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.
@@ -66,31 +66,39 @@
66
66
  });
67
67
  }
68
68
  function writeChunkAndReturn(destination, chunk) {
69
- if (0 !== chunk.byteLength)
70
- if (2048 < chunk.byteLength)
71
- 0 < writtenBytes &&
72
- (destination.enqueue(
73
- new Uint8Array(currentView.buffer, 0, writtenBytes)
69
+ if (0 === chunk.byteLength)
70
+ if (supportsArrayBufferDetached) {
71
+ if (chunk.buffer.detached)
72
+ throw Error(
73
+ "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()`."
74
+ );
75
+ } else
76
+ didWarnAboutMissingArrayBufferDetached ||
77
+ (console.error(
78
+ "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 browser that supports ArrayBuffer.prototype.detached."
74
79
  ),
75
- (currentView = new Uint8Array(2048)),
76
- (writtenBytes = 0)),
77
- destination.enqueue(chunk);
78
- else {
79
- var allowableBytes = currentView.length - writtenBytes;
80
- allowableBytes < chunk.byteLength &&
81
- (0 === allowableBytes
82
- ? destination.enqueue(currentView)
83
- : (currentView.set(
84
- chunk.subarray(0, allowableBytes),
85
- writtenBytes
86
- ),
87
- destination.enqueue(currentView),
88
- (chunk = chunk.subarray(allowableBytes))),
89
- (currentView = new Uint8Array(2048)),
90
- (writtenBytes = 0));
91
- currentView.set(chunk, writtenBytes);
92
- writtenBytes += chunk.byteLength;
93
- }
80
+ (didWarnAboutMissingArrayBufferDetached = !0));
81
+ else if (2048 < chunk.byteLength)
82
+ 0 < writtenBytes &&
83
+ (destination.enqueue(
84
+ new Uint8Array(currentView.buffer, 0, writtenBytes)
85
+ ),
86
+ (currentView = new Uint8Array(2048)),
87
+ (writtenBytes = 0)),
88
+ destination.enqueue(chunk);
89
+ else {
90
+ var allowableBytes = currentView.length - writtenBytes;
91
+ allowableBytes < chunk.byteLength &&
92
+ (0 === allowableBytes
93
+ ? destination.enqueue(currentView)
94
+ : (currentView.set(chunk.subarray(0, allowableBytes), writtenBytes),
95
+ destination.enqueue(currentView),
96
+ (chunk = chunk.subarray(allowableBytes))),
97
+ (currentView = new Uint8Array(2048)),
98
+ (writtenBytes = 0));
99
+ currentView.set(chunk, writtenBytes);
100
+ writtenBytes += chunk.byteLength;
101
+ }
94
102
  return !0;
95
103
  }
96
104
  function completeWriting(destination) {
@@ -2727,14 +2735,35 @@
2727
2735
  }
2728
2736
  function emitTypedArrayChunk(request, id, tag, typedArray, debug) {
2729
2737
  debug ? request.pendingDebugChunks++ : request.pendingChunks++;
2730
- var buffer = new Uint8Array(
2731
- typedArray.buffer,
2732
- typedArray.byteOffset,
2733
- typedArray.byteLength
2734
- );
2735
- typedArray = 2048 < typedArray.byteLength ? buffer.slice() : buffer;
2736
- buffer = typedArray.byteLength;
2737
- id = id.toString(16) + ":" + tag + buffer.toString(16) + ",";
2738
+ a: {
2739
+ var view = new Uint8Array(
2740
+ typedArray.buffer,
2741
+ typedArray.byteOffset,
2742
+ typedArray.byteLength
2743
+ );
2744
+ if (2048 < typedArray.byteLength) {
2745
+ if (
2746
+ 0 !== typedArray.byteOffset ||
2747
+ typedArray.byteLength !== typedArray.buffer.byteLength ||
2748
+ typedArray.buffer.resizable
2749
+ ) {
2750
+ typedArray = view.slice();
2751
+ break a;
2752
+ }
2753
+ if (!supportsArrayBufferDetached) {
2754
+ didWarnAboutMissingArrayBufferDetached ||
2755
+ (console.error(
2756
+ "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 use a modern browser that supports ArrayBuffer.prototype.detached."
2757
+ ),
2758
+ (didWarnAboutMissingArrayBufferDetached = !0));
2759
+ typedArray = view.slice();
2760
+ break a;
2761
+ }
2762
+ }
2763
+ typedArray = view;
2764
+ }
2765
+ view = typedArray.byteLength;
2766
+ id = id.toString(16) + ":" + tag + view.toString(16) + ",";
2738
2767
  id = stringToChunk(id);
2739
2768
  debug
2740
2769
  ? request.completedDebugChunks.push(id, typedArray)
@@ -3722,6 +3751,39 @@
3722
3751
  });
