@nx-plugins/vite
Version:
The Nx Plugin for Vite that contains executors, generators, and utilities for managing Vite applications and libraries within an Nx workspace.
78 lines • 2.87 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.keepRunning = void 0;
const tslib_1 = require("tslib");
const vite_1 = require("vite");
function runExecutor(options) {
return tslib_1.__asyncGenerator(this, arguments, function* runExecutor_1() {
const server = yield tslib_1.__await((0, vite_1.createServer)({
configFile: options.viteConfig,
server: {
open: options.open,
host: options.host,
port: options.port,
https: options.https,
cors: options.cors,
strictPort: options.strictPort,
base: options.base,
},
optimizeDeps: {
force: options.force,
},
logLevel: options.logLevel,
clearScreen: options.clearScreen,
mode: options.mode,
})
// if (!server.httpServer) {
// throw new Error('HTTP server not available')
// }
);
// if (!server.httpServer) {
// throw new Error('HTTP server not available')
// }
yield tslib_1.__await(server.listen()
// const info = server.config.logger.info
// const viteStartTime = global.__vite_start_time ?? false
// const startupDurationString = viteStartTime
// ? chalk.dim(
// `ready in ${chalk.white(
// chalk.bold(Math.ceil(performance.now() - viteStartTime))
// )} ms`
// )
// : ''
// info(
// `\n ${chalk.green(
// `${chalk.bold('VITE')} v${version}`
// )} ${startupDurationString}\n`,
// { clear: !server.config.logger.hasWarned }
// )
);
// const info = server.config.logger.info
// const viteStartTime = global.__vite_start_time ?? false
// const startupDurationString = viteStartTime
// ? chalk.dim(
// `ready in ${chalk.white(
// chalk.bold(Math.ceil(performance.now() - viteStartTime))
// )} ms`
// )
// : ''
// info(
// `\n ${chalk.green(
// `${chalk.bold('VITE')} v${version}`
// )} ${startupDurationString}\n`,
// { clear: !server.config.logger.hasWarned }
// )
server.printUrls();
yield yield tslib_1.__await({
success: true,
});
yield tslib_1.__await((0, exports.keepRunning)());
});
}
exports.default = runExecutor;
const keepRunning = () => {
// eslint-disable-next-line @typescript-eslint/no-empty-function
return new Promise(() => { });
};
exports.keepRunning = keepRunning;
//# sourceMappingURL=executor.js.map