react-server-dom-parcel 19.2.8 → 19.2.9

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.
@@ -71,31 +71,39 @@
71
71
  });
72
72
  }
73
73
  function writeChunkAndReturn(destination, chunk) {
74
- if (0 !== chunk.byteLength)
75
- if (2048 < chunk.byteLength)
76
- 0 < writtenBytes &&
77
- (destination.enqueue(
78
- new Uint8Array(currentView.buffer, 0, writtenBytes)
74
+ if (0 === chunk.byteLength)
75
+ if (supportsArrayBufferDetached) {
76
+ if (chunk.buffer.detached)
77
+ throw Error(
78
+ "Cannot transport a detached buffer. This usually happens when trying to transport multiple buffer-spanning views on the same underyling buffer. Either reuse the exact same view by identity or copy the underlying buffer manually via `view.slice()`."
79
+ );
80
+ } else
81
+ didWarnAboutMissingArrayBufferDetached ||
82
+ (console.error(
83
+ "React encountered an empty buffer when writing in an environment that does not support ArrayBuffer.prototype.detached. This could be a security issue if the buffer was not actually empty. Please use a modern Edge runtime that supports ArrayBuffer.prototype.detached."
79
84
  ),
80
- (currentView = new Uint8Array(2048)),
81
- (writtenBytes = 0)),
82
- destination.enqueue(chunk);
83
- else {
84
- var allowableBytes = currentView.length - writtenBytes;
85
- allowableBytes < chunk.byteLength &&
86
- (0 === allowableBytes
87
- ? destination.enqueue(currentView)
88
- : (currentView.set(
89
- chunk.subarray(0, allowableBytes),
90
- writtenBytes
91
- ),
92
- destination.enqueue(currentView),
93
- (chunk = chunk.subarray(allowableBytes))),
94
- (currentView = new Uint8Array(2048)),
95
- (writtenBytes = 0));
96
- currentView.set(chunk, writtenBytes);
97
- writtenBytes += chunk.byteLength;
98
- }
85
+ (didWarnAboutMissingArrayBufferDetached = !0));
86
+ else if (2048 < chunk.byteLength)
87
+ 0 < writtenBytes &&
88
+ (destination.enqueue(
89
+ new Uint8Array(currentView.buffer, 0, writtenBytes)
90
+ ),
91
+ (currentView = new Uint8Array(2048)),
92
+ (writtenBytes = 0)),
93
+ destination.enqueue(chunk);
94
+ else {
95
+ var allowableBytes = currentView.length - writtenBytes;
96
+ allowableBytes < chunk.byteLength &&
97
+ (0 === allowableBytes
98
+ ? destination.enqueue(currentView)
99
+ : (currentView.set(chunk.subarray(0, allowableBytes), writtenBytes),
100
+ destination.enqueue(currentView),
101
+ (chunk = chunk.subarray(allowableBytes))),
102
+ (currentView = new Uint8Array(2048)),
103
+ (writtenBytes = 0));
104
+ currentView.set(chunk, writtenBytes);
105
+ writtenBytes += chunk.byteLength;
106
+ }
99
107
  return !0;
100
108
  }
101
109
  function completeWriting(destination) {
@@ -2798,14 +2806,35 @@
2798
2806
  }
2799
2807
  function emitTypedArrayChunk(request, id, tag, typedArray, debug) {
2800
2808
  debug ? request.pendingDebugChunks++ : request.pendingChunks++;
2801
- var buffer = new Uint8Array(
2802
- typedArray.buffer,
2803
- typedArray.byteOffset,
2804
- typedArray.byteLength
2805
- );
2806
- typedArray = 2048 < typedArray.byteLength ? buffer.slice() : buffer;
2807
- buffer = typedArray.byteLength;
2808
- id = id.toString(16) + ":" + tag + buffer.toString(16) + ",";
2809
+ a: {
2810
+ var view = new Uint8Array(
2811
+ typedArray.buffer,
2812
+ typedArray.byteOffset,
2813
+ typedArray.byteLength
2814
+ );
2815
+ if (2048 < typedArray.byteLength) {
2816
+ if (
2817
+ 0 !== typedArray.byteOffset ||
2818
+ typedArray.byteLength !== typedArray.buffer.byteLength ||
2819
+ typedArray.buffer.resizable
2820
+ ) {
2821
+ typedArray = view.slice();
2822
+ break a;
2823
+ }
2824
+ if (!supportsArrayBufferDetached) {
2825
+ didWarnAboutMissingArrayBufferDetached ||
2826
+ (console.error(
2827
+ "React copied a partial view into a fresh buffer as a safety precaution because the environment does not implement ArrayBuffer.prototype.detached. This negatively impacts performance. Please upgrade to a modern Edge runtime."
2828
+ ),
2829
+ (didWarnAboutMissingArrayBufferDetached = !0));
2830
+ typedArray = view.slice();
2831
+ break a;
2832
+ }
2833
+ }
2834
+ typedArray = view;
2835
+ }
2836
+ view = typedArray.byteLength;
2837
+ id = id.toString(16) + ":" + tag + view.toString(16) + ",";
2809
2838
  id = stringToChunk(id);
2810
2839
  debug
2811
2840
  ? request.completedDebugChunks.push(id, typedArray)
@@ -3797,13 +3826,38 @@
3797
3826
  });
