function execute(options, context) {
        return __awaiter(this, void 0, void 0, function* () {
            const browserTarget = architect_1.targetFromTargetString(options.browserTarget);
            const browserOptions = (yield context.getTargetOptions(browserTarget));
            const routes = yield utils_2.getRoutes(options, browserOptions.tsConfig, context);
            if (!routes.length) {
                throw new Error(`Could not find any routes to generate.`);
            }
            const { result } = yield context.scheduleTarget(browserTarget, {
                watch: false,
                serviceWorker: false,
            });
            const { success, error, outputPaths } = (yield result);
            if (!success) {
                return { success, error };
            }
            const worker = createWorker(browserOptions);
            try {
                for (const outputPath of outputPaths) {
                    const spinner = ora(`Prerendering ${routes.length} route(s) to ${outputPath}...`).start();
                    const staticServer = yield createStaticServer(outputPath);
                    try {
                        yield Promise.all(routes.map((route) => worker.render({
                            outputPath,
                            route,
                            port: staticServer.port,
                        })));
                        spinner.succeed(`Prerendering routes to ${outputPath} complete.`);
                        if (browserOptions.serviceWorker) {
                            const swResult = yield generateServiceWorker(context, outputPath, browserOptions);
                            if (!swResult.success) {
                                return swResult;
                            }
                        }
                    }
                    catch (error) {
                        spinner.fail(`Prerendering routes to ${outputPath} failed.`);
                        return { success: false, error: error.message };
                    }
                    finally {
                        yield staticServer.close();
                    }
                }
                return { success: true };
            }
            finally {
                // const _ = is a workaround to disable tsetse must use promises rule.
                // tslint:disable-next-line: no-floating-promises
                const _ = worker.end();
            }
        });
    }
/**
     * Builds the browser and server, then renders each route in options.routes
     * and writes them to prerender/<route>/index.html for each output path in
     * the browser result.
     */
Builds the browser and server, then renders each route in options.routes
and writes them to prerender//index.html for each output path in
the browser result.
Builds the browser and server then renders each route in options . routes and writes them to prerender // index . html for each output path in the browser result .
function execute(options, context) {
        return __awaiter(this, void 0, void 0, function* () {
            const browserTarget = architect_1.targetFromTargetString(options.browserTarget);
            const browserOptions = (yield context.getTargetOptions(browserTarget));
            const routes = yield utils_2.getRoutes(options, browserOptions.tsConfig, context);
            if (!routes.length) {
                throw new Error(`Could not find any routes to generate.`);
            }
            const { result } = yield context.scheduleTarget(browserTarget, {
                watch: false,
                serviceWorker: false,
            });
            const { success, error, outputPaths } = (yield result);
            if (!success) {
                return { success, error };
            }
            const worker = createWorker(browserOptions);
            try {
                for (const outputPath of outputPaths) {
                    const spinner = ora(`Prerendering ${routes.length} route(s) to ${outputPath}...`).start();
                    const staticServer = yield createStaticServer(outputPath);
                    try {
                        yield Promise.all(routes.map((route) => worker.render({
                            outputPath,
                            route,
                            port: staticServer.port,
                        })));
                        spinner.succeed(`Prerendering routes to ${outputPath} complete.`);
                        if (browserOptions.serviceWorker) {
                            const swResult = yield generateServiceWorker(context, outputPath, browserOptions);
                            if (!swResult.success) {
                                return swResult;
                            }
                        }
                    }
                    catch (error) {
                        spinner.fail(`Prerendering routes to ${outputPath} failed.`);
                        return { success: false, error: error.message };
                    }
                    finally {
                        yield staticServer.close();
                    }
                }
                return { success: true };
            }
            finally {
                const _ = worker.end();
            }
        });
    }
function execute ( options , context ) { return __awaiter ( this , void 0 , void 0 , function * ( ) { const browserTarget = architect_1 . targetFromTargetString ( options . browserTarget ) ; const browserOptions = ( yield context . getTargetOptions ( browserTarget ) ) ; const routes = yield utils_2 . getRoutes ( options , browserOptions . tsConfig , context ) ; if ( ! routes . length ) { throw new Error ( ` ` ) ; } const { result } = yield context . scheduleTarget ( browserTarget , { watch : false , serviceWorker : false , } ) ; const { success , error , outputPaths } = ( yield result ) ; if ( ! success ) { return { success , error } ; } const worker = createWorker ( browserOptions ) ; try { for ( const outputPath of outputPaths ) { const spinner = ora ( ` ${ routes . length } ${ outputPath } ` ) . start ( ) ; const staticServer = yield createStaticServer ( outputPath ) ; try { yield Promise . all ( routes . map ( ( route ) => worker . render ( { outputPath , route , port : staticServer . port , } ) ) ) ; spinner . succeed ( ` ${ outputPath } ` ) ; if ( browserOptions . serviceWorker ) { const swResult = yield generateServiceWorker ( context , outputPath , browserOptions ) ; if ( ! swResult . success ) { return swResult ; } } } catch ( error ) { spinner . fail ( ` ${ outputPath } ` ) ; return { success : false , error : error . message } ; } finally { yield staticServer . close ( ) ; } } return { success : true } ; } finally { const _ = worker . end ( ) ; } } ) ; }
Builds the browser and server, then renders each route in options.routes
 and writes them to prerender/<route>/index.html for each output path in
 the browser result.
Builds the browser and server then renders each route in options . routes and writes them to prerender / <route > / index . html for each output path in the browser result .
// const _ = is a workaround to disable tsetse must use promises rule. // tslint:disable-next-line: no-floating-promises