react-test-renderer 0.0.0-experimental-c3cdbec0a7-20240708 → 0.0.0-experimental-85acf2d195-20240711

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.
@@ -73,6 +73,9 @@
73
73
  function shouldErrorImpl() {
74
74
  return null;
75
75
  }
76
+ function createFiber(tag, pendingProps, key, mode) {
77
+ return new FiberNode(tag, pendingProps, key, mode);
78
+ }
76
79
  function findHostInstancesForRefresh(root, families) {
77
80
  var hostInstances = new Set();
78
81
  families = new Set(
@@ -1039,6 +1042,28 @@
1039
1042
  child = parentInstance.children.indexOf(child);
1040
1043
  parentInstance.children.splice(child, 1);
1041
1044
  }
1045
+ function printToConsole(methodName, args, badgeName) {
1046
+ var offset = 0;
1047
+ switch (methodName) {
1048
+ case "dir":
1049
+ case "dirxml":
1050
+ case "groupEnd":
1051
+ case "table":
1052
+ console[methodName].apply(console, args);
1053
+ return;
1054
+ case "assert":
1055
+ offset = 1;
1056
+ }
1057
+ args = args.slice(0);
1058
+ "string" === typeof args[offset]
1059
+ ? args.splice(offset, 1, "[%s] " + args[offset], " " + badgeName + " ")
1060
+ : args.splice(offset, 0, "[%s] ", " " + badgeName + " ");
1061
+ "error" === methodName
1062
+ ? error$jscomp$0.apply(console, args)
1063
+ : "warn" === methodName
1064
+ ? warn.apply(console, args)
1065
+ : console[methodName].apply(console, args);
1066
+ }
1042
1067
  function createCursor(defaultValue) {
1043
1068
  return { current: defaultValue };
1044
1069
  }
@@ -1435,7 +1460,10 @@
1435
1460
  "number" === typeof clientProps ||
1436
1461
  "bigint" === typeof clientProps
1437
1462
  )
1438
- content += describeTextDiff("" + clientProps, void 0, indent + 1);
1463
+ content =
1464
+ null == type
1465
+ ? content + describeTextDiff("" + clientProps, null, indent + 1)
1466
+ : content + describeTextDiff("" + clientProps, void 0, indent + 1);
1439
1467
  return content;
1440
1468
  }
1441
1469
  function describeSiblingFiber(fiber, indent) {
@@ -1471,7 +1499,7 @@
1471
1499
  debugInfo = "";
1472
1500
  i = node.fiber.pendingProps;
1473
1501
  if (6 === node.fiber.tag)
1474
- debugInfo = describeTextDiff(i, node.serverProps, indent);
1502
+ (debugInfo = describeTextDiff(i, node.serverProps, indent)), indent++;
1475
1503
  else if (
1476
1504
  ((serverComponentName = describeFiberType(node.fiber)),
1477
1505
  null !== serverComponentName)
@@ -1499,11 +1527,12 @@
1499
1527
  indent++;
1500
1528
  } else
1501
1529
  null === node.serverProps
1502
- ? (debugInfo = describeExpandedElement(
1530
+ ? ((debugInfo = describeExpandedElement(
1503
1531
  serverComponentName,
1504
1532
  i,
1505
1533
  added(indent)
1506
- ))
1534
+ )),
1535
+ indent++)
1507
1536
  : "string" === typeof node.serverProps
1508
1537
  ? error$jscomp$0(
1509
1538
  "Should not have matched a non HostText fiber to a Text node. This is a bug in React."
@@ -1531,9 +1560,10 @@
1531
1560
  i &&
1532
1561
  0 < node.children.length &&
1533
1562
  (propName += indentation(indent) + "...\n");
1534
- node = node.serverTail;
1535
- for (i = 0; i < node.length; i++)
1536
- (serverComponentName = node[i]),
1563
+ i = node.serverTail;
1564
+ null === node.serverProps && indent--;
1565
+ for (node = 0; node < i.length; node++)
1566
+ (serverComponentName = i[node]),
1537
1567
  (propName =
1538
1568
  "string" === typeof serverComponentName
1539
1569
  ? propName +
@@ -2407,6 +2437,7 @@
2407
2437
  lanes
2408
2438
  )),
2409
2439
  (current.return = returnFiber),
2440
+ (current._debugOwner = returnFiber),
2410
2441
  (current._debugInfo = currentDebugInfo),
2411
2442
  current
2412
2443
  );
