New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

use-sync-external-store

Package Overview
Dependencies
Maintainers
3
Versions
1553
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

use-sync-external-store - npm Package Compare versions

Comparing version 0.0.0-experimental-17806594c-20220301 to 0.0.0-experimental-178c267a4e-20241218

cjs/use-sync-external-store-shim.native.production.js

13

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

@@ -5,3 +5,3 @@ /**

*
* Copyright (c) Facebook, Inc. and its affiliates.
* Copyright (c) Meta Platforms, Inc. and affiliates.
*

@@ -77,3 +77,4 @@ * This source code is licensed under the MIT license found in the

var objectIs = typeof Object.is === 'function' ? Object.is : is;
var objectIs = // $FlowFixMe[method-unbinding]
typeof Object.is === 'function' ? Object.is : is;

@@ -98,3 +99,3 @@ // dispatch for CommonJS interop named imports.

function useSyncExternalStore(subscribe, getSnapshot, // Note: The shim does not use getServerSnapshot, because pre-18 versions of
function useSyncExternalStore$2(subscribe, getSnapshot, // Note: The shim does not use getServerSnapshot, because pre-18 versions of
// React do not expose a way to check if we're hydrating. So users of the shim

@@ -228,6 +229,6 @@ // will need to track that themselves and return the correct value

var shim = isServerEnvironment ? useSyncExternalStore$1 : useSyncExternalStore;
var useSyncExternalStore$2 = React.useSyncExternalStore !== undefined ? React.useSyncExternalStore : shim;
var shim = isServerEnvironment ? useSyncExternalStore$1 : useSyncExternalStore$2;
var useSyncExternalStore = React.useSyncExternalStore !== undefined ? React.useSyncExternalStore : shim;
exports.useSyncExternalStore = useSyncExternalStore$2;
exports.useSyncExternalStore = useSyncExternalStore;
/* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */

