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.
@@ -43,31 +43,39 @@
43
43
  });
44
44
  }
45
45
  function writeChunkAndReturn(destination, chunk) {
46
- if (0 !== chunk.byteLength)
47
- if (2048 < chunk.byteLength)
48
- 0 < writtenBytes &&
49
- (destination.enqueue(
50
- new Uint8Array(currentView.buffer, 0, writtenBytes)
46
+ if (0 === chunk.byteLength)
47
+ if (supportsArrayBufferDetached) {
48
+ if (chunk.buffer.detached)
49
+ throw Error(
50
+ "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()`."
51
+ );
52
+ } else
53
+ didWarnAboutMissingArrayBufferDetached ||
54
+ (console.error(
55
+ "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."
51
56
  ),
52
- (currentView = new Uint8Array(2048)),
53
- (writtenBytes = 0)),
54
- destination.enqueue(chunk);
55
- else {
56
- var allowableBytes = currentView.length - writtenBytes;
57
- allowableBytes < chunk.byteLength &&
58
- (0 === allowableBytes
59
- ? destination.enqueue(currentView)
60
- : (currentView.set(
61
- chunk.subarray(0, allowableBytes),
62
- writtenBytes
63
- ),
64
- destination.enqueue(currentView),
65
- (chunk = chunk.subarray(allowableBytes))),
66
- (currentView = new Uint8Array(2048)),
67
- (writtenBytes = 0));
68
- currentView.set(chunk, writtenBytes);
69
- writtenBytes += chunk.byteLength;
70
- }
57
+ (didWarnAboutMissingArrayBufferDetached = !0));
58
+ else if (2048 < chunk.byteLength)
59
+ 0 < writtenBytes &&
60
+ (destination.enqueue(
61
+ new Uint8Array(currentView.buffer, 0, writtenBytes)
62
+ ),
63
+ (currentView = new Uint8Array(2048)),
64
+ (writtenBytes = 0)),
65
+ destination.enqueue(chunk);
66
+ else {
67
+ var allowableBytes = currentView.length - writtenBytes;
68
+ allowableBytes < chunk.byteLength &&
69
+ (0 === allowableBytes
70
+ ? destination.enqueue(currentView)
71
+ : (currentView.set(chunk.subarray(0, allowableBytes), writtenBytes),
72
+ destination.enqueue(currentView),
73
+ (chunk = chunk.subarray(allowableBytes))),
74
+ (currentView = new Uint8Array(2048)),
75
+ (writtenBytes = 0));
76
+ currentView.set(chunk, writtenBytes);
77
+ writtenBytes += chunk.byteLength;
78
+ }
71
79
  return !0;
72
80
  }
73
81
  function stringToChunk(content) {
@@ -2110,14 +2118,35 @@
2110
2118
  }
2111
2119
  function emitTypedArrayChunk(request, id, tag, typedArray) {
2112
2120
  request.pendingChunks++;
2113
- var buffer = new Uint8Array(
2114
- typedArray.buffer,
2115
- typedArray.byteOffset,
2116
- typedArray.byteLength
2117
- );
2118
- typedArray = 2048 < typedArray.byteLength ? buffer.slice() : buffer;
2119
- buffer = typedArray.byteLength;
2120
- id = id.toString(16) + ":" + tag + buffer.toString(16) + ",";
2121
+ a: {
2122
+ var view = new Uint8Array(
2123
+ typedArray.buffer,
2124
+ typedArray.byteOffset,
2125
+ typedArray.byteLength
2126
+ );
2127
+ if (2048 < typedArray.byteLength) {
2128
+ if (
2129
+ 0 !== typedArray.byteOffset ||
2130
+ typedArray.byteLength !== typedArray.buffer.byteLength ||
2131
+ typedArray.buffer.resizable
2132
+ ) {
2133
+ typedArray = view.slice();
2134
+ break a;
2135
+ }
2136
+ if (!supportsArrayBufferDetached) {
2137
+ didWarnAboutMissingArrayBufferDetached ||
2138
+ (console.error(
2139
+ "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."
2140
+ ),
2141
+ (didWarnAboutMissingArrayBufferDetached = !0));
2142
+ typedArray = view.slice();
2143
+ break a;
2144
+ }
2145
+ }
2146
+ typedArray = view;
2147
+ }
2148
+ view = typedArray.byteLength;
2149
+ id = id.toString(16) + ":" + tag + view.toString(16) + ",";
2121
2150
  id = stringToChunk(id);
2122
2151
  request.completedRegularChunks.push(id, typedArray);
2123
2152
  }
@@ -2759,6 +2788,39 @@
2759
2788
  chunkMap.set(chunkId, filename);
2760
2789
  return __webpack_chunk_load__(chunkId);
2761
2790
  }
