react-ssr-prepass
Advanced tools
Comparing version 1.0.2 to 1.0.3
@@ -103,3 +103,3 @@ function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; } | ||
/* The context is kept as a Map from a Context value to the current | ||
/** The context is kept as a Map from a Context value to the current | ||
value on the React element tree. | ||
@@ -130,6 +130,10 @@ The legacy context is kept as a simple object. | ||
var restoreContextMap = function (prev) { | ||
Object.assign(currentContextMap, prev); | ||
if (prev !== undefined) { | ||
Object.assign(currentContextMap, prev); | ||
} | ||
}; | ||
var restoreContextStore = function (prev) { | ||
currentContextStore.set(prev[0], prev[1]); | ||
if (prev !== undefined) { | ||
currentContextStore.set(prev[0], prev[1]); | ||
} | ||
}; | ||
@@ -725,3 +729,6 @@ var setCurrentContextMap = function (map) { | ||
// | ||
// the event loop is not interrupted for too long | ||
var YIELD_AFTER_MS = __DEV__ ? 20 : 5; | ||
var render$3 = function (type, props, queue, visitor, element) { | ||
@@ -789,8 +796,14 @@ return shouldConstruct(type) ? mount$2(type, props, queue, visitor, element) : mount$1(type, props, queue, visitor, element); | ||
{ | ||
var refElement = element; // Treat inner type as the component instead of React.forwardRef itself | ||
var refElement = element; | ||
var type$3 = refElement.type.render; | ||
var props = refElement.props; | ||
var child$2 = mount$1(type$3, props, queue, visitor); | ||
return getChildrenArray(child$2); | ||
if (typeof refElement.type.styledComponentId === 'string' && typeof refElement.type.target !== 'function') { | ||
// This is an optimization that's specific to styled-components | ||
// We can safely skip them if they're not wrapping a component | ||
return getChildrenArray(refElement.props.children); | ||
} else { | ||
var props = refElement.props; | ||
var render$1 = refElement.type.render; | ||
var child$2 = mount$1(render$1, props, queue, visitor); | ||
return getChildrenArray(child$2); | ||
} | ||
} | ||
@@ -807,5 +820,5 @@ | ||
var userElement = element; | ||
var type$4 = userElement.type; | ||
var type$3 = userElement.type; | ||
var props$1 = userElement.props; | ||
var child$3 = render$3(type$4, props$1, queue, visitor, userElement); | ||
var child$3 = render$3(type$3, props$1, queue, visitor, userElement); | ||
return getChildrenArray(child$3); | ||
@@ -822,23 +835,51 @@ } | ||
var visitChild = function (child, queue, visitor) { | ||
var children = visitElement(child, queue, visitor); // Flush the context changes | ||
var visitLoop = function (traversalChildren, traversalIndex, traversalMap, traversalStore, queue, visitor) { | ||
var start = Date.now(); | ||
var prevMap = flushPrevContextMap(); | ||
var prevStore = flushPrevContextStore(); | ||
visitChildren(children, queue, visitor); // Restore context changes after children have been walked | ||
while (traversalChildren.length > 0 && Date.now() - start <= YIELD_AFTER_MS) { | ||
var currChildren = traversalChildren[traversalChildren.length - 1]; | ||
var currIndex = traversalIndex[traversalIndex.length - 1]++; | ||
if (prevMap !== undefined) { | ||
restoreContextMap(prevMap); | ||
if (currIndex < currChildren.length) { | ||
var element = currChildren[currIndex]; | ||
var children = visitElement(element, queue, visitor); | ||
traversalChildren.push(children); | ||
traversalIndex.push(0); | ||
traversalMap.push(flushPrevContextMap()); | ||
traversalStore.push(flushPrevContextStore()); | ||
} else { | ||
traversalChildren.pop(); | ||
traversalIndex.pop(); | ||
restoreContextMap(traversalMap.pop()); | ||
restoreContextStore(traversalStore.pop()); | ||
} | ||
} | ||
if (prevStore !== undefined) { | ||
restoreContextStore(prevStore); | ||
} | ||
}; | ||
var visitChildren = function (children, queue, visitor) { | ||
for (var i = 0, l = children.length; i < l; i++) { | ||
visitChild(children[i], queue, visitor); | ||
var visitChildren = function (init, queue, visitor) { | ||
var traversalChildren = [init]; | ||
var traversalIndex = [0]; | ||
var traversalMap = [flushPrevContextMap()]; | ||
var traversalStore = [flushPrevContextStore()]; | ||
visitLoop(traversalChildren, traversalIndex, traversalMap, traversalStore, queue, visitor); | ||
if (traversalChildren.length > 0) { | ||
queue.unshift({ | ||
contextMap: getCurrentContextMap(), | ||
contextStore: getCurrentContextStore(), | ||
thenable: Promise.resolve(), | ||
kind: 'frame.yield', | ||
children: traversalChildren, | ||
index: traversalIndex, | ||
map: traversalMap, | ||
store: traversalStore | ||
}); | ||
} | ||
}; | ||
var resumeVisitChildren = function (frame, queue, visitor) { | ||
setCurrentIdentity(null); | ||
setCurrentContextMap(frame.contextMap); | ||
setCurrentContextStore(frame.contextStore); | ||
visitLoop(frame.children, frame.index, frame.map, frame.store, queue, visitor); | ||
}; | ||
@@ -849,13 +890,27 @@ // | ||
var prevDispatcher = ReactCurrentDispatcher.current; | ||
/** visitChildren walks all elements (depth-first) and while it walks the | ||
element tree some components will suspend and put a `Frame` onto | ||
the queue. Hence we recursively look at suspended components in | ||
this queue, wait for their promises to resolve, and continue | ||
calling visitChildren on their children. */ | ||
var flushFrames = function (queue, visitor) { | ||
if (queue.length === 0) { | ||
return Promise.resolve(); | ||
var updateWithFrame = function (frame, queue, visitor) { | ||
if (frame.kind === 'frame.yield') { | ||
var yieldFrame = frame; | ||
return new Promise(function (resolve) { | ||
setImmediate(function () { | ||
prevDispatcher = ReactCurrentDispatcher.current; | ||
ReactCurrentDispatcher.current = Dispatcher; | ||
resumeVisitChildren(yieldFrame, queue, visitor); | ||
ReactCurrentDispatcher.current = prevDispatcher; | ||
resolve(); | ||
}); | ||
}); | ||
} | ||
var frame = queue.shift(); | ||
return frame.thenable.then(function () { | ||
prevDispatcher = ReactCurrentDispatcher.current; | ||
ReactCurrentDispatcher.current = Dispatcher; | ||
var children = []; | ||
var children = []; // Update the component after we've suspended to rerender it, | ||
// at which point we'll actually get its children | ||
@@ -868,10 +923,19 @@ if (frame.kind === 'frame.class') { | ||
children = getChildrenArray(update(queue, frame)); | ||
} | ||
} // Now continue walking the previously suspended component's | ||
// children (which might also suspend) | ||
visitChildren(children, queue, visitor); | ||
ReactCurrentDispatcher.current = prevDispatcher; | ||
return flushFrames(queue, visitor); | ||
}); | ||
}; | ||
var flushFrames = function (queue, visitor) { | ||
if (queue.length === 0) { | ||
return Promise.resolve(); | ||
} | ||
return updateWithFrame(queue.shift(), queue, visitor).then(function () { return flushFrames(queue, visitor); }); | ||
}; | ||
var defaultVisitor = function () {}; | ||
@@ -881,3 +945,6 @@ | ||
var queue = []; | ||
var fn = visitor !== undefined ? visitor : defaultVisitor; | ||
var fn = visitor !== undefined ? visitor : defaultVisitor; // Context state is kept globally and is modified in-place. | ||
// Before we start walking the element tree we need to reset | ||
// its current state | ||
setCurrentContextMap({}); | ||
@@ -887,2 +954,5 @@ setCurrentContextStore(new Map()); | ||
try { | ||
// The "Dispatcher" is what handles hook calls and | ||
// a React internal that needs to be set to our | ||
// dispatcher and reset after we're done | ||
prevDispatcher = ReactCurrentDispatcher.current; | ||
@@ -889,0 +959,0 @@ ReactCurrentDispatcher.current = Dispatcher; |
@@ -1,2 +0,2 @@ | ||
function t(t){return t&&"object"==typeof t&&"default"in t?t.default:t}var e=require("react-is"),n=require("react"),r=t(n),u=t(require("object-is")),o=e.Element,i=e.Portal,c=e.Fragment,a=e.StrictMode,l=e.Profiler,f=e.ContextProvider,s=e.ContextConsumer,p=e.ConcurrentMode,d=e.ForwardRef,v=e.Suspense,y=e.Memo,h=e.Lazy,m=n.Children.toArray,x=function(t){return null!==t&&"object"==typeof t},_=function(t){return m(t).filter(x)},S=function(t,e){return"object"==typeof e?Object.assign({},e,t):t},g=new Map,b={},M=void 0,j=void 0,C=function(){return Object.assign({},b)},w=function(){return new Map(g)},z=function(t){M=void 0,b=t},E=function(t){j=void 0,g=t},k=function(t){var e=g.get(t);return void 0!==e?e:t._currentValue},q={},F=function(t){var e=t.contextType,n=t.contextTypes;if(e)return k(e);if(!n)return q;var r={};for(var u in n)r[u]=b[u];return r},O=null,P=function(t){O=t},R=function(){if(null===O)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 O},W=null,U=null,D=!1,N=!1,T=null,A=0,L=function(t){W=t};function I(){return null===U?null===W?(D=!1,W=U={memoizedState:null,queue:null,next:null}):(D=!0,U=W):null===U.next?(D=!1,U=U.next={memoizedState:null,queue:null,next:null}):(D=!0,U=U.next),U}function $(t,e){return"function"==typeof e?e(t):e}function H(t,e,n){var r,u=R();if(U=I(),D){var o=U.queue,i=o.dispatch;if(null!==T){var c=T.get(o);if(void 0!==c){T.delete(o);var a=U.memoizedState,l=c;do{a=t(a,l.action),l=l.next}while(null!==l);return U.memoizedState=a,[a,i]}}return[U.memoizedState,i]}r=t===$?"function"==typeof e?e():e:void 0!==n?n(e):e,U.memoizedState=r;var f=U.queue={last:null,dispatch:null},s=f.dispatch=function(t,e,n){if(t===R()){N=!0;var r={action:n,next:null};null===T&&(T=new Map);var u=T.get(e);if(void 0===u)T.set(e,r);else{for(var o=u;null!==o.next;)o=o.next;o.next=r}}}.bind(null,u,f);return[U.memoizedState,s]}function V(){}var B={readContext:function(t,e){return k(t)},useContext:function(t,e){return R(),k(t)},useMemo:function(t,e){R();var n=void 0===e?null:e;if(null!==(U=I())){var r=U.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 U.memoizedState=[o,n],o},useReducer:H,useRef:function(t){R();var e=(U=I()).memoizedState;if(null===e){var n={current:t};return U.memoizedState=n,n}return e},useState:function(t){return H($,t)},useCallback:function(t,e){return t},useLayoutEffect:V,useImperativeHandle:V,useEffect:V,useDebugValue:V},Y=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})},G=function(t,e,r){return 1===t._status?n.createElement(t._result,e):null},J=function(t,e,n){return{contextMap:C(),contextStore:w(),id:R(),hook:W,kind:"frame.hooks",thenable:n,props:e,type:t}},K=function(t,e,n){try{return function(t,e,n){for(var r=t(e,n);A<25&&N;)N=!1,A+=1,U=null,r=t(e,n);return A=0,T=null,U=null,r}(t,S(e,t.defaultProps),F(t))}catch(r){if("function"!=typeof r.then)throw r;return n.push(J(t,e,r)),null}finally{P(null)}},Q=function(t,e,n,r,u){if(L(null),P({}),void 0!==u){var o=r(u);if("object"==typeof o&&null!==o&&"function"==typeof o.then)return n.push(J(t,e,o)),null}return K(t,e,n)},X=function(t,e,n){return{contextMap:C(),contextStore:w(),thenable:n,kind:"frame.class",instance:e,type:t}},Z=function(t,e,n){!function(t){var e=t.updater.queue;if(e.length>0){for(var n=Object.assign({},t.state),r=0,u=e.length;r<u;r++){var o=e[r],i="function"==typeof o?o.call(t,n,t.props,t.context):o;null!==i&&Object.assign(n,i)}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(X(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 M={},t)M[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},tt=function(t,e,n,r,u){return(o=t).prototype&&o.prototype.isReactComponent?function(t,e,n,r,u){P(null);var o=function(t,e){var n,r={queue:n=[],isMounted:function(){return!1},enqueueForceUpdate:function(){return null},enqueueReplaceState:function(t,e){t._isMounted&&(n.length=0,n.push(e))},enqueueSetState:function(t,e){t._isMounted&&n.push(e)}},u=S(e,t.defaultProps),o=F(t),i=new t(u,o,r);if(i.props=u,i.context=o,i.updater=r,i._isMounted=!0,void 0===i.state&&(i.state=null),"function"==typeof t.getDerivedStateFromProps){var c=(0,t.getDerivedStateFromProps)(i.props,i.state);null!=c&&(i.state=Object.assign({},i.state,c))}else"function"==typeof i.componentWillMount?i.componentWillMount():"function"==typeof i.UNSAFE_componentWillMount&&i.UNSAFE_componentWillMount();return i}(t,e);if(void 0!==u){var i=r(u,o);if("object"==typeof i&&null!==i&&"function"==typeof i.then)return n.push(X(t,o,i)),null}return Z(t,o,n)}(t,e,n,r,u):Q(t,e,n,r,u);var o},et=function(t,e,n){var r,u=function(t,e,n){switch(function(t){switch(t.$$typeof){case i:return i;case o:switch(t.type){case p:return p;case c:return c;case l:return l;case a:return a;case v:return v;default:switch(t.type&&t.type.$$typeof){case h:return h;case y:return y;case s:return s;case f:return f;case d:return d;default:return o}}default:return}}(t)){case v:case a:case p:case l:case c:return _(t.props.children);case f:var r=t.props,u=r.children;return F=r.value,j=[q=t.type._context,g.get(q)],g.set(q,F),_(u);case s:var m=t.props.children;if("function"==typeof m){var x=t.type,S=k("object"==typeof x._context?x._context:x);return _(m(S))}return[];case h:var b=function(t,e,n){return 2!==t._status&&1!==t._status?(n.push({contextMap:C(),contextStore:w(),kind:"frame.lazy",thenable:Y(t),props:e,type:t}),null):G(t,e)}(t.type,t.props,e);return _(b);case y:var M=tt(t.type.type,t.props,e,n);return _(M);case d:var z=Q(t.type.render,t.props,e,n);return _(z);case o:if("string"==typeof t.type)return _(t.props.children);var E=tt(t.type,t.props,e,n,t);return _(E);case i:default:return[]}var q,F}(t,e,n),m=(r=M,M=void 0,r),x=function(){var t=j;return j=void 0,t}();nt(u,e,n),void 0!==m&&Object.assign(b,m),void 0!==x&&g.set(x[0],x[1])},nt=function(t,e,n){for(var r=0,u=t.length;r<u;r++)et(t[r],e,n)},rt=r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentDispatcher,ut=rt.current,ot=function(t,e){if(0===t.length)return Promise.resolve();var n=t.shift();return n.thenable.then(function(){ut=rt.current,rt.current=B;var r=[];return"frame.class"===n.kind?r=_(function(t,e){return P(null),z(e.contextMap),E(e.contextStore),Z(e.type,e.instance,t)}(t,n)):"frame.hooks"===n.kind?r=_(function(t,e){return L(e.hook),P(e.id),z(e.contextMap),E(e.contextStore),K(e.type,e.props,t)}(t,n)):"frame.lazy"===n.kind&&(r=_(function(t,e){return P(null),z(e.contextMap),E(e.contextStore),G(e.type,e.props)}(0,n))),nt(r,t,e),rt.current=ut,ot(t,e)})},it=function(){};module.exports=function(t,e){var n=[],r=void 0!==e?e:it;z({}),E(new Map);try{ut=rt.current,rt.current=B,nt(_(t),n,r)}catch(t){return Promise.reject(t)}finally{rt.current=ut}return ot(n,r)}; | ||
function t(t){return t&&"object"==typeof t&&"default"in t?t.default:t}var e=require("react-is"),n=require("react"),r=t(n),u=t(require("object-is")),o=e.Element,i=e.Portal,c=e.Fragment,a=e.StrictMode,l=e.Profiler,f=e.ContextProvider,s=e.ContextConsumer,p=e.ConcurrentMode,d=e.ForwardRef,v=e.Suspense,h=e.Memo,y=e.Lazy,m=n.Children.toArray,x=function(t){return null!==t&&"object"==typeof t},_=function(t){return m(t).filter(x)},S=function(t,e){return"object"==typeof e?Object.assign({},e,t):t},g=new Map,M={},b=void 0,w=void 0,C=function(){return Object.assign({},M)},j=function(){return new Map(g)},k=function(){var t=b;return b=void 0,t},E=function(){var t=w;return w=void 0,t},z=function(t){void 0!==t&&g.set(t[0],t[1])},q=function(t){b=void 0,M=t},P=function(t){w=void 0,g=t},D=function(t){var e=g.get(t);return void 0!==e?e:t._currentValue},F={},O=function(t){var e=t.contextType,n=t.contextTypes;if(e)return D(e);if(!n)return F;var r={};for(var u in n)r[u]=M[u];return r},R=null,W=function(t){R=t},U=function(){if(null===R)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 R},I=null,N=null,T=!1,A=!1,L=null,$=0,V=function(t){I=t};function H(){return null===N?null===I?(T=!1,I=N={memoizedState:null,queue:null,next:null}):(T=!0,N=I):null===N.next?(T=!1,N=N.next={memoizedState:null,queue:null,next:null}):(T=!0,N=N.next),N}function B(t,e){return"function"==typeof e?e(t):e}function Y(t,e,n){var r,u=U();if(N=H(),T){var o=N.queue,i=o.dispatch;if(null!==L){var c=L.get(o);if(void 0!==c){L.delete(o);var a=N.memoizedState,l=c;do{a=t(a,l.action),l=l.next}while(null!==l);return N.memoizedState=a,[a,i]}}return[N.memoizedState,i]}r=t===B?"function"==typeof e?e():e:void 0!==n?n(e):e,N.memoizedState=r;var f=N.queue={last:null,dispatch:null},s=f.dispatch=function(t,e,n){if(t===U()){A=!0;var r={action:n,next:null};null===L&&(L=new Map);var u=L.get(e);if(void 0===u)L.set(e,r);else{for(var o=u;null!==o.next;)o=o.next;o.next=r}}}.bind(null,u,f);return[N.memoizedState,s]}function G(){}var J={readContext:function(t,e){return D(t)},useContext:function(t,e){return U(),D(t)},useMemo:function(t,e){U();var n=void 0===e?null:e;if(null!==(N=H())){var r=N.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 N.memoizedState=[o,n],o},useReducer:Y,useRef:function(t){U();var e=(N=H()).memoizedState;if(null===e){var n={current:t};return N.memoizedState=n,n}return e},useState:function(t){return Y(B,t)},useCallback:function(t,e){return t},useLayoutEffect:G,useImperativeHandle:G,useEffect:G,useDebugValue:G},K=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})},Q=function(t,e,r){return 1===t._status?n.createElement(t._result,e):null},X=function(t,e,n){return{contextMap:C(),contextStore:j(),id:U(),hook:I,kind:"frame.hooks",thenable:n,props:e,type:t}},Z=function(t,e,n){try{return function(t,e,n){for(var r=t(e,n);$<25&&A;)A=!1,$+=1,N=null,r=t(e,n);return $=0,L=null,N=null,r}(t,S(e,t.defaultProps),O(t))}catch(r){if("function"!=typeof r.then)throw r;return n.push(X(t,e,r)),null}finally{W(null)}},tt=function(t,e,n,r,u){if(V(null),W({}),void 0!==u){var o=r(u);if("object"==typeof o&&null!==o&&"function"==typeof o.then)return n.push(X(t,e,o)),null}return Z(t,e,n)},et=function(t,e,n){return{contextMap:C(),contextStore:j(),thenable:n,kind:"frame.class",instance:e,type:t}},nt=function(t,e,n){!function(t){var e=t.updater.queue;if(e.length>0){for(var n=Object.assign({},t.state),r=0,u=e.length;r<u;r++){var o=e[r],i="function"==typeof o?o.call(t,n,t.props,t.context):o;null!==i&&Object.assign(n,i)}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(et(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 b={},t)b[e]=M[e],M[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},rt=__DEV__?20:5,ut=function(t,e,n,r,u){return(o=t).prototype&&o.prototype.isReactComponent?function(t,e,n,r,u){W(null);var o=function(t,e){var n,r={queue:n=[],isMounted:function(){return!1},enqueueForceUpdate:function(){return null},enqueueReplaceState:function(t,e){t._isMounted&&(n.length=0,n.push(e))},enqueueSetState:function(t,e){t._isMounted&&n.push(e)}},u=S(e,t.defaultProps),o=O(t),i=new t(u,o,r);if(i.props=u,i.context=o,i.updater=r,i._isMounted=!0,void 0===i.state&&(i.state=null),"function"==typeof t.getDerivedStateFromProps){var c=(0,t.getDerivedStateFromProps)(i.props,i.state);null!=c&&(i.state=Object.assign({},i.state,c))}else"function"==typeof i.componentWillMount?i.componentWillMount():"function"==typeof i.UNSAFE_componentWillMount&&i.UNSAFE_componentWillMount();return i}(t,e);if(void 0!==u){var i=r(u,o);if("object"==typeof i&&null!==i&&"function"==typeof i.then)return n.push(et(t,o,i)),null}return nt(t,o,n)}(t,e,n,r,u):tt(t,e,n,r,u);var o},ot=function(t,e,n){switch(function(t){switch(t.$$typeof){case i:return i;case o:switch(t.type){case p:return p;case c:return c;case l:return l;case a:return a;case v:return v;default:switch(t.type&&t.type.$$typeof){case y:return y;case h:return h;case s:return s;case f:return f;case d:return d;default:return o}}default:return}}(t)){case v:case a:case p:case l:case c:return _(t.props.children);case f:var r=t.props,u=r.children;return function(t,e){w=[t,g.get(t)],g.set(t,e)}(t.type._context,r.value),_(u);case s:var m=t.props.children;if("function"==typeof m){var x=t.type,S=D("object"==typeof x._context?x._context:x);return _(m(S))}return[];case y:var M=function(t,e,n){return 2!==t._status&&1!==t._status?(n.push({contextMap:C(),contextStore:j(),kind:"frame.lazy",thenable:K(t),props:e,type:t}),null):Q(t,e)}(t.type,t.props,e);return _(M);case h:var b=ut(t.type.type,t.props,e,n);return _(b);case d:var k=t;if("string"==typeof k.type.styledComponentId&&"function"!=typeof k.type.target)return _(k.props.children);var E=tt(k.type.render,k.props,e,n);return _(E);case o:if("string"==typeof t.type)return _(t.props.children);var z=ut(t.type,t.props,e,n,t);return _(z);case i:default:return[]}},it=function(t,e,n,r,u,o){for(var i,c=Date.now();t.length>0&&Date.now()-c<=rt;){var a=t[t.length-1],l=e[e.length-1]++;if(l<a.length){var f=ot(a[l],u,o);t.push(f),e.push(0),n.push(k()),r.push(E())}else t.pop(),e.pop(),void 0!==(i=n.pop())&&Object.assign(M,i),z(r.pop())}},ct=function(t,e,n){var r=[t],u=[0],o=[k()],i=[E()];it(r,u,o,i,e,n),r.length>0&&e.unshift({contextMap:C(),contextStore:j(),thenable:Promise.resolve(),kind:"frame.yield",children:r,index:u,map:o,store:i})},at=r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentDispatcher,lt=at.current,ft=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(){lt=at.current,at.current=J,function(t,e,n){W(null),q(t.contextMap),P(t.contextStore),it(t.children,t.index,t.map,t.store,e,n)}(r,e,n),at.current=lt,t()})})}return t.thenable.then(function(){lt=at.current,at.current=J;var r=[];"frame.class"===t.kind?r=_(function(t,e){return W(null),q(e.contextMap),P(e.contextStore),nt(e.type,e.instance,t)}(e,t)):"frame.hooks"===t.kind?r=_(function(t,e){return V(e.hook),W(e.id),q(e.contextMap),P(e.contextStore),Z(e.type,e.props,t)}(e,t)):"frame.lazy"===t.kind&&(r=_(function(t,e){return W(null),q(e.contextMap),P(e.contextStore),Q(e.type,e.props)}(0,t))),ct(r,e,n),at.current=lt})}(t.shift(),t,e).then(function(){return ft(t,e)})},st=function(){};module.exports=function(t,e){var n=[],r=void 0!==e?e:st;q({}),P(new Map);try{lt=at.current,at.current=J,ct(_(t),n,r)}catch(t){return Promise.reject(t)}finally{at.current=lt}return ft(n,r)}; | ||
//# sourceMappingURL=react-ssr-prepass.production.min.js.map |
{ | ||
"name": "react-ssr-prepass", | ||
"version": "1.0.2", | ||
"version": "1.0.3", | ||
"description": "A custom partial React SSR renderer for prefetching and suspense", | ||
"main": "index.js", | ||
"source": "src/index.js", | ||
"author": "Phil Plückthun <phil@kitten.sh>", | ||
"author": "Phil Plückthun <phil.pluckthun@formidable.com>", | ||
"license": "MIT", | ||
"repository": "git@github.com:FormidableLabs/react-ssr-prepass.git", | ||
"bugs": { | ||
"url": "https://github.com/kitten/react-ssr-prepass/issues" | ||
"url": "https://github.com/FormidableLabs/react-ssr-prepass/issues" | ||
}, | ||
@@ -37,2 +38,7 @@ "files": [ | ||
}, | ||
"jest": { | ||
"globals": { | ||
"__DEV__": true | ||
} | ||
}, | ||
"lint-staged": { | ||
@@ -63,3 +69,3 @@ "**/*.js": [ | ||
"@babel/preset-react": "^7.0.0", | ||
"coveralls": "^3.0.3", | ||
"codecov": "^3.2.0", | ||
"flow-bin": "^0.94.0", | ||
@@ -74,3 +80,4 @@ "husky": "^1.3.1", | ||
"react-dom": "^16.8.4", | ||
"react-is": "^16.8.4" | ||
"react-is": "^16.8.4", | ||
"styled-components": "^4.2.0" | ||
}, | ||
@@ -77,0 +84,0 @@ "dependencies": { |
# react-ssr-prepass | ||
<p> | ||
<a href="https://travis-ci.org/kitten/react-ssr-prepass"> | ||
<img alt="Build Status" src="https://travis-ci.org/kitten/react-ssr-prepass.svg?branch=master" /> | ||
<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> | ||
<a href="https://coveralls.io/github/kitten/react-ssr-prepass?branch=master"> | ||
<img alt="Test Coverage" src="https://coveralls.io/repos/github/kitten/react-ssr-prepass/badge.svg?branch=master" /> | ||
<a href="https://codecov.io/gh/FormidableLabs/react-ssr-prepass"> | ||
<img alt="Test Coverage" src="https://codecov.io/gh/FormidableLabs/react-ssr-prepass/branch/master/graph/badge.svg" /> | ||
</a> | ||
@@ -13,2 +13,5 @@ <a href="https://npmjs.com/package/react-ssr-prepass"> | ||
</a> | ||
<a href="https://github.com/FormidableLabs/react-ssr-prepass#maintenance-status"> | ||
<img alt="Maintenance Status" src="https://img.shields.io/badge/maintenance-experimental-blueviolet.svg" /> | ||
</a> | ||
</p> | ||
@@ -149,1 +152,5 @@ | ||
- [`react-tree-walker`](https://github.com/ctrlplusb/react-tree-walker) | ||
## Maintenance Status | ||
**Experimental:** This project is quite new. We're not sure what our ongoing maintenance plan for this project will be. Bug reports, feature requests and pull requests are welcome. If you like this project, let us know! |
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
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
99310
837
155
16