@loadable/component
Advanced tools
Comparing version 5.0.0 to 5.0.1
@@ -9,2 +9,7 @@ # Change Log | ||
### Bug Fixes | ||
* fix loadableReady ([59693bb](https://github.com/smooth-code/loadable-components/commit/59693bb)) | ||
### Features | ||
@@ -11,0 +16,0 @@ |
@@ -342,3 +342,3 @@ 'use strict'; | ||
var resolved = true; | ||
var resolved = false; | ||
return new Promise(function (resolve) { | ||
@@ -345,0 +345,0 @@ window.__LOADABLE_LOADED_CHUNKS__ = window.__LOADABLE_LOADED_CHUNKS__ || []; |
@@ -336,3 +336,3 @@ import React from 'react'; | ||
var resolved = true; | ||
var resolved = false; | ||
return new Promise(function (resolve) { | ||
@@ -339,0 +339,0 @@ window.__LOADABLE_LOADED_CHUNKS__ = window.__LOADABLE_LOADED_CHUNKS__ || []; |
@@ -807,3 +807,3 @@ (function (global, factory) { | ||
var resolved = true; | ||
var resolved = false; | ||
return new Promise(function (resolve) { | ||
@@ -810,0 +810,0 @@ window.__LOADABLE_LOADED_CHUNKS__ = window.__LOADABLE_LOADED_CHUNKS__ || []; |
@@ -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.loadable={},e.React)}(this,function(e,o){"use strict";function s(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 d=(o=o&&o.hasOwnProperty("default")?o.default:o).createContext(),r="__LOADABLE_REQUIRED_CHUNKS__",n=Object.freeze({LOADABLE_REQUIRED_CHUNKS_KEY:r,invariant:s,Context:d});function p(){return(p=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)}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,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},s(!e.__chunkExtractor||a.requireSync,"SSR requires `@loadable/babel`, please install it"),e.__chunkExtractor?(a.requireAsync(e).catch(function(){}),t.loadSync(),e.__chunkExtractor.addChunk(a.chunkName(e)),function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(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.state.loading?this.loadAsync():this.state.error||this.triggerOnLoad()},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:i});this.state.result=t,this.state.loading=!1}catch(e){this.state.error=e}},o.loadAsync=function(){var t=this;return this.promise=this.promise||a.requireAsync(this.props).then(function(e){t.setState({result:c(e,{Loadable:i}),loading:!1},function(){return t.triggerOnLoad()})}).catch(function(e){t.setState({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(i&&f.suspense)throw this.loadAsync();if(a)throw a;var u=r||f.fallback||null;return i?u:l({loading:i,fallback:u,result:c,options:f,props:p({},n,{ref:t})})},n}(o.Component),function(t){return o.createElement(d.Consumer,null,function(e){return o.createElement(r,p({__chunkExtractor:e},t))})}),i=o.forwardRef(function(e,t){return o.createElement(n,p({forwardedRef:t},e))});return i}return{loadable:r,lazy:function(e,t){return r(e,p({},t,{suspense:!0}))}}}function c(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,u=r?Symbol.for("react.provider"):60109,f=r?Symbol.for("react.context"):60110,l=r?Symbol.for("react.concurrent_mode"):60111,s=r?Symbol.for("react.forward_ref"):60112,d=r?Symbol.for("react.suspense"):60113,p=r?Symbol.for("react.memo"):60115,y=r?Symbol.for("react.lazy"):60116;function _(e){if("object"==typeof e&&null!==e){var t=e.$$typeof;switch(t){case n:switch(e=e.type){case l:case a:case c:case i:return e;default:switch(e=e&&e.$$typeof){case f:case s:case u:return e;default:return t}}case o:return t}}}function b(e){return _(e)===l}t.typeOf=_,t.AsyncMode=l,t.ConcurrentMode=l,t.ContextConsumer=f,t.ContextProvider=u,t.Element=n,t.ForwardRef=s,t.Fragment=a,t.Profiler=c,t.Portal=o,t.StrictMode=i,t.isValidElementType=function(e){return"string"==typeof e||"function"==typeof e||e===a||e===l||e===c||e===i||e===d||"object"==typeof e&&null!==e&&(e.$$typeof===y||e.$$typeof===p||e.$$typeof===u||e.$$typeof===f||e.$$typeof===s)},t.isAsyncMode=function(e){return b(e)},t.isConcurrentMode=b,t.isContextConsumer=function(e){return _(e)===f},t.isContextProvider=function(e){return _(e)===u},t.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===n},t.isForwardRef=function(e){return _(e)===s},t.isFragment=function(e){return _(e)===a},t.isProfiler=function(e){return _(e)===c},t.isPortal=function(e){return _(e)===o},t.isStrictMode=function(e){return _(e)===i}});c(f);var l=u(function(e,t){});c(l);var y=u(function(e){e.exports=f}),_={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},b={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},h={};h[y.ForwardRef]={$$typeof:!0,render:!0};var v=Object.defineProperty,m=Object.getOwnPropertyNames,O=Object.getOwnPropertySymbols,S=Object.getOwnPropertyDescriptor,g=Object.getPrototypeOf,w=Object.prototype;var E=function e(t,r,n){if("string"==typeof r)return t;if(w){var o=g(r);o&&o!==w&&e(t,o,n)}var a=m(r);O&&(a=a.concat(O(r)));for(var i=h[t.$$typeof]||_,c=h[r.$$typeof]||_,u=0;u<a.length;++u){var f=a[u];if(!(b[f]||n&&n[f]||c&&c[f]||i&&i[f])){var l=S(r,f);try{v(t,f,l)}catch(e){}}}return t};var x=i({resolve:function(e,t){var r=e.default||e;return E(t.Loadable,r,{prefetch:!0,Prefetch:!0}),r},render:function(e){return o.createElement(e.result,e.props)}}),L=x.loadable,P=x.lazy,R=i({onLoad:function(e,t){e&&t.ref&&("function"==typeof t.ref?t.ref(e):t.ref.current=e)},render:function(e){var t=e.props;return!e.loading&&t.children?t.children(e.result):null}}),A=R.lazy,$="undefined"!=typeof window;var C=L;C.lib=R.loadable;var D=P;D.lib=A;var j=n;e.default=C,e.lazy=D,e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=j,e.loadableReady=function(o){if(void 0===o&&(o=function(){}),!$)return t("`loadableReady()` must be called in browser only"),o(),Promise.resolve();var a=$?window[r]:null;if(!a)return t("`loadableReady()` requires state, please use `getScriptTags` or `getScriptElements` server-side"),o(),Promise.resolve();var i=!0;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.loadable={},e.React)}(this,function(e,o){"use strict";function s(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 d=(o=o&&o.hasOwnProperty("default")?o.default:o).createContext(),r="__LOADABLE_REQUIRED_CHUNKS__",n=Object.freeze({LOADABLE_REQUIRED_CHUNKS_KEY:r,invariant:s,Context:d});function p(){return(p=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)}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,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},s(!e.__chunkExtractor||a.requireSync,"SSR requires `@loadable/babel`, please install it"),e.__chunkExtractor?(a.requireAsync(e).catch(function(){}),t.loadSync(),e.__chunkExtractor.addChunk(a.chunkName(e)),function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(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.state.loading?this.loadAsync():this.state.error||this.triggerOnLoad()},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:i});this.state.result=t,this.state.loading=!1}catch(e){this.state.error=e}},o.loadAsync=function(){var t=this;return this.promise=this.promise||a.requireAsync(this.props).then(function(e){t.setState({result:c(e,{Loadable:i}),loading:!1},function(){return t.triggerOnLoad()})}).catch(function(e){t.setState({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(i&&f.suspense)throw this.loadAsync();if(a)throw a;var u=r||f.fallback||null;return i?u:l({loading:i,fallback:u,result:c,options:f,props:p({},n,{ref:t})})},n}(o.Component),function(t){return o.createElement(d.Consumer,null,function(e){return o.createElement(r,p({__chunkExtractor:e},t))})}),i=o.forwardRef(function(e,t){return o.createElement(n,p({forwardedRef:t},e))});return i}return{loadable:r,lazy:function(e,t){return r(e,p({},t,{suspense:!0}))}}}function c(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,u=r?Symbol.for("react.provider"):60109,f=r?Symbol.for("react.context"):60110,l=r?Symbol.for("react.concurrent_mode"):60111,s=r?Symbol.for("react.forward_ref"):60112,d=r?Symbol.for("react.suspense"):60113,p=r?Symbol.for("react.memo"):60115,y=r?Symbol.for("react.lazy"):60116;function _(e){if("object"==typeof e&&null!==e){var t=e.$$typeof;switch(t){case n:switch(e=e.type){case l:case a:case c:case i:return e;default:switch(e=e&&e.$$typeof){case f:case s:case u:return e;default:return t}}case o:return t}}}function b(e){return _(e)===l}t.typeOf=_,t.AsyncMode=l,t.ConcurrentMode=l,t.ContextConsumer=f,t.ContextProvider=u,t.Element=n,t.ForwardRef=s,t.Fragment=a,t.Profiler=c,t.Portal=o,t.StrictMode=i,t.isValidElementType=function(e){return"string"==typeof e||"function"==typeof e||e===a||e===l||e===c||e===i||e===d||"object"==typeof e&&null!==e&&(e.$$typeof===y||e.$$typeof===p||e.$$typeof===u||e.$$typeof===f||e.$$typeof===s)},t.isAsyncMode=function(e){return b(e)},t.isConcurrentMode=b,t.isContextConsumer=function(e){return _(e)===f},t.isContextProvider=function(e){return _(e)===u},t.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===n},t.isForwardRef=function(e){return _(e)===s},t.isFragment=function(e){return _(e)===a},t.isProfiler=function(e){return _(e)===c},t.isPortal=function(e){return _(e)===o},t.isStrictMode=function(e){return _(e)===i}});c(f);var l=u(function(e,t){});c(l);var y=u(function(e){e.exports=f}),_={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},b={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},h={};h[y.ForwardRef]={$$typeof:!0,render:!0};var v=Object.defineProperty,m=Object.getOwnPropertyNames,O=Object.getOwnPropertySymbols,S=Object.getOwnPropertyDescriptor,g=Object.getPrototypeOf,w=Object.prototype;var E=function e(t,r,n){if("string"==typeof r)return t;if(w){var o=g(r);o&&o!==w&&e(t,o,n)}var a=m(r);O&&(a=a.concat(O(r)));for(var i=h[t.$$typeof]||_,c=h[r.$$typeof]||_,u=0;u<a.length;++u){var f=a[u];if(!(b[f]||n&&n[f]||c&&c[f]||i&&i[f])){var l=S(r,f);try{v(t,f,l)}catch(e){}}}return t};var x=i({resolve:function(e,t){var r=e.default||e;return E(t.Loadable,r,{prefetch:!0,Prefetch:!0}),r},render:function(e){return o.createElement(e.result,e.props)}}),L=x.loadable,P=x.lazy,R=i({onLoad:function(e,t){e&&t.ref&&("function"==typeof t.ref?t.ref(e):t.ref.current=e)},render:function(e){var t=e.props;return!e.loading&&t.children?t.children(e.result):null}}),A=R.lazy,$="undefined"!=typeof window;var C=L;C.lib=R.loadable;var D=P;D.lib=A;var j=n;e.default=C,e.lazy=D,e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=j,e.loadableReady=function(o){if(void 0===o&&(o=function(){}),!$)return t("`loadableReady()` must be called in browser only"),o(),Promise.resolve();var a=$?window[r]:null;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})}); |
{ | ||
"name": "@loadable/component", | ||
"description": "React code splitting made easy.", | ||
"version": "5.0.0", | ||
"version": "5.0.1", | ||
"main": "dist/loadable.cjs.js", | ||
@@ -39,3 +39,3 @@ "module": "dist/loadable.es.js", | ||
}, | ||
"gitHead": "88fa92c0d46a14cedf527b14ef80966971580e28" | ||
"gitHead": "30522d18918a100215c637b1c851ac7fedc0e31b" | ||
} |
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
59093