Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
(process.UNI_PAGES_DEPS || (process.UNI_PAGES_DEPS = new Set())).add(normalizePath(file))
this.addDependency(file)
}
})
// TODO 与 usingComponents 放在一块读取设置
if (manifestJson.transformPx === false) {
process.UNI_TRANSFORM_PX = false
} else {
process.UNI_TRANSFORM_PX = true
}
if (process.env.UNI_PLATFORM === 'h5') {
return require('./platforms/h5')(pagesJson, manifestJson)
}
parsePages(pagesJson, function (page) {
updatePageJson(page.path, renameUsingComponents(parseStyle(page.style)))
}, function (root, page) {
updatePageJson(normalizePath(path.join(root, page.path)), renameUsingComponents(
parseStyle(page.style, root)
))
})
const jsonFiles = require('./platforms/' + process.env.UNI_PLATFORM)(pagesJson, manifestJson)
if (jsonFiles && jsonFiles.length) {
if (process.env.UNI_USING_NATIVE) {
let appConfigContent = ''
jsonFiles.forEach(jsonFile => {
if (jsonFile) {
if (jsonFile.name === 'app-config.js') {
appConfigContent = jsonFile.content
module.exports = function (pagesJson, manifestJson, project = {}) {
const app = {
pages: [],
subPackages: []
}
const subPackages = {}
parsePages(pagesJson, function (page) {
app.pages.push(page.path)
}, function (root, page, subPackage) {
if (!isSupportSubPackages()) { // 不支持分包
app.pages.push(normalizePath(path.join(root, page.path)))
} else {
if (!subPackages[root]) {
subPackages[root] = {
root,
pages: []
}
Object.keys(subPackage).forEach(name => {
if (['root', 'pages'].indexOf(name) === -1) {
subPackages[root][name] = subPackage[name]
}
})
}
module.exports = function (pagesJson, manifestJson) {
const app = {
pages: [],
subPackages: []
}
const subPackages = {}
parsePages(pagesJson, function (page) {
app.pages.push(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)
})
if (manifestJson.transformPx === false) {
process.UNI_TRANSFORM_PX = false
} else {
process.UNI_TRANSFORM_PX = true
}
if (process.env.UNI_PLATFORM === 'h5') {
return require('./platforms/h5')(pagesJson, manifestJson)
}
const changedEmitFiles = []
function checkPageEmitFile (pagePath, pageStyle) {
checkEmitFile(pagePath, parseStyle(pageStyle), changedEmitFiles)
}
parsePages(pagesJson, function (page) {
checkPageEmitFile(page.path, page.style)
}, function (root, page) {
checkPageEmitFile(normalizePath(path.join(root, page.path)), page.style)
})
const jsonFiles = require('./platforms/' + process.env.UNI_PLATFORM)(pagesJson, manifestJson)
if (jsonFiles && jsonFiles.length) {
jsonFiles.forEach(jsonFile => {
jsonFile && checkEmitFile(jsonFile.name, jsonFile.content, changedEmitFiles)
})
}
changedEmitFiles.forEach(name => {
this.emitFile(name + '.json', emitFileCaches[name])
})