react-server-dom-webpack 19.0.8 → 19.0.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.
@@ -33,31 +33,39 @@
33
33
  });
34
34
  }
35
35
  function writeChunkAndReturn(destination, chunk) {
36
- if (0 !== chunk.byteLength)
37
- if (2048 < chunk.byteLength)
38
- 0 < writtenBytes &&
39
- (destination.enqueue(
40
- new Uint8Array(currentView.buffer, 0, writtenBytes)
36
+ if (0 === chunk.byteLength)
37
+ if (supportsArrayBufferDetached) {
38
+ if (chunk.buffer.detached)
39
+ throw Error(
40
+ "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()`."
41
+ );
42
+ } else
43
+ didWarnAboutMissingArrayBufferDetached ||
44
+ (console.error(
45
+ "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."
41
46
  ),
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(
51
- chunk.subarray(0, allowableBytes),
52
- writtenBytes
53
- ),
54
- destination.enqueue(currentView),
55
- (chunk = chunk.subarray(allowableBytes))),
56
- (currentView = new Uint8Array(2048)),
57
- (writtenBytes = 0));
58
- currentView.set(chunk, writtenBytes);
59
- writtenBytes += chunk.byteLength;
60
- }
47
+ (didWarnAboutMissingArrayBufferDetached = !0));
48
+ else if (2048 < chunk.byteLength)
49
+ 0 < writtenBytes &&
50
+ (destination.enqueue(
51
+ new Uint8Array(currentView.buffer, 0, writtenBytes)
52
+ ),
53
+ (currentView = new Uint8Array(2048)),
54
+ (writtenBytes = 0)),
55
+ destination.enqueue(chunk);
56
+ else {
57
+ var allowableBytes = currentView.length - writtenBytes;
58
+ allowableBytes < chunk.byteLength &&
59
+ (0 === allowableBytes
60
+ ? destination.enqueue(currentView)
61
+ : (currentView.set(chunk.subarray(0, allowableBytes), writtenBytes),
62
+ destination.enqueue(currentView),
63
+ (chunk = chunk.subarray(allowableBytes))),
64
+ (currentView = new Uint8Array(2048)),
65
+ (writtenBytes = 0));
66
+ currentView.set(chunk, writtenBytes);
67
+ writtenBytes += chunk.byteLength;
68
+ }
61
69
  return !0;
62
70
  }
63
71
  function stringToChunk(content) {
@@ -1880,14 +1888,35 @@
1880
1888
  }
1881
1889
  function emitTypedArrayChunk(request, id, tag, typedArray) {
1882
1890
  request.pendingChunks++;
1883
- var buffer = new Uint8Array(
1884
- typedArray.buffer,
1885
- typedArray.byteOffset,
1886
- typedArray.byteLength
1887
- );
1888
- typedArray = 2048 < typedArray.byteLength ? buffer.slice() : buffer;
1889
- buffer = typedArray.byteLength;
1890
- id = id.toString(16) + ":" + tag + buffer.toString(16) + ",";
1891
+ a: {
1892
+ var view = new Uint8Array(
1893
+ typedArray.buffer,
1894
+ typedArray.byteOffset,
1895
+ typedArray.byteLength
1896
+ );
1897
+ if (2048 < typedArray.byteLength) {
1898
+ if (
1899
+ 0 !== typedArray.byteOffset ||
1900
+ typedArray.byteLength !== typedArray.buffer.byteLength ||
1901
+ typedArray.buffer.resizable
1902
+ ) {
1903
+ typedArray = view.slice();
1904
+ break a;
1905
+ }
1906
+ if (!supportsArrayBufferDetached) {
1907
+ didWarnAboutMissingArrayBufferDetached ||
1908
+ (console.error(
1909
+ "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."
1910
+ ),
1911
+ (didWarnAboutMissingArrayBufferDetached = !0));
1912
+ typedArray = view.slice();
1913
+ break a;
1914
+ }
1915
+ }
1916
+ typedArray = view;
1917
+ }
1918
+ view = typedArray.byteLength;
1919
+ id = id.toString(16) + ":" + tag + view.toString(16) + ",";
1891
1920
  id = stringToChunk(id);
1892
1921
  request.completedRegularChunks.push(id, typedArray);
1893
1922
  }
