use-sync-external-store
Advanced tools
Comparing version 0.0.0-experimental-05726d72c-20210927 to 0.0.0-experimental-0883c4cd3-20210929
@@ -44,6 +44,7 @@ /** @license React vundefined | ||
args = args.concat([stack]); | ||
} | ||
} // eslint-disable-next-line react-internal/safe-string-coercion | ||
var argsWithFormat = args.map(function (item) { | ||
return '' + item; | ||
return String(item); | ||
}); // Careful: RN currently depends on this prefix | ||
@@ -75,8 +76,3 @@ | ||
useLayoutEffect = React.useLayoutEffect, | ||
useDebugValue = React.useDebugValue, | ||
builtInAPI = React.unstable_useSyncExternalStore; // Prefer the built-in API, if it exists. If it doesn't exist, then we assume | ||
// we're in version 16 or 17, so rendering is always synchronous. The shim | ||
// does not support concurrent rendering, only the built-in API. | ||
var useSyncExternalStore = builtInAPI !== undefined ? builtInAPI : useSyncExternalStore_client; | ||
useDebugValue = React.useDebugValue; | ||
var didWarnOld18Alpha = false; | ||
@@ -94,3 +90,3 @@ var didWarnUncachedGetSnapshot = false; // Disclaimer: This shim breaks many of the rules of React, and only works | ||
function useSyncExternalStore_client(subscribe, getSnapshot, // Note: The client shim does not use getServerSnapshot, because pre-18 | ||
function useSyncExternalStore(subscribe, getSnapshot, // Note: The client shim does not use getServerSnapshot, because pre-18 | ||
// versions of React do not expose a way to check if we're hydrating. So | ||
@@ -211,14 +207,7 @@ // users of the shim will need to track that themselves and return the | ||
function useSyncExternalStore$1(subscribe, getSnapshot, getServerSnapshot) { | ||
if (getServerSnapshot === undefined) { | ||
{ | ||
{ | ||
throw Error( "Missing getServerSnapshot, which is required for server-rendered content." ); | ||
} | ||
} | ||
} | ||
return getServerSnapshot(); | ||
return getSnapshot(); | ||
} | ||
var useSyncExternalStore$2 = canUseDOM ? useSyncExternalStore : useSyncExternalStore$1; | ||
var builtInAPI = React.unstable_useSyncExternalStore; | ||
var useSyncExternalStore$2 = builtInAPI !== undefined ? builtInAPI : canUseDOM ? useSyncExternalStore : useSyncExternalStore$1; | ||
@@ -225,0 +214,0 @@ exports.useSyncExternalStore = useSyncExternalStore$2; |
@@ -42,6 +42,7 @@ /** @license React vundefined | ||
args = args.concat([stack]); | ||
} | ||
} // eslint-disable-next-line react-internal/safe-string-coercion | ||
var argsWithFormat = args.map(function (item) { | ||
return '' + item; | ||
return String(item); | ||
}); // Careful: RN currently depends on this prefix | ||
@@ -73,8 +74,3 @@ | ||
useLayoutEffect = React.useLayoutEffect, | ||
useDebugValue = React.useDebugValue, | ||
builtInAPI = React.unstable_useSyncExternalStore; // Prefer the built-in API, if it exists. If it doesn't exist, then we assume | ||
// we're in version 16 or 17, so rendering is always synchronous. The shim | ||
// does not support concurrent rendering, only the built-in API. | ||
var useSyncExternalStore = builtInAPI !== undefined ? builtInAPI : useSyncExternalStore_client; | ||
useDebugValue = React.useDebugValue; | ||
var didWarnOld18Alpha = false; | ||
@@ -92,3 +88,3 @@ var didWarnUncachedGetSnapshot = false; // Disclaimer: This shim breaks many of the rules of React, and only works | ||
function useSyncExternalStore_client(subscribe, getSnapshot, // Note: The client shim does not use getServerSnapshot, because pre-18 | ||
function useSyncExternalStore(subscribe, getSnapshot, // Note: The client shim does not use getServerSnapshot, because pre-18 | ||
// versions of React do not expose a way to check if we're hydrating. So | ||
@@ -95,0 +91,0 @@ // users of the shim will need to track that themselves and return the |
@@ -9,3 +9,3 @@ /** @license React vundefined | ||
*/ | ||
'use strict';var e=require("react");function h(a,b){return a===b&&(0!==a||1/a===1/b)||a!==a&&b!==b}var k="function"===typeof Object.is?Object.is:h,l=e.useState,m=e.useEffect,n=e.useLayoutEffect,p=e.useDebugValue,q=e.unstable_useSyncExternalStore;function r(a,b){var d=b(),f=l({inst:{value:d,getSnapshot:b}}),c=f[0].inst,g=f[1];n(function(){c.value=d;c.getSnapshot=b;t(c)&&g({inst:c})},[a,d,b]);m(function(){t(c)&&g({inst:c});return a(function(){t(c)&&g({inst:c})})},[a]);p(d);return d} | ||
function t(a){var b=a.getSnapshot;a=a.value;try{var d=b();return!k(a,d)}catch(f){return!0}}exports.useSyncExternalStore=void 0!==q?q:r; | ||
'use strict';var e=require("react");function f(a,b){return a===b&&(0!==a||1/a===1/b)||a!==a&&b!==b}var k="function"===typeof Object.is?Object.is:f,l=e.useState,m=e.useEffect,n=e.useLayoutEffect,p=e.useDebugValue;function q(a){var b=a.getSnapshot;a=a.value;try{var d=b();return!k(a,d)}catch(g){return!0}} | ||
exports.useSyncExternalStore=function(a,b){var d=b(),g=l({inst:{value:d,getSnapshot:b}}),c=g[0].inst,h=g[1];n(function(){c.value=d;c.getSnapshot=b;q(c)&&h({inst:c})},[a,d,b]);m(function(){q(c)&&h({inst:c});return a(function(){q(c)&&h({inst:c})})},[a]);p(d);return d}; |
@@ -9,5 +9,3 @@ /** @license React vundefined | ||
*/ | ||
'use strict';var e=require("react");function h(a,b){return a===b&&(0!==a||1/a===1/b)||a!==a&&b!==b}var k="function"===typeof Object.is?Object.is:h,l=e.useState,m=e.useEffect,n=e.useLayoutEffect,p=e.useDebugValue,q=e.unstable_useSyncExternalStore,t=void 0!==q?q:r; | ||
function r(a,b){var c=b(),f=l({inst:{value:c,getSnapshot:b}}),d=f[0].inst,g=f[1];n(function(){d.value=c;d.getSnapshot=b;u(d)&&g({inst:d})},[a,c,b]);m(function(){u(d)&&g({inst:d});return a(function(){u(d)&&g({inst:d})})},[a]);p(c);return c}function u(a){var b=a.getSnapshot;a=a.value;try{var c=b();return!k(a,c)}catch(f){return!0}} | ||
function v(a){for(var b="https://reactjs.org/docs/error-decoder.html?invariant="+a,c=1;c<arguments.length;c++)b+="&args[]="+encodeURIComponent(arguments[c]);return"Minified React error #"+a+"; visit "+b+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function w(a,b,c){if(void 0===c)throw Error(v(408));return c()} | ||
exports.useSyncExternalStore="undefined"!==typeof window&&"undefined"!==typeof window.document&&"undefined"!==typeof window.document.createElement?t:w; | ||
'use strict';var e=require("react"),h=!("undefined"===typeof window||"undefined"===typeof window.document||"undefined"===typeof window.document.createElement);function k(a,b){return a===b&&(0!==a||1/a===1/b)||a!==a&&b!==b}var l="function"===typeof Object.is?Object.is:k,m=e.useState,n=e.useEffect,p=e.useLayoutEffect,q=e.useDebugValue; | ||
function r(a,b){var d=b(),f=m({inst:{value:d,getSnapshot:b}}),c=f[0].inst,g=f[1];p(function(){c.value=d;c.getSnapshot=b;t(c)&&g({inst:c})},[a,d,b]);n(function(){t(c)&&g({inst:c});return a(function(){t(c)&&g({inst:c})})},[a]);q(d);return d}function t(a){var b=a.getSnapshot;a=a.value;try{var d=b();return!l(a,d)}catch(f){return!0}}function u(a,b){return b()}var v=e.unstable_useSyncExternalStore;exports.useSyncExternalStore=void 0!==v?v:h?r:u; |
{ | ||
"name": "use-sync-external-store", | ||
"description": "Backwards compatible shim for React's useSyncExternalStore. Works with any React that supports hooks.", | ||
"version": "0.0.0-experimental-05726d72c-20210927", | ||
"version": "0.0.0-experimental-0883c4cd3-20210929", | ||
"repository": { | ||
@@ -21,4 +21,4 @@ "type": "git", | ||
"peerDependencies": { | ||
"react": "0.0.0-experimental-05726d72c-20210927" | ||
"react": "0.0.0-experimental-0883c4cd3-20210929" | ||
} | ||
} |
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 2 instances in 1 package
4
25213
516