|
9 | 9 |
|
10 | 10 | // The Symbol used to tag the ReactElement-like types. If there is no native Symbol
|
11 | 11 | // nor polyfill, then a plain number is used for performance.
|
12 |
| -const hasSymbol = typeof Symbol === 'function' && Symbol.for; |
| 12 | +export let REACT_ELEMENT_TYPE = 0xeac7; |
| 13 | +export let REACT_PORTAL_TYPE = 0xeaca; |
| 14 | +export let REACT_FRAGMENT_TYPE = 0xeacb; |
| 15 | +export let REACT_STRICT_MODE_TYPE = 0xeacc; |
| 16 | +export let REACT_PROFILER_TYPE = 0xead2; |
| 17 | +export let REACT_PROVIDER_TYPE = 0xeacd; |
| 18 | +export let REACT_CONTEXT_TYPE = 0xeace; |
| 19 | +export let REACT_FORWARD_REF_TYPE = 0xead0; |
| 20 | +export let REACT_SUSPENSE_TYPE = 0xead1; |
| 21 | +export let REACT_SUSPENSE_LIST_TYPE = 0xead8; |
| 22 | +export let REACT_MEMO_TYPE = 0xead3; |
| 23 | +export let REACT_LAZY_TYPE = 0xead4; |
| 24 | +export let REACT_BLOCK_TYPE = 0xead9; |
| 25 | +export let REACT_SERVER_BLOCK_TYPE = 0xeada; |
| 26 | +export let REACT_FUNDAMENTAL_TYPE = 0xead5; |
| 27 | +export let REACT_RESPONDER_TYPE = 0xead6; |
| 28 | +export let REACT_SCOPE_TYPE = 0xead7; |
13 | 29 |
|
14 |
| -export const REACT_ELEMENT_TYPE = hasSymbol |
15 |
| - ? Symbol.for('react.element') |
16 |
| - : 0xeac7; |
17 |
| -export const REACT_PORTAL_TYPE = hasSymbol |
18 |
| - ? Symbol.for('react.portal') |
19 |
| - : 0xeaca; |
20 |
| -export const REACT_FRAGMENT_TYPE = hasSymbol |
21 |
| - ? Symbol.for('react.fragment') |
22 |
| - : 0xeacb; |
23 |
| -export const REACT_STRICT_MODE_TYPE = hasSymbol |
24 |
| - ? Symbol.for('react.strict_mode') |
25 |
| - : 0xeacc; |
26 |
| -export const REACT_PROFILER_TYPE = hasSymbol |
27 |
| - ? Symbol.for('react.profiler') |
28 |
| - : 0xead2; |
29 |
| -export const REACT_PROVIDER_TYPE = hasSymbol |
30 |
| - ? Symbol.for('react.provider') |
31 |
| - : 0xeacd; |
32 |
| -export const REACT_CONTEXT_TYPE = hasSymbol |
33 |
| - ? Symbol.for('react.context') |
34 |
| - : 0xeace; |
35 |
| -export const REACT_FORWARD_REF_TYPE = hasSymbol |
36 |
| - ? Symbol.for('react.forward_ref') |
37 |
| - : 0xead0; |
38 |
| -export const REACT_SUSPENSE_TYPE = hasSymbol |
39 |
| - ? Symbol.for('react.suspense') |
40 |
| - : 0xead1; |
41 |
| -export const REACT_SUSPENSE_LIST_TYPE = hasSymbol |
42 |
| - ? Symbol.for('react.suspense_list') |
43 |
| - : 0xead8; |
44 |
| -export const REACT_MEMO_TYPE = hasSymbol ? Symbol.for('react.memo') : 0xead3; |
45 |
| -export const REACT_LAZY_TYPE = hasSymbol ? Symbol.for('react.lazy') : 0xead4; |
46 |
| -export const REACT_BLOCK_TYPE = hasSymbol ? Symbol.for('react.block') : 0xead9; |
47 |
| -export const REACT_SERVER_BLOCK_TYPE = hasSymbol |
48 |
| - ? Symbol.for('react.server.block') |
49 |
| - : 0xeada; |
50 |
| -export const REACT_FUNDAMENTAL_TYPE = hasSymbol |
51 |
| - ? Symbol.for('react.fundamental') |
52 |
| - : 0xead5; |
53 |
| -export const REACT_RESPONDER_TYPE = hasSymbol |
54 |
| - ? Symbol.for('react.responder') |
55 |
| - : 0xead6; |
56 |
| -export const REACT_SCOPE_TYPE = hasSymbol ? Symbol.for('react.scope') : 0xead7; |
| 30 | +if (typeof Symbol === 'function' && Symbol.for) { |
| 31 | + const symbolFor = Symbol.for; |
| 32 | + REACT_ELEMENT_TYPE = symbolFor('react.element'); |
| 33 | + REACT_PORTAL_TYPE = symbolFor('react.portal'); |
| 34 | + REACT_FRAGMENT_TYPE = symbolFor('react.fragment'); |
| 35 | + REACT_STRICT_MODE_TYPE = symbolFor('react.strict_mode'); |
| 36 | + REACT_PROFILER_TYPE = symbolFor('react.profiler'); |
| 37 | + REACT_PROVIDER_TYPE = symbolFor('react.provider'); |
| 38 | + REACT_CONTEXT_TYPE = symbolFor('react.context'); |
| 39 | + REACT_FORWARD_REF_TYPE = symbolFor('react.forward_ref'); |
| 40 | + REACT_SUSPENSE_TYPE = symbolFor('react.suspense'); |
| 41 | + REACT_SUSPENSE_LIST_TYPE = symbolFor('react.suspense_list'); |
| 42 | + REACT_MEMO_TYPE = symbolFor('react.memo'); |
| 43 | + REACT_LAZY_TYPE = symbolFor('react.lazy'); |
| 44 | + REACT_BLOCK_TYPE = symbolFor('react.block'); |
| 45 | + REACT_SERVER_BLOCK_TYPE = symbolFor('react.server.block'); |
| 46 | + REACT_FUNDAMENTAL_TYPE = symbolFor('react.fundamental'); |
| 47 | + REACT_RESPONDER_TYPE = symbolFor('react.responder'); |
| 48 | + REACT_SCOPE_TYPE = symbolFor('react.scope'); |
| 49 | +} |
57 | 50 |
|
58 | 51 | const MAYBE_ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
|
59 | 52 | const FAUX_ITERATOR_SYMBOL = '@@iterator';
|
|
0 commit comments