2791
+ function appendBackingEntry(backingStore, value, key) {
2792
+ var prefix = backingStore.prefix;
2793
+ if (key.startsWith(prefix)) {
2794
+ switch (key[prefix.length]) {
2795
+ case "_":
2796
+ prefix = backingStore.referencedEntries;
2797
+ null === prefix && (prefix = backingStore.referencedEntries = []);
2798
+ prefix.push([key, value]);
2799
+ return;
2800
+ case "S":
2801
+ "string" === typeof value &&
2802
+ ((prefix = backingStore.streamChunks),
2803
+ null === prefix &&
2804
+ (prefix = backingStore.streamChunks = new Map()),
2805
+ (backingStore = prefix.get(key)),
2806
+ void 0 === backingStore
2807
+ ? prefix.set(key, [value])
2808
+ : backingStore.push(value));
2809
+ return;
2810
+ }
2811
+ "string" === typeof value
2812
+ ? ((prefix = backingStore.stringChunks),
2813
+ null === prefix && (prefix = backingStore.stringChunks = new Map()),
2814
+ prefix.set(key, value))
2815
+ : ((prefix = backingStore.blobs),
2816
+ null === prefix && (prefix = backingStore.blobs = new Map()),
2817
+ prefix.set(key, value));
2818
+ }
2819
+ }
2820
+ function getBackingBlob(backingStore, key) {
2821
+ backingStore = backingStore.blobs;
2822
+ return null === backingStore ? void 0 : backingStore.get(key);
2823
+ }
2762
2824
  function ReactPromise(status, value, reason) {
2763
2825
  this.status = status;
2764
2826
  this.value = value;
@@ -3070,9 +3132,11 @@
3070
3132
  function getChunk(response, id) {
3071
3133
  var chunks = response._chunks,
3072
3134
  chunk = chunks.get(id);
3073
- chunk ||
3074
- ((chunk = response._formData.data.get(response._prefix + id)),
3075
- (chunk =
3135
+ if (!chunk) {
3136
+ chunk = response._prefix;
3137
+ var stringChunks = response._formData.stringChunks;
3138
+ chunk = null === stringChunks ? void 0 : stringChunks.get(chunk + id);
3139
+ chunk =
3076
3140
  "string" === typeof chunk
3077
3141
  ? new ReactPromise(
3078
3142
  "resolved_model",
@@ -3081,8 +3145,9 @@
3081
3145
  )
3082
3146
  : response._closed
3083
3147
  ? new ReactPromise("rejected", null, response._closedReason)
3084
- : new ReactPromise("pending", null, null)),
3085
- chunks.set(id, chunk));
3148
+ : new ReactPromise("pending", null, null);
3149
+ chunks.set(id, chunk);
3150
+ }
3086
3151
  return chunk;
3087
3152
  }
3088
3153
  function fulfillReference(response, reference, value, arrayRoot) {
@@ -3329,7 +3394,7 @@
3329
3394
  Error("Already initialized typed array.")
3330
3395
  )
3331
3396
  );
