react-server-dom-webpack 19.0.0-rc-e56f4ae3-20240830 → 19.0.0-rc-4f604941-20240830
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.
- package/cjs/react-server-dom-webpack-server.browser.development.js +148 -68
- package/cjs/react-server-dom-webpack-server.edge.development.js +153 -73
- package/cjs/react-server-dom-webpack-server.node.development.js +148 -69
- package/cjs/react-server-dom-webpack-server.node.unbundled.development.js +148 -69
- package/package.json +3 -3
@@ -324,6 +324,9 @@
|
|
324
324
|
function unsupportedContext() {
|
325
325
|
throw Error("Cannot read a Client Context from a Server Component.");
|
326
326
|
}
|
327
|
+
function resolveOwner() {
|
328
|
+
return currentOwner ? currentOwner : null;
|
329
|
+
}
|
327
330
|
function isObjectPrototype(object) {
|
328
331
|
if (!object) return !1;
|
329
332
|
var ObjectPrototype = Object.prototype;
|
@@ -521,6 +524,55 @@
|
|
521
524
|
!filename.includes("node_modules")
|
522
525
|
);
|
523
526
|
}
|
527
|
+
function filterStackTrace(request, error, skipFrames) {
|
528
|
+
request = request.filterStackFrame;
|
529
|
+
error = parseStackTrace(error, skipFrames);
|
530
|
+
for (skipFrames = 0; skipFrames < error.length; skipFrames++) {
|
531
|
+
var callsite = error[skipFrames],
|
532
|
+
functionName = callsite[0],
|
533
|
+
url = callsite[1];
|
534
|
+
if (url.startsWith("rsc://React/")) {
|
535
|
+
var envIdx = url.indexOf("/", 12),
|
536
|
+
suffixIdx = url.lastIndexOf("?");
|
537
|
+
-1 < envIdx &&
|
538
|
+
-1 < suffixIdx &&
|
539
|
+
(url = callsite[1] = url.slice(envIdx + 1, suffixIdx));
|
540
|
+
}
|
541
|
+
request(url, functionName) ||
|
542
|
+
(error.splice(skipFrames, 1), skipFrames--);
|
543
|
+
}
|
544
|
+
return error;
|
545
|
+
}
|
546
|
+
function patchConsole(consoleInst, methodName) {
|
547
|
+
var descriptor = Object.getOwnPropertyDescriptor(consoleInst, methodName);
|
548
|
+
if (
|
549
|
+
descriptor &&
|
550
|
+
(descriptor.configurable || descriptor.writable) &&
|
551
|
+
"function" === typeof descriptor.value
|
552
|
+
) {
|
553
|
+
var originalMethod = descriptor.value;
|
554
|
+
descriptor = Object.getOwnPropertyDescriptor(originalMethod, "name");
|
555
|
+
var wrapperMethod = function () {
|
556
|
+
var request = currentRequest ? currentRequest : null;
|
557
|
+
if (("assert" !== methodName || !arguments[0]) && null !== request) {
|
558
|
+
var stack = filterStackTrace(
|
559
|
+
request,
|
560
|
+
Error("react-stack-top-frame"),
|
561
|
+
1
|
562
|
+
);
|
563
|
+
request.pendingChunks++;
|
564
|
+
var id = request.nextChunkId++,
|
565
|
+
owner = resolveOwner();
|
566
|
+
emitConsoleChunk(request, id, methodName, owner, stack, arguments);
|
567
|
+
}
|
568
|
+
return originalMethod.apply(this, arguments);
|
569
|
+
};
|
570
|
+
descriptor && Object.defineProperty(wrapperMethod, "name", descriptor);
|
571
|
+
Object.defineProperty(consoleInst, methodName, {
|
572
|
+
value: wrapperMethod
|
573
|
+
});
|
574
|
+
}
|
575
|
+
}
|
524
576
|
function getCurrentStackInDEV() {
|
525
577
|
return "";
|
526
578
|
}
|
@@ -622,14 +674,14 @@
|
|
622
674
|
task = thenable.reason;
|
623
675
|
var digest = logRecoverableError(request, task, null);
|
624
676
|
emitErrorChunk(request, newTask.id, digest, task);
|
625
|
-
newTask.status =
|
677
|
+
newTask.status = ERRORED$1;
|
626
678
|
request.abortableTasks.delete(newTask);
|
627
679
|
return newTask.id;
|
628
680
|
default:
|
629
|
-
if (
|
681
|
+
if (request.status === ABORTING)
|
630
682
|
return (
|
631
683
|
request.abortableTasks.delete(newTask),
|
632
|
-
(newTask.status =
|
684
|
+
(newTask.status = ABORTED),
|
633
685
|
(task = stringify(serializeByValueID(request.fatalError))),
|
634
686
|
emitModelChunk(request, newTask.id, task),
|
635
687
|
newTask.id
|
@@ -656,7 +708,7 @@
|
|
656
708
|
function (reason) {
|
657
709
|
var _digest = logRecoverableError(request, reason, newTask);
|
658
710
|
emitErrorChunk(request, newTask.id, _digest, reason);
|
659
|
-
newTask.status =
|
711
|
+
newTask.status = ERRORED$1;
|
660
712
|
request.abortableTasks.delete(newTask);
|
661
713
|
enqueueFlush(request);
|
662
714
|
}
|
@@ -807,10 +859,9 @@
|
|
807
859
|
function emitHint(request, code, model) {
|
808
860
|
model = stringify(model);
|
809
861
|
var id = request.nextChunkId++;
|
810
|
-
code = "H" + code;
|
811
|
-
code =
|
812
|
-
|
813
|
-
request.completedHintChunks.push(model);
|
862
|
+
code = serializeRowHeader("H" + code, id) + model + "\n";
|
863
|
+
code = stringToChunk(code);
|
864
|
+
request.completedHintChunks.push(code);
|
814
865
|
enqueueFlush(request);
|
815
866
|
}
|
816
867
|
function readThenable(thenable) {
|
@@ -882,7 +933,7 @@
|
|
882
933
|
}
|
883
934
|
prepareToUseHooksForComponent(prevThenableState, componentDebugInfo);
|
884
935
|
props = callComponentInDEV(Component, props, componentDebugInfo);
|
885
|
-
if (
|
936
|
+
if (request.status === ABORTING)
|
886
937
|
throw (
|
887
938
|
("object" !== typeof props ||
|
888
939
|
null === props ||
|
@@ -1015,7 +1066,7 @@
|
|
1015
1066
|
task.debugOwner
|
1016
1067
|
);
|
1017
1068
|
retryTask(request, task);
|
1018
|
-
return
|
1069
|
+
return task.status === COMPLETED
|
1019
1070
|
? serializeByValueID(task.id)
|
1020
1071
|
: "$L" + task.id.toString(16);
|
1021
1072
|
}
|
@@ -1055,7 +1106,7 @@
|
|
1055
1106
|
switch (type.$$typeof) {
|
1056
1107
|
case REACT_LAZY_TYPE:
|
1057
1108
|
type = callLazyInitInDEV(type);
|
1058
|
-
if (
|
1109
|
+
if (request.status === ABORTING) throw null;
|
1059
1110
|
return renderElement(request, task, type, key, ref, props);
|
1060
1111
|
case REACT_FORWARD_REF_TYPE:
|
1061
1112
|
return renderFunctionComponent(
|
@@ -1085,7 +1136,7 @@
|
|
1085
1136
|
pingedTasks.push(task);
|
1086
1137
|
1 === pingedTasks.length &&
|
1087
1138
|
((request.flushScheduled = null !== request.destination),
|
1088
|
-
|
1139
|
+
request.type === PRERENDER
|
1089
1140
|
? scheduleMicrotask(function () {
|
1090
1141
|
return performWork(request);
|
1091
1142
|
})
|
@@ -1110,7 +1161,7 @@
|
|
1110
1161
|
request.writtenObjects.set(model, serializeByValueID(id));
|
1111
1162
|
var task = {
|
1112
1163
|
id: id,
|
1113
|
-
status:
|
1164
|
+
status: PENDING$1,
|
1114
1165
|
model: model,
|
1115
1166
|
keyPath: keyPath,
|
1116
1167
|
implicitSlot: implicitSlot,
|
@@ -1164,6 +1215,9 @@
|
|
1164
1215
|
? "$-Infinity"
|
1165
1216
|
: "$NaN";
|
1166
1217
|
}
|
1218
|
+
function serializeRowHeader(tag, id) {
|
1219
|
+
return id.toString(16) + ":" + tag;
|
1220
|
+
}
|
1167
1221
|
function encodeReferenceChunk(request, id, reference) {
|
1168
1222
|
request = stringify(reference);
|
1169
1223
|
id = id.toString(16) + ":" + request + "\n";
|
@@ -1209,7 +1263,7 @@
|
|
1209
1263
|
request.pendingChunks++;
|
1210
1264
|
var importId = request.nextChunkId++,
|
1211
1265
|
json = stringify(clientReferenceMetadata),
|
1212
|
-
row =
|
1266
|
+
row = serializeRowHeader("I", importId) + json + "\n",
|
1213
1267
|
processedChunk = stringToChunk(row);
|
1214
1268
|
request.completedImportChunks.push(processedChunk);
|
1215
1269
|
writtenClientReferences.set(clientReferenceKey, importId);
|
@@ -1362,9 +1416,9 @@
|
|
1362
1416
|
null !== parent &&
|
1363
1417
|
(parent.$$typeof === REACT_ELEMENT_TYPE ||
|
1364
1418
|
parent.$$typeof === REACT_LAZY_TYPE);
|
1365
|
-
if (
|
1419
|
+
if (request.status === ABORTING)
|
1366
1420
|
return (
|
1367
|
-
(task.status =
|
1421
|
+
(task.status = ABORTED),
|
1368
1422
|
(task = request.fatalError),
|
1369
1423
|
parent ? "$L" + task.toString(16) : serializeByValueID(task)
|
1370
1424
|
);
|
@@ -1458,7 +1512,7 @@
|
|
1458
1512
|
case REACT_LAZY_TYPE:
|
1459
1513
|
task.thenableState = null;
|
1460
1514
|
elementReference = callLazyInitInDEV(value);
|
1461
|
-
if (
|
1515
|
+
if (request.status === ABORTING) throw null;
|
1462
1516
|
if ((_writtenObjects = value._debugInfo)) {
|
1463
1517
|
if (null === debugID) return outlineTask(request, task);
|
1464
1518
|
forwardDebugInfo(request, debugID, _writtenObjects);
|
@@ -1732,33 +1786,14 @@
|
|
1732
1786
|
null !== request.destination
|
1733
1787
|
? ((request.status = CLOSED),
|
1734
1788
|
closeWithError(request.destination, error))
|
1735
|
-
: ((request.status =
|
1789
|
+
: ((request.status = CLOSING), (request.fatalError = error));
|
1736
1790
|
}
|
1737
1791
|
function emitErrorChunk(request, id, digest, error) {
|
1738
1792
|
var env = (0, request.environmentName)();
|
1739
1793
|
try {
|
1740
1794
|
if (error instanceof Error) {
|
1741
1795
|
var message = String(error.message);
|
1742
|
-
|
1743
|
-
var filterStackFrame = request.filterStackFrame,
|
1744
|
-
stack = parseStackTrace(error, 0),
|
1745
|
-
i = 0;
|
1746
|
-
i < stack.length;
|
1747
|
-
i++
|
1748
|
-
) {
|
1749
|
-
var callsite = stack[i],
|
1750
|
-
functionName = callsite[0],
|
1751
|
-
url = callsite[1];
|
1752
|
-
if (url.startsWith("rsc://React/")) {
|
1753
|
-
var envIdx = url.indexOf("/", 12),
|
1754
|
-
suffixIdx = url.lastIndexOf("?");
|
1755
|
-
-1 < envIdx &&
|
1756
|
-
-1 < suffixIdx &&
|
1757
|
-
(url = callsite[1] = url.slice(envIdx + 1, suffixIdx));
|
1758
|
-
}
|
1759
|
-
filterStackFrame(url, functionName) || (stack.splice(i, 1), i--);
|
1760
|
-
}
|
1761
|
-
var stack$jscomp$0 = stack;
|
1796
|
+
var stack = filterStackTrace(request, error, 0);
|
1762
1797
|
var errorEnv = error.environmentName;
|
1763
1798
|
"string" === typeof errorEnv && (env = errorEnv);
|
1764
1799
|
} else
|
@@ -1766,19 +1801,14 @@
|
|
1766
1801
|
"object" === typeof error && null !== error
|
1767
1802
|
? describeObjectForErrorMessage(error)
|
1768
1803
|
: String(error)),
|
1769
|
-
(stack
|
1804
|
+
(stack = []);
|
1770
1805
|
} catch (x) {
|
1771
1806
|
(message =
|
1772
1807
|
"An error occurred but serializing the error message failed."),
|
1773
|
-
(stack
|
1808
|
+
(stack = []);
|
1774
1809
|
}
|
1775
|
-
digest = {
|
1776
|
-
|
1777
|
-
message: message,
|
1778
|
-
stack: stack$jscomp$0,
|
1779
|
-
env: env
|
1780
|
-
};
|
1781
|
-
id = id.toString(16) + ":E" + stringify(digest) + "\n";
|
1810
|
+
digest = { digest: digest, message: message, stack: stack, env: env };
|
1811
|
+
id = serializeRowHeader("E", id) + stringify(digest) + "\n";
|
1782
1812
|
id = stringToChunk(id);
|
1783
1813
|
request.completedErrorChunks.push(id);
|
1784
1814
|
}
|
@@ -1802,7 +1832,7 @@
|
|
1802
1832
|
value
|
1803
1833
|
);
|
1804
1834
|
});
|
1805
|
-
id =
|
1835
|
+
id = serializeRowHeader("D", id) + debugInfo + "\n";
|
1806
1836
|
id = stringToChunk(id);
|
1807
1837
|
request.completedRegularChunks.push(id);
|
1808
1838
|
}
|
@@ -1994,6 +2024,35 @@
|
|
1994
2024
|
request.completedRegularChunks.push(json);
|
1995
2025
|
return model;
|
1996
2026
|
}
|
2027
|
+
function emitConsoleChunk(
|
2028
|
+
request,
|
2029
|
+
id,
|
2030
|
+
methodName,
|
2031
|
+
owner,
|
2032
|
+
stackTrace,
|
2033
|
+
args
|
2034
|
+
) {
|
2035
|
+
var counter = { objectCount: 0 },
|
2036
|
+
env = (0, request.environmentName)();
|
2037
|
+
methodName = [methodName, stackTrace, owner, env];
|
2038
|
+
methodName.push.apply(methodName, args);
|
2039
|
+
args = stringify(methodName, function (parentPropertyName, value) {
|
2040
|
+
try {
|
2041
|
+
return renderConsoleValue(
|
2042
|
+
request,
|
2043
|
+
counter,
|
2044
|
+
this,
|
2045
|
+
parentPropertyName,
|
2046
|
+
value
|
2047
|
+
);
|
2048
|
+
} catch (x) {
|
2049
|
+
return "unknown value";
|
2050
|
+
}
|
2051
|
+
});
|
2052
|
+
id = serializeRowHeader("W", id) + args + "\n";
|
2053
|
+
id = stringToChunk(id);
|
2054
|
+
request.completedRegularChunks.push(id);
|
2055
|
+
}
|
1997
2056
|
function forwardDebugInfo(request, id, debugInfo) {
|
1998
2057
|
for (var i = 0; i < debugInfo.length; i++)
|
1999
2058
|
request.pendingChunks++,
|
@@ -2035,9 +2094,9 @@
|
|
2035
2094
|
emitModelChunk(request, task.id, value));
|
2036
2095
|
}
|
2037
2096
|
function retryTask(request, task) {
|
2038
|
-
if (
|
2097
|
+
if (task.status === PENDING$1) {
|
2039
2098
|
var prevDebugID = debugID;
|
2040
|
-
task.status =
|
2099
|
+
task.status = RENDERING;
|
2041
2100
|
try {
|
2042
2101
|
modelRoot = task.model;
|
2043
2102
|
debugID = task.id;
|
@@ -2069,11 +2128,11 @@
|
|
2069
2128
|
emitModelChunk(request, task.id, json);
|
2070
2129
|
}
|
2071
2130
|
request.abortableTasks.delete(task);
|
2072
|
-
task.status =
|
2131
|
+
task.status = COMPLETED;
|
2073
2132
|
} catch (thrownValue) {
|
2074
|
-
if (
|
2133
|
+
if (request.status === ABORTING) {
|
2075
2134
|
request.abortableTasks.delete(task);
|
2076
|
-
task.status =
|
2135
|
+
task.status = ABORTED;
|
2077
2136
|
var model = stringify(serializeByValueID(request.fatalError));
|
2078
2137
|
emitModelChunk(request, task.id, model);
|
2079
2138
|
} else {
|
@@ -2086,13 +2145,13 @@
|
|
2086
2145
|
null !== x &&
|
2087
2146
|
"function" === typeof x.then
|
2088
2147
|
) {
|
2089
|
-
task.status =
|
2148
|
+
task.status = PENDING$1;
|
2090
2149
|
task.thenableState = getThenableStateAfterSuspending();
|
2091
2150
|
var ping = task.ping;
|
2092
2151
|
x.then(ping, ping);
|
2093
2152
|
} else {
|
2094
2153
|
request.abortableTasks.delete(task);
|
2095
|
-
task.status =
|
2154
|
+
task.status = ERRORED$1;
|
2096
2155
|
var digest = logRecoverableError(request, x, task);
|
2097
2156
|
emitErrorChunk(request, task.id, digest, x);
|
2098
2157
|
}
|
@@ -2201,7 +2260,7 @@
|
|
2201
2260
|
}
|
2202
2261
|
function startWork(request) {
|
2203
2262
|
request.flushScheduled = null !== request.destination;
|
2204
|
-
|
2263
|
+
request.type === PRERENDER
|
2205
2264
|
? scheduleMicrotask(function () {
|
2206
2265
|
return performWork(request);
|
2207
2266
|
})
|
@@ -2222,7 +2281,7 @@
|
|
2222
2281
|
}
|
2223
2282
|
function abort(request, reason) {
|
2224
2283
|
try {
|
2225
|
-
10 === request.status && (request.status =
|
2284
|
+
10 === request.status && (request.status = ABORTING);
|
2226
2285
|
var abortableTasks = request.abortableTasks;
|
2227
2286
|
if (0 < abortableTasks.size) {
|
2228
2287
|
var error =
|
@@ -2243,8 +2302,8 @@
|
|
2243
2302
|
request.pendingChunks++;
|
2244
2303
|
emitErrorChunk(request, _errorId2, digest, error);
|
2245
2304
|
abortableTasks.forEach(function (task) {
|
2246
|
-
if (
|
2247
|
-
task.status =
|
2305
|
+
if (task.status !== RENDERING) {
|
2306
|
+
task.status = ABORTED;
|
2248
2307
|
var ref = serializeByValueID(_errorId2);
|
2249
2308
|
task = encodeReferenceChunk(request, task.id, ref);
|
2250
2309
|
request.completedErrorChunks.push(task);
|
@@ -3366,13 +3425,11 @@
|
|
3366
3425
|
void 0 === entry &&
|
3367
3426
|
((entry = resourceType()), cache.set(resourceType, entry));
|
3368
3427
|
return entry;
|
3369
|
-
},
|
3370
|
-
getOwner: function () {
|
3371
|
-
return currentOwner ? currentOwner : null;
|
3372
3428
|
}
|
3373
|
-
}
|
3374
|
-
|
3375
|
-
|
3429
|
+
};
|
3430
|
+
DefaultAsyncDispatcher.getOwner = resolveOwner;
|
3431
|
+
var ReactSharedInternalsServer =
|
3432
|
+
React.__SERVER_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;
|
3376
3433
|
if (!ReactSharedInternalsServer)
|
3377
3434
|
throw Error(
|
3378
3435
|
'The "react" package in this environment is not configured correctly. The "react-server" condition must be enabled in any environment that runs React Server Components.'
|
@@ -3413,10 +3470,33 @@
|
|
3413
3470
|
getPrototypeOf = Object.getPrototypeOf,
|
3414
3471
|
jsxPropsParents = new WeakMap(),
|
3415
3472
|
jsxChildrenParents = new WeakMap(),
|
3416
|
-
CLIENT_REFERENCE_TAG = Symbol.for("react.client.reference")
|
3417
|
-
|
3473
|
+
CLIENT_REFERENCE_TAG = Symbol.for("react.client.reference");
|
3474
|
+
"object" === typeof console &&
|
3475
|
+
null !== console &&
|
3476
|
+
(patchConsole(console, "assert"),
|
3477
|
+
patchConsole(console, "debug"),
|
3478
|
+
patchConsole(console, "dir"),
|
3479
|
+
patchConsole(console, "dirxml"),
|
3480
|
+
patchConsole(console, "error"),
|
3481
|
+
patchConsole(console, "group"),
|
3482
|
+
patchConsole(console, "groupCollapsed"),
|
3483
|
+
patchConsole(console, "groupEnd"),
|
3484
|
+
patchConsole(console, "info"),
|
3485
|
+
patchConsole(console, "log"),
|
3486
|
+
patchConsole(console, "table"),
|
3487
|
+
patchConsole(console, "trace"),
|
3488
|
+
patchConsole(console, "warn"));
|
3489
|
+
var ObjectPrototype = Object.prototype,
|
3418
3490
|
stringify = JSON.stringify,
|
3491
|
+
PENDING$1 = 0,
|
3492
|
+
COMPLETED = 1,
|
3493
|
+
ABORTED = 3,
|
3494
|
+
ERRORED$1 = 4,
|
3495
|
+
RENDERING = 5,
|
3496
|
+
ABORTING = 11,
|
3497
|
+
CLOSING = 12,
|
3419
3498
|
CLOSED = 13,
|
3499
|
+
PRERENDER = 21,
|
3420
3500
|
currentRequest = null,
|
3421
3501
|
debugID = null,
|
3422
3502
|
modelRoot = !1,
|
@@ -3576,7 +3656,7 @@
|
|
3576
3656
|
startWork(request);
|
3577
3657
|
},
|
3578
3658
|
pull: function (controller) {
|
3579
|
-
if (
|
3659
|
+
if (request.status === CLOSING)
|
3580
3660
|
(request.status = CLOSED),
|
3581
3661
|
closeWithError(controller, request.fatalError);
|
3582
3662
|
else if (
|