(coreCompiler: CoreCompiler, config: ValidatedConfig)
| 5 | import { startupCompilerLog } from './logs'; |
| 6 | |
| 7 | export const taskPrerender = async (coreCompiler: CoreCompiler, config: ValidatedConfig) => { |
| 8 | startupCompilerLog(coreCompiler, config); |
| 9 | |
| 10 | const hydrateAppFilePath = config.flags.unknownArgs[0]; |
| 11 | |
| 12 | if (typeof hydrateAppFilePath !== 'string') { |
| 13 | config.logger.error(`Missing hydrate app script path`); |
| 14 | return config.sys.exit(1); |
| 15 | } |
| 16 | |
| 17 | const srcIndexHtmlPath = config.srcIndexHtml; |
| 18 | |
| 19 | const diagnostics = await runPrerenderTask(coreCompiler, config, hydrateAppFilePath, undefined, srcIndexHtmlPath); |
| 20 | config.logger.printDiagnostics(diagnostics); |
| 21 | |
| 22 | if (diagnostics.some((d) => d.level === 'error')) { |
| 23 | return config.sys.exit(1); |
| 24 | } |
| 25 | }; |
| 26 | |
| 27 | export const runPrerenderTask = async ( |
| 28 | coreCompiler: CoreCompiler, |
no test coverage detected