react-server-dom-turbopack 19.1.8 → 19.1.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.
@@ -2730,10 +2730,10 @@
2730
2730
  return hook.checkDCE ? !0 : !1;
2731
2731
  })({
2732
2732
  bundleType: 1,
2733
- version: "19.1.8",
2733
+ version: "19.1.9",
2734
2734
  rendererPackageName: "react-server-dom-turbopack",
2735
2735
  currentDispatcherRef: ReactSharedInternals,
2736
- reconcilerVersion: "19.1.8",
2736
+ reconcilerVersion: "19.1.9",
2737
2737
  getCurrentComponentInfo: function () {
2738
2738
  return currentOwnerInDEV;
2739
2739
  }
@@ -918,7 +918,7 @@
918
918
  erroredTask(request, streamTask, reason),
919
919
  enqueueFlush(request),
920
920
  "function" === typeof iterator.throw &&
921
- iterator.throw(reason).then(error, error));
921
+ iterator.throw(reason).then(noop, noop));
922
922
  }
923
923
  function abortIterable(reason) {
924
924
  aborted ||
@@ -927,7 +927,7 @@
927
927
  erroredTask(request, streamTask, reason),
928
928
  enqueueFlush(request),
929
929
  "function" === typeof iterator.throw &&
930
- iterator.throw(reason).then(error, error));
930
+ iterator.throw(reason).then(noop, noop));
931
931
  }
932
932
  var isIterator = iterable === iterator,
933
933
  streamTask = createTask(
@@ -4401,44 +4401,44 @@
4401
4401
  };
4402
4402
  exports.decodeAction = function (body, serverManifest) {
4403
4403
  var formData = new FormData(),
4404
- action = null,
4405
- seenActions = new Set();
4404
+ maybeActionKey = null;
4406
4405
  body.forEach(function (value, key) {
4407
4406
  key.startsWith("$ACTION_")
4408
4407
  ? key.startsWith("$ACTION_REF_")
4409
- ? seenActions.has(key) ||
4410
- (seenActions.add(key),
4411
- (value = "$ACTION_" + key.slice(12) + ":"),
4412
- (value = decodeBoundActionMetaData(body, serverManifest, value)),
4413
- (action = loadServerReference(serverManifest, value)))
4414
- : key.startsWith("$ACTION_ID_") &&
4415
- !seenActions.has(key) &&
4416
- (seenActions.add(key),
4417
- (value = key.slice(11)),
4418
- (action = loadServerReference(serverManifest, {
4419
- id: value,
4420
- bound: null
4421
- })))
4408
+ ? (maybeActionKey = key)
4409
+ : key.startsWith("$ACTION_ID_") && (maybeActionKey = key)
4422
4410
  : formData.append(key, value);
4423
4411
  });
4424
- return null === action
4425
- ? null
4426
- : action.then(function (fn) {
4427
- return fn.bind(null, formData);
4428
- });
4412
+ if (null === maybeActionKey) return null;
4413
+ var actionKey = maybeActionKey,
4414
+ action = null;
4415
+ if (actionKey.startsWith("$ACTION_REF_"))
4416
+ (actionKey = "$ACTION_" + actionKey.slice(12) + ":"),
4417
+ (body = decodeBoundActionMetaData(body, serverManifest, actionKey)),
4418
+ (action = loadServerReference(serverManifest, body));
4419
+ else if (actionKey.startsWith("$ACTION_ID_"))
4420
+ (body = actionKey.slice(11)),
4421
+ (action = loadServerReference(serverManifest, {
4422
+ id: body,
4423
+ bound: null
4424
+ }));
4425
+ else throw Error("Cannot handle action key. This is a bug in React.");
4426
+ return action.then(function (fn) {
4427
+ return fn.bind(null, formData);
4428
+ });
4429
4429
  };
