|
|
|
|
|
"use strict";
|
|
|
|
|
|
/*
|
|
|
|
|
|
* ATTENTION: An "eval-source-map" devtool has been used.
|
|
|
|
|
|
* This devtool is neither made for production nor for readable output files.
|
|
|
|
|
|
* It uses "eval()" calls to create a separate source file with attached SourceMaps in the browser devtools.
|
|
|
|
|
|
* If you are trying to read the output file, select a different devtool (https://webpack.js.org/configuration/devtool/)
|
|
|
|
|
|
* or disable the default devtool with "devtool: false".
|
|
|
|
|
|
* If you are looking for production-ready output files, see mode: "production" (https://webpack.js.org/configuration/mode/).
|
|
|
|
|
|
*/
|
|
|
|
|
|
exports.id = "vendor-chunks/trough";
|
|
|
|
|
|
exports.ids = ["vendor-chunks/trough"];
|
|
|
|
|
|
exports.modules = {
|
|
|
|
|
|
|
|
|
|
|
|
/***/ "(ssr)/./node_modules/trough/index.js":
|
|
|
|
|
|
/*!**************************************!*\
|
|
|
|
|
|
!*** ./node_modules/trough/index.js ***!
|
|
|
|
|
|
\**************************************/
|
|
|
|
|
|
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
|
|
|
|
|
|
|
|
|
|
|
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ trough: () => (/* binding */ trough),\n/* harmony export */ wrap: () => (/* binding */ wrap)\n/* harmony export */ });\n/**\n * @typedef {(error?: Error|null|undefined, ...output: Array<any>) => void} Callback\n * @typedef {(...input: Array<any>) => any} Middleware\n *\n * @typedef {(...input: Array<any>) => void} Run\n * Call all middleware.\n * @typedef {(fn: Middleware) => Pipeline} Use\n * Add `fn` (middleware) to the list.\n * @typedef {{run: Run, use: Use}} Pipeline\n * Middleware.\n */ /**\n * Create new middleware.\n *\n * @returns {Pipeline}\n */ function trough() {\n /** @type {Array<Middleware>} */ const fns = [];\n /** @type {Pipeline} */ const pipeline = {\n run,\n use\n };\n return pipeline;\n /** @type {Run} */ function run(...values) {\n let middlewareIndex = -1;\n /** @type {Callback} */ const callback = values.pop();\n if (typeof callback !== \"function\") {\n throw new TypeError(\"Expected function as last argument, not \" + callback);\n }\n next(null, ...values);\n /**\n * Run the next `fn`, or we’re done.\n *\n * @param {Error|null|undefined} error\n * @param {Array<any>} output\n */ function next(error, ...output) {\n const fn = fns[++middlewareIndex];\n let index = -1;\n if (error) {\n callback(error);\n return;\n }\n // Copy non-nullish input into values.\n while(++index < values.length){\n if (output[index] === null || output[index] === undefined) {\n output[index] = values[index];\n }\n }\n // Save the newly created `output` for the next call.\n values = output;\n // Next or done.\n if (fn) {\n wrap(fn, next)(...output);\n } else {\n callback(null, ...output);\n }\n }\n }\n /** @type {Use} */ function use(middelware) {\n if (typeof middelware !== \"function\") {\n throw new TypeError(\"Expected `middelware` to be a function, not \" + middelware);\n }\n fns.push(middelware);\n return pipeline;\n }\n}\n/**\n * Wrap `middleware`.\n * Can be sync or async; return a promise, receive a callback, or return new\n * values and errors.\n *\n * @param {Middleware} middleware\n * @param {Callback} callback\n */ function wrap(middleware, callback) {\n /** @type {boolean} */ let called;\n return wrapped;\n /**\n * Call `middleware`.\n * @this {any}\n * @param {Array<any>} parameters\n * @returns {void}\n */ function wrapped(...parameters) {\n const fnExpectsCallback = middleware.length > parameters.length;\n /** @type {any} */ let result;\n if (fnExpectsCallback) {\n parameters.push(done);\n }\n try {\n result = middleware.apply(this, parameters);\n } catch (error) {\n const exception = /** @type {Error} */ error;\n // Well, this is quite the pickle.\n // `middleware` received a callback and called it synchronously, but that\n // threw an error.\n // The only thing left to do is to throw the thing instead.\n if (fnExpectsCallback && called) {\n throw exception;\n }\n return done(exception);\n }\n if (!fnExpectsCallback) {\n if (result instanceof Promise) {\n result.then(then, done);\n } else if (result instanceof Error) {\n done(result);\n } else {\n then(result);\n }\n }\n }\n /**\n * Call `callback`, only once.\n * @type {Callback}\n */ function done(error, ...output) {\n if (!called) {\n called = true;\n callback(error, ...ou
|
|
|
|
|
|
|
|
|
|
|
|
/***/ })
|
|
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
;
|