react-server-dom-webpack 19.1.9 → 19.1.10

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.
@@ -47,31 +47,39 @@
47
47
  });
48
48
  }
49
49
  function writeChunkAndReturn(destination, chunk) {
50
- if (0 !== chunk.byteLength)
51
- if (2048 < chunk.byteLength)
52
- 0 < writtenBytes &&
53
- (destination.enqueue(
54
- new Uint8Array(currentView.buffer, 0, writtenBytes)
50
+ if (0 === chunk.byteLength)
51
+ if (supportsArrayBufferDetached) {
52
+ if (chunk.buffer.detached)
53
+ throw Error(
54
+ "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()`."
55
+ );
56
+ } else
57
+ didWarnAboutMissingArrayBufferDetached ||
58
+ (console.error(
59
+ "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."
55
60
  ),
56
- (currentView = new Uint8Array(2048)),
57
- (writtenBytes = 0)),
58
- destination.enqueue(chunk);
59
- else {
60
- var allowableBytes = currentView.length - writtenBytes;
61
- allowableBytes < chunk.byteLength &&
62
- (0 === allowableBytes
63
- ? destination.enqueue(currentView)
64
- : (currentView.set(
65
- chunk.subarray(0, allowableBytes),
66
- writtenBytes
67
- ),
68
- destination.enqueue(currentView),
69
- (chunk = chunk.subarray(allowableBytes))),
70
- (currentView = new Uint8Array(2048)),
71
- (writtenBytes = 0));
72
- currentView.set(chunk, writtenBytes);
73
- writtenBytes += chunk.byteLength;
74
- }
61
+ (didWarnAboutMissingArrayBufferDetached = !0));
62
+ else if (2048 < chunk.byteLength)
63
+ 0 < writtenBytes &&
64
+ (destination.enqueue(
65
+ new Uint8Array(currentView.buffer, 0, writtenBytes)
66
+ ),
67
+ (currentView = new Uint8Array(2048)),
68
+ (writtenBytes = 0)),
69
+ destination.enqueue(chunk);
70
+ else {
71
+ var allowableBytes = currentView.length - writtenBytes;
72
+ allowableBytes < chunk.byteLength &&
73
+ (0 === allowableBytes
74
+ ? destination.enqueue(currentView)
75
+ : (currentView.set(chunk.subarray(0, allowableBytes), writtenBytes),
76
+ destination.enqueue(currentView),
77
+ (chunk = chunk.subarray(allowableBytes))),
78
+ (currentView = new Uint8Array(2048)),
79
+ (writtenBytes = 0));
80
+ currentView.set(chunk, writtenBytes);
81
+ writtenBytes += chunk.byteLength;
82
+ }
75
83
  return !0;
76
84
  }
77
85
  function stringToChunk(content) {
@@ -2184,14 +2192,35 @@
2184
2192
  }
2185
2193
  function emitTypedArrayChunk(request, id, tag, typedArray) {
2186
2194
  request.pendingChunks++;
2187
- var buffer = new Uint8Array(
2188
- typedArray.buffer,
2189
- typedArray.byteOffset,
2190
- typedArray.byteLength
2191
- );
2192
- typedArray = 2048 < typedArray.byteLength ? buffer.slice() : buffer;
2193
- buffer = typedArray.byteLength;
2194
- id = id.toString(16) + ":" + tag + buffer.toString(16) + ",";
2195
+ a: {
2196
+ var view = new Uint8Array(
2197
+ typedArray.buffer,
2198
+ typedArray.byteOffset,
2199
+ typedArray.byteLength
2200
+ );
2201
+ if (2048 < typedArray.byteLength) {
2202
+ if (
2203
+ 0 !== typedArray.byteOffset ||
2204
+ typedArray.byteLength !== typedArray.buffer.byteLength ||
2205
+ typedArray.buffer.resizable
2206
+ ) {
2207
+ typedArray = view.slice();
2208
+ break a;
2209
+ }
2210
+ if (!supportsArrayBufferDetached) {
2211
+ didWarnAboutMissingArrayBufferDetached ||
2212
+ (console.error(
2213
+ "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."
2214
+ ),
2215
+ (didWarnAboutMissingArrayBufferDetached = !0));
2216
+ typedArray = view.slice();
2217
+ break a;
2218
+ }
2219
+ }
2220
+ typedArray = view;
2221
+ }
2222
+ view = typedArray.byteLength;
2223
+ id = id.toString(16) + ":" + tag + view.toString(16) + ",";
2195
2224
  id = stringToChunk(id);
2196
2225
  request.completedRegularChunks.push(id, typedArray);
2197
2226
  }
@@ -2833,13 +2862,38 @@
2833
2862
  if (hasOwnProperty.call(moduleExports, metadata[2]))
2834
2863
  return moduleExports[metadata[2]];
2835
2864
  }
