react-server-dom-webpack 19.0.0-rc-34d0c5e357-20240607 → 19.0.0-rc-6230622a1a-20240610

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.
@@ -414,32 +414,48 @@ function error(format) {
414
414
  args[_key2 - 1] = arguments[_key2];
415
415
  }
416
416
 
417
- printWarning('error', format, args);
417
+ printWarning('error', format, args, new Error('react-stack-top-frame'));
418
418
  }
419
419
  }
420
- }
420
+ } // eslint-disable-next-line react-internal/no-production-logging
421
421
 
422
- function printWarning(level, format, args) {
422
+ function printWarning(level, format, args, currentStack) {
423
423
  // When changing this logic, you might want to also
424
424
  // update consoleWithStackDev.www.js as well.
425
425
  {
426
- var stack = ReactSharedInternals.getStackAddendum();
427
-
428
- if (stack !== '') {
429
- format += '%s';
430
- args = args.concat([stack]);
431
- } // eslint-disable-next-line react-internal/safe-string-coercion
426
+ var isErrorLogger = format === '%s\n\n%s\n' || format === '%o\n\n%s\n\n%s\n';
432
427
 
428
+ if (ReactSharedInternals.getCurrentStack) {
429
+ // We only add the current stack to the console when createTask is not supported.
430
+ // Since createTask requires DevTools to be open to work, this means that stacks
431
+ // can be lost while DevTools isn't open but we can't detect this.
432
+ var stack = ReactSharedInternals.getCurrentStack(currentStack);
433
433
 
434
- var argsWithFormat = args.map(function (item) {
435
- return String(item);
436
- }); // Careful: RN currently depends on this prefix
434
+ if (stack !== '') {
435
+ format += '%s';
436
+ args = args.concat([stack]);
437
+ }
438
+ }
437
439
 
438
- argsWithFormat.unshift('Warning: ' + format); // We intentionally don't use spread (or .apply) directly because it
440
+ if (isErrorLogger) {
441
+ // Don't prefix our default logging formatting in ReactFiberErrorLoggger.
442
+ // Don't toString the arguments.
443
+ args.unshift(format);
444
+ } else {
445
+ // TODO: Remove this prefix and stop toStringing in the wrapper and
446
+ // instead do it at each callsite as needed.
447
+ // Careful: RN currently depends on this prefix
448
+ // eslint-disable-next-line react-internal/safe-string-coercion
449
+ args = args.map(function (item) {
450
+ return String(item);
451
+ });
452
+ args.unshift('Warning: ' + format);
453
+ } // We intentionally don't use spread (or .apply) directly because it
439
454
  // breaks IE9: https://github.com/facebook/react/issues/13610
440
455
  // eslint-disable-next-line react-internal/no-production-logging
441
456
 
442
- Function.prototype.apply.call(console[level], console, argsWithFormat);
457
+
458
+ Function.prototype.apply.call(console[level], console, args);
443
459
  }
444
460
  }
445
461
 
@@ -1959,8 +1975,9 @@ function nullRefGetter() {
1959
1975
  }
1960
1976
  }
1961
1977
 
1962
- function createElement(type, key, props, owner, // DEV-only
1963
- stack) // DEV-only
1978
+ function createElement(response, type, key, props, owner, // DEV-only
1979
+ stack, // DEV-only
1980
+ validated) // DEV-only
1964
1981
  {
1965
1982
  var element;
1966
1983
 
@@ -1988,7 +2005,7 @@ stack) // DEV-only
1988
2005
  configurable: false,
1989
2006
  enumerable: false,
1990
2007
  writable: true,
1991
- value: true // This element has already been validated on the server.
2008
+ value: 1 // Whether the element has already been validated on the server.
1992
2009
 
1993
2010
  }); // debugInfo contains Server Component debug information.
1994
2011
 
