react-server-dom-webpack 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.
@@ -22,31 +22,39 @@
22
22
  });
23
23
  }
24
24
  function writeChunk(destination, chunk) {
25
- if (0 !== chunk.byteLength)
26
- if (2048 < chunk.byteLength)
27
- 0 < writtenBytes &&
28
- (destination.enqueue(
29
- new Uint8Array(currentView.buffer, 0, writtenBytes)
25
+ if (0 === chunk.byteLength)
26
+ if (supportsArrayBufferDetached) {
27
+ if (chunk.buffer.detached)
28
+ throw Error(
29
+ "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()`."
30
+ );
31
+ } else
32
+ didWarnAboutMissingArrayBufferDetached ||
33
+ (console.error(
34
+ "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."
30
35
  ),
31
- (currentView = new Uint8Array(2048)),
32
- (writtenBytes = 0)),
33
- destination.enqueue(chunk);
34
- else {
35
- var allowableBytes = currentView.length - writtenBytes;
36
- allowableBytes < chunk.byteLength &&
37
- (0 === allowableBytes
38
- ? destination.enqueue(currentView)
39
- : (currentView.set(
40
- chunk.subarray(0, allowableBytes),
41
- writtenBytes
42
- ),
43
- destination.enqueue(currentView),
44
- (chunk = chunk.subarray(allowableBytes))),
45
- (currentView = new Uint8Array(2048)),
46
- (writtenBytes = 0));
47
- currentView.set(chunk, writtenBytes);
48
- writtenBytes += chunk.byteLength;
49
- }
36
+ (didWarnAboutMissingArrayBufferDetached = !0));
37
+ else if (2048 < chunk.byteLength)
38
+ 0 < writtenBytes &&
39
+ (destination.enqueue(
40
+ new Uint8Array(currentView.buffer, 0, writtenBytes)
41
+ ),
42
+ (currentView = new Uint8Array(2048)),
43
+ (writtenBytes = 0)),
44
+ destination.enqueue(chunk);
45
+ else {
46
+ var allowableBytes = currentView.length - writtenBytes;
47
+ allowableBytes < chunk.byteLength &&
48
+ (0 === allowableBytes
49
+ ? destination.enqueue(currentView)
50
+ : (currentView.set(chunk.subarray(0, allowableBytes), writtenBytes),
51
+ destination.enqueue(currentView),
52
+ (chunk = chunk.subarray(allowableBytes))),
53
+ (currentView = new Uint8Array(2048)),
54
+ (writtenBytes = 0));
55
+ currentView.set(chunk, writtenBytes);
56
+ writtenBytes += chunk.byteLength;
57
+ }
50
58
  }
51
59
  function writeChunkAndReturn(destination, chunk) {
52
60
  writeChunk(destination, chunk);
@@ -3034,14 +3042,35 @@
3034
3042
  }
3035
3043
  function emitTypedArrayChunk(request, id, tag, typedArray, debug) {
3036
3044
  debug ? request.pendingDebugChunks++ : request.pendingChunks++;
3037
- var buffer = new Uint8Array(
3038
- typedArray.buffer,
3039
- typedArray.byteOffset,
3040
- typedArray.byteLength
3041
- );
3042
- typedArray = 2048 < typedArray.byteLength ? buffer.slice() : buffer;
3043
- buffer = typedArray.byteLength;
3044
- id = id.toString(16) + ":" + tag + buffer.toString(16) + ",";
3045
+ a: {
3046
+ var view = new Uint8Array(
3047
+ typedArray.buffer,
3048
+ typedArray.byteOffset,
3049
+ typedArray.byteLength
3050
+ );
3051
+ if (2048 < typedArray.byteLength) {
3052
+ if (
3053
+ 0 !== typedArray.byteOffset ||
3054
+ typedArray.byteLength !== typedArray.buffer.byteLength ||
3055
+ typedArray.buffer.resizable
3056
+ ) {
3057
+ typedArray = view.slice();
3058
+ break a;
3059
+ }
3060
+ if (!supportsArrayBufferDetached) {
3061
+ didWarnAboutMissingArrayBufferDetached ||
3062
+ (console.error(
3063
+ "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."
3064
+ ),
3065
+ (didWarnAboutMissingArrayBufferDetached = !0));
3066
+ typedArray = view.slice();
3067
+ break a;
3068
+ }
3069
+ }
3070
+ typedArray = view;
3071
+ }
3072
+ view = typedArray.byteLength;
3073
+ id = id.toString(16) + ":" + tag + view.toString(16) + ",";
3045
3074
  id = stringToChunk(id);
3046
3075
  debug
3047
3076
  ? request.completedDebugChunks.push(
@@ -4198,6 +4227,39 @@
4198
4227
  chunkMap.set(chunkId, filename);
4199
4228
  return __webpack_chunk_load__(chunkId);
4200
4229
  }
4230
+ function appendBackingEntry(backingStore, value, key) {
4231
+ var prefix = backingStore.prefix;
4232
+ if (key.startsWith(prefix)) {
4233
+ switch (key[prefix.length]) {
4234
+ case "_":
4235
+ prefix = backingStore.referencedEntries;
4236
+ null === prefix && (prefix = backingStore.referencedEntries = []);
4237
+ prefix.push([key, value]);
4238
+ return;
4239
+ case "S":
4240
+ "string" === typeof value &&
4241
+ ((prefix = backingStore.streamChunks),
4242
+ null === prefix &&
4243
+ (prefix = backingStore.streamChunks = new Map()),
4244
+ (backingStore = prefix.get(key)),
4245
+ void 0 === backingStore
4246
+ ? prefix.set(key, [value])
4247
+ : backingStore.push(value));
4248
+ return;
4249
+ }
4250
+ "string" === typeof value
4251
+ ? ((prefix = backingStore.stringChunks),
4252
+ null === prefix && (prefix = backingStore.stringChunks = new Map()),
4253
+ prefix.set(key, value))
4254
+ : ((prefix = backingStore.blobs),
4255
+ null === prefix && (prefix = backingStore.blobs = new Map()),
4256
+ prefix.set(key, value));
4257
+ }
4258
+ }
4259
+ function getBackingBlob(backingStore, key) {
4260
+ backingStore = backingStore.blobs;
4261
+ return null === backingStore ? void 0 : backingStore.get(key);
4262
+ }
4201
4263
  function ReactPromise(status, value, reason) {
4202
4264
  this.status = status;
4203
4265
  this.value = value;
@@ -4534,15 +4596,18 @@
4534
4596
  function getChunk(response, id) {
4535
4597
  var chunks = response._chunks,
4536
4598
  chunk = chunks.get(id);
4537
- chunk ||
4538
- ((chunk = response._formData.data.get(response._prefix + id)),
4539
- (chunk =
4599
+ if (!chunk) {
4600
+ chunk = response._prefix;
4601
+ var stringChunks = response._formData.stringChunks;
4602
+ chunk = null === stringChunks ? void 0 : stringChunks.get(chunk + id);
4603
+ chunk =
4540
4604
  "string" === typeof chunk
4541
4605
  ? createResolvedModelChunk(response, chunk, id)
4542
4606
  : response._closed
4543
4607
  ? new ReactPromise("rejected", null, response._closedReason)
4544
- : new ReactPromise("pending", null, null)),
4545
- chunks.set(id, chunk));
4608
+ : new ReactPromise("pending", null, null);
4609
+ chunks.set(id, chunk);
4610
+ }
4546
4611
  return chunk;
4547
4612
  }
4548
4613
  function fulfillReference(response, reference, value, arrayRoot) {
@@ -4789,7 +4854,7 @@
4789
4854
  Error("Already initialized typed array.")
4790
4855
  )
4791
4856
  );
4792
- reference = response._formData.data.get(key).arrayBuffer();
4857
+ reference = getBackingBlob(response._formData, key).arrayBuffer();
4793
4858
  if (initializingHandler) {
4794
4859
  var handler = initializingHandler;
4795
4860
  handler.deps++;
@@ -4833,15 +4898,17 @@
4833
4898
  var chunks = response._chunks;
4834
4899
  stream = new ReactPromise("fulfilled", stream, controller);
4835
4900
  chunks.set(id, stream);
4836
- response = response._formData.data.getAll(response._prefix + id);
4837
- for (id = 0; id < response.length; id++)
4838
- (chunks = response[id]),
4839
- "string" === typeof chunks &&
4840
- ("C" === chunks[0]
4901
+ chunks = response._prefix;
4902
+ response = response._formData.streamChunks;
4903
+ id = null === response ? void 0 : response.get(chunks + "S" + id);
4904
+ if (void 0 !== id)
4905
+ for (response = 0; response < id.length; response++)
4906
+ (chunks = id[response]),
4907
+ "C" === chunks[0]
4841
4908
  ? controller.close(
4842
4909
  "C" === chunks ? '"$undefined"' : chunks.slice(1)
4843
4910
  )
4844
- : controller.enqueueModel(chunks));
4911
+ : controller.enqueueModel(chunks);
4845
4912
  }
4846
4913
  function parseReadableStream(response, reference, type) {
4847
4914
  function enqueue(value) {
@@ -5006,7 +5073,14 @@
5006
5073
  });
5007
5074
  return iterator;
5008
5075
  }
5009
- function parseModelString(response, obj, key, value, reference, arrayRoot) {
5076
+ function parseModelString(
5077
+ response,
5078
+ obj,
5079
+ key$jscomp$0,
5080
+ value,
5081
+ reference,
5082
+ arrayRoot
5083
+ ) {
5010
5084
  if ("$" === value[0]) {
5011
5085
  switch (value[1]) {
5012
5086
  case "$":
@@ -5026,7 +5100,7 @@
5026
5100
  response,
5027
5101
  arrayRoot,
5028
5102
  obj,
5029
- key,
5103
+ key$jscomp$0,
5030
5104
  null,
5031
5105
  loadServerReference$1
5032
5106
  )
@@ -5046,41 +5120,44 @@
5046
5120
  case "Q":
5047
5121
  return (
5048
5122
  (arrayRoot = value.slice(2)),
5049
- getOutlinedModel(response, arrayRoot, obj, key, null, createMap)
5123
+ getOutlinedModel(
5124
+ response,
5125
+ arrayRoot,
5126
+ obj,
5127
+ key$jscomp$0,
5128
+ null,
5129
+ createMap
5130
+ )
5050
5131
  );
5051
5132
  case "W":
5052
5133
  return (
5053
5134
  (arrayRoot = value.slice(2)),
5054
- getOutlinedModel(response, arrayRoot, obj, key, null, createSet)
5135
+ getOutlinedModel(
5136
+ response,
5137
+ arrayRoot,
5138
+ obj,
5139
+ key$jscomp$0,
5140
+ null,
5141
+ createSet
5142
+ )
5055
5143
  );
5056
5144
  case "K":
5057
- key = value.slice(2);
5058
- obj = response._prefix + "_";
5059
- key = obj + key + "_";
5060
- arrayRoot = new FormData();
5061
- for (response = response._formData; ; ) {
5062
- value = response;
5063
- reference = value.keys;
5064
- null === reference &&
5065
- ((reference = value.keys = Array.from(value.data.keys())),
5066
- (value.keyPointer = 0));
5067
- value = reference[value.keyPointer];
5068
- if (void 0 === value) break;
5069
- if (value.startsWith(key)) {
5070
- reference = response.data.getAll(value);
5071
- for (
5072
- var referencedFormDataKey = value.slice(key.length), i = 0;
5073
- i < reference.length;
5074
- i++
5075
- )
5076
- arrayRoot.append(referencedFormDataKey, reference[i]);
5077
- reference = response;
5078
- reference.data.delete(value);
5079
- reference.keyPointer++;
5080
- } else if (value.startsWith(obj)) break;
5081
- else response.keyPointer++;
5145
+ key$jscomp$0 = value.slice(2);
5146
+ obj = response._formData;
5147
+ response = response._prefix + "_" + key$jscomp$0 + "_";
5148
+ key$jscomp$0 = new FormData();
5149
+ arrayRoot = obj.referencedEntries;
5150
+ if (null !== arrayRoot) {
5151
+ for (value = obj.keyPointer; value < arrayRoot.length; ) {
5152
+ reference = arrayRoot[value];
5153
+ var key = reference[0];
5154
+ if (!key.startsWith(response)) break;
5155
+ key$jscomp$0.append(key.slice(response.length), reference[1]);
5156
+ value++;
5157
+ }
5158
+ obj.keyPointer = value;
5082
5159
  }
5083
- return arrayRoot;
5160
+ return key$jscomp$0;
5084
5161
  case "i":
5085
5162
  return (
5086
5163
  (arrayRoot = value.slice(2)),
@@ -5088,7 +5165,7 @@
5088
5165
  response,
5089
5166
  arrayRoot,
5090
5167
  obj,
5091
- key,
5168
+ key$jscomp$0,
5092
5169
  null,
5093
5170
  extractIterator
5094
5171
  )
@@ -5123,7 +5200,7 @@
5123
5200
  ArrayBuffer,
5124
5201
  1,
5125
5202
  obj,
5126
- key,
5203
+ key$jscomp$0,
5127
5204
  arrayRoot
5128
5205
  );
5129
5206
  case "O":
@@ -5133,7 +5210,7 @@
5133
5210
  Int8Array,
5134
5211
  1,
5135
5212
  obj,
5136
- key,
5213
+ key$jscomp$0,
5137
5214
  arrayRoot
5138
5215
  );
5139
5216
  case "o":
@@ -5143,7 +5220,7 @@
5143
5220
  Uint8Array,
5144
5221
  1,
5145
5222
  obj,
5146
- key,
5223
+ key$jscomp$0,
5147
5224
  arrayRoot
5148
5225
  );
5149
5226
  case "U":
@@ -5153,7 +5230,7 @@
5153
5230
  Uint8ClampedArray,
5154
5231
  1,
5155
5232
  obj,
5156
- key,
5233
+ key$jscomp$0,
5157
5234
  arrayRoot
5158
5235
  );
5159
5236
  case "S":
@@ -5163,7 +5240,7 @@
5163
5240
  Int16Array,
5164
5241
  2,
5165
5242
  obj,
5166
- key,
5243
+ key$jscomp$0,
5167
5244
  arrayRoot
5168
5245
  );