@@ -2517,6 +2546,39 @@
2517
2546
  chunkMap.set(chunkId, filename);
2518
2547
  return __webpack_chunk_load__(chunkId);
2519
2548
  }
2549
+ function appendBackingEntry(backingStore, value, key) {
2550
+ var prefix = backingStore.prefix;
2551
+ if (key.startsWith(prefix)) {
2552
+ switch (key[prefix.length]) {
2553
+ case "_":
2554
+ prefix = backingStore.referencedEntries;
2555
+ null === prefix && (prefix = backingStore.referencedEntries = []);
2556
+ prefix.push([key, value]);
2557
+ return;
2558
+ case "S":
2559
+ "string" === typeof value &&
2560
+ ((prefix = backingStore.streamChunks),
2561
+ null === prefix &&
2562
+ (prefix = backingStore.streamChunks = new Map()),
2563
+ (backingStore = prefix.get(key)),
2564
+ void 0 === backingStore
2565
+ ? prefix.set(key, [value])
2566
+ : backingStore.push(value));
2567
+ return;
2568
+ }
2569
+ "string" === typeof value
2570
+ ? ((prefix = backingStore.stringChunks),
2571
+ null === prefix && (prefix = backingStore.stringChunks = new Map()),
2572
+ prefix.set(key, value))
2573
+ : ((prefix = backingStore.blobs),
2574
+ null === prefix && (prefix = backingStore.blobs = new Map()),
2575
+ prefix.set(key, value));
2576
+ }
2577
+ }
2578
+ function getBackingBlob(backingStore, key) {
2579
+ backingStore = backingStore.blobs;
2580
+ return null === backingStore ? void 0 : backingStore.get(key);
2581
+ }
2520
2582
  function ReactPromise(status, value, reason) {
2521
2583
  this.status = status;
2522
2584
  this.value = value;
@@ -2826,17 +2888,20 @@
2826
2888
  function getChunk(response, id) {
2827
2889
  var chunks = response._chunks,
2828
2890
  chunk = chunks.get(id);
2829
- chunk ||
2830
- ((chunk = response._formData.data.get(response._prefix + id)),
2831
- (chunk =
2891
+ if (!chunk) {
2892
+ chunk = response._prefix;
2893
+ var stringChunks = response._formData.stringChunks;
2894
+ chunk = null === stringChunks ? void 0 : stringChunks.get(chunk + id);
2895
+ chunk =
2832
2896
  "string" === typeof chunk
2833
2897
  ? new ReactPromise(
2834
2898
  "resolved_model",
2835
2899
  chunk,
2836
2900
  _defineProperty({ id: id }, RESPONSE_SYMBOL, response)
2837
2901
  )
2838
- : new ReactPromise("pending", null, null)),
2839
- chunks.set(id, chunk));
2902
+ : new ReactPromise("pending", null, null);
2903
+ chunks.set(id, chunk);
2904
+ }
2840
2905
  return chunk;
2841
2906
  }
2842
2907
  function fulfillReference(response, reference, value, arrayRoot) {
@@ -3083,7 +3148,7 @@
3083
3148
  Error("Already initialized typed array.")
3084
3149
  )
3085
3150
  );
