react-server-dom-parcel 19.3.0 → 19.3.1

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.
@@ -50,31 +50,39 @@
50
50
  });
51
51
  }
52
52
  function writeChunk(destination, chunk) {
53
- if (0 !== chunk.byteLength)
54
- if (4096 < chunk.byteLength)
55
- 0 < writtenBytes &&
56
- (destination.enqueue(
57
- new Uint8Array(currentView.buffer, 0, writtenBytes)
53
+ if (0 === chunk.byteLength)
54
+ if (supportsArrayBufferDetached) {
55
+ if (chunk.buffer.detached)
56
+ throw Error(
57
+ "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()`."
58
+ );
59
+ } else
60
+ didWarnAboutMissingArrayBufferDetached ||
61
+ (console.error(
62
+ "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."
58
63
  ),
59
- (currentView = new Uint8Array(4096)),
60
- (writtenBytes = 0)),
61
- destination.enqueue(chunk);
62
- else {
63
- var allowableBytes = currentView.length - writtenBytes;
64
- allowableBytes < chunk.byteLength &&
65
- (0 === allowableBytes
66
- ? destination.enqueue(currentView)
67
- : (currentView.set(
68
- chunk.subarray(0, allowableBytes),
69
- writtenBytes
70
- ),
71
- destination.enqueue(currentView),
72
- (chunk = chunk.subarray(allowableBytes))),
73
- (currentView = new Uint8Array(4096)),
74
- (writtenBytes = 0));
75
- currentView.set(chunk, writtenBytes);
76
- writtenBytes += chunk.byteLength;
77
- }
64
+ (didWarnAboutMissingArrayBufferDetached = !0));
65
+ else if (4096 < chunk.byteLength)
66
+ 0 < writtenBytes &&
67
+ (destination.enqueue(
68
+ new Uint8Array(currentView.buffer, 0, writtenBytes)
69
+ ),
70
+ (currentView = new Uint8Array(4096)),
71
+ (writtenBytes = 0)),
72
+ destination.enqueue(chunk);
73
+ else {
74
+ var allowableBytes = currentView.length - writtenBytes;
75
+ allowableBytes < chunk.byteLength &&
76
+ (0 === allowableBytes
77
+ ? destination.enqueue(currentView)
78
+ : (currentView.set(chunk.subarray(0, allowableBytes), writtenBytes),
79
+ destination.enqueue(currentView),
80
+ (chunk = chunk.subarray(allowableBytes))),
81
+ (currentView = new Uint8Array(4096)),
82
+ (writtenBytes = 0));
83
+ currentView.set(chunk, writtenBytes);
84
+ writtenBytes += chunk.byteLength;
85
+ }
78
86
  }
79
87
  function writeChunkAndReturn(destination, chunk) {
80
88
  writeChunk(destination, chunk);
@@ -3028,13 +3036,35 @@
3028
3036
  }
3029
3037
  function emitTypedArrayChunk(request, id, tag, typedArray, debug) {
3030
3038
  debug ? request.pendingDebugChunks++ : request.pendingChunks++;
3031
- typedArray = new Uint8Array(
3032
- typedArray.buffer,
3033
- typedArray.byteOffset,
3034
- typedArray.byteLength
3035
- );
3036
- var binaryLength = typedArray.byteLength;
3037
- id = id.toString(16) + ":" + tag + binaryLength.toString(16) + ",";
3039
+ a: {
3040
+ var view = new Uint8Array(
3041
+ typedArray.buffer,
3042
+ typedArray.byteOffset,
3043
+ typedArray.byteLength
3044
+ );
3045
+ if (4096 < typedArray.byteLength) {
3046
+ if (
3047
+ 0 !== typedArray.byteOffset ||
3048
+ typedArray.byteLength !== typedArray.buffer.byteLength ||
3049
+ typedArray.buffer.resizable
3050
+ ) {
3051
+ typedArray = view.slice();
3052
+ break a;
3053
+ }
3054
+ if (!supportsArrayBufferDetached) {
3055
+ didWarnAboutMissingArrayBufferDetached ||
3056
+ (console.error(
3057
+ "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."
3058
+ ),
3059
+ (didWarnAboutMissingArrayBufferDetached = !0));
3060
+ typedArray = view.slice();
3061
+ break a;
3062
+ }
3063
+ }
3064
+ typedArray = view;
3065
+ }
3066
+ view = typedArray.byteLength;
3067
+ id = id.toString(16) + ":" + tag + view.toString(16) + ",";
3038
3068
  id = stringToChunk(id);
3039
3069
  debug
3040
3070
  ? request.completedDebugChunks.push(
@@ -4115,13 +4145,38 @@
4115
4145
  });
4116
4146
  enqueueFlush(request);
4117
4147
  }
