react-ssr-prepass
Advanced tools
Comparing version 1.0.0 to 1.0.1
@@ -102,34 +102,59 @@ function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; } | ||
// | ||
var emptyMap = new Map(); | ||
var currentIdentity = null; | ||
var currentContextMap = emptyMap; | ||
var makeIdentity = function () { return ({}); }; | ||
var setCurrentIdentity = function (id) { | ||
currentIdentity = id; | ||
}; | ||
var getCurrentIdentity = function () { | ||
if (currentIdentity === null) { | ||
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)'); | ||
} // NOTE: The warning that is used in ReactPartialRendererHooks is obsolete | ||
// in a prepass, since it'll be caught by a subsequent renderer anyway | ||
// https://github.com/facebook/react/blob/c21c41e/packages/react-dom/src/server/ReactPartialRendererHooks.js#L63-L71 | ||
return currentIdentity; | ||
/* The context is kept as a Map from a Context value to the current | ||
value on the React element tree. | ||
The legacy context is kept as a simple object. | ||
When the tree is being walked modifications are made by assigning | ||
new legacy context maps or new context values. | ||
These changes are kept in the `prev` variables and must be flushed | ||
before continuing to walk the tree. | ||
After walking the children they can be restored. | ||
This way the context recursively restores itself on the way up. */ | ||
var currentContextStore = new Map(); | ||
var currentContextMap = {}; | ||
var prevContextMap = undefined; | ||
var prevContextEntry = undefined; | ||
var getCurrentContextMap = function () { return Object.assign({}, currentContextMap); }; | ||
var getCurrentContextStore = function () { return new Map(currentContextStore); }; | ||
var flushPrevContextMap = function () { | ||
var prev = prevContextMap; | ||
prevContextMap = undefined; | ||
return prev; | ||
}; | ||
var clearCurrentContextMap = function () { | ||
currentContextMap = emptyMap; | ||
var flushPrevContextStore = function () { | ||
var prev = prevContextEntry; | ||
prevContextEntry = undefined; | ||
return prev; | ||
}; | ||
var restoreContextMap = function (prev) { | ||
Object.assign(currentContextMap, prev); | ||
}; | ||
var restoreContextStore = function (prev) { | ||
currentContextStore.set(prev[0], prev[1]); | ||
}; | ||
var setCurrentContextMap = function (map) { | ||
prevContextMap = undefined; | ||
currentContextMap = map; | ||
}; | ||
var getCurrentContextMap = function () { | ||
return currentContextMap; | ||
var setCurrentContextStore = function (store) { | ||
prevContextEntry = undefined; | ||
currentContextStore = store; | ||
}; | ||
var readContextMap = function (context) { | ||
if (currentContextMap.has(context)) { | ||
return currentContextMap.get(context); | ||
} else if (typeof context === 'string') { | ||
// A legacy context has no default value | ||
return undefined; | ||
var assignContextMap = function (map) { | ||
prevContextMap = {}; | ||
for (var name in map) { | ||
prevContextMap[name] = currentContextMap[name]; | ||
currentContextMap[name] = map[name]; | ||
} | ||
}; | ||
var setContextValue = function (context, value) { | ||
prevContextEntry = [context, currentContextStore.get(context)]; | ||
currentContextStore.set(context, value); | ||
}; | ||
var readContextValue = function (context) { | ||
var value = currentContextStore.get(context); | ||
if (value !== undefined) { | ||
return value; | ||
} // Return default if context has no value yet | ||
@@ -140,8 +165,2 @@ | ||
}; | ||
var forkContextMap = function () { | ||
// Create cloned ContextMap of currentContextMap | ||
var newContextMap = new Map(currentContextMap); | ||
setCurrentContextMap(newContextMap); | ||
return newContextMap; | ||
}; | ||
var emptyContext = {}; | ||
@@ -153,3 +172,3 @@ var maskContext = function (type) { | ||
if (contextType) { | ||
return readContextMap(contextType); | ||
return readContextValue(contextType); | ||
} else if (!contextTypes) { | ||
@@ -162,3 +181,3 @@ return emptyContext; | ||
for (var name in contextTypes) { | ||
maskedContext[name] = readContextMap(name); | ||
maskedContext[name] = currentContextMap[name]; | ||
} | ||
@@ -170,2 +189,17 @@ | ||
// | ||
var currentIdentity = null; | ||
var makeIdentity = function () { return ({}); }; | ||
var setCurrentIdentity = function (id) { | ||
currentIdentity = id; | ||
}; | ||
var getCurrentIdentity = function () { | ||
if (currentIdentity === null) { | ||
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)'); | ||
} // NOTE: The warning that is used in ReactPartialRendererHooks is obsolete | ||
// in a prepass, since it'll be caught by a subsequent renderer anyway | ||
// https://github.com/facebook/react/blob/c21c41e/packages/react-dom/src/server/ReactPartialRendererHooks.js#L63-L71 | ||
return currentIdentity; | ||
}; | ||
var firstWorkInProgressHook = null; | ||
@@ -265,3 +299,3 @@ var workInProgressHook = null; // Whether the work-in-progress hook is a re-rendered hook | ||
// https://github.com/facebook/react/blob/c21c41e/packages/react-dom/src/server/ReactPartialRendererHooks.js#L215-L223 | ||
return readContextMap(context); | ||
return readContextValue(context); | ||
} | ||
@@ -271,3 +305,3 @@ | ||
getCurrentIdentity(); | ||
return readContextMap(context); | ||
return readContextValue(context); | ||
} | ||
@@ -479,2 +513,3 @@ | ||
contextMap: getCurrentContextMap(), | ||
contextStore: getCurrentContextStore(), | ||
kind: 'frame.lazy', | ||
@@ -493,2 +528,3 @@ thenable: resolve(type), | ||
setCurrentContextMap(frame.contextMap); | ||
setCurrentContextStore(frame.contextStore); | ||
return render(frame.type, frame.props, queue); | ||
@@ -501,2 +537,3 @@ }; | ||
contextMap: getCurrentContextMap(), | ||
contextStore: getCurrentContextStore(), | ||
id: getCurrentIdentity(), | ||
@@ -548,2 +585,3 @@ hook: getFirstHook(), | ||
setCurrentContextMap(frame.contextMap); | ||
setCurrentContextStore(frame.contextStore); | ||
return render$1(frame.type, frame.props, queue); | ||
@@ -626,2 +664,3 @@ }; | ||
contextMap: getCurrentContextMap(), | ||
contextStore: getCurrentContextStore(), | ||
thenable: thenable, | ||
@@ -652,8 +691,4 @@ kind: 'frame.class', | ||
if (childContext) { | ||
var contextMap = forkContextMap(); | ||
for (var name in childContext) { | ||
contextMap.set(name, childContext[name]); | ||
} | ||
if (childContext !== null && typeof childContext === 'object') { | ||
assignContextMap(childContext); | ||
} | ||
@@ -694,2 +729,3 @@ } | ||
setCurrentContextMap(frame.contextMap); | ||
setCurrentContextStore(frame.contextStore); | ||
return render$2(frame.type, frame.instance, queue); | ||
@@ -723,7 +759,6 @@ }; | ||
var newContextMap = forkContextMap(); | ||
var ref = providerElement.props; | ||
var value = ref.value; | ||
var children = ref.children; | ||
newContextMap.set(providerElement.type._context, value); | ||
setContextValue(providerElement.type._context, value); | ||
return getChildrenArray(children); | ||
@@ -739,3 +774,3 @@ } | ||
if (typeof children$1 === 'function') { | ||
var value$1 = readContextMap(consumerElement.type._context); | ||
var value$1 = readContextValue(consumerElement.type._context); | ||
return getChildrenArray(children$1(value$1)); | ||
@@ -795,15 +830,25 @@ } else { | ||
}; | ||
var visitChildren = function (children, queue, visitor) { | ||
if (children.length === 1) { | ||
visitChildren(visitElement(children[0], queue, visitor), queue, visitor); | ||
} else if (children.length > 1) { | ||
var contextMap = getCurrentContextMap(); | ||
for (var i = 0, l = children.length; i < l; i++) { | ||
visitChildren(visitElement(children[i], queue, visitor), queue, visitor); | ||
setCurrentContextMap(contextMap); | ||
} | ||
var visitChild = function (child, queue, visitor) { | ||
var children = visitElement(child, queue, visitor); // Flush the context changes | ||
var prevMap = flushPrevContextMap(); | ||
var prevStore = flushPrevContextStore(); | ||
visitChildren(children, queue, visitor); // Restore context changes after children have been walked | ||
if (prevMap !== undefined) { | ||
restoreContextMap(prevMap); | ||
} | ||
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); | ||
} | ||
}; | ||
// | ||
@@ -844,3 +889,4 @@ var ref = React__default.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED; | ||
var fn = visitor !== undefined ? visitor : defaultVisitor; | ||
clearCurrentContextMap(); | ||
setCurrentContextMap({}); | ||
setCurrentContextStore(new Map()); | ||
@@ -847,0 +893,0 @@ try { |
@@ -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,l=e.Fragment,a=e.StrictMode,c=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,_=function(t){return null!==t&&"object"==typeof t},x=function(t){return m(t).filter(_)},g=function(t,e){return"object"==typeof e?Object.assign({},e,t):t},S=new Map,M=null,b=S,C=function(t){M=t},w=function(){if(null===M)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 M},z=function(t){b=t},E=function(){return b},k=function(t){return b.has(t)?b.get(t):"string"!=typeof t?t._currentValue:void 0},j=function(){var t=new Map(b);return z(t),t},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]=k(u);return r},P=null,R=null,W=!1,O=!1,U=null,D=0,N=function(t){P=t};function T(){return null===R?null===P?(W=!1,P=R={memoizedState:null,queue:null,next:null}):(W=!0,R=P):null===R.next?(W=!1,R=R.next={memoizedState:null,queue:null,next:null}):(W=!0,R=R.next),R}function A(t,e){return"function"==typeof e?e(t):e}function L(t,e,n){var r,u=w();if(R=T(),W){var o=R.queue,i=o.dispatch;if(null!==U){var l=U.get(o);if(void 0!==l){U.delete(o);var a=R.memoizedState,c=l;do{a=t(a,c.action),c=c.next}while(null!==c);return R.memoizedState=a,[a,i]}}return[R.memoizedState,i]}r=t===A?"function"==typeof e?e():e:void 0!==n?n(e):e,R.memoizedState=r;var f=R.queue={last:null,dispatch:null},s=f.dispatch=function(t,e,n){if(t===w()){O=!0;var r={action:n,next:null};null===U&&(U=new Map);var u=U.get(e);if(void 0===u)U.set(e,r);else{for(var o=u;null!==o.next;)o=o.next;o.next=r}}}.bind(null,u,f);return[R.memoizedState,s]}function I(){}var $={readContext:function(t,e){return k(t)},useContext:function(t,e){return w(),k(t)},useMemo:function(t,e){w();var n=void 0===e?null:e;if(null!==(R=T())){var r=R.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 R.memoizedState=[o,n],o},useReducer:L,useRef:function(t){w();var e=(R=T()).memoizedState;if(null===e){var n={current:t};return R.memoizedState=n,n}return e},useState:function(t){return L(A,t)},useCallback:function(t,e){return t},useLayoutEffect:I,useImperativeHandle:I,useEffect:I,useDebugValue:I},H=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})},V=function(t,e,r){return 1===t._status?n.createElement(t._result,e):null},B=function(t,e,n){return{contextMap:E(),id:w(),hook:P,kind:"frame.hooks",thenable:n,props:e,type:t}},Y=function(t,e,n){try{return function(t,e,n){for(var r=t(e,n);D<25&&O;)O=!1,D+=1,R=null,r=t(e,n);return D=0,U=null,R=null,r}(t,g(e,t.defaultProps),F(t))}catch(r){if("function"!=typeof r.then)throw r;return n.push(B(t,e,r)),null}finally{C(null)}},G=function(t,e,n,r,u){if(N(null),C({}),void 0!==u){var o=r(u);if("object"==typeof o&&null!==o&&"function"==typeof o.then)return n.push(B(t,e,o)),null}return Y(t,e,n)},J=function(t,e,n){return{contextMap:E(),thenable:n,kind:"frame.class",instance:e,type:t}},K=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(J(t,e,r)),null}if(void 0!==t.childContextTypes&&"function"==typeof e.getChildContext){var u=e.getChildContext();if(u){var o=j();for(var i in u)o.set(i,u[i])}}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},Q=function(t,e,n,r,u){return(o=t).prototype&&o.prototype.isReactComponent?function(t,e,n,r,u){C(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=g(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 l=(0,t.getDerivedStateFromProps)(i.props,i.state);null!=l&&(i.state=Object.assign({},i.state,l))}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(J(t,o,i)),null}return K(t,o,n)}(t,e,n,r,u):G(t,e,n,r,u);var o},X=function(t,e,n){switch(function(t){switch(t.$$typeof){case i:return i;case o:switch(t.type){case p:return p;case l:return l;case c:return c;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 c:case l:return x(t.props.children);case f:var r=t,u=j(),m=r.props,_=m.children;return u.set(r.type._context,m.value),x(_);case s:var g=t.props.children;if("function"==typeof g){var S=k(t.type._context);return x(g(S))}return[];case h:var M=function(t,e,n){return 2!==t._status&&1!==t._status?(n.push({contextMap:E(),kind:"frame.lazy",thenable:H(t),props:e,type:t}),null):V(t,e)}(t.type,t.props,e);return x(M);case y:var b=Q(t.type.type,t.props,e,n);return x(b);case d:var C=G(t.type.render,t.props,e,n);return x(C);case o:if("string"==typeof t.type)return x(t.props.children);var w=Q(t.type,t.props,e,n,t);return x(w);case i:default:return[]}},Z=function(t,e,n){if(1===t.length)Z(X(t[0],e,n),e,n);else if(t.length>1)for(var r=E(),u=0,o=t.length;u<o;u++)Z(X(t[u],e,n),e,n),z(r)},tt=r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentDispatcher,et=tt.current,nt=function(t,e){if(0===t.length)return Promise.resolve();var n=t.shift();return n.thenable.then(function(){et=tt.current,tt.current=$;var r=[];return"frame.class"===n.kind?r=x(function(t,e){return C(null),z(e.contextMap),K(e.type,e.instance,t)}(t,n)):"frame.hooks"===n.kind?r=x(function(t,e){return N(e.hook),C(e.id),z(e.contextMap),Y(e.type,e.props,t)}(t,n)):"frame.lazy"===n.kind&&(r=x(function(t,e){return C(null),z(e.contextMap),V(e.type,e.props)}(0,n))),Z(r,t,e),tt.current=et,nt(t,e)})},rt=function(){};module.exports=function(t,e){var n=[],r=void 0!==e?e:rt;b=S;try{et=tt.current,tt.current=$,Z(x(t),n,r)}catch(t){return Promise.reject(t)}finally{tt.current=et}return nt(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,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,M={},b=void 0,C=void 0,j=function(){return Object.assign({},M)},w=function(){return new Map(g)},z=function(t){b=void 0,M=t},E=function(t){C=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]=M[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:j(),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:j(),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 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},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 q=r.value,C=[E=t.type._context,g.get(E)],g.set(E,q),_(u);case s:var m=t.props.children;if("function"==typeof m){var x=k(t.type._context);return _(m(x))}return[];case h:var S=function(t,e,n){return 2!==t._status&&1!==t._status?(n.push({contextMap:j(),contextStore:w(),kind:"frame.lazy",thenable:Y(t),props:e,type:t}),null):G(t,e)}(t.type,t.props,e);return _(S);case y:var M=tt(t.type.type,t.props,e,n);return _(M);case d:var b=Q(t.type.render,t.props,e,n);return _(b);case o:if("string"==typeof t.type)return _(t.props.children);var z=tt(t.type,t.props,e,n,t);return _(z);case i:default:return[]}var E,q}(t,e,n),m=(r=b,b=void 0,r),x=function(){var t=C;return C=void 0,t}();nt(u,e,n),void 0!==m&&Object.assign(M,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)}; | ||
//# sourceMappingURL=react-ssr-prepass.production.min.js.map |
{ | ||
"name": "react-ssr-prepass", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "A custom partial React SSR renderer for prefetching and suspense", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
96008
9
767