react-router 7.13.2 → 7.14.0-pre.0

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.
Files changed (60) hide show
  1. package/CHANGELOG.md +75 -24
  2. package/dist/development/{browser-Bfn3xw9E.d.ts → browser-C9Ar1yxG.d.ts} +13 -10
  3. package/dist/development/{browser-Di6-vSl-.d.mts → browser-vtIR1Kpe.d.mts} +13 -10
  4. package/dist/development/{chunk-UVKPFVEO.mjs → chunk-47HDNIOI.mjs} +192 -119
  5. package/dist/development/{chunk-UALY5CBT.mjs → chunk-D73YQQSY.mjs} +21 -7
  6. package/dist/development/{chunk-GO74ODU3.js → chunk-GE4J47XT.js} +191 -118
  7. package/dist/{production/chunk-XAAX7KIK.js → development/chunk-KLEV7K4H.js} +99 -99
  8. package/dist/development/{chunk-LLP6DRWX.js → chunk-MA52INJ5.js} +7 -7
  9. package/dist/development/dom-export.d.mts +1 -1
  10. package/dist/development/dom-export.d.ts +1 -1
  11. package/dist/development/dom-export.js +65 -54
  12. package/dist/development/dom-export.mjs +34 -23
  13. package/dist/{production/index-react-server-client-BcrVT7Dd.d.mts → development/index-react-server-client-BwWaHAr3.d.mts} +7 -5
  14. package/dist/development/{index-react-server-client-CCwMoQIT.d.ts → index-react-server-client-luDbagNU.d.ts} +7 -5
  15. package/dist/development/index-react-server-client.d.mts +1 -1
  16. package/dist/development/index-react-server-client.d.ts +1 -1
  17. package/dist/development/index-react-server-client.js +4 -4
  18. package/dist/development/index-react-server-client.mjs +2 -2
  19. package/dist/development/index-react-server.d.mts +12 -3
  20. package/dist/development/index-react-server.d.ts +12 -3
  21. package/dist/development/index-react-server.js +58 -18
  22. package/dist/development/index-react-server.mjs +58 -18
  23. package/dist/development/index.d.mts +4 -4
  24. package/dist/development/index.d.ts +4 -4
  25. package/dist/development/index.js +101 -87
  26. package/dist/development/index.mjs +3 -3
  27. package/dist/development/lib/types/internal.d.mts +10 -10
  28. package/dist/development/lib/types/internal.d.ts +10 -10
  29. package/dist/development/lib/types/internal.js +1 -1
  30. package/dist/development/lib/types/internal.mjs +1 -1
  31. package/dist/production/{browser-Bfn3xw9E.d.ts → browser-C9Ar1yxG.d.ts} +13 -10
  32. package/dist/production/{browser-Di6-vSl-.d.mts → browser-vtIR1Kpe.d.mts} +13 -10
  33. package/dist/production/{chunk-CAFVLUDY.js → chunk-G3YAUWGC.js} +7 -7
  34. package/dist/production/{chunk-2BDJPJTA.mjs → chunk-MQKMC5YB.mjs} +192 -119
  35. package/dist/production/{chunk-LKUVSIBA.js → chunk-OBXCYSYK.js} +191 -118
  36. package/dist/{development/chunk-HPFFRPKK.js → production/chunk-QIHLB25G.js} +99 -99
  37. package/dist/production/{chunk-PY35PE22.mjs → chunk-XM7AQRW7.mjs} +21 -7
  38. package/dist/production/dom-export.d.mts +1 -1
  39. package/dist/production/dom-export.d.ts +1 -1
  40. package/dist/production/dom-export.js +65 -54
  41. package/dist/production/dom-export.mjs +34 -23
  42. package/dist/{development/index-react-server-client-BcrVT7Dd.d.mts → production/index-react-server-client-BwWaHAr3.d.mts} +7 -5
  43. package/dist/production/{index-react-server-client-CCwMoQIT.d.ts → index-react-server-client-luDbagNU.d.ts} +7 -5
  44. package/dist/production/index-react-server-client.d.mts +1 -1
  45. package/dist/production/index-react-server-client.d.ts +1 -1
  46. package/dist/production/index-react-server-client.js +4 -4
  47. package/dist/production/index-react-server-client.mjs +2 -2
  48. package/dist/production/index-react-server.d.mts +12 -3
  49. package/dist/production/index-react-server.d.ts +12 -3
  50. package/dist/production/index-react-server.js +58 -18
  51. package/dist/production/index-react-server.mjs +58 -18
  52. package/dist/production/index.d.mts +4 -4
  53. package/dist/production/index.d.ts +4 -4
  54. package/dist/production/index.js +101 -87
  55. package/dist/production/index.mjs +3 -3
  56. package/dist/production/lib/types/internal.d.mts +10 -10
  57. package/dist/production/lib/types/internal.d.ts +10 -10
  58. package/dist/production/lib/types/internal.js +1 -1
  59. package/dist/production/lib/types/internal.mjs +1 -1
  60. package/package.json +1 -1