4430
4430
  exports.decodeFormState = function (actionResult, body, serverManifest) {
4431
4431
  var keyPath = body.get("$ACTION_KEY");
4432
4432
  if ("string" !== typeof keyPath) return Promise.resolve(null);
4433
- var metaData = null;
4433
+ var actionKey = null;
4434
4434
  body.forEach(function (value, key) {
4435
- key.startsWith("$ACTION_REF_") &&
4436
- ((value = "$ACTION_" + key.slice(12) + ":"),
4437
- (metaData = decodeBoundActionMetaData(body, serverManifest, value)));
4435
+ key.startsWith("$ACTION_REF_") && (actionKey = key);
4438
4436
  });
4439
- if (null === metaData) return Promise.resolve(null);
4440
- var referenceId = metaData.id;
4441
- return Promise.resolve(metaData.bound).then(function (bound) {
4437
+ if (null === actionKey) return Promise.resolve(null);
4438
+ var formFieldPrefix = "$ACTION_" + actionKey.slice(12) + ":";
4439
+ body = decodeBoundActionMetaData(body, serverManifest, formFieldPrefix);
4440
+ var referenceId = body.id;
4441
+ return Promise.resolve(body.bound).then(function (bound) {
4442
4442
  return null === bound
4443
4443
  ? null
4444
4444
  : [actionResult, keyPath, referenceId, bound.length - 1];
@@ -924,7 +924,7 @@ function serializeAsyncIterable(request, task, iterable, iterator) {
924
924
  erroredTask(request, streamTask, reason),
925
925
  enqueueFlush(request),
926
926
  "function" === typeof iterator.throw &&
927
- iterator.throw(reason).then(error, error));
927
+ iterator.throw(reason).then(noop, noop));
928
928
  }
929
929
  function abortIterable(reason) {
930
930
  aborted ||
@@ -933,7 +933,7 @@ function serializeAsyncIterable(request, task, iterable, iterator) {
933
933
  erroredTask(request, streamTask, reason),
934
934
  enqueueFlush(request),
935
935
  "function" === typeof iterator.throw &&
936
- iterator.throw(reason).then(error, error));
936
+ iterator.throw(reason).then(noop, noop));
937
937
  }
938
938
  iterable = iterable === iterator;
939
939
  var streamTask = createTask(
@@ -3128,44 +3128,41 @@ exports.createTemporaryReferenceSet = function () {
3128
3128
  };
3129
3129
  exports.decodeAction = function (body, serverManifest) {
3130
3130
  var formData = new FormData(),
3131
- action = null,
3132
- seenActions = new Set();
3131
+ maybeActionKey = null;
3133
3132
  body.forEach(function (value, key) {
3134
3133
  key.startsWith("$ACTION_")
3135
3134
  ? key.startsWith("$ACTION_REF_")
3136
- ? seenActions.has(key) ||
3137
- (seenActions.add(key),
3138
- (value = "$ACTION_" + key.slice(12) + ":"),
3139
- (value = decodeBoundActionMetaData(body, serverManifest, value)),
3140
- (action = loadServerReference(serverManifest, value)))
3141
- : key.startsWith("$ACTION_ID_") &&
3142
- !seenActions.has(key) &&
3143
- (seenActions.add(key),
3144
- (value = key.slice(11)),
3145
- (action = loadServerReference(serverManifest, {
3146
- id: value,
3147
- bound: null
3148
- })))
3135
+ ? (maybeActionKey = key)
3136
+ : key.startsWith("$ACTION_ID_") && (maybeActionKey = key)
3149
3137
  : formData.append(key, value);
3150
3138
  });
3151
- return null === action
3152
- ? null
3153
- : action.then(function (fn) {
3154
- return fn.bind(null, formData);
3155
- });
3139
+ if (null === maybeActionKey) return null;
3140
+ var actionKey = maybeActionKey,
3141
+ action = null;
3142
+ if (actionKey.startsWith("$ACTION_REF_"))
3143
+ (actionKey = "$ACTION_" + actionKey.slice(12) + ":"),
3144
+ (body = decodeBoundActionMetaData(body, serverManifest, actionKey)),
3145
+ (action = loadServerReference(serverManifest, body));
3146
+ else if (actionKey.startsWith("$ACTION_ID_"))
3147
+ (body = actionKey.slice(11)),
3148
+ (action = loadServerReference(serverManifest, { id: body, bound: null }));
3149
+ else throw Error("Cannot handle action key. This is a bug in React.");
3150
+ return action.then(function (fn) {
3151
+ return fn.bind(null, formData);
3152
+ });
3156
3153
  };
3157
3154
  exports.decodeFormState = function (actionResult, body, serverManifest) {
3158
3155
  var keyPath = body.get("$ACTION_KEY");
3159
3156
  if ("string" !== typeof keyPath) return Promise.resolve(null);
3160
- var metaData = null;
3157
+ var actionKey = null;
3161
3158
  body.forEach(function (value, key) {
3162
- key.startsWith("$ACTION_REF_") &&
3163
- ((value = "$ACTION_" + key.slice(12) + ":"),
3164
- (metaData = decodeBoundActionMetaData(body, serverManifest, value)));
3159
+ key.startsWith("$ACTION_REF_") && (actionKey = key);
3165
3160
  });
3166
- if (null === metaData) return Promise.resolve(null);
3167
- var referenceId = metaData.id;
3168
- return Promise.resolve(metaData.bound).then(function (bound) {
3161
+ if (null === actionKey) return Promise.resolve(null);
3162
+ var formFieldPrefix = "$ACTION_" + actionKey.slice(12) + ":";
3163
+ body = decodeBoundActionMetaData(body, serverManifest, formFieldPrefix);
3164
+ var referenceId = body.id;
3165
+ return Promise.resolve(body.bound).then(function (bound) {
3169
3166
  return null === bound
3170
3167
  ? null
3171
3168
  : [actionResult, keyPath, referenceId, bound.length - 1];
@@ -253,13 +253,13 @@
253
253
  temporaryReferences.set(reference, id);
254
254
  return reference;
255
255
  }
256
- function noop$1() {}
256
+ function noop$2() {}
257
257
  function trackUsedThenable(thenableState, thenable, index) {
258
258
  index = thenableState[index];
259
259
  void 0 === index
260
260
  ? thenableState.push(thenable)
261
261
  : index !== thenable &&
262
- (thenable.then(noop$1, noop$1), (thenable = index));
262
+ (thenable.then(noop$2, noop$2), (thenable = index));
263
263
  switch (thenable.status) {
264
264
  case "fulfilled":
265
265
  return thenable.value;
@@ -267,7 +267,7 @@
267
267
  throw thenable.reason;
268
268
  default:
269
269
  "string" === typeof thenable.status
270
- ? thenable.then(noop$1, noop$1)
270
+ ? thenable.then(noop$2, noop$2)
271
271
  : ((thenableState = thenable),
272
272
  (thenableState.status = "pending"),
273
273
  thenableState.then(
@@ -711,7 +711,7 @@
711
711
  type = createTask(this, model, null, !1, abortSet, null, null, null);
712
712
  pingedTasks.push(type);
713
713
  }
714
- function noop() {}
714
+ function noop$1() {}
715
715
  function createRequest(
716
716
  model,
717
717
  bundlerConfig,
@@ -733,8 +733,8 @@
733
733
  temporaryReferences,
734
734
  environmentName,
735
735
  filterStackFrame,
736
- noop,
737
- noop
736
+ noop$1,
737
+ noop$1
738
738
  );
739
739
  }
740
740
  function createPrerenderRequest(
@@ -933,7 +933,7 @@
933
933
  erroredTask(request, streamTask, reason),
934
934
  enqueueFlush(request),
935
935
  "function" === typeof iterator.throw &&
936
- iterator.throw(reason).then(error, error));
936
+ iterator.throw(reason).then(noop$1, noop$1));
937
937
  }
938
938
  function abortIterable(reason) {
939
939
  aborted ||
@@ -942,7 +942,7 @@
942
942
  erroredTask(request, streamTask, reason),
943
943
  enqueueFlush(request),
944
944
  "function" === typeof iterator.throw &&
945
- iterator.throw(reason).then(error, error));
945
+ iterator.throw(reason).then(noop$1, noop$1));
946
946
  }
947
947
  var isIterator = iterable === iterator,
948
948
  streamTask = createTask(
@@ -3963,6 +3963,7 @@
3963
3963
  if ("fulfilled" !== body.status) throw body.reason;
3964
3964
  return body.value;
3965
3965
  }
3966
+ function noop() {}
3966
3967
  var ReactDOM = require("react-dom"),
3967
3968
  React = require("react"),
3968
3969
  REACT_LEGACY_ELEMENT_TYPE = Symbol.for("react.element"),
@@ -4491,44 +4492,44 @@
4491
4492
  };
4492
4493
  exports.decodeAction = function (body, serverManifest) {
4493
4494
  var formData = new FormData(),
4494
- action = null,
4495
- seenActions = new Set();
4495
+ maybeActionKey = null;
4496
4496
  body.forEach(function (value, key) {
4497
4497
  key.startsWith("$ACTION_")
4498
4498
  ? key.startsWith("$ACTION_REF_")
4499
- ? seenActions.has(key) ||
4500
- (seenActions.add(key),
4501
- (value = "$ACTION_" + key.slice(12) + ":"),
4502
- (value = decodeBoundActionMetaData(body, serverManifest, value)),
4503
- (action = loadServerReference(serverManifest, value)))
4504
- : key.startsWith("$ACTION_ID_") &&
4505
- !seenActions.has(key) &&
4506
- (seenActions.add(key),
4507
- (value = key.slice(11)),
4508
- (action = loadServerReference(serverManifest, {
4509
- id: value,
4510
- bound: null
4511
- })))
4499
+ ? (maybeActionKey = key)
4500
+ : key.startsWith("$ACTION_ID_") && (maybeActionKey = key)
4512
4501
  : formData.append(key, value);
4513
4502
  });
4514
- return null === action
4515
- ? null
4516
- : action.then(function (fn) {
4517
- return fn.bind(null, formData);
4518
- });
4503
+ if (null === maybeActionKey) return null;
4504
+ var actionKey = maybeActionKey,
4505
+ action = null;
4506
+ if (actionKey.startsWith("$ACTION_REF_"))
4507
+ (actionKey = "$ACTION_" + actionKey.slice(12) + ":"),
4508
+ (body = decodeBoundActionMetaData(body, serverManifest, actionKey)),
4509
+ (action = loadServerReference(serverManifest, body));
4510
+ else if (actionKey.startsWith("$ACTION_ID_"))
4511
+ (body = actionKey.slice(11)),
4512
+ (action = loadServerReference(serverManifest, {
4513
+ id: body,
4514
+ bound: null
4515
+ }));
4516
+ else throw Error("Cannot handle action key. This is a bug in React.");
4517
+ return action.then(function (fn) {
4518
+ return fn.bind(null, formData);
4519
+ });
4519
4520
  };
4520
4521
  exports.decodeFormState = function (actionResult, body, serverManifest) {
4521
4522
  var keyPath = body.get("$ACTION_KEY");
4522
4523
  if ("string" !== typeof keyPath) return Promise.resolve(null);
4523
- var metaData = null;
4524
+ var actionKey = null;
4524
4525
  body.forEach(function (value, key) {
4525
- key.startsWith("$ACTION_REF_") &&
4526
- ((value = "$ACTION_" + key.slice(12) + ":"),
4527
- (metaData = decodeBoundActionMetaData(body, serverManifest, value)));
4526
+ key.startsWith("$ACTION_REF_") && (actionKey = key);
4528
4527
  });
4529
- if (null === metaData) return Promise.resolve(null);
4530
- var referenceId = metaData.id;
4531
- return Promise.resolve(metaData.bound).then(function (bound) {
4528
+ if (null === actionKey) return Promise.resolve(null);
4529
+ var formFieldPrefix = "$ACTION_" + actionKey.slice(12) + ":";
4530
+ body = decodeBoundActionMetaData(body, serverManifest, formFieldPrefix);
4531
+ var referenceId = body.id;
4532
+ return Promise.resolve(body.bound).then(function (bound) {
4532
4533
  return null === bound
4533
4534
  ? null
4534
4535
  : [actionResult, keyPath, referenceId, bound.length - 1];
@@ -4579,7 +4580,7 @@
4579
4580
  function error(reason) {
4580
4581
  reportGlobalError(response$jscomp$0, reason);
4581
4582
  "function" === typeof iterator.throw &&
4582
- iterator.throw(reason).then(error, error);
4583
+ iterator.throw(reason).then(noop, noop);
4583
4584
  }
4584
4585
  var iterator = iterable[ASYNC_ITERATOR](),
4585
4586
  response$jscomp$0 = createResponse(
@@ -451,12 +451,12 @@ function createTemporaryReference(temporaryReferences, id) {
451
451
  var SuspenseException = Error(
452
452
  "Suspense Exception: This is not a real error! It's an implementation detail of `use` to interrupt the current render. You must either rethrow it immediately, or move the `use` call outside of the `try/catch` block. Capturing without rethrowing will lead to unexpected behavior.\n\nTo handle async errors, wrap your component in an error boundary, or call the promise's `.catch` method and pass the result to `use`."
453
453
  );
454
- function noop$1() {}
454
+ function noop$2() {}
455
455
  function trackUsedThenable(thenableState, thenable, index) {
456
456
  index = thenableState[index];
457
457
  void 0 === index
458
458
  ? thenableState.push(thenable)
459
- : index !== thenable && (thenable.then(noop$1, noop$1), (thenable = index));
459
+ : index !== thenable && (thenable.then(noop$2, noop$2), (thenable = index));
460
460
  switch (thenable.status) {
461
461
  case "fulfilled":
462
462
  return thenable.value;
@@ -464,7 +464,7 @@ function trackUsedThenable(thenableState, thenable, index) {
464
464
  throw thenable.reason;
465
465
  default:
466
466
  "string" === typeof thenable.status
467
- ? thenable.then(noop$1, noop$1)
467
+ ? thenable.then(noop$2, noop$2)
468
468
  : ((thenableState = thenable),
469
469
  (thenableState.status = "pending"),
470
470
  thenableState.then(
@@ -769,7 +769,7 @@ function RequestInstance(
769
769
  type = createTask(this, model, null, !1, filterStackFrame);
770
770
  environmentName.push(type);
771
771
  }
772
- function noop() {}
772
+ function noop$1() {}
773
773
  var currentRequest = null;
774
774
  function resolveRequest() {
775
775
  if (currentRequest) return currentRequest;
@@ -929,7 +929,7 @@ function serializeAsyncIterable(request, task, iterable, iterator) {
929
929
  erroredTask(request, streamTask, reason),
930
930
  enqueueFlush(request),
931
931
  "function" === typeof iterator.throw &&
932
- iterator.throw(reason).then(error, error));
932
+ iterator.throw(reason).then(noop$1, noop$1));
933
933
  }
934
934
  function abortIterable(reason) {
935
935
  aborted ||
@@ -938,7 +938,7 @@ function serializeAsyncIterable(request, task, iterable, iterator) {
938
938
  erroredTask(request, streamTask, reason),
939
939
  enqueueFlush(request),
940
940
  "function" === typeof iterator.throw &&
941
- iterator.throw(reason).then(error, error));
941
+ iterator.throw(reason).then(noop$1, noop$1));
942
942
  }
943
943
  iterable = iterable === iterator;
944
944
  var streamTask = createTask(
@@ -3138,6 +3138,7 @@ function decodeBoundActionMetaData(
3138
3138
  if ("fulfilled" !== body.status) throw body.reason;
3139
3139
  return body.value;
3140
3140
  }
3141
+ function noop() {}
3141
3142
  exports.createClientModuleProxy = function (moduleId) {
3142
3143
  moduleId = registerClientReferenceImpl({}, moduleId, !1);
3143
3144
  return new Proxy(moduleId, proxyHandlers$1);
@@ -3147,44 +3148,41 @@ exports.createTemporaryReferenceSet = function () {
3147
3148
  };
3148
3149
  exports.decodeAction = function (body, serverManifest) {
3149
3150
  var formData = new FormData(),
3150
- action = null,
3151
- seenActions = new Set();
3151
+ maybeActionKey = null;
3152
3152
  body.forEach(function (value, key) {
3153
3153
  key.startsWith("$ACTION_")
3154
3154
  ? key.startsWith("$ACTION_REF_")
3155
- ? seenActions.has(key) ||
3156
- (seenActions.add(key),
3157
- (value = "$ACTION_" + key.slice(12) + ":"),
3158
- (value = decodeBoundActionMetaData(body, serverManifest, value)),
3159
- (action = loadServerReference(serverManifest, value)))
3160
- : key.startsWith("$ACTION_ID_") &&
3161
- !seenActions.has(key) &&
3162
- (seenActions.add(key),
3163
- (value = key.slice(11)),
3164
- (action = loadServerReference(serverManifest, {
3165
- id: value,
3166
- bound: null
3167
- })))
3155
+ ? (maybeActionKey = key)
3156
+ : key.startsWith("$ACTION_ID_") && (maybeActionKey = key)
3168
3157
  : formData.append(key, value);
3169
3158
  });
3170
- return null === action
3171
- ? null
3172
- : action.then(function (fn) {
3173
- return fn.bind(null, formData);
3174
- });
3159
+ if (null === maybeActionKey) return null;
3160
+ var actionKey = maybeActionKey,
3161
+ action = null;
3162
+ if (actionKey.startsWith("$ACTION_REF_"))
3163
+ (actionKey = "$ACTION_" + actionKey.slice(12) + ":"),
3164
+ (body = decodeBoundActionMetaData(body, serverManifest, actionKey)),
3165
+ (action = loadServerReference(serverManifest, body));
3166
+ else if (actionKey.startsWith("$ACTION_ID_"))
3167
+ (body = actionKey.slice(11)),
3168
+ (action = loadServerReference(serverManifest, { id: body, bound: null }));
3169
+ else throw Error("Cannot handle action key. This is a bug in React.");
3170
+ return action.then(function (fn) {
3171
+ return fn.bind(null, formData);
3172
+ });
3175
3173
  };
3176
3174
  exports.decodeFormState = function (actionResult, body, serverManifest) {
3177
3175
  var keyPath = body.get("$ACTION_KEY");
3178
3176
  if ("string" !== typeof keyPath) return Promise.resolve(null);
3179
- var metaData = null;
3177
+ var actionKey = null;
3180
3178
  body.forEach(function (value, key) {
3181
- key.startsWith("$ACTION_REF_") &&
3182
- ((value = "$ACTION_" + key.slice(12) + ":"),
3183
- (metaData = decodeBoundActionMetaData(body, serverManifest, value)));
3179
+ key.startsWith("$ACTION_REF_") && (actionKey = key);
3184
3180
  });
3185
- if (null === metaData) return Promise.resolve(null);
3186
- var referenceId = metaData.id;
3187
- return Promise.resolve(metaData.bound).then(function (bound) {
3181
+ if (null === actionKey) return Promise.resolve(null);
3182
+ var formFieldPrefix = "$ACTION_" + actionKey.slice(12) + ":";
3183
+ body = decodeBoundActionMetaData(body, serverManifest, formFieldPrefix);
3184
+ var referenceId = body.id;
3185
+ return Promise.resolve(body.bound).then(function (bound) {
3188
3186
  return null === bound
3189
3187
  ? null
3190
3188
  : [actionResult, keyPath, referenceId, bound.length - 1];
@@ -3234,7 +3232,7 @@ exports.decodeReplyFromAsyncIterable = function (
3234
3232
  function error(reason) {
3235
3233
  reportGlobalError(response, reason);
3236
3234
  "function" === typeof iterator.throw &&
3237
- iterator.throw(reason).then(error, error);
3235
+ iterator.throw(reason).then(noop, noop);
3238
3236
  }
3239
3237
  var iterator = iterable[ASYNC_ITERATOR](),
3240
3238
  response = createResponse(
@@ -3281,8 +3279,8 @@ exports.renderToReadableStream = function (model, turbopackMap, options) {
3281
3279
  options ? options.temporaryReferences : void 0,
3282
3280
  void 0,
3283
3281
  void 0,
3284
- noop,
3285
- noop
3282
+ noop$1,
3283
+ noop$1
3286
3284
  );
3287
3285
  if (options && options.signal) {
3288
3286
  var signal = options.signal;
@@ -954,7 +954,7 @@
954
954
  erroredTask(request, streamTask, reason),
955
955
  enqueueFlush(request),
956
956
  "function" === typeof iterator.throw &&
957
- iterator.throw(reason).then(error, error));
957
+ iterator.throw(reason).then(noop, noop));
958
958
  }
959
959
  function abortIterable(reason) {
960
960
  aborted ||
@@ -963,7 +963,7 @@
963
963
  erroredTask(request, streamTask, reason),
964
964
  enqueueFlush(request),
965
965
  "function" === typeof iterator.throw &&
966
- iterator.throw(reason).then(error, error));
966
+ iterator.throw(reason).then(noop, noop));
967
967
  }
968
968
  var isIterator = iterable === iterator,
969
969
  streamTask = createTask(
@@ -4487,44 +4487,44 @@
4487
4487
  };
4488
4488
  exports.decodeAction = function (body, serverManifest) {
4489
4489
  var formData = new FormData(),
4490
- action = null,
4491
- seenActions = new Set();
4490
+ maybeActionKey = null;
4492
4491
  body.forEach(function (value, key) {
4493
4492
  key.startsWith("$ACTION_")
4494
4493
  ? key.startsWith("$ACTION_REF_")
4495
- ? seenActions.has(key) ||
4496
- (seenActions.add(key),
4497
- (value = "$ACTION_" + key.slice(12) + ":"),
4498
- (value = decodeBoundActionMetaData(body, serverManifest, value)),
4499
- (action = loadServerReference(serverManifest, value)))
4500
- : key.startsWith("$ACTION_ID_") &&
4501
- !seenActions.has(key) &&
4502
- (seenActions.add(key),
4503
- (value = key.slice(11)),
4504
- (action = loadServerReference(serverManifest, {
4505
- id: value,
4506
- bound: null
4507
- })))
4494
+ ? (maybeActionKey = key)
4495
+ : key.startsWith("$ACTION_ID_") && (maybeActionKey = key)
4508
4496
  : formData.append(key, value);
4509
4497
  });
4510
- return null === action
4511
- ? null
4512
- : action.then(function (fn) {
4513
- return fn.bind(null, formData);
4514
- });
4498
+ if (null === maybeActionKey) return null;
4499
+ var actionKey = maybeActionKey,
4500
+ action = null;
4501
+ if (actionKey.startsWith("$ACTION_REF_"))
4502
+ (actionKey = "$ACTION_" + actionKey.slice(12) + ":"),
4503
+ (body = decodeBoundActionMetaData(body, serverManifest, actionKey)),
4504
+ (action = loadServerReference(serverManifest, body));
4505
+ else if (actionKey.startsWith("$ACTION_ID_"))
4506
+ (body = actionKey.slice(11)),
4507
+ (action = loadServerReference(serverManifest, {
4508
+ id: body,
4509
+ bound: null
4510
+ }));
4511
+ else throw Error("Cannot handle action key. This is a bug in React.");
4512
+ return action.then(function (fn) {
4513
+ return fn.bind(null, formData);
4514
+ });
4515
4515
  };
4516
4516
  exports.decodeFormState = function (actionResult, body, serverManifest) {
4517
4517
  var keyPath = body.get("$ACTION_KEY");
4518
4518
  if ("string" !== typeof keyPath) return Promise.resolve(null);
4519
- var metaData = null;
4519
+ var actionKey = null;
4520
4520
  body.forEach(function (value, key) {
4521
- key.startsWith("$ACTION_REF_") &&
4522
- ((value = "$ACTION_" + key.slice(12) + ":"),
4523
- (metaData = decodeBoundActionMetaData(body, serverManifest, value)));
4521
+ key.startsWith("$ACTION_REF_") && (actionKey = key);
4524
4522
  });
4525
- if (null === metaData) return Promise.resolve(null);
4526
- var referenceId = metaData.id;
4527
- return Promise.resolve(metaData.bound).then(function (bound) {
4523
+ if (null === actionKey) return Promise.resolve(null);
4524
+ var formFieldPrefix = "$ACTION_" + actionKey.slice(12) + ":";
4525
+ body = decodeBoundActionMetaData(body, serverManifest, formFieldPrefix);
4526
+ var referenceId = body.id;
4527
+ return Promise.resolve(body.bound).then(function (bound) {
4528
4528
  return null === bound
4529
4529
  ? null
4530
4530
  : [actionResult, keyPath, referenceId, bound.length - 1];
@@ -946,7 +946,7 @@ function serializeAsyncIterable(request, task, iterable, iterator) {
946
946
  erroredTask(request, streamTask, reason),
947
947
  enqueueFlush(request),
948
948
  "function" === typeof iterator.throw &&
949
- iterator.throw(reason).then(error, error));
949
+ iterator.throw(reason).then(noop, noop));
950
950
  }
951
951
  function abortIterable(reason) {
952
952
  aborted ||
@@ -955,7 +955,7 @@ function serializeAsyncIterable(request, task, iterable, iterator) {
955
955
  erroredTask(request, streamTask, reason),
956
956
  enqueueFlush(request),
957
957
  "function" === typeof iterator.throw &&
958
- iterator.throw(reason).then(error, error));
958
+ iterator.throw(reason).then(noop, noop));
959
959
  }
960
960
  iterable = iterable === iterator;
961
961
  var streamTask = createTask(
@@ -3203,44 +3203,41 @@ exports.createTemporaryReferenceSet = function () {
3203
3203
  };
3204
3204
  exports.decodeAction = function (body, serverManifest) {
3205
3205
  var formData = new FormData(),
3206
- action = null,
3207
- seenActions = new Set();
3206
+ maybeActionKey = null;
3208
3207
  body.forEach(function (value, key) {
3209
3208
  key.startsWith("$ACTION_")
3210
3209
  ? key.startsWith("$ACTION_REF_")
3211
- ? seenActions.has(key) ||
3212
- (seenActions.add(key),
3213
- (value = "$ACTION_" + key.slice(12) + ":"),
3214
- (value = decodeBoundActionMetaData(body, serverManifest, value)),
3215
- (action = loadServerReference(serverManifest, value)))
3216
- : key.startsWith("$ACTION_ID_") &&
3217
- !seenActions.has(key) &&
3218
- (seenActions.add(key),
3219
- (value = key.slice(11)),
3220
- (action = loadServerReference(serverManifest, {
3221
- id: value,
3222
- bound: null
3223
- })))
3210
+ ? (maybeActionKey = key)
3211
+ : key.startsWith("$ACTION_ID_") && (maybeActionKey = key)
3224
3212
  : formData.append(key, value);
3225
3213
  });
3226
- return null === action
3227
- ? null
3228
- : action.then(function (fn) {
3229
- return fn.bind(null, formData);
3230
- });
3214
+ if (null === maybeActionKey) return null;
3215
+ var actionKey = maybeActionKey,
3216
+ action = null;
3217
+ if (actionKey.startsWith("$ACTION_REF_"))
3218
+ (actionKey = "$ACTION_" + actionKey.slice(12) + ":"),
3219
+ (body = decodeBoundActionMetaData(body, serverManifest, actionKey)),
3220
+ (action = loadServerReference(serverManifest, body));
3221
+ else if (actionKey.startsWith("$ACTION_ID_"))
3222
+ (body = actionKey.slice(11)),
3223
+ (action = loadServerReference(serverManifest, { id: body, bound: null }));
3224
+ else throw Error("Cannot handle action key. This is a bug in React.");
3225
+ return action.then(function (fn) {
3226
+ return fn.bind(null, formData);
3227
+ });
3231
3228
  };
3232
3229
  exports.decodeFormState = function (actionResult, body, serverManifest) {
3233
3230
  var keyPath = body.get("$ACTION_KEY");
3234
3231
  if ("string" !== typeof keyPath) return Promise.resolve(null);
3235
- var metaData = null;
3232
+ var actionKey = null;
3236
3233
  body.forEach(function (value, key) {
3237
- key.startsWith("$ACTION_REF_") &&
3238
- ((value = "$ACTION_" + key.slice(12) + ":"),
3239
- (metaData = decodeBoundActionMetaData(body, serverManifest, value)));
3234
+ key.startsWith("$ACTION_REF_") && (actionKey = key);
3240
3235
  });
3241
- if (null === metaData) return Promise.resolve(null);
3242
- var referenceId = metaData.id;
3243
- return Promise.resolve(metaData.bound).then(function (bound) {
3236
+ if (null === actionKey) return Promise.resolve(null);
3237
+ var formFieldPrefix = "$ACTION_" + actionKey.slice(12) + ":";
3238
+ body = decodeBoundActionMetaData(body, serverManifest, formFieldPrefix);
3239
+ var referenceId = body.id;
3240
+ return Promise.resolve(body.bound).then(function (bound) {
3244
3241
  return null === bound
3245
3242
  ? null
3246
3243
  : [actionResult, keyPath, referenceId, bound.length - 1];
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "react-server-dom-turbopack",
3
3
  "description": "React Server Components bindings for DOM using Turbopack. This is intended to be integrated into meta-frameworks. It is not intended to be imported directly.",
4
- "version": "19.1.8",
4
+ "version": "19.1.9",
5
5
  "keywords": [
6
6
  "react"
7
7
  ],
8
8
  "homepage": "https://react.dev/",
9
- "bugs": "https://github.com/facebook/react/issues",
9
+ "bugs": "https://github.com/react/react/issues",
10
10
  "license": "MIT",
11
11
  "files": [
12
12
  "LICENSE",
@@ -71,15 +71,15 @@
71
71
  "main": "index.js",
72
72
  "repository": {
73
73
  "type": "git",
74
- "url": "https://github.com/facebook/react.git",
74
+ "url": "https://github.com/react/react.git",
75
75
  "directory": "packages/react-server-dom-turbopack"
76
76
  },
77
77
  "engines": {
78
78
  "node": ">=0.10.0"
79
79
  },
80
80
  "peerDependencies": {
81
- "react": "^19.1.8",
82
- "react-dom": "^19.1.8"
81
+ "react": "^19.1.9",
82
+ "react-dom": "^19.1.9"
83
83
  },
84
84
  "dependencies": {
85
85
  "acorn-loose": "^8.3.0",