3723
3752
  enqueueFlush(request);
3724
3753
  }
3754
+ function appendBackingEntry(backingStore, value, key) {
3755
+ var prefix = backingStore.prefix;
3756
+ if (key.startsWith(prefix)) {
3757
+ switch (key[prefix.length]) {
3758
+ case "_":
3759
+ prefix = backingStore.referencedEntries;
3760
+ null === prefix && (prefix = backingStore.referencedEntries = []);
3761
+ prefix.push([key, value]);
3762
+ return;
3763
+ case "S":
3764
+ "string" === typeof value &&
3765
+ ((prefix = backingStore.streamChunks),
3766
+ null === prefix &&
3767
+ (prefix = backingStore.streamChunks = new Map()),
3768
+ (backingStore = prefix.get(key)),
3769
+ void 0 === backingStore
3770
+ ? prefix.set(key, [value])
3771
+ : backingStore.push(value));
3772
+ return;
3773
+ }
3774
+ "string" === typeof value
3775
+ ? ((prefix = backingStore.stringChunks),
3776
+ null === prefix && (prefix = backingStore.stringChunks = new Map()),
3777
+ prefix.set(key, value))
3778
+ : ((prefix = backingStore.blobs),
3779
+ null === prefix && (prefix = backingStore.blobs = new Map()),
3780
+ prefix.set(key, value));
3781
+ }
3782
+ }
3783
+ function getBackingBlob(backingStore, key) {
3784
+ backingStore = backingStore.blobs;
3785
+ return null === backingStore ? void 0 : backingStore.get(key);
3786
+ }
3725
3787
  function ReactPromise(status, value, reason) {
3726
3788
  this.status = status;
3727
3789
  this.value = value;
@@ -4033,9 +4095,11 @@
4033
4095
  function getChunk(response, id) {
4034
4096
  var chunks = response._chunks,
4035
4097
  chunk = chunks.get(id);
4036
- chunk ||
4037
- ((chunk = response._formData.data.get(response._prefix + id)),
4038
- (chunk =
4098
+ if (!chunk) {
4099
+ chunk = response._prefix;
4100
+ var stringChunks = response._formData.stringChunks;
4101
+ chunk = null === stringChunks ? void 0 : stringChunks.get(chunk + id);
4102
+ chunk =
4039
4103
  "string" === typeof chunk
4040
4104
  ? new ReactPromise(
4041
4105
  "resolved_model",
@@ -4044,8 +4108,9 @@
4044
4108
  )
4045
4109
  : response._closed
4046
4110
  ? new ReactPromise("rejected", null, response._closedReason)
4047
- : new ReactPromise("pending", null, null)),
4048
- chunks.set(id, chunk));
4111
+ : new ReactPromise("pending", null, null);
4112
+ chunks.set(id, chunk);
4113
+ }
4049
4114
  return chunk;
4050
4115
  }
4051
4116
  function fulfillReference(response, reference, value, arrayRoot) {
@@ -4292,7 +4357,7 @@
4292
4357
  Error("Already initialized typed array.")
4293
4358
  )
4294
4359
  );
4295
- reference = response._formData.data.get(key).arrayBuffer();
4360
+ reference = getBackingBlob(response._formData, key).arrayBuffer();
4296
4361
  if (initializingHandler) {
4297
4362
  var handler = initializingHandler;
4298
4363
  handler.deps++;
@@ -4336,15 +4401,17 @@
4336
4401
  var chunks = response._chunks;
4337
4402
  stream = new ReactPromise("fulfilled", stream, controller);
4338
4403
  chunks.set(id, stream);
4339
- response = response._formData.data.getAll(response._prefix + id);
4340
- for (id = 0; id < response.length; id++)
4341
- (chunks = response[id]),
4342
- "string" === typeof chunks &&
4343
- ("C" === chunks[0]
4404
+ chunks = response._prefix;
4405
+ response = response._formData.streamChunks;
4406
+ id = null === response ? void 0 : response.get(chunks + "S" + id);
4407
+ if (void 0 !== id)
4408
+ for (response = 0; response < id.length; response++)
4409
+ (chunks = id[response]),
4410
+ "C" === chunks[0]
4344
4411
  ? controller.close(
4345
4412
  "C" === chunks ? '"$undefined"' : chunks.slice(1)
4346
4413
  )
4347
- : controller.enqueueModel(chunks));
4414
+ : controller.enqueueModel(chunks);
4348
4415
  }
4349
4416
  function parseReadableStream(response, reference, type) {
4350
4417
  function enqueue(value) {
@@ -4508,7 +4575,14 @@
4508
4575
  });
4509
4576
  return iterator;
4510
4577
  }