@@ -1,5 +1,5 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }/**
2
- * react-router v7.13.2
2
+ * react-router v7.14.0-pre.0
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -5590,7 +5590,10 @@ function createLineSplittingTransform() {
5590
5590
  }
5591
5591
 
5592
5592
  // vendor/turbo-stream-v2/flatten.ts
5593
- function flatten(input) {
5593
+ var TIME_LIMIT_MS = 1;
5594
+ var getNow = () => Date.now();
5595
+ var yieldToMain = () => new Promise((resolve) => setTimeout(resolve, 0));
5596
+ async function flatten(input) {
5594
5597
  const { indices } = this;
5595
5598
  const existing = indices.get(input);
5596
5599
  if (existing) return [existing];
@@ -5602,55 +5605,76 @@ function flatten(input) {
5602
5605
  if (input === 0 && 1 / input < 0) return NEGATIVE_ZERO;
5603
5606
  const index = this.index++;
5604
5607
  indices.set(input, index);
5605
- stringify.call(this, input, index);
5608
+ const stack = [[input, index]];
5609
+ await stringify.call(this, stack);
5606
5610
  return index;
5607
5611
  }
5608
- function stringify(input, index) {
5609
- const { deferred, plugins, postPlugins } = this;
5612
+ async function stringify(stack) {
5613
+ const { deferred, indices, plugins, postPlugins } = this;
5610
5614
  const str = this.stringified;
5611
- const stack = [[input, index]];
5615
+ let lastYieldTime = getNow();
5616
+ const flattenValue = (value) => {
5617
+ const existing = indices.get(value);
5618
+ if (existing) return [existing];
5619
+ if (value === void 0) return UNDEFINED;
5620
+ if (value === null) return NULL;
5621
+ if (Number.isNaN(value)) return NAN;
5622
+ if (value === Number.POSITIVE_INFINITY) return POSITIVE_INFINITY;
5623
+ if (value === Number.NEGATIVE_INFINITY) return NEGATIVE_INFINITY;
5624
+ if (value === 0 && 1 / value < 0) return NEGATIVE_ZERO;
5625
+ const index = this.index++;
5626
+ indices.set(value, index);
5627
+ stack.push([value, index]);
5628
+ return index;
5629
+ };
5630
+ let i = 0;
5612
5631
  while (stack.length > 0) {
5613
- const [input2, index2] = stack.pop();
5614
- const partsForObj = (obj) => Object.keys(obj).map((k) => `"_${flatten.call(this, k)}":${flatten.call(this, obj[k])}`).join(",");
5632
+ const now = getNow();
5633
+ if (++i % 6e3 === 0 && now - lastYieldTime >= TIME_LIMIT_MS) {
5634
+ await yieldToMain();
5635
+ lastYieldTime = getNow();
5636
+ }
5637
+ const [input, index] = stack.pop();
5638
+ const partsForObj = (obj) => Object.keys(obj).map((k) => `"_${flattenValue(k)}":${flattenValue(obj[k])}`).join(",");
5615
5639
  let error = null;
5616
- switch (typeof input2) {
5640
+ switch (typeof input) {
5617
5641
  case "boolean":
5618
5642
  case "number":
5619
5643
  case "string":
5620
- str[index2] = JSON.stringify(input2);
5644
+ str[index] = JSON.stringify(input);
5621
5645
  break;
5622
5646
  case "bigint":
5623
- str[index2] = `["${TYPE_BIGINT}","${input2}"]`;
5647
+ str[index] = `["${TYPE_BIGINT}","${input}"]`;
5624
5648
  break;
5625
5649
  case "symbol": {
5626
- const keyFor = Symbol.keyFor(input2);
5650
+ const keyFor = Symbol.keyFor(input);
5627
5651
  if (!keyFor) {
5628
5652
  error = new Error(
5629
5653
  "Cannot encode symbol unless created with Symbol.for()"
5630
5654
  );
5631
5655
  } else {
5632
- str[index2] = `["${TYPE_SYMBOL}",${JSON.stringify(keyFor)}]`;
5656
+ str[index] = `["${TYPE_SYMBOL}",${JSON.stringify(keyFor)}]`;
5633
5657
  }
5634
5658
  break;
5635
5659
  }
5636
5660
  case "object": {
5637
- if (!input2) {
5638
- str[index2] = `${NULL}`;
5661
+ if (!input) {
5662
+ str[index] = `${NULL}`;
5639
5663
  break;
5640
5664
  }
5641
- const isArray = Array.isArray(input2);
5665
+ const isArray = Array.isArray(input);
5642
5666
  let pluginHandled = false;
5643
5667
  if (!isArray && plugins) {
5644
5668
  for (const plugin of plugins) {
5645
- const pluginResult = plugin(input2);
5669
+ const pluginResult = plugin(input);
5646
5670
  if (Array.isArray(pluginResult)) {
5647
5671
  pluginHandled = true;
5648
5672
  const [pluginIdentifier, ...rest] = pluginResult;
5649
- str[index2] = `[${JSON.stringify(pluginIdentifier)}`;
5673
+ str[index] = `[${JSON.stringify(pluginIdentifier)}`;
5650
5674
  if (rest.length > 0) {
5651
- str[index2] += `,${rest.map((v) => flatten.call(this, v)).join(",")}`;
5675
+ str[index] += `,${rest.map((v) => flattenValue(v)).join(",")}`;
5652
5676
  }
5653
- str[index2] += "]";
5677
+ str[index] += "]";
5654
5678
  break;
5655
5679
  }
5656
5680
  }
@@ -5658,46 +5682,43 @@ function stringify(input, index) {
5658
5682
  if (!pluginHandled) {
5659
5683
  let result = isArray ? "[" : "{";
5660
5684
  if (isArray) {
5661
- for (let i = 0; i < input2.length; i++)
5662
- result += (i ? "," : "") + (i in input2 ? flatten.call(this, input2[i]) : HOLE);
5663
- str[index2] = `${result}]`;
5664
- } else if (input2 instanceof Date) {
5665
- const dateTime = input2.getTime();
5666
- str[index2] = `["${TYPE_DATE}",${Number.isNaN(dateTime) ? JSON.stringify("invalid") : dateTime}]`;
5667
- } else if (input2 instanceof URL) {
5668
- str[index2] = `["${TYPE_URL}",${JSON.stringify(input2.href)}]`;
5669
- } else if (input2 instanceof RegExp) {
5670
- str[index2] = `["${TYPE_REGEXP}",${JSON.stringify(
5671
- input2.source
5672
- )},${JSON.stringify(input2.flags)}]`;
5673
- } else if (input2 instanceof Set) {
5674
- if (input2.size > 0) {
5675
- str[index2] = `["${TYPE_SET}",${[...input2].map((val) => flatten.call(this, val)).join(",")}]`;
5685
+ for (let i2 = 0; i2 < input.length; i2++)
5686
+ result += (i2 ? "," : "") + (i2 in input ? flattenValue(input[i2]) : HOLE);
5687
+ str[index] = `${result}]`;
5688
+ } else if (input instanceof Date) {
5689
+ const dateTime = input.getTime();
5690
+ str[index] = `["${TYPE_DATE}",${Number.isNaN(dateTime) ? JSON.stringify("invalid") : dateTime}]`;
5691
+ } else if (input instanceof URL) {
5692
+ str[index] = `["${TYPE_URL}",${JSON.stringify(input.href)}]`;
5693
+ } else if (input instanceof RegExp) {
5694
+ str[index] = `["${TYPE_REGEXP}",${JSON.stringify(
5695
+ input.source
5696
+ )},${JSON.stringify(input.flags)}]`;
5697
+ } else if (input instanceof Set) {
5698
+ if (input.size > 0) {
5699
+ str[index] = `["${TYPE_SET}",${[...input].map((val) => flattenValue(val)).join(",")}]`;
5676
5700
  } else {
5677
- str[index2] = `["${TYPE_SET}"]`;
5701
+ str[index] = `["${TYPE_SET}"]`;
5678
5702
  }
5679
- } else if (input2 instanceof Map) {
5680
- if (input2.size > 0) {
5681
- str[index2] = `["${TYPE_MAP}",${[...input2].flatMap(([k, v]) => [
5682
- flatten.call(this, k),
5683
- flatten.call(this, v)
5684
- ]).join(",")}]`;
5703
+ } else if (input instanceof Map) {
5704
+ if (input.size > 0) {
5705
+ str[index] = `["${TYPE_MAP}",${[...input].flatMap(([k, v]) => [flattenValue(k), flattenValue(v)]).join(",")}]`;
5685
5706
  } else {
5686
- str[index2] = `["${TYPE_MAP}"]`;
5707
+ str[index] = `["${TYPE_MAP}"]`;
5687
5708
  }
5688
- } else if (input2 instanceof Promise) {
5689
- str[index2] = `["${TYPE_PROMISE}",${index2}]`;
5690
- deferred[index2] = input2;
5691
- } else if (input2 instanceof Error) {
5692
- str[index2] = `["${TYPE_ERROR}",${JSON.stringify(input2.message)}`;
5693
- if (input2.name !== "Error") {
5694
- str[index2] += `,${JSON.stringify(input2.name)}`;
5709
+ } else if (input instanceof Promise) {
5710
+ str[index] = `["${TYPE_PROMISE}",${index}]`;
5711
+ deferred[index] = input;
5712
+ } else if (input instanceof Error) {
5713
+ str[index] = `["${TYPE_ERROR}",${JSON.stringify(input.message)}`;
5714
+ if (input.name !== "Error") {
5715
+ str[index] += `,${JSON.stringify(input.name)}`;
5695
5716
  }
5696
- str[index2] += "]";
5697
- } else if (Object.getPrototypeOf(input2) === null) {
5698
- str[index2] = `["${TYPE_NULL_OBJECT}",{${partsForObj(input2)}}]`;
5699
- } else if (isPlainObject2(input2)) {
5700
- str[index2] = `{${partsForObj(input2)}}`;
5717
+ str[index] += "]";
5718
+ } else if (Object.getPrototypeOf(input) === null) {
5719
+ str[index] = `["${TYPE_NULL_OBJECT}",{${partsForObj(input)}}]`;
5720
+ } else if (isPlainObject2(input)) {
5721
+ str[index] = `{${partsForObj(input)}}`;
5701
5722
  } else {
5702
5723
  error = new Error("Cannot encode object with prototype");
5703
5724
  }
@@ -5705,19 +5726,19 @@ function stringify(input, index) {
5705
5726
  break;
5706
5727
  }
5707
5728
  default: {
5708
- const isArray = Array.isArray(input2);
5729
+ const isArray = Array.isArray(input);
5709
5730
  let pluginHandled = false;
5710
5731
  if (!isArray && plugins) {
5711
5732
  for (const plugin of plugins) {
5712
- const pluginResult = plugin(input2);
5733
+ const pluginResult = plugin(input);
5713
5734
  if (Array.isArray(pluginResult)) {
5714
5735
  pluginHandled = true;
5715
5736
  const [pluginIdentifier, ...rest] = pluginResult;
5716
- str[index2] = `[${JSON.stringify(pluginIdentifier)}`;
5737
+ str[index] = `[${JSON.stringify(pluginIdentifier)}`;
5717
5738
  if (rest.length > 0) {
5718
- str[index2] += `,${rest.map((v) => flatten.call(this, v)).join(",")}`;
5739
+ str[index] += `,${rest.map((v) => flattenValue(v)).join(",")}`;
5719
5740
  }
5720
- str[index2] += "]";
5741
+ str[index] += "]";
5721
5742
  break;
5722
5743
  }
5723
5744
  }
@@ -5731,15 +5752,15 @@ function stringify(input, index) {
5731
5752
  let pluginHandled = false;
5732
5753
  if (postPlugins) {
5733
5754
  for (const plugin of postPlugins) {
5734
- const pluginResult = plugin(input2);
5755
+ const pluginResult = plugin(input);
5735
5756
  if (Array.isArray(pluginResult)) {
5736
5757
  pluginHandled = true;
5737
5758
  const [pluginIdentifier, ...rest] = pluginResult;
5738
- str[index2] = `[${JSON.stringify(pluginIdentifier)}`;
5759
+ str[index] = `[${JSON.stringify(pluginIdentifier)}`;
5739
5760
  if (rest.length > 0) {
5740
- str[index2] += `,${rest.map((v) => flatten.call(this, v)).join(",")}`;
5761
+ str[index] += `,${rest.map((v) => flattenValue(v)).join(",")}`;
5741
5762
  }
5742
- str[index2] += "]";
5763
+ str[index] += "]";
5743
5764
  break;
5744
5765
  }
5745
5766
  }
@@ -6076,7 +6097,7 @@ async function decodeDeferred(reader) {
6076
6097
  }
6077
6098
  }
6078
6099
  function encode(input, options) {
6079
- const { plugins, postPlugins, signal, onComplete } = _nullishCoalesce(options, () => ( {}));
6100
+ const { onComplete, plugins, postPlugins, signal } = _nullishCoalesce(options, () => ( {}));
6080
6101
  const encoder = {
6081
6102
  deferred: {},
6082
6103
  index: 0,
@@ -6090,7 +6111,7 @@ function encode(input, options) {
6090
6111
  let lastSentIndex = 0;
6091
6112
  const readable = new ReadableStream({
6092
6113
  async start(controller) {
6093
- const id = flatten.call(encoder, input);
6114
+ const id = await flatten.call(encoder, input);
6094
6115
  if (Array.isArray(id)) {
6095
6116
  throw new Error("This should never happen");
6096
6117
  }
@@ -6105,6 +6126,7 @@ function encode(input, options) {
6105
6126
  lastSentIndex = encoder.stringified.length - 1;
6106
6127
  }
6107
6128
  const seenPromises = /* @__PURE__ */ new WeakSet();
