use-sync-external-store
Advanced tools
Comparing version 0.0.0-experimental-cb11155c8-20211112 to 0.0.0-experimental-cb151849e1-20240424
@@ -1,5 +0,6 @@ | ||
/** @license React vundefined | ||
/** | ||
* @license React | ||
* use-sync-external-store-shim.development.js | ||
* | ||
* Copyright (c) Facebook, Inc. and its affiliates. | ||
* Copyright (c) Meta Platforms, Inc. and affiliates. | ||
* | ||
@@ -27,3 +28,3 @@ * This source code is licensed under the MIT license found in the | ||
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; | ||
@@ -46,4 +47,3 @@ function error(format) { | ||
{ | ||
var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame; | ||
var stack = ReactDebugCurrentFrame.getStackAddendum(); | ||
var stack = ReactSharedInternals.getStackAddendum(); | ||
@@ -77,3 +77,4 @@ if (stack !== '') { | ||
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 | ||
@@ -122,3 +123,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'); | ||
@@ -227,6 +230,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; | ||
exports.useSyncExternalStore = useSyncExternalStore; | ||
/* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */ | ||
@@ -233,0 +236,0 @@ if ( |
@@ -1,5 +0,6 @@ | ||
/** @license React vundefined | ||
/** | ||
* @license React | ||
* use-sync-external-store-shim.native.development.js | ||
* | ||
* Copyright (c) Facebook, Inc. and its affiliates. | ||
* Copyright (c) Meta Platforms, Inc. and affiliates. | ||
* | ||
@@ -27,3 +28,3 @@ * This source code is licensed under the MIT license found in the | ||
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; | ||
@@ -46,4 +47,3 @@ function error(format) { | ||
{ | ||
var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame; | ||
var stack = ReactDebugCurrentFrame.getStackAddendum(); | ||
var stack = ReactSharedInternals.getStackAddendum(); | ||
@@ -77,3 +77,4 @@ if (stack !== '') { | ||
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 | ||
@@ -122,3 +123,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'); | ||
@@ -215,6 +218,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; | ||
exports.useSyncExternalStore = useSyncExternalStore; | ||
/* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */ | ||
@@ -221,0 +224,0 @@ if ( |
@@ -1,5 +0,6 @@ | ||
/** @license React vundefined | ||
/** | ||
* @license React | ||
* use-sync-external-store-shim/with-selector.development.js | ||
* | ||
* Copyright (c) Facebook, Inc. and its affiliates. | ||
* Copyright (c) Meta Platforms, Inc. and affiliates. | ||
* | ||
@@ -37,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; | ||
@@ -147,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; | ||
@@ -150,0 +154,0 @@ }, [value]); |
@@ -1,5 +0,6 @@ | ||
/** @license React vundefined | ||
/** | ||
* @license React | ||
* use-sync-external-store-with-selector.development.js | ||
* | ||
* Copyright (c) Facebook, Inc. and its affiliates. | ||
* Copyright (c) Meta Platforms, Inc. and affiliates. | ||
* | ||
@@ -36,3 +37,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; | ||
@@ -146,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; | ||
@@ -149,0 +153,0 @@ }, [value]); |
@@ -1,5 +0,6 @@ | ||
/** @license React vundefined | ||
/** | ||
* @license React | ||
* use-sync-external-store.development.js | ||
* | ||
* Copyright (c) Facebook, Inc. and its affiliates. | ||
* Copyright (c) Meta Platforms, Inc. and affiliates. | ||
* | ||
@@ -27,3 +28,3 @@ * This source code is licensed under the MIT license found in the | ||
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; | ||
@@ -46,4 +47,3 @@ function error(format) { | ||
{ | ||
var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame; | ||
var stack = ReactDebugCurrentFrame.getStackAddendum(); | ||
var stack = ReactSharedInternals.getStackAddendum(); | ||
@@ -71,3 +71,3 @@ 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'."); | ||
} | ||
@@ -74,0 +74,0 @@ |
'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-cb11155c8-20211112", | ||
"version": "0.0.0-experimental-cb151849e1-20240424", | ||
"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-cb11155c8-20211112" | ||
"react": "0.0.0-experimental-cb151849e1-20240424" | ||
}, | ||
"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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
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 3 instances in 1 package
43212
1059
2
10
0
2