react 19.1.1 → 19.2.0

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.
@@ -11,6 +11,7 @@
11
11
  "use strict";
12
12
  "production" !== process.env.NODE_ENV &&
13
13
  (function () {
14
+ function noop() {}
14
15
  function getIteratorFn(maybeIterable) {
15
16
  if (null === maybeIterable || "object" !== typeof maybeIterable)
16
17
  return null;
@@ -78,7 +79,7 @@
78
79
  case REACT_PORTAL_TYPE:
79
80
  return "Portal";
80
81
  case REACT_CONTEXT_TYPE:
81
- return (type.displayName || "Context") + ".Provider";
82
+ return type.displayName || "Context";
82
83
  case REACT_CONSUMER_TYPE:
83
84
  return (type._context.displayName || "Context") + ".Consumer";
84
85
  case REACT_FORWARD_REF_TYPE:
@@ -158,17 +159,8 @@
158
159
  componentName = this.props.ref;
159
160
  return void 0 !== componentName ? componentName : null;
160
161
  }
161
- function ReactElement(
162
- type,
163
- key,
164
- self,
165
- source,
166
- owner,
167
- props,
168
- debugStack,
169
- debugTask
170
- ) {
171
- self = props.ref;
162
+ function ReactElement(type, key, props, owner, debugStack, debugTask) {
163
+ var refProp = props.ref;
172
164
  type = {
173
165
  $$typeof: REACT_ELEMENT_TYPE,
174
166
  type: type,
@@ -176,7 +168,7 @@
176
168
  props: props,
177
169
  _owner: owner
178
170
  };
179
- null !== (void 0 !== self ? self : null)
171
+ null !== (void 0 !== refProp ? refProp : null)
180
172
  ? Object.defineProperty(type, "ref", {
181
173
  enumerable: !1,
182
174
  get: elementRefGetterWithDeprecationWarning
@@ -214,10 +206,8 @@
214
206
  newKey = ReactElement(
215
207
  oldElement.type,
216
208
  newKey,
217
- void 0,
218
- void 0,
219
- oldElement._owner,
220
209
  oldElement.props,
210
+ oldElement._owner,
221
211
  oldElement._debugStack,
222
212
  oldElement._debugTask
223
213
  );
@@ -225,6 +215,18 @@
225
215
  (newKey._store.validated = oldElement._store.validated);
226
216
  return newKey;
227
217
  }
218
+ function validateChildKeys(node) {
219
+ isValidElement(node)
220
+ ? node._store && (node._store.validated = 1)
221
+ : "object" === typeof node &&
222
+ null !== node &&
223
+ node.$$typeof === REACT_LAZY_TYPE &&
224
+ ("fulfilled" === node._payload.status
225
+ ? isValidElement(node._payload.value) &&
226
+ node._payload.value._store &&
227
+ (node._payload.value._store.validated = 1)
228
+ : node._store && (node._store.validated = 1));
229
+ }
228
230
  function isValidElement(object) {
229
231
  return (
230
232
  "object" === typeof object &&
@@ -248,7 +250,6 @@
248
250
  ? (checkKeyStringCoercion(element.key), escape("" + element.key))
249
251
  : index.toString(36);
250
252
  }
251
- function noop() {}
252
253
  function resolveThenable(thenable) {
253
254
  switch (thenable.status) {
254
255
  case "fulfilled":
@@ -428,35 +429,56 @@
428
429
  }
429
430
  function lazyInitializer(payload) {
430
431
  if (-1 === payload._status) {
431
- var ctor = payload._result;
432
- ctor = ctor();
433
- ctor.then(
432
+ var ioInfo = payload._ioInfo;
433
+ null != ioInfo && (ioInfo.start = ioInfo.end = performance.now());
434
+ ioInfo = payload._result;
435
+ var thenable = ioInfo();
436
+ thenable.then(
434
437
  function (moduleObject) {
435
- if (0 === payload._status || -1 === payload._status)
436
- (payload._status = 1), (payload._result = moduleObject);
438
+ if (0 === payload._status || -1 === payload._status) {
439
+ payload._status = 1;
440
+ payload._result = moduleObject;
441
+ var _ioInfo = payload._ioInfo;
442
+ null != _ioInfo && (_ioInfo.end = performance.now());
443
+ void 0 === thenable.status &&
444
+ ((thenable.status = "fulfilled"),
445
+ (thenable.value = moduleObject));
446
+ }
437
447
  },
438
448
  function (error) {
439
- if (0 === payload._status || -1 === payload._status)
440
- (payload._status = 2), (payload._result = error);
449
+ if (0 === payload._status || -1 === payload._status) {
450
+ payload._status = 2;
451
+ payload._result = error;
452
+ var _ioInfo2 = payload._ioInfo;
453
+ null != _ioInfo2 && (_ioInfo2.end = performance.now());
454
+ void 0 === thenable.status &&
455
+ ((thenable.status = "rejected"), (thenable.reason = error));
456
+ }
441
457
  }
442
458
  );
459
+ ioInfo = payload._ioInfo;
460
+ if (null != ioInfo) {
461
+ ioInfo.value = thenable;
462
+ var displayName = thenable.displayName;
463
+ "string" === typeof displayName && (ioInfo.name = displayName);
464
+ }
443
465
  -1 === payload._status &&
444
- ((payload._status = 0), (payload._result = ctor));
466
+ ((payload._status = 0), (payload._result = thenable));
445
467
  }
446
468
  if (1 === payload._status)
447
469
  return (
448
- (ctor = payload._result),
449
- void 0 === ctor &&
470
+ (ioInfo = payload._result),
471
+ void 0 === ioInfo &&
450
472
  console.error(
451
473
  "lazy: Expected the result of a dynamic import() call. Instead received: %s\n\nYour code should look like: \n const MyComponent = lazy(() => import('./MyComponent'))\n\nDid you accidentally put curly braces around the import?",
452
- ctor
474
+ ioInfo
453
475
  ),
454
- "default" in ctor ||
476
+ "default" in ioInfo ||
455
477
  console.error(
456
478
  "lazy: Expected the result of a dynamic import() call. Instead received: %s\n\nYour code should look like: \n const MyComponent = lazy(() => import('./MyComponent'))",
457
- ctor
479
+ ioInfo
458
480
  ),
459
- ctor.default
481
+ ioInfo.default
460
482
  );
461
483
  throw payload._result;
462
484
  }
@@ -477,9 +499,8 @@
477
499
  REACT_PORTAL_TYPE = Symbol.for("react.portal"),
478
500
  REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"),
479
501
  REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode"),
480
- REACT_PROFILER_TYPE = Symbol.for("react.profiler");
481
- Symbol.for("react.provider");
482
- var REACT_CONSUMER_TYPE = Symbol.for("react.consumer"),
502
+ REACT_PROFILER_TYPE = Symbol.for("react.profiler"),
503
+ REACT_CONSUMER_TYPE = Symbol.for("react.consumer"),
483
504
  REACT_CONTEXT_TYPE = Symbol.for("react.context"),
484
505
  REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"),
485
506
  REACT_SUSPENSE_TYPE = Symbol.for("react.suspense"),
@@ -595,6 +616,10 @@
595
616
  }
596
617
  };
597
618
  };
619
+ exports.cacheSignal = function () {
620
+ var dispatcher = ReactSharedInternals.A;
621
+ return dispatcher ? dispatcher.cacheSignal() : null;
622
+ };
598
623
  exports.captureOwnerStack = function () {
599
624
  var getCurrentStack = ReactSharedInternals.getCurrentStack;
600
625
  return null === getCurrentStack ? null : getCurrentStack();
@@ -647,25 +672,20 @@
647
672
  props = ReactElement(
648
673
  element.type,
649
674
  key,
650
- void 0,
651
- void 0,
652
- owner,
653
675
  props,
676
+ owner,
654
677
  element._debugStack,
655
678
  element._debugTask
656
679
  );
657
680
  for (key = 2; key < arguments.length; key++)
658
- (owner = arguments[key]),
659
- isValidElement(owner) && owner._store && (owner._store.validated = 1);
681
+ validateChildKeys(arguments[key]);
660
682
  return props;
661
683
  };
662
684
  exports.createElement = function (type, config, children) {
663
- for (var i = 2; i < arguments.length; i++) {
664
- var node = arguments[i];
665
- isValidElement(node) && node._store && (node._store.validated = 1);
666
- }
685
+ for (var i = 2; i < arguments.length; i++)
686
+ validateChildKeys(arguments[i]);
667
687
  i = {};
668
- node = null;
688
+ var key = null;
669
689
  if (null != config)
670
690
  for (propName in (didWarnAboutOldJSXRuntime ||
671
691
  !("__self" in config) ||
@@ -675,7 +695,7 @@
675
695
  "Your app (or one of its dependencies) is using an outdated JSX transform. Update to the modern JSX transform for faster performance: https://react.dev/link/new-jsx-transform"
676
696
  )),
677
697
  hasValidKey(config) &&
678
- (checkKeyStringCoercion(config.key), (node = "" + config.key)),
698
+ (checkKeyStringCoercion(config.key), (key = "" + config.key)),
679
699
  config))
680
700
  hasOwnProperty.call(config, propName) &&
681
701
  "key" !== propName &&
@@ -697,7 +717,7 @@
697
717
  if (type && type.defaultProps)
698
718
  for (propName in ((childrenLength = type.defaultProps), childrenLength))
699
719
  void 0 === i[propName] && (i[propName] = childrenLength[propName]);
700
- node &&
720
+ key &&
701
721
  defineKeyPropWarningGetter(
702
722
  i,
703
723
  "function" === typeof type
@@ -707,11 +727,9 @@
707
727
  var propName = 1e4 > ReactSharedInternals.recentlyCreatedOwnerStacks++;
708
728
  return ReactElement(
709
729
  type,
710
- node,
711
- void 0,
712
- void 0,
713
- getOwner(),
730
+ key,
714
731
  i,
732
+ getOwner(),
715
733
  propName ? Error("react-stack-top-frame") : unknownOwnerDebugStack,
716
734
  propName ? createTask(getTaskName(type)) : unknownOwnerDebugTask
717
735
  );
@@ -764,11 +782,24 @@
764
782
  };
765
783
  exports.isValidElement = isValidElement;
766
784
  exports.lazy = function (ctor) {
767
- return {
768
- $$typeof: REACT_LAZY_TYPE,
769
- _payload: { _status: -1, _result: ctor },
770
- _init: lazyInitializer
771
- };
785
+ ctor = { _status: -1, _result: ctor };
786
+ var lazyType = {
787
+ $$typeof: REACT_LAZY_TYPE,
788
+ _payload: ctor,
789
+ _init: lazyInitializer
790
+ },
791
+ ioInfo = {
792
+ name: "lazy",
793
+ start: -1,
794
+ end: -1,
795
+ value: null,
796
+ owner: null,
797
+ debugStack: Error("react-stack-top-frame"),
798
+ debugTask: console.createTask ? console.createTask("lazy()") : null
799
+ };
800
+ ctor._ioInfo = ioInfo;
801
+ lazyType._debugInfo = [{ awaited: ioInfo }];
802
+ return lazyType;
772
803
  };
773
804
  exports.memo = function (type, compare) {
774
805
  null == type &&
@@ -813,5 +844,5 @@
813
844
  exports.useMemo = function (create, deps) {
814
845
  return resolveDispatcher().useMemo(create, deps);
815
846
  };
816
- exports.version = "19.1.1";
847
+ exports.version = "19.2.0";
817
848
  })();
@@ -25,8 +25,9 @@ function formatProdErrorMessage(code) {
25
25
  " for the full message or use the non-minified dev environment for full errors and additional helpful warnings."
26
26
  );
27
27
  }
28
- var isArrayImpl = Array.isArray,
29
- REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"),
28
+ var isArrayImpl = Array.isArray;
29
+ function noop() {}
30
+ var REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"),
30
31
  REACT_PORTAL_TYPE = Symbol.for("react.portal"),
31
32
  REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"),
32
33
  REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode"),
@@ -45,25 +46,18 @@ function getIteratorFn(maybeIterable) {
45
46
  }
46
47
  var hasOwnProperty = Object.prototype.hasOwnProperty,
47
48
  assign = Object.assign;
48
- function ReactElement(type, key, self, source, owner, props) {
49
- self = props.ref;
49
+ function ReactElement(type, key, props) {
50
+ var refProp = props.ref;
50
51
  return {
51
52
  $$typeof: REACT_ELEMENT_TYPE,
52
53
  type: type,
53
54
  key: key,
54
- ref: void 0 !== self ? self : null,
55
+ ref: void 0 !== refProp ? refProp : null,
55
56
  props: props
56
57
  };
57
58
  }
58
59
  function cloneAndReplaceKey(oldElement, newKey) {
59
- return ReactElement(
60
- oldElement.type,
61
- newKey,
62
- void 0,
63
- void 0,
64
- void 0,
65
- oldElement.props
66
- );
60
+ return ReactElement(oldElement.type, newKey, oldElement.props);
67
61
  }
68
62
  function isValidElement(object) {
69
63
  return (
@@ -87,7 +81,6 @@ function getElementKey(element, index) {
87
81
  ? escape("" + element.key)
88
82
  : index.toString(36);
89
83
  }
90
- function noop() {}
91
84
  function resolveThenable(thenable) {
92
85
  switch (thenable.status) {
93
86
  case "fulfilled":
@@ -340,6 +333,10 @@ exports.cache = function (fn) {
340
333
  }
341
334
  };
342
335
  };
336
+ exports.cacheSignal = function () {
337
+ var dispatcher = ReactSharedInternals.A;
338
+ return dispatcher ? dispatcher.cacheSignal() : null;
339
+ };
343
340
  exports.captureOwnerStack = function () {
344
341
  return null;
345
342
  };
@@ -347,12 +344,9 @@ exports.cloneElement = function (element, config, children) {
347
344
  if (null === element || void 0 === element)
348
345
  throw Error(formatProdErrorMessage(267, element));
349
346
  var props = assign({}, element.props),
350
- key = element.key,
351
- owner = void 0;
347
+ key = element.key;
352
348
  if (null != config)
353
- for (propName in (void 0 !== config.ref && (owner = void 0),
354
- void 0 !== config.key && (key = "" + config.key),
355
- config))
349
+ for (propName in (void 0 !== config.key && (key = "" + config.key), config))
356
350
  !hasOwnProperty.call(config, propName) ||
357
351
  "key" === propName ||
358
352
  "__self" === propName ||
@@ -366,7 +360,7 @@ exports.cloneElement = function (element, config, children) {
366
360
  childArray[i] = arguments[i + 2];
367
361
  props.children = childArray;
368
362
  }
369
- return ReactElement(element.type, key, void 0, void 0, owner, props);
363
+ return ReactElement(element.type, key, props);
370
364
  };
371
365
  exports.createElement = function (type, config, children) {
372
366
  var propName,
@@ -390,7 +384,7 @@ exports.createElement = function (type, config, children) {
390
384
  for (propName in ((childrenLength = type.defaultProps), childrenLength))
391
385
  void 0 === props[propName] &&
392
386
  (props[propName] = childrenLength[propName]);
393
- return ReactElement(type, key, void 0, void 0, null, props);
387
+ return ReactElement(type, key, props);
394
388
  };
395
389
  exports.createRef = function () {
396
390
  return { current: null };
@@ -426,4 +420,4 @@ exports.useId = function () {
426
420
  exports.useMemo = function (create, deps) {
427
421
  return ReactSharedInternals.H.useMemo(create, deps);
428
422
  };
429
- exports.version = "19.1.1";
423
+ exports.version = "19.2.0";
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "keywords": [
5
5
  "react"
6
6
  ],
7
- "version": "19.1.1",
7
+ "version": "19.2.0",
8
8
  "homepage": "https://react.dev/",
9
9
  "bugs": "https://github.com/facebook/react/issues",
10
10
  "license": "MIT",