react-ssr-prepass
Advanced tools
Comparing version 1.0.8 to 1.1.0
@@ -67,3 +67,3 @@ "use strict"; | ||
var currentContextStore = new Map(); | ||
var currentContextStore = new Map; | ||
@@ -168,4 +168,2 @@ var currentContextMap = {}; | ||
var RE_RENDER_LIMIT = 25; | ||
var setFirstHook = function(hook) { | ||
@@ -252,3 +250,3 @@ firstWorkInProgressHook = hook; | ||
if (null === renderPhaseUpdates) { | ||
renderPhaseUpdates = new Map(); | ||
renderPhaseUpdates = new Map; | ||
} | ||
@@ -270,2 +268,6 @@ var firstRenderPhaseUpdate = renderPhaseUpdates.get(queue); | ||
function _ref(callback) { | ||
callback(); | ||
} | ||
var Dispatcher = { | ||
@@ -326,2 +328,8 @@ readContext: function readContext(context, _) { | ||
}, | ||
useTransition: function useTransition() { | ||
return [ _ref, !1 ]; | ||
}, | ||
useDeferredValue: function useDeferredValue(input) { | ||
return input; | ||
}, | ||
useLayoutEffect: noop, | ||
@@ -335,3 +343,3 @@ useImperativeHandle: noop, | ||
type._status = 0; | ||
return type._ctor().then(function(Component) { | ||
return type._ctor().then((function(Component) { | ||
if ("function" == typeof Component) { | ||
@@ -346,5 +354,5 @@ type._result = Component; | ||
} | ||
}).catch(function() { | ||
})).catch((function() { | ||
type._status = 2; | ||
}); | ||
})); | ||
}; | ||
@@ -375,4 +383,5 @@ | ||
return function renderWithHooks(Component, props, refOrContext) { | ||
workInProgressHook = null; | ||
var children = Component(props, refOrContext); | ||
while (numberOfReRenders < RE_RENDER_LIMIT && didScheduleRenderPhaseUpdate) { | ||
while (numberOfReRenders < 25 && didScheduleRenderPhaseUpdate) { | ||
didScheduleRenderPhaseUpdate = !1; | ||
@@ -397,3 +406,3 @@ numberOfReRenders += 1; | ||
function _ref() { | ||
function _ref$1() { | ||
return !1; | ||
@@ -409,3 +418,3 @@ } | ||
queue: queue = [], | ||
isMounted: _ref, | ||
isMounted: _ref$1, | ||
enqueueForceUpdate: _ref2, | ||
@@ -506,56 +515,2 @@ enqueueReplaceState: function(instance, completeState) { | ||
var styledComponents; | ||
try { | ||
if (void 0 === (styledComponents = require("styled-components")).__DO_NOT_USE_OR_YOU_WILL_BE_HAUNTED_BY_SPOOKY_GHOSTS || void 0 === styledComponents.ThemeContext) { | ||
styledComponents = void 0; | ||
} | ||
} catch (_error) {} | ||
var mount$3 = function(element) { | ||
var type = element.type; | ||
var attrs = Array.isArray(type.attrs) ? type.attrs : [ type.attrs ]; | ||
var computedProps = computeProps(element.props, type.defaultProps); | ||
var props = function(input, props, theme) { | ||
var executionContext = _extends({}, props, { | ||
theme: theme | ||
}); | ||
var attrs = input.reduce(function(acc, attr) { | ||
if ("function" == typeof attr) { | ||
return _extends(acc, attr(executionContext)); | ||
} else if ("object" != typeof attr || null === attr) { | ||
return acc; | ||
} | ||
for (var key in attr) { | ||
var attrProp = attr[key]; | ||
if ("function" == typeof attrProp) { | ||
acc[key] = attrProp(executionContext); | ||
} else if (attr.hasOwnProperty(key)) { | ||
acc[key] = attrProp; | ||
} | ||
} | ||
return acc; | ||
}, {}); | ||
var newProps = _extends(attrs, props); | ||
newProps.className = props.className || ""; | ||
newProps.style = props.style ? _extends({}, attrs.style, props.style) : attrs.style; | ||
return newProps; | ||
}(attrs, computedProps, function(props, defaultProps) { | ||
var defaultTheme = defaultProps ? defaultProps.theme : void 0; | ||
if (props.theme && !(defaultTheme ? props.theme === defaultTheme : !1)) { | ||
return props.theme; | ||
} else { | ||
return readContextValue(styledComponents.ThemeContext) || defaultTheme; | ||
} | ||
}(element.props, type)); | ||
var as = props.as || type.target; | ||
var children = computedProps.children || null; | ||
if ("string" == typeof as) { | ||
return getChildrenArray(children); | ||
} else { | ||
delete props.as; | ||
return [ React.createElement(as, props, children) ]; | ||
} | ||
}; | ||
var YIELD_AFTER_MS = "production" !== process.env.NODE_ENV ? 20 : 5; | ||
@@ -683,13 +638,6 @@ | ||
case REACT_FORWARD_REF_TYPE: | ||
var refElement = element; | ||
if (function(element) { | ||
return void 0 !== styledComponents && void 0 !== typeof element.type.target && "string" == typeof element.type.styledComponentId; | ||
}(refElement)) { | ||
return mount$3(refElement); | ||
} | ||
var ref$2 = refElement.type; | ||
var type$3 = ref$2.render; | ||
var props = computeProps(refElement.props, ref$2.defaultProps); | ||
var fauxElement = React.createElement(render$3, props); | ||
var child$2 = render$3(type$3, props, queue, visitor, fauxElement); | ||
var ref$3 = element.type; | ||
var type$3 = ref$3.render; | ||
var props = computeProps(element.props, ref$3.defaultProps); | ||
var child$2 = React.createElement(type$3, props); | ||
return getChildrenArray(child$2); | ||
@@ -744,12 +692,21 @@ | ||
var visitChildren = function(init, queue, visitor) { | ||
var traversalChildren = [ init ]; | ||
var traversalMap = [ flushPrevContextMap() ]; | ||
var traversalStore = [ flushPrevContextStore() ]; | ||
if (visitLoop(traversalChildren, traversalMap, traversalStore, queue, visitor)) { | ||
queue.unshift(makeYieldFrame(traversalChildren, traversalMap, traversalStore)); | ||
} | ||
}; | ||
var ReactCurrentDispatcher = React__default.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentDispatcher; | ||
var resumeVisitChildren = function(frame, queue, visitor) { | ||
function wrapWithDispatcher(exec) { | ||
return function() { | ||
var args = [], len = arguments.length; | ||
while (len--) { | ||
args[len] = arguments[len]; | ||
} | ||
var prevDispatcher = ReactCurrentDispatcher.current; | ||
try { | ||
ReactCurrentDispatcher.current = Dispatcher; | ||
return exec.apply(void 0, args); | ||
} finally { | ||
ReactCurrentDispatcher.current = prevDispatcher; | ||
} | ||
}; | ||
} | ||
var resumeWithDispatcher = wrapWithDispatcher((function(frame, queue, visitor) { | ||
setCurrentIdentity(null); | ||
@@ -761,60 +718,67 @@ setCurrentContextMap(frame.contextMap); | ||
} | ||
}; | ||
})); | ||
var ReactCurrentDispatcher = React__default.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentDispatcher; | ||
var visitWithDispatcher = wrapWithDispatcher((function(init, queue, visitor) { | ||
var traversalChildren = [ init ]; | ||
var traversalMap = [ flushPrevContextMap() ]; | ||
var traversalStore = [ flushPrevContextStore() ]; | ||
if (visitLoop(traversalChildren, traversalMap, traversalStore, queue, visitor)) { | ||
queue.unshift(makeYieldFrame(traversalChildren, traversalMap, traversalStore)); | ||
} | ||
})); | ||
var prevDispatcher = ReactCurrentDispatcher.current; | ||
var updateWithDispatcher = wrapWithDispatcher((function(frame, queue) { | ||
switch (frame.kind) { | ||
case "frame.class": | ||
return function(queue, frame) { | ||
setCurrentIdentity(null); | ||
setCurrentContextMap(frame.contextMap); | ||
setCurrentContextStore(frame.contextStore); | ||
return render$2(frame.type, frame.instance, queue); | ||
}(queue, frame); | ||
var updateWithFrame = function(frame, queue, visitor) { | ||
if ("frame.yield" === frame.kind) { | ||
var yieldFrame = frame; | ||
return new Promise(function _ref(resolve) { | ||
setImmediate(function() { | ||
prevDispatcher = ReactCurrentDispatcher.current; | ||
ReactCurrentDispatcher.current = Dispatcher; | ||
resumeVisitChildren(yieldFrame, queue, visitor); | ||
ReactCurrentDispatcher.current = prevDispatcher; | ||
resolve(); | ||
}); | ||
}); | ||
case "frame.hooks": | ||
return function(queue, frame) { | ||
setFirstHook(frame.hook); | ||
setCurrentIdentity(frame.id); | ||
setCurrentContextMap(frame.contextMap); | ||
setCurrentContextStore(frame.contextStore); | ||
return render$1(frame.type, frame.props, queue); | ||
}(queue, frame); | ||
case "frame.lazy": | ||
return function(queue, frame) { | ||
setCurrentIdentity(null); | ||
setCurrentContextMap(frame.contextMap); | ||
setCurrentContextStore(frame.contextStore); | ||
return render(frame.type, frame.props); | ||
}(0, frame); | ||
default: | ||
return []; | ||
} | ||
return frame.thenable.then(function() { | ||
prevDispatcher = ReactCurrentDispatcher.current; | ||
ReactCurrentDispatcher.current = Dispatcher; | ||
var children = []; | ||
if ("frame.class" === frame.kind) { | ||
children = function(queue, frame) { | ||
setCurrentIdentity(null); | ||
setCurrentContextMap(frame.contextMap); | ||
setCurrentContextStore(frame.contextStore); | ||
return render$2(frame.type, frame.instance, queue); | ||
}(queue, frame); | ||
} else if ("frame.hooks" === frame.kind) { | ||
children = function(queue, frame) { | ||
setFirstHook(frame.hook); | ||
setCurrentIdentity(frame.id); | ||
setCurrentContextMap(frame.contextMap); | ||
setCurrentContextStore(frame.contextStore); | ||
return render$1(frame.type, frame.props, queue); | ||
}(queue, frame); | ||
} else if ("frame.lazy" === frame.kind) { | ||
children = function(queue, frame) { | ||
setCurrentIdentity(null); | ||
setCurrentContextMap(frame.contextMap); | ||
setCurrentContextStore(frame.contextStore); | ||
return render(frame.type, frame.props); | ||
}(0, frame); | ||
} | ||
visitChildren(getChildrenArray(children), queue, visitor); | ||
ReactCurrentDispatcher.current = prevDispatcher; | ||
}); | ||
}; | ||
})); | ||
var flushFrames = function(queue, visitor) { | ||
if (0 === queue.length) { | ||
return Promise.resolve(); | ||
} | ||
return updateWithFrame(queue.shift(), queue, visitor).then(function() { | ||
var frame = queue.shift(); | ||
return frame ? function(frame, queue, visitor) { | ||
if ("frame.yield" === frame.kind) { | ||
return new Promise((function _ref(resolve, reject) { | ||
setImmediate((function() { | ||
try { | ||
resumeWithDispatcher(frame, queue, visitor); | ||
resolve(); | ||
} catch (err) { | ||
reject(err); | ||
} | ||
})); | ||
})); | ||
} | ||
return frame.thenable.then((function() { | ||
var children = updateWithDispatcher(frame, queue); | ||
visitWithDispatcher(getChildrenArray(children), queue, visitor); | ||
})); | ||
}(frame, queue, visitor).then((function() { | ||
return flushFrames(queue, visitor); | ||
}); | ||
})) : Promise.resolve(); | ||
}; | ||
@@ -830,11 +794,7 @@ | ||
setCurrentContextMap({}); | ||
setCurrentContextStore(new Map()); | ||
setCurrentContextStore(new Map); | ||
try { | ||
prevDispatcher = ReactCurrentDispatcher.current; | ||
ReactCurrentDispatcher.current = Dispatcher; | ||
visitChildren(getChildrenArray(element), queue, fn); | ||
visitWithDispatcher(getChildrenArray(element), queue, fn); | ||
} catch (error) { | ||
return Promise.reject(error); | ||
} finally { | ||
ReactCurrentDispatcher.current = prevDispatcher; | ||
} | ||
@@ -841,0 +801,0 @@ return flushFrames(queue, fn); |
@@ -1,2 +0,2 @@ | ||
"use strict";function t(t){return t&&"object"==typeof t&&"default"in t?t.default:t}var e=require("react"),n=t(e),r=require("react-is"),u=t(require("object-is"));function o(){return(o=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t}).apply(this,arguments)}var i=r.Element,c=r.Portal,a=r.Fragment,l=r.StrictMode,f=r.Profiler,s=r.ContextProvider,p=r.ContextConsumer,d=r.ConcurrentMode,v=r.ForwardRef,y=r.Suspense,h=r.Memo,m=r.Lazy,_=e.Children.toArray,x=function(t){return null!==t&&"object"==typeof t},S=function(t){return _(t).filter(x)},g=function(t,e){return"object"==typeof e?o({},e,t):t},M=new Map,b={},w=void 0,E=void 0,C=function(){return o({},b)},P=function(){return new Map(M)},k=function(){var t=w;return w=void 0,t},O=function(){var t=E;return E=void 0,t},z=function(t){void 0!==t&&M.set(t[0],t[1])},q=function(t){w=void 0,b=t},j=function(t){E=void 0,M=t},D=function(t){var e=M.get(t);return void 0!==e?e:t._currentValue},R={},T=function(t){var e=t.contextType,n=t.contextTypes;if(e)return D(e);if(!n)return R;var r={};for(var u in n)r[u]=b[u];return r},U=null,F=function(t){U=t},N=function(){if(null===U)throw new Error("[react-ssr-prepass] Hooks can only be called inside the body of a function component. (https://fb.me/react-invalid-hook-call)");return U},W=null,A=null,I=!1,L=!1,H=null,Y=0,$=function(t){W=t};function B(){return null===A?null===W?(I=!1,W=A={memoizedState:null,queue:null,next:null}):(I=!0,A=W):null===A.next?(I=!1,A=A.next={memoizedState:null,queue:null,next:null}):(I=!0,A=A.next),A}function V(t,e){return"function"==typeof e?e(t):e}function G(t,e,n){var r,u=N();if(A=B(),I){var o=A.queue,i=o.dispatch;if(null!==H){var c=H.get(o);if(void 0!==c){H.delete(o);var a=A.memoizedState,l=c;do{a=t(a,l.action),l=l.next}while(null!==l);return A.memoizedState=a,[a,i]}}return[A.memoizedState,i]}r=t===V?"function"==typeof e?e():e:void 0!==n?n(e):e,A.memoizedState=r;var f=A.queue={last:null,dispatch:null},s=f.dispatch=K.bind(null,u,f);return[A.memoizedState,s]}function K(t,e,n){if(t===N()){L=!0;var r={action:n,next:null};null===H&&(H=new Map);var u=H.get(e);if(void 0===u)H.set(e,r);else{for(var o=u;null!==o.next;)o=o.next;o.next=r}}}function J(){}var Q={readContext:function(t,e){return D(t)},useContext:function(t,e){return N(),D(t)},useMemo:function(t,e){N();var n=void 0===e?null:e;if(null!==(A=B())){var r=A.memoizedState;if(null!==r&&null!==n&&function(t,e){if(null===e)return!1;for(var n=0;n<e.length&&n<t.length;n++)if(!u(t[n],e[n]))return!1;return!0}(n,r[1]))return r[0]}var o=t();return A.memoizedState=[o,n],o},useReducer:G,useRef:function(t){N();var e=(A=B()).memoizedState;if(null===e){var n={current:t};return A.memoizedState=n,n}return e},useState:function(t){return G(V,t)},useCallback:function(t,e){return t},useLayoutEffect:J,useImperativeHandle:J,useEffect:J,useDebugValue:J},X=function(t){return t._status=0,t._ctor().then(function(e){"function"==typeof e?(t._result=e,t._status=1):null!==e&&"object"==typeof e&&"function"==typeof e.default?(t._result=e.default,t._status=1):t._status=2}).catch(function(){t._status=2})},Z=function(t,n,r){return 1===t._status?e.createElement(t._result,n):null},tt=function(t,e,n){return{contextMap:C(),contextStore:P(),id:N(),hook:W,kind:"frame.hooks",thenable:n,props:e,type:t}},et=function(t,e,n){try{return function(t,e,n){for(var r=t(e,n);Y<25&&L;)L=!1,Y+=1,A=null,r=t(e,n);return Y=0,H=null,A=null,r}(t,g(e,t.defaultProps),T(t))}catch(r){if("function"!=typeof r.then)throw r;return n.push(tt(t,e,r)),null}};function nt(){return!1}function rt(){return null}var ut,ot=function(t,e,n){return{contextMap:C(),contextStore:P(),thenable:n,kind:"frame.class",instance:e,type:t}},it=function(t,e,n){!function(t){var e=t.updater.queue;if(e.length>0){for(var n=o({},t.state),r=0,u=e.length;r<u;r++){var i=e[r],c="function"==typeof i?i.call(t,n,t.props,t.context):i;null!==c&&o(n,c)}t.state=n,e.length=0}}(e);var r=null;try{r=e.render()}catch(r){if("function"!=typeof r.then)throw r;return n.push(ot(t,e,r)),null}if(void 0!==t.childContextTypes&&"function"==typeof e.getChildContext){var u=e.getChildContext();null!==u&&"object"==typeof u&&function(t){for(var e in w={},t)w[e]=b[e],b[e]=t[e]}(u)}if("function"!=typeof e.getDerivedStateFromProps&&("function"==typeof e.componentWillMount||"function"==typeof e.UNSAFE_componentWillMount)&&"function"==typeof e.componentWillUnmount)try{e.componentWillUnmount()}catch(t){}return e._isMounted=!1,r};try{void 0!==(ut=require("styled-components")).__DO_NOT_USE_OR_YOU_WILL_BE_HAUNTED_BY_SPOOKY_GHOSTS&&void 0!==ut.ThemeContext||(ut=void 0)}catch(t){}var ct=function(t,e,n,r,u){return(i=t).prototype&&i.prototype.isReactComponent?function(t,e,n,r,u){F(null);var i=function(t,e){var n,r={queue:n=[],isMounted:nt,enqueueForceUpdate:rt,enqueueReplaceState:function(t,e){t._isMounted&&(n.length=0,n.push(e))},enqueueSetState:function(t,e){t._isMounted&&n.push(e)}},u=g(e,t.defaultProps),i=T(t),c=new t(u,i,r);if(c.props=u,c.context=i,c.updater=r,c._isMounted=!0,void 0===c.state&&(c.state=null),"function"==typeof t.getDerivedStateFromProps){var a=(0,t.getDerivedStateFromProps)(c.props,c.state);null!=a&&(c.state=o({},c.state,a))}else"function"==typeof c.componentWillMount?c.componentWillMount():"function"==typeof c.UNSAFE_componentWillMount&&c.UNSAFE_componentWillMount();return c}(t,e),c=r(u,i);return c?(n.push(ot(t,i,c)),null):it(t,i,n)}(t,e,n,r,u):function(t,e,n,r,u){$(null),F({});var o=r(u);return o?(n.push(tt(t,e,o)),null):et(t,e,n)}(t,e,n,r,u);var i},at=function(t,n,r){switch(function(t){switch(t.$$typeof){case c:return c;case i:switch(t.type){case d:return d;case a:return a;case f:return f;case l:return l;case y:return y;default:switch(t.type&&t.type.$$typeof){case m:return m;case h:return h;case p:return p;case s:return s;case v:return v;default:return i}}default:return}}(t)){case y:case l:case d:case f:case a:return S(t.props.children);case s:var u=t.props,_=u.children;return function(t,e){E=[t,M.get(t)],M.set(t,e)}(t.type._context,u.value),S(_);case p:var x=t.props.children;if("function"==typeof x){var b=t.type,w=D("object"==typeof b._context?b._context:b);return S(x(w))}return[];case m:var k=function(t,e,n){return 2!==t._status&&1!==t._status?(n.push({contextMap:C(),contextStore:P(),kind:"frame.lazy",thenable:X(t),props:e,type:t}),null):Z(t,e)}(t.type,t.props,n);return S(k);case h:var O=e.createElement(t.type.type,t.props);return S(O);case v:var z=t;if(void 0!==ut&&void 0!==typeof z.type.target&&"string"==typeof z.type.styledComponentId)return function(t){var n=t.type,r=Array.isArray(n.attrs)?n.attrs:[n.attrs],u=g(t.props,n.defaultProps),i=function(t,e,n){var r=o({},e,{theme:n}),u=t.reduce(function(t,e){if("function"==typeof e)return o(t,e(r));if("object"!=typeof e||null===e)return t;for(var n in e){var u=e[n];"function"==typeof u?t[n]=u(r):e.hasOwnProperty(n)&&(t[n]=u)}return t},{}),i=o(u,e);return i.className=e.className||"",i.style=e.style?o({},u.style,e.style):u.style,i}(r,u,function(t,e){var r=n?n.theme:void 0;return!t.theme||r&&t.theme===r?D(ut.ThemeContext)||r:t.theme}(t.props)),c=i.as||n.target,a=u.children||null;return"string"==typeof c?S(a):(delete i.as,[e.createElement(c,i,a)])}(z);var q=z.type,j=q.render,R=g(z.props,q.defaultProps),T=e.createElement(ct,R),U=ct(j,R,n,r,T);return S(U);case i:if("string"==typeof t.type)return S(t.props.children);var F=ct(t.type,t.props,n,r,t);return S(F);case c:default:return[]}},lt=function(t,e,n,r,u){for(var i,c=Date.now();t.length>0;){var a=t[t.length-1].shift();if(void 0!==a){var l=at(a,r,u);t.push(l),e.push(k()),n.push(O())}else t.pop(),void 0!==(i=e.pop())&&o(b,i),z(n.pop());if(Date.now()-c>5)return!0}return!1},ft=function(t,e,n){return{contextMap:C(),contextStore:P(),thenable:Promise.resolve(),kind:"frame.yield",children:t,map:e,store:n}},st=function(t,e,n){var r=[t],u=[k()],o=[O()];lt(r,u,o,e,n)&&e.unshift(ft(r,u,o))},pt=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentDispatcher,dt=pt.current,vt=function(t,e){return 0===t.length?Promise.resolve():function(t,e,n){if("frame.yield"===t.kind){var r=t;return new Promise(function(t){setImmediate(function(){dt=pt.current,pt.current=Q,function(t,e,n){F(null),q(t.contextMap),j(t.contextStore),lt(t.children,t.map,t.store,e,n)&&e.unshift(ft(t.children,t.map,t.store))}(r,e,n),pt.current=dt,t()})})}return t.thenable.then(function(){dt=pt.current,pt.current=Q;var r=[];"frame.class"===t.kind?r=function(t,e){return F(null),q(e.contextMap),j(e.contextStore),it(e.type,e.instance,t)}(e,t):"frame.hooks"===t.kind?r=function(t,e){return $(e.hook),F(e.id),q(e.contextMap),j(e.contextStore),et(e.type,e.props,t)}(e,t):"frame.lazy"===t.kind&&(r=function(t,e){return F(null),q(e.contextMap),j(e.contextStore),Z(e.type,e.props)}(0,t)),st(S(r),e,n),pt.current=dt})}(t.shift(),t,e).then(function(){return vt(t,e)})},yt=function(){};module.exports=function(t,e){var n=[],r=void 0!==e?e:yt;q({}),j(new Map);try{dt=pt.current,pt.current=Q,st(S(t),n,r)}catch(t){return Promise.reject(t)}finally{pt.current=dt}return vt(n,r)}; | ||
"use strict";function t(t){return t&&"object"==typeof t&&"default"in t?t.default:t}var e=require("react"),n=t(e),r=require("react-is"),u=t(require("object-is"));function o(){return(o=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t}).apply(this,arguments)}var i=r.Element,c=r.Portal,a=r.Fragment,l=r.StrictMode,f=r.Profiler,s=r.ContextProvider,p=r.ContextConsumer,d=r.ConcurrentMode,v=r.ForwardRef,h=r.Suspense,y=r.Memo,m=r.Lazy,x=e.Children.toArray,S=function(t){return null!==t&&"object"==typeof t},_=function(t){return x(t).filter(S)},M=function(t,e){return"object"==typeof e?o({},e,t):t},g=new Map,b={},w=void 0,C=void 0,E=function(){return o({},b)},z=function(){return new Map(g)},P=function(){var t=w;return w=void 0,t},k=function(){var t=C;return C=void 0,t},q=function(t){void 0!==t&&g.set(t[0],t[1])},j=function(t){w=void 0,b=t},D=function(t){C=void 0,g=t},F=function(t){var e=g.get(t);return void 0!==e?e:t._currentValue},R={},W=function(t){var e=t.contextType,n=t.contextTypes;if(e)return F(e);if(!n)return R;var r={};for(var u in n)r[u]=b[u];return r},U=null,O=function(t){U=t},T=function(){if(null===U)throw new Error("[react-ssr-prepass] Hooks can only be called inside the body of a function component. (https://fb.me/react-invalid-hook-call)");return U},N=null,A=null,I=!1,L=!1,$=null,V=0,H=function(t){N=t};function B(){return null===A?null===N?(I=!1,N=A={memoizedState:null,queue:null,next:null}):(I=!0,A=N):null===A.next?(I=!1,A=A.next={memoizedState:null,queue:null,next:null}):(I=!0,A=A.next),A}function Y(t,e){return"function"==typeof e?e(t):e}function G(t,e,n){var r,u=T();if(A=B(),I){var o=A.queue,i=o.dispatch;if(null!==$){var c=$.get(o);if(void 0!==c){$.delete(o);var a=A.memoizedState,l=c;do{a=t(a,l.action),l=l.next}while(null!==l);return A.memoizedState=a,[a,i]}}return[A.memoizedState,i]}r=t===Y?"function"==typeof e?e():e:void 0!==n?n(e):e,A.memoizedState=r;var f=A.queue={last:null,dispatch:null},s=f.dispatch=J.bind(null,u,f);return[A.memoizedState,s]}function J(t,e,n){if(t===T()){L=!0;var r={action:n,next:null};null===$&&($=new Map);var u=$.get(e);if(void 0===u)$.set(e,r);else{for(var o=u;null!==o.next;)o=o.next;o.next=r}}}function K(){}function Q(t){t()}var X={readContext:function(t,e){return F(t)},useContext:function(t,e){return T(),F(t)},useMemo:function(t,e){T();var n=void 0===e?null:e;if(null!==(A=B())){var r=A.memoizedState;if(null!==r&&null!==n&&function(t,e){if(null===e)return!1;for(var n=0;n<e.length&&n<t.length;n++)if(!u(t[n],e[n]))return!1;return!0}(n,r[1]))return r[0]}var o=t();return A.memoizedState=[o,n],o},useReducer:G,useRef:function(t){T();var e=(A=B()).memoizedState;if(null===e){var n={current:t};return A.memoizedState=n,n}return e},useState:function(t){return G(Y,t)},useCallback:function(t,e){return t},useTransition:function(){return[Q,!1]},useDeferredValue:function(t){return t},useLayoutEffect:K,useImperativeHandle:K,useEffect:K,useDebugValue:K},Z=function(t){return t._status=0,t._ctor().then((function(e){"function"==typeof e?(t._result=e,t._status=1):null!==e&&"object"==typeof e&&"function"==typeof e.default?(t._result=e.default,t._status=1):t._status=2})).catch((function(){t._status=2}))},tt=function(t,n,r){return 1===t._status?e.createElement(t._result,n):null},et=function(t,e,n){return{contextMap:E(),contextStore:z(),id:T(),hook:N,kind:"frame.hooks",thenable:n,props:e,type:t}},nt=function(t,e,n){try{return function(t,e,n){A=null;for(var r=t(e,n);V<25&&L;)L=!1,V+=1,A=null,r=t(e,n);return V=0,$=null,A=null,r}(t,M(e,t.defaultProps),W(t))}catch(r){if("function"!=typeof r.then)throw r;return n.push(et(t,e,r)),null}};function rt(){return!1}function ut(){return null}var ot=function(t,e,n){return{contextMap:E(),contextStore:z(),thenable:n,kind:"frame.class",instance:e,type:t}},it=function(t,e,n){!function(t){var e=t.updater.queue;if(e.length>0){for(var n=o({},t.state),r=0,u=e.length;r<u;r++){var i=e[r],c="function"==typeof i?i.call(t,n,t.props,t.context):i;null!==c&&o(n,c)}t.state=n,e.length=0}}(e);var r=null;try{r=e.render()}catch(r){if("function"!=typeof r.then)throw r;return n.push(ot(t,e,r)),null}if(void 0!==t.childContextTypes&&"function"==typeof e.getChildContext){var u=e.getChildContext();null!==u&&"object"==typeof u&&function(t){for(var e in w={},t)w[e]=b[e],b[e]=t[e]}(u)}if("function"!=typeof e.getDerivedStateFromProps&&("function"==typeof e.componentWillMount||"function"==typeof e.UNSAFE_componentWillMount)&&"function"==typeof e.componentWillUnmount)try{e.componentWillUnmount()}catch(t){}return e._isMounted=!1,r},ct=function(t,n,r){switch(function(t){switch(t.$$typeof){case c:return c;case i:switch(t.type){case d:return d;case a:return a;case f:return f;case l:return l;case h:return h;default:switch(t.type&&t.type.$$typeof){case m:return m;case y:return y;case p:return p;case s:return s;case v:return v;default:return i}}default:return}}(t)){case h:case l:case d:case f:case a:return _(t.props.children);case s:var u=t.props,x=u.children;return N=u.value,C=[T=t.type._context,g.get(T)],g.set(T,N),_(x);case p:var S=t.props.children;if("function"==typeof S){var b=t.type,w=F("object"==typeof b._context?b._context:b);return _(S(w))}return[];case m:var P=function(t,e,n){return 2!==t._status&&1!==t._status?(n.push({contextMap:E(),contextStore:z(),kind:"frame.lazy",thenable:Z(t),props:e,type:t}),null):tt(t,e)}(t.type,t.props,n);return _(P);case y:var k=e.createElement(t.type.type,t.props);return _(k);case v:var q=t.type,j=q.render,D=M(t.props,q.defaultProps),R=e.createElement(j,D);return _(R);case i:if("string"==typeof t.type)return _(t.props.children);var U=function(t,e,n,r,u){return(i=t).prototype&&i.prototype.isReactComponent?function(t,e,n,r,u){O(null);var i=function(t,e){var n,r={queue:n=[],isMounted:rt,enqueueForceUpdate:ut,enqueueReplaceState:function(t,e){t._isMounted&&(n.length=0,n.push(e))},enqueueSetState:function(t,e){t._isMounted&&n.push(e)}},u=M(e,t.defaultProps),i=W(t),c=new t(u,i,r);if(c.props=u,c.context=i,c.updater=r,c._isMounted=!0,void 0===c.state&&(c.state=null),"function"==typeof t.getDerivedStateFromProps){var a=(0,t.getDerivedStateFromProps)(c.props,c.state);null!=a&&(c.state=o({},c.state,a))}else"function"==typeof c.componentWillMount?c.componentWillMount():"function"==typeof c.UNSAFE_componentWillMount&&c.UNSAFE_componentWillMount();return c}(t,e),c=r(u,i);return c?(n.push(ot(t,i,c)),null):it(t,i,n)}(t,e,n,r,u):function(t,e,n,r,u){H(null),O({});var o=r(u);return o?(n.push(et(t,e,o)),null):nt(t,e,n)}(t,e,n,r,u);var i}(t.type,t.props,n,r,t);return _(U);case c:default:return[]}var T,N},at=function(t,e,n,r,u){for(var i,c=Date.now();t.length>0;){var a=t[t.length-1].shift();if(void 0!==a){var l=ct(a,r,u);t.push(l),e.push(P()),n.push(k())}else t.pop(),void 0!==(i=e.pop())&&o(b,i),q(n.pop());if(Date.now()-c>5)return!0}return!1},lt=function(t,e,n){return{contextMap:E(),contextStore:z(),thenable:Promise.resolve(),kind:"frame.yield",children:t,map:e,store:n}},ft=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentDispatcher;function st(t){return function(){for(var e=[],n=arguments.length;n--;)e[n]=arguments[n];var r=ft.current;try{return ft.current=X,t.apply(void 0,e)}finally{ft.current=r}}}var pt=st((function(t,e,n){O(null),j(t.contextMap),D(t.contextStore),at(t.children,t.map,t.store,e,n)&&e.unshift(lt(t.children,t.map,t.store))})),dt=st((function(t,e,n){var r=[t],u=[P()],o=[k()];at(r,u,o,e,n)&&e.unshift(lt(r,u,o))})),vt=st((function(t,e){switch(t.kind){case"frame.class":return function(t,e){return O(null),j(e.contextMap),D(e.contextStore),it(e.type,e.instance,t)}(e,t);case"frame.hooks":return function(t,e){return H(e.hook),O(e.id),j(e.contextMap),D(e.contextStore),nt(e.type,e.props,t)}(e,t);case"frame.lazy":return function(t,e){return O(null),j(e.contextMap),D(e.contextStore),tt(e.type,e.props)}(0,t);default:return[]}})),ht=function(t,e){var n=t.shift();return n?function(t,e,n){return"frame.yield"===t.kind?new Promise((function(r,u){setImmediate((function(){try{pt(t,e,n),r()}catch(t){u(t)}}))})):t.thenable.then((function(){var r=vt(t,e);dt(_(r),e,n)}))}(n,t,e).then((function(){return ht(t,e)})):Promise.resolve()},yt=function(){};module.exports=function(t,e){var n=[],r=void 0!==e?e:yt;j({}),D(new Map);try{dt(_(t),n,r)}catch(t){return Promise.reject(t)}return ht(n,r)}; | ||
//# sourceMappingURL=react-ssr-prepass.production.min.js.map |
{ | ||
"name": "react-ssr-prepass", | ||
"version": "1.0.8", | ||
"version": "1.1.0", | ||
"description": "A custom partial React SSR renderer for prefetching and suspense", | ||
@@ -63,24 +63,24 @@ "main": "index.js", | ||
"dependencies": { | ||
"object-is": "^1.0.1" | ||
"object-is": "^1.0.2" | ||
}, | ||
"devDependencies": { | ||
"@babel/core": "^7.5.5", | ||
"@babel/plugin-transform-flow-strip-types": "^7.4.4", | ||
"@babel/plugin-transform-object-assign": "^7.2.0", | ||
"@babel/preset-env": "^7.5.5", | ||
"@babel/preset-flow": "^7.0.0", | ||
"@babel/preset-react": "^7.0.0", | ||
"@babel/core": "^7.8.3", | ||
"@babel/plugin-transform-flow-strip-types": "^7.8.3", | ||
"@babel/plugin-transform-object-assign": "^7.8.3", | ||
"@babel/preset-env": "^7.8.3", | ||
"@babel/preset-flow": "^7.8.3", | ||
"@babel/preset-react": "^7.8.3", | ||
"babel-plugin-closure-elimination": "^1.3.0", | ||
"babel-plugin-transform-async-to-promises": "^0.8.14", | ||
"codecov": "^3.5.0", | ||
"flow-bin": "^0.106.3", | ||
"husky": "^3.0.5", | ||
"babel-plugin-transform-async-to-promises": "^0.8.15", | ||
"codecov": "^3.6.1", | ||
"flow-bin": "^0.116.1", | ||
"husky": "^4.0.10", | ||
"jest": "^24.9.0", | ||
"lint-staged": "^9.2.5", | ||
"lint-staged": "^9.5.0", | ||
"npm-run-all": "^4.1.5", | ||
"prettier": "^1.18.2", | ||
"react": "^16.9.0", | ||
"react-dom": "^16.9.0", | ||
"react-is": "^16.9.0", | ||
"rollup": "^1.20.3", | ||
"prettier": "^1.19.1", | ||
"react": "^16.12.0", | ||
"react-dom": "^16.12.0", | ||
"react-is": "^16.12.0", | ||
"rollup": "^1.29.0", | ||
"rollup-plugin-babel": "^4.3.3", | ||
@@ -91,5 +91,4 @@ "rollup-plugin-buble": "^0.19.8", | ||
"rollup-plugin-replace": "^2.2.0", | ||
"rollup-plugin-terser": "^5.1.1", | ||
"styled-components": "^4.3.2" | ||
"rollup-plugin-terser": "^5.2.0" | ||
} | ||
} |
# react-ssr-prepass | ||
<p> | ||
<a href="https://travis-ci.org/FormidableLabs/react-ssr-prepass"> | ||
<img alt="Build Status" src="https://travis-ci.org/FormidableLabs/react-ssr-prepass.svg?branch=master" /> | ||
<a href="https://travis-ci.com/FormidableLabs/react-ssr-prepass"> | ||
<img alt="Build Status" src="https://travis-ci.com/FormidableLabs/react-ssr-prepass.svg?branch=master" /> | ||
</a> | ||
@@ -140,20 +140,2 @@ <a href="https://codecov.io/gh/FormidableLabs/react-ssr-prepass"> | ||
## Optional Dependencies | ||
### Special case for `styled-components` | ||
`react-ssr-prepass` has an optional dependency on `styled-components@>=4.0.0`. | ||
This optimization skips any styling logic and imitates the attributes and props | ||
logic of `styled-components` otherwise. | ||
It exists because styled-components may populate the `ServerStyleSheet` as | ||
part of a `react-ssr-prepass` run, since it behaves like a normal React renderer. | ||
This is dangerous if the element tree that is passed to `react-ssr-prepass` | ||
is not wrapped in a `ServerStyleSheet` at all, since it will start accumulating | ||
styles and cause a memory leak. In `v4` it can also cause these styles to | ||
become _global_ and be sent to every server-rendered page. | ||
If you're not using styled-components however and are bundling your server-side | ||
code you need to stub styled-components with an empty package or just install it. | ||
## Prior Art | ||
@@ -160,0 +142,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
25
142252
736
155
Updatedobject-is@^1.0.2