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.
@@ -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 completeWriting(destination) {
@@ -2804,14 +2812,35 @@
2804
2812
  }
2805
2813
  function emitTypedArrayChunk(request, id, tag, typedArray, debug) {
2806
2814
  debug ? request.pendingDebugChunks++ : request.pendingChunks++;
2807
- var buffer = new Uint8Array(
2808
- typedArray.buffer,
2809
- typedArray.byteOffset,
2810
- typedArray.byteLength
2811
- );
2812
- typedArray = 2048 < typedArray.byteLength ? buffer.slice() : buffer;
2813
- buffer = typedArray.byteLength;
2814
- id = id.toString(16) + ":" + tag + buffer.toString(16) + ",";
2815
+ a: {
2816
+ var view = new Uint8Array(
2817
+ typedArray.buffer,
2818
+ typedArray.byteOffset,
2819
+ typedArray.byteLength
2820
+ );
2821
+ if (2048 < typedArray.byteLength) {
2822
+ if (
2823
+ 0 !== typedArray.byteOffset ||
2824
+ typedArray.byteLength !== typedArray.buffer.byteLength ||
2825
+ typedArray.buffer.resizable
2826
+ ) {
2827
+ typedArray = view.slice();
2828
+ break a;
2829
+ }
2830
+ if (!supportsArrayBufferDetached) {
2831
+ didWarnAboutMissingArrayBufferDetached ||
2832
+ (console.error(
2833
+ "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."
2834
+ ),
2835
+ (didWarnAboutMissingArrayBufferDetached = !0));
2836
+ typedArray = view.slice();
2837
+ break a;
2838
+ }
2839
+ }
2840
+ typedArray = view;
2841
+ }
2842
+ view = typedArray.byteLength;
2843
+ id = id.toString(16) + ":" + tag + view.toString(16) + ",";
2815
2844
  id = stringToChunk(id);
2816
2845
  debug
2817
2846
  ? request.completedDebugChunks.push(id, typedArray)
@@ -3879,6 +3908,39 @@
3879
3908
  chunkMap.set(chunkId, filename);
3880
3909
  return __webpack_chunk_load__(chunkId);
3881
3910
  }
3911
+ function appendBackingEntry(backingStore, value, key) {
3912
+ var prefix = backingStore.prefix;
3913
+ if (key.startsWith(prefix)) {
3914
+ switch (key[prefix.length]) {
3915
+ case "_":
3916
+ prefix = backingStore.referencedEntries;
3917
+ null === prefix && (prefix = backingStore.referencedEntries = []);
3918
+ prefix.push([key, value]);
3919
+ return;
3920
+ case "S":
3921
+ "string" === typeof value &&
3922
+ ((prefix = backingStore.streamChunks),
3923
+ null === prefix &&
3924
+ (prefix = backingStore.streamChunks = new Map()),
3925
+ (backingStore = prefix.get(key)),
3926
+ void 0 === backingStore
3927
+ ? prefix.set(key, [value])
3928
+ : backingStore.push(value));
3929
+ return;
3930
+ }
3931
+ "string" === typeof value
3932
+ ? ((prefix = backingStore.stringChunks),
3933
+ null === prefix && (prefix = backingStore.stringChunks = new Map()),
3934
+ prefix.set(key, value))
3935
+ : ((prefix = backingStore.blobs),
3936
+ null === prefix && (prefix = backingStore.blobs = new Map()),
3937
+ prefix.set(key, value));
3938
+ }
3939
+ }
3940
+ function getBackingBlob(backingStore, key) {
3941
+ backingStore = backingStore.blobs;
3942
+ return null === backingStore ? void 0 : backingStore.get(key);
3943
+ }
3882
3944
  function ReactPromise(status, value, reason) {
3883
3945
  this.status = status;
3884
3946
  this.value = value;
@@ -4190,9 +4252,11 @@
4190
4252
  function getChunk(response, id) {
4191
4253
  var chunks = response._chunks,
4192
4254
  chunk = chunks.get(id);
4193
- chunk ||
4194
- ((chunk = response._formData.data.get(response._prefix + id)),
4195
- (chunk =
4255
+ if (!chunk) {
4256
+ chunk = response._prefix;
4257
+ var stringChunks = response._formData.stringChunks;
4258
+ chunk = null === stringChunks ? void 0 : stringChunks.get(chunk + id);
4259
+ chunk =
4196
4260
  "string" === typeof chunk
4197
4261
  ? new ReactPromise(
4198
4262
  "resolved_model",
@@ -4201,8 +4265,9 @@
4201
4265
  )
4202
4266
  : response._closed
4203
4267
  ? new ReactPromise("rejected", null, response._closedReason)
4204
- : new ReactPromise("pending", null, null)),
4205
- chunks.set(id, chunk));
4268
+ : new ReactPromise("pending", null, null);
4269
+ chunks.set(id, chunk);
4270
+ }
4206
4271
  return chunk;
4207
4272
  }
4208
4273
  function fulfillReference(response, reference, value, arrayRoot) {
@@ -4449,7 +4514,7 @@
4449
4514
  Error("Already initialized typed array.")
4450
4515
  )
4451
4516
  );