2836
- function appendBackingEntry(backingStore, key, value) {
2837
- backingStore.data.append(key, value);
2838
- value = backingStore.keys;
2839
- null === value
2840
- ? ((backingStore.keys = Array.from(backingStore.data.keys())),
2841
- (backingStore.keyPointer = 0))
2842
- : value.push(key);
2865
+ function appendBackingEntry(backingStore, value, key) {
2866
+ var prefix = backingStore.prefix;
2867
+ if (key.startsWith(prefix)) {
2868
+ switch (key[prefix.length]) {
2869
+ case "_":
2870
+ prefix = backingStore.referencedEntries;
2871
+ null === prefix && (prefix = backingStore.referencedEntries = []);
2872
+ prefix.push([key, value]);
2873
+ return;
2874
+ case "S":
2875
+ "string" === typeof value &&
2876
+ ((prefix = backingStore.streamChunks),
2877
+ null === prefix &&
2878
+ (prefix = backingStore.streamChunks = new Map()),
2879
+ (backingStore = prefix.get(key)),
2880
+ void 0 === backingStore
2881
+ ? prefix.set(key, [value])
2882
+ : backingStore.push(value));
2883
+ return;
2884
+ }
2885
+ "string" === typeof value
2886
+ ? ((prefix = backingStore.stringChunks),
2887
+ null === prefix && (prefix = backingStore.stringChunks = new Map()),
2888
+ prefix.set(key, value))
2889
+ : ((prefix = backingStore.blobs),
2890
+ null === prefix && (prefix = backingStore.blobs = new Map()),
2891
+ prefix.set(key, value));
2892
+ }
2893
+ }
2894
+ function getBackingBlob(backingStore, key) {
2895
+ backingStore = backingStore.blobs;
2896
+ return null === backingStore ? void 0 : backingStore.get(key);
2843
2897
  }
2844
2898
  function ReactPromise(status, value, reason) {
2845
2899
  this.status = status;
@@ -3152,9 +3206,11 @@
3152
3206
  function getChunk(response, id) {
3153
3207
  var chunks = response._chunks,
3154
3208
  chunk = chunks.get(id);
3155
- chunk ||
3156
- ((chunk = response._formData.data.get(response._prefix + id)),
3157
- (chunk =
3209
+ if (!chunk) {
3210
+ chunk = response._prefix;
3211
+ var stringChunks = response._formData.stringChunks;
3212
+ chunk = null === stringChunks ? void 0 : stringChunks.get(chunk + id);
3213
+ chunk =
3158
3214
  "string" === typeof chunk
3159
3215
  ? new ReactPromise(
3160
3216
  "resolved_model",
@@ -3163,8 +3219,9 @@
3163
3219
  )
3164
3220
  : response._closed
3165
3221
  ? new ReactPromise("rejected", null, response._closedReason)
3166
- : new ReactPromise("pending", null, null)),
3167
- chunks.set(id, chunk));
3222
+ : new ReactPromise("pending", null, null);
3223
+ chunks.set(id, chunk);
3224
+ }
3168
3225
  return chunk;
3169
3226
  }
3170
3227
  function fulfillReference(response, reference, value, arrayRoot) {
@@ -3411,7 +3468,7 @@
3411
3468
  Error("Already initialized typed array.")
3412
3469
  )
3413
3470
  );
3414
- reference = response._formData.data.get(key).arrayBuffer();
3471
+ reference = getBackingBlob(response._formData, key).arrayBuffer();
3415
3472
  if (initializingHandler) {
3416
3473
  var handler = initializingHandler;
3417
3474
  handler.deps++;
@@ -3455,15 +3512,17 @@
3455
3512
  var chunks = response._chunks;
3456
3513
  stream = new ReactPromise("fulfilled", stream, controller);
3457
3514
  chunks.set(id, stream);
3458
- response = response._formData.data.getAll(response._prefix + id);
3459
- for (id = 0; id < response.length; id++)
3460
- (chunks = response[id]),
3461
- "string" === typeof chunks &&
3462
- ("C" === chunks[0]
3515
+ chunks = response._prefix;
3516
+ response = response._formData.streamChunks;
3517
+ id = null === response ? void 0 : response.get(chunks + "S" + id);
3518
+ if (void 0 !== id)
3519
+ for (response = 0; response < id.length; response++)
3520
+ (chunks = id[response]),
3521
+ "C" === chunks[0]
3463
3522
  ? controller.close(
3464
3523
  "C" === chunks ? '"$undefined"' : chunks.slice(1)
3465
3524
  )
3466
- : controller.enqueueModel(chunks));
3525
+ : controller.enqueueModel(chunks);
3467
3526
  }
3468
3527
  function parseReadableStream(response, reference, type) {
3469
3528
  function enqueue(value) {
@@ -3627,7 +3686,14 @@
3627
3686
  });
3628
3687
  return iterator;
3629
3688
  }