@@ -2480,6 +2511,7 @@
2480
2511
  key
2481
2512
  )),
2482
2513
  (current.return = returnFiber),
2514
+ (current._debugOwner = returnFiber),
2483
2515
  (current._debugInfo = currentDebugInfo),
2484
2516
  current
2485
2517
  );
@@ -2501,6 +2533,7 @@
2501
2533
  lanes
2502
2534
  )),
2503
2535
  (newChild.return = returnFiber),
2536
+ (newChild._debugOwner = returnFiber),
2504
2537
  (newChild._debugInfo = currentDebugInfo),
2505
2538
  newChild
2506
2539
  );
@@ -2547,6 +2580,7 @@
2547
2580
  null
2548
2581
  )),
2549
2582
  (lanes.return = returnFiber),
2583
+ (lanes._debugOwner = returnFiber),
2550
2584
  (returnFiber = pushDebugInfo(newChild._debugInfo)),
2551
2585
  (lanes._debugInfo = currentDebugInfo),
2552
2586
  (currentDebugInfo = returnFiber),
@@ -3079,6 +3113,7 @@
3079
3113
  newChild.key
3080
3114
  )),
3081
3115
  (currentFirstChild.return = returnFiber),
3116
+ (currentFirstChild._debugOwner = returnFiber),
3082
3117
  (currentFirstChild._debugInfo = currentDebugInfo),
3083
3118
  validateFragmentProps(
3084
3119
  newChild,
@@ -3250,6 +3285,8 @@
3250
3285
  lanes
3251
3286
  )),
3252
3287
  (currentFirstChild.return = returnFiber),
3288
+ (currentFirstChild._debugOwner = returnFiber),
3289
+ (currentFirstChild._debugInfo = currentDebugInfo),
3253
3290
  (returnFiber = currentFirstChild)),
3254
3291
  placeSingleChild(returnFiber)
3255
3292
  );
@@ -4956,26 +4993,61 @@
4956
4993
  }
4957
4994
  function defaultOnUncaughtError(error, errorInfo) {
4958
4995
  reportGlobalError(error);
4959
- console.warn(
4960
- "%s\n\n%s\n%s",
4961
- componentName
4962
- ? "An error occurred in the <" + componentName + "> component."
4963
- : "An error occurred in one of your React components.",
4964
- "Consider adding an error boundary to your tree to customize error handling behavior.\nVisit https://react.dev/link/error-boundaries to learn more about error boundaries.",
4965
- null != errorInfo.componentStack ? errorInfo.componentStack : ""
4966
- );
4996
+ error = componentName
4997
+ ? "An error occurred in the <" + componentName + "> component."
4998
+ : "An error occurred in one of your React components.";
4999
+ var prevGetCurrentStack = ReactSharedInternals.getCurrentStack,
5000
+ componentStack =
5001
+ null != errorInfo.componentStack ? errorInfo.componentStack : "";
5002
+ ReactSharedInternals.getCurrentStack = function () {
5003
+ return componentStack;
5004
+ };
5005
+ try {
5006
+ warn(
5007
+ "%s\n\n%s\n",
5008
+ error,
5009
+ "Consider adding an error boundary to your tree to customize error handling behavior.\nVisit https://react.dev/link/error-boundaries to learn more about error boundaries."
5010
+ );
5011
+ } finally {
5012
+ ReactSharedInternals.getCurrentStack = prevGetCurrentStack;
5013
+ }
4967
5014
  }
