@loadable/component
Advanced tools
Comparing version 5.7.0 to 5.9.0
@@ -6,2 +6,13 @@ # Change Log | ||
# [5.9.0](https://github.com/smooth-code/loadable-components/compare/v5.8.0...v5.9.0) (2019-04-23) | ||
### Features | ||
* support multiple react apps ([#317](https://github.com/smooth-code/loadable-components/issues/317)) ([dc54050](https://github.com/smooth-code/loadable-components/commit/dc54050)), closes [#311](https://github.com/smooth-code/loadable-components/issues/311) | ||
# [5.7.0](https://github.com/smooth-code/loadable-components/compare/v5.6.1...v5.7.0) (2019-03-14) | ||
@@ -8,0 +19,0 @@ |
@@ -26,5 +26,8 @@ 'use strict'; | ||
var LOADABLE_REQUIRED_CHUNKS_KEY = '__LOADABLE_REQUIRED_CHUNKS__'; | ||
function getRequiredChunkKey(namespace) { | ||
return "" + namespace + LOADABLE_REQUIRED_CHUNKS_KEY; | ||
} | ||
var sharedInternals = /*#__PURE__*/Object.freeze({ | ||
LOADABLE_REQUIRED_CHUNKS_KEY: LOADABLE_REQUIRED_CHUNKS_KEY, | ||
getRequiredChunkKey: getRequiredChunkKey, | ||
invariant: invariant, | ||
@@ -143,3 +146,3 @@ Context: Context | ||
ctor.requireAsync(props).catch(function () {}); // So we can require now the module synchronously | ||
ctor.requireAsync(props)["catch"](function () {}); // So we can require now the module synchronously | ||
@@ -241,3 +244,3 @@ _this.loadSync(); | ||
}); | ||
}).catch(function (error) { | ||
})["catch"](function (error) { | ||
_this3.safeSetState({ | ||
@@ -334,3 +337,3 @@ error: error, | ||
// eslint-disable-next-line no-underscore-dangle | ||
var Component = loadedModule.__esModule ? loadedModule.default : loadedModule.default || loadedModule; | ||
var Component = loadedModule.__esModule ? loadedModule["default"] : loadedModule["default"] || loadedModule; | ||
hoistNonReactStatics(Loadable, Component, { | ||
@@ -384,3 +387,3 @@ preload: true | ||
var BROWSER = typeof window !== 'undefined'; | ||
function loadableReady(done) { | ||
function loadableReady(done, _temp) { | ||
if (done === void 0) { | ||
@@ -390,2 +393,6 @@ done = function done() {}; | ||
var _ref = _temp === void 0 ? {} : _temp, | ||
_ref$namespace = _ref.namespace, | ||
namespace = _ref$namespace === void 0 ? '' : _ref$namespace; | ||
if (!BROWSER) { | ||
@@ -400,3 +407,3 @@ warn('`loadableReady()` must be called in browser only'); | ||
if (BROWSER) { | ||
var dataElement = document.getElementById(LOADABLE_REQUIRED_CHUNKS_KEY); | ||
var dataElement = document.getElementById(getRequiredChunkKey(namespace)); | ||
@@ -422,4 +429,4 @@ if (dataElement) { | ||
if (requiredChunks.every(function (chunk) { | ||
return loadedChunks.some(function (_ref) { | ||
var chunks = _ref[0]; | ||
return loadedChunks.some(function (_ref2) { | ||
var chunks = _ref2[0]; | ||
return chunks.includes(chunk); | ||
@@ -452,5 +459,5 @@ }); | ||
exports.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED; | ||
exports.default = loadable$2; | ||
exports.lazy = lazy$2; | ||
exports.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED; | ||
exports.loadableReady = loadableReady; |
@@ -20,5 +20,8 @@ import React from 'react'; | ||
var LOADABLE_REQUIRED_CHUNKS_KEY = '__LOADABLE_REQUIRED_CHUNKS__'; | ||
function getRequiredChunkKey(namespace) { | ||
return "" + namespace + LOADABLE_REQUIRED_CHUNKS_KEY; | ||
} | ||
var sharedInternals = /*#__PURE__*/Object.freeze({ | ||
LOADABLE_REQUIRED_CHUNKS_KEY: LOADABLE_REQUIRED_CHUNKS_KEY, | ||
getRequiredChunkKey: getRequiredChunkKey, | ||
invariant: invariant, | ||
@@ -137,3 +140,3 @@ Context: Context | ||
ctor.requireAsync(props).catch(function () {}); // So we can require now the module synchronously | ||
ctor.requireAsync(props)["catch"](function () {}); // So we can require now the module synchronously | ||
@@ -235,3 +238,3 @@ _this.loadSync(); | ||
}); | ||
}).catch(function (error) { | ||
})["catch"](function (error) { | ||
_this3.safeSetState({ | ||
@@ -328,3 +331,3 @@ error: error, | ||
// eslint-disable-next-line no-underscore-dangle | ||
var Component = loadedModule.__esModule ? loadedModule.default : loadedModule.default || loadedModule; | ||
var Component = loadedModule.__esModule ? loadedModule["default"] : loadedModule["default"] || loadedModule; | ||
hoistNonReactStatics(Loadable, Component, { | ||
@@ -378,3 +381,3 @@ preload: true | ||
var BROWSER = typeof window !== 'undefined'; | ||
function loadableReady(done) { | ||
function loadableReady(done, _temp) { | ||
if (done === void 0) { | ||
@@ -384,2 +387,6 @@ done = function done() {}; | ||
var _ref = _temp === void 0 ? {} : _temp, | ||
_ref$namespace = _ref.namespace, | ||
namespace = _ref$namespace === void 0 ? '' : _ref$namespace; | ||
if (!BROWSER) { | ||
@@ -394,3 +401,3 @@ warn('`loadableReady()` must be called in browser only'); | ||
if (BROWSER) { | ||
var dataElement = document.getElementById(LOADABLE_REQUIRED_CHUNKS_KEY); | ||
var dataElement = document.getElementById(getRequiredChunkKey(namespace)); | ||
@@ -416,4 +423,4 @@ if (dataElement) { | ||
if (requiredChunks.every(function (chunk) { | ||
return loadedChunks.some(function (_ref) { | ||
var chunks = _ref[0]; | ||
return loadedChunks.some(function (_ref2) { | ||
var chunks = _ref2[0]; | ||
return chunks.includes(chunk); | ||
@@ -447,2 +454,2 @@ }); | ||
export default loadable$2; | ||
export { lazy$2 as lazy, __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED, loadableReady }; | ||
export { __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED, lazy$2 as lazy, loadableReady }; |
@@ -25,5 +25,8 @@ (function (global, factory) { | ||
var LOADABLE_REQUIRED_CHUNKS_KEY = '__LOADABLE_REQUIRED_CHUNKS__'; | ||
function getRequiredChunkKey(namespace) { | ||
return "" + namespace + LOADABLE_REQUIRED_CHUNKS_KEY; | ||
} | ||
var sharedInternals = /*#__PURE__*/Object.freeze({ | ||
LOADABLE_REQUIRED_CHUNKS_KEY: LOADABLE_REQUIRED_CHUNKS_KEY, | ||
getRequiredChunkKey: getRequiredChunkKey, | ||
invariant: invariant, | ||
@@ -142,3 +145,3 @@ Context: Context | ||
ctor.requireAsync(props).catch(function () {}); // So we can require now the module synchronously | ||
ctor.requireAsync(props)["catch"](function () {}); // So we can require now the module synchronously | ||
@@ -240,3 +243,3 @@ _this.loadSync(); | ||
}); | ||
}).catch(function (error) { | ||
})["catch"](function (error) { | ||
_this3.safeSetState({ | ||
@@ -331,3 +334,3 @@ error: error, | ||
function unwrapExports (x) { | ||
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x.default : x; | ||
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x; | ||
} | ||
@@ -344,16 +347,16 @@ | ||
}); | ||
var b = "function" === typeof Symbol && Symbol.for, | ||
c = b ? Symbol.for("react.element") : 60103, | ||
d = b ? Symbol.for("react.portal") : 60106, | ||
e = b ? Symbol.for("react.fragment") : 60107, | ||
f = b ? Symbol.for("react.strict_mode") : 60108, | ||
g = b ? Symbol.for("react.profiler") : 60114, | ||
h = b ? Symbol.for("react.provider") : 60109, | ||
k = b ? Symbol.for("react.context") : 60110, | ||
l = b ? Symbol.for("react.async_mode") : 60111, | ||
m = b ? Symbol.for("react.concurrent_mode") : 60111, | ||
n = b ? Symbol.for("react.forward_ref") : 60112, | ||
p = b ? Symbol.for("react.suspense") : 60113, | ||
q = b ? Symbol.for("react.memo") : 60115, | ||
r = b ? Symbol.for("react.lazy") : 60116; | ||
var b = "function" === typeof Symbol && Symbol["for"], | ||
c = b ? Symbol["for"]("react.element") : 60103, | ||
d = b ? Symbol["for"]("react.portal") : 60106, | ||
e = b ? Symbol["for"]("react.fragment") : 60107, | ||
f = b ? Symbol["for"]("react.strict_mode") : 60108, | ||
g = b ? Symbol["for"]("react.profiler") : 60114, | ||
h = b ? Symbol["for"]("react.provider") : 60109, | ||
k = b ? Symbol["for"]("react.context") : 60110, | ||
l = b ? Symbol["for"]("react.async_mode") : 60111, | ||
m = b ? Symbol["for"]("react.concurrent_mode") : 60111, | ||
n = b ? Symbol["for"]("react.forward_ref") : 60112, | ||
p = b ? Symbol["for"]("react.suspense") : 60113, | ||
q = b ? Symbol["for"]("react.memo") : 60115, | ||
r = b ? Symbol["for"]("react.lazy") : 60116; | ||
@@ -510,16 +513,16 @@ function t(a) { | ||
var hasSymbol = typeof Symbol === 'function' && Symbol.for; | ||
var REACT_ELEMENT_TYPE = hasSymbol ? Symbol.for('react.element') : 0xeac7; | ||
var REACT_PORTAL_TYPE = hasSymbol ? Symbol.for('react.portal') : 0xeaca; | ||
var REACT_FRAGMENT_TYPE = hasSymbol ? Symbol.for('react.fragment') : 0xeacb; | ||
var REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol.for('react.strict_mode') : 0xeacc; | ||
var REACT_PROFILER_TYPE = hasSymbol ? Symbol.for('react.profiler') : 0xead2; | ||
var REACT_PROVIDER_TYPE = hasSymbol ? Symbol.for('react.provider') : 0xeacd; | ||
var REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for('react.context') : 0xeace; | ||
var REACT_ASYNC_MODE_TYPE = hasSymbol ? Symbol.for('react.async_mode') : 0xeacf; | ||
var REACT_CONCURRENT_MODE_TYPE = hasSymbol ? Symbol.for('react.concurrent_mode') : 0xeacf; | ||
var REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for('react.forward_ref') : 0xead0; | ||
var REACT_SUSPENSE_TYPE = hasSymbol ? Symbol.for('react.suspense') : 0xead1; | ||
var REACT_MEMO_TYPE = hasSymbol ? Symbol.for('react.memo') : 0xead3; | ||
var REACT_LAZY_TYPE = hasSymbol ? Symbol.for('react.lazy') : 0xead4; | ||
var hasSymbol = typeof Symbol === 'function' && Symbol["for"]; | ||
var REACT_ELEMENT_TYPE = hasSymbol ? Symbol["for"]('react.element') : 0xeac7; | ||
var REACT_PORTAL_TYPE = hasSymbol ? Symbol["for"]('react.portal') : 0xeaca; | ||
var REACT_FRAGMENT_TYPE = hasSymbol ? Symbol["for"]('react.fragment') : 0xeacb; | ||
var REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol["for"]('react.strict_mode') : 0xeacc; | ||
var REACT_PROFILER_TYPE = hasSymbol ? Symbol["for"]('react.profiler') : 0xead2; | ||
var REACT_PROVIDER_TYPE = hasSymbol ? Symbol["for"]('react.provider') : 0xeacd; | ||
var REACT_CONTEXT_TYPE = hasSymbol ? Symbol["for"]('react.context') : 0xeace; | ||
var REACT_ASYNC_MODE_TYPE = hasSymbol ? Symbol["for"]('react.async_mode') : 0xeacf; | ||
var REACT_CONCURRENT_MODE_TYPE = hasSymbol ? Symbol["for"]('react.concurrent_mode') : 0xeacf; | ||
var REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol["for"]('react.forward_ref') : 0xead0; | ||
var REACT_SUSPENSE_TYPE = hasSymbol ? Symbol["for"]('react.suspense') : 0xead1; | ||
var REACT_MEMO_TYPE = hasSymbol ? Symbol["for"]('react.memo') : 0xead3; | ||
var REACT_LAZY_TYPE = hasSymbol ? Symbol["for"]('react.lazy') : 0xead4; | ||
@@ -879,3 +882,3 @@ function isValidElementType(type) { | ||
// eslint-disable-next-line no-underscore-dangle | ||
var Component = loadedModule.__esModule ? loadedModule.default : loadedModule.default || loadedModule; | ||
var Component = loadedModule.__esModule ? loadedModule["default"] : loadedModule["default"] || loadedModule; | ||
hoistNonReactStatics_cjs(Loadable, Component, { | ||
@@ -929,3 +932,3 @@ preload: true | ||
var BROWSER = typeof window !== 'undefined'; | ||
function loadableReady(done) { | ||
function loadableReady(done, _temp) { | ||
if (done === void 0) { | ||
@@ -935,2 +938,6 @@ done = function done() {}; | ||
var _ref = _temp === void 0 ? {} : _temp, | ||
_ref$namespace = _ref.namespace, | ||
namespace = _ref$namespace === void 0 ? '' : _ref$namespace; | ||
if (!BROWSER) { | ||
@@ -945,3 +952,3 @@ warn('`loadableReady()` must be called in browser only'); | ||
if (BROWSER) { | ||
var dataElement = document.getElementById(LOADABLE_REQUIRED_CHUNKS_KEY); | ||
var dataElement = document.getElementById(getRequiredChunkKey(namespace)); | ||
@@ -967,4 +974,4 @@ if (dataElement) { | ||
if (requiredChunks.every(function (chunk) { | ||
return loadedChunks.some(function (_ref) { | ||
var chunks = _ref[0]; | ||
return loadedChunks.some(function (_ref2) { | ||
var chunks = _ref2[0]; | ||
return chunks.includes(chunk); | ||
@@ -997,5 +1004,5 @@ }); | ||
exports.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED; | ||
exports.default = loadable$2; | ||
exports.lazy = lazy$2; | ||
exports.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED; | ||
exports.loadableReady = loadableReady; | ||
@@ -1002,0 +1009,0 @@ |
@@ -1,1 +0,1 @@ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react")):"function"==typeof define&&define.amd?define(["exports","react"],t):t((e=e||self).loadable={},e.React)}(this,function(e,o){"use strict";function d(e,t){if(!e){var r=Error("loadable: "+t);throw r.framesToPop=1,r.name="Invariant Violation",r}}function t(e){console.warn("loadable: "+e)}var p=(o=o&&o.hasOwnProperty("default")?o.default:o).createContext(),r="__LOADABLE_REQUIRED_CHUNKS__",n=Object.freeze({LOADABLE_REQUIRED_CHUNKS_KEY:r,invariant:d,Context:p});function y(){return(y=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}function h(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}var a=function(e){return e};function i(e){var t=e.resolve,c=void 0===t?a:t,l=e.render,u=e.onLoad;function r(e,f){void 0===f&&(f={});var t,r,a="function"==typeof(t=e)?{requireAsync:t}:t,i={},n=(r=function(r){var e,t;function n(e){var t;return(t=r.call(this,e)||this).state={result:null,error:null,loading:!0},d(!e.__chunkExtractor||a.requireSync,"SSR requires `@loadable/babel-plugin`, please install it"),e.__chunkExtractor?(!1===f.ssr||(a.requireAsync(e).catch(function(){}),t.loadSync(),e.__chunkExtractor.addChunk(a.chunkName(e))),h(t)):(a.isReady&&a.isReady(e)&&t.loadSync(),t)}(e=n).prototype=Object.create((t=r).prototype),(e.prototype.constructor=e).__proto__=t;var o=n.prototype;return o.componentDidMount=function(){this.mounted=!0,this.state.loading?this.loadAsync():this.state.error||this.triggerOnLoad()},o.componentWillUnmount=function(){this.mounted=!1},o.safeSetState=function(e,t){this.mounted&&this.setState(e,t)},o.triggerOnLoad=function(){var e=this;u&&setTimeout(function(){u(e.state.result,e.props)})},o.loadSync=function(){if(this.state.loading)try{var e=a.requireSync(this.props),t=c(e,{Loadable:s});this.state.result=t,this.state.loading=!1}catch(e){this.state.error=e}},o.getCacheKey=function(){return JSON.stringify(this.props)},o.getCache=function(){return i[this.getCacheKey()]},o.setCache=function(e){i[this.getCacheKey()]=e},o.loadAsync=function(){var r=this;return this.promise=this.promise||a.requireAsync(this.props).then(function(e){var t=c(e,{Loadable:s});f.suspense&&r.setCache(t),r.safeSetState({result:c(e,{Loadable:s}),loading:!1},function(){return r.triggerOnLoad()})}).catch(function(e){r.safeSetState({error:e,loading:!1})}),this.promise},o.render=function(){var e=this.props,t=e.forwardedRef,r=e.fallback,n=function(e,t){if(null==e)return{};var r,n,o={},a=Object.keys(e);for(n=0;n<a.length;n++)t.indexOf(r=a[n])<0&&(o[r]=e[r]);return o}(e,["forwardedRef","fallback","__chunkExtractor"]),o=this.state,a=o.error,i=o.loading,s=o.result;if(f.suspense){var c=this.getCache();if(!c)throw this.loadAsync();return l({loading:!1,fallback:null,result:c,options:f,props:y({},n,{ref:t})})}if(a)throw a;var u=r||f.fallback||null;return i?u:l({loading:i,fallback:u,result:s,options:f,props:y({},n,{ref:t})})},n}(o.Component),function(t){return o.createElement(p.Consumer,null,function(e){return o.createElement(r,Object.assign({__chunkExtractor:e},t))})}),s=o.forwardRef(function(e,t){return o.createElement(n,Object.assign({forwardedRef:t},e))});return s.preload=function(e){if("undefined"==typeof window)throw Error("`preload` cannot be called server-side");a.requireAsync(e)},s}return{loadable:r,lazy:function(e,t){return r(e,y({},t,{suspense:!0}))}}}function s(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function c(e,t){return e(t={exports:{}},t.exports),t.exports}var u=c(function(e,t){Object.defineProperty(t,"__esModule",{value:!0});var r="function"==typeof Symbol&&Symbol.for,n=r?Symbol.for("react.element"):60103,o=r?Symbol.for("react.portal"):60106,a=r?Symbol.for("react.fragment"):60107,i=r?Symbol.for("react.strict_mode"):60108,s=r?Symbol.for("react.profiler"):60114,c=r?Symbol.for("react.provider"):60109,u=r?Symbol.for("react.context"):60110,f=r?Symbol.for("react.async_mode"):60111,l=r?Symbol.for("react.concurrent_mode"):60111,d=r?Symbol.for("react.forward_ref"):60112,p=r?Symbol.for("react.suspense"):60113,y=r?Symbol.for("react.memo"):60115,h=r?Symbol.for("react.lazy"):60116;function m(e){if("object"==typeof e&&null!==e){var t=e.$$typeof;switch(t){case n:switch(e=e.type){case f:case l:case a:case s:case i:case p:return e;default:switch(e=e&&e.$$typeof){case u:case d:case c:return e;default:return t}}case h:case y:case o:return t}}}function b(e){return m(e)===l}t.typeOf=m,t.AsyncMode=f,t.ConcurrentMode=l,t.ContextConsumer=u,t.ContextProvider=c,t.Element=n,t.ForwardRef=d,t.Fragment=a,t.Lazy=h,t.Memo=y,t.Portal=o,t.Profiler=s,t.StrictMode=i,t.Suspense=p,t.isValidElementType=function(e){return"string"==typeof e||"function"==typeof e||e===a||e===l||e===s||e===i||e===p||"object"==typeof e&&null!==e&&(e.$$typeof===h||e.$$typeof===y||e.$$typeof===c||e.$$typeof===u||e.$$typeof===d)},t.isAsyncMode=function(e){return b(e)||m(e)===f},t.isConcurrentMode=b,t.isContextConsumer=function(e){return m(e)===u},t.isContextProvider=function(e){return m(e)===c},t.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===n},t.isForwardRef=function(e){return m(e)===d},t.isFragment=function(e){return m(e)===a},t.isLazy=function(e){return m(e)===h},t.isMemo=function(e){return m(e)===y},t.isPortal=function(e){return m(e)===o},t.isProfiler=function(e){return m(e)===s},t.isStrictMode=function(e){return m(e)===i},t.isSuspense=function(e){return m(e)===p}});s(u);var f=c(function(e,t){});s(f);var l=c(function(e){e.exports=u}),m={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},b={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},_={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},v={};function S(e){return l.isMemo(e)?_:v[e.$$typeof]||m}v[l.ForwardRef]={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0};var g=Object.defineProperty,O=Object.getOwnPropertyNames,w=Object.getOwnPropertySymbols,E=Object.getOwnPropertyDescriptor,C=Object.getPrototypeOf,L=Object.prototype;var R=function e(t,r,n){if("string"==typeof r)return t;if(L){var o=C(r);o&&o!==L&&e(t,o,n)}var a=O(r);w&&(a=a.concat(w(r)));for(var i=S(t),s=S(r),c=0;c<a.length;++c){var u=a[c];if(!(b[u]||n&&n[u]||s&&s[u]||i&&i[u])){var f=E(r,u);try{g(t,u,f)}catch(e){}}}return t};var x=i({resolve:function(e,t){var r=e.__esModule?e.default:e.default||e;return R(t.Loadable,r,{preload:!0}),r},render:function(e){return o.createElement(e.result,e.props)}}),P=x.loadable,A=x.lazy,$=i({onLoad:function(e,t){e&&t.forwardedRef&&("function"==typeof t.forwardedRef?t.forwardedRef(e):t.forwardedRef.current=e)},render:function(e){var t=e.props;return!e.loading&&t.children?t.children(e.result):null}}),j=$.lazy,D="undefined"!=typeof window;var N=P;N.lib=$.loadable;var M=A;M.lib=j;var k=n;e.default=N,e.lazy=M,e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=k,e.loadableReady=function(o){if(void 0===o&&(o=function(){}),!D)return t("`loadableReady()` must be called in browser only"),o(),Promise.resolve();var a=null;if(D){var e=document.getElementById(r);e&&(a=JSON.parse(e.textContent))}if(!a)return t("`loadableReady()` requires state, please use `getScriptTags` or `getScriptElements` server-side"),o(),Promise.resolve();var i=!1;return new Promise(function(e){window.__LOADABLE_LOADED_CHUNKS__=window.__LOADABLE_LOADED_CHUNKS__||[];var r=window.__LOADABLE_LOADED_CHUNKS__,t=r.push.bind(r);function n(){a.every(function(t){return r.some(function(e){return e[0].includes(t)})})&&(i||(i=!0,e(),o()))}r.push=function(){t.apply(void 0,arguments),n()},n()})},Object.defineProperty(e,"__esModule",{value:!0})}); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react")):"function"==typeof define&&define.amd?define(["exports","react"],t):t((e=e||self).loadable={},e.React)}(this,function(e,o){"use strict";function d(e,t){if(!e){var r=Error("loadable: "+t);throw r.framesToPop=1,r.name="Invariant Violation",r}}function c(e){console.warn("loadable: "+e)}var p=(o=o&&o.hasOwnProperty("default")?o.default:o).createContext(),t="__LOADABLE_REQUIRED_CHUNKS__";function s(e){return""+e+t}var r=Object.freeze({getRequiredChunkKey:s,invariant:d,Context:p});function y(){return(y=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}function h(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}var n=function(e){return e};function a(e){var t=e.resolve,s=void 0===t?n:t,l=e.render,u=e.onLoad;function r(e,f){void 0===f&&(f={});var t,r,a="function"==typeof(t=e)?{requireAsync:t}:t,i={},n=(r=function(r){var e,t;function n(e){var t;return(t=r.call(this,e)||this).state={result:null,error:null,loading:!0},d(!e.__chunkExtractor||a.requireSync,"SSR requires `@loadable/babel-plugin`, please install it"),e.__chunkExtractor?(!1===f.ssr||(a.requireAsync(e).catch(function(){}),t.loadSync(),e.__chunkExtractor.addChunk(a.chunkName(e))),h(t)):(a.isReady&&a.isReady(e)&&t.loadSync(),t)}(e=n).prototype=Object.create((t=r).prototype),(e.prototype.constructor=e).__proto__=t;var o=n.prototype;return o.componentDidMount=function(){this.mounted=!0,this.state.loading?this.loadAsync():this.state.error||this.triggerOnLoad()},o.componentWillUnmount=function(){this.mounted=!1},o.safeSetState=function(e,t){this.mounted&&this.setState(e,t)},o.triggerOnLoad=function(){var e=this;u&&setTimeout(function(){u(e.state.result,e.props)})},o.loadSync=function(){if(this.state.loading)try{var e=a.requireSync(this.props),t=s(e,{Loadable:c});this.state.result=t,this.state.loading=!1}catch(e){this.state.error=e}},o.getCacheKey=function(){return JSON.stringify(this.props)},o.getCache=function(){return i[this.getCacheKey()]},o.setCache=function(e){i[this.getCacheKey()]=e},o.loadAsync=function(){var r=this;return this.promise=this.promise||a.requireAsync(this.props).then(function(e){var t=s(e,{Loadable:c});f.suspense&&r.setCache(t),r.safeSetState({result:s(e,{Loadable:c}),loading:!1},function(){return r.triggerOnLoad()})}).catch(function(e){r.safeSetState({error:e,loading:!1})}),this.promise},o.render=function(){var e=this.props,t=e.forwardedRef,r=e.fallback,n=function(e,t){if(null==e)return{};var r,n,o={},a=Object.keys(e);for(n=0;n<a.length;n++)t.indexOf(r=a[n])<0&&(o[r]=e[r]);return o}(e,["forwardedRef","fallback","__chunkExtractor"]),o=this.state,a=o.error,i=o.loading,c=o.result;if(f.suspense){var s=this.getCache();if(!s)throw this.loadAsync();return l({loading:!1,fallback:null,result:s,options:f,props:y({},n,{ref:t})})}if(a)throw a;var u=r||f.fallback||null;return i?u:l({loading:i,fallback:u,result:c,options:f,props:y({},n,{ref:t})})},n}(o.Component),function(t){return o.createElement(p.Consumer,null,function(e){return o.createElement(r,Object.assign({__chunkExtractor:e},t))})}),c=o.forwardRef(function(e,t){return o.createElement(n,Object.assign({forwardedRef:t},e))});return c.preload=function(e){if("undefined"==typeof window)throw Error("`preload` cannot be called server-side");a.requireAsync(e)},c}return{loadable:r,lazy:function(e,t){return r(e,y({},t,{suspense:!0}))}}}function i(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function u(e,t){return e(t={exports:{}},t.exports),t.exports}var f=u(function(e,t){Object.defineProperty(t,"__esModule",{value:!0});var r="function"==typeof Symbol&&Symbol.for,n=r?Symbol.for("react.element"):60103,o=r?Symbol.for("react.portal"):60106,a=r?Symbol.for("react.fragment"):60107,i=r?Symbol.for("react.strict_mode"):60108,c=r?Symbol.for("react.profiler"):60114,s=r?Symbol.for("react.provider"):60109,u=r?Symbol.for("react.context"):60110,f=r?Symbol.for("react.async_mode"):60111,l=r?Symbol.for("react.concurrent_mode"):60111,d=r?Symbol.for("react.forward_ref"):60112,p=r?Symbol.for("react.suspense"):60113,y=r?Symbol.for("react.memo"):60115,h=r?Symbol.for("react.lazy"):60116;function m(e){if("object"==typeof e&&null!==e){var t=e.$$typeof;switch(t){case n:switch(e=e.type){case f:case l:case a:case c:case i:case p:return e;default:switch(e=e&&e.$$typeof){case u:case d:case s:return e;default:return t}}case h:case y:case o:return t}}}function b(e){return m(e)===l}t.typeOf=m,t.AsyncMode=f,t.ConcurrentMode=l,t.ContextConsumer=u,t.ContextProvider=s,t.Element=n,t.ForwardRef=d,t.Fragment=a,t.Lazy=h,t.Memo=y,t.Portal=o,t.Profiler=c,t.StrictMode=i,t.Suspense=p,t.isValidElementType=function(e){return"string"==typeof e||"function"==typeof e||e===a||e===l||e===c||e===i||e===p||"object"==typeof e&&null!==e&&(e.$$typeof===h||e.$$typeof===y||e.$$typeof===s||e.$$typeof===u||e.$$typeof===d)},t.isAsyncMode=function(e){return b(e)||m(e)===f},t.isConcurrentMode=b,t.isContextConsumer=function(e){return m(e)===u},t.isContextProvider=function(e){return m(e)===s},t.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===n},t.isForwardRef=function(e){return m(e)===d},t.isFragment=function(e){return m(e)===a},t.isLazy=function(e){return m(e)===h},t.isMemo=function(e){return m(e)===y},t.isPortal=function(e){return m(e)===o},t.isProfiler=function(e){return m(e)===c},t.isStrictMode=function(e){return m(e)===i},t.isSuspense=function(e){return m(e)===p}});i(f);var l=u(function(e,t){});i(l);var m=u(function(e){e.exports=f}),b={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},v={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},_={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},g={};function S(e){return m.isMemo(e)?_:g[e.$$typeof]||b}g[m.ForwardRef]={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0};var O=Object.defineProperty,w=Object.getOwnPropertyNames,E=Object.getOwnPropertySymbols,C=Object.getOwnPropertyDescriptor,R=Object.getPrototypeOf,x=Object.prototype;var L=function e(t,r,n){if("string"==typeof r)return t;if(x){var o=R(r);o&&o!==x&&e(t,o,n)}var a=w(r);E&&(a=a.concat(E(r)));for(var i=S(t),c=S(r),s=0;s<a.length;++s){var u=a[s];if(!(v[u]||n&&n[u]||c&&c[u]||i&&i[u])){var f=C(r,u);try{O(t,u,f)}catch(e){}}}return t};var P=a({resolve:function(e,t){var r=e.__esModule?e.default:e.default||e;return L(t.Loadable,r,{preload:!0}),r},render:function(e){return o.createElement(e.result,e.props)}}),$=P.loadable,A=P.lazy,j=a({onLoad:function(e,t){e&&t.forwardedRef&&("function"==typeof t.forwardedRef?t.forwardedRef(e):t.forwardedRef.current=e)},render:function(e){var t=e.props;return!e.loading&&t.children?t.children(e.result):null}}),D=j.lazy,k="undefined"!=typeof window;var M=$;M.lib=j.loadable;var N=A;N.lib=D,e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=r,e.default=M,e.lazy=N,e.loadableReady=function(o,e){void 0===o&&(o=function(){});var t=(void 0===e?{}:e).namespace,r=void 0===t?"":t;if(!k)return c("`loadableReady()` must be called in browser only"),o(),Promise.resolve();var a=null;if(k){var n=document.getElementById(s(r));n&&(a=JSON.parse(n.textContent))}if(!a)return c("`loadableReady()` requires state, please use `getScriptTags` or `getScriptElements` server-side"),o(),Promise.resolve();var i=!1;return new Promise(function(e){window.__LOADABLE_LOADED_CHUNKS__=window.__LOADABLE_LOADED_CHUNKS__||[];var r=window.__LOADABLE_LOADED_CHUNKS__,t=r.push.bind(r);function n(){a.every(function(t){return r.some(function(e){return e[0].includes(t)})})&&(i||(i=!0,e(),o()))}r.push=function(){t.apply(void 0,arguments),n()},n()})},Object.defineProperty(e,"__esModule",{value:!0})}); |
{ | ||
"name": "@loadable/component", | ||
"description": "React code splitting made easy.", | ||
"version": "5.7.0", | ||
"version": "5.9.0", | ||
"main": "dist/loadable.cjs.js", | ||
@@ -39,3 +39,3 @@ "module": "dist/loadable.es.js", | ||
}, | ||
"gitHead": "6090e8affb8ebf93d33afc1df48cb05fd90c30c9" | ||
"gitHead": "82ed859b3f60bcead5e2328b72800996946ba542" | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
72073
1590