4452
- reference = response._formData.data.get(key).arrayBuffer();
4517
+ reference = getBackingBlob(response._formData, key).arrayBuffer();
4453
4518
  if (initializingHandler) {
4454
4519
  var handler = initializingHandler;
4455
4520
  handler.deps++;
@@ -4493,15 +4558,17 @@
4493
4558
  var chunks = response._chunks;
4494
4559
  stream = new ReactPromise("fulfilled", stream, controller);
4495
4560
  chunks.set(id, stream);
4496
- response = response._formData.data.getAll(response._prefix + id);
4497
- for (id = 0; id < response.length; id++)
4498
- (chunks = response[id]),
4499
- "string" === typeof chunks &&
4500
- ("C" === chunks[0]
4561
+ chunks = response._prefix;
4562
+ response = response._formData.streamChunks;
4563
+ id = null === response ? void 0 : response.get(chunks + "S" + id);
4564
+ if (void 0 !== id)
4565
+ for (response = 0; response < id.length; response++)
4566
+ (chunks = id[response]),
4567
+ "C" === chunks[0]
4501
4568
  ? controller.close(
4502
4569
  "C" === chunks ? '"$undefined"' : chunks.slice(1)
4503
4570
  )
4504
- : controller.enqueueModel(chunks));
4571
+ : controller.enqueueModel(chunks);
4505
4572
  }
4506
4573
  function parseReadableStream(response, reference, type) {
4507
4574
  function enqueue(value) {
@@ -4665,7 +4732,14 @@
4665
4732
  });
4666
4733
  return iterator;
4667
4734
  }
