diff --git a/packages/uni-cli-nvue/dist/webpack/index.js b/packages/uni-cli-nvue/dist/webpack/index.js index 8389653068668f0fa8202a88312548d53661d56d..d05f45e4573b1348fae554efb204a4bcfb4f01ce 100644 --- a/packages/uni-cli-nvue/dist/webpack/index.js +++ b/packages/uni-cli-nvue/dist/webpack/index.js @@ -19,13 +19,15 @@ function runWebpack(mode, options) { if (stats.hasErrors()) { return reject(stats.toString()); } - const info = stats.toJson(); if (stats.hasWarnings()) { + const info = stats.toJson({ all: false, warnings: true }); console.warn(info.warnings); } console.log(stats.toString({ - chunks: true, - colors: true, // 在控制台展示颜色 + all: false, + assets: true, + colors: true, + timings: true, })); resolve(void 0); }); diff --git a/packages/uni-cli-nvue/lib/@vue/component-compiler-utils/dist/stylePlugins/scoped.js b/packages/uni-cli-nvue/lib/@vue/component-compiler-utils/dist/stylePlugins/scoped.js index f3a01afbd55afd9132e38e8e215a2fd11c1145a0..d30ed53d953f452226e2e9a450a7fba1dbd04519 100644 --- a/packages/uni-cli-nvue/lib/@vue/component-compiler-utils/dist/stylePlugins/scoped.js +++ b/packages/uni-cli-nvue/lib/@vue/component-compiler-utils/dist/stylePlugins/scoped.js @@ -54,22 +54,9 @@ exports.default = (options) => { // So all leading spaces must be eliminated to avoid problems. selector.first.spaces.before = ''; } - // fixed by xxxxxx (h5,app-plus v3 平台继续使用 attribute,其他平台使用 className) - if( - process.env.UNI_PLATFORM === 'h5' || - ( - process.env.UNI_PLATFORM === 'app-plus' && - process.env.UNI_USING_V3 - ) - ){ - selector.insertAfter(node, selectorParser.attribute({ - attribute: id - })); - } else { selector.insertAfter(node, selectorParser.className({ value: id })); - } }); }).processSync(node.selector); }); diff --git a/packages/uni-cli-nvue/lib/vue-loader/lib/codegen/styleInjection.js b/packages/uni-cli-nvue/lib/vue-loader/lib/codegen/styleInjection.js index d9fcb9336f8b170bba4951100645a8200a6582ef..1b985e7841d2490decdd2c2d1c75710b28e7de15 100644 --- a/packages/uni-cli-nvue/lib/vue-loader/lib/codegen/styleInjection.js +++ b/packages/uni-cli-nvue/lib/vue-loader/lib/codegen/styleInjection.js @@ -87,20 +87,15 @@ module.exports = function genStyleInjectionCode ( }) } else {// fixed by xxxxxx nvue style styleInjectionCode = `if(!this.options.style){this.options.style = {}} - if(Vue.prototype.__merge_style && Vue.prototype.__$appStyle__){Vue.prototype.__merge_style(Vue.prototype.__$appStyle__, this.options.style)} +Vue.prototype.__merge_style(Vue.prototype.__$appStyle__, this.options.style) ` styles.forEach((style, i) => { if (isNotEmptyStyle(style)) { const request = genStyleRequest(style, i) - styleInjectionCode += ( - `if(Vue.prototype.__merge_style){ - Vue.prototype.__merge_style(require(${request}).default, this.options.style) - }else{ - Object.assign(this.options.style,require(${request}).default) - }\n`//fixed by xxxxxx 简单处理,与 weex-vue-loader 保持一致 + styleInjectionCode += `Vue.prototype.__merge_style(require(${request}).default, this.options.style)\n` + //fixed by xxxxxx 简单处理,与 weex-vue-loader 保持一致 //`var style${i} = require(${request})\n` + //`if (style${i}.__inject__) style${i}.__inject__(context)\n` - ) if (style.module) genCSSModulesCode(style, request, i) } }) diff --git a/packages/uni-cli-nvue/lib/weex-styler/lib/validator.js b/packages/uni-cli-nvue/lib/weex-styler/lib/validator.js index d437aecfb04ea9842e6fe4c7ebc8efb4b1046fe5..d2894034dc1eb3fcd45b809dcac58c6b43bfbb65 100644 --- a/packages/uni-cli-nvue/lib/weex-styler/lib/validator.js +++ b/packages/uni-cli-nvue/lib/weex-styler/lib/validator.js @@ -174,7 +174,7 @@ var EXTENDED_COLOR_KEYWORDS = { var LENGTH_REGEXP = /^[-+]?\d*\.?\d+(\S*)$/ var SUPPORT_CSS_UNIT = ['px', 'pt', 'wx'] -if(process.env.UNI_USING_NVUE_COMPILER){ +if(process.env.UNI_NVUE_COMPILER === 'uni-app'){ SUPPORT_CSS_UNIT.push('upx') SUPPORT_CSS_UNIT.push('rpx') } diff --git a/packages/uni-cli-nvue/lib/weex-template-compiler/build.js b/packages/uni-cli-nvue/lib/weex-template-compiler/build.js index f884ce0317e32b9444c5ea5bb3385eacf42c7fc2..0a935275f1f023456f4d5819dd49dc845a68e399 100644 --- a/packages/uni-cli-nvue/lib/weex-template-compiler/build.js +++ b/packages/uni-cli-nvue/lib/weex-template-compiler/build.js @@ -4930,7 +4930,7 @@ function genDefaultModel ( var event = lazy ? 'change' : 'input'; var valueExpression = "$event.target.attr.value" + (trim ? '.trim()' : ''); - if(process.env.UNI_USING_NVUE_COMPILER){ + if(process.env.UNI_NVUE_COMPILER === 'uni-app'){ valueExpression = "$event.detail.value" + (trim ? '.trim()' : ''); } if (number) { diff --git a/packages/uni-cli-nvue/src/webpack/index.ts b/packages/uni-cli-nvue/src/webpack/index.ts index 9654f811f95097b170e4c795f6edddeb0c77583c..49556d98f93c28cfc0b70871b07d962191a42b6f 100644 --- a/packages/uni-cli-nvue/src/webpack/index.ts +++ b/packages/uni-cli-nvue/src/webpack/index.ts @@ -20,14 +20,17 @@ function runWebpack( if (stats!.hasErrors()) { return reject(stats!.toString()) } - const info = stats!.toJson() + if (stats!.hasWarnings()) { + const info = stats!.toJson({ all: false, warnings: true }) console.warn(info.warnings) } console.log( stats!.toString({ - chunks: true, // 使构建过程更静默无输出 + all: false, + assets: true, colors: true, // 在控制台展示颜色 + timings: true, }) ) resolve(void 0) diff --git a/packages/uni-cli-shared/src/json/app/pages/nvue.ts b/packages/uni-cli-shared/src/json/app/pages/nvue.ts index fe7f9742546e0d07358583ddb097fbd041c6dfb4..d17afc2824aacc36d302e2d88b35d95f1d8e9c61 100644 --- a/packages/uni-cli-shared/src/json/app/pages/nvue.ts +++ b/packages/uni-cli-shared/src/json/app/pages/nvue.ts @@ -6,22 +6,22 @@ export function initWebpackNVueEntry(pages: UniApp.PagesJsonPageOptions[]) { process.UNI_NVUE_ENTRY = {} pages.forEach((page) => { if (page.style.isNVue) { - process.UNI_NVUE_ENTRY[page.path] = genWebpackBase64Code(page.path) + process.UNI_NVUE_ENTRY[page.path] = genWebpackBase64Code( + genNVueEntryCode(page.path) + ) } }) } -function genWebpackBase64Code(route: string) { - return `data:text/javascript;base64,${Buffer.from( - genNVueEntryCode(route) - ).toString('base64')}` +function genWebpackBase64Code(code: string) { + return `data:text/javascript;base64,${Buffer.from(code).toString('base64')}` } function genNVueEntryCode(route: string) { - return `import App from '${normalizePath( + return `import '${genWebpackBase64Code(genNVueAppStyle())}' +import App from '${normalizePath( path.resolve(process.env.UNI_INPUT_DIR, route) - )}.nvue?mpType=page' -${genNVueAppStyle()} + )}.nvue?mpType=page' if (typeof Promise !== 'undefined' && !Promise.prototype.finally) { Promise.prototype.finally = function(callback) { var promise = this.constructor