4118
- function appendBackingEntry(backingStore, key, value) {
4119
- backingStore.data.append(key, value);
4120
- value = backingStore.keys;
4121
- null === value
4122
- ? ((backingStore.keys = Array.from(backingStore.data.keys())),
4123
- (backingStore.keyPointer = 0))
4124
- : value.push(key);
4148
+ function appendBackingEntry(backingStore, value, key) {
4149
+ var prefix = backingStore.prefix;
4150
+ if (key.startsWith(prefix)) {
4151
+ switch (key[prefix.length]) {
4152
+ case "_":
4153
+ prefix = backingStore.referencedEntries;
4154
+ null === prefix && (prefix = backingStore.referencedEntries = []);
4155
+ prefix.push([key, value]);
4156
+ return;
4157
+ case "S":
4158
+ "string" === typeof value &&
4159
+ ((prefix = backingStore.streamChunks),
4160
+ null === prefix &&
4161
+ (prefix = backingStore.streamChunks = new Map()),
4162
+ (backingStore = prefix.get(key)),
4163
+ void 0 === backingStore
4164
+ ? prefix.set(key, [value])
4165
+ : backingStore.push(value));
4166
+ return;
4167
+ }
4168
+ "string" === typeof value
4169
+ ? ((prefix = backingStore.stringChunks),
4170
+ null === prefix && (prefix = backingStore.stringChunks = new Map()),
4171
+ prefix.set(key, value))
4172
+ : ((prefix = backingStore.blobs),
4173
+ null === prefix && (prefix = backingStore.blobs = new Map()),
4174
+ prefix.set(key, value));
4175
+ }
4176
+ }
4177
+ function getBackingBlob(backingStore, key) {
4178
+ backingStore = backingStore.blobs;
4179
+ return null === backingStore ? void 0 : backingStore.get(key);
4125
4180
  }
4126
4181
  function ReactPromise(status, value, reason) {
4127
4182
  this.status = status;
@@ -4459,15 +4514,18 @@
4459
4514
  function getChunk(response, id) {
4460
4515
  var chunks = response._chunks,
4461
4516
  chunk = chunks.get(id);
4462
- chunk ||
4463
- ((chunk = response._formData.data.get(response._prefix + id)),
4464
- (chunk =
4517
+ if (!chunk) {
4518
+ chunk = response._prefix;
4519
+ var stringChunks = response._formData.stringChunks;
4520
+ chunk = null === stringChunks ? void 0 : stringChunks.get(chunk + id);
4521
+ chunk =
4465
4522
  "string" === typeof chunk
4466
4523
  ? createResolvedModelChunk(response, chunk, id)
4467
4524
  : response._closed
4468
4525
  ? new ReactPromise("rejected", null, response._closedReason)
4469
- : new ReactPromise("pending", null, null)),
4470
- chunks.set(id, chunk));
4526
+ : new ReactPromise("pending", null, null);
4527
+ chunks.set(id, chunk);
4528
+ }
4471
4529
  return chunk;
4472
4530
  }
4473
4531
  function fulfillReference(response, reference, value, arrayRoot) {
@@ -4714,7 +4772,7 @@
4714
4772
  Error("Already initialized typed array.")
4715
4773
  )
4716
4774
  );
4717
- reference = response._formData.data.get(key).arrayBuffer();
4775
+ reference = getBackingBlob(response._formData, key).arrayBuffer();
4718
4776
  if (initializingHandler) {
4719
4777
  var handler = initializingHandler;
4720
4778
  handler.deps++;
@@ -4758,15 +4816,17 @@
4758
4816
  var chunks = response._chunks;
4759
4817
  stream = new ReactPromise("fulfilled", stream, controller);
4760
4818
  chunks.set(id, stream);
4761
- response = response._formData.data.getAll(response._prefix + id);
4762
- for (id = 0; id < response.length; id++)
4763
- (chunks = response[id]),
4764
- "string" === typeof chunks &&
4765
- ("C" === chunks[0]
4819
+ chunks = response._prefix;
4820
+ response = response._formData.streamChunks;
4821
+ id = null === response ? void 0 : response.get(chunks + "S" + id);
4822
+ if (void 0 !== id)
4823
+ for (response = 0; response < id.length; response++)
4824
+ (chunks = id[response]),
4825
+ "C" === chunks[0]
4766
4826
  ? controller.close(
4767
4827
  "C" === chunks ? '"$undefined"' : chunks.slice(1)
4768
4828
  )
4769
- : controller.enqueueModel(chunks));
4829
+ : controller.enqueueModel(chunks);
4770
4830
  }
4771
4831
  function parseReadableStream(response, reference, type) {
4772
4832
  function enqueue(value) {
@@ -4931,7 +4991,14 @@
4931
4991
  });
4932
4992
  return iterator;
4933
4993
  }