3086
- reference = response._formData.data.get(key).arrayBuffer();
3151
+ reference = getBackingBlob(response._formData, key).arrayBuffer();
3087
3152
  if (initializingHandler) {
3088
3153
  var handler = initializingHandler;
3089
3154
  handler.deps++;
@@ -3127,15 +3192,17 @@
3127
3192
  var chunks = response._chunks;
3128
3193
  stream = new ReactPromise("fulfilled", stream, controller);
3129
3194
  chunks.set(id, stream);
3130
- response = response._formData.data.getAll(response._prefix + id);
3131
- for (id = 0; id < response.length; id++)
3132
- (chunks = response[id]),
3133
- "string" === typeof chunks &&
3134
- ("C" === chunks[0]
3195
+ chunks = response._prefix;
3196
+ response = response._formData.streamChunks;
3197
+ id = null === response ? void 0 : response.get(chunks + "S" + id);
3198
+ if (void 0 !== id)
3199
+ for (response = 0; response < id.length; response++)
3200
+ (chunks = id[response]),
3201
+ "C" === chunks[0]
3135
3202
  ? controller.close(
3136
3203
  "C" === chunks ? '"$undefined"' : chunks.slice(1)
3137
3204
  )
3138
- : controller.enqueueModel(chunks));
3205
+ : controller.enqueueModel(chunks);
3139
3206
  }
3140
3207
  function parseReadableStream(response, reference, type) {
3141
3208
  function enqueue(value) {
@@ -3299,7 +3366,14 @@
3299
3366
  });
3300
3367
  return iterator;
3301
3368
  }
3302
- function parseModelString(response, obj, key, value, reference, arrayRoot) {
3369
+ function parseModelString(
3370
+ response,
3371
+ obj,
3372
+ key$jscomp$0,
3373
+ value,
3374
+ reference,
3375
+ arrayRoot
3376
+ ) {
3303
3377
  if ("$" === value[0]) {
3304
3378
  switch (value[1]) {
3305
3379
  case "$":
@@ -3319,7 +3393,7 @@
3319
3393
  response,
3320
3394
  arrayRoot,
3321
3395
  obj,
3322
- key,
3396
+ key$jscomp$0,
3323
3397
  null,
3324
3398
  loadServerReference$1
3325
3399
  )
@@ -3339,41 +3413,44 @@
3339
3413
  case "Q":
3340
3414
  return (
3341
3415
  (arrayRoot = value.slice(2)),
3342
- getOutlinedModel(response, arrayRoot, obj, key, null, createMap)
3416
+ getOutlinedModel(
3417
+ response,
3418
+ arrayRoot,
3419
+ obj,
3420
+ key$jscomp$0,
3421
+ null,
3422
+ createMap
3423
+ )
3343
3424
  );
3344
3425
  case "W":
3345
3426
  return (
3346
3427
  (arrayRoot = value.slice(2)),
3347
- getOutlinedModel(response, arrayRoot, obj, key, null, createSet)
3428
+ getOutlinedModel(
3429
+ response,
3430
+ arrayRoot,
3431
+ obj,
3432
+ key$jscomp$0,
3433
+ null,
3434
+ createSet
3435
+ )
3348
3436
  );
3349
3437
  case "K":
3350
- key = value.slice(2);
3351
- obj = response._prefix + "_";
3352
- key = obj + key + "_";
3353
- arrayRoot = new FormData();
3354
- for (response = response._formData; ; ) {
3355
- value = response;
3356
- reference = value.keys;
3357
- null === reference &&
3358
- ((reference = value.keys = Array.from(value.data.keys())),
3359
- (value.keyPointer = 0));
3360
- value = reference[value.keyPointer];
3361
- if (void 0 === value) break;
3362
- if (value.startsWith(key)) {
3363
- reference = response.data.getAll(value);
3364
- for (
3365
- var referencedFormDataKey = value.slice(key.length), i = 0;
3366
- i < reference.length;
3367
- i++
3368
- )
3369
- arrayRoot.append(referencedFormDataKey, reference[i]);
3370
- reference = response;
3371
- reference.data.delete(value);
3372
- reference.keyPointer++;
3373
- } else if (value.startsWith(obj)) break;
3374
- else response.keyPointer++;
3438
+ key$jscomp$0 = value.slice(2);
3439
+ obj = response._formData;
3440
+ response = response._prefix + "_" + key$jscomp$0 + "_";
3441
+ key$jscomp$0 = new FormData();
3442
+ arrayRoot = obj.referencedEntries;
3443
+ if (null !== arrayRoot) {
3444
+ for (value = obj.keyPointer; value < arrayRoot.length; ) {
3445
+ reference = arrayRoot[value];
3446
+ var key = reference[0];
3447
+ if (!key.startsWith(response)) break;
3448
+ key$jscomp$0.append(key.slice(response.length), reference[1]);
3449
+ value++;
3450
+ }
3451
+ obj.keyPointer = value;
3375
3452
  }
3376
- return arrayRoot;
3453
+ return key$jscomp$0;
3377
3454
  case "i":
3378
3455
  return (
3379
3456
  (arrayRoot = value.slice(2)),
@@ -3381,7 +3458,7 @@
3381
3458
  response,
3382
3459
  arrayRoot,
3383
3460
  obj,
3384
- key,
3461
+ key$jscomp$0,
3385
3462
  null,
3386
3463
  extractIterator
3387
3464
  )
@@ -3418,7 +3495,7 @@
3418
3495
  ArrayBuffer,
3419
3496
  1,
3420
3497
  obj,
3421
- key,
3498
+ key$jscomp$0,
3422
3499
  arrayRoot
3423
3500
  );
3424
3501
  case "O":
@@ -3428,7 +3505,7 @@
3428
3505
  Int8Array,
3429
3506
  1,
3430
3507
  obj,
3431
- key,
3508
+ key$jscomp$0,
3432
3509
  arrayRoot
3433
3510
  );
3434
3511
  case "o":
@@ -3438,7 +3515,7 @@
3438
3515
  Uint8Array,
3439
3516
  1,
3440
3517
  obj,
3441
- key,
3518
+ key$jscomp$0,
3442
3519
  arrayRoot
3443
3520
  );
3444
3521
  case "U":
@@ -3448,7 +3525,7 @@
3448
3525
  Uint8ClampedArray,
3449
3526
  1,
3450
3527
  obj,
3451
- key,
3528
+ key$jscomp$0,
3452
3529
  arrayRoot
3453
3530
  );
