"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.formatCISetting=exports.isUndefined=exports.checkIsUseCompilerPlugins=exports.isGameApp=exports.CompileSettingsKeysInProjectConfig=void 0;const types_1=require("../../types"),projectconfig_1=require("../../modules/corecompiler/original/json/projectconfig");function isGameApp(i){return i.type===types_1.EProjectType.miniGame||i.type===types_1.EProjectType.miniGamePlugin}exports.CompileSettingsKeysInProjectConfig=["es6","es7","enhance","minified","minify","codeProtect","uglifyFileName","postcss","minifyJS","minifyWXML","minifyWXSS","autoPrefixWXSS","disableUseStrict","compileWorklet"],exports.isGameApp=isGameApp;const checkIsUseCompilerPlugins=i=>{var e,n,t;return!isGameApp(i)||(null===(e=i.setting)||void 0===e?void 0:e.condition)||((null===(n=i.setting)||void 0===n?void 0:n.useCompilerPlugins)||[]).length>0||(null===(t=i.setting)||void 0===t?void 0:t.swc)};function isUndefined(i){return void 0===i}function formatCISetting(i,e){var n,t,s,o,d,f,r,l,c;const m=(0,projectconfig_1.getProjectConfigJSON)(i);if(e.useProjectConfig)return Object.assign(Object.assign({},m.setting),{minifyWXSS:!1!==e.minifyWXSS&&(!!e.minify||(isUndefined(e.minifyWXSS)?null===(n=m.setting)||void 0===n?void 0:n.minifyWXSS:!!e.minifyWXSS)),minifyWXML:!1!==e.minifyWXML&&(!!e.minify||(isUndefined(e.minifyWXML)?null===(t=m.setting)||void 0===t?void 0:t.minifyWXML:!!e.minifyWXML)),minified:!1!==e.minifyJS&&(!!e.minify||(isUndefined(e.minifyJS)?null===(s=m.setting)||void 0===s?void 0:s.minified:!!e.minifyJS)),postcss:isUndefined(e.autoPrefixWXSS)?null===(o=m.setting)||void 0===o?void 0:o.postcss:!!e.autoPrefixWXSS,disableUseStrict:isUndefined(e.disableUseStrict)?null===(d=m.setting)||void 0===d?void 0:d.disableUseStrict:!!e.disableUseStrict,compileWorklet:isUndefined(e.compileWorklet)?null===(f=m.setting)||void 0===f?void 0:f.compileWorklet:!!e.compileWorklet,uglifyFileName:isUndefined(e.codeProtect)?null===(r=m.setting)||void 0===r?void 0:r.uglifyFileName:!!e.codeProtect,es6:isUndefined(e.es6)&&isUndefined(e.es7)?null===(l=m.setting)||void 0===l?void 0:l.es6:!!e.es6||!!e.es7,enhance:isUndefined(e.es6)&&isUndefined(e.es7)?null===(c=m.setting)||void 0===c?void 0:c.enhance:!!e.es6||!!e.es7});const p=Object.assign({},m.setting);for(const i in p)exports.CompileSettingsKeysInProjectConfig.indexOf(i)>-1&&delete p[i];return Object.assign(Object.assign({},p),{minifyWXSS:!1!==e.minifyWXSS&&(e.minify||!!e.minifyWXSS),minifyWXML:!1!==e.minifyWXML&&(e.minify||!!e.minifyWXML),minified:!1!==e.minifyJS&&(e.minify||!!e.minifyJS),postcss:!!e.autoPrefixWXSS,disableUseStrict:!!e.disableUseStrict,compileWorklet:!!e.compileWorklet,uglifyFileName:!!e.codeProtect,es6:!!e.es6||!!e.es7,enhance:!!e.es6||!!e.es7})}exports.checkIsUseCompilerPlugins=checkIsUseCompilerPlugins,exports.isUndefined=isUndefined,exports.formatCISetting=formatCISetting;