4668
- function parseModelString(response, obj, key, value, reference, arrayRoot) {
4735
+ function parseModelString(
4736
+ response,
4737
+ obj,
4738
+ key$jscomp$0,
4739
+ value,
4740
+ reference,
4741
+ arrayRoot
4742
+ ) {
4669
4743
  if ("$" === value[0]) {
4670
4744
  switch (value[1]) {
4671
4745
  case "$":
@@ -4685,7 +4759,7 @@
4685
4759
  response,
4686
4760
  arrayRoot,
4687
4761
  obj,
4688
- key,
4762
+ key$jscomp$0,
4689
4763
  null,
4690
4764
  loadServerReference$1
4691
4765
  )
@@ -4705,41 +4779,44 @@
4705
4779
  case "Q":
4706
4780
  return (
4707
4781
  (arrayRoot = value.slice(2)),
4708
- getOutlinedModel(response, arrayRoot, obj, key, null, createMap)
4782
+ getOutlinedModel(
4783
+ response,
4784
+ arrayRoot,
4785
+ obj,
4786
+ key$jscomp$0,
4787
+ null,
4788
+ createMap
4789
+ )
4709
4790
  );
4710
4791
  case "W":
4711
4792
  return (
4712
4793
  (arrayRoot = value.slice(2)),
4713
- getOutlinedModel(response, arrayRoot, obj, key, null, createSet)
4794
+ getOutlinedModel(
4795
+ response,
4796
+ arrayRoot,
4797
+ obj,
4798
+ key$jscomp$0,
4799
+ null,
4800
+ createSet
4801
+ )
4714
4802
  );
4715
4803
  case "K":
4716
- key = value.slice(2);
4717
- obj = response._prefix + "_";
4718
- key = obj + key + "_";
4719
- arrayRoot = new FormData();
4720
- for (response = response._formData; ; ) {
4721
- value = response;
4722
- reference = value.keys;
4723
- null === reference &&
4724
- ((reference = value.keys = Array.from(value.data.keys())),
4725
- (value.keyPointer = 0));
4726
- value = reference[value.keyPointer];
4727
- if (void 0 === value) break;
4728
- if (value.startsWith(key)) {
4729
- reference = response.data.getAll(value);
4730
- for (
4731
- var referencedFormDataKey = value.slice(key.length), i = 0;
4732
- i < reference.length;
4733
- i++
4734
- )
4735
- arrayRoot.append(referencedFormDataKey, reference[i]);
4736
- reference = response;
4737
- reference.data.delete(value);
4738
- reference.keyPointer++;
4739
- } else if (value.startsWith(obj)) break;
4740
- else response.keyPointer++;
4804
+ key$jscomp$0 = value.slice(2);
4805
+ obj = response._formData;
4806
+ response = response._prefix + "_" + key$jscomp$0 + "_";
4807
+ key$jscomp$0 = new FormData();
4808
+ arrayRoot = obj.referencedEntries;
4809
+ if (null !== arrayRoot) {
4810
+ for (value = obj.keyPointer; value < arrayRoot.length; ) {
4811
+ reference = arrayRoot[value];
4812
+ var key = reference[0];
4813
+ if (!key.startsWith(response)) break;
4814
+ key$jscomp$0.append(key.slice(response.length), reference[1]);
4815
+ value++;
4816
+ }
4817
+ obj.keyPointer = value;
4741
4818
  }
4742
- return arrayRoot;
4819
+ return key$jscomp$0;
4743
4820
  case "i":
4744
4821
  return (
4745
4822
  (arrayRoot = value.slice(2)),
@@ -4747,7 +4824,7 @@
4747
4824
  response,
4748
4825
  arrayRoot,
4749
4826
  obj,
4750
- key,
4827
+ key$jscomp$0,
4751
4828
  null,
4752
4829
  extractIterator
4753
4830
  )
@@ -4782,7 +4859,7 @@
4782
4859
  ArrayBuffer,
4783
4860
  1,
4784
4861
  obj,
4785
- key,
4862
+ key$jscomp$0,
4786
4863
  arrayRoot
4787
4864
  );
4788
4865
  case "O":
@@ -4792,7 +4869,7 @@
4792
4869
  Int8Array,
4793
4870
  1,
4794
4871
  obj,
4795
- key,
4872
+ key$jscomp$0,
4796
4873
  arrayRoot
4797
4874
  );
4798
4875
  case "o":
@@ -4802,7 +4879,7 @@
4802
4879
  Uint8Array,
4803
4880
  1,
4804
4881
  obj,
4805
- key,
4882
+ key$jscomp$0,
4806
4883
  arrayRoot
4807
4884
  );
4808
4885
  case "U":
@@ -4812,7 +4889,7 @@
4812
4889
  Uint8ClampedArray,
4813
4890
  1,
4814
4891
  obj,
4815
- key,
4892
+ key$jscomp$0,
4816
4893
  arrayRoot
4817
4894
  );
4818
4895
  case "S":
@@ -4822,7 +4899,7 @@
4822
4899
  Int16Array,
4823
4900
  2,
4824
4901
  obj,
4825
- key,
4902
+ key$jscomp$0,
4826
4903
  arrayRoot
4827
4904
  );
4828
4905
  case "s":
@@ -4832,7 +4909,7 @@
4832
4909
  Uint16Array,
4833
4910
  2,
4834
4911
  obj,
4835
- key,
4912
+ key$jscomp$0,
4836
4913
  arrayRoot
4837
4914
  );
4838
4915
  case "L":
@@ -4842,7 +4919,7 @@
4842
4919
  Int32Array,
4843
4920
  4,
4844
4921
  obj,
4845
- key,
4922
+ key$jscomp$0,
4846
4923
  arrayRoot
4847
4924
  );
4848
4925
  case "l":
@@ -4852,7 +4929,7 @@
4852
4929
  Uint32Array,
4853
4930
  4,
4854
4931
  obj,
4855
- key,
4932
+ key$jscomp$0,
4856
4933
  arrayRoot
4857
4934
  );
4858
4935
  case "G":
@@ -4862,7 +4939,7 @@
4862
4939
  Float32Array,
4863
4940
  4,
4864
4941
  obj,
