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