diff --git a/packages/uni-cli-shared/lib/package.js b/packages/uni-cli-shared/lib/package.js index d4bc7e7b69c41a24149799f255fff0a04ceb7f86..3a3f90916d43d01f1817574d863ab0addf2b324a 100644 --- a/packages/uni-cli-shared/lib/package.js +++ b/packages/uni-cli-shared/lib/package.js @@ -35,7 +35,7 @@ module.exports = { if (scriptName !== name) { const define = uniAppOptions.scripts[scriptName].define Object.keys(define).forEach(name => { - if (typeof scriptOptions.define[name] !== "undefined") { + if (typeof scriptOptions.define[name] !== 'undefined') { delete define[name] } else { define[name] = false diff --git a/packages/uni-template-compiler/__tests__/compiler-mp-weixin.spec.js b/packages/uni-template-compiler/__tests__/compiler-mp-weixin.spec.js index b2a2da1d35a02dec2fef920792c7b7778d8604d3..bb2785cecbf5b10d9de593c0738e493d4e86bc94 100644 --- a/packages/uni-template-compiler/__tests__/compiler-mp-weixin.spec.js +++ b/packages/uni-template-compiler/__tests__/compiler-mp-weixin.spec.js @@ -56,33 +56,38 @@ describe('mp:compiler-mp-weixin', () => { it('generate string express with escape quote', () => { assertCodegen( - ``, + '', '', - `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( + /* eslint-disable no-template-curly-in-string */ '', '', + /* eslint-disable no-template-curly-in-string */ 'with(this){var a0=`${text}\'`;$mp.data=Object.assign({},{$root:{a0:a0}})}' ) assertCodegen( - `{{text+'\\''}}`, + '{{text+\'\\\'\'}}', '{{$root.t0}}', - `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( + /* eslint-disable no-template-curly-in-string */ '{{`${text}\'`}}', '{{$root.t0}}', + /* eslint-disable no-template-curly-in-string */ 'with(this){var t0=`${text}\'`;$mp.data=Object.assign({},{$root:{t0:t0}})}' ) assertCodegen( + /* eslint-disable no-template-curly-in-string */ '{{`${text}"`}}', - `{{text+'"'}}` + '{{text+\'"\'}}' ) assertCodegen( - `{{text+"\\""}}`, + '{{text+"\\""}}', '{{$root.t0}}', - `with(this){var t0=text+"\\"";$mp.data=Object.assign({},{$root:{t0:t0}})}` + 'with(this){var t0=text+"\\"";$mp.data=Object.assign({},{$root:{t0:t0}})}' ) }) diff --git a/packages/vue-cli-plugin-uni/commands/build.js b/packages/vue-cli-plugin-uni/commands/build.js index bf66955831cc9f20fcf5e1d6732f97ff8aef0c12..1dd76858684c31f58265f6f811447b83d3d0563e 100644 --- a/packages/vue-cli-plugin-uni/commands/build.js +++ b/packages/vue-cli-plugin-uni/commands/build.js @@ -248,7 +248,7 @@ function analysisPluginDir () { 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', { diff --git a/packages/webpack-uni-mp-loader/lib/plugin/index-new.js b/packages/webpack-uni-mp-loader/lib/plugin/index-new.js index 1859383995a50de53ec3cd16c063976afd941de4..89371203c8cdaf2c6f603cbd58cb0d531a05ec75 100644 --- a/packages/webpack-uni-mp-loader/lib/plugin/index-new.js +++ b/packages/webpack-uni-mp-loader/lib/plugin/index-new.js @@ -77,21 +77,21 @@ function addMPPluginRequire (compilation) { if (needProcess) { const modules = compilation.modules const orignalSource = compilation.assets[name].source() - const globalEnv = process.env.UNI_PLATFORM === 'mp-alipay' ? 'my' : 'wx'; + 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 source = - orignalSource.substring(0, newlineIndex) - + `\nmodule.exports = ${globalEnv}.__webpack_require_UNI_MP_PLUGIN__('${uniModuleId}');\n` - + orignalSource.substring(newlineIndex + 1) + 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 } } diff --git a/src/platforms/h5/view/components/ad/index.vue b/src/platforms/h5/view/components/ad/index.vue index d5e54e341afe948277f5dd62c1b9efded5f40e3e..ae5253eebc71bc95bb258665d551759af89fc134 100644 --- a/src/platforms/h5/view/components/ad/index.vue +++ b/src/platforms/h5/view/components/ad/index.vue @@ -545,7 +545,7 @@ export default { } }, _report (type, currentChannel) { - let reportData = { + const reportData = { h: __uniConfig.compilerVersion, a: this.adpid, at: type