Socket
Socket
Sign inDemoInstall

use-sync-external-store

Package Overview
Dependencies
1
Maintainers
1
Versions
1243
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.0.0-experimental-79b8fc667-20210920 to 0.0.0-experimental-7d38e4fd8-20210930

cjs/use-sync-external-store.native.development.js

45

cjs/use-sync-external-store.development.js

@@ -18,2 +18,4 @@ /** @license React vundefined

var canUseDOM = !!(typeof window !== 'undefined' && typeof window.document !== 'undefined' && typeof window.document.createElement !== 'undefined');
var ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;

@@ -43,6 +45,7 @@

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

@@ -69,4 +72,2 @@

var canUseDOM = !!(typeof window !== 'undefined' && typeof window.document !== 'undefined' && typeof window.document.createElement !== 'undefined');
// dispatch for CommonJS interop named imports.

@@ -77,25 +78,5 @@

useLayoutEffect = React.useLayoutEffect,
useDebugValue = React.useDebugValue,
builtInAPI = React.unstable_useSyncExternalStore; // TODO: This heuristic doesn't work in React Native. We'll need to provide a
// special build, using the `.native` extension.
var isServerEnvironment = !canUseDOM; // 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 : isServerEnvironment ? useSyncExternalStore_server : useSyncExternalStore_client;
useDebugValue = React.useDebugValue;
var didWarnOld18Alpha = false;
var didWarnUncachedGetSnapshot = false;
function useSyncExternalStore_server(subscribe, getSnapshot, getServerSnapshot) {
if (getServerSnapshot === undefined) {
{
{
throw Error( "Missing getServerSnapshot, which is required for server-rendered content." );
}
}
}
return getServerSnapshot();
} // Disclaimer: This shim breaks many of the rules of React, and only works
var didWarnUncachedGetSnapshot = false; // Disclaimer: This shim breaks many of the rules of React, and only works
// because of a very particular set of implementation details and assumptions

@@ -111,4 +92,3 @@ // -- change any one of them and it will break. The most important assumption

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

@@ -228,4 +208,11 @@ // users of the shim will need to track that themselves and return the

exports.useSyncExternalStore = useSyncExternalStore;
function useSyncExternalStore$1(subscribe, getSnapshot, getServerSnapshot) {
return getSnapshot();
}
var builtInAPI = React.unstable_useSyncExternalStore;
var useSyncExternalStore$2 = builtInAPI !== undefined ? builtInAPI : canUseDOM ? useSyncExternalStore : useSyncExternalStore$1;
exports.useSyncExternalStore = useSyncExternalStore$2;
})();
}

@@ -9,4 +9,3 @@ /** @license React vundefined

*/
'use strict';var e=require("react");function h(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 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,r=e.unstable_useSyncExternalStore,t=!("undefined"!==typeof window&&"undefined"!==typeof window.document&&"undefined"!==typeof window.document.createElement);function u(a,b,c){if(void 0===c)throw Error(h(408));return c()}
function v(a,b){var c=b(),f=m({inst:{value:c,getSnapshot:b}}),d=f[0].inst,g=f[1];p(function(){d.value=c;d.getSnapshot=b;w(d)&&g({inst:d})},[a,c,b]);n(function(){w(d)&&g({inst:d});return a(function(){w(d)&&g({inst:d})})},[a]);q(c);return c}function w(a){var b=a.getSnapshot;a=a.value;try{var c=b();return!l(a,c)}catch(f){return!0}}exports.useSyncExternalStore=void 0!==r?r:t?u:v;
'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-79b8fc667-20210920",
"version": "0.0.0-experimental-7d38e4fd8-20210930",
"repository": {

@@ -16,2 +16,3 @@ "type": "git",

"extra.js",
"index.native.js",
"cjs/"

@@ -21,4 +22,4 @@ ],

"peerDependencies": {
"react": "0.0.0-experimental-79b8fc667-20210920"
"react": "0.0.0-experimental-7d38e4fd8-20210930"
}
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc