react-server-dom-webpack 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.
@@ -48,31 +48,39 @@
48
48
  });
49
49
  }
50
50
  function writeChunkAndReturn(destination, chunk) {
51
- if (0 !== chunk.byteLength)
52
- if (2048 < chunk.byteLength)
53
- 0 < writtenBytes &&
54
- (destination.enqueue(
55
- new Uint8Array(currentView.buffer, 0, writtenBytes)
51
+ if (0 === chunk.byteLength)
52
+ if (supportsArrayBufferDetached) {
53
+ if (chunk.buffer.detached)
54
+ throw Error(
55
+ "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()`."
56
+ );
57
+ } else
58
+ didWarnAboutMissingArrayBufferDetached ||
59
+ (console.error(
60
+ "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."
56
61
  ),
57
- (currentView = new Uint8Array(2048)),
58
- (writtenBytes = 0)),
59
- destination.enqueue(chunk);
60
- else {
61
- var allowableBytes = currentView.length - writtenBytes;
62
- allowableBytes < chunk.byteLength &&
63
- (0 === allowableBytes
64
- ? destination.enqueue(currentView)
65
- : (currentView.set(
66
- chunk.subarray(0, allowableBytes),
67
- writtenBytes
68
- ),
69
- destination.enqueue(currentView),
70
- (chunk = chunk.subarray(allowableBytes))),
71
- (currentView = new Uint8Array(2048)),
72
- (writtenBytes = 0));
73
- currentView.set(chunk, writtenBytes);
74
- writtenBytes += chunk.byteLength;
75
- }
62
+ (didWarnAboutMissingArrayBufferDetached = !0));
63
+ else if (2048 < chunk.byteLength)
64
+ 0 < writtenBytes &&
65
+ (destination.enqueue(
66
+ new Uint8Array(currentView.buffer, 0, writtenBytes)
67
+ ),
68
+ (currentView = new Uint8Array(2048)),
69
+ (writtenBytes = 0)),
70
+ destination.enqueue(chunk);
71
+ else {
72
+ var allowableBytes = currentView.length - writtenBytes;
73
+ allowableBytes < chunk.byteLength &&
74
+ (0 === allowableBytes
75
+ ? destination.enqueue(currentView)
76
+ : (currentView.set(chunk.subarray(0, allowableBytes), writtenBytes),
77
+ destination.enqueue(currentView),
78
+ (chunk = chunk.subarray(allowableBytes))),
79
+ (currentView = new Uint8Array(2048)),
80
+ (writtenBytes = 0));
81
+ currentView.set(chunk, writtenBytes);
82
+ writtenBytes += chunk.byteLength;
83
+ }
76
84
  return !0;
77
85
  }
78
86
  function completeWriting(destination) {
@@ -2875,14 +2883,35 @@
2875
2883
  }
2876
2884
  function emitTypedArrayChunk(request, id, tag, typedArray, debug) {
2877
2885
  debug ? request.pendingDebugChunks++ : request.pendingChunks++;
2878
- var buffer = new Uint8Array(
2879
- typedArray.buffer,
2880
- typedArray.byteOffset,
2881
- typedArray.byteLength
2882
- );
2883
- typedArray = 2048 < typedArray.byteLength ? buffer.slice() : buffer;
2884
- buffer = typedArray.byteLength;
2885
- id = id.toString(16) + ":" + tag + buffer.toString(16) + ",";
2886
+ a: {
2887
+ var view = new Uint8Array(
2888
+ typedArray.buffer,
2889
+ typedArray.byteOffset,
2890
+ typedArray.byteLength
2891
+ );
2892
+ if (2048 < typedArray.byteLength) {
2893
+ if (
2894
+ 0 !== typedArray.byteOffset ||
2895
+ typedArray.byteLength !== typedArray.buffer.byteLength ||
2896
+ typedArray.buffer.resizable
2897
+ ) {
2898
+ typedArray = view.slice();
2899
+ break a;
2900
+ }
2901
+ if (!supportsArrayBufferDetached) {
2902
+ didWarnAboutMissingArrayBufferDetached ||
2903
+ (console.error(
2904
+ "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."
2905
+ ),
2906
+ (didWarnAboutMissingArrayBufferDetached = !0));
2907
+ typedArray = view.slice();
2908
+ break a;
2909
+ }
2910
+ }
2911
+ typedArray = view;
2912
+ }
2913
+ view = typedArray.byteLength;
2914
+ id = id.toString(16) + ":" + tag + view.toString(16) + ",";
2886
2915
  id = stringToChunk(id);
2887
2916
  debug
2888
2917
  ? request.completedDebugChunks.push(id, typedArray)
@@ -3950,13 +3979,38 @@
3950
3979
  if (hasOwnProperty.call(moduleExports, metadata[2]))
3951
3980
  return moduleExports[metadata[2]];
3952
3981
  }
3953
- function appendBackingEntry(backingStore, key, value) {
3954
- backingStore.data.append(key, value);
3955
- value = backingStore.keys;
3956
- null === value
3957
- ? ((backingStore.keys = Array.from(backingStore.data.keys())),
3958
- (backingStore.keyPointer = 0))
3959
- : value.push(key);
3982
+ function appendBackingEntry(backingStore, value, key) {
3983
+ var prefix = backingStore.prefix;
3984
+ if (key.startsWith(prefix)) {
3985
+ switch (key[prefix.length]) {
3986
+ case "_":
3987
+ prefix = backingStore.referencedEntries;
3988
+ null === prefix && (prefix = backingStore.referencedEntries = []);
3989
+ prefix.push([key, value]);
3990
+ return;
3991
+ case "S":
3992
+ "string" === typeof value &&
3993
+ ((prefix = backingStore.streamChunks),
3994
+ null === prefix &&
3995
+ (prefix = backingStore.streamChunks = new Map()),
3996
+ (backingStore = prefix.get(key)),
3997
+ void 0 === backingStore
3998
+ ? prefix.set(key, [value])
3999
+ : backingStore.push(value));
4000
+ return;
4001
+ }
4002
+ "string" === typeof value
4003
+ ? ((prefix = backingStore.stringChunks),
4004
+ null === prefix && (prefix = backingStore.stringChunks = new Map()),
4005
+ prefix.set(key, value))
4006
+ : ((prefix = backingStore.blobs),
4007
+ null === prefix && (prefix = backingStore.blobs = new Map()),
4008
+ prefix.set(key, value));
4009
+ }
4010
+ }
4011
+ function getBackingBlob(backingStore, key) {
4012
+ backingStore = backingStore.blobs;
4013
+ return null === backingStore ? void 0 : backingStore.get(key);
3960
4014
  }
3961
4015
  function ReactPromise(status, value, reason) {
3962
4016
  this.status = status;
@@ -4269,9 +4323,11 @@
4269
4323
  function getChunk(response, id) {
4270
4324
  var chunks = response._chunks,
4271
4325
  chunk = chunks.get(id);
4272
- chunk ||
4273
- ((chunk = response._formData.data.get(response._prefix + id)),
4274
- (chunk =
4326
+ if (!chunk) {
4327
+ chunk = response._prefix;
4328
+ var stringChunks = response._formData.stringChunks;
4329
+ chunk = null === stringChunks ? void 0 : stringChunks.get(chunk + id);
4330
+ chunk =
4275
4331
  "string" === typeof chunk
4276
4332
  ? new ReactPromise(
4277
4333
  "resolved_model",
@@ -4280,8 +4336,9 @@
4280
4336
  )
4281
4337
  : response._closed
4282
4338
  ? new ReactPromise("rejected", null, response._closedReason)
4283
- : new ReactPromise("pending", null, null)),
4284
- chunks.set(id, chunk));
4339
+ : new ReactPromise("pending", null, null);
4340
+ chunks.set(id, chunk);
4341
+ }
4285
4342
  return chunk;
4286
4343
  }
4287
4344
  function fulfillReference(response, reference, value, arrayRoot) {
@@ -4528,7 +4585,7 @@
4528
4585
  Error("Already initialized typed array.")
4529
4586
  )
4530
4587
  );
4531
- reference = response._formData.data.get(key).arrayBuffer();
4588
+ reference = getBackingBlob(response._formData, key).arrayBuffer();
4532
4589
  if (initializingHandler) {
4533
4590
  var handler = initializingHandler;
4534
4591
  handler.deps++;
@@ -4572,15 +4629,17 @@
4572
4629
  var chunks = response._chunks;
4573
4630
  stream = new ReactPromise("fulfilled", stream, controller);
4574
4631
  chunks.set(id, stream);
4575
- response = response._formData.data.getAll(response._prefix + id);
4576
- for (id = 0; id < response.length; id++)
4577
- (chunks = response[id]),
4578
- "string" === typeof chunks &&
4579
- ("C" === chunks[0]
4632
+ chunks = response._prefix;
4633
+ response = response._formData.streamChunks;
4634
+ id = null === response ? void 0 : response.get(chunks + "S" + id);
4635
+ if (void 0 !== id)
4636
+ for (response = 0; response < id.length; response++)
4637
+ (chunks = id[response]),
4638
+ "C" === chunks[0]
4580
4639
  ? controller.close(
4581
4640
  "C" === chunks ? '"$undefined"' : chunks.slice(1)
4582
4641
  )
4583
- : controller.enqueueModel(chunks));
4642
+ : controller.enqueueModel(chunks);
4584
4643
  }
4585
4644
  function parseReadableStream(response, reference, type) {
4586
4645
  function enqueue(value) {
@@ -4744,7 +4803,14 @@
4744
4803
  });
4745
4804
  return iterator;
4746
4805
  }
4747
- function parseModelString(response, obj, key, value, reference, arrayRoot) {
4806
+ function parseModelString(
4807
+ response,
4808
+ obj,
4809
+ key$jscomp$0,
4810
+ value,
4811
+ reference,
4812
+ arrayRoot
4813
+ ) {
4748
4814
  if ("$" === value[0]) {
4749
4815
  switch (value[1]) {
4750
4816
  case "$":
@@ -4764,7 +4830,7 @@
4764
4830
  response,
4765
4831
  arrayRoot,
4766
4832
  obj,
4767
- key,
4833
+ key$jscomp$0,
4768
4834
  null,
4769
4835
  loadServerReference$1
4770
4836
  )
@@ -4784,41 +4850,44 @@
4784
4850
  case "Q":
4785
4851
  return (
4786
4852
  (arrayRoot = value.slice(2)),
4787
- getOutlinedModel(response, arrayRoot, obj, key, null, createMap)
4853
+ getOutlinedModel(
4854
+ response,
4855
+ arrayRoot,
4856
+ obj,
4857
+ key$jscomp$0,
4858
+ null,
4859
+ createMap
4860
+ )
4788
4861
  );
4789
4862
  case "W":
4790
4863
  return (
4791
4864
  (arrayRoot = value.slice(2)),
4792
- getOutlinedModel(response, arrayRoot, obj, key, null, createSet)
4865
+ getOutlinedModel(
4866
+ response,
4867
+ arrayRoot,
4868
+ obj,
4869
+ key$jscomp$0,
4870
+ null,
4871
+ createSet
4872
+ )
4793
4873
  );
4794
4874
  case "K":
4795
- key = value.slice(2);
4796
- obj = response._prefix + "_";
4797
- key = obj + key + "_";
4798
- arrayRoot = new FormData();
4799
- for (response = response._formData; ; ) {
4800
- value = response;
4801
- reference = value.keys;
4802
- null === reference &&
4803
- ((reference = value.keys = Array.from(value.data.keys())),
4804
- (value.keyPointer = 0));
4805
- value = reference[value.keyPointer];
4806
- if (void 0 === value) break;
4807
- if (value.startsWith(key)) {
4808
- reference = response.data.getAll(value);
4809
- for (
4810
- var referencedFormDataKey = value.slice(key.length), i = 0;
4811
- i < reference.length;
4812
- i++
4813
- )
4814
- arrayRoot.append(referencedFormDataKey, reference[i]);
4815
- reference = response;
4816
- reference.data.delete(value);
4817
- reference.keyPointer++;
4818
- } else if (value.startsWith(obj)) break;
4819
- else response.keyPointer++;
4875
+ key$jscomp$0 = value.slice(2);
4876
+ obj = response._formData;
4877
+ response = response._prefix + "_" + key$jscomp$0 + "_";
4878
+ key$jscomp$0 = new FormData();
4879
+ arrayRoot = obj.referencedEntries;
4880
+ if (null !== arrayRoot) {
4881
+ for (value = obj.keyPointer; value < arrayRoot.length; ) {
4882
+ reference = arrayRoot[value];
4883
+ var key = reference[0];
4884
+ if (!key.startsWith(response)) break;
4885
+ key$jscomp$0.append(key.slice(response.length), reference[1]);
4886
+ value++;
4887
+ }
4888
+ obj.keyPointer = value;
4820
4889
  }
4821
- return arrayRoot;
4890
+ return key$jscomp$0;
4822
4891
  case "i":
4823
4892
  return (
4824
4893
  (arrayRoot = value.slice(2)),
@@ -4826,7 +4895,7 @@
4826
4895
  response,
4827
4896
  arrayRoot,
4828
4897
  obj,
4829
- key,
4898
+ key$jscomp$0,
4830
4899
  null,
4831
4900
  extractIterator
4832
4901
  )
@@ -4861,7 +4930,7 @@
4861
4930
  ArrayBuffer,
4862
4931
  1,
4863
4932
  obj,
4864
- key,
4933
+ key$jscomp$0,
4865
4934
  arrayRoot
4866
4935
  );
4867
4936
  case "O":
@@ -4871,7 +4940,7 @@
4871
4940
  Int8Array,
4872
4941
  1,
4873
4942
  obj,
4874
- key,
4943
+ key$jscomp$0,
4875
4944
  arrayRoot
4876
4945
  );
4877
4946
  case "o":
@@ -4881,7 +4950,7 @@
4881
4950
  Uint8Array,
4882
4951
  1,
4883
4952
  obj,
4884
- key,
4953
+ key$jscomp$0,
4885
4954
  arrayRoot
4886
4955
  );
4887
4956
  case "U":
@@ -4891,7 +4960,7 @@
4891
4960
  Uint8ClampedArray,
4892
4961
  1,
4893
4962
  obj,
4894
- key,
4963
+ key$jscomp$0,
4895
4964
  arrayRoot
4896
4965
  );
4897
4966
  case "S":
@@ -4901,7 +4970,7 @@
4901
4970
  Int16Array,
4902
4971
  2,
4903
4972
  obj,
4904
- key,
4973
+ key$jscomp$0,
4905
4974
  arrayRoot
4906
4975
  );
4907
4976
  case "s":
@@ -4911,7 +4980,7 @@
4911
4980
  Uint16Array,
4912
4981
  2,
4913
4982
  obj,
4914
- key,
4983
+ key$jscomp$0,
4915
4984
  arrayRoot
4916
4985
  );
4917
4986
  case "L":
@@ -4921,7 +4990,7 @@
4921
4990
  Int32Array,
4922
4991
  4,
4923
4992
  obj,
4924
- key,
4993
+ key$jscomp$0,
4925
4994
  arrayRoot
4926
4995
  );
4927
4996
  case "l":
@@ -4931,7 +5000,7 @@
4931
5000
  Uint32Array,
4932
5001
  4,
4933
5002
  obj,
4934
- key,
5003
+ key$jscomp$0,
4935
5004
  arrayRoot
4936
5005
  );
4937
5006
  case "G":
@@ -4941,7 +5010,7 @@
4941
5010
  Float32Array,
4942
5011
  4,
4943
5012
  obj,
4944
- key,
5013
+ key$jscomp$0,
4945
5014
  arrayRoot
4946
5015
  );
4947
5016
  case "g":
@@ -4951,7 +5020,7 @@
4951
5020
  Float64Array,
4952
5021
  8,
4953
5022
  obj,
4954
- key,
5023
+ key$jscomp$0,
4955
5024
  arrayRoot
