single-spa
Advanced tools
Comparing version 5.0.0-beta.0 to 5.0.0-beta.1
@@ -0,1 +1,2 @@ | ||
/* single-spa@5.0.0-beta.1 - ESM - dev */ | ||
var singleSpa = /*#__PURE__*/Object.freeze({ | ||
@@ -2,0 +3,0 @@ __proto__: null, |
@@ -0,2 +1,3 @@ | ||
/* single-spa@5.0.0-beta.1 - ESM - prod */ | ||
var t=Object.freeze({__proto__:null,get start(){return Rt},get ensureJQuerySupport(){return dt},get setBootstrapMaxTime(){return z},get setMountMaxTime(){return X},get setUnmountMaxTime(){return Y},get setUnloadMaxTime(){return Z},get registerApplication(){return Nt},get getMountedApps(){return Tt},get getAppStatus(){return bt},get unloadApplication(){return St},get checkActivityFunctions(){return _t},get getAppNames(){return Pt},get navigateToUrl(){return it},get triggerAppChange(){return Lt},get addErrorHandler(){return i},get removeErrorHandler(){return a},get mountRootParcel(){return F},get NOT_LOADED(){return l},get LOADING_SOURCE_CODE(){return c},get NOT_BOOTSTRAPPED(){return f},get BOOTSTRAPPING(){return h},get NOT_MOUNTED(){return p},get MOUNTING(){return m},get UPDATING(){return v},get LOAD_ERROR(){return E},get MOUNTED(){return d},get UNMOUNTING(){return w},get SKIP_BECAUSE_BROKEN(){return y}}),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){var r=s(t,e);n.length?n.forEach(t=>t(r)):setTimeout(()=>{throw r})}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){var r,n="".concat(U(e)," '").concat(D(e),"' died in status ").concat(e.status,": ");if(t instanceof Error){try{t.message=n+t.message}catch(t){}r=t}else{console.warn(u(30,!1,e.status,D(e)));try{r=Error(n+JSON.stringify(t))}catch(e){r=t}}return r.appOrParcelName=D(e),r}var l="NOT_LOADED",c="LOADING_SOURCE_CODE",f="NOT_BOOTSTRAPPED",h="BOOTSTRAPPING",p="NOT_MOUNTED",m="MOUNTING",d="MOUNTED",v="UPDATING",w="UNMOUNTING",g="UNLOADING",E="LOAD_ERROR",y="SKIP_BECAUSE_BROKEN";function O(t){return t.status===d}function T(t){return!O(t)}function P(t){return t.status!==l&&t.status!==c&&t.status!==E}function b(t){return!P(t)}function N(t){try{return t.activeWhen(window.location)}catch(e){o(e,t),t.status=y}}function _(t){try{return!t.activeWhen(window.location)}catch(e){o(e,t),t.status=y}}function A(t){return t!==y&&(!t||t.status!==y)}function S(t){return t.status!==E||(new Date).getTime()-t.loadErrorTime>=200}function D(t){return t.name}function M(t){return Boolean(t.unmountThisParcel)}function U(t){return M(t)?"parcel":"application"}function L(){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 j(t,e){for(var r=0;r<t.length;r++)if(e(t[r]))return t[r];return null}function I(t){return t&&("function"==typeof t||(e=t,Array.isArray(e)&&!j(e,t=>"function"!=typeof t)));var e}function R(t,e){var r=t[e]||[];0===(r=Array.isArray(r)?r:[r]).length&&(r=[()=>Promise.resolve()]);var n=U(t),o=D(t);return function(t){return r.reduce((r,i,a)=>r.then(()=>{var r=i(t);return x(r)?r:Promise.reject(u(15,!1,n,o,e,a))}),Promise.resolve())}}function x(t){return t&&"function"==typeof t.then&&"function"==typeof t.catch}function B(t,e){return Promise.resolve().then(()=>t.status!==f?t:(t.status=h,tt(t,"bootstrap").then(()=>(t.status=p,t)).catch(r=>{if(t.status=y,e)throw s(r,t);return o(r,t),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){var i=s(n,t);throw t.status=y,i}o(n,t),t.status=y})).then(()=>t);function n(){return tt(t,"unmount").then(()=>{t.status=p}).catch(r=>{if(e){var n=s(r,t);throw t.status=y,n}o(r,t),t.status=y})}})}var C=!1,K=!1;function W(t,e){return Promise.resolve().then(()=>t.status!==p?t:(C||(window.dispatchEvent(new r("single-spa:before-first-mount")),C=!0),tt(t,"mount").then(()=>(t.status=d,K||(window.dispatchEvent(new r("single-spa:first-mount")),K=!0),t)).catch(r=>{return t.status=d,G(t).then(n,n);function n(){if(e){var n=s(r,t);throw t.status=y,n}return o(r,t),t.status=y,t}})))}var $=0,k={parcels:{}};function F(){return J.apply(k,arguments)}function J(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=$++,i="function"==typeof t,a=i?t:()=>Promise.resolve(t),l={id:o,parcels:{},status:i?c:f,customProps:e,parentName:D(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=>(m(t),t)).catch(t=>{throw l.status=y,w(t),t})}};r.parcels[o]=l;var h=a();if(!h||"function"!=typeof h.then)throw Error(u(7,!1));var m,w,g=(h=h.then(t=>{if(!t)throw Error(u(8,!1));var e=t.name||"parcel-".concat(o);if(!I(t.bootstrap))throw Error(u(9,!1,e));if(!I(t.mount))throw Error(u(10,!1,e));if(!I(t.unmount))throw Error(u(11,!1,e));if(t.update&&!I(t.update))throw Error(u(12,!1,e));var r=R(t,"bootstrap"),i=R(t,"mount"),a=R(t,"unmount");l.status=f,l.name=e,l.bootstrap=r,l.mount=i,l.unmount=a,l.timeouts=et(t.timeouts),t.update&&(l.update=R(t,"update"),n.update=function(t){return l.customProps=t,H(function(t){return Promise.resolve().then(()=>{if(t.status!==d)throw Error(u(32,!1,D(t)));return t.status=v,tt(t,"update").then(()=>(t.status=d,t)).catch(e=>{var r=s(e,t);throw t.status=y,r})})}(l))})})).then(()=>B(l,!0)),E=g.then(()=>W(l,!0)),O=new Promise((t,e)=>{m=t,w=e});return n={mount:()=>H(Promise.resolve().then(()=>{if(l.status!==p)throw Error(u(13,!1,name,l.status));return r.parcels[o]=l,W(l)})),unmount:()=>H(l.unmountThisParcel()),getStatus:()=>l.status,loadPromise:H(h),bootstrapPromise:H(g),mountPromise:H(E),unmountPromise:H(O)}}function H(t){return t.then(()=>null)}function Q(e){var r=L({},e.customProps,{name:D(e),mountParcel:J.bind(e),singleSpa:t});return M(e)&&(r.unmountSelf=e.unmountThisParcel),r}var V=1e3,q={bootstrap:{millis:4e3,dieOnTimeout:!1,warningMillis:V},mount:{millis:3e3,dieOnTimeout:!1,warningMillis:V},unmount:{millis:3e3,dieOnTimeout:!1,warningMillis:V},unload:{millis:3e3,dieOnTimeout:!1,warningMillis:V},update:{millis:3e3,dieOnTimeout:!1,warningMillis:V}};function z(t,e,r){if("number"!=typeof t||t<=0)throw Error(u(16,!1));q.bootstrap={millis:t,dieOnTimeout:e,warningMillis:r||V}}function X(t,e,r){if("number"!=typeof t||t<=0)throw Error(u(17,!1));q.mount={millis:t,dieOnTimeout:e,warningMillis:r||V}}function Y(t,e,r){if("number"!=typeof t||t<=0)throw Error(u(18,!1));q.unmount={millis:t,dieOnTimeout:e,warningMillis:r||V}}function Z(t,e,r){if("number"!=typeof t||t<=0)throw Error(u(19,!1));q.unload={millis:t,dieOnTimeout:e,warningMillis:r||V}}function tt(t,e){var r=t.timeouts[e],n=r.warningMillis,o=U(t);return new Promise((i,a)=>{var s=!1,l=!1;t[e](Q(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,D(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 et(t){var e={};for(var r in q)e[r]=L({},q[r],t&&t[r]||{});return e}function rt(t){return Promise.resolve().then(()=>{return t.status!==l&&t.status!==E?t:(t.status=c,Promise.resolve().then(()=>{var n=t.loadImpl(Q(t));if(!x(n))throw r=!0,Error(u(33,!1,D(t)));return n.then(r=>{var n;t.loadErrorTime=null,"object"!=typeof(e=r)&&(n=34),I(e.bootstrap)||(n=35),I(e.mount)||(n=36),I(e.unmount)||(n=37);var i=U(e);if(n){var a;try{a=JSON.stringify(e)}catch(t){}return console.error(u(n,!1,i,D(t),a),e),o(void 0,t),t.status=y,t}return e.devtools&&e.devtools.overlays&&(t.devtools.overlays=L({},t.devtools.overlays,e.devtools.overlays)),t.status=f,t.bootstrap=R(e,"bootstrap"),t.mount=R(e,"mount"),t.unmount=R(e,"unmount"),t.unload=R(e,"unload"),t.timeouts=et(e.timeouts),t})}).catch(e=>(o(e,t),r?t.status=y:(t.status=E,t.loadErrorTime=(new Date).getTime()),t)));var e,r})}var nt={hashchange:[],popstate:[]},ot=["hashchange","popstate"];function it(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=pt(window.location.href),n=pt(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 at(t){if(t){var e=t[0].type;ot.indexOf(e)>=0&&nt[e].forEach(e=>{e.apply(this,t)})}}function ut(){jt([],arguments)}window.addEventListener("hashchange",ut),window.addEventListener("popstate",ut);var st=window.addEventListener,lt=window.removeEventListener;window.addEventListener=function(t,e){if(!("function"==typeof e&&ot.indexOf(t)>=0)||j(nt[t],t=>t===e))return st.apply(this,arguments);nt[t].push(e)},window.removeEventListener=function(t,e){if(!("function"==typeof e&&ot.indexOf(t)>=0))return lt.apply(this,arguments);nt[t]=nt[t].filter(t=>t!==e)};var ct=window.history.pushState;window.history.pushState=function(t){var e=ct.apply(this,arguments);return ut(ht(t)),e};var ft=window.history.replaceState;function ht(t){try{return new PopStateEvent("popstate",{state:t})}catch(r){var e=document.createEvent("PopStateEvent");return e.initPopStateEvent("popstate",!1,!1,t),e}}function pt(t){var e=document.createElement("a");return e.href=t,e}window.history.replaceState=function(t){var e=ft.apply(this,arguments);return ut(ht(t)),e},window.singleSpaNavigate=it;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 e=t.fn.on,r=t.fn.off;t.fn.on=function(t,r){return vt.call(this,e,window.addEventListener,t,r,arguments)},t.fn.off=function(t,e){return vt.call(this,r,window.removeEventListener,t,e,arguments)},mt=!0}}function vt(t,e,r,n,o){return"string"!=typeof r?t.apply(this,o):(r.split(/\s+/).forEach(t=>{ot.indexOf(t)>=0&&(e(t,n),r=r.replace(t,""))}),""===r.trim()?this:t.apply(this,o))}var wt={};function gt(t){return Promise.resolve().then(()=>{var e=wt[D(t)];return e?t.status===l?(Et(t,e),t):t.status===g?e.promise.then(()=>t):t.status!==p?t:(t.status=g,tt(t,"unload").then(()=>(Et(t,e),t)).catch(r=>(function(t,e,r){delete wt[D(t)],delete t.bootstrap,delete t.mount,delete t.unmount,delete t.unload,o(r,t),t.status=y,e.reject(r)}(t,e,r),t))):t})}function Et(t,e){delete wt[D(t)],delete t.bootstrap,delete t.mount,delete t.unmount,delete t.unload,t.status=l,e.resolve()}function yt(t,e,r,n){wt[D(t)]={app:t,resolve:r,reject:n},Object.defineProperty(wt[D(t)],"promise",{get:e})}var Ot=[];function Tt(){return Ot.filter(O).map(D)}function Pt(){return Ot.map(D)}function bt(t){var e=j(Ot,e=>D(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}),dt(),jt()}function _t(t){return Ot.filter(e=>e.activeWhen(t)).map(D)}function At(){return Ot.filter(A).filter(S).filter(b).filter(N)}function St(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=j(Ot,e=>D(e)===t);if(!r)throw Error(u(27,!1,t));var n,o=function(t){return wt[t]}(D(r));if(e&&e.waitForUnmount){if(o)return o.promise;var i=new Promise((t,e)=>{yt(r,()=>i,t,e)});return i}return o?(n=o.promise,Dt(r,o.resolve,o.reject)):n=new Promise((t,e)=>{yt(r,()=>n,t,e),Dt(r,t,e)}),n}function Dt(t,e,r){G(t).then(gt).then(()=>{e(),setTimeout(()=>{jt()})}).catch(r)}var Mt=!1,Ut=[];function Lt(){return jt()}function jt(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1?arguments[1]:void 0;if(Mt)return new Promise((t,r)=>{Ut.push({resolve:t,reject:r,eventArguments:e})});Mt=!0;var n=!0;return It?Promise.resolve().then(()=>{window.dispatchEvent(new r("single-spa:before-routing-event",a()));var e=Object.keys(wt).map(t=>wt[t].app).filter(T).map(gt),u=Ot.filter(A).filter(O).filter(_).map(G).map(t=>t.then(gt)).concat(e);u.length>0&&(n=!1);var s=Promise.all(u),l=At(),c=l.map(t=>rt(t).then(B).then(t=>s.then(()=>W(t))));c.length>0&&(n=!1);var f=Ot.filter(A).filter(T).filter(P).filter(N).filter(t=>l.indexOf(t)<0).map(t=>B(t).then(()=>s).then(()=>W(t)));return f.length>0&&(n=!1),s.catch(t=>{throw i(),t}).then(()=>(i(),Promise.all(c.concat(f)).catch(e=>{throw t.forEach(t=>t.reject(e)),e}).then(()=>o(!1))))}):Promise.resolve().then(()=>{var t=At().map(rt);return t.length>0&&(n=!1),Promise.all(t).then(o).catch(t=>{throw i(),t})});function o(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],o=Tt();e&&i(),t.forEach(t=>t.resolve(o));try{var u=n?"single-spa:no-app-change":"single-spa:app-change";window.dispatchEvent(new r(u,a())),window.dispatchEvent(new r("single-spa:routing-event",a()))}catch(t){setTimeout(()=>{throw t})}if(Mt=!1,Ut.length>0){var s=Ut;Ut=[],jt(s)}return o}function i(){t.forEach(t=>{at(t.eventArguments)}),at(e)}function a(){var t={detail:{}};return e&&e[0]&&(t.detail.originalEvent=e[0]),t}}var It=!1;function Rt(){It=!0,jt()}setTimeout(()=>{It||console.warn(u(1,!1))},5e3);var xt={getRawAppData:function(){return[...Ot]},reroute:jt,NOT_LOADED:l,toLoadPromise:rt,toBootstrapPromise:B,unregisterApplication:function(t){if(!Ot.find(e=>D(e)===t))throw Error(u(25,!1,t));return St(t).then(()=>{var e=Ot.findIndex(e=>D(e)===t);Ot.splice(e,1)})}};window&&window.__SINGLE_SPA_DEVTOOLS__&&(window.__SINGLE_SPA_DEVTOOLS__.exposedMethods=xt);export{h as BOOTSTRAPPING,c as LOADING_SOURCE_CODE,E as LOAD_ERROR,d as MOUNTED,m as MOUNTING,f as NOT_BOOTSTRAPPED,l as NOT_LOADED,p as NOT_MOUNTED,y as SKIP_BECAUSE_BROKEN,w as UNMOUNTING,v as UPDATING,i as addErrorHandler,_t as checkActivityFunctions,dt as ensureJQuerySupport,Pt as getAppNames,bt as getAppStatus,Tt as getMountedApps,F as mountRootParcel,it as navigateToUrl,Nt as registerApplication,a as removeErrorHandler,z as setBootstrapMaxTime,X as setMountMaxTime,Z as setUnloadMaxTime,Y as setUnmountMaxTime,Rt as start,Lt as triggerAppChange,St as unloadApplication}; | ||
//# sourceMappingURL=single-spa.min.js.map |
@@ -0,1 +1,2 @@ | ||
/* single-spa@5.0.0-beta.1 - SystemJS - dev */ | ||
System.register([], function (exports) { | ||
@@ -2,0 +3,0 @@ 'use strict'; |
@@ -0,2 +1,3 @@ | ||
/* single-spa@5.0.0-beta.1 - SystemJS - prod */ | ||
System.register([],(function(t){"use strict";return{execute:function(){t({addErrorHandler:a,checkActivityFunctions:_t,ensureJQuerySupport:wt,getAppNames:Nt,getAppStatus:At,getMountedApps:bt,mountRootParcel:$,navigateToUrl:at,registerApplication:St,removeErrorHandler:s,setBootstrapMaxTime:Y,setMountMaxTime:Z,setUnloadMaxTime:nt,setUnmountMaxTime:tt,start:Bt,triggerAppChange:Rt,unloadApplication:Mt});var n=Object.freeze({__proto__:null,get start(){return Bt},get ensureJQuerySupport(){return wt},get setBootstrapMaxTime(){return Y},get setMountMaxTime(){return Z},get setUnmountMaxTime(){return tt},get setUnloadMaxTime(){return nt},get registerApplication(){return St},get getMountedApps(){return bt},get getAppStatus(){return At},get unloadApplication(){return Mt},get checkActivityFunctions(){return _t},get getAppNames(){return Nt},get navigateToUrl(){return at},get triggerAppChange(){return Rt},get addErrorHandler(){return a},get removeErrorHandler(){return s},get mountRootParcel(){return $},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 O},get MOUNTED(){return w},get UNMOUNTING(){return E},get SKIP_BECAUSE_BROKEN(){return T}}),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){var e=f(t,n);i.length?i.forEach((function(t){return t(e)})):setTimeout((function(){throw e}))}function a(t){if("function"!=typeof t)throw Error(c(28,!1));i.push(t)}function s(t){if("function"!=typeof t)throw Error(c(29,!1));var n=!1;return i=i.filter((function(e){var r=e===t;return n=n||r,!r})),n}function c(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){var e,r="".concat(L(n)," '").concat(U(n),"' died in status ").concat(n.status,": ");if(t instanceof Error){try{t.message=r+t.message}catch(t){}e=t}else{console.warn(c(30,!1,n.status,U(n)));try{e=Error(r+JSON.stringify(t))}catch(n){e=t}}return e.appOrParcelName=U(n),e}var l=t("NOT_LOADED","NOT_LOADED"),h=t("LOADING_SOURCE_CODE","LOADING_SOURCE_CODE"),p=t("NOT_BOOTSTRAPPED","NOT_BOOTSTRAPPED"),m=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="UNLOADING",O=t("LOAD_ERROR","LOAD_ERROR"),T=t("SKIP_BECAUSE_BROKEN","SKIP_BECAUSE_BROKEN");function P(t){return t.status===w}function b(t){return!P(t)}function N(t){return t.status!==l&&t.status!==h&&t.status!==O}function A(t){return!N(t)}function S(t){try{return t.activeWhen(window.location)}catch(n){u(n,t),t.status=T}}function _(t){try{return!t.activeWhen(window.location)}catch(n){u(n,t),t.status=T}}function D(t){return t!==T&&(!t||t.status!==T)}function M(t){return t.status!==O||(new Date).getTime()-t.loadErrorTime>=200}function U(t){return t.name}function I(t){return Boolean(t.unmountThisParcel)}function L(t){return I(t)?"parcel":"application"}function R(){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 j(t,n){for(var e=0;e<t.length;e++)if(n(t[e]))return t[e];return null}function x(t){return t&&("function"==typeof t||(n=t,Array.isArray(n)&&!j(n,(function(t){return"function"!=typeof t}))));var n}function B(t,n){var e=t[n]||[];0===(e=Array.isArray(e)?e:[e]).length&&(e=[function(){return Promise.resolve()}]);var r=L(t),o=U(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(c(15,!1,r,o,n,u))}))}),Promise.resolve())}}function G(t){return t&&"function"==typeof t.then&&"function"==typeof t.catch}function C(t,n){return Promise.resolve().then((function(){return t.status!==p?t:(t.status=m,et(t,"bootstrap").then((function(){return t.status=d,t})).catch((function(e){if(t.status=T,n)throw f(e,t);return u(e,t),t})))}))}function K(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){var o=f(r,t);throw t.status=T,o}u(r,t),t.status=T}))})).then((function(){return t}));function r(){return et(t,"unmount").then((function(){t.status=d})).catch((function(e){if(n){var r=f(e,t);throw t.status=T,r}u(e,t),t.status=T}))}}))}var k=!1,F=!1;function H(t,n){return Promise.resolve().then((function(){return t.status!==d?t:(k||(window.dispatchEvent(new r("single-spa:before-first-mount")),k=!0),et(t,"mount").then((function(){return t.status=w,F||(window.dispatchEvent(new r("single-spa:first-mount")),F=!0),t})).catch((function(e){return t.status=w,K(t).then(r,r);function r(){if(n){var r=f(e,t);throw t.status=T,r}return u(e,t),t.status=T,t}})))}))}var J=0,W={parcels:{}};function $(){return Q.apply(W,arguments)}function Q(t,n){var e=this;if(!t||"object"!==o(t)&&"function"!=typeof t)throw Error(c(2,!1));if(t.name&&"string"!=typeof t.name)throw Error(c(3,!1,o(t.name)));if("object"!==o(n))throw Error(c(4,!1,name,o(n)));if(!n.domElement)throw Error(c(5,!1,name));var r,i=J++,u="function"==typeof t,a=u?t:function(){return Promise.resolve(t)},s={id:i,parcels:{},status:u?h:p,customProps:n,parentName:U(e),unmountThisParcel:function(){if(s.status!==w)throw Error(c(6,!1,name,s.status));return K(s,!0).then((function(t){return s.parentName&&delete e.parcels[s.id],t})).then((function(t){return m(t),t})).catch((function(t){throw s.status=T,v(t),t}))}};e.parcels[i]=s;var l=a();if(!l||"function"!=typeof l.then)throw Error(c(7,!1));var m,v,E=(l=l.then((function(t){if(!t)throw Error(c(8,!1));var n=t.name||"parcel-".concat(i);if(!x(t.bootstrap))throw Error(c(9,!1,n));if(!x(t.mount))throw Error(c(10,!1,n));if(!x(t.unmount))throw Error(c(11,!1,n));if(t.update&&!x(t.update))throw Error(c(12,!1,n));var e=B(t,"bootstrap"),o=B(t,"mount"),u=B(t,"unmount");s.status=p,s.name=n,s.bootstrap=e,s.mount=o,s.unmount=u,s.timeouts=rt(t.timeouts),t.update&&(s.update=B(t,"update"),r.update=function(t){return s.customProps=t,V(function(t){return Promise.resolve().then((function(){if(t.status!==w)throw Error(c(32,!1,U(t)));return t.status=g,et(t,"update").then((function(){return t.status=w,t})).catch((function(n){var e=f(n,t);throw t.status=T,e}))}))}(s))})}))).then((function(){return C(s,!0)})),y=E.then((function(){return H(s,!0)})),O=new Promise((function(t,n){m=t,v=n}));return r={mount:function(){return V(Promise.resolve().then((function(){if(s.status!==d)throw Error(c(13,!1,name,s.status));return e.parcels[i]=s,H(s)})))},unmount:function(){return V(s.unmountThisParcel())},getStatus:function(){return s.status},loadPromise:V(l),bootstrapPromise:V(E),mountPromise:V(y),unmountPromise:V(O)}}function V(t){return t.then((function(){return null}))}function q(t){var e=R({},t.customProps,{name:U(t),mountParcel:Q.bind(t),singleSpa:n});return I(t)&&(e.unmountSelf=t.unmountThisParcel),e}var z=1e3,X={bootstrap:{millis:4e3,dieOnTimeout:!1,warningMillis:z},mount:{millis:3e3,dieOnTimeout:!1,warningMillis:z},unmount:{millis:3e3,dieOnTimeout:!1,warningMillis:z},unload:{millis:3e3,dieOnTimeout:!1,warningMillis:z},update:{millis:3e3,dieOnTimeout:!1,warningMillis:z}};function Y(t,n,e){if("number"!=typeof t||t<=0)throw Error(c(16,!1));X.bootstrap={millis:t,dieOnTimeout:n,warningMillis:e||z}}function Z(t,n,e){if("number"!=typeof t||t<=0)throw Error(c(17,!1));X.mount={millis:t,dieOnTimeout:n,warningMillis:e||z}}function tt(t,n,e){if("number"!=typeof t||t<=0)throw Error(c(18,!1));X.unmount={millis:t,dieOnTimeout:n,warningMillis:e||z}}function nt(t,n,e){if("number"!=typeof t||t<=0)throw Error(c(19,!1));X.unload={millis:t,dieOnTimeout:n,warningMillis:e||z}}function et(t,n){var e=t.timeouts[n],r=e.warningMillis,o=L(t);return new Promise((function(i,u){var a=!1,s=!1;t[n](q(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=c(31,!1,n,o,U(t),e.millis);function l(t){if(!a)if(!0===t)s=!0,e.dieOnTimeout?u(Error(f)):console.error(f);else if(!s){var n=t,o=n*r;console.warn(f),o+r<e.millis&&setTimeout((function(){return l(n+1)}),r)}}}))}function rt(t){var n={};for(var e in X)n[e]=R({},X[e],t&&t[e]||{});return n}function ot(t){return Promise.resolve().then((function(){return t.status!==l&&t.status!==O?t:(t.status=h,Promise.resolve().then((function(){var r=t.loadImpl(q(t));if(!G(r))throw e=!0,Error(c(33,!1,U(t)));return r.then((function(e){var r;t.loadErrorTime=null,"object"!==o(n=e)&&(r=34),x(n.bootstrap)||(r=35),x(n.mount)||(r=36),x(n.unmount)||(r=37);var i=L(n);if(r){var a;try{a=JSON.stringify(n)}catch(t){}return console.error(c(r,!1,i,U(t),a),n),u(void 0,t),t.status=T,t}return n.devtools&&n.devtools.overlays&&(t.devtools.overlays=R({},t.devtools.overlays,n.devtools.overlays)),t.status=p,t.bootstrap=B(n,"bootstrap"),t.mount=B(n,"mount"),t.unmount=B(n,"unmount"),t.unload=B(n,"unload"),t.timeouts=rt(n.timeouts),t}))})).catch((function(n){return u(n,t),e?t.status=T:(t.status=O,t.loadErrorTime=(new Date).getTime()),t})));var n,e}))}var it={hashchange:[],popstate:[]},ut=["hashchange","popstate"];function at(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(c(14,!1));n=t.currentTarget.href,t.preventDefault()}var e=dt(window.location.href),r=dt(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 st(t){var n=this;if(t){var e=t[0].type;ut.indexOf(e)>=0&&it[e].forEach((function(e){e.apply(n,t)}))}}function ct(){jt([],arguments)}window.addEventListener("hashchange",ct),window.addEventListener("popstate",ct);var ft=window.addEventListener,lt=window.removeEventListener;window.addEventListener=function(t,n){if(!("function"==typeof n&&ut.indexOf(t)>=0)||j(it[t],(function(t){return t===n})))return ft.apply(this,arguments);it[t].push(n)},window.removeEventListener=function(t,n){if(!("function"==typeof n&&ut.indexOf(t)>=0))return lt.apply(this,arguments);it[t]=it[t].filter((function(t){return t!==n}))};var ht=window.history.pushState;window.history.pushState=function(t){var n=ht.apply(this,arguments);return ct(mt(t)),n};var pt=window.history.replaceState;function mt(t){try{return new PopStateEvent("popstate",{state:t})}catch(e){var n=document.createEvent("PopStateEvent");return n.initPopStateEvent("popstate",!1,!1,t),n}}function dt(t){var n=document.createElement("a");return n.href=t,n}window.history.replaceState=function(t){var n=pt.apply(this,arguments);return ct(mt(t)),n},window.singleSpaNavigate=at;var vt=!1;function wt(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:window.jQuery;if(t||window.$&&window.$.fn&&window.$.fn.jquery&&(t=window.$),t&&!vt){var n=t.fn.on,e=t.fn.off;t.fn.on=function(t,e){return gt.call(this,n,window.addEventListener,t,e,arguments)},t.fn.off=function(t,n){return gt.call(this,e,window.removeEventListener,t,n,arguments)},vt=!0}}function gt(t,n,e,r,o){return"string"!=typeof e?t.apply(this,o):(e.split(/\s+/).forEach((function(t){ut.indexOf(t)>=0&&(n(t,r),e=e.replace(t,""))})),""===e.trim()?this:t.apply(this,o))}var Et={};function yt(t){return Promise.resolve().then((function(){var n=Et[U(t)];return n?t.status===l?(Ot(t,n),t):t.status===y?n.promise.then((function(){return t})):t.status!==d?t:(t.status=y,et(t,"unload").then((function(){return Ot(t,n),t})).catch((function(e){return function(t,n,e){delete Et[U(t)],delete t.bootstrap,delete t.mount,delete t.unmount,delete t.unload,u(e,t),t.status=T,n.reject(e)}(t,n,e),t}))):t}))}function Ot(t,n){delete Et[U(t)],delete t.bootstrap,delete t.mount,delete t.unmount,delete t.unload,t.status=l,n.resolve()}function Tt(t,n,e,r){Et[U(t)]={app:t,resolve:e,reject:r},Object.defineProperty(Et[U(t)],"promise",{get:n})}var Pt=[];function bt(){return Pt.filter(P).map(U)}function Nt(){return Pt.map(U)}function At(t){var n=j(Pt,(function(n){return U(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(c(20,!1));if(-1!==Nt().indexOf(t))throw Error(c(21,!1,t));if("object"!==o(i)||Array.isArray(i))throw Error(c(22,!1));if(!n)throw Error(c(23,!1));if(r="function"!=typeof n?function(){return Promise.resolve(n)}:n,"function"!=typeof e)throw Error(c(24,!1));Pt.push({loadErrorTime:null,name:t,loadImpl:r,activeWhen:e,status:l,parcels:{},devtools:{overlays:{options:{},selectors:[]}},customProps:i}),wt(),jt()}function _t(t){return Pt.filter((function(n){return n.activeWhen(t)})).map(U)}function Dt(){return Pt.filter(D).filter(M).filter(A).filter(S)}function Mt(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{waitForUnmount:!1};if("string"!=typeof t)throw Error(c(26,!1));var e=j(Pt,(function(n){return U(n)===t}));if(!e)throw Error(c(27,!1,t));var r,o=function(t){return Et[t]}(U(e));if(n&&n.waitForUnmount){if(o)return o.promise;var i=new Promise((function(t,n){Tt(e,(function(){return i}),t,n)}));return i}return o?(r=o.promise,Ut(e,o.resolve,o.reject)):r=new Promise((function(t,n){Tt(e,(function(){return r}),t,n),Ut(e,t,n)})),r}function Ut(t,n,e){K(t).then(yt).then((function(){n(),setTimeout((function(){jt()}))})).catch(e)}var It=!1,Lt=[];function Rt(){return jt()}function jt(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],n=arguments.length>1?arguments[1]:void 0;if(It)return new Promise((function(t,e){Lt.push({resolve:t,reject:e,eventArguments:n})}));It=!0;var e=!0;return xt?Promise.resolve().then((function(){window.dispatchEvent(new r("single-spa:before-routing-event",u()));var n=Object.keys(Et).map((function(t){return Et[t].app})).filter(b).map(yt),a=Pt.filter(D).filter(P).filter(_).map(K).map((function(t){return t.then(yt)})).concat(n);a.length>0&&(e=!1);var s=Promise.all(a),c=Dt(),f=c.map((function(t){return ot(t).then(C).then((function(t){return s.then((function(){return H(t)}))}))}));f.length>0&&(e=!1);var l=Pt.filter(D).filter(b).filter(N).filter(S).filter((function(t){return c.indexOf(t)<0})).map((function(t){return C(t).then((function(){return s})).then((function(){return H(t)}))}));return l.length>0&&(e=!1),s.catch((function(t){throw i(),t})).then((function(){return i(),Promise.all(f.concat(l)).catch((function(n){throw t.forEach((function(t){return t.reject(n)})),n})).then((function(){return o(!1)}))}))})):Promise.resolve().then((function(){var t=Dt().map(ot);return t.length>0&&(e=!1),Promise.all(t).then(o).catch((function(t){throw i(),t}))}));function o(){var n=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],o=bt();n&&i(),t.forEach((function(t){return t.resolve(o)}));try{var a=e?"single-spa:no-app-change":"single-spa:app-change";window.dispatchEvent(new r(a,u())),window.dispatchEvent(new r("single-spa:routing-event",u()))}catch(t){setTimeout((function(){throw t}))}if(It=!1,Lt.length>0){var s=Lt;Lt=[],jt(s)}return o}function i(){t.forEach((function(t){st(t.eventArguments)})),st(n)}function u(){var t={detail:{}};return n&&n[0]&&(t.detail.originalEvent=n[0]),t}}var xt=!1;function Bt(){xt=!0,jt()}setTimeout((function(){xt||console.warn(c(1,!1))}),5e3);var Gt={getRawAppData:function(){return[].concat(Pt)},reroute:jt,NOT_LOADED:l,toLoadPromise:ot,toBootstrapPromise:C,unregisterApplication:function(t){if(!Pt.find((function(n){return U(n)===t})))throw Error(c(25,!1,t));return Mt(t).then((function(){var n=Pt.findIndex((function(n){return U(n)===t}));Pt.splice(n,1)}))}};window&&window.__SINGLE_SPA_DEVTOOLS__&&(window.__SINGLE_SPA_DEVTOOLS__.exposedMethods=Gt)}}})); | ||
//# sourceMappingURL=single-spa.min.js.map |
@@ -0,1 +1,2 @@ | ||
/* single-spa@5.0.0-beta.1 - UMD - dev */ | ||
(function (global, factory) { | ||
@@ -2,0 +3,0 @@ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : |
@@ -0,2 +1,3 @@ | ||
/* single-spa@5.0.0-beta.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){"use strict";var n=Object.freeze({__proto__:null,get start(){return Bt},get ensureJQuerySupport(){return wt},get setBootstrapMaxTime(){return Y},get setMountMaxTime(){return Z},get setUnmountMaxTime(){return tt},get setUnloadMaxTime(){return nt},get registerApplication(){return _t},get getMountedApps(){return bt},get getAppStatus(){return At},get unloadApplication(){return Mt},get checkActivityFunctions(){return St},get getAppNames(){return Nt},get navigateToUrl(){return at},get triggerAppChange(){return Rt},get addErrorHandler(){return a},get removeErrorHandler(){return s},get mountRootParcel(){return $},get NOT_LOADED(){return l},get LOADING_SOURCE_CODE(){return p},get NOT_BOOTSTRAPPED(){return h},get BOOTSTRAPPING(){return m},get NOT_MOUNTED(){return d},get MOUNTING(){return v},get UPDATING(){return g},get LOAD_ERROR(){return O},get MOUNTED(){return w},get UNMOUNTING(){return E},get SKIP_BECAUSE_BROKEN(){return T}}),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){var e=f(t,n);i.length?i.forEach((function(t){return t(e)})):setTimeout((function(){throw e}))}function a(t){if("function"!=typeof t)throw Error(c(28,!1));i.push(t)}function s(t){if("function"!=typeof t)throw Error(c(29,!1));var n=!1;return i=i.filter((function(e){var r=e===t;return n=n||r,!r})),n}function c(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){var e,r="".concat(L(n)," '").concat(U(n),"' died in status ").concat(n.status,": ");if(t instanceof Error){try{t.message=r+t.message}catch(t){}e=t}else{console.warn(c(30,!1,n.status,U(n)));try{e=Error(r+JSON.stringify(t))}catch(n){e=t}}return e.appOrParcelName=U(n),e}var l="NOT_LOADED",p="LOADING_SOURCE_CODE",h="NOT_BOOTSTRAPPED",m="BOOTSTRAPPING",d="NOT_MOUNTED",v="MOUNTING",w="MOUNTED",g="UPDATING",E="UNMOUNTING",y="UNLOADING",O="LOAD_ERROR",T="SKIP_BECAUSE_BROKEN";function P(t){return t.status===w}function b(t){return!P(t)}function N(t){return t.status!==l&&t.status!==p&&t.status!==O}function A(t){return!N(t)}function _(t){try{return t.activeWhen(window.location)}catch(n){u(n,t),t.status=T}}function S(t){try{return!t.activeWhen(window.location)}catch(n){u(n,t),t.status=T}}function D(t){return t!==T&&(!t||t.status!==T)}function M(t){return t.status!==O||(new Date).getTime()-t.loadErrorTime>=200}function U(t){return t.name}function I(t){return Boolean(t.unmountThisParcel)}function L(t){return I(t)?"parcel":"application"}function R(){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 j(t,n){for(var e=0;e<t.length;e++)if(n(t[e]))return t[e];return null}function x(t){return t&&("function"==typeof t||(n=t,Array.isArray(n)&&!j(n,(function(t){return"function"!=typeof t}))));var n}function B(t,n){var e=t[n]||[];0===(e=Array.isArray(e)?e:[e]).length&&(e=[function(){return Promise.resolve()}]);var r=L(t),o=U(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(c(15,!1,r,o,n,u))}))}),Promise.resolve())}}function G(t){return t&&"function"==typeof t.then&&"function"==typeof t.catch}function C(t,n){return Promise.resolve().then((function(){return t.status!==h?t:(t.status=m,et(t,"bootstrap").then((function(){return t.status=d,t})).catch((function(e){if(t.status=T,n)throw f(e,t);return u(e,t),t})))}))}function K(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){var o=f(r,t);throw t.status=T,o}u(r,t),t.status=T}))})).then((function(){return t}));function r(){return et(t,"unmount").then((function(){t.status=d})).catch((function(e){if(n){var r=f(e,t);throw t.status=T,r}u(e,t),t.status=T}))}}))}var k=!1,F=!1;function H(t,n){return Promise.resolve().then((function(){return t.status!==d?t:(k||(window.dispatchEvent(new r("single-spa:before-first-mount")),k=!0),et(t,"mount").then((function(){return t.status=w,F||(window.dispatchEvent(new r("single-spa:first-mount")),F=!0),t})).catch((function(e){return t.status=w,K(t).then(r,r);function r(){if(n){var r=f(e,t);throw t.status=T,r}return u(e,t),t.status=T,t}})))}))}var J=0,W={parcels:{}};function $(){return Q.apply(W,arguments)}function Q(t,n){var e=this;if(!t||"object"!==o(t)&&"function"!=typeof t)throw Error(c(2,!1));if(t.name&&"string"!=typeof t.name)throw Error(c(3,!1,o(t.name)));if("object"!==o(n))throw Error(c(4,!1,name,o(n)));if(!n.domElement)throw Error(c(5,!1,name));var r,i=J++,u="function"==typeof t,a=u?t:function(){return Promise.resolve(t)},s={id:i,parcels:{},status:u?p:h,customProps:n,parentName:U(e),unmountThisParcel:function(){if(s.status!==w)throw Error(c(6,!1,name,s.status));return K(s,!0).then((function(t){return s.parentName&&delete e.parcels[s.id],t})).then((function(t){return m(t),t})).catch((function(t){throw s.status=T,v(t),t}))}};e.parcels[i]=s;var l=a();if(!l||"function"!=typeof l.then)throw Error(c(7,!1));var m,v,E=(l=l.then((function(t){if(!t)throw Error(c(8,!1));var n=t.name||"parcel-".concat(i);if(!x(t.bootstrap))throw Error(c(9,!1,n));if(!x(t.mount))throw Error(c(10,!1,n));if(!x(t.unmount))throw Error(c(11,!1,n));if(t.update&&!x(t.update))throw Error(c(12,!1,n));var e=B(t,"bootstrap"),o=B(t,"mount"),u=B(t,"unmount");s.status=h,s.name=n,s.bootstrap=e,s.mount=o,s.unmount=u,s.timeouts=rt(t.timeouts),t.update&&(s.update=B(t,"update"),r.update=function(t){return s.customProps=t,V(function(t){return Promise.resolve().then((function(){if(t.status!==w)throw Error(c(32,!1,U(t)));return t.status=g,et(t,"update").then((function(){return t.status=w,t})).catch((function(n){var e=f(n,t);throw t.status=T,e}))}))}(s))})}))).then((function(){return C(s,!0)})),y=E.then((function(){return H(s,!0)})),O=new Promise((function(t,n){m=t,v=n}));return r={mount:function(){return V(Promise.resolve().then((function(){if(s.status!==d)throw Error(c(13,!1,name,s.status));return e.parcels[i]=s,H(s)})))},unmount:function(){return V(s.unmountThisParcel())},getStatus:function(){return s.status},loadPromise:V(l),bootstrapPromise:V(E),mountPromise:V(y),unmountPromise:V(O)}}function V(t){return t.then((function(){return null}))}function q(t){var e=R({},t.customProps,{name:U(t),mountParcel:Q.bind(t),singleSpa:n});return I(t)&&(e.unmountSelf=t.unmountThisParcel),e}var z=1e3,X={bootstrap:{millis:4e3,dieOnTimeout:!1,warningMillis:z},mount:{millis:3e3,dieOnTimeout:!1,warningMillis:z},unmount:{millis:3e3,dieOnTimeout:!1,warningMillis:z},unload:{millis:3e3,dieOnTimeout:!1,warningMillis:z},update:{millis:3e3,dieOnTimeout:!1,warningMillis:z}};function Y(t,n,e){if("number"!=typeof t||t<=0)throw Error(c(16,!1));X.bootstrap={millis:t,dieOnTimeout:n,warningMillis:e||z}}function Z(t,n,e){if("number"!=typeof t||t<=0)throw Error(c(17,!1));X.mount={millis:t,dieOnTimeout:n,warningMillis:e||z}}function tt(t,n,e){if("number"!=typeof t||t<=0)throw Error(c(18,!1));X.unmount={millis:t,dieOnTimeout:n,warningMillis:e||z}}function nt(t,n,e){if("number"!=typeof t||t<=0)throw Error(c(19,!1));X.unload={millis:t,dieOnTimeout:n,warningMillis:e||z}}function et(t,n){var e=t.timeouts[n],r=e.warningMillis,o=L(t);return new Promise((function(i,u){var a=!1,s=!1;t[n](q(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=c(31,!1,n,o,U(t),e.millis);function l(t){if(!a)if(!0===t)s=!0,e.dieOnTimeout?u(Error(f)):console.error(f);else if(!s){var n=t,o=n*r;console.warn(f),o+r<e.millis&&setTimeout((function(){return l(n+1)}),r)}}}))}function rt(t){var n={};for(var e in X)n[e]=R({},X[e],t&&t[e]||{});return n}function ot(t){return Promise.resolve().then((function(){return t.status!==l&&t.status!==O?t:(t.status=p,Promise.resolve().then((function(){var r=t.loadImpl(q(t));if(!G(r))throw e=!0,Error(c(33,!1,U(t)));return r.then((function(e){var r;t.loadErrorTime=null,"object"!==o(n=e)&&(r=34),x(n.bootstrap)||(r=35),x(n.mount)||(r=36),x(n.unmount)||(r=37);var i=L(n);if(r){var a;try{a=JSON.stringify(n)}catch(t){}return console.error(c(r,!1,i,U(t),a),n),u(void 0,t),t.status=T,t}return n.devtools&&n.devtools.overlays&&(t.devtools.overlays=R({},t.devtools.overlays,n.devtools.overlays)),t.status=h,t.bootstrap=B(n,"bootstrap"),t.mount=B(n,"mount"),t.unmount=B(n,"unmount"),t.unload=B(n,"unload"),t.timeouts=rt(n.timeouts),t}))})).catch((function(n){return u(n,t),e?t.status=T:(t.status=O,t.loadErrorTime=(new Date).getTime()),t})));var n,e}))}var it={hashchange:[],popstate:[]},ut=["hashchange","popstate"];function at(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(c(14,!1));n=t.currentTarget.href,t.preventDefault()}var e=dt(window.location.href),r=dt(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 st(t){var n=this;if(t){var e=t[0].type;ut.indexOf(e)>=0&&it[e].forEach((function(e){e.apply(n,t)}))}}function ct(){jt([],arguments)}window.addEventListener("hashchange",ct),window.addEventListener("popstate",ct);var ft=window.addEventListener,lt=window.removeEventListener;window.addEventListener=function(t,n){if(!("function"==typeof n&&ut.indexOf(t)>=0)||j(it[t],(function(t){return t===n})))return ft.apply(this,arguments);it[t].push(n)},window.removeEventListener=function(t,n){if(!("function"==typeof n&&ut.indexOf(t)>=0))return lt.apply(this,arguments);it[t]=it[t].filter((function(t){return t!==n}))};var pt=window.history.pushState;window.history.pushState=function(t){var n=pt.apply(this,arguments);return ct(mt(t)),n};var ht=window.history.replaceState;function mt(t){try{return new PopStateEvent("popstate",{state:t})}catch(e){var n=document.createEvent("PopStateEvent");return n.initPopStateEvent("popstate",!1,!1,t),n}}function dt(t){var n=document.createElement("a");return n.href=t,n}window.history.replaceState=function(t){var n=ht.apply(this,arguments);return ct(mt(t)),n},window.singleSpaNavigate=at;var vt=!1;function wt(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:window.jQuery;if(t||window.$&&window.$.fn&&window.$.fn.jquery&&(t=window.$),t&&!vt){var n=t.fn.on,e=t.fn.off;t.fn.on=function(t,e){return gt.call(this,n,window.addEventListener,t,e,arguments)},t.fn.off=function(t,n){return gt.call(this,e,window.removeEventListener,t,n,arguments)},vt=!0}}function gt(t,n,e,r,o){return"string"!=typeof e?t.apply(this,o):(e.split(/\s+/).forEach((function(t){ut.indexOf(t)>=0&&(n(t,r),e=e.replace(t,""))})),""===e.trim()?this:t.apply(this,o))}var Et={};function yt(t){return Promise.resolve().then((function(){var n=Et[U(t)];return n?t.status===l?(Ot(t,n),t):t.status===y?n.promise.then((function(){return t})):t.status!==d?t:(t.status=y,et(t,"unload").then((function(){return Ot(t,n),t})).catch((function(e){return function(t,n,e){delete Et[U(t)],delete t.bootstrap,delete t.mount,delete t.unmount,delete t.unload,u(e,t),t.status=T,n.reject(e)}(t,n,e),t}))):t}))}function Ot(t,n){delete Et[U(t)],delete t.bootstrap,delete t.mount,delete t.unmount,delete t.unload,t.status=l,n.resolve()}function Tt(t,n,e,r){Et[U(t)]={app:t,resolve:e,reject:r},Object.defineProperty(Et[U(t)],"promise",{get:n})}var Pt=[];function bt(){return Pt.filter(P).map(U)}function Nt(){return Pt.map(U)}function At(t){var n=j(Pt,(function(n){return U(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(c(20,!1));if(-1!==Nt().indexOf(t))throw Error(c(21,!1,t));if("object"!==o(i)||Array.isArray(i))throw Error(c(22,!1));if(!n)throw Error(c(23,!1));if(r="function"!=typeof n?function(){return Promise.resolve(n)}:n,"function"!=typeof e)throw Error(c(24,!1));Pt.push({loadErrorTime:null,name:t,loadImpl:r,activeWhen:e,status:l,parcels:{},devtools:{overlays:{options:{},selectors:[]}},customProps:i}),wt(),jt()}function St(t){return Pt.filter((function(n){return n.activeWhen(t)})).map(U)}function Dt(){return Pt.filter(D).filter(M).filter(A).filter(_)}function Mt(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{waitForUnmount:!1};if("string"!=typeof t)throw Error(c(26,!1));var e=j(Pt,(function(n){return U(n)===t}));if(!e)throw Error(c(27,!1,t));var r,o=function(t){return Et[t]}(U(e));if(n&&n.waitForUnmount){if(o)return o.promise;var i=new Promise((function(t,n){Tt(e,(function(){return i}),t,n)}));return i}return o?(r=o.promise,Ut(e,o.resolve,o.reject)):r=new Promise((function(t,n){Tt(e,(function(){return r}),t,n),Ut(e,t,n)})),r}function Ut(t,n,e){K(t).then(yt).then((function(){n(),setTimeout((function(){jt()}))})).catch(e)}var It=!1,Lt=[];function Rt(){return jt()}function jt(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],n=arguments.length>1?arguments[1]:void 0;if(It)return new Promise((function(t,e){Lt.push({resolve:t,reject:e,eventArguments:n})}));It=!0;var e=!0;return xt?Promise.resolve().then((function(){window.dispatchEvent(new r("single-spa:before-routing-event",u()));var n=Object.keys(Et).map((function(t){return Et[t].app})).filter(b).map(yt),a=Pt.filter(D).filter(P).filter(S).map(K).map((function(t){return t.then(yt)})).concat(n);a.length>0&&(e=!1);var s=Promise.all(a),c=Dt(),f=c.map((function(t){return ot(t).then(C).then((function(t){return s.then((function(){return H(t)}))}))}));f.length>0&&(e=!1);var l=Pt.filter(D).filter(b).filter(N).filter(_).filter((function(t){return c.indexOf(t)<0})).map((function(t){return C(t).then((function(){return s})).then((function(){return H(t)}))}));return l.length>0&&(e=!1),s.catch((function(t){throw i(),t})).then((function(){return i(),Promise.all(f.concat(l)).catch((function(n){throw t.forEach((function(t){return t.reject(n)})),n})).then((function(){return o(!1)}))}))})):Promise.resolve().then((function(){var t=Dt().map(ot);return t.length>0&&(e=!1),Promise.all(t).then(o).catch((function(t){throw i(),t}))}));function o(){var n=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],o=bt();n&&i(),t.forEach((function(t){return t.resolve(o)}));try{var a=e?"single-spa:no-app-change":"single-spa:app-change";window.dispatchEvent(new r(a,u())),window.dispatchEvent(new r("single-spa:routing-event",u()))}catch(t){setTimeout((function(){throw t}))}if(It=!1,Lt.length>0){var s=Lt;Lt=[],jt(s)}return o}function i(){t.forEach((function(t){st(t.eventArguments)})),st(n)}function u(){var t={detail:{}};return n&&n[0]&&(t.detail.originalEvent=n[0]),t}}var xt=!1;function Bt(){xt=!0,jt()}setTimeout((function(){xt||console.warn(c(1,!1))}),5e3);var Gt={getRawAppData:function(){return[].concat(Pt)},reroute:jt,NOT_LOADED:l,toLoadPromise:ot,toBootstrapPromise:C,unregisterApplication:function(t){if(!Pt.find((function(n){return U(n)===t})))throw Error(c(25,!1,t));return Mt(t).then((function(){var n=Pt.findIndex((function(n){return U(n)===t}));Pt.splice(n,1)}))}};window&&window.__SINGLE_SPA_DEVTOOLS__&&(window.__SINGLE_SPA_DEVTOOLS__.exposedMethods=Gt),t.BOOTSTRAPPING=m,t.LOADING_SOURCE_CODE=p,t.LOAD_ERROR=O,t.MOUNTED=w,t.MOUNTING=v,t.NOT_BOOTSTRAPPED=h,t.NOT_LOADED=l,t.NOT_MOUNTED=d,t.SKIP_BECAUSE_BROKEN=T,t.UNMOUNTING=E,t.UPDATING=g,t.addErrorHandler=a,t.checkActivityFunctions=St,t.ensureJQuerySupport=wt,t.getAppNames=Nt,t.getAppStatus=At,t.getMountedApps=bt,t.mountRootParcel=$,t.navigateToUrl=at,t.registerApplication=_t,t.removeErrorHandler=s,t.setBootstrapMaxTime=Y,t.setMountMaxTime=Z,t.setUnloadMaxTime=nt,t.setUnmountMaxTime=tt,t.start=Bt,t.triggerAppChange=Rt,t.unloadApplication=Mt,Object.defineProperty(t,"__esModule",{value:!0})})); | ||
//# sourceMappingURL=single-spa.min.js.map |
{ | ||
"name": "single-spa", | ||
"version": "5.0.0-beta.0", | ||
"description": "Multiple applications, one page", | ||
"version": "5.0.0-beta.1", | ||
"description": "Microfrontends made easy", | ||
"main": "lib/umd/single-spa.min.js", | ||
@@ -33,2 +33,3 @@ "types": "typings/single-spa.d.ts", | ||
"keywords": [ | ||
"microfrontends", | ||
"single", | ||
@@ -35,0 +36,0 @@ "page", |
@@ -36,3 +36,4 @@ declare module "single-spa" { | ||
| "UNLOADING" | ||
| "SKIP_BECAUSE_BROKEN"; | ||
| "SKIP_BECAUSE_BROKEN" | ||
| "LOAD_ERROR"; | ||
loadPromise: Promise<null>; | ||
@@ -92,3 +93,4 @@ bootstrapPromise: Promise<null>; | ||
UNLOADING = "UNLOADING", | ||
SKIP_BECAUSE_BROKEN = "SKIP_BECAUSE_BROKEN" | ||
SKIP_BECAUSE_BROKEN = "SKIP_BECAUSE_BROKEN", | ||
LOAD_ERROR = "LOAD_ERROR" | ||
}; | ||
@@ -95,0 +97,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
730685
4084
0