@microlink/function 0.1.2 → 0.1.3

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.
@@ -1 +1 @@
1
- {"version":3,"file":"microlink-function.min.js","sources":["../src/factory.js","../node_modules/.pnpm/is-url-http@2.2.7/node_modules/is-url-http/lightweight.js","../node_modules/.pnpm/flattie@1.1.0/node_modules/flattie/dist/index.js","../node_modules/.pnpm/qss@2.0.3/node_modules/qss/dist/qss.m.js","../node_modules/.pnpm/clean-stack@2.2.0/node_modules/clean-stack/index.js","../node_modules/.pnpm/mimic-fn@3.0.0/node_modules/mimic-fn/index.js","../node_modules/.pnpm/whoops@4.1.0/node_modules/whoops/lib/helpers.js","../node_modules/.pnpm/whoops@4.1.0/node_modules/whoops/lib/add-error-props.js","../node_modules/.pnpm/whoops@4.1.0/node_modules/whoops/lib/create-extend-error.js","../node_modules/.pnpm/whoops@4.1.0/node_modules/whoops/lib/create-error.js","../node_modules/.pnpm/whoops@4.1.0/node_modules/whoops/lib/index.js","../node_modules/.pnpm/@microlink+mql@0.10.13/node_modules/@microlink/mql/src/factory.js","../node_modules/.pnpm/@microlink+mql@0.10.13/node_modules/@microlink/mql/src/ky.js","../node_modules/.pnpm/@microlink+mql@0.10.13/node_modules/@microlink/mql/src/browser.js","../src/browser.js"],"sourcesContent":["'use strict'\n\nconst factory = ({ mql, VERSION, toCompress }) => {\n const microlink = (code, mqlOpts, gotOpts) => {\n const compress = toCompress(code)\n\n return async (url, opts) => {\n const { data } = await mql(\n url,\n {\n function: await compress,\n meta: false,\n ...mqlOpts,\n ...opts\n },\n gotOpts\n )\n\n return data.function\n }\n }\n\n microlink.version = VERSION\n microlink.mql = mql\n\n return microlink\n}\n\nmodule.exports = factory\n","'use strict'\n\nconst URL = global.window ? window.URL : require('url').URL\nconst REGEX_HTTP_PROTOCOL = /^https?:\\/\\//i\n\nmodule.exports = url => {\n try {\n return REGEX_HTTP_PROTOCOL.test(new URL(url).href)\n } catch (err) {\n return false\n }\n}\n","function iter(output, nullish, sep, val, key) {\n\tvar k, pfx = key ? (key + sep) : key;\n\n\tif (val == null) {\n\t\tif (nullish) output[key] = val;\n\t} else if (typeof val != 'object') {\n\t\toutput[key] = val;\n\t} else if (Array.isArray(val)) {\n\t\tfor (k=0; k < val.length; k++) {\n\t\t\titer(output, nullish, sep, val[k], pfx + k);\n\t\t}\n\t} else {\n\t\tfor (k in val) {\n\t\t\titer(output, nullish, sep, val[k], pfx + k);\n\t\t}\n\t}\n}\n\nfunction flattie(input, glue, toNull) {\n\tvar output = {};\n\tif (typeof input == 'object') {\n\t\titer(output, !!toNull, glue || '.', input, '');\n\t}\n\treturn output;\n}\n\nexports.flattie = flattie;","export function encode(obj, pfx) {\n\tvar k, i, tmp, str='';\n\n\tfor (k in obj) {\n\t\tif ((tmp = obj[k]) !== void 0) {\n\t\t\tif (Array.isArray(tmp)) {\n\t\t\t\tfor (i=0; i < tmp.length; i++) {\n\t\t\t\t\tstr && (str += '&');\n\t\t\t\t\tstr += encodeURIComponent(k) + '=' + encodeURIComponent(tmp[i]);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tstr && (str += '&');\n\t\t\t\tstr += encodeURIComponent(k) + '=' + encodeURIComponent(tmp);\n\t\t\t}\n\t\t}\n\t}\n\n\treturn (pfx || '') + str;\n}\n\nfunction toValue(mix) {\n\tif (!mix) return '';\n\tvar str = decodeURIComponent(mix);\n\tif (str === 'false') return false;\n\tif (str === 'true') return true;\n\treturn (+str * 0 === 0) ? (+str) : str;\n}\n\nexport function decode(str) {\n\tvar tmp, k, out={}, arr=str.split('&');\n\n\twhile (tmp = arr.shift()) {\n\t\ttmp = tmp.split('=');\n\t\tk = tmp.shift();\n\t\tif (out[k] !== void 0) {\n\t\t\tout[k] = [].concat(out[k], toValue(tmp.shift()));\n\t\t} else {\n\t\t\tout[k] = toValue(tmp.shift());\n\t\t}\n\t}\n\n\treturn out;\n}\n","'use strict';\nconst os = require('os');\n\nconst extractPathRegex = /\\s+at.*(?:\\(|\\s)(.*)\\)?/;\nconst pathRegex = /^(?:(?:(?:node|(?:internal\\/[\\w/]*|.*node_modules\\/(?:babel-polyfill|pirates)\\/.*)?\\w+)\\.js:\\d+:\\d+)|native)/;\nconst homeDir = typeof os.homedir === 'undefined' ? '' : os.homedir();\n\nmodule.exports = (stack, options) => {\n\toptions = Object.assign({pretty: false}, options);\n\n\treturn stack.replace(/\\\\/g, '/')\n\t\t.split('\\n')\n\t\t.filter(line => {\n\t\t\tconst pathMatches = line.match(extractPathRegex);\n\t\t\tif (pathMatches === null || !pathMatches[1]) {\n\t\t\t\treturn true;\n\t\t\t}\n\n\t\t\tconst match = pathMatches[1];\n\n\t\t\t// Electron\n\t\t\tif (\n\t\t\t\tmatch.includes('.app/Contents/Resources/electron.asar') ||\n\t\t\t\tmatch.includes('.app/Contents/Resources/default_app.asar')\n\t\t\t) {\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\treturn !pathRegex.test(match);\n\t\t})\n\t\t.filter(line => line.trim() !== '')\n\t\t.map(line => {\n\t\t\tif (options.pretty) {\n\t\t\t\treturn line.replace(extractPathRegex, (m, p1) => m.replace(p1, p1.replace(homeDir, '~')));\n\t\t\t}\n\n\t\t\treturn line;\n\t\t})\n\t\t.join('\\n');\n};\n","'use strict';\n\nconst copyProperty = (to, from, property, ignoreNonConfigurable) => {\n\t// `Function#length` should reflect the parameters of `to` not `from` since we keep its body.\n\t// `Function#prototype` is non-writable and non-configurable so can never be modified.\n\tif (property === 'length' || property === 'prototype') {\n\t\treturn;\n\t}\n\n\tconst toDescriptor = Object.getOwnPropertyDescriptor(to, property);\n\tconst fromDescriptor = Object.getOwnPropertyDescriptor(from, property);\n\n\tif (!canCopyProperty(toDescriptor, fromDescriptor) && ignoreNonConfigurable) {\n\t\treturn;\n\t}\n\n\tObject.defineProperty(to, property, fromDescriptor);\n};\n\n// `Object.defineProperty()` throws if the property exists, is not configurable and either:\n// - one its descriptors is changed\n// - it is non-writable and its value is changed\nconst canCopyProperty = function (toDescriptor, fromDescriptor) {\n\treturn toDescriptor === undefined || toDescriptor.configurable || (\n\t\ttoDescriptor.writable === fromDescriptor.writable &&\n\t\ttoDescriptor.enumerable === fromDescriptor.enumerable &&\n\t\ttoDescriptor.configurable === fromDescriptor.configurable &&\n\t\t(toDescriptor.writable || toDescriptor.value === fromDescriptor.value)\n\t);\n};\n\nconst changePrototype = (to, from) => {\n\tconst fromPrototype = Object.getPrototypeOf(from);\n\tif (fromPrototype === Object.getPrototypeOf(to)) {\n\t\treturn;\n\t}\n\n\tObject.setPrototypeOf(to, fromPrototype);\n};\n\nconst wrappedToString = (withName, fromBody) => `/* Wrapped ${withName}*/\\n${fromBody}`;\n\nconst toStringDescriptor = Object.getOwnPropertyDescriptor(Function.prototype, 'toString');\nconst toStringName = Object.getOwnPropertyDescriptor(Function.prototype.toString, 'name');\n\n// We call `from.toString()` early (not lazily) to ensure `from` can be garbage collected.\n// We use `bind()` instead of a closure for the same reason.\n// Calling `from.toString()` early also allows caching it in case `to.toString()` is called several times.\nconst changeToString = (to, from, name) => {\n\tconst withName = name === '' ? '' : `with ${name.trim()}() `;\n\tconst newToString = wrappedToString.bind(null, withName, from.toString());\n\t// Ensure `to.toString.toString` is non-enumerable and has the same `same`\n\tObject.defineProperty(newToString, 'name', toStringName);\n\tObject.defineProperty(to, 'toString', {...toStringDescriptor, value: newToString});\n};\n\nconst mimicFn = (to, from, {ignoreNonConfigurable = false} = {}) => {\n\tconst {name} = to;\n\n\tfor (const property of Reflect.ownKeys(from)) {\n\t\tcopyProperty(to, from, property, ignoreNonConfigurable);\n\t}\n\n\tchangePrototype(to, from);\n\tchangeToString(to, from, name);\n\n\treturn to;\n};\n\nmodule.exports = mimicFn;\n","'use strict'\n\nmodule.exports = {\n isFunction: obj => typeof obj === 'function',\n isString: obj => typeof obj === 'string',\n composeErrorMessage: (code, description) => `${code}, ${description}`,\n inherits: (ctor, superCtor) => {\n ctor.super_ = superCtor\n ctor.prototype = Object.create(superCtor.prototype, {\n constructor: {\n value: ctor,\n enumerable: false,\n writable: true,\n configurable: true\n }\n })\n }\n}\n","'use strict'\n\nconst {isFunction, composeErrorMessage} = require('./helpers')\n\nfunction interfaceObject (error, ...props) {\n Object.assign(error, ...props)\n\n error.description = isFunction(error.message) ? error.message(error) : error.message\n\n error.message = error.code\n ? composeErrorMessage(error.code, error.description)\n : error.description\n}\n\nmodule.exports = interfaceObject\n","'use strict'\n\nconst cleanStack = require('clean-stack')\nconst mimicFn = require('mimic-fn')\n\nconst addErrorProps = require('./add-error-props')\nconst {isString} = require('./helpers')\n\nfunction createExtendError (ErrorClass, classProps) {\n function ExtendError (props) {\n const error = new ErrorClass()\n const errorProps = isString(props) ? {message: props} : props\n addErrorProps(error, classProps, errorProps)\n\n error.stack = cleanStack(error.stack)\n return error\n }\n\n ExtendError.prototype = ErrorClass.prototype\n mimicFn(ExtendError, ErrorClass)\n\n return ExtendError\n}\n\nmodule.exports = createExtendError\n","'use strict'\n\nconst {inherits} = require('./helpers')\nconst mimicFn = require('mimic-fn')\n\nconst REGEX_CLASS_NAME = /[^0-9a-zA-Z_$]/\n\nfunction createError (className) {\n if (typeof className !== 'string') {\n throw new TypeError('Expected className to be a string')\n }\n\n if (REGEX_CLASS_NAME.test(className)) {\n throw new Error('className contains invalid characters')\n }\n\n function ErrorClass () {\n Object.defineProperty(this, 'name', {\n configurable: true,\n value: className,\n writable: true\n })\n\n Error.captureStackTrace(this, this.constructor)\n }\n\n inherits(ErrorClass, Error)\n mimicFn(ErrorClass, Error)\n return ErrorClass\n}\n\nmodule.exports = createError\n","'use strict'\n\nconst createExtendError = require('./create-extend-error')\nconst createError = require('./create-error')\n\nconst createErrorClass = ErrorClass => (className, props) => {\n const errorClass = createError(className || ErrorClass.name)\n return createExtendError(errorClass, props)\n}\n\nmodule.exports = createErrorClass(Error)\nmodule.exports.type = createErrorClass(TypeError)\nmodule.exports.range = createErrorClass(RangeError)\nmodule.exports.eval = createErrorClass(EvalError)\nmodule.exports.syntax = createErrorClass(SyntaxError)\nmodule.exports.reference = createErrorClass(ReferenceError)\nmodule.exports.uri = createErrorClass(URIError)\n","const ENDPOINT = {\n FREE: 'https://api.microlink.io',\n PRO: 'https://pro.microlink.io'\n}\n\nconst isObject = input => input !== null && typeof input === 'object'\n\nconst parseBody = (input, error, url) => {\n try {\n return JSON.parse(input)\n } catch (_) {\n const message = input || error.message\n\n return {\n status: 'error',\n data: { url: message },\n more: 'https://microlink.io/efatalclient',\n code: 'EFATALCLIENT',\n message,\n url\n }\n }\n}\n\nconst factory = ({\n VERSION,\n MicrolinkError,\n isUrlHttp,\n stringify,\n got,\n flatten\n}) => {\n const assertUrl = (url = '') => {\n if (!isUrlHttp(url)) {\n const message = `The \\`url\\` as \\`${url}\\` is not valid. Ensure it has protocol (http or https) and hostname.`\n throw new MicrolinkError({\n status: 'fail',\n data: { url: message },\n more: 'https://microlink.io/docs/api/api-parameters/url',\n code: 'EINVALURLCLIENT',\n message,\n url\n })\n }\n }\n\n const mapRules = rules => {\n if (!isObject(rules)) return\n const flatRules = flatten(rules)\n return Object.keys(flatRules).reduce(\n (acc, key) => ({ ...acc, [`data.${key}`]: flatRules[key].toString() }),\n {}\n )\n }\n\n const fetchFromApi = async (apiUrl, opts = {}, retryCount = 0) => {\n try {\n const response = await got(apiUrl, opts)\n return opts.responseType === 'buffer'\n ? { body: response.body, response }\n : { ...response.body, response }\n } catch (err) {\n const { response = {} } = err\n const { statusCode, body: rawBody, headers, url: uri = apiUrl } = response\n const isBuffer = Buffer.isBuffer(rawBody)\n\n const body =\n isObject(rawBody) && !isBuffer\n ? rawBody\n : parseBody(isBuffer ? rawBody.toString() : rawBody, err, uri)\n\n if (body.code === 'EFATALCLIENT' && retryCount++ < 2) {\n return fetchFromApi(apiUrl, opts, retryCount)\n }\n\n throw MicrolinkError({\n ...body,\n message: body.message,\n url: uri,\n statusCode,\n headers\n })\n }\n }\n\n const getApiUrl = (\n url,\n { data, apiKey, endpoint, retry, cache, ...opts } = {},\n { responseType = 'json', headers: gotHeaders, ...gotOpts } = {}\n ) => {\n const isPro = !!apiKey\n const apiEndpoint = endpoint || ENDPOINT[isPro ? 'PRO' : 'FREE']\n\n const apiUrl = `${apiEndpoint}?${stringify({\n url,\n ...mapRules(data),\n ...flatten(opts)\n })}`\n\n const headers = isPro\n ? { ...gotHeaders, 'x-api-key': apiKey }\n : { ...gotHeaders }\n return [apiUrl, { ...gotOpts, responseType, cache, retry, headers }]\n }\n\n const createMql = defaultOpts => async (url, opts, gotOpts) => {\n assertUrl(url)\n const [apiUrl, fetchOpts] = getApiUrl(url, opts, {\n ...defaultOpts,\n ...gotOpts\n })\n return fetchFromApi(apiUrl, fetchOpts)\n }\n\n const mql = createMql()\n mql.MicrolinkError = MicrolinkError\n mql.getApiUrl = getApiUrl\n mql.fetchFromApi = fetchFromApi\n mql.mapRules = mapRules\n mql.version = VERSION\n mql.stream = got.stream\n mql.buffer = createMql({ responseType: 'buffer' })\n\n return mql\n}\n\nmodule.exports = factory\n","(function (global, factory) {\n\ttypeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :\n\ttypeof define === 'function' && define.amd ? define(factory) :\n\t(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.ky = factory());\n}(this, (function () { 'use strict';\n\n\t/*! MIT License © Sindre Sorhus */\n\n\tconst isObject = value => value !== null && typeof value === 'object';\n\tconst supportsAbortController = typeof globalThis.AbortController === 'function';\n\tconst supportsStreams = typeof globalThis.ReadableStream === 'function';\n\tconst supportsFormData = typeof globalThis.FormData === 'function';\n\n\tconst mergeHeaders = (source1, source2) => {\n\t\tconst result = new globalThis.Headers(source1 || {});\n\t\tconst isHeadersInstance = source2 instanceof globalThis.Headers;\n\t\tconst source = new globalThis.Headers(source2 || {});\n\n\t\tfor (const [key, value] of source) {\n\t\t\tif ((isHeadersInstance && value === 'undefined') || value === undefined) {\n\t\t\t\tresult.delete(key);\n\t\t\t} else {\n\t\t\t\tresult.set(key, value);\n\t\t\t}\n\t\t}\n\n\t\treturn result;\n\t};\n\n\tconst deepMerge = (...sources) => {\n\t\tlet returnValue = {};\n\t\tlet headers = {};\n\n\t\tfor (const source of sources) {\n\t\t\tif (Array.isArray(source)) {\n\t\t\t\tif (!(Array.isArray(returnValue))) {\n\t\t\t\t\treturnValue = [];\n\t\t\t\t}\n\n\t\t\t\treturnValue = [...returnValue, ...source];\n\t\t\t} else if (isObject(source)) {\n\t\t\t\tfor (let [key, value] of Object.entries(source)) {\n\t\t\t\t\tif (isObject(value) && (key in returnValue)) {\n\t\t\t\t\t\tvalue = deepMerge(returnValue[key], value);\n\t\t\t\t\t}\n\n\t\t\t\t\treturnValue = {...returnValue, [key]: value};\n\t\t\t\t}\n\n\t\t\t\tif (isObject(source.headers)) {\n\t\t\t\t\theaders = mergeHeaders(headers, source.headers);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturnValue.headers = headers;\n\t\t}\n\n\t\treturn returnValue;\n\t};\n\n\tconst requestMethods = [\n\t\t'get',\n\t\t'post',\n\t\t'put',\n\t\t'patch',\n\t\t'head',\n\t\t'delete'\n\t];\n\n\tconst responseTypes = {\n\t\tjson: 'application/json',\n\t\ttext: 'text/*',\n\t\tformData: 'multipart/form-data',\n\t\tarrayBuffer: '*/*',\n\t\tblob: '*/*'\n\t};\n\n\tconst retryMethods = [\n\t\t'get',\n\t\t'put',\n\t\t'head',\n\t\t'delete',\n\t\t'options',\n\t\t'trace'\n\t];\n\n\tconst retryStatusCodes = [\n\t\t408,\n\t\t413,\n\t\t429,\n\t\t500,\n\t\t502,\n\t\t503,\n\t\t504\n\t];\n\n\tconst retryAfterStatusCodes = [\n\t\t413,\n\t\t429,\n\t\t503\n\t];\n\n\tconst stop = Symbol('stop');\n\n\tclass HTTPError extends Error {\n\t\tconstructor(response, request, options) {\n\t\t\t// Set the message to the status text, such as Unauthorized,\n\t\t\t// with some fallbacks. This message should never be undefined.\n\t\t\tsuper(\n\t\t\t\tresponse.statusText ||\n\t\t\t\tString(\n\t\t\t\t\t(response.status === 0 || response.status) ?\n\t\t\t\t\t\tresponse.status : 'Unknown response error'\n\t\t\t\t)\n\t\t\t);\n\t\t\tthis.name = 'HTTPError';\n\t\t\tthis.response = response;\n\t\t\tthis.request = request;\n\t\t\tthis.options = options;\n\t\t}\n\t}\n\n\tclass TimeoutError extends Error {\n\t\tconstructor(request) {\n\t\t\tsuper('Request timed out');\n\t\t\tthis.name = 'TimeoutError';\n\t\t\tthis.request = request;\n\t\t}\n\t}\n\n\tconst delay = ms => new Promise(resolve => setTimeout(resolve, ms));\n\n\t// `Promise.race()` workaround (#91)\n\tconst timeout = (request, abortController, options) =>\n\t\tnew Promise((resolve, reject) => {\n\t\t\tconst timeoutID = setTimeout(() => {\n\t\t\t\tif (abortController) {\n\t\t\t\t\tabortController.abort();\n\t\t\t\t}\n\n\t\t\t\treject(new TimeoutError(request));\n\t\t\t}, options.timeout);\n\n\t\t\t/* eslint-disable promise/prefer-await-to-then */\n\t\t\toptions.fetch(request)\n\t\t\t\t.then(resolve)\n\t\t\t\t.catch(reject)\n\t\t\t\t.then(() => {\n\t\t\t\t\tclearTimeout(timeoutID);\n\t\t\t\t});\n\t\t\t/* eslint-enable promise/prefer-await-to-then */\n\t\t});\n\n\tconst normalizeRequestMethod = input => requestMethods.includes(input) ? input.toUpperCase() : input;\n\n\tconst defaultRetryOptions = {\n\t\tlimit: 2,\n\t\tmethods: retryMethods,\n\t\tstatusCodes: retryStatusCodes,\n\t\tafterStatusCodes: retryAfterStatusCodes\n\t};\n\n\tconst normalizeRetryOptions = (retry = {}) => {\n\t\tif (typeof retry === 'number') {\n\t\t\treturn {\n\t\t\t\t...defaultRetryOptions,\n\t\t\t\tlimit: retry\n\t\t\t};\n\t\t}\n\n\t\tif (retry.methods && !Array.isArray(retry.methods)) {\n\t\t\tthrow new Error('retry.methods must be an array');\n\t\t}\n\n\t\tif (retry.statusCodes && !Array.isArray(retry.statusCodes)) {\n\t\t\tthrow new Error('retry.statusCodes must be an array');\n\t\t}\n\n\t\treturn {\n\t\t\t...defaultRetryOptions,\n\t\t\t...retry,\n\t\t\tafterStatusCodes: retryAfterStatusCodes\n\t\t};\n\t};\n\n\t// The maximum value of a 32bit int (see issue #117)\n\tconst maxSafeTimeout = 2147483647;\n\n\tclass Ky {\n\t\tconstructor(input, options = {}) {\n\t\t\tthis._retryCount = 0;\n\t\t\tthis._input = input;\n\t\t\tthis._options = {\n\t\t\t\t// TODO: credentials can be removed when the spec change is implemented in all browsers. Context: https://www.chromestatus.com/feature/4539473312350208\n\t\t\t\tcredentials: this._input.credentials || 'same-origin',\n\t\t\t\t...options,\n\t\t\t\theaders: mergeHeaders(this._input.headers, options.headers),\n\t\t\t\thooks: deepMerge({\n\t\t\t\t\tbeforeRequest: [],\n\t\t\t\t\tbeforeRetry: [],\n\t\t\t\t\tafterResponse: []\n\t\t\t\t}, options.hooks),\n\t\t\t\tmethod: normalizeRequestMethod(options.method || this._input.method),\n\t\t\t\tprefixUrl: String(options.prefixUrl || ''),\n\t\t\t\tretry: normalizeRetryOptions(options.retry),\n\t\t\t\tthrowHttpErrors: options.throwHttpErrors !== false,\n\t\t\t\ttimeout: typeof options.timeout === 'undefined' ? 10000 : options.timeout,\n\t\t\t\tfetch: options.fetch || globalThis.fetch.bind(globalThis)\n\t\t\t};\n\n\t\t\tif (typeof this._input !== 'string' && !(this._input instanceof URL || this._input instanceof globalThis.Request)) {\n\t\t\t\tthrow new TypeError('`input` must be a string, URL, or Request');\n\t\t\t}\n\n\t\t\tif (this._options.prefixUrl && typeof this._input === 'string') {\n\t\t\t\tif (this._input.startsWith('/')) {\n\t\t\t\t\tthrow new Error('`input` must not begin with a slash when using `prefixUrl`');\n\t\t\t\t}\n\n\t\t\t\tif (!this._options.prefixUrl.endsWith('/')) {\n\t\t\t\t\tthis._options.prefixUrl += '/';\n\t\t\t\t}\n\n\t\t\t\tthis._input = this._options.prefixUrl + this._input;\n\t\t\t}\n\n\t\t\tif (supportsAbortController) {\n\t\t\t\tthis.abortController = new globalThis.AbortController();\n\t\t\t\tif (this._options.signal) {\n\t\t\t\t\tthis._options.signal.addEventListener('abort', () => {\n\t\t\t\t\t\tthis.abortController.abort();\n\t\t\t\t\t});\n\t\t\t\t}\n\n\t\t\t\tthis._options.signal = this.abortController.signal;\n\t\t\t}\n\n\t\t\tthis.request = new globalThis.Request(this._input, this._options);\n\n\t\t\tif (this._options.searchParams) {\n\t\t\t\tconst textSearchParams = typeof this._options.searchParams === 'string' ?\n\t\t\t\t\tthis._options.searchParams.replace(/^\\?/, '') :\n\t\t\t\t\tnew URLSearchParams(this._options.searchParams).toString();\n\t\t\t\tconst searchParams = '?' + textSearchParams;\n\t\t\t\tconst url = this.request.url.replace(/(?:\\?.*?)?(?=#|$)/, searchParams);\n\n\t\t\t\t// To provide correct form boundary, Content-Type header should be deleted each time when new Request instantiated from another one\n\t\t\t\tif (((supportsFormData && this._options.body instanceof globalThis.FormData) || this._options.body instanceof URLSearchParams) && !(this._options.headers && this._options.headers['content-type'])) {\n\t\t\t\t\tthis.request.headers.delete('content-type');\n\t\t\t\t}\n\n\t\t\t\tthis.request = new globalThis.Request(new globalThis.Request(url, this.request), this._options);\n\t\t\t}\n\n\t\t\tif (this._options.json !== undefined) {\n\t\t\t\tthis._options.body = JSON.stringify(this._options.json);\n\t\t\t\tthis.request.headers.set('content-type', 'application/json');\n\t\t\t\tthis.request = new globalThis.Request(this.request, {body: this._options.body});\n\t\t\t}\n\n\t\t\tconst fn = async () => {\n\t\t\t\tif (this._options.timeout > maxSafeTimeout) {\n\t\t\t\t\tthrow new RangeError(`The \\`timeout\\` option cannot be greater than ${maxSafeTimeout}`);\n\t\t\t\t}\n\n\t\t\t\tawait delay(1);\n\t\t\t\tlet response = await this._fetch();\n\n\t\t\t\tfor (const hook of this._options.hooks.afterResponse) {\n\t\t\t\t\t// eslint-disable-next-line no-await-in-loop\n\t\t\t\t\tconst modifiedResponse = await hook(\n\t\t\t\t\t\tthis.request,\n\t\t\t\t\t\tthis._options,\n\t\t\t\t\t\tthis._decorateResponse(response.clone())\n\t\t\t\t\t);\n\n\t\t\t\t\tif (modifiedResponse instanceof globalThis.Response) {\n\t\t\t\t\t\tresponse = modifiedResponse;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tthis._decorateResponse(response);\n\n\t\t\t\tif (!response.ok && this._options.throwHttpErrors) {\n\t\t\t\t\tthrow new HTTPError(response, this.request, this._options);\n\t\t\t\t}\n\n\t\t\t\t// If `onDownloadProgress` is passed, it uses the stream API internally\n\t\t\t\t/* istanbul ignore next */\n\t\t\t\tif (this._options.onDownloadProgress) {\n\t\t\t\t\tif (typeof this._options.onDownloadProgress !== 'function') {\n\t\t\t\t\t\tthrow new TypeError('The `onDownloadProgress` option must be a function');\n\t\t\t\t\t}\n\n\t\t\t\t\tif (!supportsStreams) {\n\t\t\t\t\t\tthrow new Error('Streams are not supported in your environment. `ReadableStream` is missing.');\n\t\t\t\t\t}\n\n\t\t\t\t\treturn this._stream(response.clone(), this._options.onDownloadProgress);\n\t\t\t\t}\n\n\t\t\t\treturn response;\n\t\t\t};\n\n\t\t\tconst isRetriableMethod = this._options.retry.methods.includes(this.request.method.toLowerCase());\n\t\t\tconst result = isRetriableMethod ? this._retry(fn) : fn();\n\n\t\t\tfor (const [type, mimeType] of Object.entries(responseTypes)) {\n\t\t\t\tresult[type] = async () => {\n\t\t\t\t\tthis.request.headers.set('accept', this.request.headers.get('accept') || mimeType);\n\n\t\t\t\t\tconst response = (await result).clone();\n\n\t\t\t\t\tif (type === 'json') {\n\t\t\t\t\t\tif (response.status === 204) {\n\t\t\t\t\t\t\treturn '';\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (options.parseJson) {\n\t\t\t\t\t\t\treturn options.parseJson(await response.text());\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\treturn response[type]();\n\t\t\t\t};\n\t\t\t}\n\n\t\t\treturn result;\n\t\t}\n\n\t\t_calculateRetryDelay(error) {\n\t\t\tthis._retryCount++;\n\n\t\t\tif (this._retryCount < this._options.retry.limit && !(error instanceof TimeoutError)) {\n\t\t\t\tif (error instanceof HTTPError) {\n\t\t\t\t\tif (!this._options.retry.statusCodes.includes(error.response.status)) {\n\t\t\t\t\t\treturn 0;\n\t\t\t\t\t}\n\n\t\t\t\t\tconst retryAfter = error.response.headers.get('Retry-After');\n\t\t\t\t\tif (retryAfter && this._options.retry.afterStatusCodes.includes(error.response.status)) {\n\t\t\t\t\t\tlet after = Number(retryAfter);\n\t\t\t\t\t\tif (Number.isNaN(after)) {\n\t\t\t\t\t\t\tafter = Date.parse(retryAfter) - Date.now();\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tafter *= 1000;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (typeof this._options.retry.maxRetryAfter !== 'undefined' && after > this._options.retry.maxRetryAfter) {\n\t\t\t\t\t\t\treturn 0;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\treturn after;\n\t\t\t\t\t}\n\n\t\t\t\t\tif (error.response.status === 413) {\n\t\t\t\t\t\treturn 0;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tconst BACKOFF_FACTOR = 0.3;\n\t\t\t\treturn BACKOFF_FACTOR * (2 ** (this._retryCount - 1)) * 1000;\n\t\t\t}\n\n\t\t\treturn 0;\n\t\t}\n\n\t\t_decorateResponse(response) {\n\t\t\tif (this._options.parseJson) {\n\t\t\t\tresponse.json = async () => {\n\t\t\t\t\treturn this._options.parseJson(await response.text());\n\t\t\t\t};\n\t\t\t}\n\n\t\t\treturn response;\n\t\t}\n\n\t\tasync _retry(fn) {\n\t\t\ttry {\n\t\t\t\treturn await fn();\n\t\t\t} catch (error) {\n\t\t\t\tconst ms = Math.min(this._calculateRetryDelay(error), maxSafeTimeout);\n\t\t\t\tif (ms !== 0 && this._retryCount > 0) {\n\t\t\t\t\tawait delay(ms);\n\n\t\t\t\t\tfor (const hook of this._options.hooks.beforeRetry) {\n\t\t\t\t\t\t// eslint-disable-next-line no-await-in-loop\n\t\t\t\t\t\tconst hookResult = await hook({\n\t\t\t\t\t\t\trequest: this.request,\n\t\t\t\t\t\t\toptions: this._options,\n\t\t\t\t\t\t\terror,\n\t\t\t\t\t\t\tretryCount: this._retryCount\n\t\t\t\t\t\t});\n\n\t\t\t\t\t\t// If `stop` is returned from the hook, the retry process is stopped\n\t\t\t\t\t\tif (hookResult === stop) {\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\treturn this._retry(fn);\n\t\t\t\t}\n\n\t\t\t\tif (this._options.throwHttpErrors) {\n\t\t\t\t\tthrow error;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tasync _fetch() {\n\t\t\tfor (const hook of this._options.hooks.beforeRequest) {\n\t\t\t\t// eslint-disable-next-line no-await-in-loop\n\t\t\t\tconst result = await hook(this.request, this._options);\n\n\t\t\t\tif (result instanceof Request) {\n\t\t\t\t\tthis.request = result;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tif (result instanceof Response) {\n\t\t\t\t\treturn result;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (this._options.timeout === false) {\n\t\t\t\treturn this._options.fetch(this.request.clone());\n\t\t\t}\n\n\t\t\treturn timeout(this.request.clone(), this.abortController, this._options);\n\t\t}\n\n\t\t/* istanbul ignore next */\n\t\t_stream(response, onDownloadProgress) {\n\t\t\tconst totalBytes = Number(response.headers.get('content-length')) || 0;\n\t\t\tlet transferredBytes = 0;\n\n\t\t\treturn new globalThis.Response(\n\t\t\t\tnew globalThis.ReadableStream({\n\t\t\t\t\tasync start(controller) {\n\t\t\t\t\t\tconst reader = response.body.getReader();\n\n\t\t\t\t\t\tif (onDownloadProgress) {\n\t\t\t\t\t\t\tonDownloadProgress({percent: 0, transferredBytes: 0, totalBytes}, new Uint8Array());\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tasync function read() {\n\t\t\t\t\t\t\tconst {done, value} = await reader.read();\n\t\t\t\t\t\t\tif (done) {\n\t\t\t\t\t\t\t\tcontroller.close();\n\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tif (onDownloadProgress) {\n\t\t\t\t\t\t\t\ttransferredBytes += value.byteLength;\n\t\t\t\t\t\t\t\tconst percent = totalBytes === 0 ? 0 : transferredBytes / totalBytes;\n\t\t\t\t\t\t\t\tonDownloadProgress({percent, transferredBytes, totalBytes}, value);\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tcontroller.enqueue(value);\n\t\t\t\t\t\t\tawait read();\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tawait read();\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t\t);\n\t\t}\n\t}\n\n\tconst validateAndMerge = (...sources) => {\n\t\tfor (const source of sources) {\n\t\t\tif ((!isObject(source) || Array.isArray(source)) && typeof source !== 'undefined') {\n\t\t\t\tthrow new TypeError('The `options` argument must be an object');\n\t\t\t}\n\t\t}\n\n\t\treturn deepMerge({}, ...sources);\n\t};\n\n\tconst createInstance = defaults => {\n\t\tconst ky = (input, options) => new Ky(input, validateAndMerge(defaults, options));\n\n\t\tfor (const method of requestMethods) {\n\t\t\tky[method] = (input, options) => new Ky(input, validateAndMerge(defaults, options, {method}));\n\t\t}\n\n\t\tky.HTTPError = HTTPError;\n\t\tky.TimeoutError = TimeoutError;\n\t\tky.create = newDefaults => createInstance(validateAndMerge(newDefaults));\n\t\tky.extend = newDefaults => createInstance(validateAndMerge(defaults, newDefaults));\n\t\tky.stop = stop;\n\n\t\treturn ky;\n\t};\n\n\tconst ky = createInstance();\n\n\treturn ky;\n\n})));\n","'use strict'\n\nconst isUrlHttp = require('is-url-http/lightweight')\nconst { flattie: flatten } = require('flattie')\nconst { encode: stringify } = require('qss')\nconst whoops = require('whoops')\n\nconst factory = require('./factory')\nconst ky = require('./ky')\n\nconst MicrolinkError = whoops('MicrolinkError')\n\nconst got = async (url, opts) => {\n try {\n if (opts.timeout === undefined) opts.timeout = false\n const response = await ky(url, opts)\n const body = await response.json()\n const { headers, status: statusCode, statusText: statusMessage } = response\n return { url: response.url, body, headers, statusCode, statusMessage }\n } catch (err) {\n if (err.response) {\n const { response } = err\n err.response = {\n ...response,\n headers: [...response.headers.entries()].reduce(\n (acc, [key, value]) => ({ ...acc, [key]: value }),\n {}\n ),\n statusCode: response.status,\n body: await response.text()\n }\n }\n throw err\n }\n}\n\nmodule.exports = factory({\n MicrolinkError,\n isUrlHttp,\n stringify,\n got,\n flatten,\n VERSION: '__MQL_VERSION__'\n})\n","'use strict'\n\nmodule.exports = require('./factory')({\n mql: require('@microlink/mql'),\n toCompress: code => code.toString(),\n VERSION: '__VERSION__'\n})\n"],"names":["factory_1","mql","VERSION","toCompress","microlink","code","mqlOpts","gotOpts","compress","async","url","opts","data","function","meta","version","URL","global","window","require$$0","REGEX_HTTP_PROTOCOL","iter","output","nullish","sep","val","key","k","pfx","Array","isArray","length","toValue","mix","str","decodeURIComponent","input","glue","toNull","obj","i","tmp","encodeURIComponent","out","arr","split","shift","concat","os","extractPathRegex","pathRegex","homeDir","homedir","copyProperty","to","from","property","ignoreNonConfigurable","toDescriptor","Object","getOwnPropertyDescriptor","fromDescriptor","canCopyProperty","defineProperty","undefined","configurable","writable","enumerable","value","wrappedToString","withName","fromBody","toStringDescriptor","Function","prototype","toStringName","toString","mimicFn_1","name","Reflect","ownKeys","fromPrototype","getPrototypeOf","setPrototypeOf","changePrototype","trim","newToString","bind","changeToString","helpers","isFunction","isString","composeErrorMessage","description","inherits","ctor","superCtor","super_","create","constructor","cleanStack","stack","options","assign","pretty","replace","filter","line","pathMatches","match","includes","test","map","m","p1","join","mimicFn","require$$1","addErrorProps","error","props","message","require$$3","createExtendError_1","ErrorClass","classProps","ExtendError","errorProps","REGEX_CLASS_NAME","createExtendError","createError","className","TypeError","Error","this","captureStackTrace","createErrorClass","errorClass","RangeError","EvalError","SyntaxError","ReferenceError","URIError","ENDPOINT","FREE","PRO","isObject","MicrolinkError","isUrlHttp","stringify","got","flatten","mapRules","rules","flatRules","keys","reduce","acc","fetchFromApi","apiUrl","retryCount","response","responseType","body","err","statusCode","rawBody","headers","uri","isBuffer","Buffer","JSON","parse","_","status","more","parseBody","getApiUrl","apiKey","endpoint","retry","cache","gotHeaders","isPro","createMql","defaultOpts","assertUrl","fetchOpts","stream","buffer","module","supportsAbortController","globalThis","AbortController","supportsStreams","ReadableStream","supportsFormData","FormData","mergeHeaders","source1","source2","result","Headers","isHeadersInstance","source","delete","set","deepMerge","sources","returnValue","entries","requestMethods","responseTypes","json","text","formData","arrayBuffer","blob","retryMethods","retryStatusCodes","retryAfterStatusCodes","stop","Symbol","HTTPError","request","super","statusText","String","TimeoutError","delay","ms","Promise","resolve","setTimeout","timeout","abortController","reject","timeoutID","abort","fetch","then","catch","clearTimeout","normalizeRequestMethod","toUpperCase","defaultRetryOptions","limit","methods","statusCodes","afterStatusCodes","normalizeRetryOptions","maxSafeTimeout","Ky","_retryCount","_input","_options","credentials","hooks","beforeRequest","beforeRetry","afterResponse","method","prefixUrl","throwHttpErrors","Request","startsWith","endsWith","signal","addEventListener","searchParams","URLSearchParams","fn","_fetch","hook","modifiedResponse","_decorateResponse","clone","Response","ok","onDownloadProgress","_stream","toLowerCase","_retry","type","mimeType","get","parseJson","_calculateRetryDelay","retryAfter","after","Number","isNaN","Date","now","maxRetryAfter","Math","min","totalBytes","transferredBytes","controller","reader","getReader","read","done","close","byteLength","percent","enqueue","Uint8Array","validateAndMerge","createInstance","defaults","ky","newDefaults","extend","factory","href","flattie","encode","require$$2","whoops","require$$5","require$$4","statusMessage"],"mappings":"gwBA4BAA,EA1BgB,EAAGC,IAAAA,EAAKC,QAAAA,EAASC,WAAAA,MAC/B,MAAMC,EAAY,CAACC,EAAMC,EAASC,KAChC,MAAMC,EAAWL,EAAWE,GAE5B,OAAOI,MAAOC,EAAKC,KACjB,MAAMC,KA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,IAAKuJ,EAASvJ,IAAKyJ,KAAAA,EAAMI,QAAAA,EAASF,WAAAA,EAAY8J,cAAAA,GACvD,MAAO/J,GACP,GAAIA,EAAIH,SAAU,CAChB,MAAMA,SAAEA,GAAaG,EACrBA,EAAIH,SAAW,IACVA,EACHM,QAAS,IAAIN,EAASM,QAAQ2C,WAAWtD,QACvC,CAACC,GAAMnI,EAAK0C,UAAiByF,EAAKnI,CAACA,GAAM0C,KACzC,IAEFiG,WAAYJ,EAASa,OACrBX,WAAYF,EAASqD,QAGzB,MAAMlD,IASRb,QAAAA,EACArJ,QAAS,YCtCTC,WAAYE,GAAQA,EAAKuE,WACzB1E,QAAS"}
1
+ {"version":3,"file":"microlink-function.min.js","sources":["../src/factory.js","../../../node_modules/.pnpm/is-url-http@2.2.7/node_modules/is-url-http/lightweight.js","../../../node_modules/.pnpm/flattie@1.1.0/node_modules/flattie/dist/index.js","../../../node_modules/.pnpm/qss@2.0.3/node_modules/qss/dist/qss.m.js","../../../node_modules/.pnpm/clean-stack@2.2.0/node_modules/clean-stack/index.js","../../../node_modules/.pnpm/mimic-fn@3.0.0/node_modules/mimic-fn/index.js","../../../node_modules/.pnpm/whoops@4.1.0/node_modules/whoops/lib/helpers.js","../../../node_modules/.pnpm/whoops@4.1.0/node_modules/whoops/lib/add-error-props.js","../../../node_modules/.pnpm/whoops@4.1.0/node_modules/whoops/lib/create-extend-error.js","../../../node_modules/.pnpm/whoops@4.1.0/node_modules/whoops/lib/create-error.js","../../../node_modules/.pnpm/whoops@4.1.0/node_modules/whoops/lib/index.js","../../../node_modules/.pnpm/@microlink+mql@0.10.15/node_modules/@microlink/mql/src/factory.js","../../../node_modules/.pnpm/@microlink+mql@0.10.15/node_modules/@microlink/mql/src/ky.js","../../../node_modules/.pnpm/@microlink+mql@0.10.15/node_modules/@microlink/mql/src/browser.js","../src/browser.js"],"sourcesContent":["'use strict'\n\nconst factory = ({ mql, VERSION, toCompress }) => {\n const microlink = (code, mqlOpts, gotOpts) => {\n const compress = toCompress(code)\n\n return async (url, opts) => {\n const { data } = await mql(\n url,\n {\n function: await compress,\n meta: false,\n ...mqlOpts,\n ...opts\n },\n gotOpts\n )\n\n return data.function\n }\n }\n\n microlink.version = VERSION\n microlink.mql = mql\n\n return microlink\n}\n\nmodule.exports = factory\n","'use strict'\n\nconst URL = global.window ? window.URL : require('url').URL\nconst REGEX_HTTP_PROTOCOL = /^https?:\\/\\//i\n\nmodule.exports = url => {\n try {\n return REGEX_HTTP_PROTOCOL.test(new URL(url).href)\n } catch (err) {\n return false\n }\n}\n","function iter(output, nullish, sep, val, key) {\n\tvar k, pfx = key ? (key + sep) : key;\n\n\tif (val == null) {\n\t\tif (nullish) output[key] = val;\n\t} else if (typeof val != 'object') {\n\t\toutput[key] = val;\n\t} else if (Array.isArray(val)) {\n\t\tfor (k=0; k < val.length; k++) {\n\t\t\titer(output, nullish, sep, val[k], pfx + k);\n\t\t}\n\t} else {\n\t\tfor (k in val) {\n\t\t\titer(output, nullish, sep, val[k], pfx + k);\n\t\t}\n\t}\n}\n\nfunction flattie(input, glue, toNull) {\n\tvar output = {};\n\tif (typeof input == 'object') {\n\t\titer(output, !!toNull, glue || '.', input, '');\n\t}\n\treturn output;\n}\n\nexports.flattie = flattie;","export function encode(obj, pfx) {\n\tvar k, i, tmp, str='';\n\n\tfor (k in obj) {\n\t\tif ((tmp = obj[k]) !== void 0) {\n\t\t\tif (Array.isArray(tmp)) {\n\t\t\t\tfor (i=0; i < tmp.length; i++) {\n\t\t\t\t\tstr && (str += '&');\n\t\t\t\t\tstr += encodeURIComponent(k) + '=' + encodeURIComponent(tmp[i]);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tstr && (str += '&');\n\t\t\t\tstr += encodeURIComponent(k) + '=' + encodeURIComponent(tmp);\n\t\t\t}\n\t\t}\n\t}\n\n\treturn (pfx || '') + str;\n}\n\nfunction toValue(mix) {\n\tif (!mix) return '';\n\tvar str = decodeURIComponent(mix);\n\tif (str === 'false') return false;\n\tif (str === 'true') return true;\n\treturn (+str * 0 === 0) ? (+str) : str;\n}\n\nexport function decode(str) {\n\tvar tmp, k, out={}, arr=str.split('&');\n\n\twhile (tmp = arr.shift()) {\n\t\ttmp = tmp.split('=');\n\t\tk = tmp.shift();\n\t\tif (out[k] !== void 0) {\n\t\t\tout[k] = [].concat(out[k], toValue(tmp.shift()));\n\t\t} else {\n\t\t\tout[k] = toValue(tmp.shift());\n\t\t}\n\t}\n\n\treturn out;\n}\n","'use strict';\nconst os = require('os');\n\nconst extractPathRegex = /\\s+at.*(?:\\(|\\s)(.*)\\)?/;\nconst pathRegex = /^(?:(?:(?:node|(?:internal\\/[\\w/]*|.*node_modules\\/(?:babel-polyfill|pirates)\\/.*)?\\w+)\\.js:\\d+:\\d+)|native)/;\nconst homeDir = typeof os.homedir === 'undefined' ? '' : os.homedir();\n\nmodule.exports = (stack, options) => {\n\toptions = Object.assign({pretty: false}, options);\n\n\treturn stack.replace(/\\\\/g, '/')\n\t\t.split('\\n')\n\t\t.filter(line => {\n\t\t\tconst pathMatches = line.match(extractPathRegex);\n\t\t\tif (pathMatches === null || !pathMatches[1]) {\n\t\t\t\treturn true;\n\t\t\t}\n\n\t\t\tconst match = pathMatches[1];\n\n\t\t\t// Electron\n\t\t\tif (\n\t\t\t\tmatch.includes('.app/Contents/Resources/electron.asar') ||\n\t\t\t\tmatch.includes('.app/Contents/Resources/default_app.asar')\n\t\t\t) {\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\treturn !pathRegex.test(match);\n\t\t})\n\t\t.filter(line => line.trim() !== '')\n\t\t.map(line => {\n\t\t\tif (options.pretty) {\n\t\t\t\treturn line.replace(extractPathRegex, (m, p1) => m.replace(p1, p1.replace(homeDir, '~')));\n\t\t\t}\n\n\t\t\treturn line;\n\t\t})\n\t\t.join('\\n');\n};\n","'use strict';\n\nconst copyProperty = (to, from, property, ignoreNonConfigurable) => {\n\t// `Function#length` should reflect the parameters of `to` not `from` since we keep its body.\n\t// `Function#prototype` is non-writable and non-configurable so can never be modified.\n\tif (property === 'length' || property === 'prototype') {\n\t\treturn;\n\t}\n\n\tconst toDescriptor = Object.getOwnPropertyDescriptor(to, property);\n\tconst fromDescriptor = Object.getOwnPropertyDescriptor(from, property);\n\n\tif (!canCopyProperty(toDescriptor, fromDescriptor) && ignoreNonConfigurable) {\n\t\treturn;\n\t}\n\n\tObject.defineProperty(to, property, fromDescriptor);\n};\n\n// `Object.defineProperty()` throws if the property exists, is not configurable and either:\n// - one its descriptors is changed\n// - it is non-writable and its value is changed\nconst canCopyProperty = function (toDescriptor, fromDescriptor) {\n\treturn toDescriptor === undefined || toDescriptor.configurable || (\n\t\ttoDescriptor.writable === fromDescriptor.writable &&\n\t\ttoDescriptor.enumerable === fromDescriptor.enumerable &&\n\t\ttoDescriptor.configurable === fromDescriptor.configurable &&\n\t\t(toDescriptor.writable || toDescriptor.value === fromDescriptor.value)\n\t);\n};\n\nconst changePrototype = (to, from) => {\n\tconst fromPrototype = Object.getPrototypeOf(from);\n\tif (fromPrototype === Object.getPrototypeOf(to)) {\n\t\treturn;\n\t}\n\n\tObject.setPrototypeOf(to, fromPrototype);\n};\n\nconst wrappedToString = (withName, fromBody) => `/* Wrapped ${withName}*/\\n${fromBody}`;\n\nconst toStringDescriptor = Object.getOwnPropertyDescriptor(Function.prototype, 'toString');\nconst toStringName = Object.getOwnPropertyDescriptor(Function.prototype.toString, 'name');\n\n// We call `from.toString()` early (not lazily) to ensure `from` can be garbage collected.\n// We use `bind()` instead of a closure for the same reason.\n// Calling `from.toString()` early also allows caching it in case `to.toString()` is called several times.\nconst changeToString = (to, from, name) => {\n\tconst withName = name === '' ? '' : `with ${name.trim()}() `;\n\tconst newToString = wrappedToString.bind(null, withName, from.toString());\n\t// Ensure `to.toString.toString` is non-enumerable and has the same `same`\n\tObject.defineProperty(newToString, 'name', toStringName);\n\tObject.defineProperty(to, 'toString', {...toStringDescriptor, value: newToString});\n};\n\nconst mimicFn = (to, from, {ignoreNonConfigurable = false} = {}) => {\n\tconst {name} = to;\n\n\tfor (const property of Reflect.ownKeys(from)) {\n\t\tcopyProperty(to, from, property, ignoreNonConfigurable);\n\t}\n\n\tchangePrototype(to, from);\n\tchangeToString(to, from, name);\n\n\treturn to;\n};\n\nmodule.exports = mimicFn;\n","'use strict'\n\nmodule.exports = {\n isFunction: obj => typeof obj === 'function',\n isString: obj => typeof obj === 'string',\n composeErrorMessage: (code, description) => `${code}, ${description}`,\n inherits: (ctor, superCtor) => {\n ctor.super_ = superCtor\n ctor.prototype = Object.create(superCtor.prototype, {\n constructor: {\n value: ctor,\n enumerable: false,\n writable: true,\n configurable: true\n }\n })\n }\n}\n","'use strict'\n\nconst {isFunction, composeErrorMessage} = require('./helpers')\n\nfunction interfaceObject (error, ...props) {\n Object.assign(error, ...props)\n\n error.description = isFunction(error.message) ? error.message(error) : error.message\n\n error.message = error.code\n ? composeErrorMessage(error.code, error.description)\n : error.description\n}\n\nmodule.exports = interfaceObject\n","'use strict'\n\nconst cleanStack = require('clean-stack')\nconst mimicFn = require('mimic-fn')\n\nconst addErrorProps = require('./add-error-props')\nconst {isString} = require('./helpers')\n\nfunction createExtendError (ErrorClass, classProps) {\n function ExtendError (props) {\n const error = new ErrorClass()\n const errorProps = isString(props) ? {message: props} : props\n addErrorProps(error, classProps, errorProps)\n\n error.stack = cleanStack(error.stack)\n return error\n }\n\n ExtendError.prototype = ErrorClass.prototype\n mimicFn(ExtendError, ErrorClass)\n\n return ExtendError\n}\n\nmodule.exports = createExtendError\n","'use strict'\n\nconst {inherits} = require('./helpers')\nconst mimicFn = require('mimic-fn')\n\nconst REGEX_CLASS_NAME = /[^0-9a-zA-Z_$]/\n\nfunction createError (className) {\n if (typeof className !== 'string') {\n throw new TypeError('Expected className to be a string')\n }\n\n if (REGEX_CLASS_NAME.test(className)) {\n throw new Error('className contains invalid characters')\n }\n\n function ErrorClass () {\n Object.defineProperty(this, 'name', {\n configurable: true,\n value: className,\n writable: true\n })\n\n Error.captureStackTrace(this, this.constructor)\n }\n\n inherits(ErrorClass, Error)\n mimicFn(ErrorClass, Error)\n return ErrorClass\n}\n\nmodule.exports = createError\n","'use strict'\n\nconst createExtendError = require('./create-extend-error')\nconst createError = require('./create-error')\n\nconst createErrorClass = ErrorClass => (className, props) => {\n const errorClass = createError(className || ErrorClass.name)\n return createExtendError(errorClass, props)\n}\n\nmodule.exports = createErrorClass(Error)\nmodule.exports.type = createErrorClass(TypeError)\nmodule.exports.range = createErrorClass(RangeError)\nmodule.exports.eval = createErrorClass(EvalError)\nmodule.exports.syntax = createErrorClass(SyntaxError)\nmodule.exports.reference = createErrorClass(ReferenceError)\nmodule.exports.uri = createErrorClass(URIError)\n","const ENDPOINT = {\n FREE: 'https://api.microlink.io',\n PRO: 'https://pro.microlink.io'\n}\n\nconst isObject = input => input !== null && typeof input === 'object'\n\nconst parseBody = (input, error, url) => {\n try {\n return JSON.parse(input)\n } catch (_) {\n const message = input || error.message\n\n return {\n status: 'error',\n data: { url: message },\n more: 'https://microlink.io/efatalclient',\n code: 'EFATALCLIENT',\n message,\n url\n }\n }\n}\n\nconst factory = ({\n VERSION,\n MicrolinkError,\n isUrlHttp,\n stringify,\n got,\n flatten\n}) => {\n const assertUrl = (url = '') => {\n if (!isUrlHttp(url)) {\n const message = `The \\`url\\` as \\`${url}\\` is not valid. Ensure it has protocol (http or https) and hostname.`\n throw new MicrolinkError({\n status: 'fail',\n data: { url: message },\n more: 'https://microlink.io/docs/api/api-parameters/url',\n code: 'EINVALURLCLIENT',\n message,\n url\n })\n }\n }\n\n const mapRules = rules => {\n if (!isObject(rules)) return\n const flatRules = flatten(rules)\n return Object.keys(flatRules).reduce((acc, key) => {\n acc[`data.${key}`] = flatRules[key].toString()\n return acc\n }, {})\n }\n\n const fetchFromApi = async (apiUrl, opts = {}, retryCount = 0) => {\n try {\n const response = await got(apiUrl, opts)\n return opts.responseType === 'buffer'\n ? { body: response.body, response }\n : { ...response.body, response }\n } catch (err) {\n const { response = {} } = err\n const { statusCode, body: rawBody, headers, url: uri = apiUrl } = response\n const isBuffer = Buffer.isBuffer(rawBody)\n\n const body =\n isObject(rawBody) && !isBuffer\n ? rawBody\n : parseBody(isBuffer ? rawBody.toString() : rawBody, err, uri)\n\n if (body.code === 'EFATALCLIENT' && retryCount++ < 2) {\n return fetchFromApi(apiUrl, opts, retryCount)\n }\n\n throw MicrolinkError({\n ...body,\n message: body.message,\n url: uri,\n statusCode,\n headers\n })\n }\n }\n\n const getApiUrl = (\n url,\n { data, apiKey, endpoint, retry, cache, ...opts } = {},\n { responseType = 'json', headers: gotHeaders, ...gotOpts } = {}\n ) => {\n const isPro = !!apiKey\n const apiEndpoint = endpoint || ENDPOINT[isPro ? 'PRO' : 'FREE']\n\n const apiUrl = `${apiEndpoint}?${stringify({\n url,\n ...mapRules(data),\n ...flatten(opts)\n })}`\n\n const headers = isPro\n ? { ...gotHeaders, 'x-api-key': apiKey }\n : { ...gotHeaders }\n return [apiUrl, { ...gotOpts, responseType, cache, retry, headers }]\n }\n\n const createMql = defaultOpts => async (url, opts, gotOpts) => {\n assertUrl(url)\n const [apiUrl, fetchOpts] = getApiUrl(url, opts, {\n ...defaultOpts,\n ...gotOpts\n })\n return fetchFromApi(apiUrl, fetchOpts)\n }\n\n const mql = createMql()\n mql.MicrolinkError = MicrolinkError\n mql.getApiUrl = getApiUrl\n mql.fetchFromApi = fetchFromApi\n mql.mapRules = mapRules\n mql.version = VERSION\n mql.stream = got.stream\n mql.buffer = createMql({ responseType: 'buffer' })\n\n return mql\n}\n\nmodule.exports = factory\n","(function (global, factory) {\n typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :\n typeof define === 'function' && define.amd ? define(['exports'], factory) :\n (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.ky = {}));\n})(this, (function (exports) { 'use strict';\n\n // eslint-lint-disable-next-line @typescript-eslint/naming-convention\n class HTTPError extends Error {\n constructor(response, request, options) {\n const code = (response.status || response.status === 0) ? response.status : '';\n const title = response.statusText || '';\n const status = `${code} ${title}`.trim();\n const reason = status ? `status code ${status}` : 'an unknown error';\n super(`Request failed with ${reason}`);\n this.name = 'HTTPError';\n this.response = response;\n this.request = request;\n this.options = options;\n }\n }\n\n class TimeoutError extends Error {\n constructor(request) {\n super('Request timed out');\n this.name = 'TimeoutError';\n this.request = request;\n }\n }\n\n // eslint-disable-next-line @typescript-eslint/ban-types\n const isObject = (value) => value !== null && typeof value === 'object';\n\n const validateAndMerge = (...sources) => {\n for (const source of sources) {\n if ((!isObject(source) || Array.isArray(source)) && typeof source !== 'undefined') {\n throw new TypeError('The `options` argument must be an object');\n }\n }\n return deepMerge({}, ...sources);\n };\n const mergeHeaders = (source1 = {}, source2 = {}) => {\n const result = new globalThis.Headers(source1);\n const isHeadersInstance = source2 instanceof globalThis.Headers;\n const source = new globalThis.Headers(source2);\n for (const [key, value] of source.entries()) {\n if ((isHeadersInstance && value === 'undefined') || value === undefined) {\n result.delete(key);\n }\n else {\n result.set(key, value);\n }\n }\n return result;\n };\n // TODO: Make this strongly-typed (no `any`).\n const deepMerge = (...sources) => {\n let returnValue = {};\n let headers = {};\n for (const source of sources) {\n if (Array.isArray(source)) {\n if (!Array.isArray(returnValue)) {\n returnValue = [];\n }\n returnValue = [...returnValue, ...source];\n }\n else if (isObject(source)) {\n for (let [key, value] of Object.entries(source)) {\n if (isObject(value) && key in returnValue) {\n value = deepMerge(returnValue[key], value);\n }\n returnValue = { ...returnValue, [key]: value };\n }\n if (isObject(source.headers)) {\n headers = mergeHeaders(headers, source.headers);\n returnValue.headers = headers;\n }\n }\n }\n return returnValue;\n };\n\n const supportsAbortController = typeof globalThis.AbortController === 'function';\n const supportsStreams = typeof globalThis.ReadableStream === 'function';\n const supportsFormData = typeof globalThis.FormData === 'function';\n const requestMethods = ['get', 'post', 'put', 'patch', 'head', 'delete'];\n const responseTypes = {\n json: 'application/json',\n text: 'text/*',\n formData: 'multipart/form-data',\n arrayBuffer: '*/*',\n blob: '*/*',\n };\n // The maximum value of a 32bit int (see issue #117)\n const maxSafeTimeout = 2147483647;\n const stop = Symbol('stop');\n\n const normalizeRequestMethod = (input) => requestMethods.includes(input) ? input.toUpperCase() : input;\n const retryMethods = ['get', 'put', 'head', 'delete', 'options', 'trace'];\n const retryStatusCodes = [408, 413, 429, 500, 502, 503, 504];\n const retryAfterStatusCodes = [413, 429, 503];\n const defaultRetryOptions = {\n limit: 2,\n methods: retryMethods,\n statusCodes: retryStatusCodes,\n afterStatusCodes: retryAfterStatusCodes,\n maxRetryAfter: Number.POSITIVE_INFINITY,\n };\n const normalizeRetryOptions = (retry = {}) => {\n if (typeof retry === 'number') {\n return {\n ...defaultRetryOptions,\n limit: retry,\n };\n }\n if (retry.methods && !Array.isArray(retry.methods)) {\n throw new Error('retry.methods must be an array');\n }\n if (retry.statusCodes && !Array.isArray(retry.statusCodes)) {\n throw new Error('retry.statusCodes must be an array');\n }\n return {\n ...defaultRetryOptions,\n ...retry,\n afterStatusCodes: retryAfterStatusCodes,\n };\n };\n\n // `Promise.race()` workaround (#91)\n const timeout = async (request, abortController, options) => new Promise((resolve, reject) => {\n const timeoutId = setTimeout(() => {\n if (abortController) {\n abortController.abort();\n }\n reject(new TimeoutError(request));\n }, options.timeout);\n /* eslint-disable promise/prefer-await-to-then */\n void options\n .fetch(request)\n .then(resolve)\n .catch(reject)\n .then(() => {\n clearTimeout(timeoutId);\n });\n /* eslint-enable promise/prefer-await-to-then */\n });\n const delay = async (ms) => new Promise(resolve => {\n setTimeout(resolve, ms);\n });\n\n class Ky {\n // eslint-disable-next-line complexity\n constructor(input, options = {}) {\n var _a, _b;\n this._retryCount = 0;\n this._input = input;\n this._options = {\n // TODO: credentials can be removed when the spec change is implemented in all browsers. Context: https://www.chromestatus.com/feature/4539473312350208\n credentials: this._input.credentials || 'same-origin',\n ...options,\n headers: mergeHeaders(this._input.headers, options.headers),\n hooks: deepMerge({\n beforeRequest: [],\n beforeRetry: [],\n afterResponse: [],\n }, options.hooks),\n method: normalizeRequestMethod((_a = options.method) !== null && _a !== void 0 ? _a : this._input.method),\n // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing\n prefixUrl: String(options.prefixUrl || ''),\n retry: normalizeRetryOptions(options.retry),\n throwHttpErrors: options.throwHttpErrors !== false,\n timeout: typeof options.timeout === 'undefined' ? 10000 : options.timeout,\n fetch: (_b = options.fetch) !== null && _b !== void 0 ? _b : globalThis.fetch.bind(globalThis),\n };\n if (typeof this._input !== 'string' && !(this._input instanceof URL || this._input instanceof globalThis.Request)) {\n throw new TypeError('`input` must be a string, URL, or Request');\n }\n if (this._options.prefixUrl && typeof this._input === 'string') {\n if (this._input.startsWith('/')) {\n throw new Error('`input` must not begin with a slash when using `prefixUrl`');\n }\n if (!this._options.prefixUrl.endsWith('/')) {\n this._options.prefixUrl += '/';\n }\n this._input = this._options.prefixUrl + this._input;\n }\n if (supportsAbortController) {\n this.abortController = new globalThis.AbortController();\n if (this._options.signal) {\n this._options.signal.addEventListener('abort', () => {\n this.abortController.abort();\n });\n }\n this._options.signal = this.abortController.signal;\n }\n this.request = new globalThis.Request(this._input, this._options);\n if (this._options.searchParams) {\n // eslint-disable-next-line unicorn/prevent-abbreviations\n const textSearchParams = typeof this._options.searchParams === 'string'\n ? this._options.searchParams.replace(/^\\?/, '')\n : new URLSearchParams(this._options.searchParams).toString();\n // eslint-disable-next-line unicorn/prevent-abbreviations\n const searchParams = '?' + textSearchParams;\n const url = this.request.url.replace(/(?:\\?.*?)?(?=#|$)/, searchParams);\n // To provide correct form boundary, Content-Type header should be deleted each time when new Request instantiated from another one\n if (((supportsFormData && this._options.body instanceof globalThis.FormData)\n || this._options.body instanceof URLSearchParams) && !(this._options.headers && this._options.headers['content-type'])) {\n this.request.headers.delete('content-type');\n }\n this.request = new globalThis.Request(new globalThis.Request(url, this.request), this._options);\n }\n if (this._options.json !== undefined) {\n this._options.body = JSON.stringify(this._options.json);\n this.request.headers.set('content-type', 'application/json');\n this.request = new globalThis.Request(this.request, { body: this._options.body });\n }\n }\n // eslint-disable-next-line @typescript-eslint/promise-function-async\n static create(input, options) {\n const ky = new Ky(input, options);\n const fn = async () => {\n if (ky._options.timeout > maxSafeTimeout) {\n throw new RangeError(`The \\`timeout\\` option cannot be greater than ${maxSafeTimeout}`);\n }\n // Delay the fetch so that body method shortcuts can set the Accept header\n await Promise.resolve();\n let response = await ky._fetch();\n for (const hook of ky._options.hooks.afterResponse) {\n // eslint-disable-next-line no-await-in-loop\n const modifiedResponse = await hook(ky.request, ky._options, ky._decorateResponse(response.clone()));\n if (modifiedResponse instanceof globalThis.Response) {\n response = modifiedResponse;\n }\n }\n ky._decorateResponse(response);\n if (!response.ok && ky._options.throwHttpErrors) {\n throw new HTTPError(response, ky.request, ky._options);\n }\n // If `onDownloadProgress` is passed, it uses the stream API internally\n /* istanbul ignore next */\n if (ky._options.onDownloadProgress) {\n if (typeof ky._options.onDownloadProgress !== 'function') {\n throw new TypeError('The `onDownloadProgress` option must be a function');\n }\n if (!supportsStreams) {\n throw new Error('Streams are not supported in your environment. `ReadableStream` is missing.');\n }\n return ky._stream(response.clone(), ky._options.onDownloadProgress);\n }\n return response;\n };\n const isRetriableMethod = ky._options.retry.methods.includes(ky.request.method.toLowerCase());\n const result = (isRetriableMethod ? ky._retry(fn) : fn());\n for (const [type, mimeType] of Object.entries(responseTypes)) {\n result[type] = async () => {\n // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing\n ky.request.headers.set('accept', ky.request.headers.get('accept') || mimeType);\n const response = (await result).clone();\n if (type === 'json') {\n if (response.status === 204) {\n return '';\n }\n if (options.parseJson) {\n return options.parseJson(await response.text());\n }\n }\n return response[type]();\n };\n }\n return result;\n }\n _calculateRetryDelay(error) {\n this._retryCount++;\n if (this._retryCount < this._options.retry.limit && !(error instanceof TimeoutError)) {\n if (error instanceof HTTPError) {\n if (!this._options.retry.statusCodes.includes(error.response.status)) {\n return 0;\n }\n const retryAfter = error.response.headers.get('Retry-After');\n if (retryAfter && this._options.retry.afterStatusCodes.includes(error.response.status)) {\n let after = Number(retryAfter);\n if (Number.isNaN(after)) {\n after = Date.parse(retryAfter) - Date.now();\n }\n else {\n after *= 1000;\n }\n if (typeof this._options.retry.maxRetryAfter !== 'undefined' && after > this._options.retry.maxRetryAfter) {\n return 0;\n }\n return after;\n }\n if (error.response.status === 413) {\n return 0;\n }\n }\n const BACKOFF_FACTOR = 0.3;\n return BACKOFF_FACTOR * (2 ** (this._retryCount - 1)) * 1000;\n }\n return 0;\n }\n _decorateResponse(response) {\n if (this._options.parseJson) {\n response.json = async () => this._options.parseJson(await response.text());\n }\n return response;\n }\n async _retry(fn) {\n try {\n return await fn();\n // eslint-disable-next-line @typescript-eslint/no-implicit-any-catch\n }\n catch (error) {\n const ms = Math.min(this._calculateRetryDelay(error), maxSafeTimeout);\n if (ms !== 0 && this._retryCount > 0) {\n await delay(ms);\n for (const hook of this._options.hooks.beforeRetry) {\n // eslint-disable-next-line no-await-in-loop\n const hookResult = await hook({\n request: this.request,\n options: this._options,\n error: error,\n retryCount: this._retryCount,\n });\n // If `stop` is returned from the hook, the retry process is stopped\n if (hookResult === stop) {\n return;\n }\n }\n return this._retry(fn);\n }\n throw error;\n }\n }\n async _fetch() {\n for (const hook of this._options.hooks.beforeRequest) {\n // eslint-disable-next-line no-await-in-loop\n const result = await hook(this.request, this._options);\n if (result instanceof Request) {\n this.request = result;\n break;\n }\n if (result instanceof Response) {\n return result;\n }\n }\n if (this._options.timeout === false) {\n return this._options.fetch(this.request.clone());\n }\n return timeout(this.request.clone(), this.abortController, this._options);\n }\n /* istanbul ignore next */\n _stream(response, onDownloadProgress) {\n const totalBytes = Number(response.headers.get('content-length')) || 0;\n let transferredBytes = 0;\n return new globalThis.Response(new globalThis.ReadableStream({\n async start(controller) {\n const reader = response.body.getReader();\n if (onDownloadProgress) {\n onDownloadProgress({ percent: 0, transferredBytes: 0, totalBytes }, new Uint8Array());\n }\n async function read() {\n const { done, value } = await reader.read();\n if (done) {\n controller.close();\n return;\n }\n if (onDownloadProgress) {\n transferredBytes += value.byteLength;\n const percent = totalBytes === 0 ? 0 : transferredBytes / totalBytes;\n onDownloadProgress({ percent, transferredBytes, totalBytes }, value);\n }\n controller.enqueue(value);\n await read();\n }\n await read();\n },\n }));\n }\n }\n\n /*! MIT License © Sindre Sorhus */\n const createInstance = (defaults) => {\n // eslint-disable-next-line @typescript-eslint/promise-function-async\n const ky = (input, options) => Ky.create(input, validateAndMerge(defaults, options));\n for (const method of requestMethods) {\n // eslint-disable-next-line @typescript-eslint/promise-function-async\n ky[method] = (input, options) => Ky.create(input, validateAndMerge(defaults, options, { method }));\n }\n ky.create = (newDefaults) => createInstance(validateAndMerge(newDefaults));\n ky.extend = (newDefaults) => createInstance(validateAndMerge(defaults, newDefaults));\n ky.stop = stop;\n return ky;\n };\n const ky = createInstance();\n\n exports.HTTPError = HTTPError;\n exports.TimeoutError = TimeoutError;\n exports[\"default\"] = ky;\n\n Object.defineProperty(exports, '__esModule', { value: true });\n\n}));\n","'use strict'\n\nconst isUrlHttp = require('is-url-http/lightweight')\nconst { flattie: flatten } = require('flattie')\nconst { encode: stringify } = require('qss')\nconst whoops = require('whoops')\n\nconst factory = require('./factory')\nconst { default: ky } = require('./ky')\n\nconst MicrolinkError = whoops('MicrolinkError')\n\nconst got = async (url, opts) => {\n try {\n if (opts.timeout === undefined) opts.timeout = false\n const response = await ky(url, opts)\n const body = await response.json()\n const { headers, status: statusCode, statusText: statusMessage } = response\n return { url: response.url, body, headers, statusCode, statusMessage }\n } catch (err) {\n if (err.response) {\n const { response } = err\n err.response = {\n ...response,\n headers: Array.from(response.headers.entries()).reduce(\n (acc, [key, value]) => {\n acc[key] = value\n return acc\n },\n {}\n ),\n statusCode: response.status,\n body: await response.text()\n }\n }\n throw err\n }\n}\n\nmodule.exports = factory({\n MicrolinkError,\n isUrlHttp,\n stringify,\n got,\n flatten,\n VERSION: '__MQL_VERSION__'\n})\n","'use strict'\n\nmodule.exports = require('./factory')({\n mql: require('@microlink/mql'),\n toCompress: code => code.toString(),\n VERSION: '__VERSION__'\n})\n"],"names":["factory_1","mql","VERSION","toCompress","microlink","code","mqlOpts","gotOpts","compress","async","url","opts","data","function","meta","version","URL","global","window","require$$0","REGEX_HTTP_PROTOCOL","iter","output","nullish","sep","val","key","k","pfx","Array","isArray","length","toValue","mix","str","decodeURIComponent","input","glue","toNull","obj","i","tmp","encodeURIComponent","out","arr","split","shift","concat","os","extractPathRegex","pathRegex","homeDir","homedir","copyProperty","to","from","property","ignoreNonConfigurable","toDescriptor","Object","getOwnPropertyDescriptor","fromDescriptor","canCopyProperty","defineProperty","undefined","configurable","writable","enumerable","value","wrappedToString","withName","fromBody","toStringDescriptor","Function","prototype","toStringName","toString","mimicFn_1","name","Reflect","ownKeys","fromPrototype","getPrototypeOf","setPrototypeOf","changePrototype","trim","newToString","bind","changeToString","helpers","isFunction","isString","composeErrorMessage","description","inherits","ctor","superCtor","super_","create","constructor","cleanStack","stack","options","assign","pretty","replace","filter","line","pathMatches","match","includes","test","map","m","p1","join","mimicFn","require$$1","addErrorProps","error","props","message","require$$3","createExtendError_1","ErrorClass","classProps","ExtendError","errorProps","REGEX_CLASS_NAME","createExtendError","createError","className","TypeError","Error","this","captureStackTrace","createErrorClass","errorClass","RangeError","EvalError","SyntaxError","ReferenceError","URIError","ENDPOINT","FREE","PRO","isObject","MicrolinkError","isUrlHttp","stringify","got","flatten","mapRules","rules","flatRules","keys","reduce","acc","fetchFromApi","apiUrl","retryCount","response","responseType","body","err","statusCode","rawBody","headers","uri","isBuffer","Buffer","JSON","parse","_","status","more","parseBody","getApiUrl","apiKey","endpoint","retry","cache","gotHeaders","isPro","createMql","defaultOpts","assertUrl","fetchOpts","stream","buffer","exports","HTTPError","request","statusText","super","TimeoutError","validateAndMerge","sources","source","deepMerge","mergeHeaders","source1","source2","result","globalThis","Headers","isHeadersInstance","entries","delete","set","returnValue","supportsAbortController","AbortController","supportsStreams","ReadableStream","supportsFormData","FormData","requestMethods","responseTypes","json","text","formData","arrayBuffer","blob","maxSafeTimeout","stop","Symbol","normalizeRequestMethod","toUpperCase","retryAfterStatusCodes","defaultRetryOptions","limit","methods","statusCodes","afterStatusCodes","maxRetryAfter","Number","POSITIVE_INFINITY","normalizeRetryOptions","timeout","abortController","Promise","resolve","reject","timeoutId","setTimeout","abort","fetch","then","catch","clearTimeout","delay","ms","Ky","_a","_b","_retryCount","_input","_options","credentials","hooks","beforeRequest","beforeRetry","afterResponse","method","prefixUrl","String","throwHttpErrors","Request","startsWith","endsWith","signal","addEventListener","searchParams","URLSearchParams","static","ky","fn","_fetch","hook","modifiedResponse","_decorateResponse","clone","Response","ok","onDownloadProgress","_stream","toLowerCase","_retry","type","mimeType","get","parseJson","_calculateRetryDelay","retryAfter","after","isNaN","Date","now","Math","min","totalBytes","transferredBytes","controller","reader","getReader","read","done","close","byteLength","percent","enqueue","Uint8Array","createInstance","defaults","newDefaults","extend","factory","href","flattie","encode","require$$2","whoops","require$$4","default","require$$5","statusMessage"],"mappings":"gwBA4BAA,EA1BgB,EAAGC,IAAAA,EAAKC,QAAAA,EAASC,WAAAA,MAC/B,MAAMC,EAAY,CAACC,EAAMC,EAASC,KAChC,MAAMC,EAAWL,EAAWE,GAE5B,OAAOI,MAAOC,EAAKC,KACjB,MAAMC,KAAEA,SAAeX,EACrBS,EACA,CACEG,eAAgBL,EAChBM,MAAM,KACHR,KACAK,GAELJ,GAGF,OAAOK,EAAKC,WAOhB,OAHAT,EAAUW,QAAUb,EACpBE,EAAUH,IAAMA,EAETG,GCvBT,MAAMY,EAAMC,EAAOC,OAASA,OAAOF,IAAMG,UAAeH,IAClDI,EAAsB,yBCH5B,SAASC,EAAKC,EAAQC,EAASC,EAAKC,EAAKC,GACxC,IAAIC,EAAGC,EAAMF,EAAOA,EAAMF,EAAOE,EAEjC,GAAW,MAAPD,EACCF,IAASD,EAAOI,GAAOD,QACrB,GAAkB,iBAAPA,EACjBH,EAAOI,GAAOD,OACR,GAAII,MAAMC,QAAQL,G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ChB,MAAMA,SAAEA,GAAaG,EACrBA,EAAIH,SAAW,IACVA,EACHM,QAAS1I,MAAM0B,KAAK0G,EAASM,QAAQwC,WAAWnD,QAC9C,CAACC,GAAMnI,EAAK0C,MACVyF,EAAInI,GAAO0C,EACJyF,IAET,IAEFQ,WAAYJ,EAASa,OACrBX,WAAYF,EAAS2D,QAGzB,MAAMxD,IASRb,QAAAA,EACArJ,QAAS,YCzCTC,WAAYE,GAAQA,EAAKuE,WACzB1E,QAAS"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@microlink/function",
3
3
  "homepage": "https://github.com/microlinkhq/function#readme",
4
- "version": "0.1.2",
4
+ "version": "0.1.3",
5
5
  "main": "src/node.js",
6
6
  "browser": "src/browser.js",
7
7
  "author": {
@@ -31,31 +31,20 @@
31
31
  "base64-url": "~2.3.3"
32
32
  },
33
33
  "devDependencies": {
34
- "@commitlint/cli": "latest",
35
- "@commitlint/config-conventional": "latest",
36
34
  "@rollup/plugin-commonjs": "latest",
37
35
  "@rollup/plugin-node-resolve": "latest",
38
36
  "@rollup/plugin-replace": "latest",
39
37
  "abort-controller": "latest",
40
38
  "ava": "latest",
41
39
  "conventional-github-releaser": "latest",
42
- "finepack": "latest",
43
- "git-authors-cli": "latest",
44
- "git-dirty": "latest",
45
- "nano-staged": "latest",
46
40
  "node-fetch": "2",
47
41
  "npm-check-updates": "latest",
48
42
  "nyc": "latest",
49
- "prettier-standard": "latest",
50
43
  "rollup": "latest",
51
44
  "rollup-plugin-filesize": "latest",
52
45
  "rollup-plugin-shim": "latest",
53
46
  "rollup-plugin-terser": "latest",
54
- "rollup-plugin-visualizer": "latest",
55
- "simple-git-hooks": "latest",
56
- "standard": "latest",
57
- "standard-markdown": "latest",
58
- "standard-version": "latest"
47
+ "rollup-plugin-visualizer": "latest"
59
48
  },
60
49
  "engines": {
61
50
  "node": ">= 12"
@@ -64,6 +53,12 @@
64
53
  "dist",
65
54
  "src"
66
55
  ],
56
+ "scripts": {
57
+ "build": "rollup -c rollup.config.js",
58
+ "version": "pnpm run build",
59
+ "dev": "npm run build -- -w",
60
+ "test": "nyc ava --verbose"
61
+ },
67
62
  "license": "MIT",
68
63
  "ava": {
69
64
  "files": [
@@ -73,48 +68,7 @@
73
68
  ],
74
69
  "timeout": "1m"
75
70
  },
76
- "commitlint": {
77
- "extends": [
78
- "@commitlint/config-conventional"
79
- ]
80
- },
81
- "nano-staged": {
82
- "*.js": [
83
- "prettier-standard"
84
- ],
85
- "*.md": [
86
- "standard-markdown"
87
- ],
88
- "package.json": [
89
- "finepack --sort-ignore-object-at ava"
90
- ]
91
- },
92
- "simple-git-hooks": {
93
- "commit-msg": "npx commitlint --edit",
94
- "pre-commit": "npx nano-staged"
95
- },
96
- "standard": {
97
- "ignore": [
98
- "dist"
99
- ]
100
- },
101
71
  "umd:main": "dist/microlink-function.js",
102
72
  "unpkg": "dist/microlink-function.js",
103
- "scripts": {
104
- "build": "rollup -c rollup.config.js",
105
- "clean": "rm -rf node_modules",
106
- "dev": "npm run build -- -w",
107
- "lint": "standard",
108
- "postrelease": "npm run release:build && npm run release:tags && npm run release:github && (ci-publish || npm publish --access=public)",
109
- "prerelease": "git-dirty && npm run update:check && npm test",
110
- "pretest": "npm run lint",
111
- "release": "git-authors-cli && git add package.json && standard-version -a",
112
- "release:build": "npm run build && git add dist/ && git commit -m \"build(no-release): generate bundle\"",
113
- "release:github": "conventional-github-releaser -p angular",
114
- "release:tags": "git push --follow-tags origin master",
115
- "test": "nyc ava --verbose",
116
- "update": "ncu -u",
117
- "update:check": "ncu -- --error-level 2"
118
- },
119
- "readme": "<div align=\"center\">\n <img src=\"https://cdn.microlink.io/logo/banner.png\">\n <br>\n <br>\n <br>\n <p style=\"max-width: 400px;\"><b>Microlink Function</b> allows you to run JavaScript Serverless functions with <a target=\"_blank\" href=\"https://browserless.js.org\">Headless Chromium</a> programmatic access.</p>\n</div>\n\n<div align=\"center\">\n <img src=\"https://i.imgur.com/4PWrzx2.png\" width=\"700px\">\n</div>\n\n## Highlights\n\n- Starts from \\$0/mo.\n- Run Serverless Javascript functions (also [locally](https://github.com/microlinkhq/local)).\n- Ability to require to require any of the [allowed](#npm-packages) NPM packages.\n- Headless Chromium browser access in the same request cycle.\n- No servers to maintain, no hidden cost or infrastructure complexity.\n\n## Contents\n\n- [How it works](#how-it-works)\n- [Installation](#installation)\n - [from NPM](#from-npm)\n - [from CDN](#from-cdn)\n- [Get Started](#get-started)\n - [Input](#input)\n - [NPM packages](#npm-packages)\n - [Output](#output)\n- [Examples](#examples)\n- [Pricing](#pricing)\n- [API](#api)\n- [License](#license)\n\n## How it works\n\nEvery time you call a **Microlink Function**, the code function will be compiled and executed remotely in a safe V8 sandbox.\n\nIt's pretty similar to AWS Lambda, but rather than bundle your code, all the code will be executed remotely, giving the result of the execution back to you.\n\n**Microlink Function** can be invoked in frontend or backend side. There is nothing to deploy or hidden infrastructure cost associated.\n\n## Installation\n\n### from NPM\n\nIt's available as [npm package](https://www.npmjs.com/package/@microlink/function):\n\n```bash\n$ npm install @microlink/function --save\n```\n\n### from CDN\n\nLoad directly in the browser from your favorite CDN:\n\n```html\n<script src=\"https://cdn.jsdelivr.net/npm/@microlink/function/dist/microlink-function.min.js\"></script>\n```\n\n## Get Started\n\n### Input\n\nLet say you have a JavaScript like this:\n\n```js\nconst ping = ({ statusCode, response }) =>\n statusCode ? response.status() : response.statusText()\n```\n\nTo run the previous code as **Microlink Function**, all you need to do is wrap the function with the `microlink` decorator:\n\n```js\nconst microlink = require('@microlink/function')\n\nconst ping = microlink({ response }) => statusCode\n ? response.status()\n : response.statusText()\n)\n```\n\nThen, just call the function as you would normally:\n\n```js\nconst result = await ping('https://example.com', { statusCode: true })\n\nconsole.log(result)\n\n// {\n// isFullfilled: true,\n// isRejected: false,\n// value: 200\n// }\n```\n\nWhen a function is wrapped by **Microlink Function** the function execution is done remotely, giving back the result.\n\nAny **Microlink Function** will receive the following parameters:\n\n- `html`: When [meta](https://microlink.io/docs/api/parameters/meta) is enabled, the HTML markup of the website is provided.\n- `page`: The [`puppeteer#page`](https://github.com/puppeteer/puppeteer/blob/main/docs/api.md#class-page) instance to interact with the headless browser.\n- `response`: The [`puppeteer#response`](https://github.com/puppeteer/puppeteer/blob/main/docs/api.md#class-httpresponse) as result of the implicit [`page.goto`](https://github.com/puppeteer/puppeteer/blob/main/docs/api.md#pagegotourl-options).\n\n#### NPM packages\n\nAdditionally, you can require a allowed list of common NPM packages inside your code blocks:\n\n```js\nconst microlink = require('@microlink/function')\n\nconst ping = microlink(({ statusCode, response }) => {\n const { result } = require('lodash')\n return result(response, statusCode ? 'status' : 'statusText')\n})\n```\n\nThe list of allowed NPM packages are:\n\n- [`path`](https://nodejs.org/api/path.html)\n- [`url`](https://nodejs.org/api/url.html)\n- [`@aws-sdk/client-s3`](https://npm.im/@aws-sdk/client-s3)\n- [`@metascraper`](https://npm.im/@metascraper)\n- [`@mozilla/readability`](https://npm.im/@mozilla/readability)\n- [`async`](https://npm.im/async)\n- [`cheerio`](https://npm.im/cheerio)\n- [`extract-email-address`](https://npm.im/extract-email-address)\n- [`got`](https://npm.im/got)\n- [`ioredis`](https://npm.im/ioredis)\n- [`jsdom`](https://npm.im/jsdom)\n- [`lodash`](https://npm.im/lodash)\n- [`metascraper`](https://npm.im/metascraper)\n- [`p-reflect`](https://npm.im/p-reflect)\n- [`p-retry`](https://npm.im/p-retry)\n- [`p-timeout`](https://npm.im/p-timeout)\n\nDo you miss any NPM modules there? open a [new issue](/issues/new) and we make it available.\n\n### Output\n\nWhen a **Microlink Function** is executed, the result response object has the following interface:\n\n- `isFulfilled`\n- `isRejected`\n- `value` or `reason`, depending on whether the promise fulfilled or rejected.\n\n## Testing\n\nCheck [`@microlink/local`](https://github.com/microlinkhq/local) for executing your Microlink Functions locally.\n\n## Examples\n\nCheck [examples](/examples).\n\n## Pricing\n\n**Microlink Function** has been designed to be cheap and affordable.\n\nThe first 50 [uncached](https://microlink.io/blog/edge-cdn/) requests of every day are **free**. If you need more, you should to buy a [pro plan](https://microlink.io/#pricing).\n\nFor [authenticating](https://microlink.io/docs/api/basics/authentication) your requests, you should to provide your API key:\n\n```js\nconst microlink = require('@microlink/function')\n\nconst code = ({ statusCode, response }) => {\n const { result } = require('lodash')\n return result(response, statusCode ? 'status' : 'statusText')\n}\n\nconst ping = microlink(code, { apiKey: process.env.MICROLINK_API_KEY })\n```\n\n## API\n\n### microlink(fn, [mqlOpts], [gotoOpts])\n\n#### fn\n\n_Required_<br>\nType: `function`\n\nThe function that be executed inside Microlink API browser.\n\n#### mqlOpts\n\nType: `object`\n\nThe function that be executed inside Microlink API browser.\n\nAny option passed here will bypass to [mql](https://github.com/microlinkhq/mql).\n\n#### gotoOpts\n\nType: `object`\n\nAny option passed here will bypass to [browserless#goto](https://browserless.js.org/#/?id=options-5).\n\n## License\n\n**microlink-function** © [Microlink](https://microlink.io), released under the [MIT](https://github.com/microlink/microlink-function/blob/master/LICENSE.md) License.<br>\nAuthored and maintained by [Kiko Beats](https://kikobeats.com) with help from [contributors](https://github.com/microlink/microlink-function/contributors).\n\n> [microlink.io](https://microlink.io) · GitHub [@MicrolinkHQ](https://github.com/microlinkhq) · Twitter [@microlinkhq](https://twitter.com/microlinkhq)\n"
120
- }
73
+ "gitHead": "359ee6bbec76c4ad93970a468adb82106cab99c6"
74
+ }
package/README.md DELETED
@@ -1,205 +0,0 @@
1
- <div align="center">
2
- <img src="https://cdn.microlink.io/logo/banner.png">
3
- <br>
4
- <br>
5
- <br>
6
- <p style="max-width: 400px;"><b>Microlink Function</b> allows you to run JavaScript Serverless functions with <a target="_blank" href="https://browserless.js.org">Headless Chromium</a> programmatic access.</p>
7
- </div>
8
-
9
- <div align="center">
10
- <img src="https://i.imgur.com/4PWrzx2.png" width="700px">
11
- </div>
12
-
13
- ## Highlights
14
-
15
- - Starts from \$0/mo.
16
- - Run Serverless Javascript functions (also [locally](https://github.com/microlinkhq/local)).
17
- - Ability to require to require any of the [allowed](#npm-packages) NPM packages.
18
- - Headless Chromium browser access in the same request cycle.
19
- - No servers to maintain, no hidden cost or infrastructure complexity.
20
-
21
- ## Contents
22
-
23
- - [How it works](#how-it-works)
24
- - [Installation](#installation)
25
- - [from NPM](#from-npm)
26
- - [from CDN](#from-cdn)
27
- - [Get Started](#get-started)
28
- - [Input](#input)
29
- - [NPM packages](#npm-packages)
30
- - [Output](#output)
31
- - [Examples](#examples)
32
- - [Pricing](#pricing)
33
- - [API](#api)
34
- - [License](#license)
35
-
36
- ## How it works
37
-
38
- Every time you call a **Microlink Function**, the code function will be compiled and executed remotely in a safe V8 sandbox.
39
-
40
- It's pretty similar to AWS Lambda, but rather than bundle your code, all the code will be executed remotely, giving the result of the execution back to you.
41
-
42
- **Microlink Function** can be invoked in frontend or backend side. There is nothing to deploy or hidden infrastructure cost associated.
43
-
44
- ## Installation
45
-
46
- ### from NPM
47
-
48
- It's available as [npm package](https://www.npmjs.com/package/@microlink/function):
49
-
50
- ```bash
51
- $ npm install @microlink/function --save
52
- ```
53
-
54
- ### from CDN
55
-
56
- Load directly in the browser from your favorite CDN:
57
-
58
- ```html
59
- <script src="https://cdn.jsdelivr.net/npm/@microlink/function/dist/microlink-function.min.js"></script>
60
- ```
61
-
62
- ## Get Started
63
-
64
- ### Input
65
-
66
- Let say you have a JavaScript like this:
67
-
68
- ```js
69
- const ping = ({ statusCode, response }) =>
70
- statusCode ? response.status() : response.statusText()
71
- ```
72
-
73
- To run the previous code as **Microlink Function**, all you need to do is wrap the function with the `microlink` decorator:
74
-
75
- ```js
76
- const microlink = require('@microlink/function')
77
-
78
- const ping = microlink({ response }) => statusCode
79
- ? response.status()
80
- : response.statusText()
81
- )
82
- ```
83
-
84
- Then, just call the function as you would normally:
85
-
86
- ```js
87
- const result = await ping('https://example.com', { statusCode: true })
88
-
89
- console.log(result)
90
-
91
- // {
92
- // isFullfilled: true,
93
- // isRejected: false,
94
- // value: 200
95
- // }
96
- ```
97
-
98
- When a function is wrapped by **Microlink Function** the function execution is done remotely, giving back the result.
99
-
100
- Any **Microlink Function** will receive the following parameters:
101
-
102
- - `html`: When [meta](https://microlink.io/docs/api/parameters/meta) is enabled, the HTML markup of the website is provided.
103
- - `page`: The [`puppeteer#page`](https://github.com/puppeteer/puppeteer/blob/main/docs/api.md#class-page) instance to interact with the headless browser.
104
- - `response`: The [`puppeteer#response`](https://github.com/puppeteer/puppeteer/blob/main/docs/api.md#class-httpresponse) as result of the implicit [`page.goto`](https://github.com/puppeteer/puppeteer/blob/main/docs/api.md#pagegotourl-options).
105
-
106
- #### NPM packages
107
-
108
- Additionally, you can require a allowed list of common NPM packages inside your code blocks:
109
-
110
- ```js
111
- const microlink = require('@microlink/function')
112
-
113
- const ping = microlink(({ statusCode, response }) => {
114
- const { result } = require('lodash')
115
- return result(response, statusCode ? 'status' : 'statusText')
116
- })
117
- ```
118
-
119
- The list of allowed NPM packages are:
120
-
121
- - [`path`](https://nodejs.org/api/path.html)
122
- - [`url`](https://nodejs.org/api/url.html)
123
- - [`@aws-sdk/client-s3`](https://npm.im/@aws-sdk/client-s3)
124
- - [`@metascraper`](https://npm.im/@metascraper)
125
- - [`@mozilla/readability`](https://npm.im/@mozilla/readability)
126
- - [`async`](https://npm.im/async)
127
- - [`cheerio`](https://npm.im/cheerio)
128
- - [`extract-email-address`](https://npm.im/extract-email-address)
129
- - [`got`](https://npm.im/got)
130
- - [`ioredis`](https://npm.im/ioredis)
131
- - [`jsdom`](https://npm.im/jsdom)
132
- - [`lodash`](https://npm.im/lodash)
133
- - [`metascraper`](https://npm.im/metascraper)
134
- - [`p-reflect`](https://npm.im/p-reflect)
135
- - [`p-retry`](https://npm.im/p-retry)
136
- - [`p-timeout`](https://npm.im/p-timeout)
137
-
138
- Do you miss any NPM modules there? open a [new issue](/issues/new) and we make it available.
139
-
140
- ### Output
141
-
142
- When a **Microlink Function** is executed, the result response object has the following interface:
143
-
144
- - `isFulfilled`
145
- - `isRejected`
146
- - `value` or `reason`, depending on whether the promise fulfilled or rejected.
147
-
148
- ## Testing
149
-
150
- Check [`@microlink/local`](https://github.com/microlinkhq/local) for executing your Microlink Functions locally.
151
-
152
- ## Examples
153
-
154
- Check [examples](/examples).
155
-
156
- ## Pricing
157
-
158
- **Microlink Function** has been designed to be cheap and affordable.
159
-
160
- The first 50 [uncached](https://microlink.io/blog/edge-cdn/) requests of every day are **free**. If you need more, you should to buy a [pro plan](https://microlink.io/#pricing).
161
-
162
- For [authenticating](https://microlink.io/docs/api/basics/authentication) your requests, you should to provide your API key:
163
-
164
- ```js
165
- const microlink = require('@microlink/function')
166
-
167
- const code = ({ statusCode, response }) => {
168
- const { result } = require('lodash')
169
- return result(response, statusCode ? 'status' : 'statusText')
170
- }
171
-
172
- const ping = microlink(code, { apiKey: process.env.MICROLINK_API_KEY })
173
- ```
174
-
175
- ## API
176
-
177
- ### microlink(fn, [mqlOpts], [gotoOpts])
178
-
179
- #### fn
180
-
181
- _Required_<br>
182
- Type: `function`
183
-
184
- The function that be executed inside Microlink API browser.
185
-
186
- #### mqlOpts
187
-
188
- Type: `object`
189
-
190
- The function that be executed inside Microlink API browser.
191
-
192
- Any option passed here will bypass to [mql](https://github.com/microlinkhq/mql).
193
-
194
- #### gotoOpts
195
-
196
- Type: `object`
197
-
198
- Any option passed here will bypass to [browserless#goto](https://browserless.js.org/#/?id=options-5).
199
-
200
- ## License
201
-
202
- **microlink-function** © [Microlink](https://microlink.io), released under the [MIT](https://github.com/microlink/microlink-function/blob/master/LICENSE.md) License.<br>
203
- Authored and maintained by [Kiko Beats](https://kikobeats.com) with help from [contributors](https://github.com/microlink/microlink-function/contributors).
204
-
205
- > [microlink.io](https://microlink.io) · GitHub [@MicrolinkHQ](https://github.com/microlinkhq) · Twitter [@microlinkhq](https://twitter.com/microlinkhq)