"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.getCompiler=exports.getOriginalCompiler=void 0,exports.getBuilder=getBuilder;const tslib_1=require("tslib"),originalCompiler_1=require("../modules/corecompiler/originalCompiler"),locales_1=tslib_1.__importDefault(require("../utils/locales/locales")),index_1=require("../modules/index"),precompileProject_1=require("../project/advance/precompileProject"),precompiler_1=require("../modules/precompiler"),tools_1=require("./utils/tools");let compilerInstance;const getOriginalCompiler=async e=>{if(!compilerInstance||!compilerInstance.project||compilerInstance.project.projectPath!==e.projectPath){const r=new precompiler_1.ConditionCompiler(e,void 0,void 0),i=new precompileProject_1.PreCompileProject(e,r,{targetPlatform:"mini-weixin"});compilerInstance=new originalCompiler_1.OriginalCompiler(i)}return await compilerInstance.ready(),compilerInstance.setLocale(locales_1.default.getLocale()),compilerInstance};async function getBuilder(e,r){const i=new index_1.Builder(e,Object.assign({devtoolMessagehub:{showBuildLog:(e,r,i)=>{console.error("msg-"+e,"compile",r,i)}}},r));return await i.ready(),i}exports.getOriginalCompiler=getOriginalCompiler;const getCompiler=async(e,r,i={})=>{e.setting=(0,tools_1.formatCISetting)(e,r);return(await getBuilder(e,Object.assign({},i))).getCompiler()};exports.getCompiler=getCompiler;