"use strict";var __importDefault=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(exports,"__esModule",{value:!0});const commonData_1=require("../../../types/commonData"),path_1=__importDefault(require("path")),fs_extra_1=__importDefault(require("fs-extra")),common_1=require("../../../config/common"),compile_1=__importDefault(require("../compile"));class GadgetCompile extends compile_1.default{getPackVersion(){const{appInfo:e}=this.options;return"upgrade"===e.frameWorkType?"upgrade":"darwin"===process.platform||(0,common_1.featureGating)("lark.gadget.compile.ide.win.switch")?"new":"default"}start(){const{type:e,sourcePath:t,distPath:o,appInfo:a}=this.options,{pluginRoot:i}=fs_extra_1.default.readJSONSync(path_1.default.join(t,"project.config.json"));if(i){const r=path_1.default.join(t,i),p=path_1.default.join(o||r,"../",i),c={type:"compile",data:{packVersion:this.getPackVersion(),type:"plugin",watch:"watch"===e||"live"===e,projectDir:t,outputDir:p,context:{isIDE:!0,compileType:"splits",packageType:a.packageType,remoteDebugUrl:a.remoteDebugUrl,forceMinify:!1,sourceMapType:"INLINE",needComponentList:!0,needSubPackage:!1,showPerformance:!0,disableSafeCheck:!0}}};this.startProcess(c)}const r={type:"compile",data:{packVersion:this.getPackVersion(),type:commonData_1.AppTypeEnum.Gadget,watch:"watch"===e||"live"===e,projectDir:t,outputDir:o,context:{isIDE:!0,compileType:"splits",packageType:a.packageType,remoteDebugUrl:a.remoteDebugUrl,forceMinify:!1,sourceMapType:"INLINE",needComponentList:!0,needSubPackage:!1,showPerformance:!0,disableSafeCheck:!0}}};return this.startProcess(r)}get events(){return{live:{compile:"gadget_preview_compile",first:"gadget_preview_first_compile",watch:"gadget_preview_watch_compile"},force:{compile:"gadget_force_compile",first:"gadget_force_first_compile",watch:"gadget_force_watch_compile"},debug:{compile:"gadget_remote_debug",first:"gadget_remote_debug_first_compile",watch:"gadget_remote_debug_watch_compile"},watch:{compile:"gadget_develop",first:"gadget_develop_first_compile",watch:"gadget_develop_watch_compile"}}[this.compileType]}}exports.default=GadgetCompile;