use-sync-external-store
1.2.01.5.0
cjs/use-sync-external-store.development.js~
cjs/use-sync-external-store.development.jsModified+17−74
Index: package/cjs/use-sync-external-store.development.js
===================================================================
--- package/cjs/use-sync-external-store.development.js
+++ package/cjs/use-sync-external-store.development.js
@@ -1,84 +1,27 @@
/**
* @license React
* use-sync-external-store.development.js
*
- * Copyright (c) Facebook, Inc. and its affiliates.
+ * 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';
-
-if (process.env.NODE_ENV !== "production") {
- (function() {
-
- 'use strict';
-
-/* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */
-if (
- typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' &&
- typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart ===
- 'function'
-) {
- __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error());
+"use strict";
+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());
}
- var React = require('react');
-
-var ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
-
-function error(format) {
- {
- {
- for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
- args[_key2 - 1] = arguments[_key2];
- }
-
- printWarning('error', format, args);
- }
- }
-}
-
-function printWarning(level, format, args) {
- // When changing this logic, you might want to also
- // update consoleWithStackDev.www.js as well.
- {
- var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
- var stack = ReactDebugCurrentFrame.getStackAddendum();
-
- if (stack !== '') {
- format += '%s';
- args = args.concat([stack]);
- } // eslint-disable-next-line react-internal/safe-string-coercion
-
-
- var argsWithFormat = args.map(function (item) {
- return String(item);
- }); // Careful: RN currently depends on this prefix
-
- argsWithFormat.unshift('Warning: ' + format); // We intentionally don't use spread (or .apply) directly because it
- // breaks IE9: https://github.com/facebook/react/issues/13610
- // eslint-disable-next-line react-internal/no-production-logging
-
- Function.prototype.apply.call(console[level], console, argsWithFormat);
- }
-}
-
-var useSyncExternalStore = React.useSyncExternalStore;
-
-{
- 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 (
- typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' &&
- typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop ===
- 'function'
-) {
- __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error());
-}
-
- })();
-}