5169
5246
  case "s":
@@ -5173,7 +5250,7 @@
5173
5250
  Uint16Array,
5174
5251
  2,
5175
5252
  obj,
5176
- key,
5253
+ key$jscomp$0,
5177
5254
  arrayRoot
5178
5255
  );
5179
5256
  case "L":
@@ -5183,7 +5260,7 @@
5183
5260
  Int32Array,
5184
5261
  4,
5185
5262
  obj,
5186
- key,
5263
+ key$jscomp$0,
5187
5264
  arrayRoot
5188
5265
  );
5189
5266
  case "l":
@@ -5193,7 +5270,7 @@
5193
5270
  Uint32Array,
5194
5271
  4,
5195
5272
  obj,
5196
- key,
5273
+ key$jscomp$0,
5197
5274
  arrayRoot
5198
5275
  );
5199
5276
  case "G":
@@ -5203,7 +5280,7 @@
5203
5280
  Float32Array,
5204
5281
  4,
5205
5282
  obj,
5206
- key,
5283
+ key$jscomp$0,
5207
5284
  arrayRoot
5208
5285
  );
5209
5286
  case "g":
@@ -5213,7 +5290,7 @@
5213
5290
  Float64Array,
5214
5291
  8,
5215
5292
  obj,
5216
- key,
5293
+ key$jscomp$0,
5217
5294
  arrayRoot