3630
- function parseModelString(response, obj, key, value, reference, arrayRoot) {
3689
+ function parseModelString(
3690
+ response,
3691
+ obj,
3692
+ key$jscomp$0,
3693
+ value,
3694
+ reference,
3695
+ arrayRoot
3696
+ ) {
3631
3697
  if ("$" === value[0]) {
3632
3698
  switch (value[1]) {
3633
3699
  case "$":
@@ -3647,7 +3713,7 @@
3647
3713
  response,
3648
3714
  arrayRoot,
3649
3715
  obj,
3650
- key,
3716
+ key$jscomp$0,
3651
3717
  null,
3652
3718
  loadServerReference$1
3653
3719
  )
@@ -3667,41 +3733,44 @@
3667
3733
  case "Q":
3668
3734
  return (
3669
3735
  (arrayRoot = value.slice(2)),
3670
- getOutlinedModel(response, arrayRoot, obj, key, null, createMap)
3736
+ getOutlinedModel(
3737
+ response,
3738
+ arrayRoot,
3739
+ obj,
3740
+ key$jscomp$0,
3741
+ null,
3742
+ createMap
3743
+ )
3671
3744
  );
3672
3745
  case "W":
3673
3746
  return (
3674
3747
  (arrayRoot = value.slice(2)),
3675
- getOutlinedModel(response, arrayRoot, obj, key, null, createSet)
3748
+ getOutlinedModel(
3749
+ response,
3750
+ arrayRoot,
3751
+ obj,
3752
+ key$jscomp$0,
3753
+ null,
3754
+ createSet
3755
+ )
3676
3756
  );
3677
3757
  case "K":
3678
- key = value.slice(2);
3679
- obj = response._prefix + "_";
3680
- key = obj + key + "_";
3681
- arrayRoot = new FormData();
3682
- for (response = response._formData; ; ) {
3683
- value = response;
3684
- reference = value.keys;
3685
- null === reference &&
3686
- ((reference = value.keys = Array.from(value.data.keys())),
3687
- (value.keyPointer = 0));
3688
- value = reference[value.keyPointer];
3689
- if (void 0 === value) break;
3690
- if (value.startsWith(key)) {
3691
- reference = response.data.getAll(value);
3692
- for (
3693
- var referencedFormDataKey = value.slice(key.length), i = 0;
3694
- i < reference.length;
3695
- i++
3696
- )
3697
- arrayRoot.append(referencedFormDataKey, reference[i]);
3698
- reference = response;
3699
- reference.data.delete(value);
3700
- reference.keyPointer++;
3701
- } else if (value.startsWith(obj)) break;
3702
- else response.keyPointer++;
3758
+ key$jscomp$0 = value.slice(2);
3759
+ obj = response._formData;
3760
+ response = response._prefix + "_" + key$jscomp$0 + "_";
3761
+ key$jscomp$0 = new FormData();
3762
+ arrayRoot = obj.referencedEntries;
3763
+ if (null !== arrayRoot) {
3764
+ for (value = obj.keyPointer; value < arrayRoot.length; ) {
3765
+ reference = arrayRoot[value];
3766
+ var key = reference[0];
3767
+ if (!key.startsWith(response)) break;
3768
+ key$jscomp$0.append(key.slice(response.length), reference[1]);
3769
+ value++;
3770
+ }
3771
+ obj.keyPointer = value;
3703
3772
  }
3704
- return arrayRoot;
3773
+ return key$jscomp$0;
3705
3774
  case "i":
3706
3775
  return (
3707
3776
  (arrayRoot = value.slice(2)),
@@ -3709,7 +3778,7 @@
3709
3778
  response,
3710
3779
  arrayRoot,
3711
3780
  obj,
3712
- key,
3781
+ key$jscomp$0,
3713
3782
  null,
3714
3783
  extractIterator
3715
3784
  )
@@ -3744,7 +3813,7 @@
3744
3813
  ArrayBuffer,
3745
3814
  1,
3746
3815
  obj,
3747
- key,
3816
+ key$jscomp$0,
3748
3817
  arrayRoot
3749
3818
  );
3750
3819
  case "O":
@@ -3754,7 +3823,7 @@
3754
3823
  Int8Array,
3755
3824
  1,
3756
3825
  obj,
3757
- key,
3826
+ key$jscomp$0,
3758
3827
  arrayRoot
3759
3828
  );
3760
3829
  case "o":
@@ -3764,7 +3833,7 @@
3764
3833
  Uint8Array,
3765
3834
  1,
3766
3835
  obj,
3767
- key,
3836
+ key$jscomp$0,
3768
3837
  arrayRoot
3769
3838
  );
3770
3839
  case "U":
@@ -3774,7 +3843,7 @@
3774
3843
  Uint8ClampedArray,
3775
3844
  1,
3776
3845
  obj,
3777
- key,
3846
+ key$jscomp$0,
3778
3847
  arrayRoot
3779
3848
  );
