react 19.0.0-canary-e3ebcd54b-20240405 → 19.0.0-canary-adb717393-20240411

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -51,7 +51,12 @@ function getIteratorFn(maybeIterable) {
51
51
  return null;
52
52
  }
53
53
 
54
- var ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
54
+ var ReactSharedInternalsServer = // $FlowFixMe: It's defined in the one we resolve to.
55
+ React.__SERVER_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;
56
+
57
+ if (!ReactSharedInternalsServer) {
58
+ throw new Error('The "react" package in this environment is not configured correctly. ' + 'The "react-server" condition must be enabled in any environment that ' + 'runs React Server Components.');
59
+ }
55
60
 
56
61
  function error(format) {
57
62
  {
@@ -69,8 +74,7 @@ function printWarning(level, format, args) {
69
74
  // When changing this logic, you might want to also
70
75
  // update consoleWithStackDev.www.js as well.
71
76
  {
72
- var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
73
- var stack = ReactDebugCurrentFrame.getStackAddendum();
77
+ var stack = ReactSharedInternalsServer.getStackAddendum();
74
78
 
75
79
  if (stack !== '') {
76
80
  format += '%s';
@@ -419,9 +423,8 @@ function reenableLogs() {
419
423
  }
420
424
  }
421
425
 
422
- var ReactCurrentDispatcher = ReactSharedInternals.ReactCurrentDispatcher;
423
426
  var prefix;
424
- function describeBuiltInComponentFrame(name, ownerFn) {
427
+ function describeBuiltInComponentFrame(name) {
425
428
  {
426
429
  if (prefix === undefined) {
427
430
  // Extract the VM specific prefix used by each line.
@@ -475,13 +478,13 @@ function describeNativeComponentFrame(fn, construct) {
475
478
  var previousPrepareStackTrace = Error.prepareStackTrace; // $FlowFixMe[incompatible-type] It does accept undefined.
476
479
 
477
480
  Error.prepareStackTrace = undefined;
478
- var previousDispatcher;
481
+ var previousDispatcher = null;
479
482
 
480
483
  {
481
- previousDispatcher = ReactCurrentDispatcher.current; // Set the dispatcher in DEV because this might be call in the render function
484
+ previousDispatcher = ReactSharedInternalsServer.H; // Set the dispatcher in DEV because this might be call in the render function
482
485
  // for warnings.
483
486
 
484
- ReactCurrentDispatcher.current = null;
487
+ ReactSharedInternalsServer.H = null;
485
488
  disableLogs();
486
489
  }
487
490
  /**
@@ -666,7 +669,7 @@ function describeNativeComponentFrame(fn, construct) {
666
669
  reentry = false;
667
670
 
668
671
  {
669
- ReactCurrentDispatcher.current = previousDispatcher;
672
+ ReactSharedInternalsServer.H = previousDispatcher;
670
673
  reenableLogs();
671
674
  }
672
675
 
@@ -685,7 +688,7 @@ function describeNativeComponentFrame(fn, construct) {
685
688
 
686
689
  return syntheticFrame;
687
690
  }
688
- function describeFunctionComponentFrame(fn, ownerFn) {
691
+ function describeFunctionComponentFrame(fn) {
689
692
  {
690
693
  return describeNativeComponentFrame(fn, false);
691
694
  }
@@ -696,7 +699,7 @@ function shouldConstruct(Component) {
696
699
  return !!(prototype && prototype.isReactComponent);
697
700
  }
698
701
 
699
- function describeUnknownElementTypeFrameInDEV(type, ownerFn) {
702
+ function describeUnknownElementTypeFrameInDEV(type) {
700
703
 
701
704
  if (type == null) {
702
705
  return '';
@@ -727,7 +730,7 @@ function describeUnknownElementTypeFrameInDEV(type, ownerFn) {
727
730
 
728
731
  case REACT_MEMO_TYPE:
729
732
  // Memo may contain any component type so we recursively resolve it.
730
- return describeUnknownElementTypeFrameInDEV(type.type, ownerFn);
733
+ return describeUnknownElementTypeFrameInDEV(type.type);
731
734
 
732
735
  case REACT_LAZY_TYPE:
733
736
  {
@@ -737,7 +740,7 @@ function describeUnknownElementTypeFrameInDEV(type, ownerFn) {
737
740
 
738
741
  try {
739
742
  // Lazy may contain any component type so we recursively resolve it.
740
- return describeUnknownElementTypeFrameInDEV(init(payload), ownerFn);
743
+ return describeUnknownElementTypeFrameInDEV(init(payload));
741
744
  } catch (x) {}
742
745
  }
743
746
  }
@@ -746,8 +749,6 @@ function describeUnknownElementTypeFrameInDEV(type, ownerFn) {
746
749
  return '';
747
750
  }
748
751
 
749
- var ReactCurrentOwner = ReactSharedInternals.ReactCurrentOwner;
750
- var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
751
752
  var REACT_CLIENT_REFERENCE = Symbol.for('react.client.reference');
752
753
  var specialPropKeyWarningShown;
753
754
  var didWarnAboutElementRef;
@@ -1036,9 +1037,6 @@ function jsxDEV$1(type, config, maybeKey, isStaticChildren, source, self) {
1036
1037
  }
1037
1038
  }
1038
1039
 
1039
- var propName; // Reserved names are extracted
1040
-
1041
- var props = {};
1042
1040
  var key = null;
1043
1041
  var ref = null; // Currently, key can be spread in as a prop. This causes a potential
1044
1042
  // issue if key is also explicitly declared (ie. <div {...props} key="Hi" />
@@ -1063,14 +1061,33 @@ function jsxDEV$1(type, config, maybeKey, isStaticChildren, source, self) {
1063
1061
  key = '' + config.key;
1064
1062
  }
1065
1063
 
1066
- if (hasValidRef(config)) ; // Remaining properties are added to a new props object
1064
+ if (hasValidRef(config)) ;
1067
1065
 
1066
+ var props;
1068
1067
 
1069
- for (propName in config) {
1070
- if (hasOwnProperty.call(config, propName) && // Skip over reserved prop names
1071
- propName !== 'key' && (enableRefAsProp )) {
1072
- {
1073
- props[propName] = config[propName];
1068
+ if (!('key' in config)) {
1069
+ // If key was not spread in, we can reuse the original props object. This
1070
+ // only works for `jsx`, not `createElement`, because `jsx` is a compiler
1071
+ // target and the compiler always passes a new object. For `createElement`,
1072
+ // we can't assume a new object is passed every time because it can be
1073
+ // called manually.
1074
+ //
1075
+ // Spreading key is a warning in dev. In a future release, we will not
1076
+ // remove a spread key from the props object. (But we'll still warn.) We'll
1077
+ // always pass the object straight through.
1078
+ props = config;
1079
+ } else {
1080
+ // We need to remove reserved props (key, prop, ref). Create a fresh props
1081
+ // object and copy over all the non-reserved props. We don't use `delete`
1082
+ // because in V8 it will deopt the object to dictionary mode.
1083
+ props = {};
1084
+
1085
+ for (var propName in config) {
1086
+ // Skip over reserved prop names
1087
+ if (propName !== 'key' && (enableRefAsProp )) {
1088
+ {
1089
+ props[propName] = config[propName];
1090
+ }
1074
1091
  }
1075
1092
  }
1076
1093
  }
@@ -1083,7 +1100,7 @@ function jsxDEV$1(type, config, maybeKey, isStaticChildren, source, self) {
1083
1100
  }
1084
1101
  }
1085
1102
 
1086
- var element = ReactElement(type, key, ref, self, source, ReactCurrentOwner.current, props);
1103
+ var element = ReactElement(type, key, ref, self, source, ReactSharedInternalsServer.owner, props);
1087
1104
 
1088
1105
  if (type === REACT_FRAGMENT_TYPE) {
1089
1106
  validateFragmentProps(element);
@@ -1095,8 +1112,8 @@ function jsxDEV$1(type, config, maybeKey, isStaticChildren, source, self) {
1095
1112
 
1096
1113
  function getDeclarationErrorAddendum() {
1097
1114
  {
1098
- if (ReactCurrentOwner.current) {
1099
- var name = getComponentNameFromType(ReactCurrentOwner.current.type);
1115
+ if (ReactSharedInternalsServer.owner) {
1116
+ var name = getComponentNameFromType(ReactSharedInternalsServer.owner.type);
1100
1117
 
1101
1118
  if (name) {
1102
1119
  return '\n\nCheck the render method of `' + name + '`.';
@@ -1200,9 +1217,17 @@ function validateExplicitKey(element, parentType) {
1200
1217
 
1201
1218
  var childOwner = '';
1202
1219
 
1203
- if (element && element._owner && element._owner !== ReactCurrentOwner.current) {
1204
- // Give the component that originally created this child.
1205
- childOwner = " It was passed a child from " + getComponentNameFromType(element._owner.type) + ".";
1220
+ if (element && element._owner != null && element._owner !== ReactSharedInternalsServer.owner) {
1221
+ var ownerName = null;
1222
+
1223
+ if (typeof element._owner.tag === 'number') {
1224
+ ownerName = getComponentNameFromType(element._owner.type);
1225
+ } else if (typeof element._owner.name === 'string') {
1226
+ ownerName = element._owner.name;
1227
+ } // Give the component that originally created this child.
1228
+
1229
+
1230
+ childOwner = " It was passed a child from " + ownerName + ".";
1206
1231
  }
1207
1232
 
1208
1233
  setCurrentlyValidatingElement(element);
@@ -1216,11 +1241,10 @@ function validateExplicitKey(element, parentType) {
1216
1241
  function setCurrentlyValidatingElement(element) {
1217
1242
  {
1218
1243
  if (element) {
1219
- var owner = element._owner;
1220
- var stack = describeUnknownElementTypeFrameInDEV(element.type, owner ? owner.type : null);
1221
- ReactDebugCurrentFrame.setExtraStackFrame(stack);
1244
+ var stack = describeUnknownElementTypeFrameInDEV(element.type);
1245
+ ReactSharedInternalsServer.setExtraStackFrame(stack);
1222
1246
  } else {
1223
- ReactDebugCurrentFrame.setExtraStackFrame(null);
1247
+ ReactSharedInternalsServer.setExtraStackFrame(null);
1224
1248
  }
1225
1249
  }
1226
1250
  }
@@ -26,12 +26,12 @@ const REACT_FRAGMENT_TYPE = Symbol.for('react.fragment');
26
26
 
27
27
  const enableRefAsProp = true;
28
28
 
29
- const ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
29
+ const ReactSharedInternalsServer = // $FlowFixMe: It's defined in the one we resolve to.
30
+ React.__SERVER_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;
30
31
 
31
- // $FlowFixMe[method-unbinding]
32
- const hasOwnProperty = Object.prototype.hasOwnProperty;
33
-
34
- const ReactCurrentOwner = ReactSharedInternals.ReactCurrentOwner;
32
+ if (!ReactSharedInternalsServer) {
33
+ throw new Error('The "react" package in this environment is not configured correctly. ' + 'The "react-server" condition must be enabled in any environment that ' + 'runs React Server Components.');
34
+ }
35
35
 
36
36
  function hasValidKey(config) {
37
37
 
@@ -100,9 +100,6 @@ function ReactElement(type, key, _ref, self, source, owner, props) {
100
100
 
101
101
 
102
102
  function jsxProd(type, config, maybeKey) {
103
- let propName; // Reserved names are extracted
104
-
105
- const props = {};
106
103
  let key = null;
107
104
  let ref = null; // Currently, key can be spread in as a prop. This causes a potential
108
105
  // issue if key is also explicitly declared (ie. <div {...props} key="Hi" />
@@ -121,17 +118,36 @@ function jsxProd(type, config, maybeKey) {
121
118
  key = '' + config.key;
122
119
  }
123
120
 
124
-
125
- for (propName in config) {
126
- if (hasOwnProperty.call(config, propName) && // Skip over reserved prop names
127
- propName !== 'key' && (enableRefAsProp )) {
128
- {
129
- props[propName] = config[propName];
121
+ let props;
122
+
123
+ if (!('key' in config)) {
124
+ // If key was not spread in, we can reuse the original props object. This
125
+ // only works for `jsx`, not `createElement`, because `jsx` is a compiler
126
+ // target and the compiler always passes a new object. For `createElement`,
127
+ // we can't assume a new object is passed every time because it can be
128
+ // called manually.
129
+ //
130
+ // Spreading key is a warning in dev. In a future release, we will not
131
+ // remove a spread key from the props object. (But we'll still warn.) We'll
132
+ // always pass the object straight through.
133
+ props = config;
134
+ } else {
135
+ // We need to remove reserved props (key, prop, ref). Create a fresh props
136
+ // object and copy over all the non-reserved props. We don't use `delete`
137
+ // because in V8 it will deopt the object to dictionary mode.
138
+ props = {};
139
+
140
+ for (const propName in config) {
141
+ // Skip over reserved prop names
142
+ if (propName !== 'key' && (enableRefAsProp )) {
143
+ {
144
+ props[propName] = config[propName];
145
+ }
130
146
  }
131
147
  }
132
148
  }
133
149
 
134
- return ReactElement(type, key, ref, undefined, undefined, ReactCurrentOwner.current, props);
150
+ return ReactElement(type, key, ref, undefined, undefined, ReactSharedInternalsServer.owner, props);
135
151
  } // While `jsxDEV` should never be called when running in production, we do
136
152
 
137
153
  const jsx = jsxProd; // we may want to special case jsxs internally to take advantage of static children.
@@ -7,6 +7,7 @@
7
7
  This source code is licensed under the MIT license found in the
8
8
  LICENSE file in the root directory of this source tree.
9
9
  */
10
- 'use strict';require("react");var e=Symbol.for("react.element"),g=Symbol.for("react.fragment"),h=Object.prototype.hasOwnProperty;function k(l,a,f){var b,c={},d=null;void 0!==f&&(d=""+f);void 0!==a.key&&(d=""+a.key);for(b in a)h.call(a,b)&&"key"!==b&&(c[b]=a[b]);a=c.ref;return{$$typeof:e,type:l,key:d,ref:void 0!==a?a:null,props:c}}exports.Fragment=g;exports.jsx=k;exports.jsxDEV=void 0;exports.jsxs=k;
10
+ 'use strict';var e=require("react"),f=Symbol.for("react.element"),g=Symbol.for("react.fragment");if(!e.__SERVER_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE)throw Error('The "react" package in this environment is not configured correctly. The "react-server" condition must be enabled in any environment that runs React Server Components.');
11
+ function h(k,a,b){var c=null;void 0!==b&&(c=""+b);void 0!==a.key&&(c=""+a.key);if("key"in a){b={};for(var d in a)"key"!==d&&(b[d]=a[d])}else b=a;a=b.ref;return{$$typeof:f,type:k,key:c,ref:void 0!==a?a:null,props:b}}exports.Fragment=g;exports.jsx=h;exports.jsxDEV=void 0;exports.jsxs=h;
11
12
 
12
13
  //# sourceMappingURL=react-jsx-runtime.react-server.production.min.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"react-jsx-runtime.react-server.production.min.js","lineCount":10,"mappings":"A;;;;;;;;;aAYYA,OAAA,CAAQ,OAAR,CAMZ,KAAMC,EAAqBC,MAAOC,CAAAA,GAAP,CAAW,eAAX,CAA3B,CACMC,EAAsBF,MAAOC,CAAAA,GAAP,CAAW,gBAAX,CAD5B,CAaME,EAAiBC,MAAOC,CAAAA,SAAUF,CAAAA,cAsExCG,SAASA,EAAO,CAACC,CAAD,CAAOC,CAAP,CAAeC,CAAf,CAAyB,CACvC,IAAIC,CAAJ,CAEMC,EAAQ,EAFd,CAGIC,EAAM,IAQOC,KAAAA,EAAjB,GAAIJ,CAAJ,GAEEG,CAFF,CAEQ,EAFR,CAEaH,CAFb,CA5EsBI,KAAAA,EAiFtB,GAAgBL,CAjFFI,CAAAA,GAiFd,GAEEA,CAFF,CAEQ,EAFR,CAEaJ,CAAOI,CAAAA,GAFpB,CAMA,KAAKF,CAAL,GAAiBF,EAAjB,CACML,CAAeW,CAAAA,IAAf,CAAoBN,CAApB,CAA4BE,CAA5B,CAAJ,EACa,KADb,GACAA,CADA,GAGIC,CAAA,CAAMD,CAAN,CAHJ,CAGsBF,CAAA,CAAOE,CAAP,CAHtB,CAvDMK,EAAAA,CA+D6EJ,CA/D7DK,CAAAA,GA+DxB,OArDYC,CAERC,SAAUnB,CAFFkB,CAIRV,KAiDgBA,CArDRU,CAKRL,IAgDsBA,CArDdK,CAMRD,IAbgBH,IAAAA,EAAZG,GAAAD,CAAAC,CAAwBD,CAAxBC,CAAkC,IAO9BC,CAORN,MA8CiFA,CArDzEM,CAqB2B,CAyCzCE,OAAQC,CAAAA,QAAR,CAAmBlB,CACnBiB,QAAQE,CAAAA,GAAR,CAAcA,CACdF,QAAQG,CAAAA,MAAR,CAJeT,IAAAA,EAKfM,QAAQI,CAAAA,IAAR,CAAeA;","sources":["react-jsx-runtime.react-server.production.js"],"names":["require","REACT_ELEMENT_TYPE","Symbol","for","REACT_FRAGMENT_TYPE","hasOwnProperty","Object","prototype","jsxProd","type","config","maybeKey","propName","props","key","undefined","call","refProp","ref","element","$$typeof","exports","Fragment","jsx","jsxDEV","jsxs"],"ignoreList":[0]}
1
+ {"version":3,"file":"react-jsx-runtime.react-server.production.min.js","lineCount":11,"mappings":"A;;;;;;;;;aAYA,IAAIA,EAAQC,OAAA,CAAQ,OAAR,CAAZ,CAMMC,EAAqBC,MAAOC,CAAAA,GAAP,CAAW,eAAX,CAN3B,CAOMC,EAAsBF,MAAOC,CAAAA,GAAP,CAAW,gBAAX,CAY5B,IAAI,CAFJJ,CAAMM,CAAAA,+DAEN,CACE,KAAUC,MAAJ,CAAU,yKAAV,CAAN;AAqEFC,QAASA,EAAO,CAACC,CAAD,CAAOC,CAAP,CAAeC,CAAf,CAAyB,CACvC,IAAIC,EAAM,IAQOC,KAAAA,EAAjB,GAAIF,CAAJ,GAEEC,CAFF,CAEQ,EAFR,CAEaD,CAFb,CAzEsBE,KAAAA,EA8EtB,GAAgBH,CA9EFE,CAAAA,GA8Ed,GAEEA,CAFF,CAEQ,EAFR,CAEaF,CAAOE,CAAAA,GAFpB,CAOA,IAAM,KAAN,EAAeF,EAAf,CAWO,CAILI,CAAA,CAAQ,EAER,KAAKC,IAAMA,CAAX,GAAuBL,EAAvB,CAEmB,KAAjB,GAAIK,CAAJ,GAEID,CAAA,CAAMC,CAAN,CAFJ,CAEsBL,CAAA,CAAOK,CAAP,CAFtB,CARG,CAXP,IAUED,EAAA,CAAQJ,CA9DFM,EAAAA,CA+EoFF,CA/EpEG,CAAAA,GA+ExB,OArEYC,CAERC,SAAUjB,CAFFgB,CAIRT,KAiEgBA,CArERS,CAKRN,IAgEsBA,CArEdM,CAMRD,IAbgBJ,IAAAA,EAAZI,GAAAD,CAAAC,CAAwBD,CAAxBC,CAAkC,IAO9BC,CAORJ,MA8DwFA,CArEhFI,CAqB2B,CAyDzCE,OAAQC,CAAAA,QAAR,CAAmBhB,CACnBe,QAAQE,CAAAA,GAAR,CAAcA,CACdF,QAAQG,CAAAA,MAAR,CAJeV,IAAAA,EAKfO,QAAQI,CAAAA,IAAR,CAAeA;","sources":["react-jsx-runtime.react-server.production.js"],"names":["React","require","REACT_ELEMENT_TYPE","Symbol","for","REACT_FRAGMENT_TYPE","__SERVER_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE","Error","jsxProd","type","config","maybeKey","key","undefined","props","propName","refProp","ref","element","$$typeof","exports","Fragment","jsx","jsxDEV","jsxs"],"ignoreList":[0]}