3332
- reference = response._formData.data.get(key).arrayBuffer();
3397
+ reference = getBackingBlob(response._formData, key).arrayBuffer();
3333
3398
  if (initializingHandler) {
3334
3399
  var handler = initializingHandler;
3335
3400
  handler.deps++;
@@ -3373,15 +3438,17 @@
3373
3438
  var chunks = response._chunks;
3374
3439
  stream = new ReactPromise("fulfilled", stream, controller);
3375
3440
  chunks.set(id, stream);
3376
- response = response._formData.data.getAll(response._prefix + id);
3377
- for (id = 0; id < response.length; id++)
3378
- (chunks = response[id]),
3379
- "string" === typeof chunks &&
3380
- ("C" === chunks[0]
3441
+ chunks = response._prefix;
3442
+ response = response._formData.streamChunks;
3443
+ id = null === response ? void 0 : response.get(chunks + "S" + id);
3444
+ if (void 0 !== id)
3445
+ for (response = 0; response < id.length; response++)
3446
+ (chunks = id[response]),
3447
+ "C" === chunks[0]
3381
3448
  ? controller.close(
3382
3449
  "C" === chunks ? '"$undefined"' : chunks.slice(1)
3383
3450
  )
3384
- : controller.enqueueModel(chunks));
3451
+ : controller.enqueueModel(chunks);
3385
3452
  }
3386
3453
  function parseReadableStream(response, reference, type) {
3387
3454
  function enqueue(value) {
@@ -3545,7 +3612,14 @@
3545
3612
  });
3546
3613
  return iterator;
3547
3614
  }
3548
- function parseModelString(response, obj, key, value, reference, arrayRoot) {
3615
+ function parseModelString(
3616
+ response,
3617
+ obj,
3618
+ key$jscomp$0,
3619
+ value,
3620
+ reference,
3621
+ arrayRoot
3622
+ ) {
3549
3623
  if ("$" === value[0]) {
3550
3624
  switch (value[1]) {
3551
3625
  case "$":
@@ -3565,7 +3639,7 @@
3565
3639
  response,
3566
3640
  arrayRoot,
3567
3641
  obj,
3568
- key,
3642
+ key$jscomp$0,
3569
3643
  null,
3570
3644
  loadServerReference$1
3571
3645
  )
@@ -3585,41 +3659,44 @@
3585
3659
  case "Q":
3586
3660
  return (
3587
3661
  (arrayRoot = value.slice(2)),
3588
- getOutlinedModel(response, arrayRoot, obj, key, null, createMap)
3662
+ getOutlinedModel(
3663
+ response,
3664
+ arrayRoot,
3665
+ obj,
3666
+ key$jscomp$0,
3667
+ null,
3668
+ createMap
3669
+ )
3589
3670
  );
3590
3671
  case "W":
3591
3672
  return (
3592
3673
  (arrayRoot = value.slice(2)),
3593
- getOutlinedModel(response, arrayRoot, obj, key, null, createSet)
3674
+ getOutlinedModel(
3675
+ response,
3676
+ arrayRoot,
3677
+ obj,
3678
+ key$jscomp$0,
3679
+ null,
3680
+ createSet
3681
+ )
3594
3682
  );
3595
3683
  case "K":
3596
- key = value.slice(2);
3597
- obj = response._prefix + "_";
3598
- key = obj + key + "_";
3599
- arrayRoot = new FormData();
3600
- for (response = response._formData; ; ) {
3601
- value = response;
3602
- reference = value.keys;
3603
- null === reference &&
3604
- ((reference = value.keys = Array.from(value.data.keys())),
3605
- (value.keyPointer = 0));
3606
- value = reference[value.keyPointer];
3607
- if (void 0 === value) break;
3608
- if (value.startsWith(key)) {
3609
- reference = response.data.getAll(value);
3610
- for (
3611
- var referencedFormDataKey = value.slice(key.length), i = 0;
3612
- i < reference.length;
3613
- i++
3614
- )
3615
- arrayRoot.append(referencedFormDataKey, reference[i]);
3616
- reference = response;
3617
- reference.data.delete(value);
3618
- reference.keyPointer++;
3619
- } else if (value.startsWith(obj)) break;
3620
- else response.keyPointer++;
3684
+ key$jscomp$0 = value.slice(2);
3685
+ obj = response._formData;
3686
+ response = response._prefix + "_" + key$jscomp$0 + "_";
3687
+ key$jscomp$0 = new FormData();
3688
+ arrayRoot = obj.referencedEntries;
3689
+ if (null !== arrayRoot) {
3690
+ for (value = obj.keyPointer; value < arrayRoot.length; ) {
3691
+ reference = arrayRoot[value];
3692
+ var key = reference[0];
3693
+ if (!key.startsWith(response)) break;
3694
+ key$jscomp$0.append(key.slice(response.length), reference[1]);
3695
+ value++;
3696
+ }
3697
+ obj.keyPointer = value;
3621
3698
  }
3622
- return arrayRoot;
3699
+ return key$jscomp$0;
3623
3700
  case "i":
3624
3701
  return (
3625
3702
  (arrayRoot = value.slice(2)),
@@ -3627,7 +3704,7 @@
3627
3704
  response,
3628
3705
  arrayRoot,
3629
3706
  obj,
3630
- key,
3707
+ key$jscomp$0,
3631
3708
  null,
3632
3709
  extractIterator
3633
3710
  )
@@ -3662,7 +3739,7 @@
3662
3739
  ArrayBuffer,
3663
3740
  1,
3664
3741
  obj,
3665
- key,
3742
+ key$jscomp$0,
3666
3743
  arrayRoot
3667
3744
  );
3668
3745
  case "O":
@@ -3672,7 +3749,7 @@
3672
3749
  Int8Array,
3673
3750
  1,
3674
3751
  obj,
3675
- key,
3752
+ key$jscomp$0,
3676
3753
  arrayRoot
3677
3754
  );
3678
3755
  case "o":
@@ -3682,7 +3759,7 @@
3682
3759
  Uint8Array,
3683
3760
  1,
3684
3761
  obj,
3685
- key,
3762
+ key$jscomp$0,
3686
3763
  arrayRoot
3687
3764
  );
3688
3765
  case "U":
@@ -3692,7 +3769,7 @@
3692
3769
  Uint8ClampedArray,
3693
3770
  1,
3694
3771
  obj,
3695
- key,
3772
+ key$jscomp$0,
3696
3773
  arrayRoot
3697
3774
  );