3798
3827
  enqueueFlush(request);
3799
3828
  }
3800
- function appendBackingEntry(backingStore, key, value) {
3801
- backingStore.data.append(key, value);
3802
- value = backingStore.keys;
3803
- null === value
3804
- ? ((backingStore.keys = Array.from(backingStore.data.keys())),
3805
- (backingStore.keyPointer = 0))
3806
- : value.push(key);
3829
+ function appendBackingEntry(backingStore, value, key) {
3830
+ var prefix = backingStore.prefix;
3831
+ if (key.startsWith(prefix)) {
3832
+ switch (key[prefix.length]) {
3833
+ case "_":
3834
+ prefix = backingStore.referencedEntries;
3835
+ null === prefix && (prefix = backingStore.referencedEntries = []);
3836
+ prefix.push([key, value]);
3837
+ return;
3838
+ case "S":
3839
+ "string" === typeof value &&
3840
+ ((prefix = backingStore.streamChunks),
3841
+ null === prefix &&
3842
+ (prefix = backingStore.streamChunks = new Map()),
3843
+ (backingStore = prefix.get(key)),
3844
+ void 0 === backingStore
3845
+ ? prefix.set(key, [value])
3846
+ : backingStore.push(value));
3847
+ return;
3848
+ }
3849
+ "string" === typeof value
3850
+ ? ((prefix = backingStore.stringChunks),
3851
+ null === prefix && (prefix = backingStore.stringChunks = new Map()),
3852
+ prefix.set(key, value))
3853
+ : ((prefix = backingStore.blobs),
3854
+ null === prefix && (prefix = backingStore.blobs = new Map()),
3855
+ prefix.set(key, value));
3856
+ }
3857
+ }
3858
+ function getBackingBlob(backingStore, key) {
3859
+ backingStore = backingStore.blobs;
3860
+ return null === backingStore ? void 0 : backingStore.get(key);
3807
3861
  }
3808
3862
  function ReactPromise(status, value, reason) {
3809
3863
  this.status = status;
@@ -4116,9 +4170,11 @@
4116
4170
  function getChunk(response, id) {
4117
4171
  var chunks = response._chunks,
4118
4172
  chunk = chunks.get(id);
4119
- chunk ||
4120
- ((chunk = response._formData.data.get(response._prefix + id)),
4121
- (chunk =
4173
+ if (!chunk) {
4174
+ chunk = response._prefix;
4175
+ var stringChunks = response._formData.stringChunks;
4176
+ chunk = null === stringChunks ? void 0 : stringChunks.get(chunk + id);
4177
+ chunk =
4122
4178
  "string" === typeof chunk
4123
4179
  ? new ReactPromise(
4124
4180
  "resolved_model",
@@ -4127,8 +4183,9 @@
4127
4183
  )
4128
4184
  : response._closed
4129
4185
  ? new ReactPromise("rejected", null, response._closedReason)
4130
- : new ReactPromise("pending", null, null)),
4131
- chunks.set(id, chunk));
4186
+ : new ReactPromise("pending", null, null);
4187
+ chunks.set(id, chunk);
4188
+ }
4132
4189
  return chunk;
4133
4190
  }
4134
4191
  function fulfillReference(response, reference, value, arrayRoot) {
@@ -4375,7 +4432,7 @@
4375
4432
  Error("Already initialized typed array.")
4376
4433
  )
4377
4434
  );
4378
- reference = response._formData.data.get(key).arrayBuffer();
4435
+ reference = getBackingBlob(response._formData, key).arrayBuffer();
4379
4436
  if (initializingHandler) {
4380
4437
  var handler = initializingHandler;
4381
4438
  handler.deps++;
@@ -4419,15 +4476,17 @@
4419
4476
  var chunks = response._chunks;
4420
4477
  stream = new ReactPromise("fulfilled", stream, controller);
4421
4478
  chunks.set(id, stream);
4422
- response = response._formData.data.getAll(response._prefix + id);
4423
- for (id = 0; id < response.length; id++)
4424
- (chunks = response[id]),
4425
- "string" === typeof chunks &&
4426
- ("C" === chunks[0]
4479
+ chunks = response._prefix;
4480
+ response = response._formData.streamChunks;
4481
+ id = null === response ? void 0 : response.get(chunks + "S" + id);
4482
+ if (void 0 !== id)
4483
+ for (response = 0; response < id.length; response++)
4484
+ (chunks = id[response]),
4485
+ "C" === chunks[0]
4427
4486
  ? controller.close(
4428
4487
  "C" === chunks ? '"$undefined"' : chunks.slice(1)
4429
4488
  )
4430
- : controller.enqueueModel(chunks));
4489
+ : controller.enqueueModel(chunks);
4431
4490
  }
4432
4491
  function parseReadableStream(response, reference, type) {
4433
4492
  function enqueue(value) {
@@ -4591,7 +4650,14 @@
4591
4650
  });
4592
4651
  return iterator;
4593
4652
  }
