@merkur/plugin-error 0.30.0 → 0.32.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/lib/index.cjs +0 -2
- package/lib/index.es9.cjs +0 -3
- package/lib/index.js +0 -2
- package/lib/index.umd.js +1 -1
- package/package.json +9 -10
- package/rollup.config.mjs +11 -0
- package/lib/index.es5.js +0 -1
package/README.md
CHANGED
|
@@ -18,4 +18,4 @@
|
|
|
18
18
|
|
|
19
19
|
## About Merkur
|
|
20
20
|
|
|
21
|
-
The [Merkur](https://merkur.js.org/) is tiny extensible javascript library for front-end microservices(micro frontends). It allows by default server side rendering for loading performance boost. You can connect it with other frameworks or languages because merkur defines easy API. You can use one of six predefined template's library [
|
|
21
|
+
The [Merkur](https://merkur.js.org/) is tiny extensible javascript library for front-end microservices(micro frontends). It allows by default server side rendering for loading performance boost. You can connect it with other frameworks or languages because merkur defines easy API. You can use one of six predefined template's library [Preact](https://preactjs.com/), [µhtml](https://github.com/WebReflection/uhtml#readme), [Svelte](https://svelte.dev/) and [vanilla](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals) but you can easily extend for others.
|
package/lib/index.cjs
CHANGED
package/lib/index.es9.cjs
CHANGED
package/lib/index.js
CHANGED
package/lib/index.umd.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
function r(t){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(r){return typeof r}:function(r){return r&&"function"==typeof Symbol&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},r(t)}!function(r,t){if("function"==typeof define&&define.amd)define("@merkur/plugin-error",["exports","@merkur/core"],t);else if("undefined"!=typeof exports)t(exports,require("@merkur/core"));else{var e={exports:{}};t(e.exports,r.Merkur.Core),r.Merkur=r.Merkur||{},r.Merkur.Plugin=r.Merkur.Plugin||{},r.Merkur.Plugin.Error=e.exports}}("undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:this,(function(t,e){Object.defineProperty(t,"__esModule",{value:!0}),t.GenericError=t.ERROR_EVENTS=void 0,t.errorPlugin=function(){return{setup:function(r){return
|
|
1
|
+
function r(t){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(r){return typeof r}:function(r){return r&&"function"==typeof Symbol&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},r(t)}!function(r,t){if("function"==typeof define&&define.amd)define("@merkur/plugin-error",["exports","@merkur/core"],t);else if("undefined"!=typeof exports)t(exports,require("@merkur/core"));else{var e={exports:{}};t(e.exports,r.Merkur.Core),r.Merkur=r.Merkur||{},r.Merkur.Plugin=r.Merkur.Plugin||{},r.Merkur.Plugin.Error=e.exports}}("undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:this,(function(t,e){Object.defineProperty(t,"__esModule",{value:!0}),t.GenericError=t.ERROR_EVENTS=void 0,t.errorPlugin=function(){return{setup:function(r){return s((function*(){return r.error=r.error?r.error:{status:null,message:null},r}))()},create:function(r){return s((function*(){if(g===d){if(!r.$in.component)throw new Error("You must install missing plugin: npm i @merkur/plugin-component");if(!r.$in.eventEmitter)throw new Error("You must install missing plugin: npm i @merkur/plugin-event-emitter")}return(0,e.hookMethod)(r,"info",j),(0,e.hookMethod)(r,"load",w),(0,e.hookMethod)(r,"mount",P),(0,e.hookMethod)(r,"update",S),r}))()}}},t.renderContent=N,t.setErrorInfo=x;var n=["status"];function o(r){return function(r){if(Array.isArray(r))return i(r)}(r)||function(r){if("undefined"!=typeof Symbol&&null!=r[Symbol.iterator]||null!=r["@@iterator"])return Array.from(r)}(r)||function(r,t){if(!r)return;if("string"==typeof r)return i(r,t);var e=Object.prototype.toString.call(r).slice(8,-1);"Object"===e&&r.constructor&&(e=r.constructor.name);if("Map"===e||"Set"===e)return Array.from(r);if("Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e))return i(r,t)}(r)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function i(r,t){(null==t||t>r.length)&&(t=r.length);for(var e=0,n=new Array(t);e<t;e++)n[e]=r[e];return n}function u(r,t){var e=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(r,t).enumerable}))),e.push.apply(e,n)}return e}function c(r,t,e){return(t=p(t))in r?Object.defineProperty(r,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):r[t]=e,r}function a(r,t,e,n,o,i,u){try{var c=r[i](u),a=c.value}catch(r){return void e(r)}c.done?t(a):Promise.resolve(a).then(n,o)}function s(r){return function(){var t=this,e=arguments;return new Promise((function(n,o){var i=r.apply(t,e);function u(r){a(i,n,o,u,c,"next",r)}function c(r){a(i,n,o,u,c,"throw",r)}u(void 0)}))}}function f(r,t){if(null==r)return{};var e,n,o=function(r,t){if(null==r)return{};var e,n,o={},i=Object.keys(r);for(n=0;n<i.length;n++)e=i[n],t.indexOf(e)>=0||(o[e]=r[e]);return o}(r,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(r);for(n=0;n<i.length;n++)e=i[n],t.indexOf(e)>=0||Object.prototype.propertyIsEnumerable.call(r,e)&&(o[e]=r[e])}return o}function l(r,t){for(var e=0;e<t.length;e++){var n=t[e];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(r,p(n.key),n)}}function p(t){var e=function(t,e){if("object"!==r(t)||null===t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var o=n.call(t,e||"default");if("object"!==r(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"===r(e)?e:String(e)}function y(r,t){return y=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,t){return r.__proto__=t,r},y(r,t)}function h(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(r){return!1}}();return function(){var n,o=b(t);if(e){var i=b(this).constructor;n=Reflect.construct(o,arguments,i)}else n=o.apply(this,arguments);return function(t,e){if(e&&("object"===r(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(r){if(void 0===r)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return r}(t)}(this,n)}}function b(r){return b=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},b(r)}function m(r){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(!(this instanceof m))throw new TypeError("Cannot call a class as a function");if(this.constructor===m)throw new TypeError("The ExtensibleError is an abstract class and must be extended before it can be instantiated.");Error.call(this,r),this.name=this.constructor.name,this.message=r,this._nativeError=new Error(r),this._nativeError.name=this.name,this._nativeError.columnNumber&&(this.lineNumber=this._nativeError.lineNumber,this.columnNumber=this._nativeError.columnNumber,this.fileName=this._nativeError.fileName),this._stack=null,this._dropInternalStackFrames=t}m.prototype=Object.create(Error.prototype),m.prototype.constructor=m,Object.defineProperty(m.prototype,"stack",{configurable:!0,enumerable:!1,get:function(){if(this._stack)return this._stack;var r=this._nativeError.stack;if("string"==typeof r){if(this._dropInternalStackFrames){for(var t=r.split("\n"),e=1,n=Object.getPrototypeOf(this);n!==m.prototype;)n=Object.getPrototypeOf(n),e++;t.splice(1,e),this._stack=t.join("\n")}else this._stack=r;return this._stack}}});var v=function(r){!function(r,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");r.prototype=Object.create(t&&t.prototype,{constructor:{value:r,writable:!0,configurable:!0}}),Object.defineProperty(r,"prototype",{writable:!1}),t&&y(r,t)}(u,r);var t,e,o,i=h(u);function u(r,t){var e;!function(r,t){if(!(r instanceof t))throw new TypeError("Cannot call a class as a function")}(this,u),e=i.call(this,r);var o=t.status,c=void 0===o?500:o,a=f(t,n);return e.name="Error",e.status=c,e._params=a,e}return t=u,(e=[{key:"params",get:function(){return this._params}}])&&l(t.prototype,e),o&&l(t,o),Object.defineProperty(t,"prototype",{writable:!1}),u}(m);t.GenericError=v;var d="development",g="undefined"!=typeof process&&process&&process.env?process.env.NODE_ENV:d,O={ERROR:"@merkur/plugin-error.error"};function w(r,t){return E.apply(this,arguments)}function E(){return E=s((function*(r,t){var e={};if(r.error.status)return e;try{for(var n=arguments.length,o=new Array(n>2?n-2:0),i=2;i<n;i++)o[i-2]=arguments[i];e=yield t.apply(void 0,o)}catch(t){t.status=t.status||500,x(r,t),M(r,t)}return e})),E.apply(this,arguments)}function j(r,t){return k.apply(this,arguments)}function k(){return k=s((function*(r,t){for(var e=arguments.length,n=new Array(e>2?e-2:0),o=2;o<e;o++)n[o-2]=arguments[o];var i=yield t.apply(void 0,n);return function(r){for(var t=1;t<arguments.length;t++){var e=null!=arguments[t]?arguments[t]:{};t%2?u(Object(e),!0).forEach((function(t){c(r,t,e[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(e)):u(Object(e)).forEach((function(t){Object.defineProperty(r,t,Object.getOwnPropertyDescriptor(e,t))}))}return r}({error:r.error},i)})),k.apply(this,arguments)}function P(r,t){return _.apply(this,arguments)}function _(){return _=s((function*(r,t){for(var e=arguments.length,n=new Array(e>2?e-2:0),o=2;o<e;o++)n[o-2]=arguments[o];return N(r,t,n)})),_.apply(this,arguments)}function S(r,t){return R.apply(this,arguments)}function R(){return R=s((function*(r,t){for(var e=arguments.length,n=new Array(e>2?e-2:0),o=2;o<e;o++)n[o-2]=arguments[o];return N(r,t,n)})),R.apply(this,arguments)}function x(r,t){r.error.status=t.status,r.error.message=t.message,g===d&&(r.error.stack=t.stack)}function M(r,t){r.emit(O.ERROR,{error:t})}function N(r,t,e){return T.apply(this,arguments)}function T(){return(T=s((function*(r,t,e){if(r.error.status)try{return yield t.apply(void 0,o(e))}catch(r){return""}try{return yield t.apply(void 0,o(e))}catch(n){return n.status=n.status||500,x(r,n),M(r,n),N(r,t,e)}}))).apply(this,arguments)}t.ERROR_EVENTS=O}));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@merkur/plugin-error",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.32.0",
|
|
4
4
|
"description": "Merkur plugin for error handling.",
|
|
5
5
|
"main": "lib/index",
|
|
6
6
|
"module": "lib/index",
|
|
@@ -18,16 +18,16 @@
|
|
|
18
18
|
"./server/index.js": "./server/index.js"
|
|
19
19
|
},
|
|
20
20
|
"browser": {
|
|
21
|
-
"./lib/index.js": "./lib/index.
|
|
22
|
-
"./lib/index.cjs": "./lib/index.
|
|
21
|
+
"./lib/index.js": "./lib/index.js",
|
|
22
|
+
"./lib/index.cjs": "./lib/index.cjs",
|
|
23
23
|
"./lib/index.mjs": "./lib/index.mjs",
|
|
24
24
|
"./lib/index.es9.mjs": "./lib/index.es9.mjs"
|
|
25
25
|
},
|
|
26
26
|
"scripts": {
|
|
27
27
|
"preversion": "npm test",
|
|
28
|
-
"test": "
|
|
29
|
-
"test:es:version": "
|
|
30
|
-
"build": "
|
|
28
|
+
"test": "jest --no-watchman -c ./jest.config.js",
|
|
29
|
+
"test:es:version": "es-check es11 ./lib/index.mjs --module && es-check es9 ./lib/index.es9.mjs --module && es-check es9 ./lib/index.es9.cjs --module",
|
|
30
|
+
"build": "rollup -c rollup.config.mjs",
|
|
31
31
|
"prepare": "npm run build"
|
|
32
32
|
},
|
|
33
33
|
"repository": {
|
|
@@ -50,13 +50,12 @@
|
|
|
50
50
|
},
|
|
51
51
|
"homepage": "https://merkur.js.org/",
|
|
52
52
|
"devDependencies": {
|
|
53
|
-
"@merkur/core": "^0.
|
|
54
|
-
"@merkur/plugin-component": "^0.
|
|
55
|
-
"rollup": "^2.70.2"
|
|
53
|
+
"@merkur/core": "^0.32.0",
|
|
54
|
+
"@merkur/plugin-component": "^0.32.0"
|
|
56
55
|
},
|
|
57
56
|
"peerDependencies": {
|
|
58
57
|
"@merkur/core": "*",
|
|
59
58
|
"@merkur/plugin-component": "*"
|
|
60
59
|
},
|
|
61
|
-
"gitHead": "
|
|
60
|
+
"gitHead": "c45ffe12725e3c4afcf7f13869a25a96f6807055"
|
|
62
61
|
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createRollupESConfig,
|
|
3
|
+
createRollupES9Config,
|
|
4
|
+
createRollupUMDConfig,
|
|
5
|
+
} from '../../createRollupConfig.mjs';
|
|
6
|
+
|
|
7
|
+
let esConfig = createRollupESConfig();
|
|
8
|
+
let es9Config = createRollupES9Config();
|
|
9
|
+
let umdConfig = createRollupUMDConfig();
|
|
10
|
+
|
|
11
|
+
export default [esConfig, es9Config, umdConfig];
|
package/lib/index.es5.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";function r(e){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(r){return typeof r}:function(r){return r&&"function"==typeof Symbol&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},r(e)}var e=["status"];function t(r){return function(r){if(Array.isArray(r))return n(r)}(r)||function(r){if("undefined"!=typeof Symbol&&null!=r[Symbol.iterator]||null!=r["@@iterator"])return Array.from(r)}(r)||function(r,e){if(!r)return;if("string"==typeof r)return n(r,e);var t=Object.prototype.toString.call(r).slice(8,-1);"Object"===t&&r.constructor&&(t=r.constructor.name);if("Map"===t||"Set"===t)return Array.from(r);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return n(r,e)}(r)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function n(r,e){(null==e||e>r.length)&&(e=r.length);for(var t=0,n=new Array(e);t<e;t++)n[t]=r[t];return n}function o(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),t.push.apply(t,n)}return t}function i(r){for(var e=1;e<arguments.length;e++){var t=null!=arguments[e]?arguments[e]:{};e%2?o(Object(t),!0).forEach((function(e){s(r,e,t[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):o(Object(t)).forEach((function(e){Object.defineProperty(r,e,Object.getOwnPropertyDescriptor(t,e))}))}return r}function s(r,e,t){return e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function u(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */u=function(){return e};var e={},t=Object.prototype,n=t.hasOwnProperty,o=Object.defineProperty||function(r,e,t){r[e]=t.value},i="function"==typeof Symbol?Symbol:{},s=i.iterator||"@@iterator",a=i.asyncIterator||"@@asyncIterator",c=i.toStringTag||"@@toStringTag";function l(r,e,t){return Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}),r[e]}try{l({},"")}catch(r){l=function(r,e,t){return r[e]=t}}function f(r,e,t,n){var i=e&&e.prototype instanceof y?e:y,s=Object.create(i.prototype),u=new q(n||[]);return o(s,"_invoke",{value:x(r,t,u)}),s}function p(r,e,t){try{return{type:"normal",arg:r.call(e,t)}}catch(r){return{type:"throw",arg:r}}}e.wrap=f;var h={};function y(){}function d(){}function m(){}var v={};l(v,s,(function(){return this}));var b=Object.getPrototypeOf,j=b&&b(b(P([])));j&&j!==t&&n.call(j,s)&&(v=j);var g=m.prototype=y.prototype=Object.create(v);function w(r){["next","throw","return"].forEach((function(e){l(r,e,(function(r){return this._invoke(e,r)}))}))}function O(e,t){function i(o,s,u,a){var c=p(e[o],e,s);if("throw"!==c.type){var l=c.arg,f=l.value;return f&&"object"==r(f)&&n.call(f,"__await")?t.resolve(f.__await).then((function(r){i("next",r,u,a)}),(function(r){i("throw",r,u,a)})):t.resolve(f).then((function(r){l.value=r,u(l)}),(function(r){return i("throw",r,u,a)}))}a(c.arg)}var s;o(this,"_invoke",{value:function(r,e){function n(){return new t((function(t,n){i(r,e,t,n)}))}return s=s?s.then(n,n):n()}})}function x(r,e,t){var n="suspendedStart";return function(o,i){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw i;return L()}for(t.method=o,t.arg=i;;){var s=t.delegate;if(s){var u=E(s,t);if(u){if(u===h)continue;return u}}if("next"===t.method)t.sent=t._sent=t.arg;else if("throw"===t.method){if("suspendedStart"===n)throw n="completed",t.arg;t.dispatchException(t.arg)}else"return"===t.method&&t.abrupt("return",t.arg);n="executing";var a=p(r,e,t);if("normal"===a.type){if(n=t.done?"completed":"suspendedYield",a.arg===h)continue;return{value:a.arg,done:t.done}}"throw"===a.type&&(n="completed",t.method="throw",t.arg=a.arg)}}}function E(r,e){var t=r.iterator[e.method];if(void 0===t){if(e.delegate=null,"throw"===e.method){if(r.iterator.return&&(e.method="return",e.arg=void 0,E(r,e),"throw"===e.method))return h;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return h}var n=p(t,r.iterator,e.arg);if("throw"===n.type)return e.method="throw",e.arg=n.arg,e.delegate=null,h;var o=n.arg;return o?o.done?(e[r.resultName]=o.value,e.next=r.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,h):o:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,h)}function k(r){var e={tryLoc:r[0]};1 in r&&(e.catchLoc=r[1]),2 in r&&(e.finallyLoc=r[2],e.afterLoc=r[3]),this.tryEntries.push(e)}function _(r){var e=r.completion||{};e.type="normal",delete e.arg,r.completion=e}function q(r){this.tryEntries=[{tryLoc:"root"}],r.forEach(k,this),this.reset(!0)}function P(r){if(r){var e=r[s];if(e)return e.call(r);if("function"==typeof r.next)return r;if(!isNaN(r.length)){var t=-1,o=function e(){for(;++t<r.length;)if(n.call(r,t))return e.value=r[t],e.done=!1,e;return e.value=void 0,e.done=!0,e};return o.next=o}}return{next:L}}function L(){return{value:void 0,done:!0}}return d.prototype=m,o(g,"constructor",{value:m,configurable:!0}),o(m,"constructor",{value:d,configurable:!0}),d.displayName=l(m,c,"GeneratorFunction"),e.isGeneratorFunction=function(r){var e="function"==typeof r&&r.constructor;return!!e&&(e===d||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(r){return Object.setPrototypeOf?Object.setPrototypeOf(r,m):(r.__proto__=m,l(r,c,"GeneratorFunction")),r.prototype=Object.create(g),r},e.awrap=function(r){return{__await:r}},w(O.prototype),l(O.prototype,a,(function(){return this})),e.AsyncIterator=O,e.async=function(r,t,n,o,i){void 0===i&&(i=Promise);var s=new O(f(r,t,n,o),i);return e.isGeneratorFunction(t)?s:s.next().then((function(r){return r.done?r.value:s.next()}))},w(g),l(g,c,"Generator"),l(g,s,(function(){return this})),l(g,"toString",(function(){return"[object Generator]"})),e.keys=function(r){var e=Object(r),t=[];for(var n in e)t.push(n);return t.reverse(),function r(){for(;t.length;){var n=t.pop();if(n in e)return r.value=n,r.done=!1,r}return r.done=!0,r}},e.values=P,q.prototype={constructor:q,reset:function(r){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(_),!r)for(var e in this)"t"===e.charAt(0)&&n.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var r=this.tryEntries[0].completion;if("throw"===r.type)throw r.arg;return this.rval},dispatchException:function(r){if(this.done)throw r;var e=this;function t(t,n){return s.type="throw",s.arg=r,e.next=t,n&&(e.method="next",e.arg=void 0),!!n}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],s=i.completion;if("root"===i.tryLoc)return t("end");if(i.tryLoc<=this.prev){var u=n.call(i,"catchLoc"),a=n.call(i,"finallyLoc");if(u&&a){if(this.prev<i.catchLoc)return t(i.catchLoc,!0);if(this.prev<i.finallyLoc)return t(i.finallyLoc)}else if(u){if(this.prev<i.catchLoc)return t(i.catchLoc,!0)}else{if(!a)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return t(i.finallyLoc)}}}},abrupt:function(r,e){for(var t=this.tryEntries.length-1;t>=0;--t){var o=this.tryEntries[t];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===r||"continue"===r)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var s=i?i.completion:{};return s.type=r,s.arg=e,i?(this.method="next",this.next=i.finallyLoc,h):this.complete(s)},complete:function(r,e){if("throw"===r.type)throw r.arg;return"break"===r.type||"continue"===r.type?this.next=r.arg:"return"===r.type?(this.rval=this.arg=r.arg,this.method="return",this.next="end"):"normal"===r.type&&e&&(this.next=e),h},finish:function(r){for(var e=this.tryEntries.length-1;e>=0;--e){var t=this.tryEntries[e];if(t.finallyLoc===r)return this.complete(t.completion,t.afterLoc),_(t),h}},catch:function(r){for(var e=this.tryEntries.length-1;e>=0;--e){var t=this.tryEntries[e];if(t.tryLoc===r){var n=t.completion;if("throw"===n.type){var o=n.arg;_(t)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(r,e,t){return this.delegate={iterator:P(r),resultName:e,nextLoc:t},"next"===this.method&&(this.arg=void 0),h}},e}function a(r,e,t,n,o,i,s){try{var u=r[i](s),a=u.value}catch(r){return void t(r)}u.done?e(a):Promise.resolve(a).then(n,o)}function c(r){return function(){var e=this,t=arguments;return new Promise((function(n,o){var i=r.apply(e,t);function s(r){a(i,n,o,s,u,"next",r)}function u(r){a(i,n,o,s,u,"throw",r)}s(void 0)}))}}function l(r,e){if(null==r)return{};var t,n,o=function(r,e){if(null==r)return{};var t,n,o={},i=Object.keys(r);for(n=0;n<i.length;n++)t=i[n],e.indexOf(t)>=0||(o[t]=r[t]);return o}(r,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(r);for(n=0;n<i.length;n++)t=i[n],e.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(r,t)&&(o[t]=r[t])}return o}function f(r,e){for(var t=0;t<e.length;t++){var n=e[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(r,n.key,n)}}function p(r,e){return p=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,e){return r.__proto__=e,r},p(r,e)}function h(r){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(r){return!1}}();return function(){var t,n=d(r);if(e){var o=d(this).constructor;t=Reflect.construct(n,arguments,o)}else t=n.apply(this,arguments);return y(this,t)}}function y(e,t){if(t&&("object"===r(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(r){if(void 0===r)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return r}(e)}function d(r){return d=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},d(r)}require("core-js/modules/es.object.define-property.js"),require("core-js/modules/es.function.name.js"),require("core-js/modules/es.object.create.js"),require("core-js/modules/es.object.get-prototype-of.js"),require("core-js/modules/es.array.splice.js"),require("core-js/modules/es.array.join.js"),require("core-js/modules/es.object.set-prototype-of.js"),require("core-js/modules/es.function.bind.js"),require("core-js/modules/es.object.to-string.js"),require("core-js/modules/es.reflect.construct.js"),require("core-js/modules/es.object.keys.js"),require("core-js/modules/es.array.index-of.js"),require("core-js/modules/es.symbol.js"),require("core-js/modules/es.promise.js"),require("core-js/modules/es.symbol.description.js"),require("core-js/modules/es.symbol.iterator.js"),require("core-js/modules/es.array.iterator.js"),require("core-js/modules/es.string.iterator.js"),require("core-js/modules/web.dom-collections.iterator.js"),require("core-js/modules/es.symbol.async-iterator.js"),require("core-js/modules/es.symbol.to-string-tag.js"),require("core-js/modules/es.json.to-string-tag.js"),require("core-js/modules/es.math.to-string-tag.js"),require("core-js/modules/es.array.for-each.js"),require("core-js/modules/web.dom-collections.for-each.js"),require("core-js/modules/es.array.reverse.js"),require("core-js/modules/es.array.slice.js"),require("core-js/modules/es.array.filter.js"),require("core-js/modules/es.object.get-own-property-descriptor.js"),require("core-js/modules/es.object.get-own-property-descriptors.js"),require("core-js/modules/es.object.define-properties.js"),require("core-js/modules/es.array.is-array.js"),require("core-js/modules/es.array.from.js"),require("core-js/modules/es.regexp.exec.js"),Object.defineProperty(exports,"__esModule",{value:!0});var m=require("@merkur/core");function v(r){var e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(!(this instanceof v))throw new TypeError("Cannot call a class as a function");if(this.constructor===v)throw new TypeError("The ExtensibleError is an abstract class and must be extended before it can be instantiated.");Error.call(this,r),this.name=this.constructor.name,this.message=r,this._nativeError=new Error(r),this._nativeError.name=this.name,this._nativeError.columnNumber&&(this.lineNumber=this._nativeError.lineNumber,this.columnNumber=this._nativeError.columnNumber,this.fileName=this._nativeError.fileName),this._stack=null,this._dropInternalStackFrames=e}v.prototype=Object.create(Error.prototype),v.prototype.constructor=v,Object.defineProperty(v.prototype,"stack",{configurable:!0,enumerable:!1,get:function(){if(this._stack)return this._stack;var r=this._nativeError.stack;if("string"==typeof r){if(this._dropInternalStackFrames){for(var e=r.split("\n"),t=1,n=Object.getPrototypeOf(this);n!==v.prototype;)n=Object.getPrototypeOf(n),t++;e.splice(1,t),this._stack=e.join("\n")}else this._stack=r;return this._stack}}});var b=function(r){!function(r,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");r.prototype=Object.create(e&&e.prototype,{constructor:{value:r,writable:!0,configurable:!0}}),Object.defineProperty(r,"prototype",{writable:!1}),e&&p(r,e)}(s,v);var t,n,o,i=h(s);function s(r,t){var n;!function(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}(this,s),n=i.call(this,r);var o=t.status,u=void 0===o?500:o,a=l(t,e);return n.name="Error",n.status=u,n._params=a,n}return t=s,(n=[{key:"params",get:function(){return this._params}}])&&f(t.prototype,n),o&&f(t,o),Object.defineProperty(t,"prototype",{writable:!1}),s}(),j="development",g="undefined"!=typeof process&&process&&process.env?process.env.NODE_ENV:j,w={ERROR:"@merkur/plugin-error.error"};function O(r,e){return x.apply(this,arguments)}function x(){return x=c(u().mark((function r(e,t){var n,o,i,s,a=arguments;return u().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(n={},!e.error.status){r.next=3;break}return r.abrupt("return",n);case 3:for(r.prev=3,o=a.length,i=new Array(o>2?o-2:0),s=2;s<o;s++)i[s-2]=a[s];return r.next=7,t.apply(void 0,i);case 7:n=r.sent,r.next=15;break;case 10:r.prev=10,r.t0=r.catch(3),r.t0.status=r.t0.status||500,S(e,r.t0),N(e,r.t0);case 15:return r.abrupt("return",n);case 16:case"end":return r.stop()}}),r,null,[[3,10]])}))),x.apply(this,arguments)}function E(r,e){return k.apply(this,arguments)}function k(){return k=c(u().mark((function r(e,t){var n,o,s,a,c=arguments;return u().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:for(n=c.length,o=new Array(n>2?n-2:0),s=2;s<n;s++)o[s-2]=c[s];return r.next=3,t.apply(void 0,o);case 3:return a=r.sent,r.abrupt("return",i({error:e.error},a));case 5:case"end":return r.stop()}}),r)}))),k.apply(this,arguments)}function _(r,e){return q.apply(this,arguments)}function q(){return q=c(u().mark((function r(e,t){var n,o,i,s=arguments;return u().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:for(n=s.length,o=new Array(n>2?n-2:0),i=2;i<n;i++)o[i-2]=s[i];return r.abrupt("return",R(e,t,o));case 2:case"end":return r.stop()}}),r)}))),q.apply(this,arguments)}function P(r,e){return L.apply(this,arguments)}function L(){return L=c(u().mark((function r(e,t){var n,o,i,s=arguments;return u().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:for(n=s.length,o=new Array(n>2?n-2:0),i=2;i<n;i++)o[i-2]=s[i];return r.abrupt("return",R(e,t,o));case 2:case"end":return r.stop()}}),r)}))),L.apply(this,arguments)}function S(r,e){r.error.status=e.status,r.error.message=e.message,g===j&&(r.error.stack=e.stack)}function N(r,e){r.emit(w.ERROR,{error:e})}function R(r,e,t){return A.apply(this,arguments)}function A(){return(A=c(u().mark((function r(e,n,o){var i;return u().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(i=null,!e.error.status){r.next=13;break}return r.prev=2,r.next=5,n.apply(void 0,t(o));case 5:case 16:return i=r.sent,r.abrupt("return",i);case 9:return r.prev=9,r.t0=r.catch(2),i="",r.abrupt("return",i);case 13:return r.prev=13,r.next=16,n.apply(void 0,t(o));case 20:return r.prev=20,r.t1=r.catch(13),r.t1.status=r.t1.status||500,S(e,r.t1),N(e,r.t1),r.abrupt("return",R(e,n,o));case 26:case"end":return r.stop()}}),r,null,[[2,9],[13,20]])})))).apply(this,arguments)}exports.ERROR_EVENTS=w,exports.GenericError=b,exports.errorPlugin=function(){return{setup:function(r){return c(u().mark((function e(){return u().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r.error=r.error?r.error:{status:null,message:null},e.abrupt("return",r);case 2:case"end":return e.stop()}}),e)})))()},create:function(r){return c(u().mark((function e(){return u().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(g!==j){e.next=5;break}if(r.$in.component){e.next=3;break}throw new Error("You must install missing plugin: npm i @merkur/plugin-component");case 3:if(r.$in.eventEmitter){e.next=5;break}throw new Error("You must install missing plugin: npm i @merkur/plugin-event-emitter");case 5:return m.hookMethod(r,"info",E),m.hookMethod(r,"load",O),m.hookMethod(r,"mount",_),m.hookMethod(r,"update",P),e.abrupt("return",r);case 10:case"end":return e.stop()}}),e)})))()}}},exports.renderContent=R,exports.setErrorInfo=S;
|