3698
3775
  case "S":
@@ -3702,7 +3779,7 @@
3702
3779
  Int16Array,
3703
3780
  2,
3704
3781
  obj,
3705
- key,
3782
+ key$jscomp$0,
3706
3783
  arrayRoot
3707
3784
  );
3708
3785
  case "s":
@@ -3712,7 +3789,7 @@
3712
3789
  Uint16Array,
3713
3790
  2,
3714
3791
  obj,
3715
- key,
3792
+ key$jscomp$0,
3716
3793
  arrayRoot
3717
3794
  );
3718
3795
  case "L":
@@ -3722,7 +3799,7 @@
3722
3799
  Int32Array,
3723
3800
  4,
3724
3801
  obj,
3725
- key,
3802
+ key$jscomp$0,
3726
3803
  arrayRoot
3727
3804
  );
3728
3805
  case "l":
@@ -3732,7 +3809,7 @@
3732
3809
  Uint32Array,
3733
3810
  4,
3734
3811
  obj,
3735
- key,
3812
+ key$jscomp$0,
3736
3813
  arrayRoot
3737
3814
  );
3738
3815
  case "G":
@@ -3742,7 +3819,7 @@
3742
3819
  Float32Array,
3743
3820
  4,
3744
3821
  obj,
3745
- key,
3822
+ key$jscomp$0,
3746
3823
  arrayRoot
3747
3824
  );
3748
3825
  case "g":
@@ -3752,7 +3829,7 @@
3752
3829
  Float64Array,
3753
3830
  8,
3754
3831
  obj,