4594
- function parseModelString(response, obj, key, value, reference, arrayRoot) {
4653
+ function parseModelString(
4654
+ response,
4655
+ obj,
4656
+ key$jscomp$0,
4657
+ value,
4658
+ reference,
4659
+ arrayRoot
4660
+ ) {
4595
4661
  if ("$" === value[0]) {
4596
4662
  switch (value[1]) {
4597
4663
  case "$":
@@ -4611,7 +4677,7 @@
4611
4677
  response,
4612
4678
  arrayRoot,
4613
4679
  obj,
4614
- key,
4680
+ key$jscomp$0,
4615
4681
  null,
4616
4682
  loadServerReference$1
4617
4683
  )
@@ -4631,41 +4697,44 @@
4631
4697
  case "Q":
4632
4698
  return (
4633
4699
  (arrayRoot = value.slice(2)),
4634
- getOutlinedModel(response, arrayRoot, obj, key, null, createMap)
4700
+ getOutlinedModel(
4701
+ response,
4702
+ arrayRoot,
4703
+ obj,
4704
+ key$jscomp$0,
4705
+ null,
4706
+ createMap
4707
+ )
4635
4708
  );
4636
4709
  case "W":
4637
4710
  return (
4638
4711
  (arrayRoot = value.slice(2)),
4639
- getOutlinedModel(response, arrayRoot, obj, key, null, createSet)
4712
+ getOutlinedModel(
4713
+ response,
4714
+ arrayRoot,
4715
+ obj,
4716
+ key$jscomp$0,
4717
+ null,
4718
+ createSet
4719
+ )
4640
4720
  );
4641
4721
  case "K":
4642
- key = value.slice(2);
4643
- obj = response._prefix + "_";
4644
- key = obj + key + "_";
4645
- arrayRoot = new FormData();
4646
- for (response = response._formData; ; ) {
4647
- value = response;
4648
- reference = value.keys;
4649
- null === reference &&
4650
- ((reference = value.keys = Array.from(value.data.keys())),
4651
- (value.keyPointer = 0));
4652
- value = reference[value.keyPointer];
4653
- if (void 0 === value) break;
4654
- if (value.startsWith(key)) {
4655
- reference = response.data.getAll(value);
4656
- for (
4657
- var referencedFormDataKey = value.slice(key.length), i = 0;
4658
- i < reference.length;
4659
- i++
4660
- )
4661
- arrayRoot.append(referencedFormDataKey, reference[i]);
4662
- reference = response;
4663
- reference.data.delete(value);
4664
- reference.keyPointer++;
4665
- } else if (value.startsWith(obj)) break;
4666
- else response.keyPointer++;
4722
+ key$jscomp$0 = value.slice(2);
4723
+ obj = response._formData;
4724
+ response = response._prefix + "_" + key$jscomp$0 + "_";
4725
+ key$jscomp$0 = new FormData();
4726
+ arrayRoot = obj.referencedEntries;
4727
+ if (null !== arrayRoot) {
4728
+ for (value = obj.keyPointer; value < arrayRoot.length; ) {
4729
+ reference = arrayRoot[value];
4730
+ var key = reference[0];
4731
+ if (!key.startsWith(response)) break;
4732
+ key$jscomp$0.append(key.slice(response.length), reference[1]);
4733
+ value++;
4734
+ }
4735
+ obj.keyPointer = value;
4667
4736
  }
4668
- return arrayRoot;
4737
+ return key$jscomp$0;
4669
4738
  case "i":
4670
4739
  return (
4671
4740
  (arrayRoot = value.slice(2)),
@@ -4673,7 +4742,7 @@
4673
4742
  response,
4674
4743
  arrayRoot,
4675
4744
  obj,
4676
- key,
4745
+ key$jscomp$0,
4677
4746
  null,
4678
4747
  extractIterator
4679
4748
  )
@@ -4708,7 +4777,7 @@
4708
4777
  ArrayBuffer,
4709
4778
  1,
4710
4779
  obj,
4711
- key,
4780
+ key$jscomp$0,
4712
4781
  arrayRoot
4713
4782
  );
4714
4783
  case "O":
@@ -4718,7 +4787,7 @@
4718
4787
  Int8Array,
4719
4788
  1,
4720
4789
  obj,
4721
- key,
4790
+ key$jscomp$0,
4722
4791
  arrayRoot
4723
4792
  );
4724
4793
  case "o":
@@ -4728,7 +4797,7 @@
4728
4797
  Uint8Array,
4729
4798
  1,
4730
4799
  obj,
4731
- key,
4800
+ key$jscomp$0,
4732
4801
  arrayRoot
4733
4802
  );
4734
4803
  case "U":
@@ -4738,7 +4807,7 @@
4738
4807
  Uint8ClampedArray,
4739
4808
  1,
4740
4809
  obj,
4741
- key,
4810
+ key$jscomp$0,
4742
4811
  arrayRoot
4743
4812
  );
