提交 1eab7463 编写于 作者: Q qiang

Merge branch 'dev' into alpha

...@@ -62,7 +62,7 @@ ...@@ -62,7 +62,7 @@
"mpLoader.componentReferenceError": "Component {{0}} reference error", "mpLoader.componentReferenceError": "Component {{0}} reference error",
"mpLoader.componentReferenceErrorOnlySupportImport": "Component {{0}} reference error, only supports import components", "mpLoader.componentReferenceErrorOnlySupportImport": "Component {{0}} reference error, only supports import components",
"pagesLoader.pagesNodeCannotNull": "Pages node in pages.json cannot be empty", "pagesLoader.pagesNodeCannotNull": "Pages node in pages.json cannot be empty",
"pagesLoader.nvueFirstPageStartModeIsFast": "Nvue homepage startup mode: fast. For details, see: {{0}}", "pagesLoader.nvueFirstPageStartModeIsFast": "App startup mode: fast. For details, see: {{0}}",
"pagesLoader.pagesTabbarMinItem2": "{{0}} must contain at least 2 items", "pagesLoader.pagesTabbarMinItem2": "{{0}} must contain at least 2 items",
"pagesLoader.needInPagesNode": "{{0}} needs to be in the pages array", "pagesLoader.needInPagesNode": "{{0}} needs to be in the pages array",
"i18n.fallbackLocale.default": "fallbackLocale is missing in manifest.json, use:{{locale}}", "i18n.fallbackLocale.default": "fallbackLocale is missing in manifest.json, use:{{locale}}",
......
...@@ -62,7 +62,7 @@ ...@@ -62,7 +62,7 @@
"mpLoader.componentReferenceError": "组件 {{0}} 引用错误", "mpLoader.componentReferenceError": "组件 {{0}} 引用错误",
"mpLoader.componentReferenceErrorOnlySupportImport": "组件 {{0}} 引用错误,仅支持 import 方式引入组件", "mpLoader.componentReferenceErrorOnlySupportImport": "组件 {{0}} 引用错误,仅支持 import 方式引入组件",
"pagesLoader.pagesNodeCannotNull": "pages.json 中的 pages 节点不能为空", "pagesLoader.pagesNodeCannotNull": "pages.json 中的 pages 节点不能为空",
"pagesLoader.nvueFirstPageStartModeIsFast": "Nvue 首页启动模式: fast, 详见: {{0}}", "pagesLoader.nvueFirstPageStartModeIsFast": "App 启动模式: fast, 详见: {{0}}",
"pagesLoader.pagesTabbarMinItem2": "{{0}} 需至少包含2项", "pagesLoader.pagesTabbarMinItem2": "{{0}} 需至少包含2项",
"pagesLoader.needInPagesNode": "{{0}} 需在 pages 数组中", "pagesLoader.needInPagesNode": "{{0}} 需在 pages 数组中",
"i18n.fallbackLocale.default": "当前应用未在 manifest.json 配置 fallbackLocale,默认使用:{{locale}}", "i18n.fallbackLocale.default": "当前应用未在 manifest.json 配置 fallbackLocale,默认使用:{{locale}}",
......
...@@ -60,11 +60,25 @@ describe('mp:compiler-mp-weixin', () => { ...@@ -60,11 +60,25 @@ describe('mp:compiler-mp-weixin', () => {
'<view data-text="{{$root.a0}}"></view>', '<view data-text="{{$root.a0}}"></view>',
`with(this){var a0=text+"'";$mp.data=Object.assign({},{$root:{a0:a0}})}` `with(this){var a0=text+"'";$mp.data=Object.assign({},{$root:{a0:a0}})}`
) )
assertCodegen(
'<view :data-text="`${text}\'`"></view>',
'<view data-text="{{$root.a0}}"></view>',
'with(this){var a0=`${text}\'`;$mp.data=Object.assign({},{$root:{a0:a0}})}'
)
assertCodegen( assertCodegen(
`<view>{{text+'\\''}}</view>`, `<view>{{text+'\\''}}</view>`,
'<view>{{$root.t0}}</view>', '<view>{{$root.t0}}</view>',
`with(this){var t0=text+"'";$mp.data=Object.assign({},{$root:{t0:t0}})}` `with(this){var t0=text+"'";$mp.data=Object.assign({},{$root:{t0:t0}})}`
) )
assertCodegen(
'<view>{{`${text}\'`}}</view>',
'<view>{{$root.t0}}</view>',
'with(this){var t0=`${text}\'`;$mp.data=Object.assign({},{$root:{t0:t0}})}'
)
assertCodegen(
'<view>{{`${text}"`}}</view>',
`<view>{{text+'"'}}</view>`
)
assertCodegen( assertCodegen(
`<view>{{text+"\\""}}</view>`, `<view>{{text+"\\""}}</view>`,
'<view>{{$root.t0}}</view>', '<view>{{$root.t0}}</view>',
......
...@@ -255,6 +255,12 @@ function hasEscapeQuote (path) { ...@@ -255,6 +255,12 @@ function hasEscapeQuote (path) {
has = true has = true
path.stop() path.stop()
} }
},
TemplateElement (path) {
if (path.node.value.cooked.includes('\'')) {
has = true
path.stop()
}
} }
}) })
} }
......
...@@ -34,7 +34,7 @@ module.exports = (api, options) => { ...@@ -34,7 +34,7 @@ module.exports = (api, options) => {
'--auto-host': 'specify automator host', '--auto-host': 'specify automator host',
'--auto-port': 'specify automator port', '--auto-port': 'specify automator port',
'--subpackage': 'specify subpackage', '--subpackage': 'specify subpackage',
'--plugin': 'specify plugin', '--plugin': 'specify mp plugin',
'--manifest': 'build manifest.json' '--manifest': 'build manifest.json'
} }
}, async (args) => { }, async (args) => {
...@@ -244,17 +244,19 @@ function analysisPluginDir () { ...@@ -244,17 +244,19 @@ function analysisPluginDir () {
const pluginJson = parseJson(fs.readFileSync(pluginJsonPath, 'utf-8'), true) const pluginJson = parseJson(fs.readFileSync(pluginJsonPath, 'utf-8'), true)
// main 入口文件是否存在 // main 入口文件是否存在
process.env.UNI_MP_PLUGIN_MAIN = pluginJson.main if (pluginJson.main) {
const UNI_MP_PLUGIN_MAIN = process.env.UNI_MP_PLUGIN_MAIN process.env.UNI_MP_PLUGIN_MAIN = pluginJson.main
const mainFilePath = path.resolve(process.env.UNI_INPUT_DIR, UNI_MP_PLUGIN_MAIN) const UNI_MP_PLUGIN_MAIN = process.env.UNI_MP_PLUGIN_MAIN
const mainFilePath = path.resolve(process.env.UNI_INPUT_DIR, UNI_MP_PLUGIN_MAIN)
if (UNI_MP_PLUGIN_MAIN && !fs.pathExistsSync(mainFilePath)) {
console.log() if (UNI_MP_PLUGIN_MAIN && !fs.pathExistsSync(mainFilePath)) {
console.error(uniI18n.__('pluginUni.entryDileNoExistsCheckAfterRetry', { console.log()
0: UNI_MP_PLUGIN_MAIN console.error(uniI18n.__('pluginUni.entryDileNoExistsCheckAfterRetry', {
})) 0: UNI_MP_PLUGIN_MAIN
console.log() }))
process.exit(0) console.log()
process.exit(0)
}
} }
} }
......
...@@ -352,9 +352,7 @@ if (process.env.UNI_USING_NATIVE || process.env.UNI_USING_V3_NATIVE) { ...@@ -352,9 +352,7 @@ if (process.env.UNI_USING_NATIVE || process.env.UNI_USING_V3_NATIVE) {
if (process.env.UNI_PLATFORM === 'app-plus') { if (process.env.UNI_PLATFORM === 'app-plus') {
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。` info = uniI18n.__('compilerVersion') + '' + pagesPkg['uni-app'].compilerVersion
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)
......
...@@ -178,11 +178,12 @@ module.exports = { ...@@ -178,11 +178,12 @@ module.exports = {
{ {
const globalEnv = process.env.UNI_PLATFORM === 'mp-alipay' ? 'my' : 'wx'; const globalEnv = process.env.UNI_PLATFORM === 'mp-alipay' ? 'my' : 'wx';
[].concat(process.env.UNI_MP_PLUGIN ? process.env.UNI_MP_PLUGIN_MAIN : JSON.parse(process.env [].concat(
.UNI_MP_PLUGIN_EXPORT)) process.env.UNI_MP_PLUGIN
.forEach(fileName => addToUniEntry(fileName)) ? process.env.UNI_MP_PLUGIN_MAIN
beforeCode += : JSON.parse(process.env.UNI_MP_PLUGIN_EXPORT)
`${globalEnv}.__webpack_require_${(process.env.UNI_MP_PLUGIN || 'UNI_MP_PLUGIN').replace(/-/g, '_')}__ = __webpack_require__;` ).forEach(fileName => addToUniEntry(fileName))
beforeCode += `${globalEnv}.__webpack_require_UNI_MP_PLUGIN__ = __webpack_require__;`
} }
const alias = { // 仅 mp-weixin const alias = { // 仅 mp-weixin
...@@ -319,4 +320,4 @@ module.exports = { ...@@ -319,4 +320,4 @@ module.exports = {
webpackConfig.plugins.delete('preload') webpackConfig.plugins.delete('preload')
webpackConfig.plugins.delete('prefetch') webpackConfig.plugins.delete('prefetch')
} }
} }
...@@ -76,22 +76,22 @@ function addMPPluginRequire (compilation) { ...@@ -76,22 +76,22 @@ function addMPPluginRequire (compilation) {
const needProcess = process.env.UNI_MP_PLUGIN ? name === UNI_MP_PLUGIN_MAIN : UNI_MP_PLUGIN_EXPORT.includes(name) const needProcess = process.env.UNI_MP_PLUGIN ? name === UNI_MP_PLUGIN_MAIN : UNI_MP_PLUGIN_EXPORT.includes(name)
if (needProcess) { if (needProcess) {
const modules = compilation.modules const modules = compilation.modules
const orignalSource = compilation.assets[name].source()
const globalEnv = process.env.UNI_PLATFORM === 'mp-alipay' ? 'my' : 'wx';
const filePath = normalizePath(path.resolve(process.env.UNI_INPUT_DIR, name)) const filePath = normalizePath(path.resolve(process.env.UNI_INPUT_DIR, name))
const uniModuleId = modules.find(module => module.resource && normalizePath(module.resource) === filePath).id const uniModuleId = modules.find(module => module.resource && normalizePath(module.resource) === filePath).id
const newlineIndex = orignalSource.lastIndexOf('\n')
const newlineIndex = compilation.assets[name].source().lastIndexOf('\n') const source =
orignalSource.substring(0, newlineIndex)
const source = compilation.assets[name].source().substring(0, newlineIndex) + + `\nmodule.exports = ${globalEnv}.__webpack_require_UNI_MP_PLUGIN__('${uniModuleId}');\n`
`\nmodule.exports = ${process.env.UNI_PLATFORM === 'mp-alipay' ? 'my' : 'wx'}.__webpack_require_${(process.env.UNI_MP_PLUGIN || 'UNI_MP_PLUGIN').replace(/-/g, '_')}__('${uniModuleId}');\n` + + orignalSource.substring(newlineIndex + 1)
compilation.assets[name].source().substring(newlineIndex + 1)
compilation.assets[name] = { compilation.assets[name] = {
size () { size() {
return Buffer.byteLength(source, 'utf8') return Buffer.byteLength(source, 'utf8')
}, },
source () { source() {
return source return source
} }
} }
......
...@@ -308,6 +308,7 @@ export default { ...@@ -308,6 +308,7 @@ export default {
} }
}, },
__handleTouchMove: function (event) { __handleTouchMove: function (event) {
event.stopPropagation()
var self = this var self = this
if (!this._isScaling && !this.disabled && this._isTouching) { if (!this._isScaling && !this.disabled && this._isTouching) {
let x = this._translateX let x = this._translateX
......
...@@ -72,9 +72,7 @@ class RewardedVideoAd { ...@@ -72,9 +72,7 @@ class RewardedVideoAd {
this._dispatchEvent('adClicked', {}) this._dispatchEvent('adClicked', {})
}) })
if (this._preload) { this._loadAd()
this._loadAd()
}
} }
get isExpired () { get isExpired () {
......
...@@ -436,6 +436,7 @@ export default { ...@@ -436,6 +436,7 @@ export default {
const data = this._pl[this._pi] const data = this._pl[this._pi]
const providerConfig = this._b[data.a1][data.t] const providerConfig = this._b[data.a1][data.t]
const script = providerConfig.script const script = providerConfig.script
this._currentChannel = data.a1
var id = this._randomId() var id = this._randomId()
var view = this._createView(id) var view = this._createView(id)
...@@ -517,7 +518,7 @@ export default { ...@@ -517,7 +518,7 @@ export default {
_checkRender () { _checkRender () {
var hasContent = (this.$refs.container.children.length > 0 && this.$refs.container.clientHeight > 40) var hasContent = (this.$refs.container.children.length > 0 && this.$refs.container.clientHeight > 40)
if (hasContent) { if (hasContent) {
this._report(40) this._report(40, this._currentChannel)
} }
return hasContent return hasContent
}, },
...@@ -543,12 +544,16 @@ export default { ...@@ -543,12 +544,16 @@ export default {
this._checkTimer = null this._checkTimer = null
} }
}, },
_report (type) { _report (type, currentChannel) {
AdReport.instance.get({ let reportData = {
h: __uniConfig.compilerVersion, h: __uniConfig.compilerVersion,
a: this.adpid, a: this.adpid,
at: type at: type
}) }
if (currentChannel) {
reportData.t = currentChannel
}
AdReport.instance.get(reportData)
}, },
_randomId () { _randomId () {
var result = '' var result = ''
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册