react-markup 0.0.0-experimental-d331ba04-20250307 → 0.0.0-experimental-6aa8254b-20250312

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.
@@ -8919,5 +8919,5 @@
8919
8919
  });
8920
8920
  });
8921
8921
  };
8922
- exports.version = "19.1.0-experimental-d331ba04-20250307";
8922
+ exports.version = "19.1.0-experimental-6aa8254b-20250312";
8923
8923
  })();
@@ -5988,4 +5988,4 @@ exports.experimental_renderToHTML = function (children, options) {
5988
5988
  });
5989
5989
  });
5990
5990
  };
5991
- exports.version = "19.1.0-experimental-d331ba04-20250307";
5991
+ exports.version = "19.1.0-experimental-6aa8254b-20250312";
@@ -3129,7 +3129,10 @@
3129
3129
  parentReference = knownServerReferences.get(value);
3130
3130
  if (void 0 !== parentReference)
3131
3131
  return (
3132
- (key = JSON.stringify(parentReference, resolveToJSON)),
3132
+ (key = JSON.stringify(
3133
+ { id: parentReference.id, bound: parentReference.bound },
3134
+ resolveToJSON
3135
+ )),
3133
3136
  null === formData && (formData = new FormData()),
3134
3137
  (parentReference = nextPartId++),
3135
3138
  formData.set(formFieldPrefix + parentReference, key),
@@ -3225,41 +3228,45 @@
3225
3228
  return thenable;
3226
3229
  }
