scratch-storage 2.1.0 → 2.2.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/.nyc_output/f1105466-7461-4f73-8b18-ee824eb652b1.json +1 -0
- package/.nyc_output/fd8f05df-43a0-4695-b45d-f4877b37f387.json +1 -0
- package/.nyc_output/processinfo/f1105466-7461-4f73-8b18-ee824eb652b1.json +1 -0
- package/.nyc_output/processinfo/fd8f05df-43a0-4695-b45d-f4877b37f387.json +1 -0
- package/.nyc_output/processinfo/index.json +1 -0
- package/dist/node/8c63ecb0448dfbb8e804.worker.js +4187 -0
- package/dist/node/8c63ecb0448dfbb8e804.worker.js.map +1 -0
- package/dist/node/scratch-storage.js +2992 -142
- package/dist/node/scratch-storage.js.map +1 -1
- package/dist/web/90c5db0dff5ca2a36ff6.worker.js +743 -0
- package/dist/web/90c5db0dff5ca2a36ff6.worker.js.map +1 -0
- package/dist/web/scratch-storage.js +1208 -85
- package/dist/web/scratch-storage.js.map +1 -1
- package/dist/web/scratch-storage.min.js +1208 -85
- package/dist/web/scratch-storage.min.js.map +1 -1
- package/package.json +9 -4
- package/src/FetchTool.js +17 -13
- package/src/FetchWorkerTool.js +21 -7
- package/src/FetchWorkerTool.worker.js +6 -10
- package/src/ScratchStorage.js +9 -0
- package/src/scratchFetch.js +113 -0
- package/test/mocks/mock-fetch.js +69 -0
- package/test/unit/fetch-tool.js +23 -43
- package/test/unit/metadata.js +147 -0
- package/webpack.config.js +9 -8
- package/dist/node/f98711f696b187f5e007.worker.js +0 -1906
- package/dist/node/f98711f696b187f5e007.worker.js.map +0 -1
- package/dist/web/01b4fbd4d14a4f22cab8.worker.js +0 -190
- package/dist/web/01b4fbd4d14a4f22cab8.worker.js.map +0 -1
|
@@ -96,6 +96,381 @@ return /******/ (function(modules) { // webpackBootstrap
|
|
|
96
96
|
/************************************************************************/
|
|
97
97
|
/******/ ({
|
|
98
98
|
|
|
99
|
+
/***/ "./node_modules/@babel/runtime/helpers/arrayLikeToArray.js":
|
|
100
|
+
/*!*****************************************************************!*\
|
|
101
|
+
!*** ./node_modules/@babel/runtime/helpers/arrayLikeToArray.js ***!
|
|
102
|
+
\*****************************************************************/
|
|
103
|
+
/*! no static exports found */
|
|
104
|
+
/***/ (function(module, exports) {
|
|
105
|
+
|
|
106
|
+
function _arrayLikeToArray(arr, len) {
|
|
107
|
+
if (len == null || len > arr.length) len = arr.length;
|
|
108
|
+
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
109
|
+
return arr2;
|
|
110
|
+
}
|
|
111
|
+
module.exports = _arrayLikeToArray, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
112
|
+
|
|
113
|
+
/***/ }),
|
|
114
|
+
|
|
115
|
+
/***/ "./node_modules/@babel/runtime/helpers/arrayWithHoles.js":
|
|
116
|
+
/*!***************************************************************!*\
|
|
117
|
+
!*** ./node_modules/@babel/runtime/helpers/arrayWithHoles.js ***!
|
|
118
|
+
\***************************************************************/
|
|
119
|
+
/*! no static exports found */
|
|
120
|
+
/***/ (function(module, exports) {
|
|
121
|
+
|
|
122
|
+
function _arrayWithHoles(arr) {
|
|
123
|
+
if (Array.isArray(arr)) return arr;
|
|
124
|
+
}
|
|
125
|
+
module.exports = _arrayWithHoles, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
126
|
+
|
|
127
|
+
/***/ }),
|
|
128
|
+
|
|
129
|
+
/***/ "./node_modules/@babel/runtime/helpers/assertThisInitialized.js":
|
|
130
|
+
/*!**********************************************************************!*\
|
|
131
|
+
!*** ./node_modules/@babel/runtime/helpers/assertThisInitialized.js ***!
|
|
132
|
+
\**********************************************************************/
|
|
133
|
+
/*! no static exports found */
|
|
134
|
+
/***/ (function(module, exports) {
|
|
135
|
+
|
|
136
|
+
function _assertThisInitialized(self) {
|
|
137
|
+
if (self === void 0) {
|
|
138
|
+
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
139
|
+
}
|
|
140
|
+
return self;
|
|
141
|
+
}
|
|
142
|
+
module.exports = _assertThisInitialized, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
143
|
+
|
|
144
|
+
/***/ }),
|
|
145
|
+
|
|
146
|
+
/***/ "./node_modules/@babel/runtime/helpers/classCallCheck.js":
|
|
147
|
+
/*!***************************************************************!*\
|
|
148
|
+
!*** ./node_modules/@babel/runtime/helpers/classCallCheck.js ***!
|
|
149
|
+
\***************************************************************/
|
|
150
|
+
/*! no static exports found */
|
|
151
|
+
/***/ (function(module, exports) {
|
|
152
|
+
|
|
153
|
+
function _classCallCheck(instance, Constructor) {
|
|
154
|
+
if (!(instance instanceof Constructor)) {
|
|
155
|
+
throw new TypeError("Cannot call a class as a function");
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
module.exports = _classCallCheck, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
159
|
+
|
|
160
|
+
/***/ }),
|
|
161
|
+
|
|
162
|
+
/***/ "./node_modules/@babel/runtime/helpers/createClass.js":
|
|
163
|
+
/*!************************************************************!*\
|
|
164
|
+
!*** ./node_modules/@babel/runtime/helpers/createClass.js ***!
|
|
165
|
+
\************************************************************/
|
|
166
|
+
/*! no static exports found */
|
|
167
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
168
|
+
|
|
169
|
+
var toPropertyKey = __webpack_require__(/*! ./toPropertyKey.js */ "./node_modules/@babel/runtime/helpers/toPropertyKey.js");
|
|
170
|
+
function _defineProperties(target, props) {
|
|
171
|
+
for (var i = 0; i < props.length; i++) {
|
|
172
|
+
var descriptor = props[i];
|
|
173
|
+
descriptor.enumerable = descriptor.enumerable || false;
|
|
174
|
+
descriptor.configurable = true;
|
|
175
|
+
if ("value" in descriptor) descriptor.writable = true;
|
|
176
|
+
Object.defineProperty(target, toPropertyKey(descriptor.key), descriptor);
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
function _createClass(Constructor, protoProps, staticProps) {
|
|
180
|
+
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
181
|
+
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
182
|
+
Object.defineProperty(Constructor, "prototype", {
|
|
183
|
+
writable: false
|
|
184
|
+
});
|
|
185
|
+
return Constructor;
|
|
186
|
+
}
|
|
187
|
+
module.exports = _createClass, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
188
|
+
|
|
189
|
+
/***/ }),
|
|
190
|
+
|
|
191
|
+
/***/ "./node_modules/@babel/runtime/helpers/getPrototypeOf.js":
|
|
192
|
+
/*!***************************************************************!*\
|
|
193
|
+
!*** ./node_modules/@babel/runtime/helpers/getPrototypeOf.js ***!
|
|
194
|
+
\***************************************************************/
|
|
195
|
+
/*! no static exports found */
|
|
196
|
+
/***/ (function(module, exports) {
|
|
197
|
+
|
|
198
|
+
function _getPrototypeOf(o) {
|
|
199
|
+
module.exports = _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) {
|
|
200
|
+
return o.__proto__ || Object.getPrototypeOf(o);
|
|
201
|
+
}, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
202
|
+
return _getPrototypeOf(o);
|
|
203
|
+
}
|
|
204
|
+
module.exports = _getPrototypeOf, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
205
|
+
|
|
206
|
+
/***/ }),
|
|
207
|
+
|
|
208
|
+
/***/ "./node_modules/@babel/runtime/helpers/inherits.js":
|
|
209
|
+
/*!*********************************************************!*\
|
|
210
|
+
!*** ./node_modules/@babel/runtime/helpers/inherits.js ***!
|
|
211
|
+
\*********************************************************/
|
|
212
|
+
/*! no static exports found */
|
|
213
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
214
|
+
|
|
215
|
+
var setPrototypeOf = __webpack_require__(/*! ./setPrototypeOf.js */ "./node_modules/@babel/runtime/helpers/setPrototypeOf.js");
|
|
216
|
+
function _inherits(subClass, superClass) {
|
|
217
|
+
if (typeof superClass !== "function" && superClass !== null) {
|
|
218
|
+
throw new TypeError("Super expression must either be null or a function");
|
|
219
|
+
}
|
|
220
|
+
subClass.prototype = Object.create(superClass && superClass.prototype, {
|
|
221
|
+
constructor: {
|
|
222
|
+
value: subClass,
|
|
223
|
+
writable: true,
|
|
224
|
+
configurable: true
|
|
225
|
+
}
|
|
226
|
+
});
|
|
227
|
+
Object.defineProperty(subClass, "prototype", {
|
|
228
|
+
writable: false
|
|
229
|
+
});
|
|
230
|
+
if (superClass) setPrototypeOf(subClass, superClass);
|
|
231
|
+
}
|
|
232
|
+
module.exports = _inherits, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
233
|
+
|
|
234
|
+
/***/ }),
|
|
235
|
+
|
|
236
|
+
/***/ "./node_modules/@babel/runtime/helpers/iterableToArrayLimit.js":
|
|
237
|
+
/*!*********************************************************************!*\
|
|
238
|
+
!*** ./node_modules/@babel/runtime/helpers/iterableToArrayLimit.js ***!
|
|
239
|
+
\*********************************************************************/
|
|
240
|
+
/*! no static exports found */
|
|
241
|
+
/***/ (function(module, exports) {
|
|
242
|
+
|
|
243
|
+
function _iterableToArrayLimit(arr, i) {
|
|
244
|
+
var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"];
|
|
245
|
+
if (null != _i) {
|
|
246
|
+
var _s,
|
|
247
|
+
_e,
|
|
248
|
+
_x,
|
|
249
|
+
_r,
|
|
250
|
+
_arr = [],
|
|
251
|
+
_n = !0,
|
|
252
|
+
_d = !1;
|
|
253
|
+
try {
|
|
254
|
+
if (_x = (_i = _i.call(arr)).next, 0 === i) {
|
|
255
|
+
if (Object(_i) !== _i) return;
|
|
256
|
+
_n = !1;
|
|
257
|
+
} else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0);
|
|
258
|
+
} catch (err) {
|
|
259
|
+
_d = !0, _e = err;
|
|
260
|
+
} finally {
|
|
261
|
+
try {
|
|
262
|
+
if (!_n && null != _i["return"] && (_r = _i["return"](), Object(_r) !== _r)) return;
|
|
263
|
+
} finally {
|
|
264
|
+
if (_d) throw _e;
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
return _arr;
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
module.exports = _iterableToArrayLimit, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
271
|
+
|
|
272
|
+
/***/ }),
|
|
273
|
+
|
|
274
|
+
/***/ "./node_modules/@babel/runtime/helpers/nonIterableRest.js":
|
|
275
|
+
/*!****************************************************************!*\
|
|
276
|
+
!*** ./node_modules/@babel/runtime/helpers/nonIterableRest.js ***!
|
|
277
|
+
\****************************************************************/
|
|
278
|
+
/*! no static exports found */
|
|
279
|
+
/***/ (function(module, exports) {
|
|
280
|
+
|
|
281
|
+
function _nonIterableRest() {
|
|
282
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
283
|
+
}
|
|
284
|
+
module.exports = _nonIterableRest, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
285
|
+
|
|
286
|
+
/***/ }),
|
|
287
|
+
|
|
288
|
+
/***/ "./node_modules/@babel/runtime/helpers/objectWithoutProperties.js":
|
|
289
|
+
/*!************************************************************************!*\
|
|
290
|
+
!*** ./node_modules/@babel/runtime/helpers/objectWithoutProperties.js ***!
|
|
291
|
+
\************************************************************************/
|
|
292
|
+
/*! no static exports found */
|
|
293
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
294
|
+
|
|
295
|
+
var objectWithoutPropertiesLoose = __webpack_require__(/*! ./objectWithoutPropertiesLoose.js */ "./node_modules/@babel/runtime/helpers/objectWithoutPropertiesLoose.js");
|
|
296
|
+
function _objectWithoutProperties(source, excluded) {
|
|
297
|
+
if (source == null) return {};
|
|
298
|
+
var target = objectWithoutPropertiesLoose(source, excluded);
|
|
299
|
+
var key, i;
|
|
300
|
+
if (Object.getOwnPropertySymbols) {
|
|
301
|
+
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
|
|
302
|
+
for (i = 0; i < sourceSymbolKeys.length; i++) {
|
|
303
|
+
key = sourceSymbolKeys[i];
|
|
304
|
+
if (excluded.indexOf(key) >= 0) continue;
|
|
305
|
+
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
|
|
306
|
+
target[key] = source[key];
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
return target;
|
|
310
|
+
}
|
|
311
|
+
module.exports = _objectWithoutProperties, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
312
|
+
|
|
313
|
+
/***/ }),
|
|
314
|
+
|
|
315
|
+
/***/ "./node_modules/@babel/runtime/helpers/objectWithoutPropertiesLoose.js":
|
|
316
|
+
/*!*****************************************************************************!*\
|
|
317
|
+
!*** ./node_modules/@babel/runtime/helpers/objectWithoutPropertiesLoose.js ***!
|
|
318
|
+
\*****************************************************************************/
|
|
319
|
+
/*! no static exports found */
|
|
320
|
+
/***/ (function(module, exports) {
|
|
321
|
+
|
|
322
|
+
function _objectWithoutPropertiesLoose(source, excluded) {
|
|
323
|
+
if (source == null) return {};
|
|
324
|
+
var target = {};
|
|
325
|
+
var sourceKeys = Object.keys(source);
|
|
326
|
+
var key, i;
|
|
327
|
+
for (i = 0; i < sourceKeys.length; i++) {
|
|
328
|
+
key = sourceKeys[i];
|
|
329
|
+
if (excluded.indexOf(key) >= 0) continue;
|
|
330
|
+
target[key] = source[key];
|
|
331
|
+
}
|
|
332
|
+
return target;
|
|
333
|
+
}
|
|
334
|
+
module.exports = _objectWithoutPropertiesLoose, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
335
|
+
|
|
336
|
+
/***/ }),
|
|
337
|
+
|
|
338
|
+
/***/ "./node_modules/@babel/runtime/helpers/possibleConstructorReturn.js":
|
|
339
|
+
/*!**************************************************************************!*\
|
|
340
|
+
!*** ./node_modules/@babel/runtime/helpers/possibleConstructorReturn.js ***!
|
|
341
|
+
\**************************************************************************/
|
|
342
|
+
/*! no static exports found */
|
|
343
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
344
|
+
|
|
345
|
+
var _typeof = __webpack_require__(/*! ./typeof.js */ "./node_modules/@babel/runtime/helpers/typeof.js")["default"];
|
|
346
|
+
var assertThisInitialized = __webpack_require__(/*! ./assertThisInitialized.js */ "./node_modules/@babel/runtime/helpers/assertThisInitialized.js");
|
|
347
|
+
function _possibleConstructorReturn(self, call) {
|
|
348
|
+
if (call && (_typeof(call) === "object" || typeof call === "function")) {
|
|
349
|
+
return call;
|
|
350
|
+
} else if (call !== void 0) {
|
|
351
|
+
throw new TypeError("Derived constructors may only return object or undefined");
|
|
352
|
+
}
|
|
353
|
+
return assertThisInitialized(self);
|
|
354
|
+
}
|
|
355
|
+
module.exports = _possibleConstructorReturn, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
356
|
+
|
|
357
|
+
/***/ }),
|
|
358
|
+
|
|
359
|
+
/***/ "./node_modules/@babel/runtime/helpers/setPrototypeOf.js":
|
|
360
|
+
/*!***************************************************************!*\
|
|
361
|
+
!*** ./node_modules/@babel/runtime/helpers/setPrototypeOf.js ***!
|
|
362
|
+
\***************************************************************/
|
|
363
|
+
/*! no static exports found */
|
|
364
|
+
/***/ (function(module, exports) {
|
|
365
|
+
|
|
366
|
+
function _setPrototypeOf(o, p) {
|
|
367
|
+
module.exports = _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {
|
|
368
|
+
o.__proto__ = p;
|
|
369
|
+
return o;
|
|
370
|
+
}, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
371
|
+
return _setPrototypeOf(o, p);
|
|
372
|
+
}
|
|
373
|
+
module.exports = _setPrototypeOf, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
374
|
+
|
|
375
|
+
/***/ }),
|
|
376
|
+
|
|
377
|
+
/***/ "./node_modules/@babel/runtime/helpers/slicedToArray.js":
|
|
378
|
+
/*!**************************************************************!*\
|
|
379
|
+
!*** ./node_modules/@babel/runtime/helpers/slicedToArray.js ***!
|
|
380
|
+
\**************************************************************/
|
|
381
|
+
/*! no static exports found */
|
|
382
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
383
|
+
|
|
384
|
+
var arrayWithHoles = __webpack_require__(/*! ./arrayWithHoles.js */ "./node_modules/@babel/runtime/helpers/arrayWithHoles.js");
|
|
385
|
+
var iterableToArrayLimit = __webpack_require__(/*! ./iterableToArrayLimit.js */ "./node_modules/@babel/runtime/helpers/iterableToArrayLimit.js");
|
|
386
|
+
var unsupportedIterableToArray = __webpack_require__(/*! ./unsupportedIterableToArray.js */ "./node_modules/@babel/runtime/helpers/unsupportedIterableToArray.js");
|
|
387
|
+
var nonIterableRest = __webpack_require__(/*! ./nonIterableRest.js */ "./node_modules/@babel/runtime/helpers/nonIterableRest.js");
|
|
388
|
+
function _slicedToArray(arr, i) {
|
|
389
|
+
return arrayWithHoles(arr) || iterableToArrayLimit(arr, i) || unsupportedIterableToArray(arr, i) || nonIterableRest();
|
|
390
|
+
}
|
|
391
|
+
module.exports = _slicedToArray, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
392
|
+
|
|
393
|
+
/***/ }),
|
|
394
|
+
|
|
395
|
+
/***/ "./node_modules/@babel/runtime/helpers/toPrimitive.js":
|
|
396
|
+
/*!************************************************************!*\
|
|
397
|
+
!*** ./node_modules/@babel/runtime/helpers/toPrimitive.js ***!
|
|
398
|
+
\************************************************************/
|
|
399
|
+
/*! no static exports found */
|
|
400
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
401
|
+
|
|
402
|
+
var _typeof = __webpack_require__(/*! ./typeof.js */ "./node_modules/@babel/runtime/helpers/typeof.js")["default"];
|
|
403
|
+
function _toPrimitive(input, hint) {
|
|
404
|
+
if (_typeof(input) !== "object" || input === null) return input;
|
|
405
|
+
var prim = input[Symbol.toPrimitive];
|
|
406
|
+
if (prim !== undefined) {
|
|
407
|
+
var res = prim.call(input, hint || "default");
|
|
408
|
+
if (_typeof(res) !== "object") return res;
|
|
409
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
410
|
+
}
|
|
411
|
+
return (hint === "string" ? String : Number)(input);
|
|
412
|
+
}
|
|
413
|
+
module.exports = _toPrimitive, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
414
|
+
|
|
415
|
+
/***/ }),
|
|
416
|
+
|
|
417
|
+
/***/ "./node_modules/@babel/runtime/helpers/toPropertyKey.js":
|
|
418
|
+
/*!**************************************************************!*\
|
|
419
|
+
!*** ./node_modules/@babel/runtime/helpers/toPropertyKey.js ***!
|
|
420
|
+
\**************************************************************/
|
|
421
|
+
/*! no static exports found */
|
|
422
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
423
|
+
|
|
424
|
+
var _typeof = __webpack_require__(/*! ./typeof.js */ "./node_modules/@babel/runtime/helpers/typeof.js")["default"];
|
|
425
|
+
var toPrimitive = __webpack_require__(/*! ./toPrimitive.js */ "./node_modules/@babel/runtime/helpers/toPrimitive.js");
|
|
426
|
+
function _toPropertyKey(arg) {
|
|
427
|
+
var key = toPrimitive(arg, "string");
|
|
428
|
+
return _typeof(key) === "symbol" ? key : String(key);
|
|
429
|
+
}
|
|
430
|
+
module.exports = _toPropertyKey, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
431
|
+
|
|
432
|
+
/***/ }),
|
|
433
|
+
|
|
434
|
+
/***/ "./node_modules/@babel/runtime/helpers/typeof.js":
|
|
435
|
+
/*!*******************************************************!*\
|
|
436
|
+
!*** ./node_modules/@babel/runtime/helpers/typeof.js ***!
|
|
437
|
+
\*******************************************************/
|
|
438
|
+
/*! no static exports found */
|
|
439
|
+
/***/ (function(module, exports) {
|
|
440
|
+
|
|
441
|
+
function _typeof(obj) {
|
|
442
|
+
"@babel/helpers - typeof";
|
|
443
|
+
|
|
444
|
+
return (module.exports = _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
|
|
445
|
+
return typeof obj;
|
|
446
|
+
} : function (obj) {
|
|
447
|
+
return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
|
448
|
+
}, module.exports.__esModule = true, module.exports["default"] = module.exports), _typeof(obj);
|
|
449
|
+
}
|
|
450
|
+
module.exports = _typeof, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
451
|
+
|
|
452
|
+
/***/ }),
|
|
453
|
+
|
|
454
|
+
/***/ "./node_modules/@babel/runtime/helpers/unsupportedIterableToArray.js":
|
|
455
|
+
/*!***************************************************************************!*\
|
|
456
|
+
!*** ./node_modules/@babel/runtime/helpers/unsupportedIterableToArray.js ***!
|
|
457
|
+
\***************************************************************************/
|
|
458
|
+
/*! no static exports found */
|
|
459
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
460
|
+
|
|
461
|
+
var arrayLikeToArray = __webpack_require__(/*! ./arrayLikeToArray.js */ "./node_modules/@babel/runtime/helpers/arrayLikeToArray.js");
|
|
462
|
+
function _unsupportedIterableToArray(o, minLen) {
|
|
463
|
+
if (!o) return;
|
|
464
|
+
if (typeof o === "string") return arrayLikeToArray(o, minLen);
|
|
465
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
466
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
467
|
+
if (n === "Map" || n === "Set") return Array.from(o);
|
|
468
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return arrayLikeToArray(o, minLen);
|
|
469
|
+
}
|
|
470
|
+
module.exports = _unsupportedIterableToArray, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
471
|
+
|
|
472
|
+
/***/ }),
|
|
473
|
+
|
|
99
474
|
/***/ "./node_modules/arraybuffer-loader/index.js!./src/builtins/defaultBitmap.png":
|
|
100
475
|
/*!**************************************************************************!*\
|
|
101
476
|
!*** ./node_modules/arraybuffer-loader!./src/builtins/defaultBitmap.png ***!
|
|
@@ -2118,6 +2493,571 @@ function isnan (val) {
|
|
|
2118
2493
|
|
|
2119
2494
|
/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js")))
|
|
2120
2495
|
|
|
2496
|
+
/***/ }),
|
|
2497
|
+
|
|
2498
|
+
/***/ "./node_modules/cross-fetch/dist/browser-ponyfill.js":
|
|
2499
|
+
/*!***********************************************************!*\
|
|
2500
|
+
!*** ./node_modules/cross-fetch/dist/browser-ponyfill.js ***!
|
|
2501
|
+
\***********************************************************/
|
|
2502
|
+
/*! no static exports found */
|
|
2503
|
+
/***/ (function(module, exports) {
|
|
2504
|
+
|
|
2505
|
+
var global = typeof self !== 'undefined' ? self : this;
|
|
2506
|
+
var __self__ = (function () {
|
|
2507
|
+
function F() {
|
|
2508
|
+
this.fetch = false;
|
|
2509
|
+
this.DOMException = global.DOMException
|
|
2510
|
+
}
|
|
2511
|
+
F.prototype = global;
|
|
2512
|
+
return new F();
|
|
2513
|
+
})();
|
|
2514
|
+
(function(self) {
|
|
2515
|
+
|
|
2516
|
+
var irrelevant = (function (exports) {
|
|
2517
|
+
|
|
2518
|
+
var support = {
|
|
2519
|
+
searchParams: 'URLSearchParams' in self,
|
|
2520
|
+
iterable: 'Symbol' in self && 'iterator' in Symbol,
|
|
2521
|
+
blob:
|
|
2522
|
+
'FileReader' in self &&
|
|
2523
|
+
'Blob' in self &&
|
|
2524
|
+
(function() {
|
|
2525
|
+
try {
|
|
2526
|
+
new Blob();
|
|
2527
|
+
return true
|
|
2528
|
+
} catch (e) {
|
|
2529
|
+
return false
|
|
2530
|
+
}
|
|
2531
|
+
})(),
|
|
2532
|
+
formData: 'FormData' in self,
|
|
2533
|
+
arrayBuffer: 'ArrayBuffer' in self
|
|
2534
|
+
};
|
|
2535
|
+
|
|
2536
|
+
function isDataView(obj) {
|
|
2537
|
+
return obj && DataView.prototype.isPrototypeOf(obj)
|
|
2538
|
+
}
|
|
2539
|
+
|
|
2540
|
+
if (support.arrayBuffer) {
|
|
2541
|
+
var viewClasses = [
|
|
2542
|
+
'[object Int8Array]',
|
|
2543
|
+
'[object Uint8Array]',
|
|
2544
|
+
'[object Uint8ClampedArray]',
|
|
2545
|
+
'[object Int16Array]',
|
|
2546
|
+
'[object Uint16Array]',
|
|
2547
|
+
'[object Int32Array]',
|
|
2548
|
+
'[object Uint32Array]',
|
|
2549
|
+
'[object Float32Array]',
|
|
2550
|
+
'[object Float64Array]'
|
|
2551
|
+
];
|
|
2552
|
+
|
|
2553
|
+
var isArrayBufferView =
|
|
2554
|
+
ArrayBuffer.isView ||
|
|
2555
|
+
function(obj) {
|
|
2556
|
+
return obj && viewClasses.indexOf(Object.prototype.toString.call(obj)) > -1
|
|
2557
|
+
};
|
|
2558
|
+
}
|
|
2559
|
+
|
|
2560
|
+
function normalizeName(name) {
|
|
2561
|
+
if (typeof name !== 'string') {
|
|
2562
|
+
name = String(name);
|
|
2563
|
+
}
|
|
2564
|
+
if (/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(name)) {
|
|
2565
|
+
throw new TypeError('Invalid character in header field name')
|
|
2566
|
+
}
|
|
2567
|
+
return name.toLowerCase()
|
|
2568
|
+
}
|
|
2569
|
+
|
|
2570
|
+
function normalizeValue(value) {
|
|
2571
|
+
if (typeof value !== 'string') {
|
|
2572
|
+
value = String(value);
|
|
2573
|
+
}
|
|
2574
|
+
return value
|
|
2575
|
+
}
|
|
2576
|
+
|
|
2577
|
+
// Build a destructive iterator for the value list
|
|
2578
|
+
function iteratorFor(items) {
|
|
2579
|
+
var iterator = {
|
|
2580
|
+
next: function() {
|
|
2581
|
+
var value = items.shift();
|
|
2582
|
+
return {done: value === undefined, value: value}
|
|
2583
|
+
}
|
|
2584
|
+
};
|
|
2585
|
+
|
|
2586
|
+
if (support.iterable) {
|
|
2587
|
+
iterator[Symbol.iterator] = function() {
|
|
2588
|
+
return iterator
|
|
2589
|
+
};
|
|
2590
|
+
}
|
|
2591
|
+
|
|
2592
|
+
return iterator
|
|
2593
|
+
}
|
|
2594
|
+
|
|
2595
|
+
function Headers(headers) {
|
|
2596
|
+
this.map = {};
|
|
2597
|
+
|
|
2598
|
+
if (headers instanceof Headers) {
|
|
2599
|
+
headers.forEach(function(value, name) {
|
|
2600
|
+
this.append(name, value);
|
|
2601
|
+
}, this);
|
|
2602
|
+
} else if (Array.isArray(headers)) {
|
|
2603
|
+
headers.forEach(function(header) {
|
|
2604
|
+
this.append(header[0], header[1]);
|
|
2605
|
+
}, this);
|
|
2606
|
+
} else if (headers) {
|
|
2607
|
+
Object.getOwnPropertyNames(headers).forEach(function(name) {
|
|
2608
|
+
this.append(name, headers[name]);
|
|
2609
|
+
}, this);
|
|
2610
|
+
}
|
|
2611
|
+
}
|
|
2612
|
+
|
|
2613
|
+
Headers.prototype.append = function(name, value) {
|
|
2614
|
+
name = normalizeName(name);
|
|
2615
|
+
value = normalizeValue(value);
|
|
2616
|
+
var oldValue = this.map[name];
|
|
2617
|
+
this.map[name] = oldValue ? oldValue + ', ' + value : value;
|
|
2618
|
+
};
|
|
2619
|
+
|
|
2620
|
+
Headers.prototype['delete'] = function(name) {
|
|
2621
|
+
delete this.map[normalizeName(name)];
|
|
2622
|
+
};
|
|
2623
|
+
|
|
2624
|
+
Headers.prototype.get = function(name) {
|
|
2625
|
+
name = normalizeName(name);
|
|
2626
|
+
return this.has(name) ? this.map[name] : null
|
|
2627
|
+
};
|
|
2628
|
+
|
|
2629
|
+
Headers.prototype.has = function(name) {
|
|
2630
|
+
return this.map.hasOwnProperty(normalizeName(name))
|
|
2631
|
+
};
|
|
2632
|
+
|
|
2633
|
+
Headers.prototype.set = function(name, value) {
|
|
2634
|
+
this.map[normalizeName(name)] = normalizeValue(value);
|
|
2635
|
+
};
|
|
2636
|
+
|
|
2637
|
+
Headers.prototype.forEach = function(callback, thisArg) {
|
|
2638
|
+
for (var name in this.map) {
|
|
2639
|
+
if (this.map.hasOwnProperty(name)) {
|
|
2640
|
+
callback.call(thisArg, this.map[name], name, this);
|
|
2641
|
+
}
|
|
2642
|
+
}
|
|
2643
|
+
};
|
|
2644
|
+
|
|
2645
|
+
Headers.prototype.keys = function() {
|
|
2646
|
+
var items = [];
|
|
2647
|
+
this.forEach(function(value, name) {
|
|
2648
|
+
items.push(name);
|
|
2649
|
+
});
|
|
2650
|
+
return iteratorFor(items)
|
|
2651
|
+
};
|
|
2652
|
+
|
|
2653
|
+
Headers.prototype.values = function() {
|
|
2654
|
+
var items = [];
|
|
2655
|
+
this.forEach(function(value) {
|
|
2656
|
+
items.push(value);
|
|
2657
|
+
});
|
|
2658
|
+
return iteratorFor(items)
|
|
2659
|
+
};
|
|
2660
|
+
|
|
2661
|
+
Headers.prototype.entries = function() {
|
|
2662
|
+
var items = [];
|
|
2663
|
+
this.forEach(function(value, name) {
|
|
2664
|
+
items.push([name, value]);
|
|
2665
|
+
});
|
|
2666
|
+
return iteratorFor(items)
|
|
2667
|
+
};
|
|
2668
|
+
|
|
2669
|
+
if (support.iterable) {
|
|
2670
|
+
Headers.prototype[Symbol.iterator] = Headers.prototype.entries;
|
|
2671
|
+
}
|
|
2672
|
+
|
|
2673
|
+
function consumed(body) {
|
|
2674
|
+
if (body.bodyUsed) {
|
|
2675
|
+
return Promise.reject(new TypeError('Already read'))
|
|
2676
|
+
}
|
|
2677
|
+
body.bodyUsed = true;
|
|
2678
|
+
}
|
|
2679
|
+
|
|
2680
|
+
function fileReaderReady(reader) {
|
|
2681
|
+
return new Promise(function(resolve, reject) {
|
|
2682
|
+
reader.onload = function() {
|
|
2683
|
+
resolve(reader.result);
|
|
2684
|
+
};
|
|
2685
|
+
reader.onerror = function() {
|
|
2686
|
+
reject(reader.error);
|
|
2687
|
+
};
|
|
2688
|
+
})
|
|
2689
|
+
}
|
|
2690
|
+
|
|
2691
|
+
function readBlobAsArrayBuffer(blob) {
|
|
2692
|
+
var reader = new FileReader();
|
|
2693
|
+
var promise = fileReaderReady(reader);
|
|
2694
|
+
reader.readAsArrayBuffer(blob);
|
|
2695
|
+
return promise
|
|
2696
|
+
}
|
|
2697
|
+
|
|
2698
|
+
function readBlobAsText(blob) {
|
|
2699
|
+
var reader = new FileReader();
|
|
2700
|
+
var promise = fileReaderReady(reader);
|
|
2701
|
+
reader.readAsText(blob);
|
|
2702
|
+
return promise
|
|
2703
|
+
}
|
|
2704
|
+
|
|
2705
|
+
function readArrayBufferAsText(buf) {
|
|
2706
|
+
var view = new Uint8Array(buf);
|
|
2707
|
+
var chars = new Array(view.length);
|
|
2708
|
+
|
|
2709
|
+
for (var i = 0; i < view.length; i++) {
|
|
2710
|
+
chars[i] = String.fromCharCode(view[i]);
|
|
2711
|
+
}
|
|
2712
|
+
return chars.join('')
|
|
2713
|
+
}
|
|
2714
|
+
|
|
2715
|
+
function bufferClone(buf) {
|
|
2716
|
+
if (buf.slice) {
|
|
2717
|
+
return buf.slice(0)
|
|
2718
|
+
} else {
|
|
2719
|
+
var view = new Uint8Array(buf.byteLength);
|
|
2720
|
+
view.set(new Uint8Array(buf));
|
|
2721
|
+
return view.buffer
|
|
2722
|
+
}
|
|
2723
|
+
}
|
|
2724
|
+
|
|
2725
|
+
function Body() {
|
|
2726
|
+
this.bodyUsed = false;
|
|
2727
|
+
|
|
2728
|
+
this._initBody = function(body) {
|
|
2729
|
+
this._bodyInit = body;
|
|
2730
|
+
if (!body) {
|
|
2731
|
+
this._bodyText = '';
|
|
2732
|
+
} else if (typeof body === 'string') {
|
|
2733
|
+
this._bodyText = body;
|
|
2734
|
+
} else if (support.blob && Blob.prototype.isPrototypeOf(body)) {
|
|
2735
|
+
this._bodyBlob = body;
|
|
2736
|
+
} else if (support.formData && FormData.prototype.isPrototypeOf(body)) {
|
|
2737
|
+
this._bodyFormData = body;
|
|
2738
|
+
} else if (support.searchParams && URLSearchParams.prototype.isPrototypeOf(body)) {
|
|
2739
|
+
this._bodyText = body.toString();
|
|
2740
|
+
} else if (support.arrayBuffer && support.blob && isDataView(body)) {
|
|
2741
|
+
this._bodyArrayBuffer = bufferClone(body.buffer);
|
|
2742
|
+
// IE 10-11 can't handle a DataView body.
|
|
2743
|
+
this._bodyInit = new Blob([this._bodyArrayBuffer]);
|
|
2744
|
+
} else if (support.arrayBuffer && (ArrayBuffer.prototype.isPrototypeOf(body) || isArrayBufferView(body))) {
|
|
2745
|
+
this._bodyArrayBuffer = bufferClone(body);
|
|
2746
|
+
} else {
|
|
2747
|
+
this._bodyText = body = Object.prototype.toString.call(body);
|
|
2748
|
+
}
|
|
2749
|
+
|
|
2750
|
+
if (!this.headers.get('content-type')) {
|
|
2751
|
+
if (typeof body === 'string') {
|
|
2752
|
+
this.headers.set('content-type', 'text/plain;charset=UTF-8');
|
|
2753
|
+
} else if (this._bodyBlob && this._bodyBlob.type) {
|
|
2754
|
+
this.headers.set('content-type', this._bodyBlob.type);
|
|
2755
|
+
} else if (support.searchParams && URLSearchParams.prototype.isPrototypeOf(body)) {
|
|
2756
|
+
this.headers.set('content-type', 'application/x-www-form-urlencoded;charset=UTF-8');
|
|
2757
|
+
}
|
|
2758
|
+
}
|
|
2759
|
+
};
|
|
2760
|
+
|
|
2761
|
+
if (support.blob) {
|
|
2762
|
+
this.blob = function() {
|
|
2763
|
+
var rejected = consumed(this);
|
|
2764
|
+
if (rejected) {
|
|
2765
|
+
return rejected
|
|
2766
|
+
}
|
|
2767
|
+
|
|
2768
|
+
if (this._bodyBlob) {
|
|
2769
|
+
return Promise.resolve(this._bodyBlob)
|
|
2770
|
+
} else if (this._bodyArrayBuffer) {
|
|
2771
|
+
return Promise.resolve(new Blob([this._bodyArrayBuffer]))
|
|
2772
|
+
} else if (this._bodyFormData) {
|
|
2773
|
+
throw new Error('could not read FormData body as blob')
|
|
2774
|
+
} else {
|
|
2775
|
+
return Promise.resolve(new Blob([this._bodyText]))
|
|
2776
|
+
}
|
|
2777
|
+
};
|
|
2778
|
+
|
|
2779
|
+
this.arrayBuffer = function() {
|
|
2780
|
+
if (this._bodyArrayBuffer) {
|
|
2781
|
+
return consumed(this) || Promise.resolve(this._bodyArrayBuffer)
|
|
2782
|
+
} else {
|
|
2783
|
+
return this.blob().then(readBlobAsArrayBuffer)
|
|
2784
|
+
}
|
|
2785
|
+
};
|
|
2786
|
+
}
|
|
2787
|
+
|
|
2788
|
+
this.text = function() {
|
|
2789
|
+
var rejected = consumed(this);
|
|
2790
|
+
if (rejected) {
|
|
2791
|
+
return rejected
|
|
2792
|
+
}
|
|
2793
|
+
|
|
2794
|
+
if (this._bodyBlob) {
|
|
2795
|
+
return readBlobAsText(this._bodyBlob)
|
|
2796
|
+
} else if (this._bodyArrayBuffer) {
|
|
2797
|
+
return Promise.resolve(readArrayBufferAsText(this._bodyArrayBuffer))
|
|
2798
|
+
} else if (this._bodyFormData) {
|
|
2799
|
+
throw new Error('could not read FormData body as text')
|
|
2800
|
+
} else {
|
|
2801
|
+
return Promise.resolve(this._bodyText)
|
|
2802
|
+
}
|
|
2803
|
+
};
|
|
2804
|
+
|
|
2805
|
+
if (support.formData) {
|
|
2806
|
+
this.formData = function() {
|
|
2807
|
+
return this.text().then(decode)
|
|
2808
|
+
};
|
|
2809
|
+
}
|
|
2810
|
+
|
|
2811
|
+
this.json = function() {
|
|
2812
|
+
return this.text().then(JSON.parse)
|
|
2813
|
+
};
|
|
2814
|
+
|
|
2815
|
+
return this
|
|
2816
|
+
}
|
|
2817
|
+
|
|
2818
|
+
// HTTP methods whose capitalization should be normalized
|
|
2819
|
+
var methods = ['DELETE', 'GET', 'HEAD', 'OPTIONS', 'POST', 'PUT'];
|
|
2820
|
+
|
|
2821
|
+
function normalizeMethod(method) {
|
|
2822
|
+
var upcased = method.toUpperCase();
|
|
2823
|
+
return methods.indexOf(upcased) > -1 ? upcased : method
|
|
2824
|
+
}
|
|
2825
|
+
|
|
2826
|
+
function Request(input, options) {
|
|
2827
|
+
options = options || {};
|
|
2828
|
+
var body = options.body;
|
|
2829
|
+
|
|
2830
|
+
if (input instanceof Request) {
|
|
2831
|
+
if (input.bodyUsed) {
|
|
2832
|
+
throw new TypeError('Already read')
|
|
2833
|
+
}
|
|
2834
|
+
this.url = input.url;
|
|
2835
|
+
this.credentials = input.credentials;
|
|
2836
|
+
if (!options.headers) {
|
|
2837
|
+
this.headers = new Headers(input.headers);
|
|
2838
|
+
}
|
|
2839
|
+
this.method = input.method;
|
|
2840
|
+
this.mode = input.mode;
|
|
2841
|
+
this.signal = input.signal;
|
|
2842
|
+
if (!body && input._bodyInit != null) {
|
|
2843
|
+
body = input._bodyInit;
|
|
2844
|
+
input.bodyUsed = true;
|
|
2845
|
+
}
|
|
2846
|
+
} else {
|
|
2847
|
+
this.url = String(input);
|
|
2848
|
+
}
|
|
2849
|
+
|
|
2850
|
+
this.credentials = options.credentials || this.credentials || 'same-origin';
|
|
2851
|
+
if (options.headers || !this.headers) {
|
|
2852
|
+
this.headers = new Headers(options.headers);
|
|
2853
|
+
}
|
|
2854
|
+
this.method = normalizeMethod(options.method || this.method || 'GET');
|
|
2855
|
+
this.mode = options.mode || this.mode || null;
|
|
2856
|
+
this.signal = options.signal || this.signal;
|
|
2857
|
+
this.referrer = null;
|
|
2858
|
+
|
|
2859
|
+
if ((this.method === 'GET' || this.method === 'HEAD') && body) {
|
|
2860
|
+
throw new TypeError('Body not allowed for GET or HEAD requests')
|
|
2861
|
+
}
|
|
2862
|
+
this._initBody(body);
|
|
2863
|
+
}
|
|
2864
|
+
|
|
2865
|
+
Request.prototype.clone = function() {
|
|
2866
|
+
return new Request(this, {body: this._bodyInit})
|
|
2867
|
+
};
|
|
2868
|
+
|
|
2869
|
+
function decode(body) {
|
|
2870
|
+
var form = new FormData();
|
|
2871
|
+
body
|
|
2872
|
+
.trim()
|
|
2873
|
+
.split('&')
|
|
2874
|
+
.forEach(function(bytes) {
|
|
2875
|
+
if (bytes) {
|
|
2876
|
+
var split = bytes.split('=');
|
|
2877
|
+
var name = split.shift().replace(/\+/g, ' ');
|
|
2878
|
+
var value = split.join('=').replace(/\+/g, ' ');
|
|
2879
|
+
form.append(decodeURIComponent(name), decodeURIComponent(value));
|
|
2880
|
+
}
|
|
2881
|
+
});
|
|
2882
|
+
return form
|
|
2883
|
+
}
|
|
2884
|
+
|
|
2885
|
+
function parseHeaders(rawHeaders) {
|
|
2886
|
+
var headers = new Headers();
|
|
2887
|
+
// Replace instances of \r\n and \n followed by at least one space or horizontal tab with a space
|
|
2888
|
+
// https://tools.ietf.org/html/rfc7230#section-3.2
|
|
2889
|
+
var preProcessedHeaders = rawHeaders.replace(/\r?\n[\t ]+/g, ' ');
|
|
2890
|
+
preProcessedHeaders.split(/\r?\n/).forEach(function(line) {
|
|
2891
|
+
var parts = line.split(':');
|
|
2892
|
+
var key = parts.shift().trim();
|
|
2893
|
+
if (key) {
|
|
2894
|
+
var value = parts.join(':').trim();
|
|
2895
|
+
headers.append(key, value);
|
|
2896
|
+
}
|
|
2897
|
+
});
|
|
2898
|
+
return headers
|
|
2899
|
+
}
|
|
2900
|
+
|
|
2901
|
+
Body.call(Request.prototype);
|
|
2902
|
+
|
|
2903
|
+
function Response(bodyInit, options) {
|
|
2904
|
+
if (!options) {
|
|
2905
|
+
options = {};
|
|
2906
|
+
}
|
|
2907
|
+
|
|
2908
|
+
this.type = 'default';
|
|
2909
|
+
this.status = options.status === undefined ? 200 : options.status;
|
|
2910
|
+
this.ok = this.status >= 200 && this.status < 300;
|
|
2911
|
+
this.statusText = 'statusText' in options ? options.statusText : 'OK';
|
|
2912
|
+
this.headers = new Headers(options.headers);
|
|
2913
|
+
this.url = options.url || '';
|
|
2914
|
+
this._initBody(bodyInit);
|
|
2915
|
+
}
|
|
2916
|
+
|
|
2917
|
+
Body.call(Response.prototype);
|
|
2918
|
+
|
|
2919
|
+
Response.prototype.clone = function() {
|
|
2920
|
+
return new Response(this._bodyInit, {
|
|
2921
|
+
status: this.status,
|
|
2922
|
+
statusText: this.statusText,
|
|
2923
|
+
headers: new Headers(this.headers),
|
|
2924
|
+
url: this.url
|
|
2925
|
+
})
|
|
2926
|
+
};
|
|
2927
|
+
|
|
2928
|
+
Response.error = function() {
|
|
2929
|
+
var response = new Response(null, {status: 0, statusText: ''});
|
|
2930
|
+
response.type = 'error';
|
|
2931
|
+
return response
|
|
2932
|
+
};
|
|
2933
|
+
|
|
2934
|
+
var redirectStatuses = [301, 302, 303, 307, 308];
|
|
2935
|
+
|
|
2936
|
+
Response.redirect = function(url, status) {
|
|
2937
|
+
if (redirectStatuses.indexOf(status) === -1) {
|
|
2938
|
+
throw new RangeError('Invalid status code')
|
|
2939
|
+
}
|
|
2940
|
+
|
|
2941
|
+
return new Response(null, {status: status, headers: {location: url}})
|
|
2942
|
+
};
|
|
2943
|
+
|
|
2944
|
+
exports.DOMException = self.DOMException;
|
|
2945
|
+
try {
|
|
2946
|
+
new exports.DOMException();
|
|
2947
|
+
} catch (err) {
|
|
2948
|
+
exports.DOMException = function(message, name) {
|
|
2949
|
+
this.message = message;
|
|
2950
|
+
this.name = name;
|
|
2951
|
+
var error = Error(message);
|
|
2952
|
+
this.stack = error.stack;
|
|
2953
|
+
};
|
|
2954
|
+
exports.DOMException.prototype = Object.create(Error.prototype);
|
|
2955
|
+
exports.DOMException.prototype.constructor = exports.DOMException;
|
|
2956
|
+
}
|
|
2957
|
+
|
|
2958
|
+
function fetch(input, init) {
|
|
2959
|
+
return new Promise(function(resolve, reject) {
|
|
2960
|
+
var request = new Request(input, init);
|
|
2961
|
+
|
|
2962
|
+
if (request.signal && request.signal.aborted) {
|
|
2963
|
+
return reject(new exports.DOMException('Aborted', 'AbortError'))
|
|
2964
|
+
}
|
|
2965
|
+
|
|
2966
|
+
var xhr = new XMLHttpRequest();
|
|
2967
|
+
|
|
2968
|
+
function abortXhr() {
|
|
2969
|
+
xhr.abort();
|
|
2970
|
+
}
|
|
2971
|
+
|
|
2972
|
+
xhr.onload = function() {
|
|
2973
|
+
var options = {
|
|
2974
|
+
status: xhr.status,
|
|
2975
|
+
statusText: xhr.statusText,
|
|
2976
|
+
headers: parseHeaders(xhr.getAllResponseHeaders() || '')
|
|
2977
|
+
};
|
|
2978
|
+
options.url = 'responseURL' in xhr ? xhr.responseURL : options.headers.get('X-Request-URL');
|
|
2979
|
+
var body = 'response' in xhr ? xhr.response : xhr.responseText;
|
|
2980
|
+
resolve(new Response(body, options));
|
|
2981
|
+
};
|
|
2982
|
+
|
|
2983
|
+
xhr.onerror = function() {
|
|
2984
|
+
reject(new TypeError('Network request failed'));
|
|
2985
|
+
};
|
|
2986
|
+
|
|
2987
|
+
xhr.ontimeout = function() {
|
|
2988
|
+
reject(new TypeError('Network request failed'));
|
|
2989
|
+
};
|
|
2990
|
+
|
|
2991
|
+
xhr.onabort = function() {
|
|
2992
|
+
reject(new exports.DOMException('Aborted', 'AbortError'));
|
|
2993
|
+
};
|
|
2994
|
+
|
|
2995
|
+
xhr.open(request.method, request.url, true);
|
|
2996
|
+
|
|
2997
|
+
if (request.credentials === 'include') {
|
|
2998
|
+
xhr.withCredentials = true;
|
|
2999
|
+
} else if (request.credentials === 'omit') {
|
|
3000
|
+
xhr.withCredentials = false;
|
|
3001
|
+
}
|
|
3002
|
+
|
|
3003
|
+
if ('responseType' in xhr && support.blob) {
|
|
3004
|
+
xhr.responseType = 'blob';
|
|
3005
|
+
}
|
|
3006
|
+
|
|
3007
|
+
request.headers.forEach(function(value, name) {
|
|
3008
|
+
xhr.setRequestHeader(name, value);
|
|
3009
|
+
});
|
|
3010
|
+
|
|
3011
|
+
if (request.signal) {
|
|
3012
|
+
request.signal.addEventListener('abort', abortXhr);
|
|
3013
|
+
|
|
3014
|
+
xhr.onreadystatechange = function() {
|
|
3015
|
+
// DONE (success or failure)
|
|
3016
|
+
if (xhr.readyState === 4) {
|
|
3017
|
+
request.signal.removeEventListener('abort', abortXhr);
|
|
3018
|
+
}
|
|
3019
|
+
};
|
|
3020
|
+
}
|
|
3021
|
+
|
|
3022
|
+
xhr.send(typeof request._bodyInit === 'undefined' ? null : request._bodyInit);
|
|
3023
|
+
})
|
|
3024
|
+
}
|
|
3025
|
+
|
|
3026
|
+
fetch.polyfill = true;
|
|
3027
|
+
|
|
3028
|
+
if (!self.fetch) {
|
|
3029
|
+
self.fetch = fetch;
|
|
3030
|
+
self.Headers = Headers;
|
|
3031
|
+
self.Request = Request;
|
|
3032
|
+
self.Response = Response;
|
|
3033
|
+
}
|
|
3034
|
+
|
|
3035
|
+
exports.Headers = Headers;
|
|
3036
|
+
exports.Request = Request;
|
|
3037
|
+
exports.Response = Response;
|
|
3038
|
+
exports.fetch = fetch;
|
|
3039
|
+
|
|
3040
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
3041
|
+
|
|
3042
|
+
return exports;
|
|
3043
|
+
|
|
3044
|
+
})({});
|
|
3045
|
+
})(__self__);
|
|
3046
|
+
__self__.fetch.ponyfill = true;
|
|
3047
|
+
// Remove "polyfill" property added by whatwg-fetch
|
|
3048
|
+
delete __self__.fetch.polyfill;
|
|
3049
|
+
// Choose between native implementation (global) or custom implementation (__self__)
|
|
3050
|
+
// var ctx = global.fetch ? global : __self__;
|
|
3051
|
+
var ctx = __self__; // this line disable service worker support temporarily
|
|
3052
|
+
exports = ctx.fetch // To enable: import fetch from 'cross-fetch'
|
|
3053
|
+
exports.default = ctx.fetch // For TypeScript consumers without esModuleInterop.
|
|
3054
|
+
exports.fetch = ctx.fetch // To enable: import {fetch} from 'cross-fetch'
|
|
3055
|
+
exports.Headers = ctx.Headers
|
|
3056
|
+
exports.Request = ctx.Request
|
|
3057
|
+
exports.Response = ctx.Response
|
|
3058
|
+
module.exports = exports
|
|
3059
|
+
|
|
3060
|
+
|
|
2121
3061
|
/***/ }),
|
|
2122
3062
|
|
|
2123
3063
|
/***/ "./node_modules/fastestsmallesttextencoderdecoder/EncoderDecoderTogether.min.js":
|
|
@@ -3790,7 +4730,7 @@ module.exports = g;
|
|
|
3790
4730
|
/***/ (function(module, exports, __webpack_require__) {
|
|
3791
4731
|
|
|
3792
4732
|
module.exports = function() {
|
|
3793
|
-
return __webpack_require__(/*! !./node_modules/worker-loader/dist/workers/InlineWorker.js */ "./node_modules/worker-loader/dist/workers/InlineWorker.js")("/******/ (function(modules) { // webpackBootstrap\n/******/ \t// The module cache\n/******/ \tvar installedModules = {};\n/******/\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n/******/\n/******/ \t\t// Check if module is in cache\n/******/ \t\tif(installedModules[moduleId]) {\n/******/ \t\t\treturn installedModules[moduleId].exports;\n/******/ \t\t}\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = installedModules[moduleId] = {\n/******/ \t\t\ti: moduleId,\n/******/ \t\t\tl: false,\n/******/ \t\t\texports: {}\n/******/ \t\t};\n/******/\n/******/ \t\t// Execute the module function\n/******/ \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n/******/\n/******/ \t\t// Flag the module as loaded\n/******/ \t\tmodule.l = true;\n/******/\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n/******/\n/******/\n/******/ \t// expose the modules object (__webpack_modules__)\n/******/ \t__webpack_require__.m = modules;\n/******/\n/******/ \t// expose the module cache\n/******/ \t__webpack_require__.c = installedModules;\n/******/\n/******/ \t// define getter function for harmony exports\n/******/ \t__webpack_require__.d = function(exports, name, getter) {\n/******/ \t\tif(!__webpack_require__.o(exports, name)) {\n/******/ \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n/******/ \t\t}\n/******/ \t};\n/******/\n/******/ \t// define __esModule on exports\n/******/ \t__webpack_require__.r = function(exports) {\n/******/ \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n/******/ \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n/******/ \t\t}\n/******/ \t\tObject.defineProperty(exports, '__esModule', { value: true });\n/******/ \t};\n/******/\n/******/ \t// create a fake namespace object\n/******/ \t// mode & 1: value is a module id, require it\n/******/ \t// mode & 2: merge all properties of value into the ns\n/******/ \t// mode & 4: return value when already ns object\n/******/ \t// mode & 8|1: behave like require\n/******/ \t__webpack_require__.t = function(value, mode) {\n/******/ \t\tif(mode & 1) value = __webpack_require__(value);\n/******/ \t\tif(mode & 8) return value;\n/******/ \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n/******/ \t\tvar ns = Object.create(null);\n/******/ \t\t__webpack_require__.r(ns);\n/******/ \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n/******/ \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n/******/ \t\treturn ns;\n/******/ \t};\n/******/\n/******/ \t// getDefaultExport function for compatibility with non-harmony modules\n/******/ \t__webpack_require__.n = function(module) {\n/******/ \t\tvar getter = module && module.__esModule ?\n/******/ \t\t\tfunction getDefault() { return module['default']; } :\n/******/ \t\t\tfunction getModuleExports() { return module; };\n/******/ \t\t__webpack_require__.d(getter, 'a', getter);\n/******/ \t\treturn getter;\n/******/ \t};\n/******/\n/******/ \t// Object.prototype.hasOwnProperty.call\n/******/ \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n/******/\n/******/ \t// __webpack_public_path__\n/******/ \t__webpack_require__.p = \"\";\n/******/\n/******/\n/******/ \t// Load entry module and return exports\n/******/ \treturn __webpack_require__(__webpack_require__.s = \"./node_modules/babel-loader/lib/index.js?!./src/FetchWorkerTool.worker.js\");\n/******/ })\n/************************************************************************/\n/******/ ({\n\n/***/ \"./node_modules/babel-loader/lib/index.js?!./src/FetchWorkerTool.worker.js\":\n/*!*******************************************************************************!*\\\n !*** ./node_modules/babel-loader/lib??ref--4!./src/FetchWorkerTool.worker.js ***!\n \\*******************************************************************************/\n/*! no static exports found */\n/***/ (function(module, exports) {\n\n/* eslint-env worker */\nvar jobsActive = 0;\nvar complete = [];\nvar intervalId = null;\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 */\n\nvar registerStep = function registerStep() {\n intervalId = setInterval(function () {\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(complete.slice(), // 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(function (response) {\n return response.buffer;\n }).filter(Boolean));\n complete.length = 0;\n }\n\n if (jobsActive === 0) {\n clearInterval(intervalId);\n intervalId = null;\n }\n }, 1);\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 */\n\n\nvar onMessage = function onMessage(_ref) {\n var job = _ref.data;\n\n if (jobsActive === 0 && !intervalId) {\n registerStep();\n }\n\n jobsActive++;\n fetch(job.url, job.options).then(function (result) {\n if (result.ok) return result.arrayBuffer();\n if (result.status === 404) return null;\n return Promise.reject(result.status);\n }).then(function (buffer) {\n return complete.push({\n id: job.id,\n buffer: buffer\n });\n }).catch(function (error) {\n return complete.push({\n id: job.id,\n error: error && error.message || \"Failed request: \".concat(job.url)\n });\n }).then(function () {\n return jobsActive--;\n });\n};\n\nif (self.fetch) {\n postMessage({\n support: {\n fetch: true\n }\n });\n self.addEventListener('message', onMessage);\n} else {\n postMessage({\n support: {\n fetch: false\n }\n });\n self.addEventListener('message', function (_ref2) {\n var job = _ref2.data;\n postMessage([{\n id: job.id,\n error: 'fetch is unavailable'\n }]);\n });\n}\n\n/***/ })\n\n/******/ });\n//# sourceMappingURL=01b4fbd4d14a4f22cab8.worker.js.map", __webpack_require__.p + "01b4fbd4d14a4f22cab8.worker.js");
|
|
4733
|
+
return __webpack_require__(/*! !./node_modules/worker-loader/dist/workers/InlineWorker.js */ "./node_modules/worker-loader/dist/workers/InlineWorker.js")("/******/ (function(modules) { // webpackBootstrap\n/******/ \t// The module cache\n/******/ \tvar installedModules = {};\n/******/\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n/******/\n/******/ \t\t// Check if module is in cache\n/******/ \t\tif(installedModules[moduleId]) {\n/******/ \t\t\treturn installedModules[moduleId].exports;\n/******/ \t\t}\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = installedModules[moduleId] = {\n/******/ \t\t\ti: moduleId,\n/******/ \t\t\tl: false,\n/******/ \t\t\texports: {}\n/******/ \t\t};\n/******/\n/******/ \t\t// Execute the module function\n/******/ \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n/******/\n/******/ \t\t// Flag the module as loaded\n/******/ \t\tmodule.l = true;\n/******/\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n/******/\n/******/\n/******/ \t// expose the modules object (__webpack_modules__)\n/******/ \t__webpack_require__.m = modules;\n/******/\n/******/ \t// expose the module cache\n/******/ \t__webpack_require__.c = installedModules;\n/******/\n/******/ \t// define getter function for harmony exports\n/******/ \t__webpack_require__.d = function(exports, name, getter) {\n/******/ \t\tif(!__webpack_require__.o(exports, name)) {\n/******/ \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n/******/ \t\t}\n/******/ \t};\n/******/\n/******/ \t// define __esModule on exports\n/******/ \t__webpack_require__.r = function(exports) {\n/******/ \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n/******/ \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n/******/ \t\t}\n/******/ \t\tObject.defineProperty(exports, '__esModule', { value: true });\n/******/ \t};\n/******/\n/******/ \t// create a fake namespace object\n/******/ \t// mode & 1: value is a module id, require it\n/******/ \t// mode & 2: merge all properties of value into the ns\n/******/ \t// mode & 4: return value when already ns object\n/******/ \t// mode & 8|1: behave like require\n/******/ \t__webpack_require__.t = function(value, mode) {\n/******/ \t\tif(mode & 1) value = __webpack_require__(value);\n/******/ \t\tif(mode & 8) return value;\n/******/ \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n/******/ \t\tvar ns = Object.create(null);\n/******/ \t\t__webpack_require__.r(ns);\n/******/ \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n/******/ \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n/******/ \t\treturn ns;\n/******/ \t};\n/******/\n/******/ \t// getDefaultExport function for compatibility with non-harmony modules\n/******/ \t__webpack_require__.n = function(module) {\n/******/ \t\tvar getter = module && module.__esModule ?\n/******/ \t\t\tfunction getDefault() { return module['default']; } :\n/******/ \t\t\tfunction getModuleExports() { return module; };\n/******/ \t\t__webpack_require__.d(getter, 'a', getter);\n/******/ \t\treturn getter;\n/******/ \t};\n/******/\n/******/ \t// Object.prototype.hasOwnProperty.call\n/******/ \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n/******/\n/******/ \t// __webpack_public_path__\n/******/ \t__webpack_require__.p = \"\";\n/******/\n/******/\n/******/ \t// Load entry module and return exports\n/******/ \treturn __webpack_require__(__webpack_require__.s = \"./node_modules/babel-loader/lib/index.js?!./src/FetchWorkerTool.worker.js\");\n/******/ })\n/************************************************************************/\n/******/ ({\n\n/***/ \"./node_modules/babel-loader/lib/index.js?!./src/FetchWorkerTool.worker.js\":\n/*!*******************************************************************************!*\\\n !*** ./node_modules/babel-loader/lib??ref--4!./src/FetchWorkerTool.worker.js ***!\n \\*******************************************************************************/\n/*! no static exports found */\n/***/ (function(module, exports, __webpack_require__) {\n\n/* eslint-env worker */\nvar crossFetch = __webpack_require__(/*! cross-fetch */ \"./node_modules/cross-fetch/dist/browser-ponyfill.js\").default;\n\nvar jobsActive = 0;\nvar complete = [];\nvar intervalId = null;\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 */\n\nvar registerStep = function registerStep() {\n intervalId = setInterval(function () {\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(complete.slice(), // 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(function (response) {\n return response.buffer;\n }).filter(Boolean));\n complete.length = 0;\n }\n\n if (jobsActive === 0) {\n clearInterval(intervalId);\n intervalId = null;\n }\n }, 1);\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 */\n\n\nvar onMessage = function onMessage(_ref) {\n var job = _ref.data;\n\n if (jobsActive === 0 && !intervalId) {\n registerStep();\n }\n\n jobsActive++;\n crossFetch(job.url, job.options).then(function (result) {\n if (result.ok) return result.arrayBuffer();\n if (result.status === 404) return null;\n return Promise.reject(result.status);\n }).then(function (buffer) {\n return complete.push({\n id: job.id,\n buffer: buffer\n });\n }).catch(function (error) {\n return complete.push({\n id: job.id,\n error: error && error.message || \"Failed request: \".concat(job.url)\n });\n }).then(function () {\n return jobsActive--;\n });\n}; // crossFetch means \"fetch\" is now always supported\n\n\npostMessage({\n support: {\n fetch: true\n }\n});\nself.addEventListener('message', onMessage);\n\n/***/ }),\n\n/***/ \"./node_modules/cross-fetch/dist/browser-ponyfill.js\":\n/*!***********************************************************!*\\\n !*** ./node_modules/cross-fetch/dist/browser-ponyfill.js ***!\n \\***********************************************************/\n/*! no static exports found */\n/***/ (function(module, exports) {\n\nvar global = typeof self !== 'undefined' ? self : this;\nvar __self__ = (function () {\nfunction F() {\nthis.fetch = false;\nthis.DOMException = global.DOMException\n}\nF.prototype = global;\nreturn new F();\n})();\n(function(self) {\n\nvar irrelevant = (function (exports) {\n\n var support = {\n searchParams: 'URLSearchParams' in self,\n iterable: 'Symbol' in self && 'iterator' in Symbol,\n blob:\n 'FileReader' in self &&\n 'Blob' in self &&\n (function() {\n try {\n new Blob();\n return true\n } catch (e) {\n return false\n }\n })(),\n formData: 'FormData' in self,\n arrayBuffer: 'ArrayBuffer' in self\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)) {\n throw new TypeError('Invalid character in header field 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 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 return consumed(this) || Promise.resolve(this._bodyArrayBuffer)\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 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\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 preProcessedHeaders.split(/\\r?\\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 (!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 = 'statusText' in options ? options.statusText : 'OK';\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 = self.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 resolve(new Response(body, options));\n };\n\n xhr.onerror = function() {\n reject(new TypeError('Network request failed'));\n };\n\n xhr.ontimeout = function() {\n reject(new TypeError('Network request failed'));\n };\n\n xhr.onabort = function() {\n reject(new exports.DOMException('Aborted', 'AbortError'));\n };\n\n xhr.open(request.method, 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 && support.blob) {\n xhr.responseType = 'blob';\n }\n\n request.headers.forEach(function(value, name) {\n xhr.setRequestHeader(name, value);\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 (!self.fetch) {\n self.fetch = fetch;\n self.Headers = Headers;\n self.Request = Request;\n self.Response = Response;\n }\n\n exports.Headers = Headers;\n exports.Request = Request;\n exports.Response = Response;\n exports.fetch = fetch;\n\n Object.defineProperty(exports, '__esModule', { value: true });\n\n return exports;\n\n})({});\n})(__self__);\n__self__.fetch.ponyfill = true;\n// Remove \"polyfill\" property added by whatwg-fetch\ndelete __self__.fetch.polyfill;\n// Choose between native implementation (global) or custom implementation (__self__)\n// var ctx = global.fetch ? global : __self__;\nvar ctx = __self__; // this line disable service worker support temporarily\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\n\n/***/ })\n\n/******/ });\n//# sourceMappingURL=90c5db0dff5ca2a36ff6.worker.js.map", __webpack_require__.p + "90c5db0dff5ca2a36ff6.worker.js");
|
|
3794
4734
|
};
|
|
3795
4735
|
|
|
3796
4736
|
/***/ }),
|
|
@@ -3850,11 +4790,9 @@ module.exports = function (content, url) {
|
|
|
3850
4790
|
/*! no static exports found */
|
|
3851
4791
|
/***/ (function(module, exports, __webpack_require__) {
|
|
3852
4792
|
|
|
3853
|
-
|
|
4793
|
+
var _classCallCheck = __webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "./node_modules/@babel/runtime/helpers/classCallCheck.js");
|
|
3854
4794
|
|
|
3855
|
-
|
|
3856
|
-
|
|
3857
|
-
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
|
4795
|
+
var _createClass = __webpack_require__(/*! @babel/runtime/helpers/createClass */ "./node_modules/@babel/runtime/helpers/createClass.js");
|
|
3858
4796
|
|
|
3859
4797
|
// Use JS implemented TextDecoder and TextEncoder if it is not provided by the
|
|
3860
4798
|
// browser.
|
|
@@ -3944,6 +4882,8 @@ var memoizedToString = function () {
|
|
|
3944
4882
|
}();
|
|
3945
4883
|
|
|
3946
4884
|
var Asset = /*#__PURE__*/function () {
|
|
4885
|
+
"use strict";
|
|
4886
|
+
|
|
3947
4887
|
/**
|
|
3948
4888
|
* Construct an Asset.
|
|
3949
4889
|
* @param {AssetType} assetType - The type of this asset (sound, image, etc.)
|
|
@@ -4090,28 +5030,20 @@ module.exports = AssetType;
|
|
|
4090
5030
|
/*! no static exports found */
|
|
4091
5031
|
/***/ (function(module, exports, __webpack_require__) {
|
|
4092
5032
|
|
|
4093
|
-
/* WEBPACK VAR INJECTION */(function(Buffer) {
|
|
5033
|
+
/* WEBPACK VAR INJECTION */(function(Buffer) {var _classCallCheck = __webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "./node_modules/@babel/runtime/helpers/classCallCheck.js");
|
|
4094
5034
|
|
|
4095
|
-
|
|
5035
|
+
var _createClass = __webpack_require__(/*! @babel/runtime/helpers/createClass */ "./node_modules/@babel/runtime/helpers/createClass.js");
|
|
4096
5036
|
|
|
4097
|
-
|
|
5037
|
+
var _inherits = __webpack_require__(/*! @babel/runtime/helpers/inherits */ "./node_modules/@babel/runtime/helpers/inherits.js");
|
|
4098
5038
|
|
|
4099
|
-
|
|
5039
|
+
var _possibleConstructorReturn = __webpack_require__(/*! @babel/runtime/helpers/possibleConstructorReturn */ "./node_modules/@babel/runtime/helpers/possibleConstructorReturn.js");
|
|
4100
5040
|
|
|
4101
|
-
|
|
4102
|
-
|
|
4103
|
-
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
5041
|
+
var _getPrototypeOf = __webpack_require__(/*! @babel/runtime/helpers/getPrototypeOf */ "./node_modules/@babel/runtime/helpers/getPrototypeOf.js");
|
|
4104
5042
|
|
|
4105
5043
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
4106
5044
|
|
|
4107
|
-
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
|
|
4108
|
-
|
|
4109
|
-
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
4110
|
-
|
|
4111
5045
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
4112
5046
|
|
|
4113
|
-
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
4114
|
-
|
|
4115
5047
|
var md5 = __webpack_require__(/*! js-md5 */ "./node_modules/js-md5/src/md5.js");
|
|
4116
5048
|
|
|
4117
5049
|
var log = __webpack_require__(/*! ./log */ "./src/log.js");
|
|
@@ -4162,6 +5094,8 @@ var DefaultAssets = [{
|
|
|
4162
5094
|
var BuiltinAssets = DefaultAssets.concat([]);
|
|
4163
5095
|
|
|
4164
5096
|
var BuiltinHelper = /*#__PURE__*/function (_Helper) {
|
|
5097
|
+
"use strict";
|
|
5098
|
+
|
|
4165
5099
|
_inherits(BuiltinHelper, _Helper);
|
|
4166
5100
|
|
|
4167
5101
|
var _super = _createSuper(BuiltinHelper);
|
|
@@ -4338,27 +5272,31 @@ module.exports = DataFormat;
|
|
|
4338
5272
|
!*** ./src/FetchTool.js ***!
|
|
4339
5273
|
\**************************/
|
|
4340
5274
|
/*! no static exports found */
|
|
4341
|
-
/***/ (function(module, exports) {
|
|
4342
|
-
|
|
4343
|
-
var _excluded = ["url"],
|
|
4344
|
-
_excluded2 = ["url", "withCredentials"];
|
|
4345
|
-
|
|
4346
|
-
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
5275
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
4347
5276
|
|
|
4348
|
-
|
|
5277
|
+
var _objectWithoutProperties = __webpack_require__(/*! @babel/runtime/helpers/objectWithoutProperties */ "./node_modules/@babel/runtime/helpers/objectWithoutProperties.js");
|
|
4349
5278
|
|
|
4350
|
-
|
|
5279
|
+
var _classCallCheck = __webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "./node_modules/@babel/runtime/helpers/classCallCheck.js");
|
|
4351
5280
|
|
|
4352
|
-
|
|
5281
|
+
var _createClass = __webpack_require__(/*! @babel/runtime/helpers/createClass */ "./node_modules/@babel/runtime/helpers/createClass.js");
|
|
4353
5282
|
|
|
4354
|
-
|
|
5283
|
+
var _excluded = ["url"],
|
|
5284
|
+
_excluded2 = ["url", "withCredentials"];
|
|
4355
5285
|
|
|
4356
|
-
|
|
5286
|
+
var _require = __webpack_require__(/*! ./scratchFetch */ "./src/scratchFetch.js"),
|
|
5287
|
+
scratchFetch = _require.scratchFetch;
|
|
5288
|
+
/**
|
|
5289
|
+
* @typedef {Request & {withCredentials: boolean}} ScratchSendRequest
|
|
5290
|
+
*/
|
|
4357
5291
|
|
|
4358
5292
|
/**
|
|
4359
5293
|
* Get and send assets with the fetch standard web api.
|
|
4360
5294
|
*/
|
|
5295
|
+
|
|
5296
|
+
|
|
4361
5297
|
var FetchTool = /*#__PURE__*/function () {
|
|
5298
|
+
"use strict";
|
|
5299
|
+
|
|
4362
5300
|
function FetchTool() {
|
|
4363
5301
|
_classCallCheck(this, FetchTool);
|
|
4364
5302
|
}
|
|
@@ -4367,17 +5305,17 @@ var FetchTool = /*#__PURE__*/function () {
|
|
|
4367
5305
|
key: "isGetSupported",
|
|
4368
5306
|
get:
|
|
4369
5307
|
/**
|
|
4370
|
-
* Is get supported?
|
|
5308
|
+
* Is get supported?
|
|
5309
|
+
* Always true for `FetchTool` because `scratchFetch` ponyfills `fetch` if necessary.
|
|
4371
5310
|
* @returns {boolean} Is get supported?
|
|
4372
5311
|
*/
|
|
4373
5312
|
function get() {
|
|
4374
|
-
return
|
|
5313
|
+
return true;
|
|
4375
5314
|
}
|
|
4376
5315
|
/**
|
|
4377
5316
|
* Request data from a server with fetch.
|
|
4378
|
-
* @param {
|
|
4379
|
-
* @
|
|
4380
|
-
* @returns {Promise.<Uint8Array>} Resolve to Buffer of data from server.
|
|
5317
|
+
* @param {Request} reqConfig - Request configuration for data to get.
|
|
5318
|
+
* @returns {Promise.<Uint8Array?>} Resolve to Buffer of data from server.
|
|
4381
5319
|
*/
|
|
4382
5320
|
|
|
4383
5321
|
}, {
|
|
@@ -4386,30 +5324,30 @@ var FetchTool = /*#__PURE__*/function () {
|
|
|
4386
5324
|
var url = _ref.url,
|
|
4387
5325
|
options = _objectWithoutProperties(_ref, _excluded);
|
|
4388
5326
|
|
|
4389
|
-
return
|
|
5327
|
+
return scratchFetch(url, Object.assign({
|
|
4390
5328
|
method: 'GET'
|
|
4391
5329
|
}, options)).then(function (result) {
|
|
4392
5330
|
if (result.ok) return result.arrayBuffer().then(function (b) {
|
|
4393
5331
|
return new Uint8Array(b);
|
|
4394
5332
|
});
|
|
4395
5333
|
if (result.status === 404) return null;
|
|
4396
|
-
return Promise.reject(result.status);
|
|
5334
|
+
return Promise.reject(result.status); // TODO: we should throw a proper error
|
|
4397
5335
|
});
|
|
4398
5336
|
}
|
|
4399
5337
|
/**
|
|
4400
|
-
* Is sending supported?
|
|
4401
|
-
*
|
|
5338
|
+
* Is sending supported?
|
|
5339
|
+
* Always true for `FetchTool` because `scratchFetch` ponyfills `fetch` if necessary.
|
|
4402
5340
|
* @returns {boolean} Is sending supported?
|
|
4403
5341
|
*/
|
|
4404
5342
|
|
|
4405
5343
|
}, {
|
|
4406
5344
|
key: "isSendSupported",
|
|
4407
5345
|
get: function get() {
|
|
4408
|
-
return
|
|
5346
|
+
return true;
|
|
4409
5347
|
}
|
|
4410
5348
|
/**
|
|
4411
5349
|
* Send data to a server with fetch.
|
|
4412
|
-
* @param {
|
|
5350
|
+
* @param {ScratchSendRequest} reqConfig - Request configuration for data to send.
|
|
4413
5351
|
* @returns {Promise.<string>} Server returned metadata.
|
|
4414
5352
|
*/
|
|
4415
5353
|
|
|
@@ -4421,7 +5359,7 @@ var FetchTool = /*#__PURE__*/function () {
|
|
|
4421
5359
|
withCredentials = _ref2$withCredentials === void 0 ? false : _ref2$withCredentials,
|
|
4422
5360
|
options = _objectWithoutProperties(_ref2, _excluded2);
|
|
4423
5361
|
|
|
4424
|
-
return
|
|
5362
|
+
return scratchFetch(url, Object.assign({
|
|
4425
5363
|
credentials: withCredentials ? 'include' : 'omit'
|
|
4426
5364
|
}, options)).then(function (response) {
|
|
4427
5365
|
if (response.ok) return response.text();
|
|
@@ -4444,11 +5382,13 @@ module.exports = FetchTool;
|
|
|
4444
5382
|
/*! no static exports found */
|
|
4445
5383
|
/***/ (function(module, exports, __webpack_require__) {
|
|
4446
5384
|
|
|
4447
|
-
var
|
|
5385
|
+
var _objectWithoutProperties = __webpack_require__(/*! @babel/runtime/helpers/objectWithoutProperties */ "./node_modules/@babel/runtime/helpers/objectWithoutProperties.js");
|
|
4448
5386
|
|
|
4449
|
-
|
|
5387
|
+
var _classCallCheck = __webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "./node_modules/@babel/runtime/helpers/classCallCheck.js");
|
|
4450
5388
|
|
|
4451
|
-
|
|
5389
|
+
var _createClass = __webpack_require__(/*! @babel/runtime/helpers/createClass */ "./node_modules/@babel/runtime/helpers/createClass.js");
|
|
5390
|
+
|
|
5391
|
+
var _excluded = ["url"];
|
|
4452
5392
|
|
|
4453
5393
|
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
4454
5394
|
|
|
@@ -4456,16 +5396,17 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
|
|
|
4456
5396
|
|
|
4457
5397
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
4458
5398
|
|
|
4459
|
-
|
|
4460
|
-
|
|
4461
|
-
|
|
4462
|
-
|
|
4463
|
-
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
|
4464
|
-
|
|
5399
|
+
var _require = __webpack_require__(/*! ./scratchFetch */ "./src/scratchFetch.js"),
|
|
5400
|
+
Headers = _require.Headers,
|
|
5401
|
+
applyMetadata = _require.applyMetadata;
|
|
4465
5402
|
/**
|
|
4466
5403
|
* Get and send assets with a worker that uses fetch.
|
|
4467
5404
|
*/
|
|
5405
|
+
|
|
5406
|
+
|
|
4468
5407
|
var PrivateFetchWorkerTool = /*#__PURE__*/function () {
|
|
5408
|
+
"use strict";
|
|
5409
|
+
|
|
4469
5410
|
function PrivateFetchWorkerTool() {
|
|
4470
5411
|
var _this = this;
|
|
4471
5412
|
|
|
@@ -4480,13 +5421,13 @@ var PrivateFetchWorkerTool = /*#__PURE__*/function () {
|
|
|
4480
5421
|
};
|
|
4481
5422
|
/**
|
|
4482
5423
|
* A possible error occurred standing up the worker.
|
|
4483
|
-
* @type {
|
|
5424
|
+
* @type {Error?}
|
|
4484
5425
|
*/
|
|
4485
5426
|
|
|
4486
5427
|
this._supportError = null;
|
|
4487
5428
|
/**
|
|
4488
5429
|
* The worker that runs fetch and returns data for us.
|
|
4489
|
-
* @type {
|
|
5430
|
+
* @type {Worker?}
|
|
4490
5431
|
*/
|
|
4491
5432
|
|
|
4492
5433
|
this.worker = null;
|
|
@@ -4502,8 +5443,8 @@ var PrivateFetchWorkerTool = /*#__PURE__*/function () {
|
|
|
4502
5443
|
// eslint-disable-next-line global-require
|
|
4503
5444
|
var FetchWorker = __webpack_require__(/*! worker-loader?{"inline":true,"fallback":true}!./FetchWorkerTool.worker */ "./node_modules/worker-loader/dist/cjs.js?{\"inline\":true,\"fallback\":true}!./src/FetchWorkerTool.worker.js");
|
|
4504
5445
|
|
|
4505
|
-
|
|
4506
|
-
|
|
5446
|
+
var worker = new FetchWorker();
|
|
5447
|
+
worker.addEventListener('message', function (_ref) {
|
|
4507
5448
|
var data = _ref.data;
|
|
4508
5449
|
|
|
4509
5450
|
if (data.support) {
|
|
@@ -4534,6 +5475,7 @@ var PrivateFetchWorkerTool = /*#__PURE__*/function () {
|
|
|
4534
5475
|
_iterator.f();
|
|
4535
5476
|
}
|
|
4536
5477
|
});
|
|
5478
|
+
this.worker = worker;
|
|
4537
5479
|
}
|
|
4538
5480
|
} catch (error) {
|
|
4539
5481
|
this._supportError = error;
|
|
@@ -4558,7 +5500,7 @@ var PrivateFetchWorkerTool = /*#__PURE__*/function () {
|
|
|
4558
5500
|
* Request data from a server with a worker using fetch.
|
|
4559
5501
|
* @param {{url:string}} reqConfig - Request configuration for data to get.
|
|
4560
5502
|
* @param {{method:string}} options - Additional options to configure fetch.
|
|
4561
|
-
* @returns {Promise.<Buffer>} Resolve to Buffer of data from server.
|
|
5503
|
+
* @returns {Promise.<Buffer|Uint8Array|null>} Resolve to Buffer of data from server.
|
|
4562
5504
|
*/
|
|
4563
5505
|
|
|
4564
5506
|
}, {
|
|
@@ -4572,13 +5514,21 @@ var PrivateFetchWorkerTool = /*#__PURE__*/function () {
|
|
|
4572
5514
|
return new Promise(function (resolve, reject) {
|
|
4573
5515
|
// TODO: Use a Scratch standard ID generator ...
|
|
4574
5516
|
var id = Math.random().toString(16).substring(2);
|
|
5517
|
+
var augmentedOptions = applyMetadata(Object.assign({
|
|
5518
|
+
method: 'GET'
|
|
5519
|
+
}, options)); // the Fetch spec says options.headers could be:
|
|
5520
|
+
// "A Headers object, an object literal, or an array of two-item arrays to set request's headers."
|
|
5521
|
+
// structured clone (postMessage) doesn't support Headers objects
|
|
5522
|
+
// so turn it into an array of two-item arrays to make it to the worker intact
|
|
5523
|
+
|
|
5524
|
+
if (augmentedOptions && augmentedOptions.headers instanceof Headers) {
|
|
5525
|
+
augmentedOptions.headers = Array.from(augmentedOptions.headers.entries());
|
|
5526
|
+
}
|
|
4575
5527
|
|
|
4576
5528
|
_this2.worker.postMessage({
|
|
4577
5529
|
id: id,
|
|
4578
5530
|
url: url,
|
|
4579
|
-
options:
|
|
4580
|
-
method: 'GET'
|
|
4581
|
-
}, options)
|
|
5531
|
+
options: augmentedOptions
|
|
4582
5532
|
});
|
|
4583
5533
|
|
|
4584
5534
|
_this2.jobs[id] = {
|
|
@@ -4637,6 +5587,8 @@ var PrivateFetchWorkerTool = /*#__PURE__*/function () {
|
|
|
4637
5587
|
|
|
4638
5588
|
|
|
4639
5589
|
var PublicFetchWorkerTool = /*#__PURE__*/function () {
|
|
5590
|
+
"use strict";
|
|
5591
|
+
|
|
4640
5592
|
function PublicFetchWorkerTool() {
|
|
4641
5593
|
_classCallCheck(this, PublicFetchWorkerTool);
|
|
4642
5594
|
|
|
@@ -4661,7 +5613,7 @@ var PublicFetchWorkerTool = /*#__PURE__*/function () {
|
|
|
4661
5613
|
/**
|
|
4662
5614
|
* Request data from a server with a worker that uses fetch.
|
|
4663
5615
|
* @param {{url:string}} reqConfig - Request configuration for data to get.
|
|
4664
|
-
* @returns {Promise.<Buffer>} Resolve to Buffer of data from server.
|
|
5616
|
+
* @returns {Promise.<Buffer|Uint8Array|null>} Resolve to Buffer of data from server.
|
|
4665
5617
|
*/
|
|
4666
5618
|
|
|
4667
5619
|
}, {
|
|
@@ -4703,19 +5655,19 @@ module.exports = PublicFetchWorkerTool;
|
|
|
4703
5655
|
!*** ./src/Helper.js ***!
|
|
4704
5656
|
\***********************/
|
|
4705
5657
|
/*! no static exports found */
|
|
4706
|
-
/***/ (function(module, exports) {
|
|
4707
|
-
|
|
4708
|
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
5658
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
4709
5659
|
|
|
4710
|
-
|
|
5660
|
+
var _classCallCheck = __webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "./node_modules/@babel/runtime/helpers/classCallCheck.js");
|
|
4711
5661
|
|
|
4712
|
-
|
|
5662
|
+
var _createClass = __webpack_require__(/*! @babel/runtime/helpers/createClass */ "./node_modules/@babel/runtime/helpers/createClass.js");
|
|
4713
5663
|
|
|
4714
5664
|
/**
|
|
4715
5665
|
* Base class for asset load/save helpers.
|
|
4716
5666
|
* @abstract
|
|
4717
5667
|
*/
|
|
4718
5668
|
var Helper = /*#__PURE__*/function () {
|
|
5669
|
+
"use strict";
|
|
5670
|
+
|
|
4719
5671
|
function Helper(parent) {
|
|
4720
5672
|
_classCallCheck(this, Helper);
|
|
4721
5673
|
|
|
@@ -4751,11 +5703,9 @@ module.exports = Helper;
|
|
|
4751
5703
|
/*! no static exports found */
|
|
4752
5704
|
/***/ (function(module, exports, __webpack_require__) {
|
|
4753
5705
|
|
|
4754
|
-
|
|
4755
|
-
|
|
4756
|
-
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
5706
|
+
var _classCallCheck = __webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "./node_modules/@babel/runtime/helpers/classCallCheck.js");
|
|
4757
5707
|
|
|
4758
|
-
|
|
5708
|
+
var _createClass = __webpack_require__(/*! @babel/runtime/helpers/createClass */ "./node_modules/@babel/runtime/helpers/createClass.js");
|
|
4759
5709
|
|
|
4760
5710
|
var FetchWorkerTool = __webpack_require__(/*! ./FetchWorkerTool */ "./src/FetchWorkerTool.js");
|
|
4761
5711
|
|
|
@@ -4774,6 +5724,8 @@ var FetchTool = __webpack_require__(/*! ./FetchTool */ "./src/FetchTool.js");
|
|
|
4774
5724
|
|
|
4775
5725
|
|
|
4776
5726
|
var ProxyTool = /*#__PURE__*/function () {
|
|
5727
|
+
"use strict";
|
|
5728
|
+
|
|
4777
5729
|
function ProxyTool() {
|
|
4778
5730
|
var filter = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ProxyTool.TOOL_FILTER.ALL;
|
|
4779
5731
|
|
|
@@ -4909,11 +5861,9 @@ module.exports = ProxyTool;
|
|
|
4909
5861
|
/*! no static exports found */
|
|
4910
5862
|
/***/ (function(module, exports, __webpack_require__) {
|
|
4911
5863
|
|
|
4912
|
-
|
|
4913
|
-
|
|
4914
|
-
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
5864
|
+
var _classCallCheck = __webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "./node_modules/@babel/runtime/helpers/classCallCheck.js");
|
|
4915
5865
|
|
|
4916
|
-
|
|
5866
|
+
var _createClass = __webpack_require__(/*! @babel/runtime/helpers/createClass */ "./node_modules/@babel/runtime/helpers/createClass.js");
|
|
4917
5867
|
|
|
4918
5868
|
var log = __webpack_require__(/*! ./log */ "./src/log.js");
|
|
4919
5869
|
|
|
@@ -4927,7 +5877,11 @@ var _AssetType = __webpack_require__(/*! ./AssetType */ "./src/AssetType.js");
|
|
|
4927
5877
|
|
|
4928
5878
|
var _DataFormat = __webpack_require__(/*! ./DataFormat */ "./src/DataFormat.js");
|
|
4929
5879
|
|
|
5880
|
+
var _scratchFetch = __webpack_require__(/*! ./scratchFetch */ "./src/scratchFetch.js");
|
|
5881
|
+
|
|
4930
5882
|
var ScratchStorage = /*#__PURE__*/function () {
|
|
5883
|
+
"use strict";
|
|
5884
|
+
|
|
4931
5885
|
function ScratchStorage() {
|
|
4932
5886
|
_classCallCheck(this, ScratchStorage);
|
|
4933
5887
|
|
|
@@ -4974,6 +5928,16 @@ var ScratchStorage = /*#__PURE__*/function () {
|
|
|
4974
5928
|
get: function get() {
|
|
4975
5929
|
return _DataFormat;
|
|
4976
5930
|
}
|
|
5931
|
+
/**
|
|
5932
|
+
* Access the `scratchFetch` module within this library.
|
|
5933
|
+
* @return {module} the scratchFetch module, with properties for `scratchFetch`, `setMetadata`, etc.
|
|
5934
|
+
*/
|
|
5935
|
+
|
|
5936
|
+
}, {
|
|
5937
|
+
key: "scratchFetch",
|
|
5938
|
+
get: function get() {
|
|
5939
|
+
return _scratchFetch;
|
|
5940
|
+
}
|
|
4977
5941
|
/**
|
|
4978
5942
|
* @deprecated Please use the `Asset` member of a storage instance instead.
|
|
4979
5943
|
* @return {Asset} - the `Asset` class constructor.
|
|
@@ -5209,28 +6173,20 @@ module.exports = ScratchStorage;
|
|
|
5209
6173
|
/*! no static exports found */
|
|
5210
6174
|
/***/ (function(module, exports, __webpack_require__) {
|
|
5211
6175
|
|
|
5212
|
-
|
|
5213
|
-
|
|
5214
|
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
6176
|
+
var _classCallCheck = __webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "./node_modules/@babel/runtime/helpers/classCallCheck.js");
|
|
5215
6177
|
|
|
5216
|
-
|
|
6178
|
+
var _createClass = __webpack_require__(/*! @babel/runtime/helpers/createClass */ "./node_modules/@babel/runtime/helpers/createClass.js");
|
|
5217
6179
|
|
|
5218
|
-
|
|
6180
|
+
var _inherits = __webpack_require__(/*! @babel/runtime/helpers/inherits */ "./node_modules/@babel/runtime/helpers/inherits.js");
|
|
5219
6181
|
|
|
5220
|
-
|
|
6182
|
+
var _possibleConstructorReturn = __webpack_require__(/*! @babel/runtime/helpers/possibleConstructorReturn */ "./node_modules/@babel/runtime/helpers/possibleConstructorReturn.js");
|
|
5221
6183
|
|
|
5222
|
-
|
|
6184
|
+
var _getPrototypeOf = __webpack_require__(/*! @babel/runtime/helpers/getPrototypeOf */ "./node_modules/@babel/runtime/helpers/getPrototypeOf.js");
|
|
5223
6185
|
|
|
5224
6186
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
5225
6187
|
|
|
5226
|
-
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
|
|
5227
|
-
|
|
5228
|
-
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
5229
|
-
|
|
5230
6188
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
5231
6189
|
|
|
5232
|
-
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
5233
|
-
|
|
5234
6190
|
var log = __webpack_require__(/*! ./log */ "./src/log.js");
|
|
5235
6191
|
|
|
5236
6192
|
var Asset = __webpack_require__(/*! ./Asset */ "./src/Asset.js");
|
|
@@ -5257,6 +6213,8 @@ var ensureRequestConfig = function ensureRequestConfig(reqConfig) {
|
|
|
5257
6213
|
|
|
5258
6214
|
|
|
5259
6215
|
var WebHelper = /*#__PURE__*/function (_Helper) {
|
|
6216
|
+
"use strict";
|
|
6217
|
+
|
|
5260
6218
|
_inherits(WebHelper, _Helper);
|
|
5261
6219
|
|
|
5262
6220
|
var _super = _createSuper(WebHelper);
|
|
@@ -5483,6 +6441,171 @@ var minilog = __webpack_require__(/*! minilog */ "./node_modules/minilog/lib/web
|
|
|
5483
6441
|
minilog.enable();
|
|
5484
6442
|
module.exports = minilog('storage');
|
|
5485
6443
|
|
|
6444
|
+
/***/ }),
|
|
6445
|
+
|
|
6446
|
+
/***/ "./src/scratchFetch.js":
|
|
6447
|
+
/*!*****************************!*\
|
|
6448
|
+
!*** ./src/scratchFetch.js ***!
|
|
6449
|
+
\*****************************/
|
|
6450
|
+
/*! no static exports found */
|
|
6451
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
6452
|
+
|
|
6453
|
+
var _slicedToArray = __webpack_require__(/*! @babel/runtime/helpers/slicedToArray */ "./node_modules/@babel/runtime/helpers/slicedToArray.js");
|
|
6454
|
+
|
|
6455
|
+
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
6456
|
+
|
|
6457
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
6458
|
+
|
|
6459
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
6460
|
+
|
|
6461
|
+
var crossFetch = __webpack_require__(/*! cross-fetch */ "./node_modules/cross-fetch/dist/browser-ponyfill.js");
|
|
6462
|
+
/**
|
|
6463
|
+
* Metadata header names
|
|
6464
|
+
* @enum {string} The enum value is the name of the associated header.
|
|
6465
|
+
* @readonly
|
|
6466
|
+
*/
|
|
6467
|
+
|
|
6468
|
+
|
|
6469
|
+
var RequestMetadata = {
|
|
6470
|
+
/** The ID of the project associated with this request */
|
|
6471
|
+
ProjectId: 'X-Project-ID',
|
|
6472
|
+
|
|
6473
|
+
/** The ID of the project run associated with this request */
|
|
6474
|
+
RunId: 'X-Run-ID'
|
|
6475
|
+
};
|
|
6476
|
+
/**
|
|
6477
|
+
* Metadata headers for requests
|
|
6478
|
+
* @type {Headers}
|
|
6479
|
+
*/
|
|
6480
|
+
|
|
6481
|
+
var metadata = new crossFetch.Headers();
|
|
6482
|
+
/**
|
|
6483
|
+
* Check if there is any metadata to apply.
|
|
6484
|
+
* @returns {boolean} true if `metadata` has contents, or false if it is empty.
|
|
6485
|
+
*/
|
|
6486
|
+
|
|
6487
|
+
var hasMetadata = function hasMetadata() {
|
|
6488
|
+
var _iterator = _createForOfIteratorHelper(metadata),
|
|
6489
|
+
_step;
|
|
6490
|
+
|
|
6491
|
+
try {
|
|
6492
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
6493
|
+
var _ = _step.value;
|
|
6494
|
+
return true;
|
|
6495
|
+
}
|
|
6496
|
+
} catch (err) {
|
|
6497
|
+
_iterator.e(err);
|
|
6498
|
+
} finally {
|
|
6499
|
+
_iterator.f();
|
|
6500
|
+
}
|
|
6501
|
+
|
|
6502
|
+
return false;
|
|
6503
|
+
};
|
|
6504
|
+
/**
|
|
6505
|
+
* Non-destructively merge any metadata state (if any) with the provided options object (if any).
|
|
6506
|
+
* If there is metadata state but no options object is provided, make a new object.
|
|
6507
|
+
* If there is no metadata state, return the provided options parameter without modification.
|
|
6508
|
+
* If there is metadata and an options object is provided, modify a copy and return it.
|
|
6509
|
+
* Headers in the provided options object may override headers generated from metadata state.
|
|
6510
|
+
* @param {RequestInit} [options] The initial request options. May be null or undefined.
|
|
6511
|
+
* @returns {RequestInit|undefined} the provided options parameter without modification, or a new options object.
|
|
6512
|
+
*/
|
|
6513
|
+
|
|
6514
|
+
|
|
6515
|
+
var applyMetadata = function applyMetadata(options) {
|
|
6516
|
+
if (hasMetadata()) {
|
|
6517
|
+
var augmentedOptions = Object.assign({}, options);
|
|
6518
|
+
augmentedOptions.headers = new crossFetch.Headers(metadata);
|
|
6519
|
+
|
|
6520
|
+
if (options && options.headers) {
|
|
6521
|
+
// the Fetch spec says options.headers could be:
|
|
6522
|
+
// "A Headers object, an object literal, or an array of two-item arrays to set request's headers."
|
|
6523
|
+
// turn it into a Headers object to be sure of how to interact with it
|
|
6524
|
+
var overrideHeaders = options.headers instanceof crossFetch.Headers ? options.headers : new crossFetch.Headers(options.headers);
|
|
6525
|
+
|
|
6526
|
+
var _iterator2 = _createForOfIteratorHelper(overrideHeaders.entries()),
|
|
6527
|
+
_step2;
|
|
6528
|
+
|
|
6529
|
+
try {
|
|
6530
|
+
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
6531
|
+
var _step2$value = _slicedToArray(_step2.value, 2),
|
|
6532
|
+
name = _step2$value[0],
|
|
6533
|
+
value = _step2$value[1];
|
|
6534
|
+
|
|
6535
|
+
augmentedOptions.headers.set(name, value);
|
|
6536
|
+
}
|
|
6537
|
+
} catch (err) {
|
|
6538
|
+
_iterator2.e(err);
|
|
6539
|
+
} finally {
|
|
6540
|
+
_iterator2.f();
|
|
6541
|
+
}
|
|
6542
|
+
}
|
|
6543
|
+
|
|
6544
|
+
return augmentedOptions;
|
|
6545
|
+
}
|
|
6546
|
+
|
|
6547
|
+
return options;
|
|
6548
|
+
};
|
|
6549
|
+
/**
|
|
6550
|
+
* Make a network request.
|
|
6551
|
+
* This is a wrapper for the global fetch method, adding some Scratch-specific functionality.
|
|
6552
|
+
* @param {RequestInfo|URL} resource The resource to fetch.
|
|
6553
|
+
* @param {RequestInit} options Optional object containing custom settings for this request.
|
|
6554
|
+
* @see {@link https://developer.mozilla.org/docs/Web/API/fetch} for more about the fetch API.
|
|
6555
|
+
* @returns {Promise<Response>} A promise for the response to the request.
|
|
6556
|
+
*/
|
|
6557
|
+
|
|
6558
|
+
|
|
6559
|
+
var scratchFetch = function scratchFetch(resource, options) {
|
|
6560
|
+
var augmentedOptions = applyMetadata(options);
|
|
6561
|
+
return crossFetch.fetch(resource, augmentedOptions);
|
|
6562
|
+
};
|
|
6563
|
+
/**
|
|
6564
|
+
* Set the value of a named request metadata item.
|
|
6565
|
+
* Setting the value to `null` or `undefined` will NOT remove the item.
|
|
6566
|
+
* Use `unsetMetadata` for that.
|
|
6567
|
+
* @param {RequestMetadata} name The name of the metadata item to set.
|
|
6568
|
+
* @param {any} value The value to set (will be converted to a string).
|
|
6569
|
+
*/
|
|
6570
|
+
|
|
6571
|
+
|
|
6572
|
+
var setMetadata = function setMetadata(name, value) {
|
|
6573
|
+
metadata.set(name, value);
|
|
6574
|
+
};
|
|
6575
|
+
/**
|
|
6576
|
+
* Remove a named request metadata item.
|
|
6577
|
+
* @param {RequestMetadata} name The name of the metadata item to remove.
|
|
6578
|
+
*/
|
|
6579
|
+
|
|
6580
|
+
|
|
6581
|
+
var unsetMetadata = function unsetMetadata(name) {
|
|
6582
|
+
metadata.delete(name);
|
|
6583
|
+
};
|
|
6584
|
+
|
|
6585
|
+
module.exports = {
|
|
6586
|
+
default: scratchFetch,
|
|
6587
|
+
Headers: crossFetch.Headers,
|
|
6588
|
+
RequestMetadata: RequestMetadata,
|
|
6589
|
+
applyMetadata: applyMetadata,
|
|
6590
|
+
scratchFetch: scratchFetch,
|
|
6591
|
+
setMetadata: setMetadata,
|
|
6592
|
+
unsetMetadata: unsetMetadata
|
|
6593
|
+
};
|
|
6594
|
+
|
|
6595
|
+
if (true) {
|
|
6596
|
+
/**
|
|
6597
|
+
* Retrieve a named request metadata item.
|
|
6598
|
+
* Only for use in tests.
|
|
6599
|
+
* @param {RequestMetadata} name The name of the metadata item to retrieve.
|
|
6600
|
+
* @returns {any} value The value of the metadata item, or `undefined` if it was not found.
|
|
6601
|
+
*/
|
|
6602
|
+
var getMetadata = function getMetadata(name) {
|
|
6603
|
+
return metadata.get(name);
|
|
6604
|
+
};
|
|
6605
|
+
|
|
6606
|
+
module.exports.getMetadata = getMetadata;
|
|
6607
|
+
}
|
|
6608
|
+
|
|
5486
6609
|
/***/ })
|
|
5487
6610
|
|
|
5488
6611
|
/******/ });
|