提交 2c706286 编写于 作者: fxy060608's avatar fxy060608

feat(mp-alipay): support subPackages

上级 ece5ee98
{
"name": "@dcloudio/uni-cli-shared",
"version": "1.0.0-alpha-22120190814002",
"version": "0.2.987",
"description": "uni-cli-shared",
"main": "lib/index.js",
"files": [
......
const path = require('path')
const {
parsePages,
normalizePath
parsePages
} = require('@dcloudio/uni-cli-shared')
const {
......@@ -13,10 +10,10 @@ const {
const pagesJson2AppJson = {
'globalStyle': function (name, value, json) {
json['window'] = parseStyle(value)
if (json['window'].usingComponents) {
json['usingComponents'] = json['window'].usingComponents
delete json['window']['usingComponents']
json['window'] = parseStyle(value)
if (json['window'].usingComponents) {
json['usingComponents'] = json['window'].usingComponents
delete json['window']['usingComponents']
}
},
'tabBar': function (name, value, json) {
......@@ -34,13 +31,31 @@ function copyToJson (json, fromJson, options) {
module.exports = function (pagesJson, manifestJson) {
const app = {
pages: []
}
pages: [],
subPackages: []
}
const subPackages = {}
parsePages(pagesJson, function (page) {
app.pages.push(page.path)
}, function (root, page) {
app.pages.push(normalizePath(path.join(root, page.path)))
}, function (root, page, subPackage) {
if (!subPackages[root]) {
subPackages[root] = {
root,
pages: []
}
Object.keys(subPackage).forEach(name => {
if (['root', 'pages'].indexOf(name) === -1) {
subPackages[root][name] = subPackage[name]
}
})
}
subPackages[root].pages.push(page.path)
})
Object.keys(subPackages).forEach(root => {
app.subPackages.push(subPackages[root])
})
copyToJson(app, pagesJson, pagesJson2AppJson)
......
{
"name": "@dcloudio/webpack-uni-pages-loader",
"version": "0.2.872",
"version": "0.2.873",
"description": "uni-app pages.json loader",
"main": "lib/index.js",
"files": [
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册