( request: Request, id: number, name: string, start: number, end: number, value: ?Promise<mixed>, env: ?string, owner: ?ReactComponentInfo, stack: ?ReactStackTrace, )
| 4343 | } |
| 4344 | |
| 4345 | function emitIOInfoChunk( |
| 4346 | request: Request, |
| 4347 | id: number, |
| 4348 | name: string, |
| 4349 | start: number, |
| 4350 | end: number, |
| 4351 | value: ?Promise<mixed>, |
| 4352 | env: ?string, |
| 4353 | owner: ?ReactComponentInfo, |
| 4354 | stack: ?ReactStackTrace, |
| 4355 | ): void { |
| 4356 | if (!__DEV__) { |
| 4357 | // These errors should never make it into a build so we don't need to encode them in codes.json |
| 4358 | // eslint-disable-next-line react-internal/prod-error-codes |
| 4359 | throw new Error( |
| 4360 | 'emitIOInfoChunk should never be called in production mode. This is a bug in React.', |
| 4361 | ); |
| 4362 | } |
| 4363 | |
| 4364 | let objectLimit = 10; |
| 4365 | if (stack) { |
| 4366 | objectLimit += stack.length; |
| 4367 | } |
| 4368 | |
| 4369 | const relativeStartTimestamp = start - request.timeOrigin; |
| 4370 | const relativeEndTimestamp = end - request.timeOrigin; |
| 4371 | const debugIOInfo: Omit<ReactIOInfo, 'debugTask' | 'debugStack'> = { |
| 4372 | name: name, |
| 4373 | start: relativeStartTimestamp, |
| 4374 | end: relativeEndTimestamp, |
| 4375 | }; |
| 4376 | if (env != null) { |
| 4377 | // $FlowFixMe[cannot-write] |
| 4378 | debugIOInfo.env = env; |
| 4379 | } |
| 4380 | if (stack != null) { |
| 4381 | // $FlowFixMe[cannot-write] |
| 4382 | debugIOInfo.stack = stack; |
| 4383 | } |
| 4384 | if (owner != null) { |
| 4385 | // $FlowFixMe[cannot-write] |
| 4386 | debugIOInfo.owner = owner; |
| 4387 | } |
| 4388 | if (value !== undefined) { |
| 4389 | // $FlowFixMe[cannot-write] |
| 4390 | debugIOInfo.value = value; |
| 4391 | } |
| 4392 | const json: string = serializeDebugModel(request, objectLimit, debugIOInfo); |
| 4393 | const row = id.toString(16) + ':J' + json + '\n'; |
| 4394 | const processedChunk = stringToChunk(row); |
| 4395 | request.completedDebugChunks.push(processedChunk); |
| 4396 | } |
| 4397 | |
| 4398 | function outlineIOInfo(request: Request, ioInfo: ReactIOInfo): void { |
| 4399 | if (request.writtenObjects.has(ioInfo)) { |
no test coverage detected