single-spa
Advanced tools
Comparing version 5.2.0 to 5.2.1
@@ -1,2 +0,2 @@ | ||
/* single-spa@5.2.0 - ESM - dev */ | ||
/* single-spa@5.2.1 - ESM - dev */ | ||
var singleSpa = /*#__PURE__*/Object.freeze({ | ||
@@ -3,0 +3,0 @@ __proto__: null, |
@@ -1,3 +0,3 @@ | ||
/* single-spa@5.2.0 - ESM - prod */ | ||
/* single-spa@5.2.1 - ESM - prod */ | ||
var t=Object.freeze({__proto__:null,get start(){return Gt},get ensureJQuerySupport(){return mt},get setBootstrapMaxTime(){return V},get setMountMaxTime(){return q},get setUnmountMaxTime(){return z},get setUnloadMaxTime(){return X},get registerApplication(){return Nt},get getMountedApps(){return Tt},get getAppStatus(){return bt},get unloadApplication(){return Mt},get checkActivityFunctions(){return At},get getAppNames(){return Pt},get navigateToUrl(){return ot},get triggerAppChange(){return It},get addErrorHandler(){return i},get removeErrorHandler(){return a},get mountRootParcel(){return k},get NOT_LOADED(){return l},get LOADING_SOURCE_CODE(){return c},get NOT_BOOTSTRAPPED(){return f},get BOOTSTRAPPING(){return h},get NOT_MOUNTED(){return m},get MOUNTING(){return p},get UPDATING(){return v},get LOAD_ERROR(){return g},get MOUNTED(){return d},get UNMOUNTING(){return w},get SKIP_BECAUSE_BROKEN(){return E}}),e=("undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{}).CustomEvent,r=function(){try{var t=new e("cat",{detail:{foo:"bar"}});return"cat"===t.type&&"bar"===t.detail.foo}catch(t){}return!1}()?e:"undefined"!=typeof document&&"function"==typeof document.createEvent?function(t,e){var r=document.createEvent("CustomEvent");return e?r.initCustomEvent(t,e.bubbles,e.cancelable,e.detail):r.initCustomEvent(t,!1,!1,void 0),r}:function(t,e){var r=document.createEventObject();return r.type=t,e?(r.bubbles=Boolean(e.bubbles),r.cancelable=Boolean(e.cancelable),r.detail=e.detail):(r.bubbles=!1,r.cancelable=!1,r.detail=void 0),r},n=[];function o(t,e,r){var o=s(t,e,r);n.length?n.forEach(t=>t(o)):setTimeout(()=>{throw o})}function i(t){if("function"!=typeof t)throw Error(u(28,!1));n.push(t)}function a(t){if("function"!=typeof t)throw Error(u(29,!1));var e=!1;return n=n.filter(r=>{var n=r===t;return e=e||n,!n}),e}function u(t,e){for(var r=arguments.length,n=new Array(r>2?r-2:0),o=2;o<r;o++)n[o-2]=arguments[o];return"single-spa minified message #".concat(t,": ").concat(e?e+" ":"","See https://single-spa.js.org/error/?code=").concat(t).concat(n.length?"&arg=".concat(n.join("&arg=")):"")}function s(t,e,r){var n,o="".concat(M(e)," '").concat(S(e),"' died in status ").concat(e.status,": ");if(t instanceof Error){try{t.message=o+t.message}catch(t){}n=t}else{console.warn(u(30,!1,e.status,S(e)));try{n=Error(o+JSON.stringify(t))}catch(e){n=t}}return n.appOrParcelName=S(e),e.status=r,n}var l="NOT_LOADED",c="LOADING_SOURCE_CODE",f="NOT_BOOTSTRAPPED",h="BOOTSTRAPPING",m="NOT_MOUNTED",p="MOUNTING",d="MOUNTED",v="UPDATING",w="UNMOUNTING",g="LOAD_ERROR",E="SKIP_BECAUSE_BROKEN";function y(t){return t.status===d}function O(t){return!y(t)}function T(t){return t.status!==l&&t.status!==c&&t.status!==g}function P(t){return!T(t)}function b(t){try{return t.activeWhen(window.location)}catch(e){o(e,t,E)}}function N(t){try{return!t.activeWhen(window.location)}catch(e){o(e,t,E)}}function A(t){return t!==E&&(!t||t.status!==E)}function _(t){return t.status!==g||(new Date).getTime()-t.loadErrorTime>=200}function S(t){return t.name}function D(t){return Boolean(t.unmountThisParcel)}function M(t){return D(t)?"parcel":"application"}function U(){for(var t=arguments.length-1;t>0;t--)for(var e in arguments[t])"__proto__"!==e&&(arguments[t-1][e]=arguments[t][e]);return arguments[0]}function L(t,e){for(var r=0;r<t.length;r++)if(e(t[r]))return t[r];return null}function j(t){return t&&("function"==typeof t||(e=t,Array.isArray(e)&&!L(e,t=>"function"!=typeof t)));var e}function I(t,e){var r=t[e]||[];0===(r=Array.isArray(r)?r:[r]).length&&(r=[()=>Promise.resolve()]);var n=M(t),o=S(t);return function(t){return r.reduce((r,i,a)=>r.then(()=>{var r=i(t);return R(r)?r:Promise.reject(u(15,!1,n,o,e,a))}),Promise.resolve())}}function R(t){return t&&"function"==typeof t.then&&"function"==typeof t.catch}function x(t,e){return Promise.resolve().then(()=>t.status!==f?t:(t.status=h,Y(t,"bootstrap").then(()=>(t.status=m,t)).catch(r=>{if(e)throw s(r,t,E);return o(r,t,E),t})))}function G(t,e){return Promise.resolve().then(()=>{if(t.status!==d)return t;t.status=w;var r=Object.keys(t.parcels).map(e=>t.parcels[e].unmountThisParcel());return Promise.all(r).then(n,r=>n().then(()=>{var n=Error(r.message);if(e)throw s(n,t,E);o(n,t,E)})).then(()=>t);function n(){return Y(t,"unmount").then(()=>{t.status=m}).catch(r=>{if(e)throw s(r,t,E);o(r,t,E)})}})}var B=!1,C=!1;function K(t,e){return Promise.resolve().then(()=>t.status!==m?t:(B||(window.dispatchEvent(new r("single-spa:before-first-mount")),B=!0),Y(t,"mount").then(()=>(t.status=d,C||(window.dispatchEvent(new r("single-spa:first-mount")),C=!0),t)).catch(r=>{return t.status=d,G(t,!0).then(n,n);function n(){if(e)throw s(r,t,E);return o(r,t,E),t}})))}var W=0,$={parcels:{}};function k(){return F.apply($,arguments)}function F(t,e){var r=this;if(!t||"object"!=typeof t&&"function"!=typeof t)throw Error(u(2,!1));if(t.name&&"string"!=typeof t.name)throw Error(u(3,!1,typeof t.name));if("object"!=typeof e)throw Error(u(4,!1,name,typeof e));if(!e.domElement)throw Error(u(5,!1,name));var n,o=W++,i="function"==typeof t,a=i?t:()=>Promise.resolve(t),l={id:o,parcels:{},status:i?c:f,customProps:e,parentName:S(r),unmountThisParcel(){if(l.status!==d)throw Error(u(6,!1,name,l.status));return G(l,!0).then(t=>(l.parentName&&delete r.parcels[l.id],t)).then(t=>(p(t),t)).catch(t=>{throw l.status=E,w(t),t})}};r.parcels[o]=l;var h=a();if(!h||"function"!=typeof h.then)throw Error(u(7,!1));var p,w,g=(h=h.then(t=>{if(!t)throw Error(u(8,!1));var e=t.name||"parcel-".concat(o);if(!j(t.bootstrap))throw Error(u(9,!1,e));if(!j(t.mount))throw Error(u(10,!1,e));if(!j(t.unmount))throw Error(u(11,!1,e));if(t.update&&!j(t.update))throw Error(u(12,!1,e));var r=I(t,"bootstrap"),i=I(t,"mount"),a=I(t,"unmount");l.status=f,l.name=e,l.bootstrap=r,l.mount=i,l.unmount=a,l.timeouts=Z(t.timeouts),t.update&&(l.update=I(t,"update"),n.update=function(t){return l.customProps=t,J(function(t){return Promise.resolve().then(()=>{if(t.status!==d)throw Error(u(32,!1,S(t)));return t.status=v,Y(t,"update").then(()=>(t.status=d,t)).catch(e=>{throw s(e,t,E)})})}(l))})})).then(()=>x(l,!0)),y=g.then(()=>K(l,!0)),O=new Promise((t,e)=>{p=t,w=e});return n={mount:()=>J(Promise.resolve().then(()=>{if(l.status!==m)throw Error(u(13,!1,name,l.status));return r.parcels[o]=l,K(l)})),unmount:()=>J(l.unmountThisParcel()),getStatus:()=>l.status,loadPromise:J(h),bootstrapPromise:J(g),mountPromise:J(y),unmountPromise:J(O)}}function J(t){return t.then(()=>null)}function H(e){var r=U({},e.customProps,{name:S(e),mountParcel:F.bind(e),singleSpa:t});return D(e)&&(r.unmountSelf=e.unmountThisParcel),r}var Q={bootstrap:{millis:4e3,dieOnTimeout:!1,warningMillis:1e3},mount:{millis:3e3,dieOnTimeout:!1,warningMillis:1e3},unmount:{millis:3e3,dieOnTimeout:!1,warningMillis:1e3},unload:{millis:3e3,dieOnTimeout:!1,warningMillis:1e3},update:{millis:3e3,dieOnTimeout:!1,warningMillis:1e3}};function V(t,e,r){if("number"!=typeof t||t<=0)throw Error(u(16,!1));Q.bootstrap={millis:t,dieOnTimeout:e,warningMillis:r||1e3}}function q(t,e,r){if("number"!=typeof t||t<=0)throw Error(u(17,!1));Q.mount={millis:t,dieOnTimeout:e,warningMillis:r||1e3}}function z(t,e,r){if("number"!=typeof t||t<=0)throw Error(u(18,!1));Q.unmount={millis:t,dieOnTimeout:e,warningMillis:r||1e3}}function X(t,e,r){if("number"!=typeof t||t<=0)throw Error(u(19,!1));Q.unload={millis:t,dieOnTimeout:e,warningMillis:r||1e3}}function Y(t,e){var r=t.timeouts[e],n=r.warningMillis,o=M(t);return new Promise((i,a)=>{var s=!1,l=!1;t[e](H(t)).then(t=>{s=!0,i(t)}).catch(t=>{s=!0,a(t)}),setTimeout(()=>f(1),n),setTimeout(()=>f(!0),r.millis);var c=u(31,!1,e,o,S(t),r.millis);function f(t){if(!s)if(!0===t)l=!0,r.dieOnTimeout?a(Error(c)):console.error(c);else if(!l){var e=t,o=e*n;console.warn(c),o+n<r.millis&&setTimeout(()=>f(e+1),n)}}})}function Z(t){var e={};for(var r in Q)e[r]=U({},Q[r],t&&t[r]||{});return e}function tt(t){return Promise.resolve().then(()=>{return t.loadPromise?t.loadPromise:t.status!==l&&t.status!==g?t:(t.status=c,t.loadPromise=Promise.resolve().then(()=>{var n=t.loadImpl(H(t));if(!R(n))throw r=!0,Error(u(33,!1,S(t)));return n.then(r=>{var n;t.loadErrorTime=null,"object"!=typeof(e=r)&&(n=34),j(e.bootstrap)||(n=35),j(e.mount)||(n=36),j(e.unmount)||(n=37);var i=M(e);if(n){var a;try{a=JSON.stringify(e)}catch(t){}return console.error(u(n,!1,i,S(t),a),e),o(void 0,t,E),t}return e.devtools&&e.devtools.overlays&&(t.devtools.overlays=U({},t.devtools.overlays,e.devtools.overlays)),t.status=f,t.bootstrap=I(e,"bootstrap"),t.mount=I(e,"mount"),t.unmount=I(e,"unmount"),t.unload=I(e,"unload"),t.timeouts=Z(e.timeouts),delete t.loadPromise,t})}).catch(e=>{var n;return delete t.loadPromise,r?n=E:(n=g,t.loadErrorTime=(new Date).getTime()),o(e,t,n),t}));var e,r})}var et,rt={hashchange:[],popstate:[]},nt=["hashchange","popstate"];function ot(t){var e;if("string"==typeof t)e=t;else if(this&&this.href)e=this.href;else{if(!(t&&t.currentTarget&&t.currentTarget.href&&t.preventDefault))throw Error(u(14,!1));e=t.currentTarget.href,t.preventDefault()}var r=ft(window.location.href),n=ft(e);0===e.indexOf("#")?window.location.hash=n.hash:r.host!==n.host&&n.host?window.location.href=e:n.pathname===r.pathname&&n.search===r.pathname?window.location.hash=n.hash:window.history.pushState(null,null,e)}function it(t){if(t){var e=t[0].type;nt.indexOf(e)>=0&&rt[e].forEach(e=>{try{e.apply(this,t)}catch(t){setTimeout(()=>{throw t})}})}}function at(){Rt([],arguments)}window.addEventListener("hashchange",at),window.addEventListener("popstate",at);var ut=window.addEventListener,st=window.removeEventListener;function lt(t){return function(){var e=window.location.href,r=t.apply(this,arguments),n=window.location.href;return et&&e===n||at(ct(window.history.state)),r}}function ct(t){try{return new PopStateEvent("popstate",{state:t})}catch(r){var e=document.createEvent("PopStateEvent");return e.initPopStateEvent("popstate",!1,!1,t),e}}function ft(t){var e=document.createElement("a");return e.href=t,e}window.addEventListener=function(t,e){if(!("function"==typeof e&&nt.indexOf(t)>=0)||L(rt[t],t=>t===e))return ut.apply(this,arguments);rt[t].push(e)},window.removeEventListener=function(t,e){if(!("function"==typeof e&&nt.indexOf(t)>=0))return st.apply(this,arguments);rt[t]=rt[t].filter(t=>t!==e)},window.history.pushState=lt(window.history.pushState),window.history.replaceState=lt(window.history.replaceState),window.singleSpaNavigate=ot;var ht=!1;function mt(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:window.jQuery;if(t||window.$&&window.$.fn&&window.$.fn.jquery&&(t=window.$),t&&!ht){var e=t.fn.on,r=t.fn.off;t.fn.on=function(t,r){return pt.call(this,e,window.addEventListener,t,r,arguments)},t.fn.off=function(t,e){return pt.call(this,r,window.removeEventListener,t,e,arguments)},ht=!0}}function pt(t,e,r,n,o){return"string"!=typeof r?t.apply(this,o):(r.split(/\s+/).forEach(t=>{nt.indexOf(t)>=0&&(e(t,n),r=r.replace(t,""))}),""===r.trim()?this:t.apply(this,o))}var dt={};function vt(t){return Promise.resolve().then(()=>{var e=dt[S(t)];return e?t.status===l?(wt(t,e),t):"UNLOADING"===t.status?e.promise.then(()=>t):t.status!==m?t:(t.status="UNLOADING",Y(t,"unload").then(()=>(wt(t,e),t)).catch(r=>(function(t,e,r){delete dt[S(t)],delete t.bootstrap,delete t.mount,delete t.unmount,delete t.unload,o(r,t,E),e.reject(r)}(t,e,r),t))):t})}function wt(t,e){delete dt[S(t)],delete t.bootstrap,delete t.mount,delete t.unmount,delete t.unload,t.status=l,e.resolve()}function gt(t,e,r,n){dt[S(t)]={app:t,resolve:r,reject:n},Object.defineProperty(dt[S(t)],"promise",{get:e})}function Et(t){return dt[t]}function yt(){return Object.keys(dt).map(t=>dt[t].app).filter(O)}var Ot=[];function Tt(){return Ot.filter(y).map(S)}function Pt(){return Ot.map(S)}function bt(t){var e=L(Ot,e=>S(e)===t);return e?e.status:null}function Nt(t,e,r){var n,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};if("string"!=typeof t||0===t.length)throw Error(u(20,!1));if(-1!==Pt().indexOf(t))throw Error(u(21,!1,t));if("object"!=typeof o||Array.isArray(o))throw Error(u(22,!1));if(!e)throw Error(u(23,!1));if(n="function"!=typeof e?()=>Promise.resolve(e):e,"function"!=typeof r)throw Error(u(24,!1));Ot.push({loadErrorTime:null,name:t,loadImpl:n,activeWhen:r,status:l,parcels:{},devtools:{overlays:{options:{},selectors:[]}},customProps:o}),mt(),Rt()}function At(t){return Ot.filter(e=>e.activeWhen(t)).map(S)}function _t(){return Ot.filter(A).filter(_).filter(P).filter(b)}function St(){return Ot.filter(A).filter(y).filter(N)}function Dt(){return Ot.filter(A).filter(O).filter(T).filter(b)}function Mt(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{waitForUnmount:!1};if("string"!=typeof t)throw Error(u(26,!1));var r=L(Ot,e=>S(e)===t);if(!r)throw Error(u(27,!1,t));var n,o=Et(S(r));if(e&&e.waitForUnmount){if(o)return o.promise;var i=new Promise((t,e)=>{gt(r,()=>i,t,e)});return i}return o?(n=o.promise,Ut(r,o.resolve,o.reject)):n=new Promise((t,e)=>{gt(r,()=>n,t,e),Ut(r,t,e)}),n}function Ut(t,e,r){G(t).then(vt).then(()=>{e(),setTimeout(()=>{Rt()})}).catch(r)}var Lt=!1,jt=[];function It(){return Rt()}function Rt(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1?arguments[1]:void 0;if(Lt)return new Promise((t,r)=>{jt.push({resolve:t,reject:r,eventArguments:e})});var n=!0;return Bt()?(Lt=!0,i()):o();function o(){return Promise.resolve().then(()=>{var t=_t().map(tt);return t.length>0&&(n=!1),Promise.all(t).then(u).then(()=>[]).catch(t=>{throw u(),t})})}function i(){return Promise.resolve().then(()=>{window.dispatchEvent(new r("single-spa:before-routing-event",s()));var e=yt().map(vt),o=St().map(G).map(t=>t.then(vt)).concat(e);o.length>0&&(n=!1);var i=Promise.all(o),l=_t(),c=l.map(t=>tt(t).then(x).then(t=>i.then(()=>K(t))));c.length>0&&(n=!1);var f=Dt().filter(t=>l.indexOf(t)<0).map(t=>x(t).then(()=>i).then(()=>K(t)));return f.length>0&&(n=!1),i.catch(t=>{throw u(),t}).then(()=>(u(),Promise.all(c.concat(f)).catch(e=>{throw t.forEach(t=>t.reject(e)),e}).then(a)))})}function a(){var e=Tt();t.forEach(t=>t.resolve(e));try{var o=n?"single-spa:no-app-change":"single-spa:app-change";window.dispatchEvent(new r(o,s())),window.dispatchEvent(new r("single-spa:routing-event",s()))}catch(t){setTimeout(()=>{throw t})}if(Lt=!1,jt.length>0){var i=jt;jt=[],Rt(i)}return e}function u(){t.forEach(t=>{it(t.eventArguments)}),it(e)}function s(){var t={detail:{}};return e&&e[0]&&(t.detail.originalEvent=e[0]),t}}var xt=!1;function Gt(t){var e;xt=!0,t&&t.urlRerouteOnly&&(e=t.urlRerouteOnly,et=e),Rt()}function Bt(){return xt}setTimeout(()=>{xt||console.warn(u(1,!1))},5e3);var Ct={getRawAppData:function(){return[...Ot]},reroute:Rt,NOT_LOADED:l,toLoadPromise:tt,toBootstrapPromise:x,unregisterApplication:function(t){if(!Ot.find(e=>S(e)===t))throw Error(u(25,!1,t));return Mt(t).then(()=>{var e=Ot.findIndex(e=>S(e)===t);Ot.splice(e,1)})}};window&&window.__SINGLE_SPA_DEVTOOLS__&&(window.__SINGLE_SPA_DEVTOOLS__.exposedMethods=Ct);export{h as BOOTSTRAPPING,c as LOADING_SOURCE_CODE,g as LOAD_ERROR,d as MOUNTED,p as MOUNTING,f as NOT_BOOTSTRAPPED,l as NOT_LOADED,m as NOT_MOUNTED,E as SKIP_BECAUSE_BROKEN,w as UNMOUNTING,v as UPDATING,i as addErrorHandler,At as checkActivityFunctions,mt as ensureJQuerySupport,Pt as getAppNames,bt as getAppStatus,Tt as getMountedApps,k as mountRootParcel,ot as navigateToUrl,Nt as registerApplication,a as removeErrorHandler,V as setBootstrapMaxTime,q as setMountMaxTime,X as setUnloadMaxTime,z as setUnmountMaxTime,Gt as start,It as triggerAppChange,Mt as unloadApplication}; | ||
//# sourceMappingURL=single-spa.min.js.map |
@@ -1,2 +0,2 @@ | ||
/* single-spa@5.2.0 - SystemJS - dev */ | ||
/* single-spa@5.2.1 - SystemJS - dev */ | ||
System.register([], function (exports) { | ||
@@ -3,0 +3,0 @@ 'use strict'; |
@@ -1,3 +0,3 @@ | ||
/* single-spa@5.2.0 - SystemJS - prod */ | ||
/* single-spa@5.2.1 - SystemJS - prod */ | ||
System.register([],(function(t){return{execute:function(){t({addErrorHandler:a,checkActivityFunctions:_t,ensureJQuerySupport:dt,getAppNames:Nt,getAppStatus:At,getMountedApps:bt,mountRootParcel:W,navigateToUrl:ut,registerApplication:St,removeErrorHandler:c,setBootstrapMaxTime:z,setMountMaxTime:X,setUnloadMaxTime:Z,setUnmountMaxTime:Y,start:Ct,triggerAppChange:Gt,unloadApplication:Rt});var n=Object.freeze({__proto__:null,get start(){return Ct},get ensureJQuerySupport(){return dt},get setBootstrapMaxTime(){return z},get setMountMaxTime(){return X},get setUnmountMaxTime(){return Y},get setUnloadMaxTime(){return Z},get registerApplication(){return St},get getMountedApps(){return bt},get getAppStatus(){return At},get unloadApplication(){return Rt},get checkActivityFunctions(){return _t},get getAppNames(){return Nt},get navigateToUrl(){return ut},get triggerAppChange(){return Gt},get addErrorHandler(){return a},get removeErrorHandler(){return c},get mountRootParcel(){return W},get NOT_LOADED(){return l},get LOADING_SOURCE_CODE(){return h},get NOT_BOOTSTRAPPED(){return m},get BOOTSTRAPPING(){return p},get NOT_MOUNTED(){return d},get MOUNTING(){return v},get UPDATING(){return g},get LOAD_ERROR(){return y},get MOUNTED(){return w},get UNMOUNTING(){return E},get SKIP_BECAUSE_BROKEN(){return O}}),e=("undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{}).CustomEvent,r=function(){try{var t=new e("cat",{detail:{foo:"bar"}});return"cat"===t.type&&"bar"===t.detail.foo}catch(t){}return!1}()?e:"undefined"!=typeof document&&"function"==typeof document.createEvent?function(t,n){var e=document.createEvent("CustomEvent");return n?e.initCustomEvent(t,n.bubbles,n.cancelable,n.detail):e.initCustomEvent(t,!1,!1,void 0),e}:function(t,n){var e=document.createEventObject();return e.type=t,n?(e.bubbles=Boolean(n.bubbles),e.cancelable=Boolean(n.cancelable),e.detail=n.detail):(e.bubbles=!1,e.cancelable=!1,e.detail=void 0),e};function o(t){return(o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var i=[];function u(t,n,e){var r=f(t,n,e);i.length?i.forEach((function(t){return t(r)})):setTimeout((function(){throw r}))}function a(t){if("function"!=typeof t)throw Error(s(28,!1));i.push(t)}function c(t){if("function"!=typeof t)throw Error(s(29,!1));var n=!1;return i=i.filter((function(e){var r=e===t;return n=n||r,!r})),n}function s(t,n){for(var e=arguments.length,r=new Array(e>2?e-2:0),o=2;o<e;o++)r[o-2]=arguments[o];return"single-spa minified message #".concat(t,": ").concat(n?n+" ":"","See https://single-spa.js.org/error/?code=").concat(t).concat(r.length?"&arg=".concat(r.join("&arg=")):"")}function f(t,n,e){var r,o="".concat(R(n)," '").concat(M(n),"' died in status ").concat(n.status,": ");if(t instanceof Error){try{t.message=o+t.message}catch(t){}r=t}else{console.warn(s(30,!1,n.status,M(n)));try{r=Error(o+JSON.stringify(t))}catch(n){r=t}}return r.appOrParcelName=M(n),n.status=e,r}var l=t("NOT_LOADED","NOT_LOADED"),h=t("LOADING_SOURCE_CODE","LOADING_SOURCE_CODE"),m=t("NOT_BOOTSTRAPPED","NOT_BOOTSTRAPPED"),p=t("BOOTSTRAPPING","BOOTSTRAPPING"),d=t("NOT_MOUNTED","NOT_MOUNTED"),v=t("MOUNTING","MOUNTING"),w=t("MOUNTED","MOUNTED"),g=t("UPDATING","UPDATING"),E=t("UNMOUNTING","UNMOUNTING"),y=t("LOAD_ERROR","LOAD_ERROR"),O=t("SKIP_BECAUSE_BROKEN","SKIP_BECAUSE_BROKEN");function T(t){return t.status===w}function P(t){return!T(t)}function b(t){return t.status!==l&&t.status!==h&&t.status!==y}function N(t){return!b(t)}function A(t){try{return t.activeWhen(window.location)}catch(n){u(n,t,O)}}function S(t){try{return!t.activeWhen(window.location)}catch(n){u(n,t,O)}}function _(t){return t!==O&&(!t||t.status!==O)}function D(t){return t.status!==y||(new Date).getTime()-t.loadErrorTime>=200}function M(t){return t.name}function U(t){return Boolean(t.unmountThisParcel)}function R(t){return U(t)?"parcel":"application"}function I(){for(var t=arguments.length-1;t>0;t--)for(var n in arguments[t])"__proto__"!==n&&(arguments[t-1][n]=arguments[t][n]);return arguments[0]}function L(t,n){for(var e=0;e<t.length;e++)if(n(t[e]))return t[e];return null}function j(t){return t&&("function"==typeof t||(n=t,Array.isArray(n)&&!L(n,(function(t){return"function"!=typeof t}))));var n}function G(t,n){var e=t[n]||[];0===(e=Array.isArray(e)?e:[e]).length&&(e=[function(){return Promise.resolve()}]);var r=R(t),o=M(t);return function(t){return e.reduce((function(e,i,u){return e.then((function(){var e=i(t);return x(e)?e:Promise.reject(s(15,!1,r,o,n,u))}))}),Promise.resolve())}}function x(t){return t&&"function"==typeof t.then&&"function"==typeof t.catch}function B(t,n){return Promise.resolve().then((function(){return t.status!==m?t:(t.status=p,tt(t,"bootstrap").then((function(){return t.status=d,t})).catch((function(e){if(n)throw f(e,t,O);return u(e,t,O),t})))}))}function C(t,n){return Promise.resolve().then((function(){if(t.status!==w)return t;t.status=E;var e=Object.keys(t.parcels).map((function(n){return t.parcels[n].unmountThisParcel()}));return Promise.all(e).then(r,(function(e){return r().then((function(){var r=Error(e.message);if(n)throw f(r,t,O);u(r,t,O)}))})).then((function(){return t}));function r(){return tt(t,"unmount").then((function(){t.status=d})).catch((function(e){if(n)throw f(e,t,O);u(e,t,O)}))}}))}var K=!1,k=!1;function F(t,n){return Promise.resolve().then((function(){return t.status!==d?t:(K||(window.dispatchEvent(new r("single-spa:before-first-mount")),K=!0),tt(t,"mount").then((function(){return t.status=w,k||(window.dispatchEvent(new r("single-spa:first-mount")),k=!0),t})).catch((function(e){return t.status=w,C(t,!0).then(r,r);function r(){if(n)throw f(e,t,O);return u(e,t,O),t}})))}))}var H=0,J={parcels:{}};function W(){return $.apply(J,arguments)}function $(t,n){var e=this;if(!t||"object"!==o(t)&&"function"!=typeof t)throw Error(s(2,!1));if(t.name&&"string"!=typeof t.name)throw Error(s(3,!1,o(t.name)));if("object"!==o(n))throw Error(s(4,!1,name,o(n)));if(!n.domElement)throw Error(s(5,!1,name));var r,i=H++,u="function"==typeof t,a=u?t:function(){return Promise.resolve(t)},c={id:i,parcels:{},status:u?h:m,customProps:n,parentName:M(e),unmountThisParcel:function(){if(c.status!==w)throw Error(s(6,!1,name,c.status));return C(c,!0).then((function(t){return c.parentName&&delete e.parcels[c.id],t})).then((function(t){return p(t),t})).catch((function(t){throw c.status=O,v(t),t}))}};e.parcels[i]=c;var l=a();if(!l||"function"!=typeof l.then)throw Error(s(7,!1));var p,v,E=(l=l.then((function(t){if(!t)throw Error(s(8,!1));var n=t.name||"parcel-".concat(i);if(!j(t.bootstrap))throw Error(s(9,!1,n));if(!j(t.mount))throw Error(s(10,!1,n));if(!j(t.unmount))throw Error(s(11,!1,n));if(t.update&&!j(t.update))throw Error(s(12,!1,n));var e=G(t,"bootstrap"),o=G(t,"mount"),u=G(t,"unmount");c.status=m,c.name=n,c.bootstrap=e,c.mount=o,c.unmount=u,c.timeouts=nt(t.timeouts),t.update&&(c.update=G(t,"update"),r.update=function(t){return c.customProps=t,Q(function(t){return Promise.resolve().then((function(){if(t.status!==w)throw Error(s(32,!1,M(t)));return t.status=g,tt(t,"update").then((function(){return t.status=w,t})).catch((function(n){throw f(n,t,O)}))}))}(c))})}))).then((function(){return B(c,!0)})),y=E.then((function(){return F(c,!0)})),T=new Promise((function(t,n){p=t,v=n}));return r={mount:function(){return Q(Promise.resolve().then((function(){if(c.status!==d)throw Error(s(13,!1,name,c.status));return e.parcels[i]=c,F(c)})))},unmount:function(){return Q(c.unmountThisParcel())},getStatus:function(){return c.status},loadPromise:Q(l),bootstrapPromise:Q(E),mountPromise:Q(y),unmountPromise:Q(T)}}function Q(t){return t.then((function(){return null}))}function V(t){var e=I({},t.customProps,{name:M(t),mountParcel:$.bind(t),singleSpa:n});return U(t)&&(e.unmountSelf=t.unmountThisParcel),e}var q={bootstrap:{millis:4e3,dieOnTimeout:!1,warningMillis:1e3},mount:{millis:3e3,dieOnTimeout:!1,warningMillis:1e3},unmount:{millis:3e3,dieOnTimeout:!1,warningMillis:1e3},unload:{millis:3e3,dieOnTimeout:!1,warningMillis:1e3},update:{millis:3e3,dieOnTimeout:!1,warningMillis:1e3}};function z(t,n,e){if("number"!=typeof t||t<=0)throw Error(s(16,!1));q.bootstrap={millis:t,dieOnTimeout:n,warningMillis:e||1e3}}function X(t,n,e){if("number"!=typeof t||t<=0)throw Error(s(17,!1));q.mount={millis:t,dieOnTimeout:n,warningMillis:e||1e3}}function Y(t,n,e){if("number"!=typeof t||t<=0)throw Error(s(18,!1));q.unmount={millis:t,dieOnTimeout:n,warningMillis:e||1e3}}function Z(t,n,e){if("number"!=typeof t||t<=0)throw Error(s(19,!1));q.unload={millis:t,dieOnTimeout:n,warningMillis:e||1e3}}function tt(t,n){var e=t.timeouts[n],r=e.warningMillis,o=R(t);return new Promise((function(i,u){var a=!1,c=!1;t[n](V(t)).then((function(t){a=!0,i(t)})).catch((function(t){a=!0,u(t)})),setTimeout((function(){return l(1)}),r),setTimeout((function(){return l(!0)}),e.millis);var f=s(31,!1,n,o,M(t),e.millis);function l(t){if(!a)if(!0===t)c=!0,e.dieOnTimeout?u(Error(f)):console.error(f);else if(!c){var n=t,o=n*r;console.warn(f),o+r<e.millis&&setTimeout((function(){return l(n+1)}),r)}}}))}function nt(t){var n={};for(var e in q)n[e]=I({},q[e],t&&t[e]||{});return n}function et(t){return Promise.resolve().then((function(){return t.loadPromise?t.loadPromise:t.status!==l&&t.status!==y?t:(t.status=h,t.loadPromise=Promise.resolve().then((function(){var r=t.loadImpl(V(t));if(!x(r))throw e=!0,Error(s(33,!1,M(t)));return r.then((function(e){var r;t.loadErrorTime=null,"object"!==o(n=e)&&(r=34),j(n.bootstrap)||(r=35),j(n.mount)||(r=36),j(n.unmount)||(r=37);var i=R(n);if(r){var a;try{a=JSON.stringify(n)}catch(t){}return console.error(s(r,!1,i,M(t),a),n),u(void 0,t,O),t}return n.devtools&&n.devtools.overlays&&(t.devtools.overlays=I({},t.devtools.overlays,n.devtools.overlays)),t.status=m,t.bootstrap=G(n,"bootstrap"),t.mount=G(n,"mount"),t.unmount=G(n,"unmount"),t.unload=G(n,"unload"),t.timeouts=nt(n.timeouts),delete t.loadPromise,t}))})).catch((function(n){var r;return delete t.loadPromise,e?r=O:(r=y,t.loadErrorTime=(new Date).getTime()),u(n,t,r),t})));var n,e}))}var rt,ot={hashchange:[],popstate:[]},it=["hashchange","popstate"];function ut(t){var n;if("string"==typeof t)n=t;else if(this&&this.href)n=this.href;else{if(!(t&&t.currentTarget&&t.currentTarget.href&&t.preventDefault))throw Error(s(14,!1));n=t.currentTarget.href,t.preventDefault()}var e=mt(window.location.href),r=mt(n);0===n.indexOf("#")?window.location.hash=r.hash:e.host!==r.host&&r.host?window.location.href=n:r.pathname===e.pathname&&r.search===e.pathname?window.location.hash=r.hash:window.history.pushState(null,null,n)}function at(t){var n=this;if(t){var e=t[0].type;it.indexOf(e)>=0&&ot[e].forEach((function(e){try{e.apply(n,t)}catch(t){setTimeout((function(){throw t}))}}))}}function ct(){xt([],arguments)}window.addEventListener("hashchange",ct),window.addEventListener("popstate",ct);var st=window.addEventListener,ft=window.removeEventListener;function lt(t){return function(){var n=window.location.href,e=t.apply(this,arguments),r=window.location.href;return rt&&n===r||ct(ht(window.history.state)),e}}function ht(t){try{return new PopStateEvent("popstate",{state:t})}catch(e){var n=document.createEvent("PopStateEvent");return n.initPopStateEvent("popstate",!1,!1,t),n}}function mt(t){var n=document.createElement("a");return n.href=t,n}window.addEventListener=function(t,n){if(!("function"==typeof n&&it.indexOf(t)>=0)||L(ot[t],(function(t){return t===n})))return st.apply(this,arguments);ot[t].push(n)},window.removeEventListener=function(t,n){if(!("function"==typeof n&&it.indexOf(t)>=0))return ft.apply(this,arguments);ot[t]=ot[t].filter((function(t){return t!==n}))},window.history.pushState=lt(window.history.pushState),window.history.replaceState=lt(window.history.replaceState),window.singleSpaNavigate=ut;var pt=!1;function dt(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:window.jQuery;if(t||window.$&&window.$.fn&&window.$.fn.jquery&&(t=window.$),t&&!pt){var n=t.fn.on,e=t.fn.off;t.fn.on=function(t,e){return vt.call(this,n,window.addEventListener,t,e,arguments)},t.fn.off=function(t,n){return vt.call(this,e,window.removeEventListener,t,n,arguments)},pt=!0}}function vt(t,n,e,r,o){return"string"!=typeof e?t.apply(this,o):(e.split(/\s+/).forEach((function(t){it.indexOf(t)>=0&&(n(t,r),e=e.replace(t,""))})),""===e.trim()?this:t.apply(this,o))}var wt={};function gt(t){return Promise.resolve().then((function(){var n=wt[M(t)];return n?t.status===l?(Et(t,n),t):"UNLOADING"===t.status?n.promise.then((function(){return t})):t.status!==d?t:(t.status="UNLOADING",tt(t,"unload").then((function(){return Et(t,n),t})).catch((function(e){return function(t,n,e){delete wt[M(t)],delete t.bootstrap,delete t.mount,delete t.unmount,delete t.unload,u(e,t,O),n.reject(e)}(t,n,e),t}))):t}))}function Et(t,n){delete wt[M(t)],delete t.bootstrap,delete t.mount,delete t.unmount,delete t.unload,t.status=l,n.resolve()}function yt(t,n,e,r){wt[M(t)]={app:t,resolve:e,reject:r},Object.defineProperty(wt[M(t)],"promise",{get:n})}function Ot(t){return wt[t]}function Tt(){return Object.keys(wt).map((function(t){return wt[t].app})).filter(P)}var Pt=[];function bt(){return Pt.filter(T).map(M)}function Nt(){return Pt.map(M)}function At(t){var n=L(Pt,(function(n){return M(n)===t}));return n?n.status:null}function St(t,n,e){var r,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};if("string"!=typeof t||0===t.length)throw Error(s(20,!1));if(-1!==Nt().indexOf(t))throw Error(s(21,!1,t));if("object"!==o(i)||Array.isArray(i))throw Error(s(22,!1));if(!n)throw Error(s(23,!1));if(r="function"!=typeof n?function(){return Promise.resolve(n)}:n,"function"!=typeof e)throw Error(s(24,!1));Pt.push({loadErrorTime:null,name:t,loadImpl:r,activeWhen:e,status:l,parcels:{},devtools:{overlays:{options:{},selectors:[]}},customProps:i}),dt(),xt()}function _t(t){return Pt.filter((function(n){return n.activeWhen(t)})).map(M)}function Dt(){return Pt.filter(_).filter(D).filter(N).filter(A)}function Mt(){return Pt.filter(_).filter(T).filter(S)}function Ut(){return Pt.filter(_).filter(P).filter(b).filter(A)}function Rt(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{waitForUnmount:!1};if("string"!=typeof t)throw Error(s(26,!1));var e=L(Pt,(function(n){return M(n)===t}));if(!e)throw Error(s(27,!1,t));var r,o=Ot(M(e));if(n&&n.waitForUnmount){if(o)return o.promise;var i=new Promise((function(t,n){yt(e,(function(){return i}),t,n)}));return i}return o?(r=o.promise,It(e,o.resolve,o.reject)):r=new Promise((function(t,n){yt(e,(function(){return r}),t,n),It(e,t,n)})),r}function It(t,n,e){C(t).then(gt).then((function(){n(),setTimeout((function(){xt()}))})).catch(e)}var Lt=!1,jt=[];function Gt(){return xt()}function xt(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],n=arguments.length>1?arguments[1]:void 0;if(Lt)return new Promise((function(t,e){jt.push({resolve:t,reject:e,eventArguments:n})}));var e=!0;return Kt()?(Lt=!0,i()):o();function o(){return Promise.resolve().then((function(){var t=Dt().map(et);return t.length>0&&(e=!1),Promise.all(t).then(a).then((function(){return[]})).catch((function(t){throw a(),t}))}))}function i(){return Promise.resolve().then((function(){window.dispatchEvent(new r("single-spa:before-routing-event",c()));var n=Tt().map(gt),o=Mt().map(C).map((function(t){return t.then(gt)})).concat(n);o.length>0&&(e=!1);var i=Promise.all(o),s=Dt(),f=s.map((function(t){return et(t).then(B).then((function(t){return i.then((function(){return F(t)}))}))}));f.length>0&&(e=!1);var l=Ut().filter((function(t){return s.indexOf(t)<0})).map((function(t){return B(t).then((function(){return i})).then((function(){return F(t)}))}));return l.length>0&&(e=!1),i.catch((function(t){throw a(),t})).then((function(){return a(),Promise.all(f.concat(l)).catch((function(n){throw t.forEach((function(t){return t.reject(n)})),n})).then(u)}))}))}function u(){var n=bt();t.forEach((function(t){return t.resolve(n)}));try{var o=e?"single-spa:no-app-change":"single-spa:app-change";window.dispatchEvent(new r(o,c())),window.dispatchEvent(new r("single-spa:routing-event",c()))}catch(t){setTimeout((function(){throw t}))}if(Lt=!1,jt.length>0){var i=jt;jt=[],xt(i)}return n}function a(){t.forEach((function(t){at(t.eventArguments)})),at(n)}function c(){var t={detail:{}};return n&&n[0]&&(t.detail.originalEvent=n[0]),t}}var Bt=!1;function Ct(t){var n;Bt=!0,t&&t.urlRerouteOnly&&(n=t.urlRerouteOnly,rt=n),xt()}function Kt(){return Bt}setTimeout((function(){Bt||console.warn(s(1,!1))}),5e3);var kt={getRawAppData:function(){return[].concat(Pt)},reroute:xt,NOT_LOADED:l,toLoadPromise:et,toBootstrapPromise:B,unregisterApplication:function(t){if(!Pt.find((function(n){return M(n)===t})))throw Error(s(25,!1,t));return Rt(t).then((function(){var n=Pt.findIndex((function(n){return M(n)===t}));Pt.splice(n,1)}))}};window&&window.__SINGLE_SPA_DEVTOOLS__&&(window.__SINGLE_SPA_DEVTOOLS__.exposedMethods=kt)}}})); | ||
//# sourceMappingURL=single-spa.min.js.map |
@@ -1,2 +0,2 @@ | ||
/* single-spa@5.2.0 - UMD - dev */ | ||
/* single-spa@5.2.1 - UMD - dev */ | ||
(function (global, factory) { | ||
@@ -3,0 +3,0 @@ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : |
@@ -1,3 +0,3 @@ | ||
/* single-spa@5.2.0 - UMD - prod */ | ||
/* single-spa@5.2.1 - UMD - prod */ | ||
!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n((t=t||self).singleSpa={})}(this,(function(t){var n=Object.freeze({__proto__:null,get start(){return Ct},get ensureJQuerySupport(){return dt},get setBootstrapMaxTime(){return z},get setMountMaxTime(){return X},get setUnmountMaxTime(){return Y},get setUnloadMaxTime(){return Z},get registerApplication(){return _t},get getMountedApps(){return bt},get getAppStatus(){return At},get unloadApplication(){return Rt},get checkActivityFunctions(){return St},get getAppNames(){return Nt},get navigateToUrl(){return ut},get triggerAppChange(){return xt},get addErrorHandler(){return a},get removeErrorHandler(){return c},get mountRootParcel(){return W},get NOT_LOADED(){return l},get LOADING_SOURCE_CODE(){return h},get NOT_BOOTSTRAPPED(){return p},get BOOTSTRAPPING(){return m},get NOT_MOUNTED(){return d},get MOUNTING(){return v},get UPDATING(){return g},get LOAD_ERROR(){return y},get MOUNTED(){return w},get UNMOUNTING(){return E},get SKIP_BECAUSE_BROKEN(){return O}}),e=("undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{}).CustomEvent,r=function(){try{var t=new e("cat",{detail:{foo:"bar"}});return"cat"===t.type&&"bar"===t.detail.foo}catch(t){}return!1}()?e:"undefined"!=typeof document&&"function"==typeof document.createEvent?function(t,n){var e=document.createEvent("CustomEvent");return n?e.initCustomEvent(t,n.bubbles,n.cancelable,n.detail):e.initCustomEvent(t,!1,!1,void 0),e}:function(t,n){var e=document.createEventObject();return e.type=t,n?(e.bubbles=Boolean(n.bubbles),e.cancelable=Boolean(n.cancelable),e.detail=n.detail):(e.bubbles=!1,e.cancelable=!1,e.detail=void 0),e};function o(t){return(o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var i=[];function u(t,n,e){var r=f(t,n,e);i.length?i.forEach((function(t){return t(r)})):setTimeout((function(){throw r}))}function a(t){if("function"!=typeof t)throw Error(s(28,!1));i.push(t)}function c(t){if("function"!=typeof t)throw Error(s(29,!1));var n=!1;return i=i.filter((function(e){var r=e===t;return n=n||r,!r})),n}function s(t,n){for(var e=arguments.length,r=new Array(e>2?e-2:0),o=2;o<e;o++)r[o-2]=arguments[o];return"single-spa minified message #".concat(t,": ").concat(n?n+" ":"","See https://single-spa.js.org/error/?code=").concat(t).concat(r.length?"&arg=".concat(r.join("&arg=")):"")}function f(t,n,e){var r,o="".concat(R(n)," '").concat(M(n),"' died in status ").concat(n.status,": ");if(t instanceof Error){try{t.message=o+t.message}catch(t){}r=t}else{console.warn(s(30,!1,n.status,M(n)));try{r=Error(o+JSON.stringify(t))}catch(n){r=t}}return r.appOrParcelName=M(n),n.status=e,r}var l="NOT_LOADED",h="LOADING_SOURCE_CODE",p="NOT_BOOTSTRAPPED",m="BOOTSTRAPPING",d="NOT_MOUNTED",v="MOUNTING",w="MOUNTED",g="UPDATING",E="UNMOUNTING",y="LOAD_ERROR",O="SKIP_BECAUSE_BROKEN";function T(t){return t.status===w}function P(t){return!T(t)}function b(t){return t.status!==l&&t.status!==h&&t.status!==y}function N(t){return!b(t)}function A(t){try{return t.activeWhen(window.location)}catch(n){u(n,t,O)}}function _(t){try{return!t.activeWhen(window.location)}catch(n){u(n,t,O)}}function S(t){return t!==O&&(!t||t.status!==O)}function D(t){return t.status!==y||(new Date).getTime()-t.loadErrorTime>=200}function M(t){return t.name}function U(t){return Boolean(t.unmountThisParcel)}function R(t){return U(t)?"parcel":"application"}function I(){for(var t=arguments.length-1;t>0;t--)for(var n in arguments[t])"__proto__"!==n&&(arguments[t-1][n]=arguments[t][n]);return arguments[0]}function L(t,n){for(var e=0;e<t.length;e++)if(n(t[e]))return t[e];return null}function j(t){return t&&("function"==typeof t||(n=t,Array.isArray(n)&&!L(n,(function(t){return"function"!=typeof t}))));var n}function x(t,n){var e=t[n]||[];0===(e=Array.isArray(e)?e:[e]).length&&(e=[function(){return Promise.resolve()}]);var r=R(t),o=M(t);return function(t){return e.reduce((function(e,i,u){return e.then((function(){var e=i(t);return G(e)?e:Promise.reject(s(15,!1,r,o,n,u))}))}),Promise.resolve())}}function G(t){return t&&"function"==typeof t.then&&"function"==typeof t.catch}function B(t,n){return Promise.resolve().then((function(){return t.status!==p?t:(t.status=m,tt(t,"bootstrap").then((function(){return t.status=d,t})).catch((function(e){if(n)throw f(e,t,O);return u(e,t,O),t})))}))}function C(t,n){return Promise.resolve().then((function(){if(t.status!==w)return t;t.status=E;var e=Object.keys(t.parcels).map((function(n){return t.parcels[n].unmountThisParcel()}));return Promise.all(e).then(r,(function(e){return r().then((function(){var r=Error(e.message);if(n)throw f(r,t,O);u(r,t,O)}))})).then((function(){return t}));function r(){return tt(t,"unmount").then((function(){t.status=d})).catch((function(e){if(n)throw f(e,t,O);u(e,t,O)}))}}))}var K=!1,k=!1;function F(t,n){return Promise.resolve().then((function(){return t.status!==d?t:(K||(window.dispatchEvent(new r("single-spa:before-first-mount")),K=!0),tt(t,"mount").then((function(){return t.status=w,k||(window.dispatchEvent(new r("single-spa:first-mount")),k=!0),t})).catch((function(e){return t.status=w,C(t,!0).then(r,r);function r(){if(n)throw f(e,t,O);return u(e,t,O),t}})))}))}var H=0,J={parcels:{}};function W(){return $.apply(J,arguments)}function $(t,n){var e=this;if(!t||"object"!==o(t)&&"function"!=typeof t)throw Error(s(2,!1));if(t.name&&"string"!=typeof t.name)throw Error(s(3,!1,o(t.name)));if("object"!==o(n))throw Error(s(4,!1,name,o(n)));if(!n.domElement)throw Error(s(5,!1,name));var r,i=H++,u="function"==typeof t,a=u?t:function(){return Promise.resolve(t)},c={id:i,parcels:{},status:u?h:p,customProps:n,parentName:M(e),unmountThisParcel:function(){if(c.status!==w)throw Error(s(6,!1,name,c.status));return C(c,!0).then((function(t){return c.parentName&&delete e.parcels[c.id],t})).then((function(t){return m(t),t})).catch((function(t){throw c.status=O,v(t),t}))}};e.parcels[i]=c;var l=a();if(!l||"function"!=typeof l.then)throw Error(s(7,!1));var m,v,E=(l=l.then((function(t){if(!t)throw Error(s(8,!1));var n=t.name||"parcel-".concat(i);if(!j(t.bootstrap))throw Error(s(9,!1,n));if(!j(t.mount))throw Error(s(10,!1,n));if(!j(t.unmount))throw Error(s(11,!1,n));if(t.update&&!j(t.update))throw Error(s(12,!1,n));var e=x(t,"bootstrap"),o=x(t,"mount"),u=x(t,"unmount");c.status=p,c.name=n,c.bootstrap=e,c.mount=o,c.unmount=u,c.timeouts=nt(t.timeouts),t.update&&(c.update=x(t,"update"),r.update=function(t){return c.customProps=t,Q(function(t){return Promise.resolve().then((function(){if(t.status!==w)throw Error(s(32,!1,M(t)));return t.status=g,tt(t,"update").then((function(){return t.status=w,t})).catch((function(n){throw f(n,t,O)}))}))}(c))})}))).then((function(){return B(c,!0)})),y=E.then((function(){return F(c,!0)})),T=new Promise((function(t,n){m=t,v=n}));return r={mount:function(){return Q(Promise.resolve().then((function(){if(c.status!==d)throw Error(s(13,!1,name,c.status));return e.parcels[i]=c,F(c)})))},unmount:function(){return Q(c.unmountThisParcel())},getStatus:function(){return c.status},loadPromise:Q(l),bootstrapPromise:Q(E),mountPromise:Q(y),unmountPromise:Q(T)}}function Q(t){return t.then((function(){return null}))}function V(t){var e=I({},t.customProps,{name:M(t),mountParcel:$.bind(t),singleSpa:n});return U(t)&&(e.unmountSelf=t.unmountThisParcel),e}var q={bootstrap:{millis:4e3,dieOnTimeout:!1,warningMillis:1e3},mount:{millis:3e3,dieOnTimeout:!1,warningMillis:1e3},unmount:{millis:3e3,dieOnTimeout:!1,warningMillis:1e3},unload:{millis:3e3,dieOnTimeout:!1,warningMillis:1e3},update:{millis:3e3,dieOnTimeout:!1,warningMillis:1e3}};function z(t,n,e){if("number"!=typeof t||t<=0)throw Error(s(16,!1));q.bootstrap={millis:t,dieOnTimeout:n,warningMillis:e||1e3}}function X(t,n,e){if("number"!=typeof t||t<=0)throw Error(s(17,!1));q.mount={millis:t,dieOnTimeout:n,warningMillis:e||1e3}}function Y(t,n,e){if("number"!=typeof t||t<=0)throw Error(s(18,!1));q.unmount={millis:t,dieOnTimeout:n,warningMillis:e||1e3}}function Z(t,n,e){if("number"!=typeof t||t<=0)throw Error(s(19,!1));q.unload={millis:t,dieOnTimeout:n,warningMillis:e||1e3}}function tt(t,n){var e=t.timeouts[n],r=e.warningMillis,o=R(t);return new Promise((function(i,u){var a=!1,c=!1;t[n](V(t)).then((function(t){a=!0,i(t)})).catch((function(t){a=!0,u(t)})),setTimeout((function(){return l(1)}),r),setTimeout((function(){return l(!0)}),e.millis);var f=s(31,!1,n,o,M(t),e.millis);function l(t){if(!a)if(!0===t)c=!0,e.dieOnTimeout?u(Error(f)):console.error(f);else if(!c){var n=t,o=n*r;console.warn(f),o+r<e.millis&&setTimeout((function(){return l(n+1)}),r)}}}))}function nt(t){var n={};for(var e in q)n[e]=I({},q[e],t&&t[e]||{});return n}function et(t){return Promise.resolve().then((function(){return t.loadPromise?t.loadPromise:t.status!==l&&t.status!==y?t:(t.status=h,t.loadPromise=Promise.resolve().then((function(){var r=t.loadImpl(V(t));if(!G(r))throw e=!0,Error(s(33,!1,M(t)));return r.then((function(e){var r;t.loadErrorTime=null,"object"!==o(n=e)&&(r=34),j(n.bootstrap)||(r=35),j(n.mount)||(r=36),j(n.unmount)||(r=37);var i=R(n);if(r){var a;try{a=JSON.stringify(n)}catch(t){}return console.error(s(r,!1,i,M(t),a),n),u(void 0,t,O),t}return n.devtools&&n.devtools.overlays&&(t.devtools.overlays=I({},t.devtools.overlays,n.devtools.overlays)),t.status=p,t.bootstrap=x(n,"bootstrap"),t.mount=x(n,"mount"),t.unmount=x(n,"unmount"),t.unload=x(n,"unload"),t.timeouts=nt(n.timeouts),delete t.loadPromise,t}))})).catch((function(n){var r;return delete t.loadPromise,e?r=O:(r=y,t.loadErrorTime=(new Date).getTime()),u(n,t,r),t})));var n,e}))}var rt,ot={hashchange:[],popstate:[]},it=["hashchange","popstate"];function ut(t){var n;if("string"==typeof t)n=t;else if(this&&this.href)n=this.href;else{if(!(t&&t.currentTarget&&t.currentTarget.href&&t.preventDefault))throw Error(s(14,!1));n=t.currentTarget.href,t.preventDefault()}var e=pt(window.location.href),r=pt(n);0===n.indexOf("#")?window.location.hash=r.hash:e.host!==r.host&&r.host?window.location.href=n:r.pathname===e.pathname&&r.search===e.pathname?window.location.hash=r.hash:window.history.pushState(null,null,n)}function at(t){var n=this;if(t){var e=t[0].type;it.indexOf(e)>=0&&ot[e].forEach((function(e){try{e.apply(n,t)}catch(t){setTimeout((function(){throw t}))}}))}}function ct(){Gt([],arguments)}window.addEventListener("hashchange",ct),window.addEventListener("popstate",ct);var st=window.addEventListener,ft=window.removeEventListener;function lt(t){return function(){var n=window.location.href,e=t.apply(this,arguments),r=window.location.href;return rt&&n===r||ct(ht(window.history.state)),e}}function ht(t){try{return new PopStateEvent("popstate",{state:t})}catch(e){var n=document.createEvent("PopStateEvent");return n.initPopStateEvent("popstate",!1,!1,t),n}}function pt(t){var n=document.createElement("a");return n.href=t,n}window.addEventListener=function(t,n){if(!("function"==typeof n&&it.indexOf(t)>=0)||L(ot[t],(function(t){return t===n})))return st.apply(this,arguments);ot[t].push(n)},window.removeEventListener=function(t,n){if(!("function"==typeof n&&it.indexOf(t)>=0))return ft.apply(this,arguments);ot[t]=ot[t].filter((function(t){return t!==n}))},window.history.pushState=lt(window.history.pushState),window.history.replaceState=lt(window.history.replaceState),window.singleSpaNavigate=ut;var mt=!1;function dt(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:window.jQuery;if(t||window.$&&window.$.fn&&window.$.fn.jquery&&(t=window.$),t&&!mt){var n=t.fn.on,e=t.fn.off;t.fn.on=function(t,e){return vt.call(this,n,window.addEventListener,t,e,arguments)},t.fn.off=function(t,n){return vt.call(this,e,window.removeEventListener,t,n,arguments)},mt=!0}}function vt(t,n,e,r,o){return"string"!=typeof e?t.apply(this,o):(e.split(/\s+/).forEach((function(t){it.indexOf(t)>=0&&(n(t,r),e=e.replace(t,""))})),""===e.trim()?this:t.apply(this,o))}var wt={};function gt(t){return Promise.resolve().then((function(){var n=wt[M(t)];return n?t.status===l?(Et(t,n),t):"UNLOADING"===t.status?n.promise.then((function(){return t})):t.status!==d?t:(t.status="UNLOADING",tt(t,"unload").then((function(){return Et(t,n),t})).catch((function(e){return function(t,n,e){delete wt[M(t)],delete t.bootstrap,delete t.mount,delete t.unmount,delete t.unload,u(e,t,O),n.reject(e)}(t,n,e),t}))):t}))}function Et(t,n){delete wt[M(t)],delete t.bootstrap,delete t.mount,delete t.unmount,delete t.unload,t.status=l,n.resolve()}function yt(t,n,e,r){wt[M(t)]={app:t,resolve:e,reject:r},Object.defineProperty(wt[M(t)],"promise",{get:n})}function Ot(t){return wt[t]}function Tt(){return Object.keys(wt).map((function(t){return wt[t].app})).filter(P)}var Pt=[];function bt(){return Pt.filter(T).map(M)}function Nt(){return Pt.map(M)}function At(t){var n=L(Pt,(function(n){return M(n)===t}));return n?n.status:null}function _t(t,n,e){var r,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};if("string"!=typeof t||0===t.length)throw Error(s(20,!1));if(-1!==Nt().indexOf(t))throw Error(s(21,!1,t));if("object"!==o(i)||Array.isArray(i))throw Error(s(22,!1));if(!n)throw Error(s(23,!1));if(r="function"!=typeof n?function(){return Promise.resolve(n)}:n,"function"!=typeof e)throw Error(s(24,!1));Pt.push({loadErrorTime:null,name:t,loadImpl:r,activeWhen:e,status:l,parcels:{},devtools:{overlays:{options:{},selectors:[]}},customProps:i}),dt(),Gt()}function St(t){return Pt.filter((function(n){return n.activeWhen(t)})).map(M)}function Dt(){return Pt.filter(S).filter(D).filter(N).filter(A)}function Mt(){return Pt.filter(S).filter(T).filter(_)}function Ut(){return Pt.filter(S).filter(P).filter(b).filter(A)}function Rt(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{waitForUnmount:!1};if("string"!=typeof t)throw Error(s(26,!1));var e=L(Pt,(function(n){return M(n)===t}));if(!e)throw Error(s(27,!1,t));var r,o=Ot(M(e));if(n&&n.waitForUnmount){if(o)return o.promise;var i=new Promise((function(t,n){yt(e,(function(){return i}),t,n)}));return i}return o?(r=o.promise,It(e,o.resolve,o.reject)):r=new Promise((function(t,n){yt(e,(function(){return r}),t,n),It(e,t,n)})),r}function It(t,n,e){C(t).then(gt).then((function(){n(),setTimeout((function(){Gt()}))})).catch(e)}var Lt=!1,jt=[];function xt(){return Gt()}function Gt(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],n=arguments.length>1?arguments[1]:void 0;if(Lt)return new Promise((function(t,e){jt.push({resolve:t,reject:e,eventArguments:n})}));var e=!0;return Kt()?(Lt=!0,i()):o();function o(){return Promise.resolve().then((function(){var t=Dt().map(et);return t.length>0&&(e=!1),Promise.all(t).then(a).then((function(){return[]})).catch((function(t){throw a(),t}))}))}function i(){return Promise.resolve().then((function(){window.dispatchEvent(new r("single-spa:before-routing-event",c()));var n=Tt().map(gt),o=Mt().map(C).map((function(t){return t.then(gt)})).concat(n);o.length>0&&(e=!1);var i=Promise.all(o),s=Dt(),f=s.map((function(t){return et(t).then(B).then((function(t){return i.then((function(){return F(t)}))}))}));f.length>0&&(e=!1);var l=Ut().filter((function(t){return s.indexOf(t)<0})).map((function(t){return B(t).then((function(){return i})).then((function(){return F(t)}))}));return l.length>0&&(e=!1),i.catch((function(t){throw a(),t})).then((function(){return a(),Promise.all(f.concat(l)).catch((function(n){throw t.forEach((function(t){return t.reject(n)})),n})).then(u)}))}))}function u(){var n=bt();t.forEach((function(t){return t.resolve(n)}));try{var o=e?"single-spa:no-app-change":"single-spa:app-change";window.dispatchEvent(new r(o,c())),window.dispatchEvent(new r("single-spa:routing-event",c()))}catch(t){setTimeout((function(){throw t}))}if(Lt=!1,jt.length>0){var i=jt;jt=[],Gt(i)}return n}function a(){t.forEach((function(t){at(t.eventArguments)})),at(n)}function c(){var t={detail:{}};return n&&n[0]&&(t.detail.originalEvent=n[0]),t}}var Bt=!1;function Ct(t){var n;Bt=!0,t&&t.urlRerouteOnly&&(n=t.urlRerouteOnly,rt=n),Gt()}function Kt(){return Bt}setTimeout((function(){Bt||console.warn(s(1,!1))}),5e3);var kt={getRawAppData:function(){return[].concat(Pt)},reroute:Gt,NOT_LOADED:l,toLoadPromise:et,toBootstrapPromise:B,unregisterApplication:function(t){if(!Pt.find((function(n){return M(n)===t})))throw Error(s(25,!1,t));return Rt(t).then((function(){var n=Pt.findIndex((function(n){return M(n)===t}));Pt.splice(n,1)}))}};window&&window.__SINGLE_SPA_DEVTOOLS__&&(window.__SINGLE_SPA_DEVTOOLS__.exposedMethods=kt),t.BOOTSTRAPPING=m,t.LOADING_SOURCE_CODE=h,t.LOAD_ERROR=y,t.MOUNTED=w,t.MOUNTING=v,t.NOT_BOOTSTRAPPED=p,t.NOT_LOADED=l,t.NOT_MOUNTED=d,t.SKIP_BECAUSE_BROKEN=O,t.UNMOUNTING=E,t.UPDATING=g,t.addErrorHandler=a,t.checkActivityFunctions=St,t.ensureJQuerySupport=dt,t.getAppNames=Nt,t.getAppStatus=At,t.getMountedApps=bt,t.mountRootParcel=W,t.navigateToUrl=ut,t.registerApplication=_t,t.removeErrorHandler=c,t.setBootstrapMaxTime=z,t.setMountMaxTime=X,t.setUnloadMaxTime=Z,t.setUnmountMaxTime=Y,t.start=Ct,t.triggerAppChange=xt,t.unloadApplication=Rt,Object.defineProperty(t,"__esModule",{value:!0})})); | ||
//# sourceMappingURL=single-spa.min.js.map |
{ | ||
"name": "single-spa", | ||
"version": "5.2.0", | ||
"version": "5.2.1", | ||
"description": "Microfrontends made easy", | ||
@@ -5,0 +5,0 @@ "main": "lib/umd/single-spa.min.js", |
@@ -52,4 +52,8 @@ declare module "single-spa" { | ||
type StartOpts = { | ||
urlRerouteOnly?: boolean; | ||
}; | ||
// ./start.js | ||
export function start(): void; | ||
export function start(opts?: StartOpts): void; | ||
export function isStarted(): boolean; | ||
@@ -56,0 +60,0 @@ |
743049
4109