"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
function serve(env, inputs, options) {
    return tslib_1.__awaiter(this, void 0, void 0, function* () {
        yield env.hooks.fire('watch:before', { env });
        const serveOptions = {
            env,
            options: Object.assign({}, options, { externalIpRequired: options.broadcast }),
        };
        let serverDetails;
        const project = yield env.project.load();
        if (project.type === 'ionic1') {
            const { serve } = yield Promise.resolve().then(function () { return require('../lib/ionic1/serve'); });
            serverDetails = yield serve(serveOptions);
        }
        else if (project.type === 'ionic-angular') {
            const { serve } = yield Promise.resolve().then(function () { return require('../lib/ionic-angular/serve'); });
            serverDetails = yield serve(serveOptions);
        }
        else {
            throw new Error('Unknown project.'); // TODO
        }
        return serverDetails;
    });
}
exports.serve = serve;