4744
4813
  case "S":
@@ -4748,7 +4817,7 @@
4748
4817
  Int16Array,
4749
4818
  2,
4750
4819
  obj,
4751
- key,
4820
+ key$jscomp$0,
4752
4821
  arrayRoot
4753
4822
  );
4754
4823
  case "s":
@@ -4758,7 +4827,7 @@
4758
4827
  Uint16Array,
4759
4828
  2,
4760
4829
  obj,
4761
- key,
4830
+ key$jscomp$0,
4762
4831
  arrayRoot
4763
4832
  );
4764
4833
  case "L":
@@ -4768,7 +4837,7 @@
4768
4837
  Int32Array,
4769
4838
  4,
4770
4839
  obj,
4771
- key,
4840
+ key$jscomp$0,
4772
4841
  arrayRoot
4773
4842
  );
4774
4843
  case "l":
@@ -4778,7 +4847,7 @@
4778
4847
  Uint32Array,
4779
4848
  4,
4780
4849
  obj,
4781
- key,
4850
+ key$jscomp$0,
4782
4851
  arrayRoot
4783
4852
  );
4784
4853
  case "G":
@@ -4788,7 +4857,7 @@
4788
4857
  Float32Array,
4789
4858
  4,
4790
4859
  obj,
4791
- key,
4860
+ key$jscomp$0,
4792
4861
  arrayRoot
4793
4862
  );
4794
4863
  case "g":
@@ -4798,7 +4867,7 @@
4798
4867
  Float64Array,
4799
4868
  8,
4800
4869
  obj,
4801
- key,
4870
+ key$jscomp$0,
4802
4871
  arrayRoot
4803
4872
  );
4804
4873
  case "M":
@@ -4808,7 +4877,7 @@
4808
4877
  BigInt64Array,
4809
4878
  8,
4810
4879
  obj,
4811
- key,
4880
+ key$jscomp$0,
4812
4881
  arrayRoot
4813
4882
  );
4814
4883
  case "m":
@@ -4818,7 +4887,7 @@
4818
4887
  BigUint64Array,
4819
4888
  8,
4820
4889
  obj,
4821
- key,
4890
+ key$jscomp$0,
4822
4891
  arrayRoot
4823
4892
  );
4824
4893
  case "V":
@@ -4828,13 +4897,13 @@
4828
4897
  DataView,
4829
4898
  1,
4830
4899
  obj,
4831
- key,
4900
+ key$jscomp$0,
4832
4901
  arrayRoot
4833
4902
  );
4834
4903
  case "B":
