scratch-storage 4.1.27 → 5.0.0
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/.nvmrc +1 -1
- package/dist/node/chunks/{fetch-worker.4e33fe859c268e9b63d7.js → fetch-worker.56da39b0f4bad6747138.js} +3 -2
- package/dist/node/chunks/fetch-worker.56da39b0f4bad6747138.js.map +1 -0
- package/dist/node/scratch-storage.js +29 -31
- package/dist/node/scratch-storage.js.map +1 -1
- package/dist/types/Asset.d.ts +2 -2
- package/dist/types/AssetType.d.ts +2 -2
- package/dist/types/BuiltinHelper.d.ts +1 -1
- package/dist/types/FetchWorkerTool.worker.d.ts +1 -0
- package/dist/types/Helper.d.ts +1 -1
- package/dist/types/ScratchStorage.d.ts +29 -15
- package/dist/types/WebHelper.d.ts +2 -2
- package/dist/types/scratchFetch.d.ts +51 -0
- package/dist/web/chunks/{fetch-worker.06b6114f5c2d9f3dd9ff.js → fetch-worker.3a4763eac20f439e99d3.js} +1 -1
- package/dist/web/chunks/{fetch-worker.06b6114f5c2d9f3dd9ff.js.map → fetch-worker.3a4763eac20f439e99d3.js.map} +1 -1
- package/dist/web/chunks/{fetch-worker.ca18555b9ac45d3fc5e1.js → fetch-worker.c813c32be403f91001ba.js} +3 -2
- package/dist/web/chunks/fetch-worker.c813c32be403f91001ba.js.map +1 -0
- package/dist/web/scratch-storage.js +29 -31
- package/dist/web/scratch-storage.js.map +1 -1
- package/dist/web/scratch-storage.min.js +1 -1
- package/eslint.config.mjs +47 -0
- package/package.json +5 -8
- package/src/Asset.ts +2 -2
- package/src/AssetType.ts +2 -2
- package/src/BuiltinHelper.ts +4 -4
- package/src/FetchWorkerTool.ts +0 -1
- package/src/FetchWorkerTool.worker.js +2 -1
- package/src/Helper.ts +1 -1
- package/src/ScratchStorage.ts +15 -15
- package/src/Tool.ts +4 -4
- package/src/WebHelper.ts +3 -3
- package/src/memoizedToString.ts +2 -4
- package/test/__mocks__/cross-fetch.js +1 -1
- package/test/integration/download-known-assets.test.js +0 -2
- package/test/unit/add-helper.test.js +2 -2
- package/test/unit/metadata.test.js +0 -1
- package/tsconfig.json +1 -0
- package/.eslintignore +0 -2
- package/.eslintrc.js +0 -4
- package/dist/node/chunks/fetch-worker.4e33fe859c268e9b63d7.js.map +0 -1
- package/dist/web/chunks/fetch-worker.ca18555b9ac45d3fc5e1.js.map +0 -1
- package/src/.eslintrc.js +0 -20
- package/test/.eslintrc.js +0 -7
- package/test/transformers/.eslintrc.js +0 -8
package/.nvmrc
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
v20
|
|
@@ -772,7 +772,8 @@ const registerStep = function registerStep() {
|
|
|
772
772
|
|
|
773
773
|
/**
|
|
774
774
|
* Receive a job from the parent and fetch the requested data.
|
|
775
|
-
* @param {object}
|
|
775
|
+
* @param {object} message The message from the parent.
|
|
776
|
+
* @param {object} message.data A job id, url, and options descriptor to perform.
|
|
776
777
|
*/
|
|
777
778
|
const onMessage = _ref => {
|
|
778
779
|
let {
|
|
@@ -805,4 +806,4 @@ self.addEventListener('message', onMessage);
|
|
|
805
806
|
module.exports = __webpack_exports__;
|
|
806
807
|
/******/ })()
|
|
807
808
|
;
|
|
808
|
-
//# sourceMappingURL=fetch-worker.
|
|
809
|
+
//# sourceMappingURL=fetch-worker.56da39b0f4bad6747138.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chunks/fetch-worker.56da39b0f4bad6747138.js","mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;AC3qBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;ACvBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;ACPA;;AAEA;AAEA;AACA;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AACA;AACA;AACA;AAEA;AAEA;AAEA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AAAA;AAAA;AAEA;;AAEA;AACA;AAAA;AAAA;AAAA;AAAA;AACA","sources":["webpack://scratch-storage/./node_modules/cross-fetch/dist/browser-ponyfill.js","webpack://scratch-storage/webpack/bootstrap","webpack://scratch-storage/webpack/runtime/global","webpack://scratch-storage/./src/FetchWorkerTool.worker.js"],"sourcesContent":["// Save global object in a variable\nvar __global__ =\n(typeof globalThis !== 'undefined' && globalThis) ||\n(typeof self !== 'undefined' && self) ||\n(typeof global !== 'undefined' && global);\n// Create an object that extends from __global__ without the fetch function\nvar __globalThis__ = (function () {\nfunction F() {\nthis.fetch = false;\nthis.DOMException = __global__.DOMException\n}\nF.prototype = __global__; // Needed for feature detection on whatwg-fetch's code\nreturn new F();\n})();\n// Wraps whatwg-fetch with a function scope to hijack the global object\n// \"globalThis\" that's going to be patched\n(function(globalThis) {\n\nvar irrelevant = (function (exports) {\n\n /* eslint-disable no-prototype-builtins */\n var g =\n (typeof globalThis !== 'undefined' && globalThis) ||\n (typeof self !== 'undefined' && self) ||\n // eslint-disable-next-line no-undef\n (typeof global !== 'undefined' && global) ||\n {};\n\n var support = {\n searchParams: 'URLSearchParams' in g,\n iterable: 'Symbol' in g && 'iterator' in Symbol,\n blob:\n 'FileReader' in g &&\n 'Blob' in g &&\n (function() {\n try {\n new Blob();\n return true\n } catch (e) {\n return false\n }\n })(),\n formData: 'FormData' in g,\n arrayBuffer: 'ArrayBuffer' in g\n };\n\n function isDataView(obj) {\n return obj && DataView.prototype.isPrototypeOf(obj)\n }\n\n if (support.arrayBuffer) {\n var viewClasses = [\n '[object Int8Array]',\n '[object Uint8Array]',\n '[object Uint8ClampedArray]',\n '[object Int16Array]',\n '[object Uint16Array]',\n '[object Int32Array]',\n '[object Uint32Array]',\n '[object Float32Array]',\n '[object Float64Array]'\n ];\n\n var isArrayBufferView =\n ArrayBuffer.isView ||\n function(obj) {\n return obj && viewClasses.indexOf(Object.prototype.toString.call(obj)) > -1\n };\n }\n\n function normalizeName(name) {\n if (typeof name !== 'string') {\n name = String(name);\n }\n if (/[^a-z0-9\\-#$%&'*+.^_`|~!]/i.test(name) || name === '') {\n throw new TypeError('Invalid character in header field name: \"' + name + '\"')\n }\n return name.toLowerCase()\n }\n\n function normalizeValue(value) {\n if (typeof value !== 'string') {\n value = String(value);\n }\n return value\n }\n\n // Build a destructive iterator for the value list\n function iteratorFor(items) {\n var iterator = {\n next: function() {\n var value = items.shift();\n return {done: value === undefined, value: value}\n }\n };\n\n if (support.iterable) {\n iterator[Symbol.iterator] = function() {\n return iterator\n };\n }\n\n return iterator\n }\n\n function Headers(headers) {\n this.map = {};\n\n if (headers instanceof Headers) {\n headers.forEach(function(value, name) {\n this.append(name, value);\n }, this);\n } else if (Array.isArray(headers)) {\n headers.forEach(function(header) {\n if (header.length != 2) {\n throw new TypeError('Headers constructor: expected name/value pair to be length 2, found' + header.length)\n }\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._noBody) return\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 var match = /charset=([A-Za-z0-9_-]+)/.exec(blob.type);\n var encoding = match ? match[1] : 'utf-8';\n reader.readAsText(blob, encoding);\n return promise\n }\n\n function readArrayBufferAsText(buf) {\n var view = new Uint8Array(buf);\n var chars = new Array(view.length);\n\n for (var i = 0; i < view.length; i++) {\n chars[i] = String.fromCharCode(view[i]);\n }\n return chars.join('')\n }\n\n function bufferClone(buf) {\n if (buf.slice) {\n return buf.slice(0)\n } else {\n var view = new Uint8Array(buf.byteLength);\n view.set(new Uint8Array(buf));\n return view.buffer\n }\n }\n\n function Body() {\n this.bodyUsed = false;\n\n this._initBody = function(body) {\n /*\n fetch-mock wraps the Response object in an ES6 Proxy to\n provide useful test harness features such as flush. However, on\n ES5 browsers without fetch or Proxy support pollyfills must be used;\n the proxy-pollyfill is unable to proxy an attribute unless it exists\n on the object before the Proxy is created. This change ensures\n Response.bodyUsed exists on the instance, while maintaining the\n semantic of setting Request.bodyUsed in the constructor before\n _initBody is called.\n */\n // eslint-disable-next-line no-self-assign\n this.bodyUsed = this.bodyUsed;\n this._bodyInit = body;\n if (!body) {\n this._noBody = true;\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\n this.arrayBuffer = function() {\n if (this._bodyArrayBuffer) {\n var isConsumed = consumed(this);\n if (isConsumed) {\n return isConsumed\n } else if (ArrayBuffer.isView(this._bodyArrayBuffer)) {\n return Promise.resolve(\n this._bodyArrayBuffer.buffer.slice(\n this._bodyArrayBuffer.byteOffset,\n this._bodyArrayBuffer.byteOffset + this._bodyArrayBuffer.byteLength\n )\n )\n } else {\n return Promise.resolve(this._bodyArrayBuffer)\n }\n } else if (support.blob) {\n return this.blob().then(readBlobAsArrayBuffer)\n } else {\n throw new Error('could not read as ArrayBuffer')\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 = ['CONNECT', 'DELETE', 'GET', 'HEAD', 'OPTIONS', 'PATCH', 'POST', 'PUT', 'TRACE'];\n\n function normalizeMethod(method) {\n var upcased = method.toUpperCase();\n return methods.indexOf(upcased) > -1 ? upcased : method\n }\n\n function Request(input, options) {\n if (!(this instanceof Request)) {\n throw new TypeError('Please use the \"new\" operator, this DOM object constructor cannot be called as a function.')\n }\n\n options = options || {};\n var body = options.body;\n\n if (input instanceof Request) {\n if (input.bodyUsed) {\n throw new TypeError('Already read')\n }\n this.url = input.url;\n this.credentials = input.credentials;\n if (!options.headers) {\n this.headers = new Headers(input.headers);\n }\n this.method = input.method;\n this.mode = input.mode;\n this.signal = input.signal;\n if (!body && input._bodyInit != null) {\n body = input._bodyInit;\n input.bodyUsed = true;\n }\n } else {\n this.url = String(input);\n }\n\n this.credentials = options.credentials || this.credentials || 'same-origin';\n if (options.headers || !this.headers) {\n this.headers = new Headers(options.headers);\n }\n this.method = normalizeMethod(options.method || this.method || 'GET');\n this.mode = options.mode || this.mode || null;\n this.signal = options.signal || this.signal || (function () {\n if ('AbortController' in g) {\n var ctrl = new AbortController();\n return ctrl.signal;\n }\n }());\n this.referrer = null;\n\n if ((this.method === 'GET' || this.method === 'HEAD') && body) {\n throw new TypeError('Body not allowed for GET or HEAD requests')\n }\n this._initBody(body);\n\n if (this.method === 'GET' || this.method === 'HEAD') {\n if (options.cache === 'no-store' || options.cache === 'no-cache') {\n // Search for a '_' parameter in the query string\n var reParamSearch = /([?&])_=[^&]*/;\n if (reParamSearch.test(this.url)) {\n // If it already exists then set the value with the current time\n this.url = this.url.replace(reParamSearch, '$1_=' + new Date().getTime());\n } else {\n // Otherwise add a new '_' parameter to the end with the current time\n var reQueryString = /\\?/;\n this.url += (reQueryString.test(this.url) ? '&' : '?') + '_=' + new Date().getTime();\n }\n }\n }\n }\n\n Request.prototype.clone = function() {\n return new Request(this, {body: this._bodyInit})\n };\n\n function decode(body) {\n var form = new FormData();\n body\n .trim()\n .split('&')\n .forEach(function(bytes) {\n if (bytes) {\n var split = bytes.split('=');\n var name = split.shift().replace(/\\+/g, ' ');\n var value = split.join('=').replace(/\\+/g, ' ');\n form.append(decodeURIComponent(name), decodeURIComponent(value));\n }\n });\n return form\n }\n\n function parseHeaders(rawHeaders) {\n var headers = new Headers();\n // Replace instances of \\r\\n and \\n followed by at least one space or horizontal tab with a space\n // https://tools.ietf.org/html/rfc7230#section-3.2\n var preProcessedHeaders = rawHeaders.replace(/\\r?\\n[\\t ]+/g, ' ');\n // Avoiding split via regex to work around a common IE11 bug with the core-js 3.6.0 regex polyfill\n // https://github.com/github/fetch/issues/748\n // https://github.com/zloirock/core-js/issues/751\n preProcessedHeaders\n .split('\\r')\n .map(function(header) {\n return header.indexOf('\\n') === 0 ? header.substr(1, header.length) : header\n })\n .forEach(function(line) {\n var parts = line.split(':');\n var key = parts.shift().trim();\n if (key) {\n var value = parts.join(':').trim();\n try {\n headers.append(key, value);\n } catch (error) {\n console.warn('Response ' + error.message);\n }\n }\n });\n return headers\n }\n\n Body.call(Request.prototype);\n\n function Response(bodyInit, options) {\n if (!(this instanceof Response)) {\n throw new TypeError('Please use the \"new\" operator, this DOM object constructor cannot be called as a function.')\n }\n if (!options) {\n options = {};\n }\n\n this.type = 'default';\n this.status = options.status === undefined ? 200 : options.status;\n if (this.status < 200 || this.status > 599) {\n throw new RangeError(\"Failed to construct 'Response': The status provided (0) is outside the range [200, 599].\")\n }\n this.ok = this.status >= 200 && this.status < 300;\n this.statusText = options.statusText === undefined ? '' : '' + options.statusText;\n this.headers = new Headers(options.headers);\n this.url = options.url || '';\n this._initBody(bodyInit);\n }\n\n Body.call(Response.prototype);\n\n Response.prototype.clone = function() {\n return new Response(this._bodyInit, {\n status: this.status,\n statusText: this.statusText,\n headers: new Headers(this.headers),\n url: this.url\n })\n };\n\n Response.error = function() {\n var response = new Response(null, {status: 200, statusText: ''});\n response.ok = false;\n response.status = 0;\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 = g.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 statusText: xhr.statusText,\n headers: parseHeaders(xhr.getAllResponseHeaders() || '')\n };\n // This check if specifically for when a user fetches a file locally from the file system\n // Only if the status is out of a normal range\n if (request.url.indexOf('file://') === 0 && (xhr.status < 200 || xhr.status > 599)) {\n options.status = 200;\n } else {\n options.status = xhr.status;\n }\n options.url = 'responseURL' in xhr ? xhr.responseURL : options.headers.get('X-Request-URL');\n var body = 'response' in xhr ? xhr.response : xhr.responseText;\n setTimeout(function() {\n resolve(new Response(body, options));\n }, 0);\n };\n\n xhr.onerror = function() {\n setTimeout(function() {\n reject(new TypeError('Network request failed'));\n }, 0);\n };\n\n xhr.ontimeout = function() {\n setTimeout(function() {\n reject(new TypeError('Network request timed out'));\n }, 0);\n };\n\n xhr.onabort = function() {\n setTimeout(function() {\n reject(new exports.DOMException('Aborted', 'AbortError'));\n }, 0);\n };\n\n function fixUrl(url) {\n try {\n return url === '' && g.location.href ? g.location.href : url\n } catch (e) {\n return url\n }\n }\n\n xhr.open(request.method, fixUrl(request.url), true);\n\n if (request.credentials === 'include') {\n xhr.withCredentials = true;\n } else if (request.credentials === 'omit') {\n xhr.withCredentials = false;\n }\n\n if ('responseType' in xhr) {\n if (support.blob) {\n xhr.responseType = 'blob';\n } else if (\n support.arrayBuffer\n ) {\n xhr.responseType = 'arraybuffer';\n }\n }\n\n if (init && typeof init.headers === 'object' && !(init.headers instanceof Headers || (g.Headers && init.headers instanceof g.Headers))) {\n var names = [];\n Object.getOwnPropertyNames(init.headers).forEach(function(name) {\n names.push(normalizeName(name));\n xhr.setRequestHeader(name, normalizeValue(init.headers[name]));\n });\n request.headers.forEach(function(value, name) {\n if (names.indexOf(name) === -1) {\n xhr.setRequestHeader(name, value);\n }\n });\n } else {\n request.headers.forEach(function(value, name) {\n xhr.setRequestHeader(name, value);\n });\n }\n\n if (request.signal) {\n request.signal.addEventListener('abort', abortXhr);\n\n xhr.onreadystatechange = function() {\n // DONE (success or failure)\n if (xhr.readyState === 4) {\n request.signal.removeEventListener('abort', abortXhr);\n }\n };\n }\n\n xhr.send(typeof request._bodyInit === 'undefined' ? null : request._bodyInit);\n })\n }\n\n fetch.polyfill = true;\n\n if (!g.fetch) {\n g.fetch = fetch;\n g.Headers = Headers;\n g.Request = Request;\n g.Response = Response;\n }\n\n exports.Headers = Headers;\n exports.Request = Request;\n exports.Response = Response;\n exports.fetch = fetch;\n\n return exports;\n\n})({});\n})(__globalThis__);\n// This is a ponyfill, so...\n__globalThis__.fetch.ponyfill = true;\ndelete __globalThis__.fetch.polyfill;\n// Choose between native implementation (__global__) or custom implementation (__globalThis__)\nvar ctx = __global__.fetch ? __global__ : __globalThis__;\nexports = ctx.fetch // To enable: import fetch from 'cross-fetch'\nexports.default = ctx.fetch // For TypeScript consumers without esModuleInterop.\nexports.fetch = ctx.fetch // To enable: import {fetch} from 'cross-fetch'\nexports.Headers = ctx.Headers\nexports.Request = ctx.Request\nexports.Response = ctx.Response\nmodule.exports = exports\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","__webpack_require__.g = (function() {\n\tif (typeof globalThis === 'object') return globalThis;\n\ttry {\n\t\treturn this || new Function('return this')();\n\t} catch (e) {\n\t\tif (typeof window === 'object') return window;\n\t}\n})();","/* eslint-env worker */\n\nconst crossFetch = require('cross-fetch').default;\n\nlet jobsActive = 0;\nconst complete = [];\n\nlet intervalId = null;\n\n/**\n * Register a step function.\n *\n * Step checks if there are completed jobs and if there are sends them to the\n * parent. Then it checks the jobs count. If there are no further jobs, clear\n * the step.\n */\nconst registerStep = function () {\n intervalId = setInterval(() => {\n if (complete.length) {\n // Send our chunk of completed requests and instruct postMessage to\n // transfer the buffers instead of copying them.\n postMessage(\n complete.slice(),\n // Instruct postMessage that these buffers in the sent message\n // should use their Transferable trait. After the postMessage\n // call the \"buffers\" will still be in complete if you looked,\n // but they will all be length 0 as the data they reference has\n // been sent to the window. This lets us send a lot of data\n // without the normal postMessage behaviour of making a copy of\n // all of the data for the window.\n complete.map(response => response.buffer).filter(Boolean)\n );\n complete.length = 0;\n }\n if (jobsActive === 0) {\n clearInterval(intervalId);\n intervalId = null;\n }\n }, 1);\n};\n\n/**\n * Receive a job from the parent and fetch the requested data.\n * @param {object} message The message from the parent.\n * @param {object} message.data A job id, url, and options descriptor to perform.\n */\nconst onMessage = ({data: job}) => {\n if (jobsActive === 0 && !intervalId) {\n registerStep();\n }\n\n jobsActive++;\n\n crossFetch(job.url, job.options)\n .then(result => {\n if (result.ok) return result.arrayBuffer();\n if (result.status === 404) return null;\n return Promise.reject(result.status);\n })\n .then(buffer => complete.push({id: job.id, buffer}))\n .catch(error => complete.push({id: job.id, error: (error && error.message) || `Failed request: ${job.url}`}))\n .then(() => jobsActive--);\n};\n\n// crossFetch means \"fetch\" is now always supported\npostMessage({support: {fetch: true}});\nself.addEventListener('message', onMessage);\n"],"names":[],"sourceRoot":""}
|
|
@@ -3686,7 +3686,7 @@ module.exports = {
|
|
|
3686
3686
|
/******/ // This function allow to reference async chunks
|
|
3687
3687
|
/******/ __webpack_require__.u = (chunkId) => {
|
|
3688
3688
|
/******/ // return url for filenames based on template
|
|
3689
|
-
/******/ return "chunks/" + "fetch-worker" + "." + "
|
|
3689
|
+
/******/ return "chunks/" + "fetch-worker" + "." + "56da39b0f4bad6747138" + ".js";
|
|
3690
3690
|
/******/ };
|
|
3691
3691
|
/******/ })();
|
|
3692
3692
|
/******/
|
|
@@ -3762,7 +3762,6 @@ let _TextDecoder;
|
|
|
3762
3762
|
let _TextEncoder;
|
|
3763
3763
|
if (typeof TextDecoder === 'undefined' || typeof TextEncoder === 'undefined') {
|
|
3764
3764
|
// Wait to require the text encoding polyfill until we know it's needed.
|
|
3765
|
-
// eslint-disable-next-line global-require
|
|
3766
3765
|
const encoding = __webpack_require__(767);
|
|
3767
3766
|
_TextDecoder = encoding.TextDecoder;
|
|
3768
3767
|
_TextEncoder = encoding.TextEncoder;
|
|
@@ -3777,12 +3776,12 @@ const memoizedToString = function () {
|
|
|
3777
3776
|
* 32766 is a multiple of 3 so btoa does not need to use padding characters
|
|
3778
3777
|
* except for the final chunk where that is fine. 32766 is also close to
|
|
3779
3778
|
* 32768 so it is close to a size an memory allocator would prefer.
|
|
3780
|
-
* @
|
|
3779
|
+
* @constant {number}
|
|
3781
3780
|
*/
|
|
3782
3781
|
const BTOA_CHUNK_MAX_LENGTH = 32766;
|
|
3783
3782
|
/**
|
|
3784
3783
|
* An array cache of bytes to characters.
|
|
3785
|
-
* @
|
|
3784
|
+
* @constant {?Array.<string>}
|
|
3786
3785
|
*/
|
|
3787
3786
|
let fromCharCode = null;
|
|
3788
3787
|
const strings = {};
|
|
@@ -3790,7 +3789,6 @@ const memoizedToString = function () {
|
|
|
3790
3789
|
if (!Object.prototype.hasOwnProperty.call(strings, assetId)) {
|
|
3791
3790
|
if (typeof btoa === 'undefined') {
|
|
3792
3791
|
// Use a library that does not need btoa to run.
|
|
3793
|
-
/* eslint-disable-next-line global-require */
|
|
3794
3792
|
const base64js = __webpack_require__(523);
|
|
3795
3793
|
strings[assetId] = base64js.fromByteArray(data);
|
|
3796
3794
|
} else {
|
|
@@ -3841,7 +3839,7 @@ class Asset {
|
|
|
3841
3839
|
* @param {string} assetId - The ID of this asset.
|
|
3842
3840
|
* @param {DataFormat} [dataFormat] - The format of the data (WAV, PNG, etc.); required iff `data` is present.
|
|
3843
3841
|
* @param {Buffer} [data] - The in-memory data for this asset; optional.
|
|
3844
|
-
* @param {
|
|
3842
|
+
* @param {boolean} [generateId] - Whether to create id from an md5 hash of data
|
|
3845
3843
|
*/
|
|
3846
3844
|
constructor(assetType, assetId, dataFormat, data, generateId) {
|
|
3847
3845
|
_defineProperty(this, "assetType", void 0);
|
|
@@ -3884,7 +3882,7 @@ class Asset {
|
|
|
3884
3882
|
* Same as `setData` but encodes text first.
|
|
3885
3883
|
* @param {string} data - the text data to encode and store.
|
|
3886
3884
|
* @param {DataFormat} dataFormat - the format of the data (DataFormat.SVG for example).
|
|
3887
|
-
* @param {
|
|
3885
|
+
* @param {boolean} generateId - after setting data, set the id to an md5 of the data?
|
|
3888
3886
|
*/
|
|
3889
3887
|
encodeTextData(data, dataFormat, generateId) {
|
|
3890
3888
|
const encoder = new _TextEncoder();
|
|
@@ -3920,8 +3918,8 @@ const DataFormat = {
|
|
|
3920
3918
|
|
|
3921
3919
|
/**
|
|
3922
3920
|
* Enumeration of the supported asset types.
|
|
3923
|
-
* @type {
|
|
3924
|
-
* @typedef {
|
|
3921
|
+
* @type {{[assetTypeName: string]: AssetType}}
|
|
3922
|
+
* @typedef {object} AssetType - Information about a supported asset type.
|
|
3925
3923
|
* @property {string} contentType - the MIME type associated with this kind of data. Useful for data URIs, etc.
|
|
3926
3924
|
* @property {string} name - The human-readable name of this asset type.
|
|
3927
3925
|
* @property {DataFormat} runtimeFormat - The default format used for runtime, in-memory storage of this asset. For
|
|
@@ -3978,7 +3976,7 @@ class Helper {
|
|
|
3978
3976
|
* @param {AssetType} assetType - The type of asset to fetch.
|
|
3979
3977
|
* @param {string} assetId - The ID of the asset to fetch: a project ID, MD5, etc.
|
|
3980
3978
|
* @param {DataFormat} dataFormat - The file format / file extension of the asset to fetch: PNG, JPG, etc.
|
|
3981
|
-
* @
|
|
3979
|
+
* @returns {Promise.<Asset>} A promise for the contents of the asset.
|
|
3982
3980
|
*/
|
|
3983
3981
|
load(assetType, assetId, dataFormat) {
|
|
3984
3982
|
return Promise.reject(new Error("No asset of type ".concat(assetType, " for ID ").concat(assetId, " with format ").concat(dataFormat)));
|
|
@@ -4037,8 +4035,8 @@ class BuiltinHelper extends Helper {
|
|
|
4037
4035
|
super(parent);
|
|
4038
4036
|
/**
|
|
4039
4037
|
* In-memory storage for all built-in assets.
|
|
4040
|
-
* @type {
|
|
4041
|
-
* @typedef {
|
|
4038
|
+
* @type {{[assetType: string]: AssetIdMap}} Maps asset type to a map of asset ID to actual assets.
|
|
4039
|
+
* @typedef {{[id: string]: BuiltinAssetRecord}} AssetIdMap - Maps asset ID to asset.
|
|
4042
4040
|
*/
|
|
4043
4041
|
BuiltinHelper_defineProperty(this, "assets", void 0);
|
|
4044
4042
|
this.assets = {};
|
|
@@ -4064,7 +4062,7 @@ class BuiltinHelper extends Helper {
|
|
|
4064
4062
|
get(assetId) {
|
|
4065
4063
|
let asset = null;
|
|
4066
4064
|
if (Object.prototype.hasOwnProperty.call(this.assets, assetId)) {
|
|
4067
|
-
/** @type{BuiltinAssetRecord} */
|
|
4065
|
+
/** @type {BuiltinAssetRecord} */
|
|
4068
4066
|
const assetRecord = this.assets[assetId];
|
|
4069
4067
|
asset = new Asset(assetRecord.type, assetRecord.id, assetRecord.format, assetRecord.data);
|
|
4070
4068
|
}
|
|
@@ -4126,7 +4124,7 @@ class BuiltinHelper extends Helper {
|
|
|
4126
4124
|
* Fetch an asset but don't process dependencies.
|
|
4127
4125
|
* @param {AssetType} assetType - The type of asset to fetch.
|
|
4128
4126
|
* @param {string} assetId - The ID of the asset to fetch: a project ID, MD5, etc.
|
|
4129
|
-
* @
|
|
4127
|
+
* @returns {?Promise.<Asset>} A promise for the contents of the asset.
|
|
4130
4128
|
*/
|
|
4131
4129
|
load(assetType, assetId) {
|
|
4132
4130
|
if (!this.get(assetId)) {
|
|
@@ -4184,7 +4182,6 @@ class PrivateFetchWorkerTool {
|
|
|
4184
4182
|
// Yes, this is a browser API and we've specified `browser: false` in the eslint env,
|
|
4185
4183
|
// but `isGetSupported` checks for the presence of Worker and uses it only if present.
|
|
4186
4184
|
// Also see https://webpack.js.org/guides/web-workers/
|
|
4187
|
-
// eslint-disable-next-line no-undef
|
|
4188
4185
|
const worker = new Worker(/* webpackChunkName: "fetch-worker" */new URL(/* worker import */ __webpack_require__.p + __webpack_require__.u(836), __webpack_require__.b));
|
|
4189
4186
|
worker.addEventListener('message', _ref => {
|
|
4190
4187
|
let {
|
|
@@ -4567,7 +4564,7 @@ class WebHelper extends Helper {
|
|
|
4567
4564
|
* @param {AssetType} assetType - The type of asset to fetch.
|
|
4568
4565
|
* @param {string} assetId - The ID of the asset to fetch: a project ID, MD5, etc.
|
|
4569
4566
|
* @param {DataFormat} dataFormat - The file format / file extension of the asset to fetch: PNG, JPG, etc.
|
|
4570
|
-
* @
|
|
4567
|
+
* @returns {Promise.<Asset>} A promise for the contents of the asset.
|
|
4571
4568
|
*/
|
|
4572
4569
|
load(assetType, assetId, dataFormat) {
|
|
4573
4570
|
/** @type {Array.<{url:string, result:*}>} List of URLs attempted & errors encountered. */
|
|
@@ -4613,7 +4610,7 @@ class WebHelper extends Helper {
|
|
|
4613
4610
|
* @param {?DataFormat} dataFormat - DataFormat of the data for the stored asset.
|
|
4614
4611
|
* @param {Buffer} data - The data for the cached asset.
|
|
4615
4612
|
* @param {?string} assetId - The ID of the asset to fetch: a project ID, MD5, etc.
|
|
4616
|
-
* @
|
|
4613
|
+
* @returns {Promise.<object>} A promise for the response from the create or update request
|
|
4617
4614
|
*/
|
|
4618
4615
|
store(assetType, dataFormat, data, assetId) {
|
|
4619
4616
|
const asset = new Asset(assetType, assetId, dataFormat);
|
|
@@ -4649,6 +4646,7 @@ class WebHelper extends Helper {
|
|
|
4649
4646
|
try {
|
|
4650
4647
|
body = JSON.parse(body);
|
|
4651
4648
|
} catch (parseError) {
|
|
4649
|
+
// eslint-disable-line @typescript-eslint/no-unused-vars
|
|
4652
4650
|
// If it's not parseable, then we can't add the id even
|
|
4653
4651
|
// if we want to, so stop here
|
|
4654
4652
|
return body;
|
|
@@ -4690,45 +4688,45 @@ class ScratchStorage {
|
|
|
4690
4688
|
}];
|
|
4691
4689
|
}
|
|
4692
4690
|
/**
|
|
4693
|
-
* @
|
|
4694
|
-
* @
|
|
4691
|
+
* @returns {Asset} - the `Asset` class constructor.
|
|
4692
|
+
* @class
|
|
4695
4693
|
*/
|
|
4696
4694
|
get Asset() {
|
|
4697
4695
|
return Asset;
|
|
4698
4696
|
}
|
|
4699
4697
|
/**
|
|
4700
|
-
* @
|
|
4701
|
-
* @
|
|
4698
|
+
* @returns {AssetType} - the list of supported asset types.
|
|
4699
|
+
* @class
|
|
4702
4700
|
*/
|
|
4703
4701
|
get AssetType() {
|
|
4704
4702
|
return AssetType;
|
|
4705
4703
|
}
|
|
4706
4704
|
/**
|
|
4707
|
-
* @
|
|
4708
|
-
* @
|
|
4705
|
+
* @returns {DataFormat} - the list of supported data formats.
|
|
4706
|
+
* @class
|
|
4709
4707
|
*/
|
|
4710
4708
|
get DataFormat() {
|
|
4711
4709
|
return DataFormat;
|
|
4712
4710
|
}
|
|
4713
4711
|
/**
|
|
4714
4712
|
* Access the `scratchFetch` module within this library.
|
|
4715
|
-
* @
|
|
4713
|
+
* @returns {module} the scratchFetch module, with properties for `scratchFetch`, `setMetadata`, etc.
|
|
4716
4714
|
*/
|
|
4717
4715
|
get scratchFetch() {
|
|
4718
4716
|
return (scratchFetch_default());
|
|
4719
4717
|
}
|
|
4720
4718
|
/**
|
|
4721
4719
|
* @deprecated Please use the `Asset` member of a storage instance instead.
|
|
4722
|
-
* @
|
|
4723
|
-
* @
|
|
4720
|
+
* @returns {Asset} - the `Asset` class constructor.
|
|
4721
|
+
* @class
|
|
4724
4722
|
*/
|
|
4725
4723
|
static get Asset() {
|
|
4726
4724
|
return Asset;
|
|
4727
4725
|
}
|
|
4728
4726
|
/**
|
|
4729
4727
|
* @deprecated Please use the `AssetType` member of a storage instance instead.
|
|
4730
|
-
* @
|
|
4731
|
-
* @
|
|
4728
|
+
* @returns {AssetType} - the list of supported asset types.
|
|
4729
|
+
* @class
|
|
4732
4730
|
*/
|
|
4733
4731
|
static get AssetType() {
|
|
4734
4732
|
return AssetType;
|
|
@@ -4804,7 +4802,7 @@ class ScratchStorage {
|
|
|
4804
4802
|
/**
|
|
4805
4803
|
* TODO: Should this be removed in favor of requesting an asset with `null` as the ID?
|
|
4806
4804
|
* @param {AssetType} type - Get the default ID for assets of this type.
|
|
4807
|
-
* @
|
|
4805
|
+
* @returns {?string} The ID of the default asset of the given type, if any.
|
|
4808
4806
|
*/
|
|
4809
4807
|
getDefaultAssetId(type) {
|
|
4810
4808
|
if (Object.prototype.hasOwnProperty.call(this.defaultAssetId, type.name)) {
|
|
@@ -4827,7 +4825,7 @@ class ScratchStorage {
|
|
|
4827
4825
|
* @param {AssetType} assetType - The type of asset to fetch. This also determines which asset store to use.
|
|
4828
4826
|
* @param {string} assetId - The ID of the asset to fetch: a project ID, MD5, etc.
|
|
4829
4827
|
* @param {DataFormat} [dataFormat] - Optional: load this format instead of the AssetType's default.
|
|
4830
|
-
* @
|
|
4828
|
+
* @returns {Promise.<Asset>} A promise for the requested Asset.
|
|
4831
4829
|
* If the promise is resolved with non-null, the value is the requested asset.
|
|
4832
4830
|
* If the promise is resolved with null, the desired asset could not be found with the current asset sources.
|
|
4833
4831
|
* If the promise is rejected, there was an error on at least one asset source. HTTP 404 does not count as an
|
|
@@ -4870,7 +4868,7 @@ class ScratchStorage {
|
|
|
4870
4868
|
* @param {?DataFormat} [dataFormat] - Optional: load this format instead of the AssetType's default.
|
|
4871
4869
|
* @param {Buffer} data - Data to store for the asset
|
|
4872
4870
|
* @param {?string} [assetId] - The ID of the asset to fetch: a project ID, MD5, etc.
|
|
4873
|
-
* @
|
|
4871
|
+
* @returns {Promise.<object>} A promise for asset metadata
|
|
4874
4872
|
*/
|
|
4875
4873
|
store(assetType, dataFormat, data, assetId) {
|
|
4876
4874
|
dataFormat = dataFormat || assetType.runtimeFormat;
|