3227
3230
  function defaultEncodeFormAction(identifierPrefix) {
3228
- var reference = knownServerReferences.get(this);
3229
- if (!reference)
3231
+ var referenceClosure = knownServerReferences.get(this);
3232
+ if (!referenceClosure)
3230
3233
  throw Error(
3231
3234
  "Tried to encode a Server Action from a different instance than the encoder is from. This is a bug in React."
3232
3235
  );
3233
3236
  var data = null;
3234
- if (null !== reference.bound) {
3235
- data = boundCache.get(reference);
3237
+ if (null !== referenceClosure.bound) {
3238
+ data = boundCache.get(referenceClosure);
3236
3239
  data ||
3237
- ((data = encodeFormData(reference)), boundCache.set(reference, data));
3240
+ ((data = encodeFormData({
3241
+ id: referenceClosure.id,
3242
+ bound: referenceClosure.bound
3243
+ })),
3244
+ boundCache.set(referenceClosure, data));
3238
3245
  if ("rejected" === data.status) throw data.reason;
3239
3246
  if ("fulfilled" !== data.status) throw data;
3240
- reference = data.value;
3247
+ referenceClosure = data.value;
3241
3248
  var prefixedData = new FormData();
3242
- reference.forEach(function (value, key) {
3249
+ referenceClosure.forEach(function (value, key) {
3243
3250
  prefixedData.append("$ACTION_" + identifierPrefix + ":" + key, value);
3244
3251
  });
3245
3252
  data = prefixedData;
3246
- reference = "$ACTION_REF_" + identifierPrefix;
3247
- } else reference = "$ACTION_ID_" + reference.id;
3253
+ referenceClosure = "$ACTION_REF_" + identifierPrefix;
3254
+ } else referenceClosure = "$ACTION_ID_" + referenceClosure.id;
3248
3255
  return {
3249
- name: reference,
3256
+ name: referenceClosure,
3250
3257
  method: "POST",
3251
3258
  encType: "multipart/form-data",
3252
3259
  data: data
3253
3260
  };
3254
3261
  }
3255
3262
  function isSignatureEqual(referenceId, numberOfBoundArgs) {
3256
- var reference = knownServerReferences.get(this);
3257
- if (!reference)
3263
+ var referenceClosure = knownServerReferences.get(this);
3264
+ if (!referenceClosure)
3258
3265
  throw Error(
3259
3266
  "Tried to encode a Server Action from a different instance than the encoder is from. This is a bug in React."
3260
3267
  );
3261
- if (reference.id !== referenceId) return !1;
3262
- var boundPromise = reference.bound;
3268
+ if (referenceClosure.id !== referenceId) return !1;
3269
+ var boundPromise = referenceClosure.bound;
3263
3270
  if (null === boundPromise) return 0 === numberOfBoundArgs;
3264
3271
  switch (boundPromise.status) {
3265
3272
  case "fulfilled":
@@ -3330,58 +3337,64 @@
3330
3337
  }
3331
3338
  }
3332
3339
  function registerBoundServerReference(
3333
- reference$jscomp$0,
3340
+ reference,
3334
3341
  id,
3335
3342
  bound,
3336
3343
  encodeFormAction
3337
3344
  ) {
3338
- Object.defineProperties(reference$jscomp$0, {
3339
- $$FORM_ACTION: {
3340
- value:
3341
- void 0 === encodeFormAction
3342
- ? defaultEncodeFormAction
3343
- : function () {
3344
- var reference = knownServerReferences.get(this);
3345
- if (!reference)
3346
- throw Error(
3347
- "Tried to encode a Server Action from a different instance than the encoder is from. This is a bug in React."
3348
- );
3349
- var boundPromise = reference.bound;
3350
- null === boundPromise && (boundPromise = Promise.resolve([]));
3351
- return encodeFormAction(reference.id, boundPromise);
3352
- }
3353
- },
3345
+ knownServerReferences.has(reference) ||
3346
+ (knownServerReferences.set(reference, {
3347
+ id: id,
3348
+ originalBind: reference.bind,
3349
+ bound: bound
3350
+ }),
3351
+ Object.defineProperties(reference, {
3352
+ $$FORM_ACTION: {
3353
+ value:
3354
+ void 0 === encodeFormAction
3355
+ ? defaultEncodeFormAction
3356
+ : function () {
3357
+ var referenceClosure = knownServerReferences.get(this);
3358
+ if (!referenceClosure)
3359
+ throw Error(
3360
+ "Tried to encode a Server Action from a different instance than the encoder is from. This is a bug in React."
3361
+ );
3362
+ var boundPromise = referenceClosure.bound;
3363
+ null === boundPromise &&
3364
+ (boundPromise = Promise.resolve([]));
3365
+ return encodeFormAction(referenceClosure.id, boundPromise);
3366
+ }
3367
+ },
3368
+ $$IS_SIGNATURE_EQUAL: { value: isSignatureEqual },
3369
+ bind: { value: bind }
3370
+ }));
3371
+ }
3372
+ function bind() {
3373
+ var referenceClosure = knownServerReferences.get(this);
3374
+ if (!referenceClosure) return FunctionBind.apply(this, arguments);
3375
+ var newFn = referenceClosure.originalBind.apply(this, arguments);
3376
+ null != arguments[0] &&
3377
+ console.error(
3378
+ 'Cannot bind "this" of a Server Action. Pass null or undefined as the first argument to .bind().'
3379
+ );
3380
+ var args = ArraySlice.call(arguments, 1),
3381
+ boundPromise = null;
3382
+ boundPromise =
3383
+ null !== referenceClosure.bound
3384
+ ? Promise.resolve(referenceClosure.bound).then(function (boundArgs) {
3385
+ return boundArgs.concat(args);
3386
+ })
3387
+ : Promise.resolve(args);
3388
+ knownServerReferences.set(newFn, {
3389
+ id: referenceClosure.id,
3390
+ originalBind: newFn.bind,
3391
+ bound: boundPromise
3392
+ });
3393
+ Object.defineProperties(newFn, {
3394
+ $$FORM_ACTION: { value: this.$$FORM_ACTION },
3354
3395
  $$IS_SIGNATURE_EQUAL: { value: isSignatureEqual },
3355
3396
  bind: { value: bind }
3356
3397
  });
3357
- knownServerReferences.set(reference$jscomp$0, { id: id, bound: bound });
3358
- }
3359
- function bind() {
3360
- var newFn = FunctionBind.apply(this, arguments),
3361
- reference = knownServerReferences.get(this);
3362
- if (reference) {
3363
- null != arguments[0] &&
3364
- console.error(
3365
- 'Cannot bind "this" of a Server Action. Pass null or undefined as the first argument to .bind().'
3366
- );
3367
- var args = ArraySlice.call(arguments, 1),
3368
- boundPromise = null;
3369
- boundPromise =
3370
- null !== reference.bound
3371
- ? Promise.resolve(reference.bound).then(function (boundArgs) {
3372
- return boundArgs.concat(args);
3373
- })
3374
- : Promise.resolve(args);
3375
- Object.defineProperties(newFn, {
3376
- $$FORM_ACTION: { value: this.$$FORM_ACTION },
3377
- $$IS_SIGNATURE_EQUAL: { value: isSignatureEqual },
3378
- bind: { value: bind }
3379
- });
3380
- knownServerReferences.set(newFn, {
3381
- id: reference.id,
3382
- bound: boundPromise
3383
- });
3384
- }
3385
3398
  return newFn;
3386
3399
  }
3387
3400
  function createBoundServerReference(
@@ -13643,5 +13656,5 @@
13643
13656
  });
13644
13657
  });
13645
13658
  };
13646
- exports.version = "19.1.0-experimental-d331ba04-20250307";
13659
+ exports.version = "19.1.0-experimental-6aa8254b-20250312";
13647
13660
  })();
