use-sync-external-store
Advanced tools
Comparing version 1.4.0-rc-a532d91d01-20240610 to 1.4.0-rc-ab2135c7-20240724
@@ -14,28 +14,2 @@ /** | ||
(function () { | ||
function error(format) { | ||
for ( | ||
var _len2 = arguments.length, | ||
args = Array(1 < _len2 ? _len2 - 1 : 0), | ||
_key2 = 1; | ||
_key2 < _len2; | ||
_key2++ | ||
) | ||
args[_key2 - 1] = arguments[_key2]; | ||
printWarning("error", format, args, Error("react-stack-top-frame")); | ||
} | ||
function printWarning(level, format, args, currentStack) { | ||
var isErrorLogger = | ||
"%s\n\n%s\n" === format || "%o\n\n%s\n\n%s\n" === format; | ||
ReactSharedInternals.getCurrentStack && | ||
((currentStack = ReactSharedInternals.getCurrentStack(currentStack)), | ||
"" !== currentStack && | ||
((format += "%s"), (args = args.concat([currentStack])))); | ||
isErrorLogger | ||
? args.unshift(format) | ||
: ((args = args.map(function (item) { | ||
return String(item); | ||
})), | ||
args.unshift("Warning: " + format)); | ||
Function.prototype.apply.call(console[level], console, args); | ||
} | ||
function is(x, y) { | ||
@@ -48,3 +22,3 @@ return (x === y && (0 !== x || 1 / x === 1 / y)) || (x !== x && y !== y); | ||
((didWarnOld18Alpha = !0), | ||
error( | ||
console.error( | ||
"You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release." | ||
@@ -56,3 +30,3 @@ )); | ||
objectIs(value, cachedValue) || | ||
(error( | ||
(console.error( | ||
"The result of getSnapshot should be cached to avoid an infinite loop" | ||
@@ -93,3 +67,3 @@ ), | ||
return !objectIs(inst, nextValue); | ||
} catch (error$0) { | ||
} catch (error) { | ||
return !0; | ||
@@ -106,4 +80,2 @@ } | ||
var React = require("react"), | ||
ReactSharedInternals = | ||
React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, | ||
objectIs = "function" === typeof Object.is ? Object.is : is, | ||
@@ -110,0 +82,0 @@ useState = React.useState, |
@@ -14,28 +14,2 @@ /** | ||
(function () { | ||
function error(format) { | ||
for ( | ||
var _len2 = arguments.length, | ||
args = Array(1 < _len2 ? _len2 - 1 : 0), | ||
_key2 = 1; | ||
_key2 < _len2; | ||
_key2++ | ||
) | ||
args[_key2 - 1] = arguments[_key2]; | ||
printWarning("error", format, args, Error("react-stack-top-frame")); | ||
} | ||
function printWarning(level, format, args, currentStack) { | ||
var isErrorLogger = | ||
"%s\n\n%s\n" === format || "%o\n\n%s\n\n%s\n" === format; | ||
ReactSharedInternals.getCurrentStack && | ||
((currentStack = ReactSharedInternals.getCurrentStack(currentStack)), | ||
"" !== currentStack && | ||
((format += "%s"), (args = args.concat([currentStack])))); | ||
isErrorLogger | ||
? args.unshift(format) | ||
: ((args = args.map(function (item) { | ||
return String(item); | ||
})), | ||
args.unshift("Warning: " + format)); | ||
Function.prototype.apply.call(console[level], console, args); | ||
} | ||
function is(x, y) { | ||
@@ -48,3 +22,3 @@ return (x === y && (0 !== x || 1 / x === 1 / y)) || (x !== x && y !== y); | ||
((didWarnOld18Alpha = !0), | ||
error( | ||
console.error( | ||
"You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release." | ||
@@ -56,3 +30,3 @@ )); | ||
objectIs(value, cachedValue) || | ||
(error( | ||
(console.error( | ||
"The result of getSnapshot should be cached to avoid an infinite loop" | ||
@@ -93,3 +67,3 @@ ), | ||
return !objectIs(inst, nextValue); | ||
} catch (error$0) { | ||
} catch (error) { | ||
return !0; | ||
@@ -103,4 +77,2 @@ } | ||
var React = require("react"), | ||
ReactSharedInternals = | ||
React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, | ||
objectIs = "function" === typeof Object.is ? Object.is : is, | ||
@@ -107,0 +79,0 @@ useState = React.useState, |
@@ -60,3 +60,3 @@ /** | ||
if (void 0 !== isEqual && isEqual(currentSelection, nextSelection)) | ||
return currentSelection; | ||
return (memoizedSnapshot = nextSnapshot), currentSelection; | ||
memoizedSnapshot = nextSnapshot; | ||
@@ -63,0 +63,0 @@ return (memoizedSelection = nextSelection); |
@@ -53,3 +53,3 @@ /** | ||
if (void 0 !== isEqual && isEqual(currentSelection, nextSelection)) | ||
return currentSelection; | ||
return (memoizedSnapshot = nextSnapshot), currentSelection; | ||
memoizedSnapshot = nextSnapshot; | ||
@@ -56,0 +56,0 @@ return (memoizedSelection = nextSelection); |
@@ -59,3 +59,3 @@ /** | ||
if (void 0 !== isEqual && isEqual(currentSelection, nextSelection)) | ||
return currentSelection; | ||
return (memoizedSnapshot = nextSnapshot), currentSelection; | ||
memoizedSnapshot = nextSnapshot; | ||
@@ -62,0 +62,0 @@ return (memoizedSelection = nextSelection); |
@@ -52,3 +52,3 @@ /** | ||
if (void 0 !== isEqual && isEqual(currentSelection, nextSelection)) | ||
return currentSelection; | ||
return (memoizedSnapshot = nextSnapshot), currentSelection; | ||
memoizedSnapshot = nextSnapshot; | ||
@@ -55,0 +55,0 @@ return (memoizedSelection = nextSelection); |
@@ -12,45 +12,17 @@ /** | ||
"use strict"; | ||
"production" !== process.env.NODE_ENV && | ||
(function () { | ||
function printWarning(level, format, args, currentStack) { | ||
var isErrorLogger = | ||
"%s\n\n%s\n" === format || "%o\n\n%s\n\n%s\n" === format; | ||
ReactSharedInternals.getCurrentStack && | ||
((currentStack = ReactSharedInternals.getCurrentStack(currentStack)), | ||
"" !== currentStack && | ||
((format += "%s"), (args = args.concat([currentStack])))); | ||
isErrorLogger | ||
? args.unshift(format) | ||
: ((args = args.map(function (item) { | ||
return String(item); | ||
})), | ||
args.unshift("Warning: " + format)); | ||
Function.prototype.apply.call(console[level], console, args); | ||
} | ||
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && | ||
"function" === | ||
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart && | ||
__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error()); | ||
var React = require("react"), | ||
ReactSharedInternals = | ||
React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE; | ||
React = React.useSyncExternalStore; | ||
(function (format) { | ||
for ( | ||
var _len2 = arguments.length, | ||
args = Array(1 < _len2 ? _len2 - 1 : 0), | ||
_key2 = 1; | ||
_key2 < _len2; | ||
_key2++ | ||
) | ||
args[_key2 - 1] = arguments[_key2]; | ||
printWarning("error", format, args, Error("react-stack-top-frame")); | ||
})( | ||
"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\nIf 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\nIf you only support React 18+, you can import directly from 'react'." | ||
); | ||
exports.useSyncExternalStore = React; | ||
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && | ||
"function" === | ||
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop && | ||
__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error()); | ||
})(); | ||
if ("production" !== process.env.NODE_ENV) { | ||
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && | ||
"function" === | ||
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart && | ||
__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error()); | ||
var useSyncExternalStore$jscomp$inline_1 = | ||
require("react").useSyncExternalStore; | ||
console.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\nIf 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\nIf you only support React 18+, you can import directly from 'react'." | ||
); | ||
exports.useSyncExternalStore = useSyncExternalStore$jscomp$inline_1; | ||
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && | ||
"function" === | ||
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop && | ||
__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error()); | ||
} |
{ | ||
"name": "use-sync-external-store", | ||
"description": "Backwards compatible shim for React's useSyncExternalStore. Works with any React that supports hooks.", | ||
"version": "1.4.0-rc-a532d91d01-20240610", | ||
"version": "1.4.0-rc-ab2135c7-20240724", | ||
"repository": { | ||
@@ -22,3 +22,3 @@ "type": "git", | ||
"peerDependencies": { | ||
"react": "19.0.0-rc-a532d91d01-20240610" | ||
"react": "19.0.0-rc-ab2135c7-20240724" | ||
}, | ||
@@ -25,0 +25,0 @@ "devDependencies": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
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
0
27649
731