react-server-dom-webpack 19.0.0-rc-a26e3f403e-20240611 → 19.0.0-rc-dfd30974ab-20240613

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.
@@ -626,7 +626,6 @@ Chunk.prototype.then = function (resolve, reject) {
626
626
  break;
627
627
  case "pending":
628
628
  case "blocked":
629
- case "cyclic":
630
629
  resolve &&
631
630
  (null === this.value && (this.value = []), this.value.push(resolve));
632
631
  reject &&
@@ -649,7 +648,6 @@ function readChunk(chunk) {
649
648
  return chunk.value;
650
649
  case "pending":
651
650
  case "blocked":
652
- case "cyclic":
653
651
  throw chunk;
654
652
  default:
655
653
  throw chunk.reason;
@@ -668,7 +666,6 @@ function wakeChunkIfInitialized(chunk, resolveListeners, rejectListeners) {
668
666
  break;
669
667
  case "pending":
670
668
  case "blocked":
671
- case "cyclic":
672
669
  if (chunk.value)
673
670
  for (var i = 0; i < resolveListeners.length; i++)
674
671
  chunk.value.push(resolveListeners[i]);
@@ -734,35 +731,35 @@ function resolveModuleChunk(chunk, value) {
734
731
  wakeChunkIfInitialized(chunk, resolveListeners, rejectListeners));
735
732
  }
736
733
  }
737
- var initializingChunk = null,
738
- initializingChunkBlockedModel = null;
734
+ var initializingHandler = null;
739
735
  function initializeModelChunk(chunk) {
740
- var prevChunk = initializingChunk,
741
- prevBlocked = initializingChunkBlockedModel;
742
- initializingChunk = chunk;
743
- initializingChunkBlockedModel = null;
736
+ var prevHandler = initializingHandler;
737
+ initializingHandler = null;
744
738
  var resolvedModel = chunk.value;
745
- chunk.status = "cyclic";
739
+ chunk.status = "blocked";
746
740
  chunk.value = null;
747
741
  chunk.reason = null;
748
742
  try {
749
- var value = JSON.parse(resolvedModel, chunk._response._fromJSON);
750
- if (
751
- null !== initializingChunkBlockedModel &&
752
- 0 < initializingChunkBlockedModel.deps
753
- )
754
- (initializingChunkBlockedModel.value = value), (chunk.status = "blocked");
755
- else {
756
- var resolveListeners = chunk.value;
757
- chunk.status = "fulfilled";
758
- chunk.value = value;
759
- null !== resolveListeners && wakeChunk(resolveListeners, value);
743
+ var value = JSON.parse(resolvedModel, chunk._response._fromJSON),
744
+ resolveListeners = chunk.value;
745
+ null !== resolveListeners &&
746
+ ((chunk.value = null),
747
+ (chunk.reason = null),
748
+ wakeChunk(resolveListeners, value));
749
+ if (null !== initializingHandler) {
750
+ if (initializingHandler.errored) throw initializingHandler.value;
751
+ if (0 < initializingHandler.deps) {
752
+ initializingHandler.value = value;
753
+ initializingHandler.chunk = chunk;
754
+ return;
755
+ }
760
756
  }
757
+ chunk.status = "fulfilled";
758
+ chunk.value = value;
761
759
  } catch (error) {
762
760
  (chunk.status = "rejected"), (chunk.reason = error);
763
761
  } finally {
764
- (initializingChunk = prevChunk),
765
- (initializingChunkBlockedModel = prevBlocked);
762
+ initializingHandler = prevHandler;
766
763
  }
767
764
  }
768
765
  function initializeModuleChunk(chunk) {
@@ -788,46 +785,71 @@ function reportGlobalError(response, error) {
788
785
  "pending" === chunk.status && triggerErrorOnChunk(chunk, error);
789
786
  });
790
787
  }
788
+ function createLazyChunkWrapper(chunk) {
789
+ return { $$typeof: REACT_LAZY_TYPE, _payload: chunk, _init: readChunk };
790
+ }
791
791
  function getChunk(response, id) {
792
792
  var chunks = response._chunks,
793
793
  chunk = chunks.get(id);
794
794
  chunk || ((chunk = createPendingChunk(response)), chunks.set(id, chunk));
795
795
  return chunk;
796
796
  }
797
- function createModelResolver(
798
- chunk,
797
+ function waitForReference(
798
+ referencedChunk,
799
799
  parentObject,
800
800
  key,
801
- cyclic,
802
801
  response,
803
802
  map,
804
803
  path
805
804
  ) {
806
- if (initializingChunkBlockedModel) {
807
- var blocked = initializingChunkBlockedModel;
808
- cyclic || blocked.deps++;
805
+ function fulfill(value) {
806
+ for (var i = 1; i < path.length; i++) {
807
+ for (; value.$$typeof === REACT_LAZY_TYPE; )
808
+ if (((value = value._payload), value === handler.chunk))
809
+ value = handler.value;
810
+ else if ("fulfilled" === value.status) value = value.value;
811
+ else {
812
+ path.splice(0, i - 1);
813
+ value.then(fulfill, reject);
814
+ return;
815
+ }
816
+ value = value[path[i]];
817
+ }
818
+ parentObject[key] = map(response, value);
819
+ "" === key && null === handler.value && (handler.value = parentObject[key]);
820
+ handler.deps--;
821
+ 0 === handler.deps &&
822
+ ((i = handler.chunk),
823
+ null !== i &&
824
+ "blocked" === i.status &&
825
+ ((value = i.value),
826
+ (i.status = "fulfilled"),
827
+ (i.value = handler.value),
828
+ null !== value && wakeChunk(value, handler.value)));
829
+ }
830
+ function reject(error) {
831
+ if (!handler.errored) {
832
+ handler.errored = !0;
833
+ handler.value = error;
834
+ var chunk = handler.chunk;
835
+ null !== chunk &&
836
+ "blocked" === chunk.status &&
837
+ triggerErrorOnChunk(chunk, error);
838
+ }
839
+ }
840
+ if (initializingHandler) {
841
+ var handler = initializingHandler;
842
+ handler.deps++;
809
843
  } else
810
- blocked = initializingChunkBlockedModel = {
811
- deps: cyclic ? 0 : 1,
812
- value: null
844
+ handler = initializingHandler = {
845
+ parent: null,
846
+ chunk: null,
847
+ value: null,
848
+ deps: 1,
849
+ errored: !1
813
850
  };
814
- return function (value) {
815
- for (var i = 1; i < path.length; i++) value = value[path[i]];
816
- parentObject[key] = map(response, value);
817
- "" === key && null === blocked.value && (blocked.value = parentObject[key]);
818
- blocked.deps--;
819
- 0 === blocked.deps &&
820
- "blocked" === chunk.status &&
821
- ((value = chunk.value),
822
- (chunk.status = "fulfilled"),
823
- (chunk.value = blocked.value),
824
- null !== value && wakeChunk(value, blocked.value));
825
- };
826
- }
827
- function createModelReject(chunk) {
828
- return function (error) {
829
- return triggerErrorOnChunk(chunk, error);
830
- };
851
+ referencedChunk.then(fulfill, reject);
852
+ return null;
831
853
  }
832
854
  function createServerReferenceProxy(response, metaData) {
833
855
  function proxy() {
@@ -864,23 +886,21 @@ function getOutlinedModel(response, reference, parentObject, key, map) {
864
886
  return map(response, parentObject);
865
887
  case "pending":
866
888
  case "blocked":
867
- case "cyclic":
868
- var parentChunk = initializingChunk;
869
- id.then(
870
- createModelResolver(
871
- parentChunk,
872
- parentObject,
873
- key,
874
- "cyclic" === id.status,
875
- response,
876
- map,
877
- reference
878
- ),
879
- createModelReject(parentChunk)
880
- );
881
- return null;
889
+ return waitForReference(id, parentObject, key, response, map, reference);
882
890
  default:
883
- throw id.reason;
891
+ return (
892
+ initializingHandler
893
+ ? ((initializingHandler.errored = !0),
894
+ (initializingHandler.value = id.reason))
895
+ : (initializingHandler = {
896
+ parent: null,
897
+ chunk: null,
898
+ value: id.reason,
899
+ deps: 0,
900
+ errored: !0
901
+ }),
902
+ null
903
+ );
884
904
  }
885
905
  }
886
906
  function createMap(response, model) {
@@ -906,7 +926,19 @@ function createModel(response, model) {
906
926
  }
907
927
  function parseModelString(response, parentObject, key, value) {
908
928
  if ("$" === value[0]) {
909
- if ("$" === value) return REACT_ELEMENT_TYPE;
929
+ if ("$" === value)
930
+ return (
931
+ null !== initializingHandler &&
932
+ "0" === key &&
933
+ (initializingHandler = {
934
+ parent: initializingHandler,
935
+ chunk: null,
936
+ value: null,
937
+ deps: 0,
938
+ errored: !1
939
+ }),
940
+ REACT_ELEMENT_TYPE
941
+ );
910
942
  switch (value[1]) {
911
943
  case "$":
912
944
  return value.slice(1);
@@ -914,7 +946,7 @@ function parseModelString(response, parentObject, key, value) {
914
946
  return (
915
947
  (parentObject = parseInt(value.slice(2), 16)),
916
948
  (response = getChunk(response, parentObject)),
917
- { $$typeof: REACT_LAZY_TYPE, _payload: response, _init: readChunk }
949
+ createLazyChunkWrapper(response)
918
950
  );
919
951
  case "@":
920
952
  if (2 === value.length) return new Promise(function () {});
@@ -1100,8 +1132,8 @@ function startReadableStream(response, id, type) {
1100
1132
  (previousBlockedChunk = chunk));
1101
1133
  } else {
1102
1134
  chunk = previousBlockedChunk;
1103
- var chunk$51 = createPendingChunk(response);
1104
- chunk$51.then(
1135
+ var chunk$52 = createPendingChunk(response);
1136
+ chunk$52.then(
1105
1137
  function (v) {
1106
1138
  return controller.enqueue(v);
1107
1139
  },
@@ -1109,10 +1141,10 @@ function startReadableStream(response, id, type) {
1109
1141
  return controller.error(e);
1110
1142
  }
1111
1143
  );
1112
- previousBlockedChunk = chunk$51;
1144
+ previousBlockedChunk = chunk$52;
1113
1145
  chunk.then(function () {
1114
- previousBlockedChunk === chunk$51 && (previousBlockedChunk = null);
1115
- resolveModelChunk(chunk$51, json);
1146
+ previousBlockedChunk === chunk$52 && (previousBlockedChunk = null);
1147
+ resolveModelChunk(chunk$52, json);
1116
1148
  });
1117
1149
  }
1118
1150
  },
@@ -1240,8 +1272,8 @@ function mergeBuffer(buffer, lastChunk) {
1240
1272
  for (var l = buffer.length, byteLength = lastChunk.length, i = 0; i < l; i++)
1241
1273
  byteLength += buffer[i].byteLength;
1242
1274
  byteLength = new Uint8Array(byteLength);
1243
- for (var i$52 = (i = 0); i$52 < l; i$52++) {
1244
- var chunk = buffer[i$52];
1275
+ for (var i$53 = (i = 0); i$53 < l; i$53++) {
1276
+ var chunk = buffer[i$53];
1245
1277
  byteLength.set(chunk, i);
1246
1278
  i += chunk.byteLength;
1247
1279
  }
@@ -1417,21 +1449,37 @@ function processFullRow(response, id, tag, buffer, chunk) {
1417
1449
  }
1418
1450
  function createFromJSONCallback(response) {
1419
1451
  return function (key, value) {
1420
- return "string" === typeof value
1421
- ? parseModelString(response, this, key, value)
1422
- : "object" === typeof value && null !== value
1423
- ? ((key =
1424
- value[0] === REACT_ELEMENT_TYPE
1425
- ? {
1426
- $$typeof: REACT_ELEMENT_TYPE,
1427
- type: value[1],
1428
- key: value[2],
1429
- ref: null,
1430
- props: value[3]
1431
- }
1432
- : value),
1433
- key)
1434
- : value;
1452
+ if ("string" === typeof value)
1453
+ return parseModelString(response, this, key, value);
1454
+ if ("object" === typeof value && null !== value) {
1455
+ if (value[0] === REACT_ELEMENT_TYPE) {
1456
+ if (
1457
+ ((key = {
1458
+ $$typeof: REACT_ELEMENT_TYPE,
1459
+ type: value[1],
1460
+ key: value[2],
1461
+ ref: null,
1462
+ props: value[3]
1463
+ }),
1464
+ null !== initializingHandler)
1465
+ )
1466
+ if (
1467
+ ((value = initializingHandler),
1468
+ (initializingHandler = value.parent),
1469
+ value.errored)
1470
+ )
1471
+ (key = new Chunk("rejected", null, value.value, response)),
1472
+ (key = createLazyChunkWrapper(key));
1473
+ else if (0 < value.deps) {
1474
+ var blockedChunk = new Chunk("blocked", null, null, response);
1475
+ value.value = key;
1476
+ value.chunk = blockedChunk;
1477
+ key = createLazyChunkWrapper(blockedChunk);
1478
+ }
1479
+ } else key = value;
1480
+ return key;
1481
+ }
1482
+ return value;
1435
1483
  };
1436
1484
  }
1437
1485
  function noServerCall() {
@@ -518,7 +518,15 @@
518
518
  this.onPostpone =
519
519
  void 0 === onPostpone ? defaultPostponeHandler : onPostpone;
520
520
  this.environmentName =
521
- void 0 === environmentName ? "Server" : environmentName;
521
+ void 0 === environmentName
522
+ ? function () {
523
+ return "Server";
524
+ }
525
+ : "function" !== typeof environmentName
526
+ ? function () {
527
+ return environmentName;
528
+ }
529
+ : environmentName;
522
530
  this.didWarnForKey = null;
523
531
  model = createTask(this, model, null, !1, abortSet);
524
532
  pingedTasks.push(model);
@@ -772,16 +780,14 @@
772
780
  if (null !== prevThenableState)
773
781
  owner = prevThenableState._componentDebugInfo;
774
782
  else {
775
- var componentName = Component.displayName || Component.name || "";
783
+ var componentDebugID = debugID,
784
+ componentName = Component.displayName || Component.name || "",
785
+ componentEnv = request.environmentName();
776
786
  request.pendingChunks++;
777
- var componentDebugID = debugID;
778
- owner = {
779
- name: componentName,
780
- env: request.environmentName,
781
- owner: owner
782
- };
787
+ owner = { name: componentName, env: componentEnv, owner: owner };
783
788
  outlineModel(request, owner);
784
789
  emitDebugChunk(request, componentDebugID, owner);
790
+ task.environmentName = componentEnv;
785
791
  }
786
792
  prepareToUseHooksForComponent(prevThenableState, owner);
787
793
  props = callComponentInDEV(Component, props, owner);
@@ -1067,28 +1073,28 @@
1067
1073
  ? serializeLazyID(JSCompiler_inline_result.id)
1068
1074
  : serializeByValueID(JSCompiler_inline_result.id);
1069
1075
  }
1070
- else if (thrownValue === AbortSigil)
1071
- (originalValue.status = 3),
1072
- (originalValue = request.fatalError),
1073
- (JSCompiler_inline_result = parentPropertyName
1074
- ? serializeLazyID(originalValue)
1075
- : serializeByValueID(originalValue));
1076
- else if (
1077
- ((originalValue.keyPath = prevKeyPath),
1078
- (originalValue.implicitSlot = prevImplicitSlot),
1079
- parentPropertyName)
1080
- )
1081
- request.pendingChunks++,
1082
- (originalValue = request.nextChunkId++),
1083
- (prevKeyPath = logRecoverableError(request, value)),
1084
- emitErrorChunk(request, originalValue, prevKeyPath, value),
1085
- (JSCompiler_inline_result = serializeLazyID(originalValue));
1086
- else throw value;
1076
+ else
1077
+ thrownValue === AbortSigil
1078
+ ? ((originalValue.status = 3),
1079
+ (originalValue = request.fatalError),
1080
+ (JSCompiler_inline_result = parentPropertyName
1081
+ ? serializeLazyID(originalValue)
1082
+ : serializeByValueID(originalValue)))
1083
+ : ((originalValue.keyPath = prevKeyPath),
1084
+ (originalValue.implicitSlot = prevImplicitSlot),
1085
+ request.pendingChunks++,
1086
+ (originalValue = request.nextChunkId++),
1087
+ (prevKeyPath = logRecoverableError(request, value)),
1088
+ emitErrorChunk(request, originalValue, prevKeyPath, value),
1089
+ (JSCompiler_inline_result = parentPropertyName
1090
+ ? serializeLazyID(originalValue)
1091
+ : serializeByValueID(originalValue)));
1087
1092
  }
1088
1093
  return JSCompiler_inline_result;
1089
1094
  },
1090
1095
  thenableState: null
1091
1096
  };
1097
+ task.environmentName = request.environmentName();
1092
1098
  abortSet.add(task);
1093
1099
  return task;
1094
1100
  }
@@ -1244,7 +1250,8 @@
1244
1250
  if ("object" === typeof value) {
1245
1251
  switch (value.$$typeof) {
1246
1252
  case REACT_ELEMENT_TYPE:
1247
- var _writtenObjects = request.writtenObjects;
1253
+ var elementReference = null,
1254
+ _writtenObjects = request.writtenObjects;
1248
1255
  if (null === task.keyPath && !task.implicitSlot) {
1249
1256
  var _existingReference = _writtenObjects.get(value);
1250
1257
  if (void 0 !== _existingReference)
@@ -1254,10 +1261,8 @@
1254
1261
  -1 === parentPropertyName.indexOf(":") &&
1255
1262
  ((parent = _writtenObjects.get(parent)),
1256
1263
  void 0 !== parent &&
1257
- _writtenObjects.set(
1258
- value,
1259
- parent + ":" + parentPropertyName
1260
- ));
1264
+ ((elementReference = parent + ":" + parentPropertyName),
1265
+ _writtenObjects.set(value, elementReference)));
1261
1266
  }
1262
1267
  if ((parentPropertyName = value._debugInfo)) {
1263
1268
  if (null === debugID) return outlineTask(request, task);
@@ -1265,7 +1270,7 @@
1265
1270
  }
1266
1271
  parentPropertyName = value.props;
1267
1272
  parent = parentPropertyName.ref;
1268
- return renderElement(
1273
+ value = renderElement(
1269
1274
  request,
1270
1275
  task,
1271
1276
  value.type,
@@ -1274,6 +1279,12 @@
1274
1279
  parentPropertyName,
1275
1280
  value._owner
1276
1281
  );
1282
+ "object" === typeof value &&
1283
+ null !== value &&
1284
+ null !== elementReference &&
1285
+ (_writtenObjects.has(value) ||
1286
+ _writtenObjects.set(value, elementReference));
1287
+ return value;
1277
1288
  case REACT_LAZY_TYPE:
1278
1289
  task.thenableState = null;
1279
1290
  parentPropertyName = callLazyInitInDEV(value);
@@ -1303,46 +1314,49 @@
1303
1314
  );
1304
1315
  if (
1305
1316
  void 0 !== request.temporaryReferences &&
1306
- ((_writtenObjects = request.temporaryReferences.get(value)),
1307
- void 0 !== _writtenObjects)
1317
+ ((elementReference = request.temporaryReferences.get(value)),
1318
+ void 0 !== elementReference)
1308
1319
  )
1309
- return "$T" + _writtenObjects;
1310
- _writtenObjects = request.writtenObjects;
1311
- _existingReference = _writtenObjects.get(value);
1320
+ return "$T" + elementReference;
1321
+ elementReference = request.writtenObjects;
1322
+ _writtenObjects = elementReference.get(value);
1312
1323
  if ("function" === typeof value.then) {
1313
- if (void 0 !== _existingReference) {
1324
+ if (void 0 !== _writtenObjects) {
1314
1325
  if (null !== task.keyPath || task.implicitSlot)
1315
1326
  return (
1316
1327
  "$@" + serializeThenable(request, task, value).toString(16)
1317
1328
  );
1318
1329
  if (modelRoot === value) modelRoot = null;
1319
- else return _existingReference;
1330
+ else return _writtenObjects;
1320
1331
  }
1321
1332
  request = "$@" + serializeThenable(request, task, value).toString(16);
1322
- _writtenObjects.set(value, request);
1333
+ elementReference.set(value, request);
1323
1334
  return request;
1324
1335
  }
1325
- if (void 0 !== _existingReference)
1336
+ if (void 0 !== _writtenObjects)
1326
1337
  if (modelRoot === value) modelRoot = null;
1327
- else return _existingReference;
1338
+ else return _writtenObjects;
1328
1339
  else if (
1329
1340
  -1 === parentPropertyName.indexOf(":") &&
1330
- ((_existingReference = _writtenObjects.get(parent)),
1331
- void 0 !== _existingReference)
1341
+ ((_writtenObjects = elementReference.get(parent)),
1342
+ void 0 !== _writtenObjects)
1332
1343
  ) {
1333
- var propertyName = parentPropertyName;
1344
+ _existingReference = parentPropertyName;
1334
1345
  if (isArrayImpl(parent) && parent[0] === REACT_ELEMENT_TYPE)
1335
1346
  switch (parentPropertyName) {
1336
1347
  case "1":
1337
- propertyName = "type";
1348
+ _existingReference = "type";
1338
1349
  break;
1339
1350
  case "2":
1340
- propertyName = "key";
1351
+ _existingReference = "key";
1341
1352
  break;
1342
1353
  case "3":
1343
- propertyName = "props";
1354
+ _existingReference = "props";
1344
1355
  }
1345
- _writtenObjects.set(value, _existingReference + ":" + propertyName);
1356
+ elementReference.set(
1357
+ value,
1358
+ _writtenObjects + ":" + _existingReference
1359
+ );
1346
1360
  }
1347
1361
  if (isArrayImpl(value)) return renderFragment(request, task, value);
1348
1362
  if (value instanceof Map) return serializeMap(request, value);
@@ -1377,9 +1391,9 @@
1377
1391
  return serializeTypedArray(request, "V", value);
1378
1392
  if ("function" === typeof Blob && value instanceof Blob)
1379
1393
  return serializeBlob(request, value);
1380
- if ((_writtenObjects = getIteratorFn(value)))
1394
+ if ((elementReference = getIteratorFn(value)))
1381
1395
  return (
1382
- (parentPropertyName = _writtenObjects.call(value)),
1396
+ (parentPropertyName = elementReference.call(value)),
1383
1397
  parentPropertyName === value
1384
1398
  ? "$i" +
1385
1399
  outlineModel(request, Array.from(parentPropertyName)).toString(
@@ -1392,8 +1406,8 @@
1392
1406
  value instanceof ReadableStream
1393
1407
  )
1394
1408
  return serializeReadableStream(request, task, value);
1395
- _writtenObjects = value[ASYNC_ITERATOR];
1396
- if ("function" === typeof _writtenObjects)
1409
+ elementReference = value[ASYNC_ITERATOR];
1410
+ if ("function" === typeof elementReference)
1397
1411
  return (
1398
1412
  null !== task.keyPath
1399
1413
  ? ((value = [
@@ -1404,7 +1418,7 @@
1404
1418
  null
1405
1419
  ]),
1406
1420
  (value = task.implicitSlot ? [value] : value))
1407
- : ((parentPropertyName = _writtenObjects.call(value)),
1421
+ : ((parentPropertyName = elementReference.call(value)),
1408
1422
  (value = serializeAsyncIterable(
1409
1423
  request,
1410
1424
  task,
@@ -1421,6 +1435,16 @@
1421
1435
  throw Error(
1422
1436
  "Only plain objects, and a few built-ins, can be passed to Client Components from Server Components. Classes or null prototypes are not supported."
1423
1437
  );
1438
+ if (
1439
+ "object" === typeof value.task &&
1440
+ null !== value.task &&
1441
+ "function" === typeof value.task.run &&
1442
+ "string" === typeof value.name &&
1443
+ "string" === typeof value.env &&
1444
+ void 0 !== value.owner &&
1445
+ "undefined" === typeof value.stack
1446
+ )
1447
+ return { name: value.name, env: value.env, owner: value.owner };
1424
1448
  if ("Object" !== objectName(value))
1425
1449
  error$jscomp$0(
1426
1450
  "Only plain objects can be passed to Client Components from Server Components. %s objects are not supported.%s",
@@ -1432,14 +1456,14 @@
1432
1456
  request = Object.getOwnPropertyNames(value);
1433
1457
  for (task = 0; task < request.length; task++)
1434
1458
  if (
1435
- ((_writtenObjects = Object.getOwnPropertyDescriptor(
1459
+ ((elementReference = Object.getOwnPropertyDescriptor(
1436
1460
  value,
1437
1461
  request[task]
1438
1462
  )),
1439
- !_writtenObjects ||
1440
- (!_writtenObjects.enumerable &&
1463
+ !elementReference ||
1464
+ (!elementReference.enumerable &&
1441
1465
  (("key" !== request[task] && "ref" !== request[task]) ||
1442
- "function" !== typeof _writtenObjects.get)))
1466
+ "function" !== typeof elementReference.get)))
1443
1467
  ) {
1444
1468
  request = !1;
1445
1469
  break a;
@@ -1536,11 +1560,11 @@
1536
1560
  }
1537
1561
  if ("symbol" === typeof value) {
1538
1562
  task = request.writtenSymbols;
1539
- _writtenObjects = task.get(value);
1540
- if (void 0 !== _writtenObjects)
1541
- return serializeByValueID(_writtenObjects);
1542
- _writtenObjects = value.description;
1543
- if (Symbol.for(_writtenObjects) !== value)
1563
+ elementReference = task.get(value);
1564
+ if (void 0 !== elementReference)
1565
+ return serializeByValueID(elementReference);
1566
+ elementReference = value.description;
1567
+ if (Symbol.for(elementReference) !== value)
1544
1568
  throw Error(
1545
1569
  "Only global symbols received from Symbol.for(...) can be passed to Client Components. The symbol Symbol.for(" +
1546
1570
  (value.description + ") cannot be found among global symbols.") +
@@ -1551,7 +1575,7 @@
1551
1575
  parent = encodeReferenceChunk(
1552
1576
  request,
1553
1577
  parentPropertyName,
1554
- "$S" + _writtenObjects
1578
+ "$S" + elementReference
1555
1579
  );
1556
1580
  request.completedImportChunks.push(parent);
1557
1581
  task.set(value, parentPropertyName);
@@ -1800,7 +1824,10 @@
1800
1824
  }
1801
1825
  function forwardDebugInfo(request, id, debugInfo) {
1802
1826
  for (var i = 0; i < debugInfo.length; i++)
1803
- request.pendingChunks++, emitDebugChunk(request, id, debugInfo[i]);
1827
+ request.pendingChunks++,
1828
+ "string" === typeof debugInfo[i].name &&
1829
+ outlineModel(request, debugInfo[i]),
1830
+ emitDebugChunk(request, id, debugInfo[i]);
1804
1831
  }
1805
1832
  function emitChunk(request, task, value) {
1806
1833
  var id = task.id;
@@ -1853,14 +1880,20 @@
1853
1880
  modelRoot = resolvedModel;
1854
1881
  task.keyPath = null;
1855
1882
  task.implicitSlot = !1;
1856
- if ("object" === typeof resolvedModel && null !== resolvedModel)
1883
+ if ("object" === typeof resolvedModel && null !== resolvedModel) {
1857
1884
  request.writtenObjects.set(
1858
1885
  resolvedModel,
1859
1886
  serializeByValueID(task.id)
1860
- ),
1861
- emitChunk(request, task, resolvedModel);
1862
- else {
1863
- var json = stringify(resolvedModel);
1887
+ );
1888
+ var currentEnv = request.environmentName();
1889
+ currentEnv !== task.environmentName &&
1890
+ emitDebugChunk(request, task.id, { env: currentEnv });
1891
+ emitChunk(request, task, resolvedModel);
1892
+ } else {
1893
+ var json = stringify(resolvedModel),
1894
+ _currentEnv = request.environmentName();
1895
+ _currentEnv !== task.environmentName &&
1896
+ emitDebugChunk(request, task.id, { env: _currentEnv });
1864
1897
  emitModelChunk(request, task.id, json);
1865
1898
  }
1866
1899
  request.abortableTasks.delete(task);