source: node_modules/use-sync-external-store/cjs/use-sync-external-store.development.js@ d24f17c

main
Last change on this file since d24f17c was d24f17c, checked in by Aleksandar Panovski <apano77@…>, 15 months ago

Initial commit

  • Property mode set to 100644
File size: 2.8 KB
Line 
1/**
2 * @license React
3 * use-sync-external-store.development.js
4 *
5 * Copyright (c) Facebook, Inc. and its affiliates.
6 *
7 * This source code is licensed under the MIT license found in the
8 * LICENSE file in the root directory of this source tree.
9 */
10
11'use strict';
12
13if (process.env.NODE_ENV !== "production") {
14 (function() {
15
16 'use strict';
17
18/* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */
19if (
20 typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' &&
21 typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart ===
22 'function'
23) {
24 __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error());
25}
26 var React = require('react');
27
28var ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
29
30function error(format) {
31 {
32 {
33 for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
34 args[_key2 - 1] = arguments[_key2];
35 }
36
37 printWarning('error', format, args);
38 }
39 }
40}
41
42function printWarning(level, format, args) {
43 // When changing this logic, you might want to also
44 // update consoleWithStackDev.www.js as well.
45 {
46 var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
47 var stack = ReactDebugCurrentFrame.getStackAddendum();
48
49 if (stack !== '') {
50 format += '%s';
51 args = args.concat([stack]);
52 } // eslint-disable-next-line react-internal/safe-string-coercion
53
54
55 var argsWithFormat = args.map(function (item) {
56 return String(item);
57 }); // Careful: RN currently depends on this prefix
58
59 argsWithFormat.unshift('Warning: ' + format); // We intentionally don't use spread (or .apply) directly because it
60 // breaks IE9: https://github.com/facebook/react/issues/13610
61 // eslint-disable-next-line react-internal/no-production-logging
62
63 Function.prototype.apply.call(console[level], console, argsWithFormat);
64 }
65}
66
67var useSyncExternalStore = React.useSyncExternalStore;
68
69{
70 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'.");
71}
72
73exports.useSyncExternalStore = useSyncExternalStore;
74 /* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */
75if (
76 typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' &&
77 typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop ===
78 'function'
79) {
80 __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error());
81}
82
83 })();
84}
Note: See TracBrowser for help on using the repository browser.