@jsenv/core 23.8.2 → 23.8.7
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/dist/jsenv_browser_system.js +46 -39
- package/dist/jsenv_browser_system.js.map +14 -14
- package/dist/jsenv_compile_proxy.js.map +6 -6
- package/dist/jsenv_exploring_index.js.map +5 -5
- package/dist/jsenv_exploring_redirector.js.map +12 -12
- package/dist/jsenv_toolbar.js.map +7 -7
- package/dist/jsenv_toolbar_injector.js.map +5 -5
- package/helpers/babel/.eslintrc.cjs +24 -24
- package/helpers/babel/AsyncGenerator/AsyncGenerator.js +81 -81
- package/helpers/babel/AwaitValue/AwaitValue.js +3 -3
- package/helpers/babel/applyDecoratorDescriptor/applyDecoratorDescriptor.js +33 -33
- package/helpers/babel/arrayLikeToArray/arrayLikeToArray.js +7 -7
- package/helpers/babel/arrayWithHoles/arrayWithHoles.js +4 -4
- package/helpers/babel/arrayWithoutHoles/arrayWithoutHoles.js +6 -6
- package/helpers/babel/assertThisInitialized/assertThisInitialized.js +7 -7
- package/helpers/babel/asyncGeneratorDelegate/asyncGeneratorDelegate.js +40 -40
- package/helpers/babel/asyncIterator/asyncIterator.js +12 -12
- package/helpers/babel/asyncToGenerator/asyncToGenerator.js +34 -34
- package/helpers/babel/awaitAsyncGenerator/awaitAsyncGenerator.js +5 -5
- package/helpers/babel/classApplyDescriptorDestructureSet/classApplyDescriptorDestructureSet.js +20 -20
- package/helpers/babel/classApplyDescriptorGet/classApplyDescriptorGet.js +6 -6
- package/helpers/babel/classApplyDescriptorSet/classApplyDescriptorSet.js +13 -13
- package/helpers/babel/classCallCheck/classCallCheck.js +5 -5
- package/helpers/babel/classCheckPrivateStaticAccess/classCheckPrivateStaticAccess.js +5 -5
- package/helpers/babel/classCheckPrivateStaticFieldDescriptor/classCheckPrivateStaticFieldDescriptor.js +6 -6
- package/helpers/babel/classExtractFieldDescriptor/classExtractFieldDescriptor.js +7 -7
- package/helpers/babel/classNameTDZError/classNameTDZError.js +4 -4
- package/helpers/babel/classPrivateFieldDestructureSet/classPrivateFieldDestructureSet.js +7 -7
- package/helpers/babel/classPrivateFieldGet/classPrivateFieldGet.js +7 -7
- package/helpers/babel/classPrivateFieldLooseBase/classPrivateFieldLooseBase.js +6 -6
- package/helpers/babel/classPrivateFieldLooseKey/classPrivateFieldLooseKey.js +5 -5
- package/helpers/babel/classPrivateFieldSet/classPrivateFieldSet.js +8 -8
- package/helpers/babel/classPrivateMethodGet/classPrivateMethodGet.js +6 -6
- package/helpers/babel/classPrivateMethodSet/classPrivateMethodSet.js +3 -3
- package/helpers/babel/classStaticPrivateFieldSpecGet/classStaticPrivateFieldSpecGet.js +9 -9
- package/helpers/babel/classStaticPrivateFieldSpecSet/classStaticPrivateFieldSpecSet.js +15 -15
- package/helpers/babel/classStaticPrivateMethodGet/classStaticPrivateMethodGet.js +6 -6
- package/helpers/babel/classStaticPrivateMethodSet/classStaticPrivateMethodSet.js +3 -3
- package/helpers/babel/construct/construct.js +16 -16
- package/helpers/babel/createClass/createClass.js +15 -15
- package/helpers/babel/createForOfIteratorHelper/createForOfIteratorHelper.js +60 -60
- package/helpers/babel/createForOfIteratorHelperLoose/createForOfIteratorHelperLoose.js +23 -23
- package/helpers/babel/createRawReactElement/createRawReactElement.js +50 -50
- package/helpers/babel/createSuper/createSuper.js +22 -22
- package/helpers/babel/decorate/decorate.js +403 -403
- package/helpers/babel/defaults/defaults.js +11 -11
- package/helpers/babel/defineEnumerableProperties/defineEnumerableProperties.js +23 -23
- package/helpers/babel/defineProperty/defineProperty.js +18 -18
- package/helpers/babel/extends/extends.js +14 -14
- package/helpers/babel/get/get.js +13 -13
- package/helpers/babel/getPrototypeOf/getPrototypeOf.js +4 -4
- package/helpers/babel/inherits/inherits.js +15 -15
- package/helpers/babel/inheritsLoose/inheritsLoose.js +7 -7
- package/helpers/babel/initializerDefineProperty/initializerDefineProperty.js +10 -10
- package/helpers/babel/initializerWarningHelper/initializerWarningHelper.js +6 -6
- package/helpers/babel/instanceof/instanceof.js +6 -6
- package/helpers/babel/interopRequireDefault/interopRequireDefault.js +3 -3
- package/helpers/babel/interopRequireWildcard/interopRequireWildcard.js +37 -37
- package/helpers/babel/isNativeFunction/isNativeFunction.js +4 -4
- package/helpers/babel/isNativeReflectConstruct/isNativeReflectConstruct.js +21 -21
- package/helpers/babel/iterableToArray/iterableToArray.js +7 -7
- package/helpers/babel/iterableToArrayLimit/iterableToArrayLimit.js +36 -36
- package/helpers/babel/iterableToArrayLimitLoose/iterableToArrayLimitLoose.js +10 -10
- package/helpers/babel/jsx/jsx.js +45 -45
- package/helpers/babel/maybeArrayLike/maybeArrayLike.js +10 -10
- package/helpers/babel/newArrowCheck/newArrowCheck.js +5 -5
- package/helpers/babel/nonIterableRest/nonIterableRest.js +5 -5
- package/helpers/babel/nonIterableSpread/nonIterableSpread.js +5 -5
- package/helpers/babel/objectDestructuringEmpty/objectDestructuringEmpty.js +3 -3
- package/helpers/babel/objectSpread/objectSpread.js +23 -23
- package/helpers/babel/objectSpread2/objectSpread2.js +33 -33
- package/helpers/babel/objectWithoutProperties/objectWithoutProperties.js +19 -19
- package/helpers/babel/objectWithoutPropertiesLoose/objectWithoutPropertiesLoose.js +13 -13
- package/helpers/babel/possibleConstructorReturn/possibleConstructorReturn.js +10 -10
- package/helpers/babel/readOnlyError/readOnlyError.js +4 -4
- package/helpers/babel/readme.md +9 -9
- package/helpers/babel/set/set.js +44 -44
- package/helpers/babel/setPrototypeOf/setPrototypeOf.js +6 -6
- package/helpers/babel/skipFirstGeneratorNext/skipFirstGeneratorNext.js +8 -8
- package/helpers/babel/slicedToArray/slicedToArray.js +10 -10
- package/helpers/babel/slicedToArrayLoose/slicedToArrayLoose.js +13 -13
- package/helpers/babel/superPropBase/superPropBase.js +10 -10
- package/helpers/babel/taggedTemplateLiteral/taggedTemplateLiteral.js +10 -10
- package/helpers/babel/taggedTemplateLiteralLoose/taggedTemplateLiteralLoose.js +7 -7
- package/helpers/babel/tdz/tdz.js +4 -4
- package/helpers/babel/temporalRef/temporalRef.js +6 -6
- package/helpers/babel/temporalUndefined/temporalUndefined.js +3 -3
- package/helpers/babel/toArray/toArray.js +10 -10
- package/helpers/babel/toConsumableArray/toConsumableArray.js +10 -10
- package/helpers/babel/toPrimitive/toPrimitive.js +10 -10
- package/helpers/babel/toPropertyKey/toPropertyKey.js +6 -6
- package/helpers/babel/typeof/typeof.js +14 -14
- package/helpers/babel/unsupportedIterableToArray/unsupportedIterableToArray.js +12 -12
- package/helpers/babel/wrapAsyncGenerator/wrapAsyncGenerator.js +8 -8
- package/helpers/babel/wrapNativeSuper/wrapNativeSuper.js +30 -30
- package/helpers/babel/wrapRegExp/wrapRegExp.js +63 -63
- package/helpers/babel/writeOnlyError/writeOnlyError.js +4 -4
- package/helpers/regenerator-runtime/regenerator-runtime.js +748 -748
- package/{LICENSE → license} +21 -21
- package/package.json +2 -2
- package/src/buildProject.js +300 -300
- package/src/execute.js +184 -184
- package/src/internal/browser-launcher/jsenv-browser-system.js +203 -199
- package/src/internal/building/buildUsingRollup.js +2 -10
- package/src/internal/compiling/babel_plugin_import_assertions.js +121 -121
- package/src/internal/compiling/babel_plugin_import_metadata.js +22 -22
- package/src/internal/compiling/babel_plugin_import_visitor.js +84 -84
- package/src/internal/compiling/compile-directory/getOrGenerateCompiledFile.js +268 -268
- package/src/internal/compiling/compile-directory/updateMeta.js +154 -154
- package/src/internal/compiling/compile-directory/validateCache.js +265 -265
- package/src/internal/compiling/compileFile.js +233 -224
- package/src/internal/compiling/compileHtml.js +550 -550
- package/src/internal/compiling/createCompiledFileService.js +291 -291
- package/src/internal/compiling/html_source_file_service.js +403 -404
- package/src/internal/compiling/js-compilation-service/jsenvTransform.js +272 -270
- package/src/internal/compiling/jsenvCompilerForHtml.js +374 -308
- package/src/internal/compiling/jsenvCompilerForJavaScript.js +2 -0
- package/src/internal/compiling/startCompileServer.js +1086 -1048
- package/src/internal/compiling/transformResultToCompilationResult.js +220 -220
- package/src/internal/executing/coverage/babel_plugin_instrument.js +90 -90
- package/src/internal/executing/coverage/reportToCoverage.js +193 -187
- package/src/internal/executing/executePlan.js +183 -183
- package/src/internal/executing/launchAndExecute.js +458 -458
- package/src/internal/generateGroupMap/featuresCompatMap.js +29 -0
- package/src/internal/generateGroupMap/jsenvBabelPluginCompatMap.js +1 -8
- package/src/internal/runtime/createBrowserRuntime/scanBrowserRuntimeFeatures.js +246 -246
- package/src/internal/runtime/createNodeRuntime/scanNodeRuntimeFeatures.js +112 -112
- package/src/internal/runtime/s.js +727 -727
- package/src/internal/toolbar/jsenv-logo.svg +144 -144
- package/src/internal/toolbar/toolbar.main.css +196 -196
- package/src/internal/toolbar/toolbar.main.js +227 -227
- package/src/internal/url_conversion.js +317 -317
- package/src/startExploring.js +309 -309
|
@@ -16,12 +16,12 @@
|
|
|
16
16
|
"../src/internal/toolbar/toolbar.injector.js"
|
|
17
17
|
],
|
|
18
18
|
"sourcesContent": [
|
|
19
|
-
"const nativeTypeOf = (obj) => typeof obj\
|
|
20
|
-
"export default (obj, key, value) => {\
|
|
19
|
+
"const nativeTypeOf = (obj) => typeof obj\n\nconst customTypeOf = (obj) => {\n return obj &&\n typeof Symbol === \"function\" &&\n obj.constructor === Symbol &&\n obj !== Symbol.prototype\n ? \"symbol\"\n : typeof obj\n}\n\nexport default typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\"\n ? nativeTypeOf\n : customTypeOf\n",
|
|
20
|
+
"export default (obj, key, value) => {\n // Shortcircuit the slow defineProperty path when possible.\n // We are trying to avoid issues where setters defined on the\n // prototype cause side effects under the fast path of simple\n // assignment. By checking for existence of the property with\n // the in operator, we can optimize most of this overhead away.\n if (key in obj) {\n Object.defineProperty(obj, key, {\n value,\n enumerable: true,\n configurable: true,\n writable: true,\n })\n } else {\n obj[key] = value\n }\n return obj\n}\n",
|
|
21
21
|
"export const createDetailedMessage = (message, details = {}) => {\n let string = `${message}`\n\n Object.keys(details).forEach((key) => {\n const value = details[key]\n string += `\n--- ${key} ---\n${\n Array.isArray(value)\n ? value.join(`\n`)\n : value\n}`\n })\n\n return string\n}\n",
|
|
22
|
-
"import defineProperty from \"../defineProperty/defineProperty.js\"\
|
|
23
|
-
"export default (source, excluded) => {\
|
|
24
|
-
"import objectWithoutPropertiesLoose from \"../objectWithoutPropertiesLoose/objectWithoutPropertiesLoose.js\"\
|
|
22
|
+
"import defineProperty from \"../defineProperty/defineProperty.js\"\n\nfunction ownKeys(object, enumerableOnly) {\n var keys = Object.keys(object)\n if (Object.getOwnPropertySymbols) {\n var symbols = Object.getOwnPropertySymbols(object)\n if (enumerableOnly) {\n symbols = symbols.filter(function (sym) {\n return Object.getOwnPropertyDescriptor(object, sym).enumerable\n })\n }\n keys.push.apply(keys, symbols)\n }\n return keys\n}\n\nexport default function _objectSpread2(target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i] != null ? arguments[i] : {}\n if (i % 2) {\n ownKeys(Object(source), true).forEach(function (key) {\n defineProperty(target, key, source[key])\n })\n } else if (Object.getOwnPropertyDescriptors) {\n Object.defineProperties(target, Object.getOwnPropertyDescriptors(source))\n } else {\n ownKeys(Object(source)).forEach(function (key) {\n Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key))\n })\n }\n }\n return target\n}\n",
|
|
23
|
+
"export default (source, excluded) => {\n if (source === null) return {}\n var target = {}\n var sourceKeys = Object.keys(source)\n var key\n var i\n for (i = 0; i < sourceKeys.length; i++) {\n key = sourceKeys[i]\n if (excluded.indexOf(key) >= 0) continue\n target[key] = source[key]\n }\n return target\n}\n",
|
|
24
|
+
"import objectWithoutPropertiesLoose from \"../objectWithoutPropertiesLoose/objectWithoutPropertiesLoose.js\"\n\nexport default (source, excluded) => {\n if (source === null) return {}\n\n var target = objectWithoutPropertiesLoose(source, excluded)\n var key\n var i\n if (Object.getOwnPropertySymbols) {\n var sourceSymbolKeys = Object.getOwnPropertySymbols(source)\n for (i = 0; i < sourceSymbolKeys.length; i++) {\n key = sourceSymbolKeys[i]\n if (excluded.indexOf(key) >= 0) continue\n if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue\n target[key] = source[key]\n }\n }\n return target\n}\n",
|
|
25
25
|
"import { createDetailedMessage } from \"@jsenv/logger\"\n\nexport const fetchUsingXHR = async (\n url,\n {\n signal,\n method = \"GET\",\n credentials = \"same-origin\",\n headers = {},\n body = null,\n } = {},\n) => {\n const headersPromise = createPromiseAndHooks()\n const bodyPromise = createPromiseAndHooks()\n\n const xhr = new XMLHttpRequest()\n\n const failure = (error) => {\n // if it was already resolved, we must reject the body promise\n if (headersPromise.settled) {\n bodyPromise.reject(error)\n } else {\n headersPromise.reject(error)\n }\n }\n\n const cleanup = () => {\n xhr.ontimeout = null\n xhr.onerror = null\n xhr.onload = null\n xhr.onreadystatechange = null\n }\n\n xhr.ontimeout = () => {\n cleanup()\n failure(new Error(`xhr request timeout on ${url}.`))\n }\n\n xhr.onerror = (error) => {\n cleanup()\n // unfortunately with have no clue why it fails\n // might be cors for instance\n failure(createRequestError(error, { url }))\n }\n\n xhr.onload = () => {\n cleanup()\n bodyPromise.resolve()\n }\n\n signal.addEventListener(\"abort\", () => {\n xhr.abort()\n const abortError = new Error(\"aborted\")\n abortError.name = \"AbortError\"\n failure(abortError)\n })\n\n xhr.onreadystatechange = () => {\n // https://developer.mozilla.org/fr/docs/Web/API/XMLHttpRequest/readyState\n const { readyState } = xhr\n\n if (readyState === 2) {\n headersPromise.resolve()\n } else if (readyState === 4) {\n cleanup()\n bodyPromise.resolve()\n }\n }\n\n xhr.open(method, url, true)\n Object.keys(headers).forEach((key) => {\n xhr.setRequestHeader(key, headers[key])\n })\n xhr.withCredentials = computeWithCredentials({ credentials, url })\n if (\"responseType\" in xhr && hasBlob) {\n xhr.responseType = \"blob\"\n }\n xhr.send(body)\n\n await headersPromise\n\n // https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/responseURL\n const responseUrl =\n \"responseURL\" in xhr ? xhr.responseURL : headers[\"x-request-url\"]\n let responseStatus = xhr.status\n const responseStatusText = xhr.statusText\n const responseHeaders = getHeadersFromXHR(xhr)\n\n const readBody = async () => {\n await bodyPromise\n\n const { status } = xhr\n // in Chrome on file:/// URLs, status is 0\n if (status === 0) {\n responseStatus = 200\n }\n\n const body = \"response\" in xhr ? xhr.response : xhr.responseText\n\n return {\n responseBody: body,\n responseBodyType: detectBodyType(body),\n }\n }\n\n const text = async () => {\n const { responseBody, responseBodyType } = await readBody()\n\n if (responseBodyType === \"blob\") {\n return blobToText(responseBody)\n }\n if (responseBodyType === \"formData\") {\n throw new Error(\"could not read FormData body as text\")\n }\n if (responseBodyType === \"dataView\") {\n return arrayBufferToText(responseBody.buffer)\n }\n if (responseBodyType === \"arrayBuffer\") {\n return arrayBufferToText(responseBody)\n }\n // if (responseBodyType === \"text\" || responseBodyType === 'searchParams') {\n // return body\n // }\n return String(responseBody)\n }\n\n const json = async () => {\n const responseText = await text()\n return JSON.parse(responseText)\n }\n\n const blob = async () => {\n if (!hasBlob) {\n throw new Error(`blob not supported`)\n }\n\n const { responseBody, responseBodyType } = await readBody()\n\n if (responseBodyType === \"blob\") {\n return responseBody\n }\n if (responseBodyType === \"dataView\") {\n return new Blob([cloneBuffer(responseBody.buffer)])\n }\n if (responseBodyType === \"arrayBuffer\") {\n return new Blob([cloneBuffer(responseBody)])\n }\n if (responseBodyType === \"formData\") {\n throw new Error(\"could not read FormData body as blob\")\n }\n return new Blob([String(responseBody)])\n }\n\n const arrayBuffer = async () => {\n const { responseBody, responseBodyType } = await readBody()\n\n if (responseBodyType === \"arrayBuffer\") {\n return cloneBuffer(responseBody)\n }\n const responseBlob = await blob()\n return blobToArrayBuffer(responseBlob)\n }\n\n const formData = async () => {\n if (!hasFormData) {\n throw new Error(`formData not supported`)\n }\n const responseText = await text()\n return textToFormData(responseText)\n }\n\n return {\n url: responseUrl,\n status: responseStatus,\n statusText: responseStatusText,\n headers: responseHeaders,\n text,\n json,\n blob,\n arrayBuffer,\n formData,\n }\n}\n\nconst canUseBlob = () => {\n if (typeof window.FileReader !== \"function\") return false\n\n if (typeof window.Blob !== \"function\") return false\n\n try {\n // eslint-disable-next-line no-new\n new Blob()\n return true\n } catch (e) {\n return false\n }\n}\n\nconst hasBlob = canUseBlob()\n\nconst hasFormData = typeof window.FormData === \"function\"\n\nconst hasArrayBuffer = typeof window.ArrayBuffer === \"function\"\n\nconst hasSearchParams = typeof window.URLSearchParams === \"function\"\n\nconst createRequestError = (error, { url }) => {\n return new Error(\n createDetailedMessage(`error during xhr request on ${url}.`, {\n [\"error stack\"]: error.stack,\n }),\n )\n}\n\nconst createPromiseAndHooks = () => {\n let resolve\n let reject\n const promise = new Promise((res, rej) => {\n resolve = (value) => {\n promise.settled = true\n res(value)\n }\n reject = (value) => {\n promise.settled = true\n rej(value)\n }\n })\n promise.resolve = resolve\n promise.reject = reject\n return promise\n}\n\n// https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API/Using_Fetch\nconst computeWithCredentials = ({ credentials, url }) => {\n if (credentials === \"same-origin\") {\n return originSameAsGlobalOrigin(url)\n }\n return credentials === \"include\"\n}\n\nconst originSameAsGlobalOrigin = (url) => {\n // if we cannot read globalOrigin from window.location.origin, let's consider it's ok\n if (typeof window !== \"object\") return true\n if (typeof window.location !== \"object\") return true\n const globalOrigin = window.location.origin\n if (globalOrigin === \"null\") return true\n return hrefToOrigin(url) === globalOrigin\n}\n\nconst detectBodyType = (body) => {\n if (!body) {\n return \"\"\n }\n if (typeof body === \"string\") {\n return \"text\"\n }\n if (hasBlob && Blob.prototype.isPrototypeOf(body)) {\n return \"blob\"\n }\n if (hasFormData && FormData.prototype.isPrototypeOf(body)) {\n return \"formData\"\n }\n if (hasArrayBuffer) {\n if (hasBlob && isDataView(body)) {\n return `dataView`\n }\n if (ArrayBuffer.prototype.isPrototypeOf(body) || isArrayBufferView(body)) {\n return `arrayBuffer`\n }\n }\n if (hasSearchParams && URLSearchParams.prototype.isPrototypeOf(body)) {\n return \"searchParams\"\n }\n return \"\"\n}\n\n// https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/getAllResponseHeaders#Example\nconst getHeadersFromXHR = (xhr) => {\n const headerMap = {}\n\n const headersString = xhr.getAllResponseHeaders()\n if (headersString === \"\") return headerMap\n\n const lines = headersString.trim().split(/[\\r\\n]+/)\n lines.forEach((line) => {\n const parts = line.split(\": \")\n const name = parts.shift()\n const value = parts.join(\": \")\n headerMap[name.toLowerCase()] = value\n })\n\n return headerMap\n}\n\nconst hrefToOrigin = (href) => {\n const scheme = hrefToScheme(href)\n\n if (scheme === \"file\") {\n return \"file://\"\n }\n\n if (scheme === \"http\" || scheme === \"https\") {\n const secondProtocolSlashIndex = scheme.length + \"://\".length\n const pathnameSlashIndex = href.indexOf(\"/\", secondProtocolSlashIndex)\n\n if (pathnameSlashIndex === -1) return href\n return href.slice(0, pathnameSlashIndex)\n }\n\n return href.slice(0, scheme.length + 1)\n}\n\nconst hrefToScheme = (href) => {\n const colonIndex = href.indexOf(\":\")\n if (colonIndex === -1) return \"\"\n return href.slice(0, colonIndex)\n}\n\nconst isDataView = (obj) => {\n return obj && DataView.prototype.isPrototypeOf(obj)\n}\n\nconst isArrayBufferView =\n ArrayBuffer.isView ||\n (() => {\n const 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 return (value) => {\n return (\n value && viewClasses.includes(Object.prototype.toString.call(value))\n )\n }\n })()\n\nconst textToFormData = (text) => {\n const form = new FormData()\n text\n .trim()\n .split(\"&\")\n .forEach(function (bytes) {\n if (bytes) {\n const split = bytes.split(\"=\")\n const name = split.shift().replace(/\\+/g, \" \")\n const value = split.join(\"=\").replace(/\\+/g, \" \")\n form.append(decodeURIComponent(name), decodeURIComponent(value))\n }\n })\n return form\n}\n\nconst blobToArrayBuffer = async (blob) => {\n const reader = new FileReader()\n const promise = fileReaderReady(reader)\n reader.readAsArrayBuffer(blob)\n return promise\n}\n\nconst blobToText = (blob) => {\n const reader = new FileReader()\n const promise = fileReaderReady(reader)\n reader.readAsText(blob)\n return promise\n}\n\nconst arrayBufferToText = (arrayBuffer) => {\n const view = new Uint8Array(arrayBuffer)\n const chars = new Array(view.length)\n let i = 0\n while (i < view.length) {\n chars[i] = String.fromCharCode(view[i])\n\n i++\n }\n return chars.join(\"\")\n}\n\nconst 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\nconst cloneBuffer = (buffer) => {\n if (buffer.slice) {\n return buffer.slice(0)\n }\n const view = new Uint8Array(buffer.byteLength)\n view.set(new Uint8Array(buffer))\n return view.buffer\n}\n",
|
|
26
26
|
"import { fetchUsingXHR } from \"./fetchUsingXHR.js\"\n\nconst fetchNative = async (url, { mode = \"cors\", ...options } = {}) => {\n const response = await window.fetch(url, {\n mode,\n ...options,\n })\n\n return {\n url: response.url,\n status: response.status,\n statusText: \"\",\n headers: responseToHeaders(response),\n text: () => response.text(),\n json: () => response.json(),\n blob: () => response.blob(),\n arrayBuffer: () => response.arrayBuffer(),\n formData: () => response.formData(),\n }\n}\n\nconst responseToHeaders = (response) => {\n const headers = {}\n response.headers.forEach((value, name) => {\n headers[name] = value\n })\n return headers\n}\n\nexport const fetchUrl =\n typeof window.fetch === \"function\" &&\n typeof window.AbortController === \"function\"\n ? fetchNative\n : fetchUsingXHR\n",
|
|
27
27
|
"import { fetchUrl } from \"./fetch-browser.js\"\n\nexport const fetchJson = async (url, options = {}) => {\n const response = await fetchUrl(url, options)\n const object = await response.json()\n return object\n}\n",
|
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
const eslintConfig = require("../../.eslintrc.cjs")
|
|
2
|
-
|
|
3
|
-
// babel helpers are copy pasted from the babel repository
|
|
4
|
-
Object.assign(eslintConfig.rules, {
|
|
5
|
-
"eqeqeq": ["off"],
|
|
6
|
-
"no-eq-null": ["off"],
|
|
7
|
-
"no-undef-init": ["off"],
|
|
8
|
-
"dot-notation": ["off"],
|
|
9
|
-
"consistent-return": ["off"],
|
|
10
|
-
"one-var": ["off"],
|
|
11
|
-
"object-shorthand": ["off"],
|
|
12
|
-
"no-return-assign": ["off"],
|
|
13
|
-
"prefer-template": ["off"],
|
|
14
|
-
"prefer-rest-params": ["off"],
|
|
15
|
-
"no-void": ["off"],
|
|
16
|
-
"no-implicit-coercion": ["off"],
|
|
17
|
-
"prefer-spread": ["off"],
|
|
18
|
-
"no-loop-func": ["off"],
|
|
19
|
-
"no-negated-condition": ["off"],
|
|
20
|
-
"no-func-assign": ["off"],
|
|
21
|
-
"no-else-return": ["off"],
|
|
22
|
-
})
|
|
23
|
-
|
|
24
|
-
module.exports = eslintConfig
|
|
1
|
+
const eslintConfig = require("../../.eslintrc.cjs")
|
|
2
|
+
|
|
3
|
+
// babel helpers are copy pasted from the babel repository
|
|
4
|
+
Object.assign(eslintConfig.rules, {
|
|
5
|
+
"eqeqeq": ["off"],
|
|
6
|
+
"no-eq-null": ["off"],
|
|
7
|
+
"no-undef-init": ["off"],
|
|
8
|
+
"dot-notation": ["off"],
|
|
9
|
+
"consistent-return": ["off"],
|
|
10
|
+
"one-var": ["off"],
|
|
11
|
+
"object-shorthand": ["off"],
|
|
12
|
+
"no-return-assign": ["off"],
|
|
13
|
+
"prefer-template": ["off"],
|
|
14
|
+
"prefer-rest-params": ["off"],
|
|
15
|
+
"no-void": ["off"],
|
|
16
|
+
"no-implicit-coercion": ["off"],
|
|
17
|
+
"prefer-spread": ["off"],
|
|
18
|
+
"no-loop-func": ["off"],
|
|
19
|
+
"no-negated-condition": ["off"],
|
|
20
|
+
"no-func-assign": ["off"],
|
|
21
|
+
"no-else-return": ["off"],
|
|
22
|
+
})
|
|
23
|
+
|
|
24
|
+
module.exports = eslintConfig
|
|
@@ -1,81 +1,81 @@
|
|
|
1
|
-
import AwaitValue from "../AwaitValue/AwaitValue.js"
|
|
2
|
-
|
|
3
|
-
export default function AsyncGenerator(gen) {
|
|
4
|
-
var front, back
|
|
5
|
-
function send(key, arg) {
|
|
6
|
-
return new Promise(function (resolve, reject) {
|
|
7
|
-
var request = {
|
|
8
|
-
key: key,
|
|
9
|
-
arg: arg,
|
|
10
|
-
resolve: resolve,
|
|
11
|
-
reject: reject,
|
|
12
|
-
next: null,
|
|
13
|
-
}
|
|
14
|
-
if (back) {
|
|
15
|
-
back = back.next = request
|
|
16
|
-
} else {
|
|
17
|
-
front = back = request
|
|
18
|
-
resume(key, arg)
|
|
19
|
-
}
|
|
20
|
-
})
|
|
21
|
-
}
|
|
22
|
-
function resume(key, arg) {
|
|
23
|
-
try {
|
|
24
|
-
var result = gen[key](arg)
|
|
25
|
-
var value = result.value
|
|
26
|
-
var wrappedAwait = value instanceof AwaitValue
|
|
27
|
-
Promise.resolve(wrappedAwait ? value.wrapped : value).then(
|
|
28
|
-
function (arg) {
|
|
29
|
-
if (wrappedAwait) {
|
|
30
|
-
resume(key === "return" ? "return" : "next", arg)
|
|
31
|
-
return
|
|
32
|
-
}
|
|
33
|
-
settle(result.done ? "return" : "normal", arg)
|
|
34
|
-
},
|
|
35
|
-
function (err) {
|
|
36
|
-
resume("throw", err)
|
|
37
|
-
},
|
|
38
|
-
)
|
|
39
|
-
} catch (err) {
|
|
40
|
-
settle("throw", err)
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
function settle(type, value) {
|
|
44
|
-
switch (type) {
|
|
45
|
-
case "return":
|
|
46
|
-
front.resolve({ value: value, done: true })
|
|
47
|
-
break
|
|
48
|
-
case "throw":
|
|
49
|
-
front.reject(value)
|
|
50
|
-
break
|
|
51
|
-
default:
|
|
52
|
-
front.resolve({ value: value, done: false })
|
|
53
|
-
break
|
|
54
|
-
}
|
|
55
|
-
front = front.next
|
|
56
|
-
if (front) {
|
|
57
|
-
resume(front.key, front.arg)
|
|
58
|
-
} else {
|
|
59
|
-
back = null
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
this._invoke = send
|
|
63
|
-
// Hide "return" method if generator return is not supported
|
|
64
|
-
if (typeof gen.return !== "function") {
|
|
65
|
-
this.return = undefined
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
AsyncGenerator.prototype[
|
|
69
|
-
(typeof Symbol === "function" && Symbol.asyncIterator) || "@@asyncIterator"
|
|
70
|
-
] = function () {
|
|
71
|
-
return this
|
|
72
|
-
}
|
|
73
|
-
AsyncGenerator.prototype.next = function (arg) {
|
|
74
|
-
return this._invoke("next", arg)
|
|
75
|
-
}
|
|
76
|
-
AsyncGenerator.prototype.throw = function (arg) {
|
|
77
|
-
return this._invoke("throw", arg)
|
|
78
|
-
}
|
|
79
|
-
AsyncGenerator.prototype.return = function (arg) {
|
|
80
|
-
return this._invoke("return", arg)
|
|
81
|
-
}
|
|
1
|
+
import AwaitValue from "../AwaitValue/AwaitValue.js"
|
|
2
|
+
|
|
3
|
+
export default function AsyncGenerator(gen) {
|
|
4
|
+
var front, back
|
|
5
|
+
function send(key, arg) {
|
|
6
|
+
return new Promise(function (resolve, reject) {
|
|
7
|
+
var request = {
|
|
8
|
+
key: key,
|
|
9
|
+
arg: arg,
|
|
10
|
+
resolve: resolve,
|
|
11
|
+
reject: reject,
|
|
12
|
+
next: null,
|
|
13
|
+
}
|
|
14
|
+
if (back) {
|
|
15
|
+
back = back.next = request
|
|
16
|
+
} else {
|
|
17
|
+
front = back = request
|
|
18
|
+
resume(key, arg)
|
|
19
|
+
}
|
|
20
|
+
})
|
|
21
|
+
}
|
|
22
|
+
function resume(key, arg) {
|
|
23
|
+
try {
|
|
24
|
+
var result = gen[key](arg)
|
|
25
|
+
var value = result.value
|
|
26
|
+
var wrappedAwait = value instanceof AwaitValue
|
|
27
|
+
Promise.resolve(wrappedAwait ? value.wrapped : value).then(
|
|
28
|
+
function (arg) {
|
|
29
|
+
if (wrappedAwait) {
|
|
30
|
+
resume(key === "return" ? "return" : "next", arg)
|
|
31
|
+
return
|
|
32
|
+
}
|
|
33
|
+
settle(result.done ? "return" : "normal", arg)
|
|
34
|
+
},
|
|
35
|
+
function (err) {
|
|
36
|
+
resume("throw", err)
|
|
37
|
+
},
|
|
38
|
+
)
|
|
39
|
+
} catch (err) {
|
|
40
|
+
settle("throw", err)
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
function settle(type, value) {
|
|
44
|
+
switch (type) {
|
|
45
|
+
case "return":
|
|
46
|
+
front.resolve({ value: value, done: true })
|
|
47
|
+
break
|
|
48
|
+
case "throw":
|
|
49
|
+
front.reject(value)
|
|
50
|
+
break
|
|
51
|
+
default:
|
|
52
|
+
front.resolve({ value: value, done: false })
|
|
53
|
+
break
|
|
54
|
+
}
|
|
55
|
+
front = front.next
|
|
56
|
+
if (front) {
|
|
57
|
+
resume(front.key, front.arg)
|
|
58
|
+
} else {
|
|
59
|
+
back = null
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
this._invoke = send
|
|
63
|
+
// Hide "return" method if generator return is not supported
|
|
64
|
+
if (typeof gen.return !== "function") {
|
|
65
|
+
this.return = undefined
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
AsyncGenerator.prototype[
|
|
69
|
+
(typeof Symbol === "function" && Symbol.asyncIterator) || "@@asyncIterator"
|
|
70
|
+
] = function () {
|
|
71
|
+
return this
|
|
72
|
+
}
|
|
73
|
+
AsyncGenerator.prototype.next = function (arg) {
|
|
74
|
+
return this._invoke("next", arg)
|
|
75
|
+
}
|
|
76
|
+
AsyncGenerator.prototype.throw = function (arg) {
|
|
77
|
+
return this._invoke("throw", arg)
|
|
78
|
+
}
|
|
79
|
+
AsyncGenerator.prototype.return = function (arg) {
|
|
80
|
+
return this._invoke("return", arg)
|
|
81
|
+
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export default function (value) {
|
|
2
|
-
this.wrapped = value
|
|
3
|
-
}
|
|
1
|
+
export default function (value) {
|
|
2
|
+
this.wrapped = value
|
|
3
|
+
}
|
|
@@ -1,33 +1,33 @@
|
|
|
1
|
-
/* eslint-disable no-void */
|
|
2
|
-
export default function _applyDecoratedDescriptor(
|
|
3
|
-
target,
|
|
4
|
-
property,
|
|
5
|
-
decorators,
|
|
6
|
-
descriptor,
|
|
7
|
-
context,
|
|
8
|
-
) {
|
|
9
|
-
var desc = {}
|
|
10
|
-
Object.keys(descriptor).forEach(function (key) {
|
|
11
|
-
desc[key] = descriptor[key]
|
|
12
|
-
})
|
|
13
|
-
desc.enumerable = Boolean(desc.enumerable)
|
|
14
|
-
desc.configurable = Boolean(desc.configurable)
|
|
15
|
-
if ("value" in desc || desc.initializer) {
|
|
16
|
-
desc.writable = true
|
|
17
|
-
}
|
|
18
|
-
desc = decorators
|
|
19
|
-
.slice()
|
|
20
|
-
.reverse()
|
|
21
|
-
.reduce(function (desc, decorator) {
|
|
22
|
-
return decorator(target, property, desc) || desc
|
|
23
|
-
}, desc)
|
|
24
|
-
if (context && desc.initializer !== void 0) {
|
|
25
|
-
desc.value = desc.initializer ? desc.initializer.call(context) : void 0
|
|
26
|
-
desc.initializer = undefined
|
|
27
|
-
}
|
|
28
|
-
if (desc.initializer === void 0) {
|
|
29
|
-
Object.defineProperty(target, property, desc)
|
|
30
|
-
desc = null
|
|
31
|
-
}
|
|
32
|
-
return desc
|
|
33
|
-
}
|
|
1
|
+
/* eslint-disable no-void */
|
|
2
|
+
export default function _applyDecoratedDescriptor(
|
|
3
|
+
target,
|
|
4
|
+
property,
|
|
5
|
+
decorators,
|
|
6
|
+
descriptor,
|
|
7
|
+
context,
|
|
8
|
+
) {
|
|
9
|
+
var desc = {}
|
|
10
|
+
Object.keys(descriptor).forEach(function (key) {
|
|
11
|
+
desc[key] = descriptor[key]
|
|
12
|
+
})
|
|
13
|
+
desc.enumerable = Boolean(desc.enumerable)
|
|
14
|
+
desc.configurable = Boolean(desc.configurable)
|
|
15
|
+
if ("value" in desc || desc.initializer) {
|
|
16
|
+
desc.writable = true
|
|
17
|
+
}
|
|
18
|
+
desc = decorators
|
|
19
|
+
.slice()
|
|
20
|
+
.reverse()
|
|
21
|
+
.reduce(function (desc, decorator) {
|
|
22
|
+
return decorator(target, property, desc) || desc
|
|
23
|
+
}, desc)
|
|
24
|
+
if (context && desc.initializer !== void 0) {
|
|
25
|
+
desc.value = desc.initializer ? desc.initializer.call(context) : void 0
|
|
26
|
+
desc.initializer = undefined
|
|
27
|
+
}
|
|
28
|
+
if (desc.initializer === void 0) {
|
|
29
|
+
Object.defineProperty(target, property, desc)
|
|
30
|
+
desc = null
|
|
31
|
+
}
|
|
32
|
+
return desc
|
|
33
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
/* eslint-disable no-eq-null, eqeqeq */
|
|
2
|
-
export default function arrayLikeToArray(arr, len) {
|
|
3
|
-
if (len == null || len > arr.length) len = arr.length
|
|
4
|
-
var arr2 = new Array(len)
|
|
5
|
-
for (var i = 0; i < len; i++) arr2[i] = arr[i]
|
|
6
|
-
return arr2
|
|
7
|
-
}
|
|
1
|
+
/* eslint-disable no-eq-null, eqeqeq */
|
|
2
|
+
export default function arrayLikeToArray(arr, len) {
|
|
3
|
+
if (len == null || len > arr.length) len = arr.length
|
|
4
|
+
var arr2 = new Array(len)
|
|
5
|
+
for (var i = 0; i < len; i++) arr2[i] = arr[i]
|
|
6
|
+
return arr2
|
|
7
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// eslint-disable-next-line consistent-return
|
|
2
|
-
export default (arr) => {
|
|
3
|
-
if (Array.isArray(arr)) return arr
|
|
4
|
-
}
|
|
1
|
+
// eslint-disable-next-line consistent-return
|
|
2
|
+
export default (arr) => {
|
|
3
|
+
if (Array.isArray(arr)) return arr
|
|
4
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import arrayLikeToArray from "../arrayLikeToArray/arrayLikeToArray.js"
|
|
2
|
-
|
|
3
|
-
// eslint-disable-next-line consistent-return
|
|
4
|
-
export default (arr) => {
|
|
5
|
-
if (Array.isArray(arr)) return arrayLikeToArray(arr)
|
|
6
|
-
}
|
|
1
|
+
import arrayLikeToArray from "../arrayLikeToArray/arrayLikeToArray.js"
|
|
2
|
+
|
|
3
|
+
// eslint-disable-next-line consistent-return
|
|
4
|
+
export default (arr) => {
|
|
5
|
+
if (Array.isArray(arr)) return arrayLikeToArray(arr)
|
|
6
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export default (self) => {
|
|
2
|
-
// eslint-disable-next-line no-void
|
|
3
|
-
if (self === void 0) {
|
|
4
|
-
throw new ReferenceError("this hasn't been initialised - super() hasn't been called")
|
|
5
|
-
}
|
|
6
|
-
return self
|
|
7
|
-
}
|
|
1
|
+
export default (self) => {
|
|
2
|
+
// eslint-disable-next-line no-void
|
|
3
|
+
if (self === void 0) {
|
|
4
|
+
throw new ReferenceError("this hasn't been initialised - super() hasn't been called")
|
|
5
|
+
}
|
|
6
|
+
return self
|
|
7
|
+
}
|
|
@@ -1,40 +1,40 @@
|
|
|
1
|
-
export default function _asyncGeneratorDelegate(inner, awaitWrap) {
|
|
2
|
-
var iter = {},
|
|
3
|
-
waiting = false
|
|
4
|
-
function pump(key, value) {
|
|
5
|
-
waiting = true
|
|
6
|
-
value = new Promise(function (resolve) {
|
|
7
|
-
resolve(inner[key](value))
|
|
8
|
-
})
|
|
9
|
-
return { done: false, value: awaitWrap(value) }
|
|
10
|
-
}
|
|
11
|
-
iter[(typeof Symbol !== "undefined" && Symbol.iterator) || "@@iterator"] = function () {
|
|
12
|
-
return this
|
|
13
|
-
}
|
|
14
|
-
iter.next = function (value) {
|
|
15
|
-
if (waiting) {
|
|
16
|
-
waiting = false
|
|
17
|
-
return value
|
|
18
|
-
}
|
|
19
|
-
return pump("next", value)
|
|
20
|
-
}
|
|
21
|
-
if (typeof inner.throw === "function") {
|
|
22
|
-
iter.throw = function (value) {
|
|
23
|
-
if (waiting) {
|
|
24
|
-
waiting = false
|
|
25
|
-
throw value
|
|
26
|
-
}
|
|
27
|
-
return pump("throw", value)
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
if (typeof inner.return === "function") {
|
|
31
|
-
iter.return = function (value) {
|
|
32
|
-
if (waiting) {
|
|
33
|
-
waiting = false
|
|
34
|
-
return value
|
|
35
|
-
}
|
|
36
|
-
return pump("return", value)
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
return iter
|
|
40
|
-
}
|
|
1
|
+
export default function _asyncGeneratorDelegate(inner, awaitWrap) {
|
|
2
|
+
var iter = {},
|
|
3
|
+
waiting = false
|
|
4
|
+
function pump(key, value) {
|
|
5
|
+
waiting = true
|
|
6
|
+
value = new Promise(function (resolve) {
|
|
7
|
+
resolve(inner[key](value))
|
|
8
|
+
})
|
|
9
|
+
return { done: false, value: awaitWrap(value) }
|
|
10
|
+
}
|
|
11
|
+
iter[(typeof Symbol !== "undefined" && Symbol.iterator) || "@@iterator"] = function () {
|
|
12
|
+
return this
|
|
13
|
+
}
|
|
14
|
+
iter.next = function (value) {
|
|
15
|
+
if (waiting) {
|
|
16
|
+
waiting = false
|
|
17
|
+
return value
|
|
18
|
+
}
|
|
19
|
+
return pump("next", value)
|
|
20
|
+
}
|
|
21
|
+
if (typeof inner.throw === "function") {
|
|
22
|
+
iter.throw = function (value) {
|
|
23
|
+
if (waiting) {
|
|
24
|
+
waiting = false
|
|
25
|
+
throw value
|
|
26
|
+
}
|
|
27
|
+
return pump("throw", value)
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
if (typeof inner.return === "function") {
|
|
31
|
+
iter.return = function (value) {
|
|
32
|
+
if (waiting) {
|
|
33
|
+
waiting = false
|
|
34
|
+
return value
|
|
35
|
+
}
|
|
36
|
+
return pump("return", value)
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
return iter
|
|
40
|
+
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
/* eslint-disable eqeqeq, no-eq-null */
|
|
2
|
-
export default function _asyncIterator(iterable) {
|
|
3
|
-
var method
|
|
4
|
-
if (typeof Symbol !== "undefined") {
|
|
5
|
-
if (Symbol.asyncIterator) method = iterable[Symbol.asyncIterator]
|
|
6
|
-
if (method == null && Symbol.iterator) method = iterable[Symbol.iterator]
|
|
7
|
-
}
|
|
8
|
-
if (method == null) method = iterable["@@asyncIterator"]
|
|
9
|
-
if (method == null) method = iterable["@@iterator"]
|
|
10
|
-
if (method == null) throw new TypeError("Object is not async iterable")
|
|
11
|
-
return method.call(iterable)
|
|
12
|
-
}
|
|
1
|
+
/* eslint-disable eqeqeq, no-eq-null */
|
|
2
|
+
export default function _asyncIterator(iterable) {
|
|
3
|
+
var method
|
|
4
|
+
if (typeof Symbol !== "undefined") {
|
|
5
|
+
if (Symbol.asyncIterator) method = iterable[Symbol.asyncIterator]
|
|
6
|
+
if (method == null && Symbol.iterator) method = iterable[Symbol.iterator]
|
|
7
|
+
}
|
|
8
|
+
if (method == null) method = iterable["@@asyncIterator"]
|
|
9
|
+
if (method == null) method = iterable["@@iterator"]
|
|
10
|
+
if (method == null) throw new TypeError("Object is not async iterable")
|
|
11
|
+
return method.call(iterable)
|
|
12
|
+
}
|
|
@@ -1,34 +1,34 @@
|
|
|
1
|
-
export default function (fn) {
|
|
2
|
-
return function () {
|
|
3
|
-
var self = this
|
|
4
|
-
// eslint-disable-next-line prefer-rest-params
|
|
5
|
-
var args = arguments
|
|
6
|
-
return new Promise(function (resolve, reject) {
|
|
7
|
-
var gen = fn.apply(self, args)
|
|
8
|
-
function _next(value) {
|
|
9
|
-
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value)
|
|
10
|
-
}
|
|
11
|
-
function _throw(err) {
|
|
12
|
-
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err)
|
|
13
|
-
}
|
|
14
|
-
_next(undefined)
|
|
15
|
-
})
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
const asyncGeneratorStep = (gen, resolve, reject, _next, _throw, key, arg) => {
|
|
20
|
-
var info
|
|
21
|
-
var value
|
|
22
|
-
try {
|
|
23
|
-
info = gen[key](arg)
|
|
24
|
-
value = info.value
|
|
25
|
-
} catch (error) {
|
|
26
|
-
reject(error)
|
|
27
|
-
return
|
|
28
|
-
}
|
|
29
|
-
if (info.done) {
|
|
30
|
-
resolve(value)
|
|
31
|
-
} else {
|
|
32
|
-
Promise.resolve(value).then(_next, _throw)
|
|
33
|
-
}
|
|
34
|
-
}
|
|
1
|
+
export default function (fn) {
|
|
2
|
+
return function () {
|
|
3
|
+
var self = this
|
|
4
|
+
// eslint-disable-next-line prefer-rest-params
|
|
5
|
+
var args = arguments
|
|
6
|
+
return new Promise(function (resolve, reject) {
|
|
7
|
+
var gen = fn.apply(self, args)
|
|
8
|
+
function _next(value) {
|
|
9
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value)
|
|
10
|
+
}
|
|
11
|
+
function _throw(err) {
|
|
12
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err)
|
|
13
|
+
}
|
|
14
|
+
_next(undefined)
|
|
15
|
+
})
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const asyncGeneratorStep = (gen, resolve, reject, _next, _throw, key, arg) => {
|
|
20
|
+
var info
|
|
21
|
+
var value
|
|
22
|
+
try {
|
|
23
|
+
info = gen[key](arg)
|
|
24
|
+
value = info.value
|
|
25
|
+
} catch (error) {
|
|
26
|
+
reject(error)
|
|
27
|
+
return
|
|
28
|
+
}
|
|
29
|
+
if (info.done) {
|
|
30
|
+
resolve(value)
|
|
31
|
+
} else {
|
|
32
|
+
Promise.resolve(value).then(_next, _throw)
|
|
33
|
+
}
|
|
34
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import AwaitValue from "../AwaitValue/AwaitValue.js"
|
|
2
|
-
|
|
3
|
-
export default function (value) {
|
|
4
|
-
return new AwaitValue(value)
|
|
5
|
-
}
|
|
1
|
+
import AwaitValue from "../AwaitValue/AwaitValue.js"
|
|
2
|
+
|
|
3
|
+
export default function (value) {
|
|
4
|
+
return new AwaitValue(value)
|
|
5
|
+
}
|
package/helpers/babel/classApplyDescriptorDestructureSet/classApplyDescriptorDestructureSet.js
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
export default function _classApplyDescriptorDestructureSet(receiver, descriptor) {
|
|
2
|
-
if (descriptor.set) {
|
|
3
|
-
if (!("__destrObj" in descriptor)) {
|
|
4
|
-
descriptor.__destrObj = {
|
|
5
|
-
// eslint-disable-next-line accessor-pairs
|
|
6
|
-
set value(v) {
|
|
7
|
-
descriptor.set.call(receiver, v)
|
|
8
|
-
},
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
return descriptor.__destrObj
|
|
12
|
-
}
|
|
13
|
-
if (!descriptor.writable) {
|
|
14
|
-
// This should only throw in strict mode, but class bodies are
|
|
15
|
-
// always strict and private fields can only be used inside
|
|
16
|
-
// class bodies.
|
|
17
|
-
throw new TypeError("attempted to set read only private field")
|
|
18
|
-
}
|
|
19
|
-
return descriptor
|
|
20
|
-
}
|
|
1
|
+
export default function _classApplyDescriptorDestructureSet(receiver, descriptor) {
|
|
2
|
+
if (descriptor.set) {
|
|
3
|
+
if (!("__destrObj" in descriptor)) {
|
|
4
|
+
descriptor.__destrObj = {
|
|
5
|
+
// eslint-disable-next-line accessor-pairs
|
|
6
|
+
set value(v) {
|
|
7
|
+
descriptor.set.call(receiver, v)
|
|
8
|
+
},
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
return descriptor.__destrObj
|
|
12
|
+
}
|
|
13
|
+
if (!descriptor.writable) {
|
|
14
|
+
// This should only throw in strict mode, but class bodies are
|
|
15
|
+
// always strict and private fields can only be used inside
|
|
16
|
+
// class bodies.
|
|
17
|
+
throw new TypeError("attempted to set read only private field")
|
|
18
|
+
}
|
|
19
|
+
return descriptor
|
|
20
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export default function _classApplyDescriptorGet(receiver, descriptor) {
|
|
2
|
-
if (descriptor.get) {
|
|
3
|
-
return descriptor.get.call(receiver)
|
|
4
|
-
}
|
|
5
|
-
return descriptor.value
|
|
6
|
-
}
|
|
1
|
+
export default function _classApplyDescriptorGet(receiver, descriptor) {
|
|
2
|
+
if (descriptor.get) {
|
|
3
|
+
return descriptor.get.call(receiver)
|
|
4
|
+
}
|
|
5
|
+
return descriptor.value
|
|
6
|
+
}
|