4956
5025
  );
4957
5026
  case "M":
@@ -4961,7 +5030,7 @@
4961
5030
  BigInt64Array,
4962
5031
  8,
4963
5032
  obj,
4964
- key,
5033
+ key$jscomp$0,
4965
5034
  arrayRoot
4966
5035
  );
4967
5036
  case "m":
@@ -4971,7 +5040,7 @@
4971
5040
  BigUint64Array,
4972
5041
  8,
4973
5042
  obj,
4974
- key,
5043
+ key$jscomp$0,
4975
5044
  arrayRoot
4976
5045
  );
4977
5046
  case "V":
@@ -4981,13 +5050,13 @@
4981
5050
  DataView,
4982
5051
  1,
4983
5052
  obj,
4984
- key,
5053
+ key$jscomp$0,
4985
5054
  arrayRoot
4986
5055
  );
4987
5056
  case "B":
4988
5057
  return (
4989
5058
  (obj = parseInt(value.slice(2), 16)),
4990
- response._formData.data.get(response._prefix + obj)
5059
+ getBackingBlob(response._formData, response._prefix + obj)
4991
5060
  );
4992
5061
  case "R":
4993
5062
  return parseReadableStream(response, value, void 0);
@@ -5003,7 +5072,7 @@
5003
5072
  response,