@@ -2398,7 +2415,7 @@ function parseModelTuple(response, value) {
2398
2415
  if (tuple[0] === REACT_ELEMENT_TYPE) {
2399
2416
  // TODO: Consider having React just directly accept these arrays as elements.
2400
2417
  // Or even change the ReactElement type to be an array.
2401
- return createElement(tuple[1], tuple[2], tuple[3], tuple[4] );
2418
+ return createElement(response, tuple[1], tuple[2], tuple[3], tuple[4] );
2402
2419
  }
2403
2420
 
2404
2421
  return value;
@@ -2408,7 +2425,7 @@ function missingCall() {
2408
2425
  throw new Error('Trying to call a function from "use server" but the callServer option ' + 'was not implemented in your router runtime.');
2409
2426
  }
2410
2427
 
2411
- function createResponse(bundlerConfig, moduleLoading, callServer, encodeFormAction, nonce, temporaryReferences) {
2428
+ function createResponse(bundlerConfig, moduleLoading, callServer, encodeFormAction, nonce, temporaryReferences, findSourceMapURL) {
2412
2429
  var chunks = new Map();
2413
2430
  var response = {
2414
2431
  _bundlerConfig: bundlerConfig,
@@ -2425,7 +2442,12 @@ function createResponse(bundlerConfig, moduleLoading, callServer, encodeFormActi
2425
2442
  _rowLength: 0,
2426
2443
  _buffer: [],
2427
2444
  _tempRefs: temporaryReferences
2428
- }; // Don't inline this call because it causes closure to outline the call above.
2445
+ };
2446
+
2447
+ {
2448
+ response._debugFindSourceMapURL = findSourceMapURL;
2449
+ } // Don't inline this call because it causes closure to outline the call above.
2450
+
2429
2451
 
2430
2452
  response._fromJSON = createFromJSONCallback(response);
2431
2453
  return response;
@@ -2780,10 +2802,9 @@ function resolveErrorDev(response, id, digest, message, stack) {
2780
2802
  function resolveHint(response, code, model) {
2781
2803
  var hintModel = parseModel(response, model);
2782
2804
  dispatchHint(code, hintModel);
2783
- }
2805
+ } // eslint-disable-next-line react-internal/no-production-logging
2784
2806
 
2785
2807
  function resolveDebugInfo(response, id, debugInfo) {
2786
-
2787
2808
  var chunk = getChunk(response, id);
2788
2809
  var chunkDebugInfo = chunk._debugInfo || (chunk._debugInfo = []);
2789
2810
  chunkDebugInfo.push(debugInfo);
@@ -2792,13 +2813,16 @@ function resolveDebugInfo(response, id, debugInfo) {
2792
2813
  function resolveConsoleEntry(response, value) {
2793
2814
 
2794
2815
  var payload = parseModel(response, value);
2795
- var methodName = payload[0]; // TODO: Restore the fake stack before logging.
2796
- // const stackTrace = payload[1];
2797
- // const owner = payload[2];
2798
-
2816
+ var methodName = payload[0];
2799
2817
  var env = payload[3];
2800
2818
  var args = payload.slice(4);
2801
- printToConsole(methodName, args, env);
2819
+
2820
+ {
2821
+ // Printing with stack isn't really limited to owner stacks but
2822
+ // we gate it behind the same flag for now while iterating.
2823
+ printToConsole(methodName, args, env);
2824
+ return;
2825
+ }
2802
2826
  }
2803
2827
 
2804
2828
  function mergeBuffer(buffer, lastChunk) {
@@ -3255,7 +3279,7 @@ function close(response) {
3255
3279
  function createResponseFromOptions(options) {
3256
3280
  return createResponse(null, null, options && options.callServer ? options.callServer : undefined, undefined, // encodeFormAction
3257
3281
  undefined, // nonce
3258
- options && options.temporaryReferences ? options.temporaryReferences : undefined);
3282
+ options && options.temporaryReferences ? options.temporaryReferences : undefined, options && options.findSourceMapURL ? options.findSourceMapURL : undefined);
3259
3283
  }
3260
3284
 
3261
3285
  function startReadingFromStream(response, stream) {
@@ -433,32 +433,48 @@ function error(format) {
433
433
  args[_key2 - 1] = arguments[_key2];
434
434
  }
435
435
 
436
- printWarning('error', format, args);
436
+ printWarning('error', format, args, new Error('react-stack-top-frame'));
437
437
  }
438
438
  }
439
- }
439
+ } // eslint-disable-next-line react-internal/no-production-logging
440
440
 
441
- function printWarning(level, format, args) {
441
+ function printWarning(level, format, args, currentStack) {
442
442
  // When changing this logic, you might want to also
443
443
  // update consoleWithStackDev.www.js as well.
444
444
  {
445
- var stack = ReactSharedInternals.getStackAddendum();
446
-
447
- if (stack !== '') {
448
- format += '%s';
449
- args = args.concat([stack]);
450
- } // eslint-disable-next-line react-internal/safe-string-coercion
445
+ var isErrorLogger = format === '%s\n\n%s\n' || format === '%o\n\n%s\n\n%s\n';
451
446
 
447
+ if (ReactSharedInternals.getCurrentStack) {
448
+ // We only add the current stack to the console when createTask is not supported.
449
+ // Since createTask requires DevTools to be open to work, this means that stacks
450
+ // can be lost while DevTools isn't open but we can't detect this.
451
+ var stack = ReactSharedInternals.getCurrentStack(currentStack);
452
452
 
453
- var argsWithFormat = args.map(function (item) {
454
- return String(item);
455
- }); // Careful: RN currently depends on this prefix
453
+ if (stack !== '') {
454
+ format += '%s';
455
+ args = args.concat([stack]);
456
+ }
457
+ }
456
458
 
457
- argsWithFormat.unshift('Warning: ' + format); // We intentionally don't use spread (or .apply) directly because it
459
+ if (isErrorLogger) {
460
+ // Don't prefix our default logging formatting in ReactFiberErrorLoggger.
461
+ // Don't toString the arguments.
462
+ args.unshift(format);
463
+ } else {
464
+ // TODO: Remove this prefix and stop toStringing in the wrapper and
465
+ // instead do it at each callsite as needed.
466
+ // Careful: RN currently depends on this prefix
467
+ // eslint-disable-next-line react-internal/safe-string-coercion
468
+ args = args.map(function (item) {
469
+ return String(item);
470
+ });
471
+ args.unshift('Warning: ' + format);
472
+ } // We intentionally don't use spread (or .apply) directly because it
458
473
  // breaks IE9: https://github.com/facebook/react/issues/13610
459
474
  // eslint-disable-next-line react-internal/no-production-logging
460
475
 
461
- Function.prototype.apply.call(console[level], console, argsWithFormat);
476
+
477
+ Function.prototype.apply.call(console[level], console, args);
462
478
  }
463
479
  }
464
480
 
@@ -2212,8 +2228,9 @@ function nullRefGetter() {
2212
2228
  }
2213
2229
  }
2214
2230
 
2215
- function createElement(type, key, props, owner, // DEV-only
2216
- stack) // DEV-only
2231
+ function createElement(response, type, key, props, owner, // DEV-only
2232
+ stack, // DEV-only
2233
+ validated) // DEV-only
2217
2234
  {
2218
2235
  var element;
2219
2236
 
@@ -2241,7 +2258,7 @@ stack) // DEV-only
2241
2258
  configurable: false,
2242
2259
  enumerable: false,
2243
2260
  writable: true,
2244
- value: true // This element has already been validated on the server.
2261
+ value: 1 // Whether the element has already been validated on the server.
2245
2262
 
2246
2263
  }); // debugInfo contains Server Component debug information.
2247
2264
 
@@ -2651,7 +2668,7 @@ function parseModelTuple(response, value) {
2651
2668
  if (tuple[0] === REACT_ELEMENT_TYPE) {
2652
2669
  // TODO: Consider having React just directly accept these arrays as elements.
2653
2670
  // Or even change the ReactElement type to be an array.
2654
- return createElement(tuple[1], tuple[2], tuple[3], tuple[4] );
2671
+ return createElement(response, tuple[1], tuple[2], tuple[3], tuple[4] );
2655
2672
  }
2656
2673
 
2657
2674
  return value;
@@ -2661,7 +2678,7 @@ function missingCall() {
2661
2678
  throw new Error('Trying to call a function from "use server" but the callServer option ' + 'was not implemented in your router runtime.');
2662
2679
  }
2663
2680
 
2664
- function createResponse(bundlerConfig, moduleLoading, callServer, encodeFormAction, nonce, temporaryReferences) {
2681
+ function createResponse(bundlerConfig, moduleLoading, callServer, encodeFormAction, nonce, temporaryReferences, findSourceMapURL) {
2665
2682
  var chunks = new Map();
2666
2683
  var response = {
2667
2684
  _bundlerConfig: bundlerConfig,
@@ -2678,7 +2695,12 @@ function createResponse(bundlerConfig, moduleLoading, callServer, encodeFormActi
2678
2695
  _rowLength: 0,
2679
2696
  _buffer: [],
2680
2697
  _tempRefs: temporaryReferences
2681
- }; // Don't inline this call because it causes closure to outline the call above.
2698
+ };
2699
+
2700
+ {
2701
+ response._debugFindSourceMapURL = findSourceMapURL;
2702
+ } // Don't inline this call because it causes closure to outline the call above.
2703
+
2682
2704
 
2683
2705
  response._fromJSON = createFromJSONCallback(response);
2684
2706
  return response;
@@ -3034,10 +3056,9 @@ function resolveErrorDev(response, id, digest, message, stack) {
3034
3056
  function resolveHint(response, code, model) {
3035
3057
  var hintModel = parseModel(response, model);
3036
3058
  dispatchHint(code, hintModel);
3037
- }
3059
+ } // eslint-disable-next-line react-internal/no-production-logging
3038
3060
 
3039
3061
  function resolveDebugInfo(response, id, debugInfo) {
3040
-
3041
3062
  var chunk = getChunk(response, id);
3042
3063
  var chunkDebugInfo = chunk._debugInfo || (chunk._debugInfo = []);
3043
3064
  chunkDebugInfo.push(debugInfo);
@@ -3046,13 +3067,16 @@ function resolveDebugInfo(response, id, debugInfo) {
3046
3067
  function resolveConsoleEntry(response, value) {
3047
3068
 
3048
3069
  var payload = parseModel(response, value);
3049
- var methodName = payload[0]; // TODO: Restore the fake stack before logging.
3050
- // const stackTrace = payload[1];
3051
- // const owner = payload[2];
3052
-
3070
+ var methodName = payload[0];
3053
3071
  var env = payload[3];
3054
3072
  var args = payload.slice(4);
3055
- printToConsole(methodName, args, env);
3073
+
3074
+ {
3075
+ // Printing with stack isn't really limited to owner stacks but
3076
+ // we gate it behind the same flag for now while iterating.
3077
+ printToConsole(methodName, args, env);
3078
+ return;
3079
+ }
3056
3080
  }
3057
3081
 
3058
3082
  function mergeBuffer(buffer, lastChunk) {
@@ -3515,7 +3539,7 @@ function createServerReference(id, callServer) {
3515
3539
  }
3516
3540
 
3517
3541
  function createResponseFromOptions(options) {
3518
- return createResponse(options.ssrManifest.moduleMap, options.ssrManifest.moduleLoading, noServerCall, options.encodeFormAction, typeof options.nonce === 'string' ? options.nonce : undefined, options && options.temporaryReferences ? options.temporaryReferences : undefined);
3542
+ return createResponse(options.ssrManifest.moduleMap, options.ssrManifest.moduleLoading, noServerCall, options.encodeFormAction, typeof options.nonce === 'string' ? options.nonce : undefined, options && options.temporaryReferences ? options.temporaryReferences : undefined, options && options.findSourceMapURL ? options.findSourceMapURL : undefined);
3519
3543
  }
3520
3544
 
3521
3545
  function startReadingFromStream(response, stream) {
@@ -434,32 +434,48 @@ function error(format) {
434
434
  args[_key2 - 1] = arguments[_key2];
435
435
  }
436
436
 
437
- printWarning('error', format, args);
437
+ printWarning('error', format, args, new Error('react-stack-top-frame'));
438
438
  }
439
439
  }
440
- }
440
+ } // eslint-disable-next-line react-internal/no-production-logging
441
441
 
442
- function printWarning(level, format, args) {
442
+ function printWarning(level, format, args, currentStack) {
443
443
  // When changing this logic, you might want to also
444
444
  // update consoleWithStackDev.www.js as well.
445
445
  {
446
- var stack = ReactSharedInternals.getStackAddendum();
447
-
448
- if (stack !== '') {
449
- format += '%s';
450
- args = args.concat([stack]);
451
- } // eslint-disable-next-line react-internal/safe-string-coercion
446
+ var isErrorLogger = format === '%s\n\n%s\n' || format === '%o\n\n%s\n\n%s\n';
452
447
 
448
+ if (ReactSharedInternals.getCurrentStack) {
449
+ // We only add the current stack to the console when createTask is not supported.
450
+ // Since createTask requires DevTools to be open to work, this means that stacks
451
+ // can be lost while DevTools isn't open but we can't detect this.
452
+ var stack = ReactSharedInternals.getCurrentStack(currentStack);
453
453
 
454
- var argsWithFormat = args.map(function (item) {
455
- return String(item);
456
- }); // Careful: RN currently depends on this prefix
454
+ if (stack !== '') {
455
+ format += '%s';
456
+ args = args.concat([stack]);
457
+ }
458
+ }
457
459
 
458
- argsWithFormat.unshift('Warning: ' + format); // We intentionally don't use spread (or .apply) directly because it
460
+ if (isErrorLogger) {
461
+ // Don't prefix our default logging formatting in ReactFiberErrorLoggger.
462
+ // Don't toString the arguments.
463
+ args.unshift(format);
464
+ } else {
465
+ // TODO: Remove this prefix and stop toStringing in the wrapper and
466
+ // instead do it at each callsite as needed.
467
+ // Careful: RN currently depends on this prefix
468
+ // eslint-disable-next-line react-internal/safe-string-coercion
469
+ args = args.map(function (item) {
470
+ return String(item);
471
+ });
472
+ args.unshift('Warning: ' + format);
473
+ } // We intentionally don't use spread (or .apply) directly because it
459
474
  // breaks IE9: https://github.com/facebook/react/issues/13610
460
475
  // eslint-disable-next-line react-internal/no-production-logging
461
476
 
462
- Function.prototype.apply.call(console[level], console, argsWithFormat);
477
+
478
+ Function.prototype.apply.call(console[level], console, args);
463
479
  }
464
480
  }
465
481
 
@@ -2210,8 +2226,9 @@ function nullRefGetter() {
2210
2226
  }
2211
2227
  }
2212
2228
 
2213
- function createElement(type, key, props, owner, // DEV-only
2214
- stack) // DEV-only
2229
+ function createElement(response, type, key, props, owner, // DEV-only
2230
+ stack, // DEV-only
2231
+ validated) // DEV-only
2215
2232
  {
2216
2233
  var element;
2217
2234
 
@@ -2239,7 +2256,7 @@ stack) // DEV-only
2239
2256
  configurable: false,
2240
2257
  enumerable: false,
2241
2258
  writable: true,
2242
- value: true // This element has already been validated on the server.
2259
+ value: 1 // Whether the element has already been validated on the server.
2243
2260
 
2244
2261
  }); // debugInfo contains Server Component debug information.
2245
2262
 
@@ -2649,7 +2666,7 @@ function parseModelTuple(response, value) {
2649
2666
  if (tuple[0] === REACT_ELEMENT_TYPE) {
2650
2667
  // TODO: Consider having React just directly accept these arrays as elements.
2651
2668
  // Or even change the ReactElement type to be an array.
2652
- return createElement(tuple[1], tuple[2], tuple[3], tuple[4] );
2669
+ return createElement(response, tuple[1], tuple[2], tuple[3], tuple[4] );
2653
2670
  }
2654
2671
 
2655
2672
  return value;
@@ -2659,7 +2676,7 @@ function missingCall() {
2659
2676
  throw new Error('Trying to call a function from "use server" but the callServer option ' + 'was not implemented in your router runtime.');
2660
2677
  }
2661
2678
 
2662
- function createResponse(bundlerConfig, moduleLoading, callServer, encodeFormAction, nonce, temporaryReferences) {
2679
+ function createResponse(bundlerConfig, moduleLoading, callServer, encodeFormAction, nonce, temporaryReferences, findSourceMapURL) {
2663
2680
  var chunks = new Map();
2664
2681
  var response = {
2665
2682
  _bundlerConfig: bundlerConfig,
@@ -2676,7 +2693,12 @@ function createResponse(bundlerConfig, moduleLoading, callServer, encodeFormActi
2676
2693
  _rowLength: 0,
2677
2694
  _buffer: [],
2678
2695
  _tempRefs: temporaryReferences
2679
- }; // Don't inline this call because it causes closure to outline the call above.
2696
+ };
2697
+
2698
+ {
2699
+ response._debugFindSourceMapURL = findSourceMapURL;
2700
+ } // Don't inline this call because it causes closure to outline the call above.
2701
+
2680
2702
 
2681
2703
  response._fromJSON = createFromJSONCallback(response);
2682
2704
  return response;
@@ -3032,10 +3054,9 @@ function resolveErrorDev(response, id, digest, message, stack) {
3032
3054
  function resolveHint(response, code, model) {
3033
3055
  var hintModel = parseModel(response, model);
3034
3056
  dispatchHint(code, hintModel);
3035
- }
3057
+ } // eslint-disable-next-line react-internal/no-production-logging
3036
3058
 
3037
3059
  function resolveDebugInfo(response, id, debugInfo) {
3038
-
3039
3060
  var chunk = getChunk(response, id);
3040
3061
  var chunkDebugInfo = chunk._debugInfo || (chunk._debugInfo = []);
3041
3062
  chunkDebugInfo.push(debugInfo);
@@ -3044,13 +3065,16 @@ function resolveDebugInfo(response, id, debugInfo) {
3044
3065
  function resolveConsoleEntry(response, value) {
3045
3066
 
3046
3067
  var payload = parseModel(response, value);
3047
- var methodName = payload[0]; // TODO: Restore the fake stack before logging.
3048
- // const stackTrace = payload[1];
3049
- // const owner = payload[2];
3050
-
3068
+ var methodName = payload[0];
3051
3069
  var env = payload[3];
3052
3070
  var args = payload.slice(4);
3053
- printToConsole(methodName, args, env);
3071
+
3072
+ {
3073
+ // Printing with stack isn't really limited to owner stacks but
3074
+ // we gate it behind the same flag for now while iterating.
3075
+ printToConsole(methodName, args, env);
3076
+ return;
3077
+ }
3054
3078
  }
3055
3079
 
3056
3080
  function mergeBuffer(buffer, lastChunk) {
@@ -3513,8 +3537,8 @@ function createServerReference(id, callServer) {
3513
3537
  }
3514
3538
 
3515
3539
  function createFromNodeStream(stream, ssrManifest, options) {
3516
- var response = createResponse(ssrManifest.moduleMap, ssrManifest.moduleLoading, noServerCall, options ? options.encodeFormAction : undefined, options && typeof options.nonce === 'string' ? options.nonce : undefined, undefined // TODO: If encodeReply is supported, this should support temporaryReferences
3517
- );
3540
+ var response = createResponse(ssrManifest.moduleMap, ssrManifest.moduleLoading, noServerCall, options ? options.encodeFormAction : undefined, options && typeof options.nonce === 'string' ? options.nonce : undefined, undefined, // TODO: If encodeReply is supported, this should support temporaryReferences
3541
+ options && options.findSourceMapURL ? options.findSourceMapURL : undefined);
3518
3542
  stream.on('data', function (chunk) {
3519
3543
  processBinaryChunk(response, chunk);
3520
3544
  });
@@ -387,32 +387,48 @@ function error(format) {
387
387
  args[_key2 - 1] = arguments[_key2];
388
388
  }
389
389
 
390
- printWarning('error', format, args);
390
+ printWarning('error', format, args, new Error('react-stack-top-frame'));
391
391
  }
392
392
  }
393
- }
393
+ } // eslint-disable-next-line react-internal/no-production-logging
394
394
 
395
- function printWarning(level, format, args) {
395
+ function printWarning(level, format, args, currentStack) {
396
396
  // When changing this logic, you might want to also
397
397
  // update consoleWithStackDev.www.js as well.
398
398
  {
399
- var stack = ReactSharedInternals.getStackAddendum();
400
-
401
- if (stack !== '') {
402
- format += '%s';
403
- args = args.concat([stack]);
404
- } // eslint-disable-next-line react-internal/safe-string-coercion
399
+ var isErrorLogger = format === '%s\n\n%s\n' || format === '%o\n\n%s\n\n%s\n';
405
400
 
401
+ if (ReactSharedInternals.getCurrentStack) {
402
+ // We only add the current stack to the console when createTask is not supported.
403
+ // Since createTask requires DevTools to be open to work, this means that stacks
404
+ // can be lost while DevTools isn't open but we can't detect this.
405
+ var stack = ReactSharedInternals.getCurrentStack(currentStack);
406
406
 
407
- var argsWithFormat = args.map(function (item) {
408
- return String(item);
409
- }); // Careful: RN currently depends on this prefix
407
+ if (stack !== '') {
408
+ format += '%s';
409
+ args = args.concat([stack]);
410
+ }
411
+ }
410
412
 
411
- argsWithFormat.unshift('Warning: ' + format); // We intentionally don't use spread (or .apply) directly because it
413
+ if (isErrorLogger) {
414
+ // Don't prefix our default logging formatting in ReactFiberErrorLoggger.
415
+ // Don't toString the arguments.
416
+ args.unshift(format);
417
+ } else {
418
+ // TODO: Remove this prefix and stop toStringing in the wrapper and
419
+ // instead do it at each callsite as needed.
420
+ // Careful: RN currently depends on this prefix
421
+ // eslint-disable-next-line react-internal/safe-string-coercion
422
+ args = args.map(function (item) {
423
+ return String(item);
424
+ });
425
+ args.unshift('Warning: ' + format);
426
+ } // We intentionally don't use spread (or .apply) directly because it
412
427
  // breaks IE9: https://github.com/facebook/react/issues/13610
413
428
  // eslint-disable-next-line react-internal/no-production-logging
414
429
 
415
- Function.prototype.apply.call(console[level], console, argsWithFormat);
430
+
431
+ Function.prototype.apply.call(console[level], console, args);
416
432
  }
417
433
  }
418
434
 
@@ -2163,8 +2179,9 @@ function nullRefGetter() {
2163
2179
  }
2164
2180
  }
2165
2181
 
2166
- function createElement(type, key, props, owner, // DEV-only
2167
- stack) // DEV-only
2182
+ function createElement(response, type, key, props, owner, // DEV-only
2183
+ stack, // DEV-only
2184
+ validated) // DEV-only
2168
2185
  {
2169
2186
  var element;
2170
2187
 
@@ -2192,7 +2209,7 @@ stack) // DEV-only
2192
2209
  configurable: false,
2193
2210
  enumerable: false,
2194
2211
  writable: true,
2195
- value: true // This element has already been validated on the server.
2212
+ value: 1 // Whether the element has already been validated on the server.
2196
2213
 
2197
2214
  }); // debugInfo contains Server Component debug information.
2198
2215
 
@@ -2602,7 +2619,7 @@ function parseModelTuple(response, value) {
2602
2619
  if (tuple[0] === REACT_ELEMENT_TYPE) {
2603
2620
  // TODO: Consider having React just directly accept these arrays as elements.
2604
2621
  // Or even change the ReactElement type to be an array.
2605
- return createElement(tuple[1], tuple[2], tuple[3], tuple[4] );
2622
+ return createElement(response, tuple[1], tuple[2], tuple[3], tuple[4] );
2606
2623
  }
2607
2624
 
2608
2625
  return value;
@@ -2612,7 +2629,7 @@ function missingCall() {
2612
2629
  throw new Error('Trying to call a function from "use server" but the callServer option ' + 'was not implemented in your router runtime.');
2613
2630
  }
2614
2631
 
2615
- function createResponse(bundlerConfig, moduleLoading, callServer, encodeFormAction, nonce, temporaryReferences) {
2632
+ function createResponse(bundlerConfig, moduleLoading, callServer, encodeFormAction, nonce, temporaryReferences, findSourceMapURL) {
2616
2633
  var chunks = new Map();
2617
2634
  var response = {
2618
2635
  _bundlerConfig: bundlerConfig,
@@ -2629,7 +2646,12 @@ function createResponse(bundlerConfig, moduleLoading, callServer, encodeFormActi
2629
2646
  _rowLength: 0,
2630
2647
  _buffer: [],
2631
2648
  _tempRefs: temporaryReferences
2632
- }; // Don't inline this call because it causes closure to outline the call above.
2649
+ };
2650
+
2651
+ {
2652
+ response._debugFindSourceMapURL = findSourceMapURL;
2653
+ } // Don't inline this call because it causes closure to outline the call above.
2654
+
2633
2655
 
2634
2656
  response._fromJSON = createFromJSONCallback(response);
2635
2657
  return response;
@@ -2985,10 +3007,9 @@ function resolveErrorDev(response, id, digest, message, stack) {
2985
3007
  function resolveHint(response, code, model) {
2986
3008
  var hintModel = parseModel(response, model);
2987
3009
  dispatchHint(code, hintModel);
2988
- }
3010
+ } // eslint-disable-next-line react-internal/no-production-logging
2989
3011
 
2990
3012
  function resolveDebugInfo(response, id, debugInfo) {
2991
-
2992
3013
  var chunk = getChunk(response, id);
2993
3014
  var chunkDebugInfo = chunk._debugInfo || (chunk._debugInfo = []);
2994
3015
  chunkDebugInfo.push(debugInfo);
@@ -2997,13 +3018,16 @@ function resolveDebugInfo(response, id, debugInfo) {
2997
3018
  function resolveConsoleEntry(response, value) {
2998
3019
 
2999
3020
  var payload = parseModel(response, value);
3000
- var methodName = payload[0]; // TODO: Restore the fake stack before logging.
3001
- // const stackTrace = payload[1];
3002
- // const owner = payload[2];
3003
-
3021
+ var methodName = payload[0];
3004
3022
  var env = payload[3];
3005
3023
  var args = payload.slice(4);
3006
- printToConsole(methodName, args, env);
3024
+
3025
+ {
3026
+ // Printing with stack isn't really limited to owner stacks but
3027
+ // we gate it behind the same flag for now while iterating.
3028
+ printToConsole(methodName, args, env);
3029
+ return;
3030
+ }
3007
3031
  }
3008
3032
 
3009
3033
  function mergeBuffer(buffer, lastChunk) {
@@ -3466,8 +3490,8 @@ function createServerReference(id, callServer) {
3466
3490
  }
3467
3491
 
3468
3492
  function createFromNodeStream(stream, ssrManifest, options) {
3469
- var response = createResponse(ssrManifest.moduleMap, ssrManifest.moduleLoading, noServerCall, options ? options.encodeFormAction : undefined, options && typeof options.nonce === 'string' ? options.nonce : undefined, undefined // TODO: If encodeReply is supported, this should support temporaryReferences
3470
- );
3493
+ var response = createResponse(ssrManifest.moduleMap, ssrManifest.moduleLoading, noServerCall, options ? options.encodeFormAction : undefined, options && typeof options.nonce === 'string' ? options.nonce : undefined, undefined, // TODO: If encodeReply is supported, this should support temporaryReferences
3494
+ options && options.findSourceMapURL ? options.findSourceMapURL : undefined);
3471
3495
  stream.on('data', function (chunk) {
3472
3496
  processBinaryChunk(response, chunk);
3473
3497
  });