6129
+ let processingChain = Promise.resolve();
6108
6130
  if (Object.keys(encoder.deferred).length) {
6109
6131
  let raceDone;
6110
6132
  const racePromise = new Promise((resolve, reject) => {
@@ -6132,65 +6154,71 @@ function encode(input, options) {
6132
6154
  deferred
6133
6155
  ]).then(
6134
6156
  (resolved) => {
6135
- const id2 = flatten.call(encoder, resolved);
6136
- if (Array.isArray(id2)) {
6137
- controller.enqueue(
6138
- textEncoder.encode(
6139
- `${TYPE_PROMISE}${deferredId}:[["${TYPE_PREVIOUS_RESOLVED}",${id2[0]}]]
6157
+ processingChain = processingChain.then(async () => {
6158
+ const id2 = await flatten.call(encoder, resolved);
6159
+ if (Array.isArray(id2)) {
6160
+ controller.enqueue(
6161
+ textEncoder.encode(
6162
+ `${TYPE_PROMISE}${deferredId}:[["${TYPE_PREVIOUS_RESOLVED}",${id2[0]}]]
6140
6163
  `
6141
- )
6142
- );
6143
- encoder.index++;
6144
- lastSentIndex++;
6145
- } else if (id2 < 0) {
6146
- controller.enqueue(
6147
- textEncoder.encode(
6148
- `${TYPE_PROMISE}${deferredId}:${id2}
6164
+ )
6165
+ );
6166
+ encoder.index++;
6167
+ lastSentIndex++;
6168
+ } else if (id2 < 0) {
6169
+ controller.enqueue(
6170
+ textEncoder.encode(
6171
+ `${TYPE_PROMISE}${deferredId}:${id2}
6149
6172
  `
6150
- )
6151
- );
6152
- } else {
6153
- const values = encoder.stringified.slice(lastSentIndex + 1).join(",");
6154
- controller.enqueue(
6155
- textEncoder.encode(
6156
- `${TYPE_PROMISE}${deferredId}:[${values}]
6173
+ )
6174
+ );
6175
+ } else {
6176
+ const values = encoder.stringified.slice(lastSentIndex + 1).join(",");
6177
+ controller.enqueue(
6178
+ textEncoder.encode(
6179
+ `${TYPE_PROMISE}${deferredId}:[${values}]
6157
6180
  `
6158
- )
6159
- );
6160
- lastSentIndex = encoder.stringified.length - 1;
6161
- }
6181
+ )
6182
+ );
6183
+ lastSentIndex = encoder.stringified.length - 1;
6184
+ }
6185
+ });
6186
+ return processingChain;
6162
6187
  },
6163
6188
  (reason) => {
6164
- if (!reason || typeof reason !== "object" || !(reason instanceof Error)) {
6165
- reason = new Error("An unknown error occurred");
6166
- }
6167
- const id2 = flatten.call(encoder, reason);
6168
- if (Array.isArray(id2)) {
6169
- controller.enqueue(
6170
- textEncoder.encode(
6171
- `${TYPE_ERROR}${deferredId}:[["${TYPE_PREVIOUS_RESOLVED}",${id2[0]}]]
6189
+ processingChain = processingChain.then(async () => {
6190
+ if (!reason || typeof reason !== "object" || !(reason instanceof Error)) {
6191
+ reason = new Error("An unknown error occurred");
6192
+ }
6193
+ const id2 = await flatten.call(encoder, reason);
6194
+ if (Array.isArray(id2)) {
6195
+ controller.enqueue(
6196
+ textEncoder.encode(
6197
+ `${TYPE_ERROR}${deferredId}:[["${TYPE_PREVIOUS_RESOLVED}",${id2[0]}]]
6172
6198
  `
6173
- )
6174
- );
6175
- encoder.index++;
6176
- lastSentIndex++;
6177
- } else if (id2 < 0) {
6178
- controller.enqueue(
6179
- textEncoder.encode(
6180
- `${TYPE_ERROR}${deferredId}:${id2}
6199
+ )
6200
+ );
6201
+ encoder.index++;
6202
+ lastSentIndex++;
6203
+ } else if (id2 < 0) {
6204
+ controller.enqueue(
6205
+ textEncoder.encode(
6206
+ `${TYPE_ERROR}${deferredId}:${id2}
6181
6207
  `
6182
- )
6183
- );
6184
- } else {
6185
- const values = encoder.stringified.slice(lastSentIndex + 1).join(",");
6186
- controller.enqueue(
6187
- textEncoder.encode(
6188
- `${TYPE_ERROR}${deferredId}:[${values}]
6208
+ )
6209
+ );
6210
+ } else {
6211
+ const values = encoder.stringified.slice(lastSentIndex + 1).join(",");
6212
+ controller.enqueue(
6213
+ textEncoder.encode(
6214
+ `${TYPE_ERROR}${deferredId}:[${values}]
6189
6215
  `
6190
- )
6191
- );
6192
- lastSentIndex = encoder.stringified.length - 1;
6193
- }
6216
+ )
6217
+ );
6218
+ lastSentIndex = encoder.stringified.length - 1;
6219
+ }
6220
+ });
6221
+ return processingChain;
6194
6222
  }
6195
6223
  ).finally(() => {
6196
6224
  delete encoder.deferred[Number(deferredId)];
@@ -6202,8 +6230,9 @@ function encode(input, options) {
6202
6230
  raceDone();
6203
6231
  }
6204
6232
  await Promise.all(Object.values(encoder.deferred));
6205
- _optionalChain([onComplete, 'optionalCall', _82 => _82()]);
6233
+ await processingChain;
6206
6234
  controller.close();
6235
+ _optionalChain([onComplete, 'optionalCall', _82 => _82()]);
6207
6236
  }
6208
6237
  });
6209
6238
  return readable;
@@ -8544,6 +8573,7 @@ function Links({ nonce, crossOrigin }) {
8544
8573
  ));