4934
- function parseModelString(response, obj, key, value, reference, arrayRoot) {
4994
+ function parseModelString(
4995
+ response,
4996
+ obj,
4997
+ key$jscomp$0,
4998
+ value,
4999
+ reference,
5000
+ arrayRoot
5001
+ ) {
4935
5002
  if ("$" === value[0]) {
4936
5003
  switch (value[1]) {
4937
5004
  case "$":
@@ -4951,7 +5018,7 @@
4951
5018
  response,
4952
5019
  arrayRoot,
4953
5020
  obj,
4954
- key,
5021
+ key$jscomp$0,
4955
5022
  null,
4956
5023
  loadServerReference$1
4957
5024
  )
@@ -4971,41 +5038,44 @@
4971
5038
  case "Q":
4972
5039
  return (
4973
5040
  (arrayRoot = value.slice(2)),
4974
- getOutlinedModel(response, arrayRoot, obj, key, null, createMap)
5041
+ getOutlinedModel(
5042
+ response,
5043
+ arrayRoot,
5044
+ obj,
5045
+ key$jscomp$0,
5046
+ null,
5047
+ createMap
5048
+ )
4975
5049
  );
4976
5050
  case "W":
4977
5051
  return (
4978
5052
  (arrayRoot = value.slice(2)),
4979
- getOutlinedModel(response, arrayRoot, obj, key, null, createSet)
5053
+ getOutlinedModel(
5054
+ response,
5055
+ arrayRoot,
5056
+ obj,
5057
+ key$jscomp$0,
5058
+ null,
5059
+ createSet
5060
+ )
4980
5061
  );
4981
5062
  case "K":
4982
- key = value.slice(2);
4983
- obj = response._prefix + "_";
4984
- key = obj + key + "_";
4985
- arrayRoot = new FormData();
4986
- for (response = response._formData; ; ) {
4987
- value = response;
4988
- reference = value.keys;
4989
- null === reference &&
4990
- ((reference = value.keys = Array.from(value.data.keys())),
4991
- (value.keyPointer = 0));
4992
- value = reference[value.keyPointer];
4993
- if (void 0 === value) break;
4994
- if (value.startsWith(key)) {
4995
- reference = response.data.getAll(value);
4996
- for (
4997
- var referencedFormDataKey = value.slice(key.length), i = 0;
4998
- i < reference.length;
4999
- i++
5000
- )
5001
- arrayRoot.append(referencedFormDataKey, reference[i]);
5002
- reference = response;
5003
- reference.data.delete(value);
5004
- reference.keyPointer++;
5005
- } else if (value.startsWith(obj)) break;
5006
- else response.keyPointer++;
5063
+ key$jscomp$0 = value.slice(2);
5064
+ obj = response._formData;
5065
+ response = response._prefix + "_" + key$jscomp$0 + "_";
5066
+ key$jscomp$0 = new FormData();
5067
+ arrayRoot = obj.referencedEntries;
5068
+ if (null !== arrayRoot) {
5069
+ for (value = obj.keyPointer; value < arrayRoot.length; ) {
5070
+ reference = arrayRoot[value];
5071
+ var key = reference[0];
5072
+ if (!key.startsWith(response)) break;
5073
+ key$jscomp$0.append(key.slice(response.length), reference[1]);
5074
+ value++;
5075
+ }
5076
+ obj.keyPointer = value;
5007
5077
  }
5008
- return arrayRoot;
5078
+ return key$jscomp$0;
5009
5079
  case "i":
5010
5080
  return (
5011
5081
  (arrayRoot = value.slice(2)),
@@ -5013,7 +5083,7 @@
5013
5083
  response,
5014
5084
  arrayRoot,
5015
5085
  obj,
5016
- key,
5086
+ key$jscomp$0,
5017
5087
  null,
5018
5088
  extractIterator
5019
5089
  )
@@ -5048,7 +5118,7 @@
5048
5118
  ArrayBuffer,
5049
5119
  1,
5050
5120
  obj,
5051
- key,
5121
+ key$jscomp$0,
5052
5122
  arrayRoot
5053
5123
  );
5054
5124
  case "O":
@@ -5058,7 +5128,7 @@
5058
5128
  Int8Array,
5059
5129
  1,
5060
5130
  obj,
5061
- key,
5131
+ key$jscomp$0,
5062
5132
  arrayRoot
5063
5133
  );
5064
5134
  case "o":
@@ -5068,7 +5138,7 @@
5068
5138
  Uint8Array,
5069
5139
  1,
5070
5140
  obj,
5071
- key,
5141
+ key$jscomp$0,
5072
5142
  arrayRoot
5073
5143
  );
5074
5144
  case "U":
@@ -5078,7 +5148,7 @@
5078
5148
  Uint8ClampedArray,
5079
5149
  1,
5080
5150
  obj,
5081
- key,
5151
+ key$jscomp$0,
5082
5152
  arrayRoot
5083
5153
  );