@@ -234,0 +235,0 @@ if (

@@ -5,3 +5,3 @@ /**

*
* Copyright (c) Facebook, Inc. and its affiliates.
* Copyright (c) Meta Platforms, Inc. and affiliates.
*

@@ -77,3 +77,4 @@ * This source code is licensed under the MIT license found in the

var objectIs = typeof Object.is === 'function' ? Object.is : is;
var objectIs = // $FlowFixMe[method-unbinding]
typeof Object.is === 'function' ? Object.is : is;

@@ -98,3 +99,3 @@ // dispatch for CommonJS interop named imports.

function useSyncExternalStore(subscribe, getSnapshot, // Note: The shim does not use getServerSnapshot, because pre-18 versions of
function useSyncExternalStore$1(subscribe, getSnapshot, // Note: The shim does not use getServerSnapshot, because pre-18 versions of
// React do not expose a way to check if we're hydrating. So users of the shim

@@ -216,6 +217,6 @@ // will need to track that themselves and return the correct value

var shim = useSyncExternalStore;
var useSyncExternalStore$1 = React.useSyncExternalStore !== undefined ? React.useSyncExternalStore : shim;
var shim = useSyncExternalStore$1;
var useSyncExternalStore = React.useSyncExternalStore !== undefined ? React.useSyncExternalStore : shim;
exports.useSyncExternalStore = useSyncExternalStore$1;
exports.useSyncExternalStore = useSyncExternalStore;
/* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */

@@ -222,0 +223,0 @@ if (

@@ -1,11 +0,13 @@

/**
* @license React
* use-sync-external-store-shim.native.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
/*
React
use-sync-external-store-shim.native.production.min.js
Copyright (c) Meta Platforms, Inc. and affiliates.
This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
*/
'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;function q(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;r(c)&&g({inst:c})},[a,d,b]);m(function(){r(c)&&g({inst:c});return a(function(){r(c)&&g({inst:c})})},[a]);p(d);return d}
function r(a){var b=a.getSnapshot;a=a.value;try{var d=b();return!k(a,d)}catch(f){return!0}}exports.useSyncExternalStore=void 0!==e.useSyncExternalStore?e.useSyncExternalStore:q;
//# sourceMappingURL=use-sync-external-store-shim.native.production.min.js.map

@@ -1,11 +0,13 @@

/**
* @license React
* use-sync-external-store-shim.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
/*
React
use-sync-external-store-shim.production.min.js
Copyright (c) Meta Platforms, Inc. and affiliates.
This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
*/
'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;function q(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;r(c)&&g({inst:c})},[a,d,b]);m(function(){r(c)&&g({inst:c});return a(function(){r(c)&&g({inst:c})})},[a]);p(d);return d}
function r(a){var b=a.getSnapshot;a=a.value;try{var d=b();return!k(a,d)}catch(f){return!0}}function t(a,b){return b()}var u="undefined"===typeof window||"undefined"===typeof window.document||"undefined"===typeof window.document.createElement?t:q;exports.useSyncExternalStore=void 0!==e.useSyncExternalStore?e.useSyncExternalStore:u;
//# sourceMappingURL=use-sync-external-store-shim.production.min.js.map

@@ -5,3 +5,3 @@ /**

*
* Copyright (c) Facebook, Inc. and its affiliates.
* Copyright (c) Meta Platforms, Inc. and affiliates.
*

@@ -39,3 +39,4 @@ * This source code is licensed under the MIT license found in the

var objectIs = typeof Object.is === 'function' ? Object.is : is;
var objectIs = // $FlowFixMe[method-unbinding]
typeof Object.is === 'function' ? Object.is : is;

@@ -149,3 +150,5 @@ var useSyncExternalStore = shim.useSyncExternalStore;

useEffect(function () {
inst.hasValue = true;
// $FlowFixMe[incompatible-type] changing the variant using mutation isn't supported
inst.hasValue = true; // $FlowFixMe[incompatible-type]
inst.value = value;

@@ -152,0 +155,0 @@ }, [value]);

@@ -1,12 +0,14 @@

/**
* @license React
* use-sync-external-store-shim/with-selector.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
'use strict';var h=require("react"),n=require("use-sync-external-store/shim");function p(a,b){return a===b&&(0!==a||1/a===1/b)||a!==a&&b!==b}var q="function"===typeof Object.is?Object.is:p,r=n.useSyncExternalStore,t=h.useRef,u=h.useEffect,v=h.useMemo,w=h.useDebugValue;
exports.useSyncExternalStoreWithSelector=function(a,b,e,l,g){var c=t(null);if(null===c.current){var f={hasValue:!1,value:null};c.current=f}else f=c.current;c=v(function(){function a(a){if(!c){c=!0;d=a;a=l(a);if(void 0!==g&&f.hasValue){var b=f.value;if(g(b,a))return k=b}return k=a}b=k;if(q(d,a))return b;var e=l(a);if(void 0!==g&&g(b,e))return b;d=a;return k=e}var c=!1,d,k,m=void 0===e?null:e;return[function(){return a(b())},null===m?void 0:function(){return a(m())}]},[b,e,l,g]);var d=r(a,c[0],c[1]);
u(function(){f.hasValue=!0;f.value=d},[d]);w(d);return d};
/*
React
use-sync-external-store-shim/with-selector.production.min.js
Copyright (c) Meta Platforms, Inc. and affiliates.
This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
*/
'use strict';var h=require("react"),v=require("use-sync-external-store/shim");function w(b,c){return b===c&&(0!==b||1/b===1/c)||b!==b&&c!==c}var x="function"===typeof Object.is?Object.is:w,y=v.useSyncExternalStore,z=h.useRef,A=h.useEffect,B=h.useMemo,C=h.useDebugValue;
exports.useSyncExternalStoreWithSelector=function(b,c,m,n,g){var d=z(null);if(null===d.current){var e={hasValue:!1,value:null};d.current=e}else e=d.current;d=B(function(){function q(a){if(!r){r=!0;p=a;a=n(a);if(void 0!==g&&e.hasValue){var f=e.value;if(g(f,a))return k=f}return k=a}f=k;if(x(p,a))return f;var t=n(a);if(void 0!==g&&g(f,t))return f;p=a;return k=t}var r=!1,p,k,u=void 0===m?null:m;return[function(){return q(c())},null===u?void 0:function(){return q(u())}]},[c,m,n,g]);var l=y(b,d[0],d[1]);
A(function(){e.hasValue=!0;e.value=l},[l]);C(l);return l};
//# sourceMappingURL=with-selector.production.min.js.map

@@ -5,3 +5,3 @@ /**

*
* Copyright (c) Facebook, Inc. and its affiliates.
* Copyright (c) Meta Platforms, Inc. and affiliates.
*

@@ -38,3 +38,4 @@ * This source code is licensed under the MIT license found in the

var objectIs = typeof Object.is === 'function' ? Object.is : is;
var objectIs = // $FlowFixMe[method-unbinding]
typeof Object.is === 'function' ? Object.is : is;

@@ -148,3 +149,5 @@ var useSyncExternalStore = React.useSyncExternalStore;

useEffect(function () {
inst.hasValue = true;
// $FlowFixMe[incompatible-type] changing the variant using mutation isn't supported
inst.hasValue = true; // $FlowFixMe[incompatible-type]
inst.value = value;

@@ -151,0 +154,0 @@ }, [value]);

@@ -1,12 +0,14 @@

/**
* @license React
* use-sync-external-store-with-selector.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
'use strict';var g=require("react");function n(a,b){return a===b&&(0!==a||1/a===1/b)||a!==a&&b!==b}var p="function"===typeof Object.is?Object.is:n,q=g.useSyncExternalStore,r=g.useRef,t=g.useEffect,u=g.useMemo,v=g.useDebugValue;
exports.useSyncExternalStoreWithSelector=function(a,b,e,l,h){var c=r(null);if(null===c.current){var f={hasValue:!1,value:null};c.current=f}else f=c.current;c=u(function(){function a(a){if(!c){c=!0;d=a;a=l(a);if(void 0!==h&&f.hasValue){var b=f.value;if(h(b,a))return k=b}return k=a}b=k;if(p(d,a))return b;var e=l(a);if(void 0!==h&&h(b,e))return b;d=a;return k=e}var c=!1,d,k,m=void 0===e?null:e;return[function(){return a(b())},null===m?void 0:function(){return a(m())}]},[b,e,l,h]);var d=q(a,c[0],c[1]);
t(function(){f.hasValue=!0;f.value=d},[d]);v(d);return d};
/*
React
use-sync-external-store-with-selector.production.min.js
Copyright (c) Meta Platforms, Inc. and affiliates.
This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
*/
'use strict';var g=require("react");function v(b,c){return b===c&&(0!==b||1/b===1/c)||b!==b&&c!==c}var w="function"===typeof Object.is?Object.is:v,x=g.useSyncExternalStore,y=g.useRef,z=g.useEffect,A=g.useMemo,B=g.useDebugValue;
exports.useSyncExternalStoreWithSelector=function(b,c,m,n,h){var d=y(null);if(null===d.current){var e={hasValue:!1,value:null};d.current=e}else e=d.current;d=A(function(){function q(a){if(!r){r=!0;p=a;a=n(a);if(void 0!==h&&e.hasValue){var f=e.value;if(h(f,a))return k=f}return k=a}f=k;if(w(p,a))return f;var t=n(a);if(void 0!==h&&h(f,t))return f;p=a;return k=t}var r=!1,p,k,u=void 0===m?null:m;return[function(){return q(c())},null===u?void 0:function(){return q(u())}]},[c,m,n,h]);var l=x(b,d[0],d[1]);
z(function(){e.hasValue=!0;e.value=l},[l]);B(l);return l};
//# sourceMappingURL=use-sync-external-store-with-selector.production.min.js.map

@@ -5,3 +5,3 @@ /**

*
* Copyright (c) Facebook, Inc. and its affiliates.
* Copyright (c) Meta Platforms, Inc. and affiliates.
*

@@ -71,3 +71,3 @@ * This source code is licensed under the MIT license found in the

{
error("The main 'use-sync-external-store' entry point is not supported; all it " + "does is re-export useSyncExternalStore from the 'react' package, so " + 'it only works with React 18+.' + '\n\n' + 'If you wish to support React 16 and 17, import from ' + "'use-sync-external-store/shim' instead. It will fall back to a shimmed" + 'implementation when the native one is not available.' + '\n\n' + "If you only support React 18+, you can import directly from 'react'.");
error("The main 'use-sync-external-store' entry point is not supported; all it " + "does is re-export useSyncExternalStore from the 'react' package, so " + 'it only works with React 18+.' + '\n\n' + 'If you wish to support React 16 and 17, import from ' + "'use-sync-external-store/shim' instead. It will fall back to a shimmed " + 'implementation when the native one is not available.' + '\n\n' + "If you only support React 18+, you can import directly from 'react'.");
}

@@ -74,0 +74,0 @@

@@ -1,10 +0,12 @@

/**
* @license React
* use-sync-external-store.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
/*
React
use-sync-external-store.production.min.js
Copyright (c) Meta Platforms, Inc. and affiliates.
This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
*/
'use strict';var a=require("react").useSyncExternalStore;exports.useSyncExternalStore=a;
//# sourceMappingURL=use-sync-external-store.production.min.js.map
{
"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-17806594c-20220301",
"version": "0.0.0-experimental-178c267a4e-20241218",
"repository": {

@@ -22,4 +22,8 @@ "type": "git",

"peerDependencies": {
"react": "0.0.0-experimental-17806594c-20220301"
"react": "0.0.0-experimental-178c267a4e-20241218"
},
"devDependencies": {
"react-17": "npm:react@^17",
"react-dom-17": "npm:react-dom@^17"
}
}
# use-sync-external-store
Backwards compatible shim for React's `useSyncExternalStore`. Works with any React that supports hooks.
Backwards-compatible shim for [`React.useSyncExternalStore`](https://reactjs.org/docs/hooks-reference.html#usesyncexternalstore). Works with any React that supports Hooks.
Until `useSyncExternalStore` is documented, refer to https://github.com/reactwg/react-18/discussions/86
See also https://github.com/reactwg/react-18/discussions/86.

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc