(request: Request)
| 5848 | } |
| 5849 | |
| 5850 | function flushCompletedChunks(request: Request): void { |
| 5851 | if (__DEV__ && request.debugDestination !== null) { |
| 5852 | const debugDestination = request.debugDestination; |
| 5853 | beginWriting(debugDestination); |
| 5854 | try { |
| 5855 | const debugChunks = request.completedDebugChunks; |
| 5856 | let i = 0; |
| 5857 | for (; i < debugChunks.length; i++) { |
| 5858 | request.pendingDebugChunks--; |
| 5859 | const chunk = debugChunks[i]; |
| 5860 | writeChunkAndReturn(debugDestination, chunk); |
| 5861 | } |
| 5862 | debugChunks.splice(0, i); |
| 5863 | } finally { |
| 5864 | completeWriting(debugDestination); |
| 5865 | } |
| 5866 | flushBuffered(debugDestination); |
| 5867 | } |
| 5868 | const destination = request.destination; |
| 5869 | if (destination !== null) { |
| 5870 | beginWriting(destination); |
| 5871 | try { |
| 5872 | // We emit module chunks first in the stream so that |
| 5873 | // they can be preloaded as early as possible. |
| 5874 | const importsChunks = request.completedImportChunks; |
| 5875 | let i = 0; |
| 5876 | for (; i < importsChunks.length; i++) { |
| 5877 | request.pendingChunks--; |
| 5878 | const chunk = importsChunks[i]; |
| 5879 | const keepWriting: boolean = writeChunkAndReturn(destination, chunk); |
| 5880 | if (!keepWriting) { |
| 5881 | request.destination = null; |
| 5882 | i++; |
| 5883 | break; |
| 5884 | } |
| 5885 | } |
| 5886 | importsChunks.splice(0, i); |
| 5887 | |
| 5888 | // Next comes hints. |
| 5889 | const hintChunks = request.completedHintChunks; |
| 5890 | i = 0; |
| 5891 | for (; i < hintChunks.length; i++) { |
| 5892 | const chunk = hintChunks[i]; |
| 5893 | const keepWriting: boolean = writeChunkAndReturn(destination, chunk); |
| 5894 | if (!keepWriting) { |
| 5895 | request.destination = null; |
| 5896 | i++; |
| 5897 | break; |
| 5898 | } |
| 5899 | } |
| 5900 | hintChunks.splice(0, i); |
| 5901 | |
| 5902 | // Debug meta data comes before the model data because it will often end up blocking the model from |
| 5903 | // completing since the JSX will reference the debug data. |
| 5904 | if (__DEV__ && request.debugDestination === null) { |
| 5905 | const debugChunks = request.completedDebugChunks; |
| 5906 | i = 0; |
| 5907 | for (; i < debugChunks.length; i++) { |
no test coverage detected