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

Merge branch 'dev' of https://github.com/dcloudio/uni-app into v3

# Conflicts:
#	packages/vue-cli-plugin-uni/lib/env.js
......@@ -10,7 +10,7 @@ const {
isUnaryTag
} = require('../util')
function getProvides() {
function getProvides () {
return {
'__f__': [path.resolve(__dirname, '../format-log.js'), 'default']
}
......@@ -20,7 +20,7 @@ const v3 = {
vueConfig: {
parallel: false
},
webpackConfig(webpackConfig, vueOptions) {
webpackConfig (webpackConfig, vueOptions) {
const isAppService = !!vueOptions.pluginOptions['uni-app-plus']['service']
const isAppView = !!vueOptions.pluginOptions['uni-app-plus']['view']
......@@ -34,7 +34,6 @@ const v3 = {
// disable noEmitOnErrors
webpackConfig.optimization.noEmitOnErrors = false
if (isAppService) {
webpackConfig.optimization.runtimeChunk = {
name: 'app-config'
......@@ -53,7 +52,7 @@ const v3 = {
externals: {
vue: 'Vue'
},
entry() {
entry () {
const entry = {}
if (isAppService) {
entry['app-service'] = path.resolve(process.env.UNI_INPUT_DIR, getMainEntry())
......@@ -96,7 +95,7 @@ const v3 = {
]
}
},
chainWebpack(webpackConfig, vueOptions) {
chainWebpack (webpackConfig, vueOptions) {
const isAppService = !!vueOptions.pluginOptions['uni-app-plus']['service']
const isAppView = !!vueOptions.pluginOptions['uni-app-plus']['view']
......
......@@ -184,13 +184,16 @@ if (process.env.UNI_USING_COMPONENTS) { // 是否启用分包优化
}
const warningMsg =
usingComponentsAbsent ?
`该应用之前可能是非自定义组件模式,目前以自定义组件模式运行。非自定义组件将于2019年11月1日起停止支持。详见:https://ask.dcloud.net.cn/article/36385` :
`uni-app将于2019年11月1日起停止支持非自定义组件模式 [详情](https://ask.dcloud.net.cn/article/36385)`
usingComponentsAbsent
? `该应用之前可能是非自定义组件模式,目前以自定义组件模式运行。非自定义组件将于2019年11月1日起停止支持。详见:https://ask.dcloud.net.cn/article/36385`
: `uni-app将于2019年11月1日起停止支持非自定义组件模式 [详情](https://ask.dcloud.net.cn/article/36385)`
const needWarning = !platformOptions.usingComponents || usingComponentsAbsent
// 输出编译器版本等信息
if (process.env.UNI_PLATFORM !== 'h5') {
if (process.env.UNI_USING_NATIVE) {
console.log('当前nvue编译模式:' + (isNVueCompiler ? 'uni-app' : 'weex') +
' 。编译模式差异见:https://ask.dcloud.net.cn/article/36074')
} else if (process.env.UNI_PLATFORM !== 'h5') {
try {
const modeText = '当前项目编译模式:' +
(platformOptions.usingComponents ? '自定义组件模式' : '非自定义组件模式') +
......@@ -204,8 +207,8 @@ if (process.env.UNI_PLATFORM !== 'h5') {
}
const glob = require('glob')
if (glob.sync('pages/**/*.nvue', {
cwd: process.env.UNI_INPUT_DIR
}).length) {
cwd: process.env.UNI_INPUT_DIR
}).length) {
console.log(info)
console.log(modeText)
if (needWarning) {
......@@ -237,9 +240,9 @@ moduleAlias.addAlias('mpvue-template-compiler', '@dcloudio/vue-cli-plugin-uni/pa
if (runByHBuilderX) {
const oldError = console.error
console.error = function(msg) {
console.error = function (msg) {
if (typeof msg === 'string' && msg.includes(
'[BABEL] Note: The code generator has deoptimised the styling of')) {
'[BABEL] Note: The code generator has deoptimised the styling of')) {
const filePath = msg.replace('[BABEL] Note: The code generator has deoptimised the styling of ', '').split(
' as ')[0]
console.log('[警告] `' + path.relative(process.env.UNI_INPUT_DIR, filePath) +
......
......@@ -15,7 +15,7 @@ const {
const parseV3Config = require('./config-parser')
function parseConfig(appJson) {
function parseConfig (appJson) {
return {
name: 'app-config.js',
content: `__registerConfig(${JSON.stringify(appJson)});`
......@@ -24,11 +24,11 @@ function parseConfig(appJson) {
const _toString = Object.prototype.toString
function isPlainObject(obj) {
function isPlainObject (obj) {
return _toString.call(obj) === '[object Object]'
}
function normalizeNetworkTimeout(appJson) {
function normalizeNetworkTimeout (appJson) {
if (!isPlainObject(appJson.networkTimeout)) {
appJson.networkTimeout = {
request: 6000,
......@@ -52,7 +52,7 @@ function normalizeNetworkTimeout(appJson) {
}
}
module.exports = function(pagesJson, userManifestJson) {
module.exports = function (pagesJson, userManifestJson) {
const {
app
} = require('../mp')(pagesJson, userManifestJson)
......@@ -65,9 +65,9 @@ module.exports = function(pagesJson, userManifestJson) {
const {
navigationBarTextStyle = 'white',
navigationBarBackgroundColor = '#000000'
navigationBarBackgroundColor = '#000000'
} = appJson['window'] || {}
const TABBAR_HEIGHT = 50
let manifestJson = JSON.parse(fs.readFileSync(path.resolve(__dirname, './manifest.json'), 'utf8'))
......@@ -182,7 +182,7 @@ module.exports = function(pagesJson, userManifestJson) {
// 允许内联播放视频
manifestJson.plus.allowsInlineMediaPlayback = true
const addRenderAlways = function() {
const addRenderAlways = function () {
// "render": "always"
if (!manifestJson.plus.launchwebview) {
manifestJson.plus.launchwebview = {
......@@ -382,7 +382,7 @@ module.exports = function(pagesJson, userManifestJson) {
})
delete appJson.nvue
delete manifestJson.plus.launchwebview.kernel
manifestJson.launch_path = ''
Object.assign(manifestJson.plus.launchwebview, {
......@@ -437,21 +437,20 @@ module.exports = function(pagesJson, userManifestJson) {
manifest.content = JSON.stringify(manifest.content)
return [manifest, parseConfig(appJson)]
}
if (process.env.UNI_USING_V3) {
if (process.env.UNI_USING_V3) {
appJson.entryPagePath = appJson.pages[0]
appJson.page = Object.create(null)
const addPage = function(pagePath, windowOptions) {
const addPage = function (pagePath, windowOptions) {
delete windowOptions.usingComponents
appJson.page[pagePath] = {
window: windowOptions
}
}
parsePages(pagesJson, function(page) {
parsePages(pagesJson, function (page) {
addPage(page.path, parseStyle(page.style))
}, function(root, page) {
}, function (root, page) {
addPage(normalizePath(path.join(root, page.path)), parseStyle(page.style, root))
})
manifest.name = 'manifest.json'
......
......@@ -71,8 +71,14 @@ export function initSubNVue (nvue, plus, BroadcastChannel) {
const maskColor = webview.__uniapp_mask
let maskWebview = plus.webview.getWebviewById(webview.__uniapp_mask_id)
maskWebview = maskWebview.parent() || maskWebview // 再次检测父
let maskWebview = webview.__uniapp_mask_id === '0' ? {
setStyle ({ mask }) {
nvue.requireModule('uni-tabview').setMask({
color: mask
})
}
} : plus.webview.getWebviewById(webview.__uniapp_mask_id)
const oldShow = webview.show
const oldHide = webview.hide
const oldClose = webview.close
......@@ -115,4 +121,4 @@ export function initSubNVue (nvue, plus, BroadcastChannel) {
return getSubNVueById(plus.webview.currentWebview().id)
}
}
}
}
import { requireNativePlugin } from './index'
function wrapper (webview) {
webview.$processed = true
......@@ -19,8 +21,13 @@ function wrapper (webview) {
return
}
const maskColor = webview.__uniapp_mask
let maskWebview = plus.webview.getWebviewById(webview.__uniapp_mask_id)
maskWebview = maskWebview.parent() || maskWebview// 再次检测父
let maskWebview = webview.__uniapp_mask_id === '0' ? {
setStyle ({ mask }) {
requireNativePlugin('uni-tabview').setMask({
color: mask
})
}
} : plus.webview.getWebviewById(webview.__uniapp_mask_id)
const oldShow = webview.show
const oldHide = webview.hide
const oldClose = webview.close
......@@ -56,4 +63,4 @@ export function getSubNVueById (id) {
wrapper(webview)
}
return webview
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册