"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.VueServeRunner = void 0;
const utils_network_1 = require("@ionic/utils-network");
const chalk = require("chalk");
const errors_1 = require("../../errors");
const serve_1 = require("../../serve");
class VueServeRunner extends serve_1.ServeRunner {
constructor(e) {
super();
this.e = e;
}
async getCommandMetadata() {
return {};
}
modifyOpenUrl(url, options) {
return url;
}
async serveProject(options) {
const cli = this.getPkgManagerServeCLI();
if (!await cli.resolveScript()) {
throw new errors_1.RunnerException(`Cannot perform serve.\n` +
`Since you're using the ${chalk.bold('Vue')} project type, you must provide the ${chalk.green(cli.script)} npm script so the Ionic CLI can serve your project.`);
}
const [externalIP, availableInterfaces] = await this.selectExternalIP(options);
const port = options.port = await utils_network_1.findClosestOpenPort(options.port);
await cli.serve(options);
return {
custom: false,
protocol: 'http',
localAddress: 'localhost',
externalAddress: externalIP,
externalNetworkInterfaces: availableInterfaces,
port,
externallyAccessible: ![serve_1.BIND_ALL_ADDRESS, ...serve_1.LOCAL_ADDRESSES].includes(externalIP),
};
}
}
exports.VueServeRunner = VueServeRunner;