3454
3531
  case "S":
@@ -3458,7 +3535,7 @@
3458
3535
  Int16Array,
3459
3536
  2,
3460
3537
  obj,
3461
- key,
3538
+ key$jscomp$0,
3462
3539
  arrayRoot
3463
3540
  );
3464
3541
  case "s":
@@ -3468,7 +3545,7 @@
3468
3545
  Uint16Array,
3469
3546
  2,
3470
3547
  obj,
3471
- key,
3548
+ key$jscomp$0,
3472
3549
  arrayRoot
3473
3550
  );
3474
3551
  case "L":
@@ -3478,7 +3555,7 @@
3478
3555
  Int32Array,
3479
3556
  4,
3480
3557
  obj,
3481
- key,
3558
+ key$jscomp$0,
3482
3559
  arrayRoot
3483
3560
  );
3484
3561
  case "l":
@@ -3488,7 +3565,7 @@
3488
3565
  Uint32Array,
3489
3566
  4,
3490
3567
  obj,
3491
- key,
3568
+ key$jscomp$0,
3492
3569
  arrayRoot
3493
3570
  );
3494
3571
  case "G":
@@ -3498,7 +3575,7 @@
3498
3575
  Float32Array,
3499
3576
  4,
3500
3577
  obj,
3501
- key,
3578
+ key$jscomp$0,
3502
3579
  arrayRoot
3503
3580
  );
3504
3581
  case "g":
@@ -3508,7 +3585,7 @@
3508
3585
  Float64Array,
3509
3586
  8,
3510
3587
  obj,
3511
- key,
3588
+ key$jscomp$0,
3512
3589
  arrayRoot
3513
3590
  );
