Join our webinar on Wednesday, June 26, at 1pm EDTHow Chia Mitigates Risk in the Crypto Industry.Register
Socket
Socket
Sign inDemoInstall

use-sync-external-store

Package Overview
Dependencies
1
Maintainers
3
Versions
1217
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.0.0-experimental-3a4462129-20220201 to 0.0.0-experimental-3ac551e855-20240522

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

32

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.
*

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

(function() {
'use strict';
/* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */
'use strict';
if (

@@ -28,5 +25,5 @@ typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' &&

}
var React = require('react');
var React = require('react');
var ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
var ReactSharedInternals = React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;

@@ -49,4 +46,3 @@ function error(format) {

{
var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
var stack = ReactDebugCurrentFrame.getStackAddendum();
var stack = ReactSharedInternals.getStackAddendum();

@@ -80,3 +76,4 @@ if (stack !== '') {

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

@@ -101,3 +98,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

@@ -125,3 +122,5 @@ // will need to track that themselves and return the correct value

if (!didWarnUncachedGetSnapshot) {
if (value !== getSnapshot()) {
var cachedValue = getSnapshot();
if (!objectIs(value, cachedValue)) {
error('The result of getSnapshot should be cached to avoid an infinite loop');

@@ -230,7 +229,6 @@

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;
/* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */
exports.useSyncExternalStore = useSyncExternalStore;
if (

@@ -243,4 +241,4 @@ typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' &&

}
})();
}

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

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

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

(function() {
'use strict';
/* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */
'use strict';
if (

@@ -28,5 +25,5 @@ typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' &&

}
var React = require('react');
var React = require('react');
var ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
var ReactSharedInternals = React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;

@@ -49,4 +46,3 @@ function error(format) {

{
var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
var stack = ReactDebugCurrentFrame.getStackAddendum();
var stack = ReactSharedInternals.getStackAddendum();

@@ -80,3 +76,4 @@ if (stack !== '') {

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

@@ -101,3 +98,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

@@ -125,3 +122,5 @@ // will need to track that themselves and return the correct value

if (!didWarnUncachedGetSnapshot) {
if (value !== getSnapshot()) {
var cachedValue = getSnapshot();
if (!objectIs(value, cachedValue)) {
error('The result of getSnapshot should be cached to avoid an infinite loop');

@@ -218,7 +217,6 @@

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;
/* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */
exports.useSyncExternalStore = useSyncExternalStore;
if (

@@ -231,4 +229,4 @@ typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' &&

}
})();
}

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

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

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

(function() {
'use strict';
/* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */
'use strict';
if (

@@ -28,3 +25,3 @@ typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' &&

}
var React = require('react');
var React = require('react');
var shim = require('use-sync-external-store/shim');

@@ -41,3 +38,4 @@

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

@@ -151,3 +149,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;

@@ -160,3 +160,2 @@ }, [value]);

exports.useSyncExternalStoreWithSelector = useSyncExternalStoreWithSelector;
/* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */
if (

@@ -169,4 +168,4 @@ typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' &&

}
})();
}

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

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

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

(function() {
'use strict';
/* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */
'use strict';
if (

@@ -28,3 +25,3 @@ typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' &&

}
var React = require('react');
var React = require('react');

@@ -40,3 +37,4 @@ /**

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

@@ -150,3 +148,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;

@@ -159,3 +159,2 @@ }, [value]);

exports.useSyncExternalStoreWithSelector = useSyncExternalStoreWithSelector;
/* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */
if (

@@ -168,4 +167,4 @@ typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' &&

}
})();
}

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

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

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

(function() {
'use strict';
/* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */
'use strict';
if (

@@ -28,5 +25,5 @@ typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' &&

}
var React = require('react');
var React = require('react');
var ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
var ReactSharedInternals = React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;

@@ -49,4 +46,3 @@ function error(format) {

{
var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
var stack = ReactDebugCurrentFrame.getStackAddendum();
var stack = ReactSharedInternals.getStackAddendum();

@@ -74,7 +70,6 @@ if (stack !== '') {

{
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'.");
}
exports.useSyncExternalStore = useSyncExternalStore;
/* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */
if (

@@ -87,4 +82,4 @@ typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' &&

}
})();
}
'use strict';
if (process.env.NODE_ENV === 'production') {
module.exports = require('./cjs/use-sync-external-store.production.min.js');
module.exports = require('./cjs/use-sync-external-store.production.js');
} else {
module.exports = require('./cjs/use-sync-external-store.development.js');
}
{
"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-3a4462129-20220201",
"version": "0.0.0-experimental-3ac551e855-20240522",
"repository": {

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

"README.md",
"build-info.json",
"index.js",

@@ -24,4 +23,8 @@ "index.native.js",

"peerDependencies": {
"react": "0.0.0-experimental-3a4462129-20220201"
"react": "0.0.0-experimental-3ac551e855-20240522"
},
"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.
'use strict';
if (process.env.NODE_ENV === 'production') {
module.exports = require('../cjs/use-sync-external-store-shim.production.min.js');
module.exports = require('../cjs/use-sync-external-store-shim.production.js');
} else {
module.exports = require('../cjs/use-sync-external-store-shim.development.js');
}
'use strict';
if (process.env.NODE_ENV === 'production') {
module.exports = require('../cjs/use-sync-external-store-shim.native.production.min.js');
module.exports = require('../cjs/use-sync-external-store-shim.native.production.js');
} else {
module.exports = require('../cjs/use-sync-external-store-shim.native.development.js');
}
'use strict';
if (process.env.NODE_ENV === 'production') {
module.exports = require('../cjs/use-sync-external-store-shim/with-selector.production.min.js');
module.exports = require('../cjs/use-sync-external-store-shim/with-selector.production.js');
} else {
module.exports = require('../cjs/use-sync-external-store-shim/with-selector.development.js');
}
'use strict';
if (process.env.NODE_ENV === 'production') {
module.exports = require('./cjs/use-sync-external-store-with-selector.production.min.js');
module.exports = require('./cjs/use-sync-external-store-with-selector.production.js');
} else {
module.exports = require('./cjs/use-sync-external-store-with-selector.development.js');
}

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc