mini-entry
Advanced tools
Comparing version 0.0.10 to 0.0.11
@@ -5,3 +5,3 @@ /* | ||
* @Last Modified by: youzhao.zhou | ||
* @Last Modified time: 2021-04-22 12:17:15 | ||
* @Last Modified time: 2021-04-22 15:01:40 | ||
* @Description 获取webpack入口 | ||
@@ -68,3 +68,6 @@ * | ||
if (tmpConfigFiles.length === 0) { | ||
return {}; | ||
return { | ||
entry: {}, | ||
subPackagesDir: [], | ||
}; | ||
} | ||
@@ -75,3 +78,3 @@ | ||
// 解析app.json文件,获取app.json中配置的页面和组件信息 | ||
const appEntry = parseApp(appEntryFilePath); | ||
const { entry: appEntry, subPackagesDir } = parseApp(appEntryFilePath); | ||
// 解析app.json中获取到的所有json配置文件 | ||
@@ -89,4 +92,7 @@ const componentEntry = parseComponentInPageAndComponent(entryConfigPath); | ||
return { | ||
...entry, | ||
...result, | ||
entry: { | ||
...entry, | ||
...result.entry, | ||
}, | ||
subPackagesDir: [...subPackagesDir, ...result.subPackagesDir], | ||
}; | ||
@@ -128,3 +134,5 @@ } | ||
const mainPages = parsePages(configData.pages); | ||
const subPages = parseSubPages(configData.subpackages); | ||
const { entry: subPages, subPackagesDir } = parseSubPages( | ||
configData.subpackages || configData.subPackages, | ||
); | ||
@@ -144,3 +152,6 @@ const entryFileAbsolutePath = join(process.cwd(), configFile); | ||
return pages; | ||
return { | ||
entry: pages, | ||
subPackagesDir, | ||
}; | ||
} | ||
@@ -245,7 +256,13 @@ | ||
if (!Array.isArray(pages)) { | ||
return {}; | ||
return { | ||
entry: {}, | ||
subPackagesDir: [], | ||
}; | ||
} | ||
const subPackagesDir = []; | ||
const subPages = pages | ||
.map((page) => { | ||
subPackagesDir.push(page.root); | ||
return page.pages.map((subPage) => { | ||
@@ -258,3 +275,7 @@ return join(page.root || "", subPage); | ||
}, []); | ||
return parsePages(subPages); | ||
return { | ||
entry: parsePages(subPages), | ||
subPackagesDir, | ||
}; | ||
} | ||
@@ -374,7 +395,19 @@ | ||
const entry = getAllEntry(paths); | ||
const { entry, subPackagesDir } = getAllEntry(paths); | ||
return entry; | ||
const jsonFiles = {}; | ||
Object.keys(entry).forEach((item) => { | ||
const jsonFile = entry[item].find((element) => | ||
/\.(json)$/.test(String(element)), | ||
); | ||
if (jsonFile) { | ||
jsonFiles[item] = jsonFile; | ||
} | ||
}); | ||
return { entry, jsonFiles, subPackagesDir }; | ||
} | ||
module.exports = getEntry; |
{ | ||
"name": "mini-entry", | ||
"version": "0.0.10", | ||
"version": "0.0.11", | ||
"description": "解析小程序json", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
14576
506