3514
3591
  case "M":
@@ -3518,7 +3595,7 @@
3518
3595
  BigInt64Array,
3519
3596
  8,
3520
3597
  obj,
3521
- key,
3598
+ key$jscomp$0,
3522
3599
  arrayRoot
3523
3600
  );
3524
3601
  case "m":
@@ -3528,7 +3605,7 @@
3528
3605
  BigUint64Array,
3529
3606
  8,
3530
3607
  obj,
3531
- key,
3608
+ key$jscomp$0,
3532
3609
  arrayRoot
3533
3610
  );
3534
3611
  case "V":
@@ -3538,13 +3615,13 @@
3538
3615
  DataView,
3539
3616
  1,
3540
3617
  obj,
3541
- key,
3618
+ key$jscomp$0,
3542
3619
  arrayRoot
3543
3620
  );
3544
3621
  case "B":
3545
3622
  return (
3546
3623
  (obj = parseInt(value.slice(2), 16)),
3547
- response._formData.data.get(response._prefix + obj)
3624
+ getBackingBlob(response._formData, response._prefix + obj)
3548
3625
  );
3549
3626
  }
3550
3627
  switch (value[1]) {
@@ -3562,7 +3639,7 @@
3562
3639
  response,
3563
3640
  value,
3564
3641
  obj,
3565
- key,
3642
+ key$jscomp$0,
3566
3643
  arrayRoot,
3567
3644
  createModel
3568
3645
  );
@@ -3581,11 +3658,20 @@
3581
3658
  : new FormData(),
3582
3659
  arraySizeLimit =
3583
3660
  4 < arguments.length && void 0 !== arguments[4] ? arguments[4] : 1e6,
3584
- chunks = new Map();
3661
+ chunks = new Map(),
3662
+ backingStore = {
3663
+ prefix: formFieldPrefix,
3664
+ referencedEntries: null,
3665
+ keyPointer: 0,
3666
+ stringChunks: null,
3667
+ streamChunks: null,
3668
+ blobs: null
3669
+ };
3670
+ backingFormData.forEach(appendBackingEntry.bind(null, backingStore));
3585
3671
  return {
3586
3672
  _bundlerConfig: bundlerConfig,
3587
3673
  _prefix: formFieldPrefix,
3588
- _formData: { data: backingFormData, keyPointer: -1, keys: null },
3674
+ _formData: backingStore,
3589
3675
  _chunks: chunks,
3590
3676
  _temporaryReferences: temporaryReferences,
3591
3677
  _rootArrayContexts: new WeakMap(),
@@ -3642,13 +3728,19 @@
3642
3728
  }
3643
3729
  var ReactDOM = require("react-dom"),
3644
3730
  React = require("react"),
3731
+ hasOwnProperty = Object.prototype.hasOwnProperty,
3645
3732
  channel = new MessageChannel(),
3646
3733
  taskQueue = [];
3647
3734
  channel.port1.onmessage = function () {
3648
3735
  var task = taskQueue.shift();
3649
3736
  task && task();
3650
3737
  };
3651
- var LocalPromise = Promise,
3738
+ var supportsArrayBufferDetached = hasOwnProperty.call(
3739
+ ArrayBuffer.prototype,
3740
+ "detached"
3741
+ ),
3742
+ didWarnAboutMissingArrayBufferDetached = !1,
3743
+ LocalPromise = Promise,
3652
3744
  scheduleMicrotask =
3653
3745
  "function" === typeof queueMicrotask
3654
3746
  ? queueMicrotask
@@ -4076,7 +4168,6 @@
4076
4168
  debugID = null,
4077
4169
  modelRoot = !1,
4078
4170
  emptyRoot = {},
4079
- hasOwnProperty = Object.prototype.hasOwnProperty,
4080
4171
  chunkCache = new Map(),
4081
4172
  chunkMap = new Map(),
4082
4173
  webpackGetChunkFilename = __webpack_require__.u;