4511
- function parseModelString(response, obj, key, value, reference, arrayRoot) {
4578
+ function parseModelString(
4579
+ response,
4580
+ obj,
4581
+ key$jscomp$0,
4582
+ value,
4583
+ reference,
4584
+ arrayRoot
4585
+ ) {
4512
4586
  if ("$" === value[0]) {
4513
4587
  switch (value[1]) {
4514
4588
  case "$":
@@ -4528,7 +4602,7 @@
4528
4602
  response,
4529
4603
  arrayRoot,
4530
4604
  obj,
4531
- key,
4605
+ key$jscomp$0,
4532
4606
  null,
4533
4607
  loadServerReference$1
4534
4608
  )
@@ -4548,41 +4622,44 @@
4548
4622
  case "Q":
4549
4623
  return (
4550
4624
  (arrayRoot = value.slice(2)),
4551
- getOutlinedModel(response, arrayRoot, obj, key, null, createMap)
4625
+ getOutlinedModel(
4626
+ response,
4627
+ arrayRoot,
4628
+ obj,
4629
+ key$jscomp$0,
4630
+ null,
4631
+ createMap
4632
+ )
4552
4633
  );
4553
4634
  case "W":
4554
4635
  return (
4555
4636
  (arrayRoot = value.slice(2)),
4556
- getOutlinedModel(response, arrayRoot, obj, key, null, createSet)
4637
+ getOutlinedModel(
4638
+ response,
4639
+ arrayRoot,
4640
+ obj,
4641
+ key$jscomp$0,
4642
+ null,
4643
+ createSet
4644
+ )
4557
4645
  );
4558
4646
  case "K":
4559
- key = value.slice(2);
4560
- obj = response._prefix + "_";
4561
- key = obj + key + "_";
4562
- arrayRoot = new FormData();
4563
- for (response = response._formData; ; ) {
4564
- value = response;
4565
- reference = value.keys;
4566
- null === reference &&
4567
- ((reference = value.keys = Array.from(value.data.keys())),
4568
- (value.keyPointer = 0));
4569
- value = reference[value.keyPointer];
4570
- if (void 0 === value) break;
4571
- if (value.startsWith(key)) {
4572
- reference = response.data.getAll(value);
4573
- for (
4574
- var referencedFormDataKey = value.slice(key.length), i = 0;
4575
- i < reference.length;
4576
- i++
4577
- )
4578
- arrayRoot.append(referencedFormDataKey, reference[i]);
4579
- reference = response;
4580
- reference.data.delete(value);
4581
- reference.keyPointer++;
4582
- } else if (value.startsWith(obj)) break;
4583
- else response.keyPointer++;
4647
+ key$jscomp$0 = value.slice(2);
4648
+ obj = response._formData;
4649
+ response = response._prefix + "_" + key$jscomp$0 + "_";
4650
+ key$jscomp$0 = new FormData();
4651
+ arrayRoot = obj.referencedEntries;
4652
+ if (null !== arrayRoot) {
4653
+ for (value = obj.keyPointer; value < arrayRoot.length; ) {
4654
+ reference = arrayRoot[value];
4655
+ var key = reference[0];
4656
+ if (!key.startsWith(response)) break;
4657
+ key$jscomp$0.append(key.slice(response.length), reference[1]);
4658
+ value++;
4659
+ }
4660
+ obj.keyPointer = value;
4584
4661
  }
4585
- return arrayRoot;
4662
+ return key$jscomp$0;
4586
4663
  case "i":
4587
4664
  return (
4588
4665
  (arrayRoot = value.slice(2)),
@@ -4590,7 +4667,7 @@
4590
4667
  response,
4591
4668
  arrayRoot,
4592
4669
  obj,
4593
- key,
4670
+ key$jscomp$0,
4594
4671
  null,
4595
4672
  extractIterator
4596
4673
  )
@@ -4625,7 +4702,7 @@
4625
4702
  ArrayBuffer,
4626
4703
  1,
4627
4704
  obj,
4628
- key,
4705
+ key$jscomp$0,
4629
4706
  arrayRoot
4630
4707
  );
4631
4708
  case "O":
@@ -4635,7 +4712,7 @@
4635
4712
  Int8Array,
4636
4713
  1,
4637
4714
  obj,
4638
- key,
4715
+ key$jscomp$0,
4639
4716
  arrayRoot
4640
4717
  );
4641
4718
  case "o":
@@ -4645,7 +4722,7 @@
4645
4722
  Uint8Array,
4646
4723
  1,
4647
4724
  obj,
4648
- key,
4725
+ key$jscomp$0,
4649
4726
  arrayRoot
4650
4727
  );
4651
4728
  case "U":
@@ -4655,7 +4732,7 @@
4655
4732
  Uint8ClampedArray,
4656
4733
  1,
4657
4734
  obj,
4658
- key,
4735
+ key$jscomp$0,
4659
4736
  arrayRoot
4660
4737
  );