5218
5295
  );
5219
5296
  case "M":
@@ -5223,7 +5300,7 @@
5223
5300
  BigInt64Array,
5224
5301
  8,
5225
5302
  obj,
5226
- key,
5303
+ key$jscomp$0,
5227
5304
  arrayRoot
5228
5305
  );
5229
5306
  case "m":
@@ -5233,7 +5310,7 @@
5233
5310
  BigUint64Array,
5234
5311
  8,
5235
5312
  obj,
5236
- key,
5313
+ key$jscomp$0,
5237
5314
  arrayRoot
5238
5315
  );
5239
5316
  case "V":
@@ -5243,12 +5320,15 @@
5243
5320
  DataView,
5244
5321
  1,
5245
5322
  obj,
5246
- key,
5323
+ key$jscomp$0,
5247
5324
  arrayRoot
5248
5325
  );
5249
5326
  case "B":
5250
5327
  obj = parseInt(value.slice(2), 16);
5251
- response = response._formData.data.get(response._prefix + obj);
5328
+ response = getBackingBlob(
5329
+ response._formData,
5330
+ response._prefix + obj
5331
+ );
5252
5332
  if (!(response instanceof Blob))
5253
5333
  throw Error("Referenced Blob is not a Blob.");
5254
5334
  return response;