3755
- key,
3832
+ key$jscomp$0,
3756
3833
  arrayRoot
3757
3834
  );
3758
3835
  case "M":
@@ -3762,7 +3839,7 @@
3762
3839
  BigInt64Array,
3763
3840
  8,
3764
3841
  obj,
3765
- key,
3842
+ key$jscomp$0,
3766
3843
  arrayRoot
3767
3844
  );
3768
3845
  case "m":
@@ -3772,7 +3849,7 @@
3772
3849
  BigUint64Array,
3773
3850
  8,
3774
3851
  obj,
3775
- key,
3852
+ key$jscomp$0,
3776
3853
  arrayRoot
3777
3854
  );
3778
3855
  case "V":
@@ -3782,13 +3859,13 @@
3782
3859
  DataView,
3783
3860
  1,
3784
3861
  obj,
3785
- key,
3862
+ key$jscomp$0,
3786
3863
  arrayRoot
3787
3864
  );
3788
3865
  case "B":
3789
3866
  return (
3790
3867
  (obj = parseInt(value.slice(2), 16)),
3791
- response._formData.data.get(response._prefix + obj)
3868
+ getBackingBlob(response._formData, response._prefix + obj)
3792
3869
  );
3793
3870
  case "R":
3794
3871
  return parseReadableStream(response, value, void 0);
@@ -3804,7 +3881,7 @@
3804
3881
  response,
3805
3882
  value,
3806
3883
  obj,
3807
- key,
3884
+ key$jscomp$0,
3808
3885
  arrayRoot,
3809
3886
  createModel
3810
3887
  );
@@ -3823,11 +3900,20 @@
3823
3900
  : new FormData(),
3824
3901
  arraySizeLimit =
3825
3902
  4 < arguments.length && void 0 !== arguments[4] ? arguments[4] : 1e6,
3826
- chunks = new Map();
3903
+ chunks = new Map(),
3904
+ backingStore = {
3905
+ prefix: formFieldPrefix,
3906
+ referencedEntries: null,
3907
+ keyPointer: 0,
3908
+ stringChunks: null,
3909
+ streamChunks: null,
3910
+ blobs: null
3911
+ };
3912
+ backingFormData.forEach(appendBackingEntry.bind(null, backingStore));
3827
3913
  return {
3828
3914
  _bundlerConfig: bundlerConfig,
3829
3915
  _prefix: formFieldPrefix,
3830
- _formData: { data: backingFormData, keyPointer: -1, keys: null },
3916
+ _formData: backingStore,
3831
3917
  _chunks: chunks,
3832
3918
  _closed: !1,
3833
3919
  _closedReason: null,
@@ -3886,13 +3972,19 @@
3886
3972
  }
3887
3973
  var ReactDOM = require("react-dom"),
3888
3974
  React = require("react"),
3975
+ hasOwnProperty = Object.prototype.hasOwnProperty,
3889
3976
  channel = new MessageChannel(),
3890
3977
  taskQueue = [];
3891
3978
  channel.port1.onmessage = function () {
3892
3979
  var task = taskQueue.shift();
3893
3980
  task && task();
3894
3981
  };
3895
- var LocalPromise = Promise,
3982
+ var supportsArrayBufferDetached = hasOwnProperty.call(
3983
+ ArrayBuffer.prototype,
3984
+ "detached"
3985
+ ),
3986
+ didWarnAboutMissingArrayBufferDetached = !1,
3987
+ LocalPromise = Promise,
3896
3988
  scheduleMicrotask =
3897
3989
  "function" === typeof queueMicrotask
3898
3990
  ? queueMicrotask
@@ -4340,7 +4432,6 @@
4340
4432
  debugID = null,
4341
4433
  modelRoot = !1,
4342
4434
  emptyRoot = {},
4343
- hasOwnProperty = Object.prototype.hasOwnProperty,
4344
4435
  chunkCache = new Map(),
4345
4436
  chunkMap = new Map(),
4346
4437
  webpackGetChunkFilename = __webpack_require__.u;