MCPcopy
hub / github.com/facebook/react / normalizeIOInfo

Function normalizeIOInfo

packages/internal-test-utils/debugInfo.js:47–88  ·  view source on GitHub ↗
(config: DebugInfoConfig, ioInfo)

Source from the content-addressed store, hash-verified

45}
46
47function normalizeIOInfo(config: DebugInfoConfig, ioInfo) {
48 const {debugTask, debugStack, debugLocation, ...copy} = ioInfo;
49 if (ioInfo.stack) {
50 copy.stack = config.useV8Stack
51 ? formatV8Stack(ioInfo.stack)
52 : normalizeStack(ioInfo.stack);
53 }
54 if (ioInfo.owner) {
55 copy.owner = normalizeDebugInfo(config, ioInfo.owner);
56 }
57 if (typeof ioInfo.start === 'number' && config.useFixedTime) {
58 copy.start = 0;
59 }
60 if (typeof ioInfo.end === 'number' && config.useFixedTime) {
61 copy.end = 0;
62 }
63 const promise = ioInfo.value;
64 if (promise) {
65 promise.then(); // init
66 if (promise.status === 'fulfilled') {
67 if (ioInfo.name === 'RSC stream') {
68 copy.byteSize = 0;
69 copy.value = {
70 value: 'stream',
71 };
72 } else {
73 copy.value = {
74 value: promise.value,
75 };
76 }
77 } else if (promise.status === 'rejected') {
78 copy.value = {
79 reason: promise.reason,
80 };
81 } else {
82 copy.value = {
83 status: promise.status,
84 };
85 }
86 }
87 return copy;
88}
89
90function normalizeDebugInfo(config: DebugInfoConfig, original) {
91 const {debugTask, debugStack, debugLocation, ...debugInfo} = original;

Callers 1

normalizeDebugInfoFunction · 0.85

Calls 4

formatV8StackFunction · 0.85
normalizeStackFunction · 0.85
normalizeDebugInfoFunction · 0.85
thenMethod · 0.65

Tested by

no test coverage detected