@@ -5266,7 +5346,7 @@
5266
5346
  response,
5267
5347
  value,
5268
5348
  obj,
5269
- key,
5349
+ key$jscomp$0,
5270
5350
  arrayRoot,
5271
5351
  createModel
5272
5352
  );
@@ -5285,11 +5365,20 @@
5285
5365
  : new FormData(),
5286
5366
  arraySizeLimit =
5287
5367
  4 < arguments.length && void 0 !== arguments[4] ? arguments[4] : 1e6,
5288
- chunks = new Map();
5368
+ chunks = new Map(),
5369
+ backingStore = {
5370
+ prefix: formFieldPrefix,
5371
+ referencedEntries: null,
5372
+ keyPointer: 0,
5373
+ stringChunks: null,
5374
+ streamChunks: null,
5375
+ blobs: null
5376
+ };
5377
+ backingFormData.forEach(appendBackingEntry.bind(null, backingStore));
5289
5378
  return {
5290
5379
  _bundlerConfig: bundlerConfig,
5291
5380
  _prefix: formFieldPrefix,
5292
- _formData: { data: backingFormData, keyPointer: -1, keys: null },
5381
+ _formData: backingStore,
5293
5382
  _chunks: chunks,
5294
5383
  _closed: !1,
5295
5384
  _closedReason: null,
@@ -5436,13 +5525,19 @@
5436
5525
  }