4661
4738
  case "S":
@@ -4665,7 +4742,7 @@
4665
4742
  Int16Array,
4666
4743
  2,
4667
4744
  obj,
4668
- key,
4745
+ key$jscomp$0,
4669
4746
  arrayRoot
4670
4747
  );
4671
4748
  case "s":
@@ -4675,7 +4752,7 @@
4675
4752
  Uint16Array,
4676
4753
  2,
4677
4754
  obj,
4678
- key,
4755
+ key$jscomp$0,
4679
4756
  arrayRoot
4680
4757
  );
4681
4758
  case "L":
@@ -4685,7 +4762,7 @@
4685
4762
  Int32Array,
4686
4763
  4,
4687
4764
  obj,
4688
- key,
4765
+ key$jscomp$0,
4689
4766
  arrayRoot
4690
4767
  );
4691
4768
  case "l":
@@ -4695,7 +4772,7 @@
4695
4772
  Uint32Array,
4696
4773
  4,
4697
4774
  obj,
4698
- key,
4775
+ key$jscomp$0,
4699
4776
  arrayRoot
4700
4777
  );
4701
4778
  case "G":
@@ -4705,7 +4782,7 @@
4705
4782
  Float32Array,
4706
4783
  4,
4707
4784
  obj,
4708
- key,
4785
+ key$jscomp$0,
4709
4786
  arrayRoot
4710
4787
  );
4711
4788
  case "g":
@@ -4715,7 +4792,7 @@
4715
4792
  Float64Array,
4716
4793
  8,
4717
4794
  obj,
4718
- key,
4795
+ key$jscomp$0,
4719
4796
  arrayRoot
4720
4797
  );
4721
4798
  case "M":
@@ -4725,7 +4802,7 @@
4725
4802
  BigInt64Array,
4726
4803
  8,
4727
4804
  obj,
4728
- key,
4805
+ key$jscomp$0,
4729
4806
  arrayRoot
4730
4807
  );
4731
4808
  case "m":
@@ -4735,7 +4812,7 @@
4735
4812
  BigUint64Array,
4736
4813
  8,
4737
4814
  obj,
4738
- key,
4815
+ key$jscomp$0,
4739
4816
  arrayRoot
4740
4817
  );
4741
4818
  case "V":
@@ -4745,13 +4822,13 @@
4745
4822
  DataView,
4746
4823
  1,
4747
4824
  obj,
4748
- key,
4825
+ key$jscomp$0,
4749
4826
  arrayRoot
4750
4827
  );
4751
4828
  case "B":
4752
4829
  return (
4753
4830
  (obj = parseInt(value.slice(2), 16)),
4754
- response._formData.data.get(response._prefix + obj)
4831
+ getBackingBlob(response._formData, response._prefix + obj)
4755
4832
  );
4756
4833
  case "R":
4757
4834
  return parseReadableStream(response, value, void 0);
@@ -4767,7 +4844,7 @@
4767
4844
  response,
4768
4845
  value,
4769
4846
  obj,
4770
- key,
4847
+ key$jscomp$0,
4771
4848
  arrayRoot,
4772
4849
  createModel
4773
4850
  );
@@ -4786,11 +4863,20 @@
4786
4863
  : new FormData(),
4787
4864
  arraySizeLimit =
4788
4865
  4 < arguments.length && void 0 !== arguments[4] ? arguments[4] : 1e6,
4789
- chunks = new Map();
4866
+ chunks = new Map(),
4867
+ backingStore = {
4868
+ prefix: formFieldPrefix,
4869
+ referencedEntries: null,
4870
+ keyPointer: 0,
4871
+ stringChunks: null,
4872
+ streamChunks: null,
4873
+ blobs: null
4874
+ };
4875
+ backingFormData.forEach(appendBackingEntry.bind(null, backingStore));
4790
4876
  return {
4791
4877
  _bundlerConfig: bundlerConfig,
4792
4878
  _prefix: formFieldPrefix,
4793
- _formData: { data: backingFormData, keyPointer: -1, keys: null },
4879
+ _formData: backingStore,
4794
4880
  _chunks: chunks,
4795
4881
  _closed: !1,
4796
4882
  _closedReason: null,
@@ -4992,7 +5078,12 @@
4992
5078
  var task = taskQueue.shift();
4993
5079
  task && task();
4994
5080
  };
4995
- var LocalPromise = Promise,
5081
+ var supportsArrayBufferDetached = hasOwnProperty.call(
5082
+ ArrayBuffer.prototype,
5083
+ "detached"
5084
+ ),
5085
+ didWarnAboutMissingArrayBufferDetached = !1,
5086
+ LocalPromise = Promise,
4996
5087
  scheduleMicrotask =
4997
5088
  "function" === typeof queueMicrotask
4998
5089
  ? queueMicrotask