5084
5154
  case "S":
@@ -5088,7 +5158,7 @@
5088
5158
  Int16Array,
5089
5159
  2,
5090
5160
  obj,
5091
- key,
5161
+ key$jscomp$0,
5092
5162
  arrayRoot
5093
5163
  );
5094
5164
  case "s":
@@ -5098,7 +5168,7 @@
5098
5168
  Uint16Array,
5099
5169
  2,
5100
5170
  obj,
5101
- key,
5171
+ key$jscomp$0,
5102
5172
  arrayRoot
5103
5173
  );
5104
5174
  case "L":
@@ -5108,7 +5178,7 @@
5108
5178
  Int32Array,
5109
5179
  4,
5110
5180
  obj,
5111
- key,
5181
+ key$jscomp$0,
5112
5182
  arrayRoot
5113
5183
  );
5114
5184
  case "l":
@@ -5118,7 +5188,7 @@
5118
5188
  Uint32Array,
5119
5189
  4,
5120
5190
  obj,
5121
- key,
5191
+ key$jscomp$0,
5122
5192
  arrayRoot
5123
5193
  );
5124
5194
  case "G":
@@ -5128,7 +5198,7 @@
5128
5198
  Float32Array,
5129
5199
  4,
5130
5200
  obj,
5131
- key,
5201
+ key$jscomp$0,
5132
5202
  arrayRoot
5133
5203
  );
5134
5204
  case "g":
@@ -5138,7 +5208,7 @@
5138
5208
  Float64Array,
5139
5209
  8,
5140
5210
  obj,
5141
- key,
5211
+ key$jscomp$0,
5142
5212
  arrayRoot
5143
5213
  );
5144
5214
  case "M":
@@ -5148,7 +5218,7 @@
5148
5218
  BigInt64Array,
5149
5219
  8,
5150
5220
  obj,
5151
- key,
5221
+ key$jscomp$0,
5152
5222
  arrayRoot
5153
5223
  );
5154
5224
  case "m":
@@ -5158,7 +5228,7 @@
5158
5228
  BigUint64Array,
5159
5229
  8,
5160
5230
  obj,
5161
- key,
5231
+ key$jscomp$0,
5162
5232
  arrayRoot
5163
5233
  );
5164
5234
  case "V":
@@ -5168,12 +5238,15 @@
5168
5238
  DataView,
5169
5239
  1,
5170
5240
  obj,
5171
- key,
5241
+ key$jscomp$0,
5172
5242
  arrayRoot
5173
5243
  );
5174
5244
  case "B":
5175
5245
  obj = parseInt(value.slice(2), 16);
5176
- response = response._formData.data.get(response._prefix + obj);
5246
+ response = getBackingBlob(
5247
+ response._formData,
5248
+ response._prefix + obj
5249
+ );
5177
5250
  if (!(response instanceof Blob))
5178
5251
  throw Error("Referenced Blob is not a Blob.");