4835
4904
  return (
4836
4905
  (obj = parseInt(value.slice(2), 16)),
4837
- response._formData.data.get(response._prefix + obj)
4906
+ getBackingBlob(response._formData, response._prefix + obj)
4838
4907
  );
4839
4908
  case "R":
4840
4909
  return parseReadableStream(response, value, void 0);
@@ -4850,7 +4919,7 @@
4850
4919
  response,
4851
4920
  value,
4852
4921
  obj,
4853
- key,
4922
+ key$jscomp$0,
4854
4923
  arrayRoot,
4855
4924
  createModel
4856
4925
  );
@@ -4869,11 +4938,20 @@
4869
4938
  : new FormData(),
4870
4939
  arraySizeLimit =
4871
4940
  4 < arguments.length && void 0 !== arguments[4] ? arguments[4] : 1e6,
4872
- chunks = new Map();
4941
+ chunks = new Map(),
4942
+ backingStore = {
4943
+ prefix: formFieldPrefix,
4944
+ referencedEntries: null,
4945
+ keyPointer: 0,
4946
+ stringChunks: null,
4947
+ streamChunks: null,
4948
+ blobs: null
4949
+ };
4950
+ backingFormData.forEach(appendBackingEntry.bind(null, backingStore));
4873
4951
  return {
4874
4952
  _bundlerConfig: bundlerConfig,
4875
4953
  _prefix: formFieldPrefix,
4876
- _formData: { data: backingFormData, keyPointer: -1, keys: null },
4954
+ _formData: backingStore,
4877
4955
  _chunks: chunks,
4878
4956
  _closed: !1,
4879
4957
  _closedReason: null,
@@ -5082,6 +5160,11 @@
5082
5160
  Symbol.for("react.postpone");
5083
5161
  var MAYBE_ITERATOR_SYMBOL = Symbol.iterator,
5084
5162
  ASYNC_ITERATOR = Symbol.asyncIterator,
5163
+ supportsArrayBufferDetached = hasOwnProperty.call(
5164
+ ArrayBuffer.prototype,
5165
+ "detached"
5166
+ ),
5167
+ didWarnAboutMissingArrayBufferDetached = !1,
5085
5168
  LocalPromise = Promise,
5086
5169
  scheduleMicrotask =
5087
5170
  "function" === typeof queueMicrotask
@@ -5529,20 +5612,40 @@
5529
5612
  function progress(entry) {
5530
5613
  if (entry.done) close(response$jscomp$0);
5531
5614
  else {
5532
- entry = entry.value;
5533
- var name = entry[0];
5534
- entry = entry[1];
5535
- if ("string" === typeof entry) {
5536
- var response = response$jscomp$0;
5537
- appendBackingEntry(response._formData, name, entry);
5538
- var prefix = response._prefix;
5539
- if (name.startsWith(prefix)) {
5540
- var chunks = response._chunks;
5541
- name = +name.slice(prefix.length);
5542
- (chunks = chunks.get(name)) &&
5543
- resolveModelChunk(response, chunks, entry, name);
5615
+ var _entry$value = entry.value;
5616
+ entry = _entry$value[0];
5617
+ _entry$value = _entry$value[1];
5618
+ if ("string" === typeof _entry$value)
5619
+ a: {
5620
+ var response = response$jscomp$0,
5621
+ prefix = response._prefix;
5622
+ if (entry.startsWith(prefix)) {
5623
+ var chunks = response._chunks;
5624
+ if ("S" === entry[prefix.length]) {
5625
+ if (
5626
+ entry.length > prefix.length + 1 &&
5627
+ ((prefix = +entry.slice(prefix.length + 1)),
5628
+ (chunks = chunks.get(prefix)))
5629
+ ) {
5630
+ resolveModelChunk(response, chunks, _entry$value, prefix);
5631
+ break a;
5632
+ }
5633
+ } else if (
5634
+ ((prefix = +entry.slice(prefix.length)),
5635
+ (chunks = chunks.get(prefix)))
5636
+ ) {
5637
+ resolveModelChunk(response, chunks, _entry$value, prefix);
5638
+ break a;
5639
+ }
5640
+ }
5641
+ appendBackingEntry(response._formData, _entry$value, entry);
5544
5642
  }
5545
- } else appendBackingEntry(response$jscomp$0._formData, name, entry);
5643
+ else
5644
+ appendBackingEntry(
5645
+ response$jscomp$0._formData,
5646
+ _entry$value,
5647
+ entry
5648
+ );
5546
5649
  iterator.next().then(progress, error);
5547
5650
  }
5548
5651
  }