4865
- key,
4942
+ key$jscomp$0,
4866
4943
  arrayRoot
4867
4944
  );
4868
4945
  case "g":
@@ -4872,7 +4949,7 @@
4872
4949
  Float64Array,
4873
4950
  8,
4874
4951
  obj,
4875
- key,
4952
+ key$jscomp$0,
4876
4953
  arrayRoot
4877
4954
  );
4878
4955
  case "M":
@@ -4882,7 +4959,7 @@
4882
4959
  BigInt64Array,
4883
4960
  8,
4884
4961
  obj,
4885
- key,
4962
+ key$jscomp$0,
4886
4963
  arrayRoot
4887
4964
  );
4888
4965
  case "m":
@@ -4892,7 +4969,7 @@
4892
4969
  BigUint64Array,
4893
4970
  8,
4894
4971
  obj,
4895
- key,
4972
+ key$jscomp$0,
4896
4973
  arrayRoot
4897
4974
  );
4898
4975
  case "V":
@@ -4902,13 +4979,13 @@
4902
4979
  DataView,
4903
4980
  1,
4904
4981
  obj,
4905
- key,
4982
+ key$jscomp$0,
4906
4983
  arrayRoot
4907
4984
  );
4908
4985
  case "B":
4909
4986
  return (
4910
4987
  (obj = parseInt(value.slice(2), 16)),
4911
- response._formData.data.get(response._prefix + obj)
4988
+ getBackingBlob(response._formData, response._prefix + obj)
4912
4989
  );
4913
4990
  case "R":
4914
4991
  return parseReadableStream(response, value, void 0);
@@ -4924,7 +5001,7 @@
4924
5001
  response,
4925
5002
  value,
4926
5003
  obj,
4927
- key,
5004
+ key$jscomp$0,
4928
5005
  arrayRoot,
4929
5006
  createModel
4930
5007
  );
@@ -4943,11 +5020,20 @@
4943
5020
  : new FormData(),
4944
5021
  arraySizeLimit =
4945
5022
  4 < arguments.length && void 0 !== arguments[4] ? arguments[4] : 1e6,
4946
- chunks = new Map();
5023
+ chunks = new Map(),
5024
+ backingStore = {
5025
+ prefix: formFieldPrefix,
5026
+ referencedEntries: null,
5027
+ keyPointer: 0,
5028
+ stringChunks: null,
5029
+ streamChunks: null,
5030
+ blobs: null
5031
+ };
5032
+ backingFormData.forEach(appendBackingEntry.bind(null, backingStore));
4947
5033
  return {
4948
5034
  _bundlerConfig: bundlerConfig,
4949
5035
  _prefix: formFieldPrefix,
4950
- _formData: { data: backingFormData, keyPointer: -1, keys: null },
5036
+ _formData: backingStore,
4951
5037
  _chunks: chunks,
4952
5038
  _closed: !1,
4953
5039
  _closedReason: null,
@@ -5094,13 +5180,19 @@
5094
5180
  }
5095
5181
  var ReactDOM = require("react-dom"),
5096
5182
  React = require("react"),
5183
+ hasOwnProperty = Object.prototype.hasOwnProperty,
5097
5184
  channel = new MessageChannel(),
5098
5185
  taskQueue = [];
5099
5186
  channel.port1.onmessage = function () {
5100
5187
  var task = taskQueue.shift();
5101
5188
  task && task();
5102
5189
  };
5103
- var LocalPromise = Promise,
5190
+ var supportsArrayBufferDetached = hasOwnProperty.call(
5191
+ ArrayBuffer.prototype,
5192
+ "detached"
5193
+ ),
5194
+ didWarnAboutMissingArrayBufferDetached = !1,
5195
+ LocalPromise = Promise,
5104
5196
  scheduleMicrotask =
5105
5197
  "function" === typeof queueMicrotask
5106
5198
  ? queueMicrotask
@@ -5490,7 +5582,6 @@
5490
5582
  jsxPropsParents = new WeakMap(),
5491
5583
  jsxChildrenParents = new WeakMap(),
5492
5584
  CLIENT_REFERENCE_TAG = Symbol.for("react.client.reference"),
5493
- hasOwnProperty = Object.prototype.hasOwnProperty,
5494
5585
  doNotLimit = new WeakSet();
5495
5586
  "object" === typeof console &&
5496
5587
  null !== console &&