3780
3849
  case "S":
@@ -3784,7 +3853,7 @@
3784
3853
  Int16Array,
3785
3854
  2,
3786
3855
  obj,
3787
- key,
3856
+ key$jscomp$0,
3788
3857
  arrayRoot
3789
3858
  );
3790
3859
  case "s":
@@ -3794,7 +3863,7 @@
3794
3863
  Uint16Array,
3795
3864
  2,
3796
3865
  obj,
3797
- key,
3866
+ key$jscomp$0,
3798
3867
  arrayRoot
3799
3868
  );
3800
3869
  case "L":
@@ -3804,7 +3873,7 @@
3804
3873
  Int32Array,
3805
3874
  4,
3806
3875
  obj,
3807
- key,
3876
+ key$jscomp$0,
3808
3877
  arrayRoot
3809
3878
  );
3810
3879
  case "l":
@@ -3814,7 +3883,7 @@
3814
3883
  Uint32Array,
3815
3884
  4,
3816
3885
  obj,
3817
- key,
3886
+ key$jscomp$0,
3818
3887
  arrayRoot
3819
3888
  );
3820
3889
  case "G":
@@ -3824,7 +3893,7 @@
3824
3893
  Float32Array,
3825
3894
  4,
3826
3895
  obj,
3827
- key,
3896
+ key$jscomp$0,
3828
3897
  arrayRoot
3829
3898
  );
3830
3899
  case "g":
@@ -3834,7 +3903,7 @@
3834
3903
  Float64Array,
3835
3904
  8,
3836
3905
  obj,
3837
- key,
3906
+ key$jscomp$0,
3838
3907
  arrayRoot
3839
3908
  );
3840
3909
  case "M":
@@ -3844,7 +3913,7 @@
3844
3913
  BigInt64Array,
3845
3914
  8,
3846
3915
  obj,
3847
- key,
3916
+ key$jscomp$0,
3848
3917
  arrayRoot
3849
3918
  );
3850
3919
  case "m":
@@ -3854,7 +3923,7 @@
3854
3923
  BigUint64Array,
3855
3924
  8,
3856
3925
  obj,
3857
- key,
3926
+ key$jscomp$0,
3858
3927
  arrayRoot
3859
3928
  );
3860
3929
  case "V":
@@ -3864,13 +3933,13 @@
3864
3933
  DataView,
3865
3934
  1,
3866
3935
  obj,
3867
- key,
3936
+ key$jscomp$0,
3868
3937
  arrayRoot
3869
3938
  );
3870
3939
  case "B":
3871
3940
  return (
3872
3941
  (obj = parseInt(value.slice(2), 16)),
3873
- response._formData.data.get(response._prefix + obj)
3942
+ getBackingBlob(response._formData, response._prefix + obj)
3874
3943
  );
3875
3944
  case "R":
3876
3945
  return parseReadableStream(response, value, void 0);
@@ -3886,7 +3955,7 @@
3886
3955
  response,
3887
3956
  value,
3888
3957
  obj,
3889
- key,
3958
+ key$jscomp$0,
3890
3959
  arrayRoot,
3891
3960
  createModel
3892
3961
  );