4968
5015
  function defaultOnCaughtError(error$1, errorInfo) {
4969
- console.error(
4970
- "%o\n\n%s\n\n%s\n%s",
4971
- error$1,
4972
- componentName
5016
+ var componentNameMessage = componentName
4973
5017
  ? "The above error occurred in the <" + componentName + "> component."
4974
5018
  : "The above error occurred in one of your React components.",
4975
- "React will try to recreate this component tree from scratch using the error boundary you provided, " +
5019
+ recreateMessage =
5020
+ "React will try to recreate this component tree from scratch using the error boundary you provided, " +
4976
5021
  ((errorBoundaryName || "Anonymous") + "."),
4977
- null != errorInfo.componentStack ? errorInfo.componentStack : ""
4978
- );
5022
+ prevGetCurrentStack = ReactSharedInternals.getCurrentStack,
5023
+ componentStack =
5024
+ null != errorInfo.componentStack ? errorInfo.componentStack : "";
5025
+ ReactSharedInternals.getCurrentStack = function () {
5026
+ return componentStack;
5027
+ };
5028
+ try {
5029
+ "object" === typeof error$1 &&
5030
+ null !== error$1 &&
5031
+ "string" === typeof error$1.environmentName
5032
+ ? printToConsole(
5033
+ "error",
5034
+ [
5035
+ "%o\n\n%s\n\n%s\n",
5036
+ error$1,
5037
+ componentNameMessage,
5038
+ recreateMessage
5039
+ ],
5040
+ error$1.environmentName
5041
+ )
5042
+ : error$jscomp$0(
5043
+ "%o\n\n%s\n\n%s\n",
5044
+ error$1,
5045
+ componentNameMessage,
5046
+ recreateMessage
5047
+ );
5048
+ } finally {
5049
+ ReactSharedInternals.getCurrentStack = prevGetCurrentStack;
5050
+ }
4979
5051
  }
4980
5052
  function defaultOnRecoverableError(error) {
4981
5053
  reportGlobalError(error);
@@ -5470,10 +5542,13 @@
5470
5542
  null === current &&
5471
5543
  (validateFunctionComponentInDev(workInProgress, workInProgress.type),
5472
5544
  Component.contextTypes &&
5473
- error$jscomp$0(
5474
- "%s uses the legacy contextTypes API which was removed in React 19. Use React.createContext() with React.useContext() instead.",
5475
- getComponentNameFromType(Component) || "Unknown"
5476
- ));
5545
+ ((componentName = getComponentNameFromType(Component) || "Unknown"),
5546
+ didWarnAboutContextTypes[componentName] ||
5547
+ ((didWarnAboutContextTypes[componentName] = !0),
5548
+ error$jscomp$0(
5549
+ "%s uses the legacy contextTypes API which was removed in React 19. Use React.createContext() with React.useContext() instead. (https://react.dev/link/legacy-context)",
5550
+ componentName
5551
+ ))));
5477
5552
  prepareToReadContext(workInProgress, renderLanes);
5478
5553
  Component = renderWithHooks(
5479
5554
  current,
@@ -5669,26 +5744,25 @@
5669
5744
  "getDefaultProps was defined on %s, a plain JavaScript class. This is only supported for classes created using React.createClass. Use a static property to define defaultProps instead.",
5670
5745
  state
5671
5746
  );
5672
- _instance.propTypes &&
5673
- error$jscomp$0(
5674
- "propTypes was defined as an instance property on %s. Use a static property to define propTypes instead.",
5675
- state
5676
- );
5677
5747
  _instance.contextType &&
5678
5748
  error$jscomp$0(
5679
5749
  "contextType was defined as an instance property on %s. Use a static property to define contextType instead.",
5680
5750
  state
5681
5751
  );
5682
5752
  Component.childContextTypes &&
