"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
    return new (P || (P = Promise))(function (resolve, reject) {
        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
        function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
        step((generator = generator.apply(thisArg, _arguments || [])).next());
    });
};
Object.defineProperty(exports, "__esModule", { value: true });
const Falcon = require("./falcon-builder");
const Vue = require("./vue-builder");
const Utils = require("../../util/src");
const Project = require("../../project/src");
class ACPack {
    buildProject(path, output) {
        return __awaiter(this, void 0, void 0, function* () {
            const pkg = Utils.ACUtils.pickProjectPackage(path);
            switch (pkg.type) {
                case Project.ProjectType.Application:
                    if (Project.ProjectSubType.App === pkg.subtype) {
                        const builder = new Vue.VueBuilder();
                        const result = yield builder.build(path, output);
                        return Promise.resolve({ success: true, message: result });
                    }
                    return Promise.reject(new Error(`无效的待编译项目子类型 [${pkg.subtype}] [${path}]`));
                case Project.ProjectType.Falcons:
                    const builder = new Falcon.FalconBuilder();
                    const result = yield builder.build(path, output);
                    return Promise.resolve({ success: true, message: result });
                default:
                    return Promise.reject(new Error(`未发现可编译项目 [${path}]`));
            }
        });
    }
}
exports.ACPack = ACPack;
//# sourceMappingURL=pack.js.map