Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function analyzeUsingComponents () {
if (!process.env.UNI_OPT_SUBPACKAGES) {
return
}
const pageSet = getPageSet()
const jsonFileMap = getJsonFileMap()
// 生成所有组件引用关系
for (let name of jsonFileMap.keys()) {
const jsonObj = JSON.parse(jsonFileMap.get(name))
const usingComponents = jsonObj.usingComponents
if (!usingComponents || !pageSet.has(name)) {
continue
}
// usingComponentsMap[name] = {}
Object.keys(usingComponents).forEach(componentName => {
const componentPath = usingComponents[componentName].slice(1)
if (!usingComponentsMap[componentPath]) {
usingComponentsMap[componentPath] = new Set()
}
usingComponentsMap[componentPath].add(name)