@@ -2057,7 +2057,10 @@ function processReply(
2057
2057
  parentReference = knownServerReferences.get(value);
2058
2058
  if (void 0 !== parentReference)
2059
2059
  return (
2060
- (key = JSON.stringify(parentReference, resolveToJSON)),
2060
+ (key = JSON.stringify(
2061
+ { id: parentReference.id, bound: parentReference.bound },
2062
+ resolveToJSON
2063
+ )),
2061
2064
  null === formData && (formData = new FormData()),
2062
2065
  (parentReference = nextPartId++),
2063
2066
  formData.set(formFieldPrefix + parentReference, key),
@@ -2153,41 +2156,45 @@ function encodeFormData(reference) {
2153
2156
  return thenable;
2154
2157
  }
2155
2158
  function defaultEncodeFormAction(identifierPrefix) {
2156
- var reference = knownServerReferences.get(this);
2157
- if (!reference)
2159
+ var referenceClosure = knownServerReferences.get(this);
2160
+ if (!referenceClosure)
2158
2161
  throw Error(
2159
2162
  "Tried to encode a Server Action from a different instance than the encoder is from. This is a bug in React."
2160
2163
  );
2161
2164
  var data = null;
2162
- if (null !== reference.bound) {
2163
- data = boundCache.get(reference);
2165
+ if (null !== referenceClosure.bound) {
2166
+ data = boundCache.get(referenceClosure);
2164
2167
  data ||
2165
- ((data = encodeFormData(reference)), boundCache.set(reference, data));
2168
+ ((data = encodeFormData({
2169
+ id: referenceClosure.id,
2170
+ bound: referenceClosure.bound
2171
+ })),
2172
+ boundCache.set(referenceClosure, data));
2166
2173
  if ("rejected" === data.status) throw data.reason;
2167
2174
  if ("fulfilled" !== data.status) throw data;
2168
- reference = data.value;
2175
+ referenceClosure = data.value;
2169
2176
  var prefixedData = new FormData();
2170
- reference.forEach(function (value, key) {
2177
+ referenceClosure.forEach(function (value, key) {
2171
2178
  prefixedData.append("$ACTION_" + identifierPrefix + ":" + key, value);
2172
2179
  });
2173
2180
  data = prefixedData;
2174
- reference = "$ACTION_REF_" + identifierPrefix;
2175
- } else reference = "$ACTION_ID_" + reference.id;
2181
+ referenceClosure = "$ACTION_REF_" + identifierPrefix;
2182
+ } else referenceClosure = "$ACTION_ID_" + referenceClosure.id;
2176
2183
  return {
2177
- name: reference,
2184
+ name: referenceClosure,
2178
2185
  method: "POST",
2179
2186
  encType: "multipart/form-data",
2180
2187
  data: data
2181
2188
  };
2182
2189
  }
2183
2190
  function isSignatureEqual(referenceId, numberOfBoundArgs) {
2184
- var reference = knownServerReferences.get(this);
2185
- if (!reference)
2191
+ var referenceClosure = knownServerReferences.get(this);
2192
+ if (!referenceClosure)
2186
2193
  throw Error(
2187
2194
  "Tried to encode a Server Action from a different instance than the encoder is from. This is a bug in React."
2188
2195
  );
2189
- if (reference.id !== referenceId) return !1;
2190
- var boundPromise = reference.bound;
2196
+ if (referenceClosure.id !== referenceId) return !1;
2197
+ var boundPromise = referenceClosure.bound;
2191
2198
  if (null === boundPromise) return 0 === numberOfBoundArgs;
2192
2199
  switch (boundPromise.status) {
2193
2200
  case "fulfilled":
@@ -2214,54 +2221,57 @@ function isSignatureEqual(referenceId, numberOfBoundArgs) {
2214
2221
  );
2215
2222
  }
2216
2223
  }
2217
- function registerBoundServerReference(
2218
- reference$jscomp$0,
2219
- id,
2220
- bound,
2221
- encodeFormAction
2222
- ) {
2223
- Object.defineProperties(reference$jscomp$0, {
2224
- $$FORM_ACTION: {
2225
- value:
2226
- void 0 === encodeFormAction
2227
- ? defaultEncodeFormAction
2228
- : function () {
2229
- var reference = knownServerReferences.get(this);
2230
- if (!reference)
2231
- throw Error(
2232
- "Tried to encode a Server Action from a different instance than the encoder is from. This is a bug in React."
2233
- );
2234
- var boundPromise = reference.bound;
2235
- null === boundPromise && (boundPromise = Promise.resolve([]));
2236
- return encodeFormAction(reference.id, boundPromise);
2237
- }
2238
- },
2239
- $$IS_SIGNATURE_EQUAL: { value: isSignatureEqual },
2240
- bind: { value: bind }
2241
- });
2242
- knownServerReferences.set(reference$jscomp$0, { id: id, bound: bound });
2224
+ function registerBoundServerReference(reference, id, bound, encodeFormAction) {
2225
+ knownServerReferences.has(reference) ||
2226
+ (knownServerReferences.set(reference, {
2227
+ id: id,
2228
+ originalBind: reference.bind,
2229
+ bound: bound
2230
+ }),
2231
+ Object.defineProperties(reference, {
2232
+ $$FORM_ACTION: {
2233
+ value:
2234
+ void 0 === encodeFormAction
2235
+ ? defaultEncodeFormAction
2236
+ : function () {
2237
+ var referenceClosure = knownServerReferences.get(this);
2238
+ if (!referenceClosure)
2239
+ throw Error(
2240
+ "Tried to encode a Server Action from a different instance than the encoder is from. This is a bug in React."
2241
+ );
2242
+ var boundPromise = referenceClosure.bound;
2243
+ null === boundPromise && (boundPromise = Promise.resolve([]));
2244
+ return encodeFormAction(referenceClosure.id, boundPromise);
2245
+ }
2246
+ },
2247
+ $$IS_SIGNATURE_EQUAL: { value: isSignatureEqual },
2248
+ bind: { value: bind }
2249
+ }));
2243
2250
  }
2244
2251
  var FunctionBind = Function.prototype.bind,
2245
2252
  ArraySlice = Array.prototype.slice;
2246
2253
  function bind() {
2247
- var newFn = FunctionBind.apply(this, arguments),
2248
- reference = knownServerReferences.get(this);
2249
- if (reference) {
2250
- var args = ArraySlice.call(arguments, 1),
2251
- boundPromise = null;
2252
- boundPromise =
2253
- null !== reference.bound
2254
- ? Promise.resolve(reference.bound).then(function (boundArgs) {
2255
- return boundArgs.concat(args);
2256
- })
2257
- : Promise.resolve(args);
2258
- Object.defineProperties(newFn, {
2259
- $$FORM_ACTION: { value: this.$$FORM_ACTION },
2260
- $$IS_SIGNATURE_EQUAL: { value: isSignatureEqual },
2261
- bind: { value: bind }
2262
- });
2263
- knownServerReferences.set(newFn, { id: reference.id, bound: boundPromise });
2264
- }
2254
+ var referenceClosure = knownServerReferences.get(this);
2255
+ if (!referenceClosure) return FunctionBind.apply(this, arguments);
2256
+ var newFn = referenceClosure.originalBind.apply(this, arguments),
2257
+ args = ArraySlice.call(arguments, 1),
2258
+ boundPromise = null;
2259
+ boundPromise =
2260
+ null !== referenceClosure.bound
2261
+ ? Promise.resolve(referenceClosure.bound).then(function (boundArgs) {
2262
+ return boundArgs.concat(args);
2263
+ })
2264
+ : Promise.resolve(args);
2265
+ knownServerReferences.set(newFn, {
2266
+ id: referenceClosure.id,
2267
+ originalBind: newFn.bind,
2268
+ bound: boundPromise
2269
+ });
2270
+ Object.defineProperties(newFn, {
2271
+ $$FORM_ACTION: { value: this.$$FORM_ACTION },
2272
+ $$IS_SIGNATURE_EQUAL: { value: isSignatureEqual },
2273
+ bind: { value: bind }
2274
+ });
2265
2275
  return newFn;
2266
2276
  }
2267
2277
  function createBoundServerReference(metaData, callServer, encodeFormAction) {
@@ -8916,4 +8926,4 @@ exports.experimental_renderToHTML = function (children, options) {
8916
8926
  });
8917
8927
  });
8918
8928
  };
8919
- exports.version = "19.1.0-experimental-d331ba04-20250307";
8929
+ exports.version = "19.1.0-experimental-6aa8254b-20250312";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-markup",
3
- "version": "0.0.0-experimental-d331ba04-20250307",
3
+ "version": "0.0.0-experimental-6aa8254b-20250312",
4
4
  "description": "React package generating embedded markup such as e-mails with support for Server Components.",
5
5
  "main": "index.js",
6
6
  "repository": {
@@ -17,7 +17,7 @@
17
17
  },
18
18
  "homepage": "https://react.dev/",
19
19
  "peerDependencies": {
20
- "react": "0.0.0-experimental-d331ba04-20250307"
20
+ "react": "0.0.0-experimental-6aa8254b-20250312"
21
21
  },
22
22
  "files": [
23
23
  "LICENSE",