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

Merge branch 'dev' into alpha

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