!function(require, directRequire){ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.analyseCode=exports.transCompileType=void 0;const tslib_1=require("tslib"),projectconfig_1=require("../core/json/projectconfig"),code_analyse_1=require("../vendor/code-analyse"),path_1=tslib_1.__importDefault(require("path"));function transCompileType(e){if("miniProgram"===e.type)return"miniprogram";if("miniProgramPlugin"===e.type)return"plugin";if("miniGame"===e.type)return"game";if("miniGamePlugin"===e.type)return"gamePlugin";throw new Error("unknown compile type "+e.type)}exports.transCompileType=transCompileType;class LogPlugin{constructor(){this.name="LogPlugin"}onDepResolveFailed(e,o){var n,i;console.warn(`${null===(n=e.originModule)||void 0===n?void 0:n.type} module ${null===(i=e.originModule)||void 0===i?void 0:i.path} resolve dep failed`),console.warn(o)}onModuleBuildFailed(e,o,n){console.warn(`${e.type} module ${e.path} build failed`),console.warn(n)}}async function analyseCode(e,o){const n=(0,projectconfig_1.getProjectConfigJSON)(e),i=transCompileType(e);if("gamePlugin"===i)throw new Error("gamePlugin is not support yet!");let r="plugin"===i?n.pluginRoot:n.miniprogramRoot;r=r?path_1.default.posix.join(e.projectPath,r):e.projectPath;const t=new code_analyse_1.Analyzer({root:r,type:i,plugins:(null==o?void 0:o.silent)?[]:[new LogPlugin]});return await t.analyse(),t.serialize()}exports.analyseCode=analyseCode; }(require("licia/lazyImport")(require), require)