8545
8574
  }
8546
8575
  function PrefetchPageLinks({ page, ...linkProps }) {
8576
+ let rsc = useIsRSCRouterContext();
8547
8577
  let { router } = useDataRouterContext2();
8548
8578
  let matches = React7.useMemo(
8549
8579
  () => matchRoutes(router.routes, page, router.basename),
@@ -8552,6 +8582,9 @@ function PrefetchPageLinks({ page, ...linkProps }) {
8552
8582
  if (!matches) {
8553
8583
  return null;
8554
8584
  }
8585
+ if (rsc) {
8586
+ return /* @__PURE__ */ React7.createElement(RSCPrefetchPageLinksImpl, { page, matches, ...linkProps });
8587
+ }
8555
8588
  return /* @__PURE__ */ React7.createElement(PrefetchPageLinksImpl, { page, matches, ...linkProps });
8556
8589
  }
8557
8590
  function useKeyedPrefetchLinks(matches) {
@@ -8572,6 +8605,46 @@ function useKeyedPrefetchLinks(matches) {
8572
8605
  }, [matches, manifest, routeModules]);
8573
8606
  return keyedPrefetchLinks;
8574
8607
  }
8608
+ function RSCPrefetchPageLinksImpl({
8609
+ page,
8610
+ matches: nextMatches,
8611
+ ...linkProps
8612
+ }) {
8613
+ let location = useLocation();
8614
+ let { future } = useFrameworkContext();
8615
+ let { basename } = useDataRouterContext2();
8616
+ let dataHrefs = React7.useMemo(() => {
8617
+ if (page === location.pathname + location.search + location.hash) {
8618
+ return [];
8619
+ }
8620
+ let url = singleFetchUrl(
8621
+ page,
8622
+ basename,
8623
+ future.unstable_trailingSlashAwareDataRequests,
8624
+ "rsc"
8625
+ );
8626
+ let hasSomeRoutesWithShouldRevalidate = false;
8627
+ let targetRoutes = [];
8628
+ for (let match of nextMatches) {
8629
+ if (typeof match.route.shouldRevalidate === "function") {
8630
+ hasSomeRoutesWithShouldRevalidate = true;
8631
+ } else {
8632
+ targetRoutes.push(match.route.id);
8633
+ }
8634
+ }
8635
+ if (hasSomeRoutesWithShouldRevalidate && targetRoutes.length > 0) {
8636
+ url.searchParams.set("_routes", targetRoutes.join(","));
8637
+ }
8638
+ return [url.pathname + url.search];
8639
+ }, [
8640
+ basename,
8641
+ future.unstable_trailingSlashAwareDataRequests,
8642
+ page,
8643
+ location,
8644
+ nextMatches
8645
+ ]);
8646
+ return /* @__PURE__ */ React7.createElement(React7.Fragment, null, dataHrefs.map((href) => /* @__PURE__ */ React7.createElement("link", { key: href, rel: "prefetch", as: "fetch", href, ...linkProps })));
8647
+ }
8575
8648
  function PrefetchPageLinksImpl({
8576
8649
  page,
8577
8650
  matches: nextMatches,