5179
5252
  return response;
@@ -5191,7 +5264,7 @@
5191
5264
  response,
5192
5265
  value,
5193
5266
  obj,
5194
- key,
5267
+ key$jscomp$0,
5195
5268
  arrayRoot,
5196
5269
  createModel
5197
5270
  );
@@ -5210,11 +5283,20 @@
5210
5283
  : new FormData(),
5211
5284
  arraySizeLimit =
5212
5285
  4 < arguments.length && void 0 !== arguments[4] ? arguments[4] : 1e6,
5213
- chunks = new Map();
5286
+ chunks = new Map(),
5287
+ backingStore = {
5288
+ prefix: formFieldPrefix,
5289
+ referencedEntries: null,
5290
+ keyPointer: 0,
5291
+ stringChunks: null,
5292
+ streamChunks: null,
5293
+ blobs: null
5294
+ };
5295
+ backingFormData.forEach(appendBackingEntry.bind(null, backingStore));
5214
5296
  return {
5215
5297
  _bundlerConfig: bundlerConfig,
5216
5298
  _prefix: formFieldPrefix,
5217
- _formData: { data: backingFormData, keyPointer: -1, keys: null },
5299
+ _formData: backingStore,
5218
5300
  _chunks: chunks,
5219
5301
  _closed: !1,
5220
5302
  _closedReason: null,
@@ -5424,6 +5506,11 @@
5424
5506
  MAYBE_ITERATOR_SYMBOL = Symbol.iterator,
5425
5507
  ASYNC_ITERATOR = Symbol.asyncIterator,
5426
5508
  REACT_OPTIMISTIC_KEY = Symbol.for("react.optimistic_key"),
5509
+ supportsArrayBufferDetached = hasOwnProperty.call(
5510
+ ArrayBuffer.prototype,
5511
+ "detached"
5512
+ ),
5513
+ didWarnAboutMissingArrayBufferDetached = !1,
5427
5514
  LocalPromise = Promise,
5428
5515
  scheduleMicrotask =
5429
5516
  "function" === typeof queueMicrotask
@@ -5888,20 +5975,40 @@
5888
5975
  function progress(entry) {
5889
5976
  if (entry.done) close(response$jscomp$0);
5890
5977
  else {
5891
- entry = entry.value;
5892
- var name = entry[0];
5893
- entry = entry[1];
5894
- if ("string" === typeof entry) {
5895
- var response = response$jscomp$0;
5896
- appendBackingEntry(response._formData, name, entry);
5897
- var prefix = response._prefix;
5898
- if (name.startsWith(prefix)) {
5899
- var chunks = response._chunks;
5900
- name = +name.slice(prefix.length);
5901
- (chunks = chunks.get(name)) &&
5902
- resolveModelChunk(response, chunks, entry, name);
5978
+ var _entry$value = entry.value;
5979
+ entry = _entry$value[0];
5980
+ _entry$value = _entry$value[1];
5981
+ if ("string" === typeof _entry$value)
5982
+ a: {
5983
+ var response = response$jscomp$0,
5984
+ prefix = response._prefix;
5985
+ if (entry.startsWith(prefix)) {
5986
+ var chunks = response._chunks;
5987
+ if ("S" === entry[prefix.length]) {
5988
+ if (
5989
+ entry.length > prefix.length + 1 &&
5990
+ ((prefix = +entry.slice(prefix.length + 1)),
5991
+ (chunks = chunks.get(prefix)))
5992
+ ) {
5993
+ resolveModelChunk(response, chunks, _entry$value, prefix);
5994
+ break a;
5995
+ }
5996
+ } else if (
5997
+ ((prefix = +entry.slice(prefix.length)),
5998
+ (chunks = chunks.get(prefix)))
5999
+ ) {
6000
+ resolveModelChunk(response, chunks, _entry$value, prefix);
6001
+ break a;
6002
+ }
6003
+ }
6004
+ appendBackingEntry(response._formData, _entry$value, entry);
5903
6005
  }
5904
- } else appendBackingEntry(response$jscomp$0._formData, name, entry);
6006
+ else
6007
+ appendBackingEntry(
6008
+ response$jscomp$0._formData,
6009
+ _entry$value,
6010
+ entry
6011
+ );
5905
6012
  iterator.next().then(progress, error);
5906
6013
  }
5907
6014
  }