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
@@ -320,6 +320,14 @@
|
|
320
320
|
function unsupportedContext() {
|
321
321
|
throw Error("Cannot read a Client Context from a Server Component.");
|
322
322
|
}
|
323
|
+
function resolveOwner() {
|
324
|
+
if (currentOwner) return currentOwner;
|
325
|
+
if (supportsComponentStorage) {
|
326
|
+
var owner = componentStorage.getStore();
|
327
|
+
if (owner) return owner;
|
328
|
+
}
|
329
|
+
return null;
|
330
|
+
}
|
323
331
|
function isObjectPrototype(object) {
|
324
332
|
if (!object) return !1;
|
325
333
|
var ObjectPrototype = Object.prototype;
|
@@ -517,6 +525,55 @@
|
|
517
525
|
!filename.includes("node_modules")
|
518
526
|
);
|
519
527
|
}
|
528
|
+
function filterStackTrace(request, error, skipFrames) {
|
529
|
+
request = request.filterStackFrame;
|
530
|
+
error = parseStackTrace(error, skipFrames);
|
531
|
+
for (skipFrames = 0; skipFrames < error.length; skipFrames++) {
|
532
|
+
var callsite = error[skipFrames],
|
533
|
+
functionName = callsite[0],
|
534
|
+
url = callsite[1];
|
535
|
+
if (url.startsWith("rsc://React/")) {
|
536
|
+
var envIdx = url.indexOf("/", 12),
|
537
|
+
suffixIdx = url.lastIndexOf("?");
|
538
|
+
-1 < envIdx &&
|
539
|
+
-1 < suffixIdx &&
|
540
|
+
(url = callsite[1] = url.slice(envIdx + 1, suffixIdx));
|
541
|
+
}
|
542
|
+
request(url, functionName) ||
|
543
|
+
(error.splice(skipFrames, 1), skipFrames--);
|
544
|
+
}
|
545
|
+
return error;
|
546
|
+
}
|
547
|
+
function patchConsole(consoleInst, methodName) {
|
548
|
+
var descriptor = Object.getOwnPropertyDescriptor(consoleInst, methodName);
|
549
|
+
if (
|
550
|
+
descriptor &&
|
551
|
+
(descriptor.configurable || descriptor.writable) &&
|
552
|
+
"function" === typeof descriptor.value
|
553
|
+
) {
|
554
|
+
var originalMethod = descriptor.value;
|
555
|
+
descriptor = Object.getOwnPropertyDescriptor(originalMethod, "name");
|
556
|
+
var wrapperMethod = function () {
|
557
|
+
var request = resolveRequest();
|
558
|
+
if (("assert" !== methodName || !arguments[0]) && null !== request) {
|
559
|
+
var stack = filterStackTrace(
|
560
|
+
request,
|
561
|
+
Error("react-stack-top-frame"),
|
562
|
+
1
|
563
|
+
);
|
564
|
+
request.pendingChunks++;
|
565
|
+
var id = request.nextChunkId++,
|
566
|
+
owner = resolveOwner();
|
567
|
+
emitConsoleChunk(request, id, methodName, owner, stack, arguments);
|
568
|
+
}
|
569
|
+
return originalMethod.apply(this, arguments);
|
570
|
+
};
|
571
|
+
descriptor && Object.defineProperty(wrapperMethod, "name", descriptor);
|
572
|
+
Object.defineProperty(consoleInst, methodName, {
|
573
|
+
value: wrapperMethod
|
574
|
+
});
|
575
|
+
}
|
576
|
+
}
|
520
577
|
function getCurrentStackInDEV() {
|
521
578
|
return "";
|
522
579
|
}
|
@@ -626,14 +683,14 @@
|
|
626
683
|
task = thenable.reason;
|
627
684
|
var digest = logRecoverableError(request, task, null);
|
628
685
|
emitErrorChunk(request, newTask.id, digest, task);
|
629
|
-
newTask.status =
|
686
|
+
newTask.status = ERRORED$1;
|
630
687
|
request.abortableTasks.delete(newTask);
|
631
688
|
return newTask.id;
|
632
689
|
default:
|
633
|
-
if (
|
690
|
+
if (request.status === ABORTING)
|
634
691
|
return (
|
635
692
|
request.abortableTasks.delete(newTask),
|
636
|
-
(newTask.status =
|
693
|
+
(newTask.status = ABORTED),
|
637
694
|
(task = stringify(serializeByValueID(request.fatalError))),
|
638
695
|
emitModelChunk(request, newTask.id, task),
|
639
696
|
newTask.id
|
@@ -660,7 +717,7 @@
|
|
660
717
|
function (reason) {
|
661
718
|
var _digest = logRecoverableError(request, reason, newTask);
|
662
719
|
emitErrorChunk(request, newTask.id, _digest, reason);
|
663
|
-
newTask.status =
|
720
|
+
newTask.status = ERRORED$1;
|
664
721
|
request.abortableTasks.delete(newTask);
|
665
722
|
enqueueFlush(request);
|
666
723
|
}
|
@@ -811,10 +868,9 @@
|
|
811
868
|
function emitHint(request, code, model) {
|
812
869
|
model = stringify(model);
|
813
870
|
var id = request.nextChunkId++;
|
814
|
-
code = "H" + code;
|
815
|
-
code =
|
816
|
-
|
817
|
-
request.completedHintChunks.push(model);
|
871
|
+
code = serializeRowHeader("H" + code, id) + model + "\n";
|
872
|
+
code = stringToChunk(code);
|
873
|
+
request.completedHintChunks.push(code);
|
818
874
|
enqueueFlush(request);
|
819
875
|
}
|
820
876
|
function readThenable(thenable) {
|
@@ -894,7 +950,7 @@
|
|
894
950
|
componentDebugInfo
|
895
951
|
)
|
896
952
|
: callComponentInDEV(Component, props, componentDebugInfo);
|
897
|
-
if (
|
953
|
+
if (request.status === ABORTING)
|
898
954
|
throw (
|
899
955
|
("object" !== typeof props ||
|
900
956
|
null === props ||
|
@@ -1027,7 +1083,7 @@
|
|
1027
1083
|
task.debugOwner
|
1028
1084
|
);
|
1029
1085
|
retryTask(request, task);
|
1030
|
-
return
|
1086
|
+
return task.status === COMPLETED
|
1031
1087
|
? serializeByValueID(task.id)
|
1032
1088
|
: "$L" + task.id.toString(16);
|
1033
1089
|
}
|
@@ -1067,7 +1123,7 @@
|
|
1067
1123
|
switch (type.$$typeof) {
|
1068
1124
|
case REACT_LAZY_TYPE:
|
1069
1125
|
type = callLazyInitInDEV(type);
|
1070
|
-
if (
|
1126
|
+
if (request.status === ABORTING) throw null;
|
1071
1127
|
return renderElement(request, task, type, key, ref, props);
|
1072
1128
|
case REACT_FORWARD_REF_TYPE:
|
1073
1129
|
return renderFunctionComponent(
|
@@ -1097,7 +1153,7 @@
|
|
1097
1153
|
pingedTasks.push(task);
|
1098
1154
|
1 === pingedTasks.length &&
|
1099
1155
|
((request.flushScheduled = null !== request.destination),
|
1100
|
-
|
1156
|
+
request.type === PRERENDER
|
1101
1157
|
? scheduleMicrotask(function () {
|
1102
1158
|
return performWork(request);
|
1103
1159
|
})
|
@@ -1122,7 +1178,7 @@
|
|
1122
1178
|
request.writtenObjects.set(model, serializeByValueID(id));
|
1123
1179
|
var task = {
|
1124
1180
|
id: id,
|
1125
|
-
status:
|
1181
|
+
status: PENDING$1,
|
1126
1182
|
model: model,
|
1127
1183
|
keyPath: keyPath,
|
1128
1184
|
implicitSlot: implicitSlot,
|
@@ -1176,6 +1232,9 @@
|
|
1176
1232
|
? "$-Infinity"
|
1177
1233
|
: "$NaN";
|
1178
1234
|
}
|
1235
|
+
function serializeRowHeader(tag, id) {
|
1236
|
+
return id.toString(16) + ":" + tag;
|
1237
|
+
}
|
1179
1238
|
function encodeReferenceChunk(request, id, reference) {
|
1180
1239
|
request = stringify(reference);
|
1181
1240
|
id = id.toString(16) + ":" + request + "\n";
|
@@ -1221,7 +1280,7 @@
|
|
1221
1280
|
request.pendingChunks++;
|
1222
1281
|
var importId = request.nextChunkId++,
|
1223
1282
|
json = stringify(clientReferenceMetadata),
|
1224
|
-
row =
|
1283
|
+
row = serializeRowHeader("I", importId) + json + "\n",
|
1225
1284
|
processedChunk = stringToChunk(row);
|
1226
1285
|
request.completedImportChunks.push(processedChunk);
|
1227
1286
|
writtenClientReferences.set(clientReferenceKey, importId);
|
@@ -1374,9 +1433,9 @@
|
|
1374
1433
|
null !== parent &&
|
1375
1434
|
(parent.$$typeof === REACT_ELEMENT_TYPE ||
|
1376
1435
|
parent.$$typeof === REACT_LAZY_TYPE);
|
1377
|
-
if (
|
1436
|
+
if (request.status === ABORTING)
|
1378
1437
|
return (
|
1379
|
-
(task.status =
|
1438
|
+
(task.status = ABORTED),
|
1380
1439
|
(task = request.fatalError),
|
1381
1440
|
parent ? "$L" + task.toString(16) : serializeByValueID(task)
|
1382
1441
|
);
|
@@ -1470,7 +1529,7 @@
|
|
1470
1529
|
case REACT_LAZY_TYPE:
|
1471
1530
|
task.thenableState = null;
|
1472
1531
|
elementReference = callLazyInitInDEV(value);
|
1473
|
-
if (
|
1532
|
+
if (request.status === ABORTING) throw null;
|
1474
1533
|
if ((_writtenObjects = value._debugInfo)) {
|
1475
1534
|
if (null === debugID) return outlineTask(request, task);
|
1476
1535
|
forwardDebugInfo(request, debugID, _writtenObjects);
|
@@ -1755,33 +1814,14 @@
|
|
1755
1814
|
null !== request.destination
|
1756
1815
|
? ((request.status = CLOSED),
|
1757
1816
|
closeWithError(request.destination, error))
|
1758
|
-
: ((request.status =
|
1817
|
+
: ((request.status = CLOSING), (request.fatalError = error));
|
1759
1818
|
}
|
1760
1819
|
function emitErrorChunk(request, id, digest, error) {
|
1761
1820
|
var env = (0, request.environmentName)();
|
1762
1821
|
try {
|
1763
1822
|
if (error instanceof Error) {
|
1764
1823
|
var message = String(error.message);
|
1765
|
-
|
1766
|
-
var filterStackFrame = request.filterStackFrame,
|
1767
|
-
stack = parseStackTrace(error, 0),
|
1768
|
-
i = 0;
|
1769
|
-
i < stack.length;
|
1770
|
-
i++
|
1771
|
-
) {
|
1772
|
-
var callsite = stack[i],
|
1773
|
-
functionName = callsite[0],
|
1774
|
-
url = callsite[1];
|
1775
|
-
if (url.startsWith("rsc://React/")) {
|
1776
|
-
var envIdx = url.indexOf("/", 12),
|
1777
|
-
suffixIdx = url.lastIndexOf("?");
|
1778
|
-
-1 < envIdx &&
|
1779
|
-
-1 < suffixIdx &&
|
1780
|
-
(url = callsite[1] = url.slice(envIdx + 1, suffixIdx));
|
1781
|
-
}
|
1782
|
-
filterStackFrame(url, functionName) || (stack.splice(i, 1), i--);
|
1783
|
-
}
|
1784
|
-
var stack$jscomp$0 = stack;
|
1824
|
+
var stack = filterStackTrace(request, error, 0);
|
1785
1825
|
var errorEnv = error.environmentName;
|
1786
1826
|
"string" === typeof errorEnv && (env = errorEnv);
|
1787
1827
|
} else
|
@@ -1789,19 +1829,14 @@
|
|
1789
1829
|
"object" === typeof error && null !== error
|
1790
1830
|
? describeObjectForErrorMessage(error)
|
1791
1831
|
: String(error)),
|
1792
|
-
(stack
|
1832
|
+
(stack = []);
|
1793
1833
|
} catch (x) {
|
1794
1834
|
(message =
|
1795
1835
|
"An error occurred but serializing the error message failed."),
|
1796
|
-
(stack
|
1836
|
+
(stack = []);
|
1797
1837
|
}
|
1798
|
-
digest = {
|
1799
|
-
|
1800
|
-
message: message,
|
1801
|
-
stack: stack$jscomp$0,
|
1802
|
-
env: env
|
1803
|
-
};
|
1804
|
-
id = id.toString(16) + ":E" + stringify(digest) + "\n";
|
1838
|
+
digest = { digest: digest, message: message, stack: stack, env: env };
|
1839
|
+
id = serializeRowHeader("E", id) + stringify(digest) + "\n";
|
1805
1840
|
id = stringToChunk(id);
|
1806
1841
|
request.completedErrorChunks.push(id);
|
1807
1842
|
}
|
@@ -1825,7 +1860,7 @@
|
|
1825
1860
|
value
|
1826
1861
|
);
|
1827
1862
|
});
|
1828
|
-
id =
|
1863
|
+
id = serializeRowHeader("D", id) + debugInfo + "\n";
|
1829
1864
|
id = stringToChunk(id);
|
1830
1865
|
request.completedRegularChunks.push(id);
|
1831
1866
|
}
|
@@ -2017,6 +2052,35 @@
|
|
2017
2052
|
request.completedRegularChunks.push(json);
|
2018
2053
|
return model;
|
2019
2054
|
}
|
2055
|
+
function emitConsoleChunk(
|
2056
|
+
request,
|
2057
|
+
id,
|
2058
|
+
methodName,
|
2059
|
+
owner,
|
2060
|
+
stackTrace,
|
2061
|
+
args
|
2062
|
+
) {
|
2063
|
+
var counter = { objectCount: 0 },
|
2064
|
+
env = (0, request.environmentName)();
|
2065
|
+
methodName = [methodName, stackTrace, owner, env];
|
2066
|
+
methodName.push.apply(methodName, args);
|
2067
|
+
args = stringify(methodName, function (parentPropertyName, value) {
|
2068
|
+
try {
|
2069
|
+
return renderConsoleValue(
|
2070
|
+
request,
|
2071
|
+
counter,
|
2072
|
+
this,
|
2073
|
+
parentPropertyName,
|
2074
|
+
value
|
2075
|
+
);
|
2076
|
+
} catch (x) {
|
2077
|
+
return "unknown value";
|
2078
|
+
}
|
2079
|
+
});
|
2080
|
+
id = serializeRowHeader("W", id) + args + "\n";
|
2081
|
+
id = stringToChunk(id);
|
2082
|
+
request.completedRegularChunks.push(id);
|
2083
|
+
}
|
2020
2084
|
function forwardDebugInfo(request, id, debugInfo) {
|
2021
2085
|
for (var i = 0; i < debugInfo.length; i++)
|
2022
2086
|
request.pendingChunks++,
|
@@ -2058,9 +2122,9 @@
|
|
2058
2122
|
emitModelChunk(request, task.id, value));
|
2059
2123
|
}
|
2060
2124
|
function retryTask(request, task) {
|
2061
|
-
if (
|
2125
|
+
if (task.status === PENDING$1) {
|
2062
2126
|
var prevDebugID = debugID;
|
2063
|
-
task.status =
|
2127
|
+
task.status = RENDERING;
|
2064
2128
|
try {
|
2065
2129
|
modelRoot = task.model;
|
2066
2130
|
debugID = task.id;
|
@@ -2092,11 +2156,11 @@
|
|
2092
2156
|
emitModelChunk(request, task.id, json);
|
2093
2157
|
}
|
2094
2158
|
request.abortableTasks.delete(task);
|
2095
|
-
task.status =
|
2159
|
+
task.status = COMPLETED;
|
2096
2160
|
} catch (thrownValue) {
|
2097
|
-
if (
|
2161
|
+
if (request.status === ABORTING) {
|
2098
2162
|
request.abortableTasks.delete(task);
|
2099
|
-
task.status =
|
2163
|
+
task.status = ABORTED;
|
2100
2164
|
var model = stringify(serializeByValueID(request.fatalError));
|
2101
2165
|
emitModelChunk(request, task.id, model);
|
2102
2166
|
} else {
|
@@ -2109,13 +2173,13 @@
|
|
2109
2173
|
null !== x &&
|
2110
2174
|
"function" === typeof x.then
|
2111
2175
|
) {
|
2112
|
-
task.status =
|
2176
|
+
task.status = PENDING$1;
|
2113
2177
|
task.thenableState = getThenableStateAfterSuspending();
|
2114
2178
|
var ping = task.ping;
|
2115
2179
|
x.then(ping, ping);
|
2116
2180
|
} else {
|
2117
2181
|
request.abortableTasks.delete(task);
|
2118
|
-
task.status =
|
2182
|
+
task.status = ERRORED$1;
|
2119
2183
|
var digest = logRecoverableError(request, x, task);
|
2120
2184
|
emitErrorChunk(request, task.id, digest, x);
|
2121
2185
|
}
|
@@ -2224,7 +2288,7 @@
|
|
2224
2288
|
}
|
2225
2289
|
function startWork(request) {
|
2226
2290
|
request.flushScheduled = null !== request.destination;
|
2227
|
-
|
2291
|
+
request.type === PRERENDER
|
2228
2292
|
? supportsRequestStorage
|
2229
2293
|
? scheduleMicrotask(function () {
|
2230
2294
|
requestStorage.run(request, performWork, request);
|
@@ -2253,7 +2317,7 @@
|
|
2253
2317
|
}
|
2254
2318
|
function abort(request, reason) {
|
2255
2319
|
try {
|
2256
|
-
10 === request.status && (request.status =
|
2320
|
+
10 === request.status && (request.status = ABORTING);
|
2257
2321
|
var abortableTasks = request.abortableTasks;
|
2258
2322
|
if (0 < abortableTasks.size) {
|
2259
2323
|
var error =
|
@@ -2274,8 +2338,8 @@
|
|
2274
2338
|
request.pendingChunks++;
|
2275
2339
|
emitErrorChunk(request, _errorId2, digest, error);
|
2276
2340
|
abortableTasks.forEach(function (task) {
|
2277
|
-
if (
|
2278
|
-
task.status =
|
2341
|
+
if (task.status !== RENDERING) {
|
2342
|
+
task.status = ABORTED;
|
2279
2343
|
var ref = serializeByValueID(_errorId2);
|
2280
2344
|
task = encodeReferenceChunk(request, task.id, ref);
|
2281
2345
|
request.completedErrorChunks.push(task);
|
@@ -3397,18 +3461,11 @@
|
|
3397
3461
|
void 0 === entry &&
|
3398
3462
|
((entry = resourceType()), cache.set(resourceType, entry));
|
3399
3463
|
return entry;
|
3400
|
-
},
|
3401
|
-
getOwner: function () {
|
3402
|
-
if (currentOwner) return currentOwner;
|
3403
|
-
if (supportsComponentStorage) {
|
3404
|
-
var owner = componentStorage.getStore();
|
3405
|
-
if (owner) return owner;
|
3406
|
-
}
|
3407
|
-
return null;
|
3408
3464
|
}
|
3409
|
-
}
|
3410
|
-
|
3411
|
-
|
3465
|
+
};
|
3466
|
+
DefaultAsyncDispatcher.getOwner = resolveOwner;
|
3467
|
+
var ReactSharedInternalsServer =
|
3468
|
+
React.__SERVER_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;
|
3412
3469
|
if (!ReactSharedInternalsServer)
|
3413
3470
|
throw Error(
|
3414
3471
|
'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.'
|
@@ -3449,10 +3506,33 @@
|
|
3449
3506
|
getPrototypeOf = Object.getPrototypeOf,
|
3450
3507
|
jsxPropsParents = new WeakMap(),
|
3451
3508
|
jsxChildrenParents = new WeakMap(),
|
3452
|
-
CLIENT_REFERENCE_TAG = Symbol.for("react.client.reference")
|
3453
|
-
|
3509
|
+
CLIENT_REFERENCE_TAG = Symbol.for("react.client.reference");
|
3510
|
+
"object" === typeof console &&
|
3511
|
+
null !== console &&
|
3512
|
+
(patchConsole(console, "assert"),
|
3513
|
+
patchConsole(console, "debug"),
|
3514
|
+
patchConsole(console, "dir"),
|
3515
|
+
patchConsole(console, "dirxml"),
|
3516
|
+
patchConsole(console, "error"),
|
3517
|
+
patchConsole(console, "group"),
|
3518
|
+
patchConsole(console, "groupCollapsed"),
|
3519
|
+
patchConsole(console, "groupEnd"),
|
3520
|
+
patchConsole(console, "info"),
|
3521
|
+
patchConsole(console, "log"),
|
3522
|
+
patchConsole(console, "table"),
|
3523
|
+
patchConsole(console, "trace"),
|
3524
|
+
patchConsole(console, "warn"));
|
3525
|
+
var ObjectPrototype = Object.prototype,
|
3454
3526
|
stringify = JSON.stringify,
|
3527
|
+
PENDING$1 = 0,
|
3528
|
+
COMPLETED = 1,
|
3529
|
+
ABORTED = 3,
|
3530
|
+
ERRORED$1 = 4,
|
3531
|
+
RENDERING = 5,
|
3532
|
+
ABORTING = 11,
|
3533
|
+
CLOSING = 12,
|
3455
3534
|
CLOSED = 13,
|
3535
|
+
PRERENDER = 21,
|
3456
3536
|
currentRequest = null,
|
3457
3537
|
debugID = null,
|
3458
3538
|
modelRoot = !1,
|
@@ -3604,7 +3684,7 @@
|
|
3604
3684
|
startWork(request);
|
3605
3685
|
},
|
3606
3686
|
pull: function (controller) {
|
3607
|
-
if (
|
3687
|
+
if (request.status === CLOSING)
|
3608
3688
|
(request.status = CLOSED),
|
3609
3689
|
closeWithError(controller, request.fatalError);
|
3610
3690
|
else if (
|