5753
+ !didWarnAboutChildContextTypes.has(Component) &&
5754
+ (didWarnAboutChildContextTypes.add(Component),
5683
5755
  error$jscomp$0(
5684
- "%s uses the legacy childContextTypes API which was removed in React 19. Use React.createContext() instead.",
5756
+ "%s uses the legacy childContextTypes API which was removed in React 19. Use React.createContext() instead. (https://react.dev/link/legacy-context)",
5685
5757
  state
5686
- );
5758
+ ));
5687
5759
  Component.contextTypes &&
5760
+ !didWarnAboutContextTypes$1.has(Component) &&
5761
+ (didWarnAboutContextTypes$1.add(Component),
5688
5762
  error$jscomp$0(
5689
- "%s uses the legacy contextTypes API which was removed in React 19. Use React.createContext() with static contextType instead.",
5763
+ "%s uses the legacy contextTypes API which was removed in React 19. Use React.createContext() with static contextType instead. (https://react.dev/link/legacy-context)",
5690
5764
  state
5691
- );
5765
+ ));
5692
5766
  "function" === typeof _instance.componentShouldUpdate &&
5693
5767
  error$jscomp$0(
5694
5768
  "%s has a method called componentShouldUpdate(). Did you mean shouldComponentUpdate()? The name is phrased as a question because the function is expected to return a value.",
@@ -11555,9 +11629,6 @@
11555
11629
  "function" !== typeof Object.preventExtensions ||
11556
11630
  Object.preventExtensions(this);
11557
11631
  }
11558
- function createFiber(tag, pendingProps, key, mode) {
11559
- return new FiberNode(tag, pendingProps, key, mode);
11560
- }
11561
11632
  function shouldConstruct(Component) {
11562
11633
  Component = Component.prototype;
11563
11634
  return !(!Component || !Component.isReactComponent);
@@ -12319,7 +12390,7 @@
12319
12390
  _currentValue2: null,
12320
12391
  _threadCount: 0
12321
12392
  },
12322
- needsEscaping = /["'&<>\n\t]/,
12393
+ needsEscaping = /["'&<>\n\t]|^\s|\s$/,
12323
12394
  hydrationDiffRootDEV = null,
12324
12395
  hydrationErrors = null,
12325
12396
  concurrentQueues = [],
@@ -13665,6 +13736,8 @@
13665
13736
  var didWarnAboutLegacyLifecyclesAndDerivedState = new Set();
13666
13737
  var didWarnAboutDirectlyAssigningPropsToState = new Set();
13667
13738
  var didWarnAboutUndefinedDerivedState = new Set();
13739
+ var didWarnAboutContextTypes$1 = new Set();
13740
+ var didWarnAboutChildContextTypes = new Set();
13668
13741
  var didWarnAboutInvalidateContextType = new Set();
13669
13742
  var didWarnOnInvalidCallback = new Set();
13670
13743
  Object.freeze(fakeInternalInstance);
@@ -13762,6 +13835,7 @@
13762
13835
  didReceiveUpdate = !1;
13763
13836
  var didWarnAboutBadClass = {};
13764
13837
  var didWarnAboutContextTypeOnFunctionComponent = {};
13838
+ var didWarnAboutContextTypes = {};
13765
13839
  var didWarnAboutGetDerivedStateOnFunctionComponent = {};
13766
13840
  var didWarnAboutReassigningProps = !1;
13767
13841
  var didWarnAboutRevealOrder = {};
@@ -14146,14 +14220,14 @@
14146
14220
  scheduleRoot: scheduleRoot,
14147
14221
  setRefreshHandler: setRefreshHandler,
14148
14222
  getCurrentFiber: getCurrentFiberForDevTools,
14149
- reconcilerVersion: "19.0.0-experimental-c3cdbec0a7-20240708"
14223
+ reconcilerVersion: "19.0.0-experimental-85acf2d195-20240711"
14150
14224
  });