@@ -3905,11 +3974,20 @@
3905
3974
  : new FormData(),
3906
3975
  arraySizeLimit =
3907
3976
  4 < arguments.length && void 0 !== arguments[4] ? arguments[4] : 1e6,
3908
- chunks = new Map();
3977
+ chunks = new Map(),
3978
+ backingStore = {
3979
+ prefix: formFieldPrefix,
3980
+ referencedEntries: null,
3981
+ keyPointer: 0,
3982
+ stringChunks: null,
3983
+ streamChunks: null,
3984
+ blobs: null
3985
+ };
3986
+ backingFormData.forEach(appendBackingEntry.bind(null, backingStore));
3909
3987
  return {
3910
3988
  _bundlerConfig: bundlerConfig,
3911
3989
  _prefix: formFieldPrefix,
3912
- _formData: { data: backingFormData, keyPointer: -1, keys: null },
3990
+ _formData: backingStore,
3913
3991
  _chunks: chunks,
3914
3992
  _closed: !1,
3915
3993
  _closedReason: null,
@@ -3982,6 +4060,12 @@
3982
4060
  Symbol.for("react.postpone");
3983
4061
  var MAYBE_ITERATOR_SYMBOL = Symbol.iterator,
3984
4062
  ASYNC_ITERATOR = Symbol.asyncIterator,
4063
+ hasOwnProperty = Object.prototype.hasOwnProperty,
4064
+ supportsArrayBufferDetached = hasOwnProperty.call(
4065
+ ArrayBuffer.prototype,
4066
+ "detached"
4067
+ ),
4068
+ didWarnAboutMissingArrayBufferDetached = !1,
3985
4069
  LocalPromise = Promise,
3986
4070
  scheduleMicrotask =
3987
4071
  "function" === typeof queueMicrotask
@@ -4427,7 +4511,6 @@
4427
4511
  debugID = null,
4428
4512
  modelRoot = !1,
4429
4513
  emptyRoot = {},
4430
- hasOwnProperty = Object.prototype.hasOwnProperty,
4431
4514
  chunkCache = new Map(),
4432
4515
  RESPONSE_SYMBOL = Symbol();
4433
4516
  ReactPromise.prototype = Object.create(Promise.prototype);
@@ -4563,20 +4646,40 @@
4563
4646
  function progress(entry) {
4564
4647
  if (entry.done) close(response$jscomp$0);
4565
4648
  else {
4566
- entry = entry.value;
4567
- var name = entry[0];
4568
- entry = entry[1];
4569
- if ("string" === typeof entry) {
4570
- var response = response$jscomp$0;
4571
- appendBackingEntry(response._formData, name, entry);
4572
- var prefix = response._prefix;
4573
- if (name.startsWith(prefix)) {
4574
- var chunks = response._chunks;
4575
- name = +name.slice(prefix.length);
4576
- (chunks = chunks.get(name)) &&
4577
- resolveModelChunk(response, chunks, entry, name);
4649
+ var _entry$value = entry.value;
4650
+ entry = _entry$value[0];
4651
+ _entry$value = _entry$value[1];
4652
+ if ("string" === typeof _entry$value)
4653
+ a: {
4654
+ var response = response$jscomp$0,
4655
+ prefix = response._prefix;
4656
+ if (entry.startsWith(prefix)) {
4657
+ var chunks = response._chunks;
4658
+ if ("S" === entry[prefix.length]) {
4659
+ if (
4660
+ entry.length > prefix.length + 1 &&
4661
+ ((prefix = +entry.slice(prefix.length + 1)),
4662
+ (chunks = chunks.get(prefix)))
4663
+ ) {
4664
+ resolveModelChunk(response, chunks, _entry$value, prefix);
4665
+ break a;
4666
+ }
4667
+ } else if (
4668
+ ((prefix = +entry.slice(prefix.length)),
4669
+ (chunks = chunks.get(prefix)))
4670
+ ) {
4671
+ resolveModelChunk(response, chunks, _entry$value, prefix);
4672
+ break a;
4673
+ }
4674
+ }
4675
+ appendBackingEntry(response._formData, _entry$value, entry);
4578
4676
  }
4579
- } else appendBackingEntry(response$jscomp$0._formData, name, entry);
4677
+ else
4678
+ appendBackingEntry(
4679
+ response$jscomp$0._formData,
4680
+ _entry$value,
4681
+ entry
4682
+ );
4580
4683
  iterator.next().then(progress, error);
4581
4684
  }
4582
4685
  }