5004
5073
  value,
5005
5074
  obj,
5006
- key,
5075
+ key$jscomp$0,
5007
5076
  arrayRoot,
5008
5077
  createModel
5009
5078
  );
@@ -5022,11 +5091,20 @@
5022
5091
  : new FormData(),
5023
5092
  arraySizeLimit =
5024
5093
  4 < arguments.length && void 0 !== arguments[4] ? arguments[4] : 1e6,
5025
- chunks = new Map();
5094
+ chunks = new Map(),
5095
+ backingStore = {
5096
+ prefix: formFieldPrefix,
5097
+ referencedEntries: null,
5098
+ keyPointer: 0,
5099
+ stringChunks: null,
5100
+ streamChunks: null,
5101
+ blobs: null
5102
+ };
5103
+ backingFormData.forEach(appendBackingEntry.bind(null, backingStore));
5026
5104
  return {
5027
5105
  _bundlerConfig: bundlerConfig,
5028
5106
  _prefix: formFieldPrefix,
5029
- _formData: { data: backingFormData, keyPointer: -1, keys: null },
5107
+ _formData: backingStore,
5030
5108
  _chunks: chunks,
5031
5109
  _closed: !1,
5032
5110
  _closedReason: null,
@@ -5186,6 +5264,12 @@
5186
5264
  Symbol.for("react.postpone");
5187
5265
  var MAYBE_ITERATOR_SYMBOL = Symbol.iterator,
5188
5266
  ASYNC_ITERATOR = Symbol.asyncIterator,
5267
+ hasOwnProperty = Object.prototype.hasOwnProperty,
5268
+ supportsArrayBufferDetached = hasOwnProperty.call(
5269
+ ArrayBuffer.prototype,
5270
+ "detached"
5271
+ ),
5272
+ didWarnAboutMissingArrayBufferDetached = !1,
5189
5273
  LocalPromise = Promise,
5190
5274
  scheduleMicrotask =
5191
5275
  "function" === typeof queueMicrotask
@@ -5569,7 +5653,6 @@
5569
5653
  jsxPropsParents = new WeakMap(),
5570
5654
  jsxChildrenParents = new WeakMap(),
5571
5655
  CLIENT_REFERENCE_TAG = Symbol.for("react.client.reference"),
5572
- hasOwnProperty = Object.prototype.hasOwnProperty,
5573
5656
  doNotLimit = new WeakSet();
5574
5657
  "object" === typeof console &&
5575
5658
  null !== console &&
@@ -5736,20 +5819,40 @@
5736
5819
  function progress(entry) {
5737
5820
  if (entry.done) close(response$jscomp$0);
5738
5821
  else {
5739
- entry = entry.value;
5740
- var name = entry[0];
5741
- entry = entry[1];
5742
- if ("string" === typeof entry) {
5743
- var response = response$jscomp$0;
5744
- appendBackingEntry(response._formData, name, entry);
5745
- var prefix = response._prefix;
5746
- if (name.startsWith(prefix)) {
5747
- var chunks = response._chunks;
5748
- name = +name.slice(prefix.length);
5749
- (chunks = chunks.get(name)) &&
5750
- resolveModelChunk(response, chunks, entry, name);
5822
+ var _entry$value = entry.value;
5823
+ entry = _entry$value[0];
5824
+ _entry$value = _entry$value[1];
5825
+ if ("string" === typeof _entry$value)
5826
+ a: {
5827
+ var response = response$jscomp$0,
5828
+ prefix = response._prefix;
5829
+ if (entry.startsWith(prefix)) {
5830
+ var chunks = response._chunks;
5831
+ if ("S" === entry[prefix.length]) {
5832
+ if (
5833
+ entry.length > prefix.length + 1 &&
5834
+ ((prefix = +entry.slice(prefix.length + 1)),
5835
+ (chunks = chunks.get(prefix)))
5836
+ ) {
5837
+ resolveModelChunk(response, chunks, _entry$value, prefix);
5838
+ break a;
5839
+ }
5840
+ } else if (
5841
+ ((prefix = +entry.slice(prefix.length)),
5842
+ (chunks = chunks.get(prefix)))
5843
+ ) {
5844
+ resolveModelChunk(response, chunks, _entry$value, prefix);
5845
+ break a;
5846
+ }
5847
+ }
5848
+ appendBackingEntry(response._formData, _entry$value, entry);
5751
5849
  }
5752
- } else appendBackingEntry(response$jscomp$0._formData, name, entry);
5850
+ else
5851
+ appendBackingEntry(
5852
+ response$jscomp$0._formData,
5853
+ _entry$value,
5854
+ entry
5855
+ );
5753
5856
  iterator.next().then(progress, error);
5754
5857
  }
5755
5858
  }