You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
46 lines
1.0 KiB
46 lines
1.0 KiB
const parseBase = require('./base-parser')
|
|
const parsePages = require('./pages-parser')
|
|
const parseDisplay = require('./display-parser')
|
|
|
|
const parseEntry = require('./entry-parser')
|
|
|
|
function getPages(pagesJson) {
|
|
const ret = pagesJson.pages
|
|
const subPackages = pagesJson.subPackages
|
|
if (!subPackages || !subPackages.length) {
|
|
return ret
|
|
}
|
|
subPackages.forEach(({
|
|
root,
|
|
pages
|
|
}) => {
|
|
if (!Array.isArray(pages)) {
|
|
return
|
|
}
|
|
pages.forEach(page => {
|
|
page.path = root + '/' + page.path
|
|
ret.push(page)
|
|
})
|
|
})
|
|
return ret
|
|
}
|
|
|
|
module.exports = function(pagesJson, manifestJson, loader) {
|
|
|
|
const manifest = manifestJson['quickapp-native'] || {}
|
|
|
|
parseBase(manifest, manifestJson)
|
|
|
|
const pages = getPages(pagesJson)
|
|
|
|
parsePages(manifest, pages)
|
|
parseDisplay(manifest, pages, pagesJson.globalStyle)
|
|
|
|
process.UNI_ENTRY = parseEntry(pages)
|
|
|
|
global.framework.manifest = manifest
|
|
|
|
loader && loader.emitFile('manifest.json', JSON.stringify(manifest))
|
|
|
|
return ''
|
|
}
|
|
|