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

feat: add BROWSERSLIST_CONFIG

上级 c7d99b2c
...@@ -7,3 +7,4 @@ unpackage/ ...@@ -7,3 +7,4 @@ unpackage/
!packages/uni-app-plus/dist !packages/uni-app-plus/dist
package-lock.json package-lock.json
!packages/vue-cli-plugin-uni/packages/**/* !packages/vue-cli-plugin-uni/packages/**/*
tests/package.json
...@@ -58,7 +58,9 @@ if (process.env.UNI_CLOUD_SPACES) { ...@@ -58,7 +58,9 @@ if (process.env.UNI_CLOUD_SPACES) {
const hasUniCloudSpace = spaces.length > 0 const hasUniCloudSpace = spaces.length > 0
if (spaces.length === 1) { if (spaces.length === 1) {
const space = spaces[0] const space = spaces[0]
console.log(uniI18n.__('pluginUni.currentProjectDefaultSpaceId', { 0: space.id })) console.log(uniI18n.__('pluginUni.currentProjectDefaultSpaceId', {
0: space.id
}))
} }
if ( if (
...@@ -66,13 +68,17 @@ if (process.env.UNI_CLOUD_SPACES) { ...@@ -66,13 +68,17 @@ if (process.env.UNI_CLOUD_SPACES) {
isH5 && isH5 &&
isProduction isProduction
) { ) {
console.warn(uniI18n.__('pluginUni.unicloudReleaseH5', { 0: 'https://uniapp.dcloud.io/uniCloud/quickstart?id=useinh5' })) console.warn(uniI18n.__('pluginUni.unicloudReleaseH5', {
0: 'https://uniapp.dcloud.io/uniCloud/quickstart?id=useinh5'
}))
} else if ( } else if (
hasUniCloudSpace && hasUniCloudSpace &&
isH5 && isH5 &&
!isProduction !isProduction
) { ) {
console.warn(uniI18n.__('pluginUni.unicloudShowedRunByHBuilderX', { 0: 'https://uniapp.dcloud.io/uniCloud/quickstart?id=useinh5' })) console.warn(uniI18n.__('pluginUni.unicloudShowedRunByHBuilderX', {
0: 'https://uniapp.dcloud.io/uniCloud/quickstart?id=useinh5'
}))
} }
process.env.UNI_CLOUD_PROVIDER = JSON.stringify(spaces.map(space => { process.env.UNI_CLOUD_PROVIDER = JSON.stringify(spaces.map(space => {
...@@ -122,6 +128,12 @@ if (process.env.NODE_ENV === 'production') { // 发行模式,不启用 cache ...@@ -122,6 +128,12 @@ if (process.env.NODE_ENV === 'production') { // 发行模式,不启用 cache
delete process.env.UNI_USING_CACHE delete process.env.UNI_USING_CACHE
} }
process.env.BROWSERSLIST_CONFIG = [
path.resolve(process.env.UNI_INPUT_DIR, '.browserslistrc'),
path.resolve(process.env.UNI_CLI_CONTEXT, 'package.json'),
path.resolve(process.cwd(), 'package.json')
].find(file => fs.existsSync(file))
const { const {
normalizePath, normalizePath,
isSupportSubPackages, isSupportSubPackages,
...@@ -295,7 +307,9 @@ if ( ...@@ -295,7 +307,9 @@ if (
process.env.UNI_USING_STAT = true process.env.UNI_USING_STAT = true
if (!process.UNI_STAT_CONFIG.appid && process.env.NODE_ENV === 'production') { if (!process.UNI_STAT_CONFIG.appid && process.env.NODE_ENV === 'production') {
console.log() console.log()
console.warn(uniI18n.__('pluginUni.uniStatisticsNoAppid', { 0: 'https://ask.dcloud.net.cn/article/36303' })) console.warn(uniI18n.__('pluginUni.uniStatisticsNoAppid', {
0: 'https://ask.dcloud.net.cn/article/36303'
}))
console.log() console.log()
} }
} }
...@@ -324,7 +338,10 @@ let hasNVue = false ...@@ -324,7 +338,10 @@ let hasNVue = false
const compileModeUrl = 'https://ask.dcloud.net.cn/article/36074' const compileModeUrl = 'https://ask.dcloud.net.cn/article/36074'
if (process.env.UNI_USING_NATIVE || process.env.UNI_USING_V3_NATIVE) { if (process.env.UNI_USING_NATIVE || process.env.UNI_USING_V3_NATIVE) {
const compileMode = (process.env.UNI_USING_V3_NATIVE ? '(v3)' : '') + '' + (isNVueCompiler ? 'uni-app' : 'weex') const compileMode = (process.env.UNI_USING_V3_NATIVE ? '(v3)' : '') + '' + (isNVueCompiler ? 'uni-app' : 'weex')
console.log(uniI18n.__('pluginUni.nvueCompileModeForDetail', { 0: compileMode, 1: compileModeUrl })) console.log(uniI18n.__('pluginUni.nvueCompileModeForDetail', {
0: compileMode,
1: compileModeUrl
}))
} else if (process.env.UNI_PLATFORM !== 'h5' && process.env.UNI_PLATFORM !== 'quickapp-native') { } else if (process.env.UNI_PLATFORM !== 'h5' && process.env.UNI_PLATFORM !== 'quickapp-native') {
try { try {
let info = '' let info = ''
...@@ -332,7 +349,8 @@ if (process.env.UNI_USING_NATIVE || process.env.UNI_USING_V3_NATIVE) { ...@@ -332,7 +349,8 @@ if (process.env.UNI_USING_NATIVE || process.env.UNI_USING_V3_NATIVE) {
const pagesPkg = require('@dcloudio/webpack-uni-pages-loader/package.json') const pagesPkg = require('@dcloudio/webpack-uni-pages-loader/package.json')
if (pagesPkg) { if (pagesPkg) {
const v3Tips = `(v3)${uniI18n.__('see')}:https://ask.dcloud.net.cn/article/36599。` const v3Tips = `(v3)${uniI18n.__('see')}:https://ask.dcloud.net.cn/article/36599。`
info = uniI18n.__('compilerVersion') + '' + pagesPkg['uni-app'].compilerVersion + (process.env.UNI_USING_V3 ? v3Tips : '') info = uniI18n.__('compilerVersion') + '' + pagesPkg['uni-app'].compilerVersion + (process.env.UNI_USING_V3
? v3Tips : '')
} }
if (process.env.UNI_USING_V3) { if (process.env.UNI_USING_V3) {
console.log(info) console.log(info)
...@@ -346,7 +364,10 @@ if (process.env.UNI_USING_NATIVE || process.env.UNI_USING_V3_NATIVE) { ...@@ -346,7 +364,10 @@ if (process.env.UNI_USING_NATIVE || process.env.UNI_USING_V3_NATIVE) {
if (needWarning) { if (needWarning) {
console.log(warningMsg) console.log(warningMsg)
} }
console.log(uniI18n.__('pluginUni.nvueCompileModeForDetail', { 0: (isNVueCompiler ? 'uni-app' : 'weex'), 1: compileModeUrl })) console.log(uniI18n.__('pluginUni.nvueCompileModeForDetail', {
0: (isNVueCompiler ? 'uni-app' : 'weex'),
1: compileModeUrl
}))
} else { } else {
console.log(info) console.log(info)
if (needWarning) { if (needWarning) {
...@@ -467,11 +488,13 @@ if ( ...@@ -467,11 +488,13 @@ if (
} }
if (process.env.UNI_PLATFORM.startsWith('mp-')) { if (process.env.UNI_PLATFORM.startsWith('mp-')) {
console.log(uniI18n.__('pluginUni.mpBrowserKernelDifference', { 0: 'https://uniapp.dcloud.io/matter?id=mp' })) console.log(uniI18n.__('pluginUni.mpBrowserKernelDifference', {
0: 'https://uniapp.dcloud.io/matter?id=mp'
}))
} }
runByHBuilderX && console.log(uniI18n.__('compiling')) runByHBuilderX && console.log(uniI18n.__('compiling'))
module.exports = { module.exports = {
manifestPlatformOptions: platformOptions manifestPlatformOptions: platformOptions
} }
...@@ -38,7 +38,7 @@ const { ...@@ -38,7 +38,7 @@ const {
} = require('@dcloudio/uni-i18n') } = require('@dcloudio/uni-i18n')
// 将开发者手动设置的 usingComponents 调整名称,方便与自动解析到的 usingComponents 做最后合并 // 将开发者手动设置的 usingComponents 调整名称,方便与自动解析到的 usingComponents 做最后合并
function renameUsingComponents(jsonObj) { function renameUsingComponents (jsonObj) {
if (jsonObj.usingComponents) { if (jsonObj.usingComponents) {
jsonObj.customUsingComponents = jsonObj.usingComponents jsonObj.customUsingComponents = jsonObj.usingComponents
delete jsonObj.usingComponents delete jsonObj.usingComponents
...@@ -46,7 +46,7 @@ function renameUsingComponents(jsonObj) { ...@@ -46,7 +46,7 @@ function renameUsingComponents(jsonObj) {
return jsonObj return jsonObj
} }
module.exports = function(content, map) { module.exports = function (content, map) {
this.cacheable && this.cacheable() this.cacheable && this.cacheable()
initTheme() initTheme()
...@@ -136,13 +136,13 @@ module.exports = function(content, map) { ...@@ -136,13 +136,13 @@ module.exports = function(content, map) {
if (!process.env.UNI_USING_V3) { if (!process.env.UNI_USING_V3) {
parsePages( parsePages(
pagesJson, pagesJson,
function(page) { function (page) {
updatePageJson( updatePageJson(
page.path, page.path,
renameUsingComponents(parseStyle(page.style)) renameUsingComponents(parseStyle(page.style))
) )
}, },
function(root, page) { function (root, page) {
updatePageJson( updatePageJson(
normalizePath(path.join(root, page.path)), normalizePath(path.join(root, page.path)),
renameUsingComponents(parseStyle(page.style, root)) renameUsingComponents(parseStyle(page.style, root))
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册