5437
5526
  var ReactDOM = require("react-dom"),
5438
5527
  React = require("react"),
5528
+ hasOwnProperty = Object.prototype.hasOwnProperty,
5439
5529
  channel = new MessageChannel(),
5440
5530
  taskQueue = [];
5441
5531
  channel.port1.onmessage = function () {
5442
5532
  var task = taskQueue.shift();
5443
5533
  task && task();
5444
5534
  };
5445
- var LocalPromise = Promise,
5535
+ var supportsArrayBufferDetached = hasOwnProperty.call(
5536
+ ArrayBuffer.prototype,
5537
+ "detached"
5538
+ ),
5539
+ didWarnAboutMissingArrayBufferDetached = !1,
5540
+ LocalPromise = Promise,
5446
5541
  scheduleMicrotask =
5447
5542
  "function" === typeof queueMicrotask
5448
5543
  ? queueMicrotask
@@ -5829,7 +5924,6 @@
5829
5924
  jsxPropsParents = new WeakMap(),
5830
5925
  jsxChildrenParents = new WeakMap(),
5831
5926
  CLIENT_REFERENCE_TAG = Symbol.for("react.client.reference"),
5832
- hasOwnProperty = Object.prototype.hasOwnProperty,
5833
5927
  doNotLimit = new WeakSet();
5834
5928
  "object" === typeof console &&
5835
5929
  null !== console &&