14151
14225
  })({
14152
14226
  findFiberByHostInstance: function () {
14153
14227
  throw Error("TestRenderer does not support findFiberByHostInstance()");
14154
14228
  },
14155
14229
  bundleType: 1,
14156
- version: "19.0.0-experimental-c3cdbec0a7-20240708",
14230
+ version: "19.0.0-experimental-85acf2d195-20240711",
14157
14231
  rendererPackageName: "react-test-renderer"
14158
14232
  });
14159
14233
  exports._Scheduler = Scheduler;
@@ -2088,7 +2088,7 @@ function createChildReconciler(shouldTrackSideEffects) {
2088
2088
  return firstChildFiber;
2089
2089
  } catch (x) {
2090
2090
  if (x === SuspenseException) throw x;
2091
- var fiber = createFiber(29, x, null, returnFiber.mode);
2091
+ var fiber = createFiberImplClass(29, x, null, returnFiber.mode);
2092
2092
  fiber.lanes = lanes;
2093
2093
  fiber.return = returnFiber;
2094
2094
  return fiber;
@@ -8208,7 +8208,7 @@ function FiberNode(tag, pendingProps, key, mode) {
8208
8208
  this.childLanes = this.lanes = 0;
8209
8209
  this.alternate = null;
8210
8210
  }
8211
- function createFiber(tag, pendingProps, key, mode) {
8211
+ function createFiberImplClass(tag, pendingProps, key, mode) {
8212
8212
  return new FiberNode(tag, pendingProps, key, mode);
8213
8213
  }
8214
8214
  function shouldConstruct(Component) {
@@ -8218,7 +8218,7 @@ function shouldConstruct(Component) {
8218
8218
  function createWorkInProgress(current, pendingProps) {
8219
8219
  var workInProgress = current.alternate;
8220
8220
  null === workInProgress
8221
- ? ((workInProgress = createFiber(
8221
+ ? ((workInProgress = createFiberImplClass(
8222
8222
  current.tag,
8223
8223
  pendingProps,
8224
8224
  current.key,
@@ -8306,21 +8306,21 @@ function createFiberFromTypeAndProps(
8306
8306
  break;
8307
8307
  case REACT_PROFILER_TYPE:
8308
8308
  return (
8309
- (type = createFiber(12, pendingProps, key, mode | 2)),
8309
+ (type = createFiberImplClass(12, pendingProps, key, mode | 2)),
8310
8310
  (type.elementType = REACT_PROFILER_TYPE),
8311
8311
  (type.lanes = lanes),
8312
8312
  type
8313
8313
  );
8314
8314
  case REACT_SUSPENSE_TYPE:
8315
8315
  return (
8316
- (type = createFiber(13, pendingProps, key, mode)),
8316
+ (type = createFiberImplClass(13, pendingProps, key, mode)),
8317
8317
  (type.elementType = REACT_SUSPENSE_TYPE),
8318
8318
  (type.lanes = lanes),
8319
8319
  type
8320
8320
  );
8321
8321
  case REACT_SUSPENSE_LIST_TYPE:
8322
8322
  return (
8323
- (type = createFiber(19, pendingProps, key, mode)),
8323
+ (type = createFiberImplClass(19, pendingProps, key, mode)),
8324
8324
  (type.elementType = REACT_SUSPENSE_LIST_TYPE),
8325
8325
  (type.lanes = lanes),
8326
8326
  type
@@ -8355,19 +8355,19 @@ function createFiberFromTypeAndProps(
8355
8355
  );
8356
8356
  owner = null;
8357
8357
  }
8358
- key = createFiber(fiberTag, pendingProps, key, mode);
8358
+ key = createFiberImplClass(fiberTag, pendingProps, key, mode);
8359
8359
  key.elementType = type;
8360
8360
  key.type = owner;
8361
8361
  key.lanes = lanes;
8362
8362
  return key;
8363
8363
  }
8364
8364
  function createFiberFromFragment(elements, mode, lanes, key) {
8365
- elements = createFiber(7, elements, key, mode);
8365
+ elements = createFiberImplClass(7, elements, key, mode);
8366
8366
  elements.lanes = lanes;
8367
8367
  return elements;
8368
8368
  }
8369
8369
  function createFiberFromOffscreen(pendingProps, mode, lanes, key) {
8370
- pendingProps = createFiber(22, pendingProps, key, mode);
8370
+ pendingProps = createFiberImplClass(22, pendingProps, key, mode);
8371
8371
  pendingProps.elementType = REACT_OFFSCREEN_TYPE;
8372
8372
  pendingProps.lanes = lanes;
8373
8373
  var primaryChildInstance = {
@@ -8408,12 +8408,12 @@ function createFiberFromOffscreen(pendingProps, mode, lanes, key) {
8408
8408
  return pendingProps;
8409
8409
  }
8410
8410
  function createFiberFromText(content, mode, lanes) {
8411
- content = createFiber(6, content, null, mode);
8411
+ content = createFiberImplClass(6, content, null, mode);
8412
8412
  content.lanes = lanes;
8413
8413
  return content;
8414
8414
  }
8415
8415
  function createFiberFromPortal(portal, mode, lanes) {
8416
- mode = createFiber(
8416
+ mode = createFiberImplClass(
8417
8417
  4,
8418
8418
  null !== portal.children ? portal.children : [],
8419
8419
  portal.key,
@@ -8496,7 +8496,7 @@ function createContainer(
8496
8496
  );
8497
8497
  tag = 1;
8498
8498
  !0 === isStrictMode && (tag |= 24);
8499
- isStrictMode = createFiber(3, null, null, tag);
8499
+ isStrictMode = createFiberImplClass(3, null, null, tag);
8500
8500
  containerInfo.current = isStrictMode;
8501
8501
  isStrictMode.stateNode = containerInfo;
8502
8502
  tag = createCache();
@@ -8827,7 +8827,7 @@ var devToolsConfig$jscomp$inline_1009 = {
8827
8827
  throw Error("TestRenderer does not support findFiberByHostInstance()");
8828
8828
  },
8829
8829
  bundleType: 0,
8830
- version: "19.0.0-experimental-c3cdbec0a7-20240708",
8830
+ version: "19.0.0-experimental-85acf2d195-20240711",
8831
8831
  rendererPackageName: "react-test-renderer"
8832
8832
  };
8833
8833
  var internals$jscomp$inline_1217 = {
@@ -8858,7 +8858,7 @@ var internals$jscomp$inline_1217 = {
8858
8858
  scheduleRoot: null,
8859
8859
  setRefreshHandler: null,
8860
8860
  getCurrentFiber: null,
8861
- reconcilerVersion: "19.0.0-experimental-c3cdbec0a7-20240708"
8861
+ reconcilerVersion: "19.0.0-experimental-85acf2d195-20240711"
8862
8862
  };
8863
8863
  if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
8864
8864
  var hook$jscomp$inline_1218 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-test-renderer",
3
- "version": "0.0.0-experimental-c3cdbec0a7-20240708",
3
+ "version": "0.0.0-experimental-85acf2d195-20240711",
4
4
  "description": "React package for snapshot testing.",
5
5
  "main": "index.js",
6
6
  "repository": {
@@ -19,11 +19,11 @@
19
19
  },
20
20
  "homepage": "https://react.dev/",
21
21
  "dependencies": {
22
- "react-is": "0.0.0-experimental-c3cdbec0a7-20240708",
23
- "scheduler": "0.0.0-experimental-c3cdbec0a7-20240708"
22
+ "react-is": "0.0.0-experimental-85acf2d195-20240711",
23
+ "scheduler": "0.0.0-experimental-85acf2d195-20240711"
24
24
  },
25
25
  "peerDependencies": {
26
- "react": "0.0.0-experimental-c3cdbec0a7-20240708"
26
+ "react": "0.0.0-experimental-85acf2d195-20240711"
27
27
  },
28
28
  "files": [
29
29
  "LICENSE",