* 分析编译源代码 * @param {string} code 要分析的源代码 * @returns {Promise }
(code)
| 28 | forceFormat: options.forceFormat || options.scriptFormat, |
| 29 | noAstFallback: options.noAstFallback, |
| 30 | }); |
| 31 | logger.info('代码分析完成'); |
| 32 | return result; |
| 33 | } catch (err) { |
| 34 | logger.error('分析编译代码时出错:', err); |
| 35 | throw err; |
| 36 | } |
| 37 | }, |
| 38 | |
| 39 | /** |
| 40 | * 仅提取模块(不写盘),供测试与工具使用 |
| 41 | * @param {string} code |
| 42 | * @param {object} [options] |
| 43 | */ |
| 44 | extractModules(code, options = {}) { |
| 45 | return extractModulesOnly(code, options); |
| 46 | }, |
| 47 | }; |
| 48 | |
| 49 | module.exports = { codeAnalyzer }; |