提交 096d38fe 编写于 作者: fxy060608's avatar fxy060608

Merge branch 'dev' of https://github.com/dcloudio/uni-app into alpha

# Conflicts:
#	packages/uni-quickapp-native/package.json
#	packages/uni-quickapp-webview/package.json
...@@ -51,18 +51,18 @@ dsl.onInitApp(function({ ...@@ -51,18 +51,18 @@ dsl.onInitApp(function({
});` });`
}) })
const pageCode = pageOutput[0].code const pageCode = pageOutput[0].code
const vueCode = fs.readFileSync(path.resolve(__dirname, '../packages/uni-quickapp-vue/assets/' + filename)) const vueCode = fs.readFileSync(path.resolve(__dirname, '../packages/uni-quickapp-native/assets/' + filename))
fs.writeFileSync( fs.writeFileSync(
path.resolve(__dirname, '../packages/uni-quickapp-vue/dist/' + filename), path.resolve(__dirname, '../packages/uni-quickapp-native/dist/' + filename),
vueCode + bridgeCode + appCode + pageCode, { vueCode + bridgeCode + appCode + pageCode, {
encoding: 'utf8' encoding: 'utf8'
} }
) )
if (process.env.NODE_ENV === 'production') { // 命令会执行dev,prod两次,仅prod时执行copy if (process.env.NODE_ENV === 'production') { // 命令会执行dev,prod两次,仅prod时执行copy
const componentsSrc = path.resolve(__dirname, '../src/platforms/quickapp-vue/view/components/**/*') const componentsSrc = path.resolve(__dirname, '../src/platforms/quickapp-native/view/components/**/*')
const componentsDest = path.resolve(__dirname, '../packages/uni-quickapp-vue/components') const componentsDest = path.resolve(__dirname, '../packages/uni-quickapp-native/components')
del.sync([componentsDest]) del.sync([componentsDest])
......
...@@ -23,9 +23,9 @@ const PLATFORMS = { ...@@ -23,9 +23,9 @@ const PLATFORMS = {
prefix: 'tt', prefix: 'tt',
title: '头条小程序' title: '头条小程序'
}, },
'quickapp-light': { 'quickapp-webview': {
prefix: 'qa', prefix: 'qa',
title: '快应用(Light)版' title: '快应用(Webview)版'
}, },
'app-plus': { 'app-plus': {
prefix: 'wx', prefix: 'wx',
......
...@@ -6,7 +6,7 @@ const commonjs = require('@rollup/plugin-commonjs') ...@@ -6,7 +6,7 @@ const commonjs = require('@rollup/plugin-commonjs')
const terser = require('rollup-plugin-terser') const terser = require('rollup-plugin-terser')
const requireContext = require('../lib/rollup-plugin-require-context') const requireContext = require('../lib/rollup-plugin-require-context')
process.env.UNI_PLATFORM = 'quickapp-vue' process.env.UNI_PLATFORM = 'quickapp-native'
const external = [] const external = []
...@@ -36,7 +36,7 @@ alias({ ...@@ -36,7 +36,7 @@ alias({
replacement: resolve('src/core') replacement: resolve('src/core')
}, { }, {
find: 'uni-platform', find: 'uni-platform',
replacement: resolve('src/platforms/quickapp-vue') replacement: resolve('src/platforms/quickapp-native')
}, { }, {
find: 'uni-platforms', find: 'uni-platforms',
replacement: resolve('src/platforms') replacement: resolve('src/platforms')
...@@ -48,10 +48,10 @@ alias({ ...@@ -48,10 +48,10 @@ alias({
replacement: resolve('src/core/helpers') replacement: resolve('src/core/helpers')
}, { }, {
find: 'uni-invoke-api', find: 'uni-invoke-api',
replacement: resolve('src/platforms/quickapp-vue/service/invoke-api') replacement: resolve('src/platforms/quickapp-native/service/invoke-api')
}, { }, {
find: 'uni-service-api', find: 'uni-service-api',
replacement: resolve('src/platforms/quickapp-vue/service/api') replacement: resolve('src/platforms/quickapp-native/service/api')
}, { }, {
find: 'uni-api-protocol', find: 'uni-api-protocol',
replacement: resolve('src/core/helpers/protocol') replacement: resolve('src/core/helpers/protocol')
...@@ -62,7 +62,7 @@ requireContext(), ...@@ -62,7 +62,7 @@ requireContext(),
commonjs(), commonjs(),
replace({ replace({
__PLATFORM__: JSON.stringify(process.env.UNI_PLATFORM), __PLATFORM__: JSON.stringify(process.env.UNI_PLATFORM),
__PLATFORM_TITLE__: '快应用(Vue)版' __PLATFORM_TITLE__: '快应用(Native)版'
}) })
] ]
...@@ -74,11 +74,11 @@ module.exports = function (type) { ...@@ -74,11 +74,11 @@ module.exports = function (type) {
let input = '' let input = ''
if (type === 'bridge') { if (type === 'bridge') {
input = 'src/platforms/quickapp-vue/runtime/bridge.js' input = 'src/platforms/quickapp-native/runtime/bridge.js'
} else if (type === 'app') { } else if (type === 'app') {
input = 'src/platforms/quickapp-vue/runtime/app.js' input = 'src/platforms/quickapp-native/runtime/app.js'
} else if (type === 'page') { } else if (type === 'page') {
input = 'src/platforms/quickapp-vue/runtime/page.js' input = 'src/platforms/quickapp-native/runtime/page.js'
} }
return { return {
......
...@@ -18,11 +18,11 @@ ...@@ -18,11 +18,11 @@
"build:mp-baidu": "cross-env UNI_PLATFORM=mp-baidu rollup -c build/rollup.config.mp.js", "build:mp-baidu": "cross-env UNI_PLATFORM=mp-baidu rollup -c build/rollup.config.mp.js",
"build:mp-alipay": "cross-env UNI_PLATFORM=mp-alipay rollup -c build/rollup.config.mp.js", "build:mp-alipay": "cross-env UNI_PLATFORM=mp-alipay rollup -c build/rollup.config.mp.js",
"build:mp-toutiao": "cross-env UNI_PLATFORM=mp-toutiao rollup -c build/rollup.config.mp.js", "build:mp-toutiao": "cross-env UNI_PLATFORM=mp-toutiao rollup -c build/rollup.config.mp.js",
"build:quickapp-light": "cross-env UNI_PLATFORM=quickapp-light rollup -c build/rollup.config.mp.js", "build:quickapp-webview": "cross-env UNI_PLATFORM=quickapp-webview rollup -c build/rollup.config.mp.js",
"build:mp-weixin:mp": "cross-env UNI_PLATFORM=mp-weixin UNI_MP=true rollup -c build/rollup.config.mp.js", "build:mp-weixin:mp": "cross-env UNI_PLATFORM=mp-weixin UNI_MP=true rollup -c build/rollup.config.mp.js",
"build:mp-weixin:wxs": "rollup -c build/rollup.config.wxs.js", "build:mp-weixin:wxs": "rollup -c build/rollup.config.wxs.js",
"build:quickapp-vue": "cross-env NODE_ENV=development node build/build.qa.js && cross-env NODE_ENV=production node build/build.qa.js", "build:quickapp-native": "cross-env NODE_ENV=development node build/build.qa.js && cross-env NODE_ENV=production node build/build.qa.js",
"build:runtime": "npm run lint && npm run build:mp-weixin && npm run build:mp-qq && npm run build:mp-alipay && npm run build:mp-baidu && npm run build:mp-toutiao && npm run build:app-plus && npm run build:quickapp-light && npm run build:quickapp-vue", "build:runtime": "npm run lint && npm run build:mp-weixin && npm run build:mp-qq && npm run build:mp-alipay && npm run build:mp-baidu && npm run build:mp-toutiao && npm run build:app-plus && npm run build:quickapp-webview && npm run build:quickapp-native",
"build:stat": "npm run lint && rollup -c build/rollup.config.stat.js", "build:stat": "npm run lint && rollup -c build/rollup.config.stat.js",
"build:web-view": "rollup -c build/rollup.config.web-view.js", "build:web-view": "rollup -c build/rollup.config.web-view.js",
"test:cli": "cross-env NODE_ENV=test jest", "test:cli": "cross-env NODE_ENV=test jest",
......
...@@ -359,10 +359,10 @@ function initAutoImportScanComponents () { ...@@ -359,10 +359,10 @@ function initAutoImportScanComponents () {
const components = getAutoComponentsByDir(componentsPath) const components = getAutoComponentsByDir(componentsPath)
if (process.env.UNI_PLATFORM === 'quickapp-vue') { if (process.env.UNI_PLATFORM === 'quickapp-native') {
if (!uniQuickAppAutoImportScanComponents) { if (!uniQuickAppAutoImportScanComponents) {
uniQuickAppAutoImportScanComponents = getAutoComponentsByDir( uniQuickAppAutoImportScanComponents = getAutoComponentsByDir(
path.resolve(require.resolve('@dcloudio/uni-quickapp-vue'), '../../components'), path.resolve(require.resolve('@dcloudio/uni-quickapp-native'), '../../components'),
true true
) )
} }
......
const migrate = require('../lib/index') // const migrate = require('../lib/index')
migrate('/Users/fxy/Downloads/wa-vantui_1.1') // migrate('/Users/fxy/Downloads/wa-vantui_1.1')
// migrate('/Users/fxy/Downloads/wa-vantui_1.1/pages') // migrate('/Users/fxy/Downloads/wa-vantui_1.1/pages')
// const { const {
// parse parse
// } = require('mustache') } = require('mustache')
// console.log(parse("van-notice-bar__content {{ !scrollable && !wrapable ? 'van-ellipsis' : '' }}"))
function parseMustache(expr, identifier = false) {
if (!expr) {
return ''
}
const tokens = parse(expr)
const isIdentifier = tokens.length === 1
return tokens.map(token => {
if (token[0] === 'text') {
if (identifier) {
return token[1]
}
return `'${token[1]}'`
} else if (token[0] === '!') { // {{ !loading }}
return `(!${token[1]})`
} else if (token[0] === 'name') {
if (isIdentifier) {
return token[1]
}
return `(${token[1]})`
}
}).join('+')
}
console.log(parseMustache("click ",true)==='click ')
// const { // const {
// transformTemplate // transformTemplate
......
...@@ -9,11 +9,11 @@ describe('wxml:compiler', () => { ...@@ -9,11 +9,11 @@ describe('wxml:compiler', () => {
it('generate event', () => { it('generate event', () => {
assertCodegen( assertCodegen(
`<view bindtouchstart="startDrag" catchtouchmove="{{ catchMove ? 'noop' : '' }}"/>`, `<view bindtouchstart="startDrag" catchtouchmove="{{ catchMove ? 'noop' : '' }}"/>`,
`<uni-shadow-root><view @touchstart="startDrag" @touchmove.stop.prevent="catchMove ? 'noop' : ''"></view></uni-shadow-root>` `<uni-shadow-root><view @touchstart="startDrag" @touchmove.stop.prevent="_$self[(catchMove ? 'noop' : '')||'_$noop']($event)"></view></uni-shadow-root>`
) )
assertCodegen( assertCodegen(
`<uni-transition bind:click="click" bindtouchstart="startDrag" catchtouchmove="{{ catchMove ? 'noop' : '' }}"/>`, `<uni-transition bind:click="click" bindtouchstart="startDrag" catchtouchmove="{{ catchMove ? 'noop' : '' }}"/>`,
`<uni-shadow-root><uni-transition @click="click" @touchstart.native="startDrag" @touchmove.native.stop.prevent="catchMove ? 'noop' : ''"></uni-transition></uni-shadow-root>` `<uni-shadow-root><uni-transition @click="click" @touchstart.native="startDrag" @touchmove.native.stop.prevent="_$self[(catchMove ? 'noop' : '')||'_$noop']($event)"></uni-transition></uni-shadow-root>`
) )
}) })
it('generate class', () => { it('generate class', () => {
......
...@@ -127,7 +127,7 @@ function transformFor(attribs) { ...@@ -127,7 +127,7 @@ function transformFor(attribs) {
if (vKey) { if (vKey) {
if (vKey === '*this') { if (vKey === '*this') {
vKey = vItem vKey = vItem
} else if (vKey !== vItem && vKey.indexOf('.')===-1) {// wx:for-key="{{item.value}}" } else if (vKey !== vItem && vKey.indexOf('.') === -1) { // wx:for-key="{{item.value}}"
vKey = vItem + '.' + vKey vKey = vItem + '.' + vKey
} }
attribs[':key'] = vKey attribs[':key'] = vKey
...@@ -163,7 +163,11 @@ function transformEvent(name, value, attribs, state) { ...@@ -163,7 +163,11 @@ function transformEvent(name, value, attribs, state) {
event = transformEventName(name.replace(captureCatchRE, ''), state) + '.stop.prevent.capture' event = transformEventName(name.replace(captureCatchRE, ''), state) + '.stop.prevent.capture'
} }
if (event !== name) { if (event !== name) {
attribs[event] = parseMustache(value, true) let newValue = parseMustache(value, true)
if (newValue !== value) {
newValue = `_$self[(${newValue})||'_$noop']($event)`
}
attribs[event] = newValue
return true return true
} }
} }
......
...@@ -758,6 +758,9 @@ var polyfill = { ...@@ -758,6 +758,9 @@ var polyfill = {
beforeCreate () { beforeCreate () {
// 取消 development 时的 Proxy,避免小程序组件模板中使用尚未定义的属性告警 // 取消 development 时的 Proxy,避免小程序组件模板中使用尚未定义的属性告警
this._renderProxy = this; this._renderProxy = this;
this._$self = this;
this._$noop = noop;
}, },
created () { // properties 中可能会访问 methods,故需要在 created 中初始化 created () { // properties 中可能会访问 methods,故需要在 created 中初始化
initState(this); initState(this);
......
...@@ -24,7 +24,7 @@ function getProjectName(e, t) { ...@@ -24,7 +24,7 @@ function getProjectName(e, t) {
const stripJsonComments = require('strip-json-comments'); const stripJsonComments = require('strip-json-comments');
const r = _path.default.join(e, t, "manifest.json"); const r = _path.default.join(e, t, "manifest.json");
const s = JSON.parse(stripJsonComments(_fs.default.readFileSync(r).toString())) const s = JSON.parse(stripJsonComments(_fs.default.readFileSync(r).toString()))
return s && s['quickapp-vue'] && s['quickapp-vue']['package'] || s.name || "Bundle" return s && s['quickapp-native'] && s['quickapp-native']['package'] || s.name || "Bundle"
} catch (e) { } catch (e) {
_sharedUtils.colorconsole.error(`### App Server ### 获取项目名称出错:${e.message}`) _sharedUtils.colorconsole.error(`### App Server ### 获取项目名称出错:${e.message}`)
} }
...@@ -50,7 +50,7 @@ function getDistFilePath(e, t, r) { ...@@ -50,7 +50,7 @@ function getDistFilePath(e, t, r) {
let s; let s;
if (!process.env.UNI_OUTPUT_DIR) { if (!process.env.UNI_OUTPUT_DIR) {
const mode = process.env.NODE_ENV === 'production' ? 'build' : 'dev' const mode = process.env.NODE_ENV === 'production' ? 'build' : 'dev'
process.env.UNI_OUTPUT_DIR = _path.default.join(process.cwd(), 'dist/' + mode + '/quickapp-vue') process.env.UNI_OUTPUT_DIR = _path.default.join(process.cwd(), 'dist/' + mode + '/quickapp-native')
} }
return s = _path.default.join(process.env.UNI_OUTPUT_DIR, `${t}.debug.${r}`), _fs.default.existsSync(s) ? s : (s = return s = _path.default.join(process.env.UNI_OUTPUT_DIR, `${t}.debug.${r}`), _fs.default.existsSync(s) ? s : (s =
_path.default.join(e, _path.default.join(e,
......
...@@ -7,7 +7,7 @@ module.exports = config => { ...@@ -7,7 +7,7 @@ module.exports = config => {
.use('vue-loader') .use('vue-loader')
.loader(vueLoader.loader) .loader(vueLoader.loader)
.tap(options => Object.assign(options, vueLoader.options({}, { .tap(options => Object.assign(options, vueLoader.options({}, {
'quickapp-vue': true 'quickapp-native': true
}))) })))
config.module config.module
......
...@@ -6,7 +6,7 @@ const PLATFORMS = [ ...@@ -6,7 +6,7 @@ const PLATFORMS = [
'mp-baidu', 'mp-baidu',
'mp-alipay', 'mp-alipay',
'mp-toutiao', 'mp-toutiao',
'quickapp-vue' 'quickapp-native'
] ]
const DISPLAY = { const DISPLAY = {
...@@ -44,8 +44,8 @@ function parseStyle(style = {}) { ...@@ -44,8 +44,8 @@ function parseStyle(style = {}) {
} }
} }
}) })
if (style['quickapp-vue']) { if (style['quickapp-native']) {
Object.assign(ret, style['quickapp-vue']) Object.assign(ret, style['quickapp-native'])
} }
return ret return ret
} }
......
...@@ -27,7 +27,7 @@ function getPages(pagesJson) { ...@@ -27,7 +27,7 @@ function getPages(pagesJson) {
module.exports = function(pagesJson, manifestJson, loader) { module.exports = function(pagesJson, manifestJson, loader) {
const manifest = manifestJson['quickapp-vue'] || {} const manifest = manifestJson['quickapp-native'] || {}
parseBase(manifest, manifestJson) parseBase(manifest, manifestJson)
......
...@@ -5,7 +5,7 @@ module.exports = function () { ...@@ -5,7 +5,7 @@ module.exports = function () {
const manifest = global.framework.manifest const manifest = global.framework.manifest
if (manifest.package === 'Bundle') { if (manifest.package === 'Bundle') {
console.error('> 建议配置 manifest.json->quickapp-vue->package 应用包名') console.error('> 建议配置 manifest.json->quickapp-native->package 应用包名')
} }
const signPath = './sign/' + (process.env.NODE_ENV === 'production' ? 'release' : 'debug') const signPath = './sign/' + (process.env.NODE_ENV === 'production' ? 'release' : 'debug')
......
{ {
"name": "@dcloudio/uni-quickapp-vue", "name": "@dcloudio/uni-quickapp-native",
"version": "2.0.0-alpha-27020200429001", "version": "2.0.0-alpha-26920200407011",
"description": "uni-app quickapp-vue", "description": "uni-app quickapp-native",
"main": "dist/vue.prod.js", "main": "dist/vue.prod.js",
"repository": { "repository": {
"type": "git", "type": "git",
"url": "git+https://github.com/dcloudio/uni-app.git", "url": "git+https://github.com/dcloudio/uni-app.git",
"directory": "packages/uni-quickapp-vue" "directory": "packages/uni-quickapp-native"
}, },
"files": [ "files": [
"bin", "bin",
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
"license": "Apache-2.0", "license": "Apache-2.0",
"gitHead": "5ed6c58ef3a74a43b11bd65f8f6f488e470716c8", "gitHead": "5ed6c58ef3a74a43b11bd65f8f6f488e470716c8",
"uni-app": { "uni-app": {
"name": "quickapp-vue", "name": "quickapp-native",
"title": "快应用(Vue)版" "title": "快应用(Vue)版"
}, },
"dependencies": { "dependencies": {
......
...@@ -417,7 +417,7 @@ function processArgs (methodName, fromArgs, argsOption = {}, returnValue = {}, k ...@@ -417,7 +417,7 @@ function processArgs (methodName, fromArgs, argsOption = {}, returnValue = {}, k
keyOption = keyOption(fromArgs[key], fromArgs, toArgs); keyOption = keyOption(fromArgs[key], fromArgs, toArgs);
} }
if (!keyOption) { // 不支持的参数 if (!keyOption) { // 不支持的参数
console.warn(`快应用(Light)版 ${methodName}暂不支持${key}`); console.warn(`快应用(Webview)版 ${methodName}暂不支持${key}`);
} else if (isStr(keyOption)) { // 重写参数 key } else if (isStr(keyOption)) { // 重写参数 key
toArgs[keyOption] = fromArgs[key]; toArgs[keyOption] = fromArgs[key];
} else if (isPlainObject(keyOption)) { // {name:newName,value:value}可重新指定参数 key:value } else if (isPlainObject(keyOption)) { // {name:newName,value:value}可重新指定参数 key:value
...@@ -450,7 +450,7 @@ function wrapper (methodName, method) { ...@@ -450,7 +450,7 @@ function wrapper (methodName, method) {
const protocol = protocols[methodName]; const protocol = protocols[methodName];
if (!protocol) { // 暂不支持的 api if (!protocol) { // 暂不支持的 api
return function () { return function () {
console.error(`快应用(Light)版 暂不支持${methodName}`); console.error(`快应用(Webview)版 暂不支持${methodName}`);
} }
} }
return function (arg1, arg2) { // 目前 api 最多两个参数 return function (arg1, arg2) { // 目前 api 最多两个参数
...@@ -1146,7 +1146,7 @@ function parseBaseApp (vm, { ...@@ -1146,7 +1146,7 @@ function parseBaseApp (vm, {
Vue.prototype.$store = vm.$options.store; Vue.prototype.$store = vm.$options.store;
} }
Vue.prototype.mpHost = "quickapp-light"; Vue.prototype.mpHost = "quickapp-webview";
Vue.mixin({ Vue.mixin({
beforeCreate () { beforeCreate () {
...@@ -1580,7 +1580,7 @@ canIUses.forEach(canIUseApi => { ...@@ -1580,7 +1580,7 @@ canIUses.forEach(canIUseApi => {
let uni = {}; let uni = {};
if (typeof Proxy !== 'undefined' && "quickapp-light" !== 'app-plus') { if (typeof Proxy !== 'undefined' && "quickapp-webview" !== 'app-plus') {
uni = new Proxy({}, { uni = new Proxy({}, {
get (target, name) { get (target, name) {
if (target[name]) { if (target[name]) {
......
...@@ -31,10 +31,10 @@ module.exports = { ...@@ -31,10 +31,10 @@ module.exports = {
}, },
validate (platformOptions, manifestJson) { validate (platformOptions, manifestJson) {
if (!platformOptions.package) { if (!platformOptions.package) {
console.warn('manifest.json->quickapp-light 缺少 package 配置') console.warn('manifest.json->quickapp-webview 缺少 package 配置')
} }
if (!platformOptions.icon) { if (!platformOptions.icon) {
console.warn('manifest.json->quickapp-light 缺少 icon 配置') console.warn('manifest.json->quickapp-webview 缺少 icon 配置')
} }
}, },
copyWebpackOptions (platformOptions, vueOptions) { copyWebpackOptions (platformOptions, vueOptions) {
......
{ {
"name": "@dcloudio/uni-quickapp-light", "name": "@dcloudio/uni-quickapp-webview",
"version": "2.0.0-alpha-27020200429001", "version": "2.0.0-alpha-26920200407011",
"description": "uni-app quickapp-light", "description": "uni-app quickapp-webview",
"main": "dist/index.js", "main": "dist/index.js",
"repository": { "repository": {
"type": "git", "type": "git",
"url": "git+https://github.com/dcloudio/uni-app.git", "url": "git+https://github.com/dcloudio/uni-app.git",
"directory": "packages/uni-quickapp-light" "directory": "packages/uni-quickapp-webview"
}, },
"scripts": { "scripts": {
"test": "echo \"Error: no test specified\" && exit 1" "test": "echo \"Error: no test specified\" && exit 1"
...@@ -14,8 +14,8 @@ ...@@ -14,8 +14,8 @@
"author": "fxy060608", "author": "fxy060608",
"license": "Apache-2.0", "license": "Apache-2.0",
"uni-app": { "uni-app": {
"name": "quickapp-light", "name": "quickapp-webview",
"title": "快应用(Light)版" "title": "快应用(Webview)版"
}, },
"gitHead": "56868b5e04d0c94c33e40d13f26937b43ea05156" "gitHead": "5ed6c58ef3a74a43b11bd65f8f6f488e470716c8"
} }
...@@ -6,7 +6,7 @@ function assertCodegen (template, templateCode, renderCode = 'with(this){}', opt ...@@ -6,7 +6,7 @@ function assertCodegen (template, templateCode, renderCode = 'with(this){}', opt
mp: Object.assign({ mp: Object.assign({
minified: true, minified: true,
isTest: true, isTest: true,
platform: 'quickapp-light' platform: 'quickapp-webview'
}, options) }, options)
}) })
...@@ -14,7 +14,7 @@ function assertCodegen (template, templateCode, renderCode = 'with(this){}', opt ...@@ -14,7 +14,7 @@ function assertCodegen (template, templateCode, renderCode = 'with(this){}', opt
expect(res.render).toBe(renderCode) expect(res.render).toBe(renderCode)
} }
describe('mp:compiler-quickapp-light', () => { describe('mp:compiler-quickapp-webview', () => {
it('generate v-for directive', () => { it('generate v-for directive', () => {
assertCodegen( assertCodegen(
'<view><view v-for="(item,index) in items" :key="index"></view></view>', '<view><view v-for="(item,index) in items" :key="index"></view></view>',
......
...@@ -86,7 +86,7 @@ function compileTemplate (source, options, compile) { ...@@ -86,7 +86,7 @@ function compileTemplate (source, options, compile) {
const compilerModule = { const compilerModule = {
preTransformNode (el, options) { preTransformNode (el, options) {
if (process.env.UNI_PLATFORM === 'quickapp-vue') { if (process.env.UNI_PLATFORM === 'quickapp-native') {
// 排查所有标签 // 排查所有标签
(options.isUnaryTag.autoComponents || (options.isUnaryTag.autoComponents = new Set())).add(el.tag) (options.isUnaryTag.autoComponents || (options.isUnaryTag.autoComponents = new Set())).add(el.tag)
} else if (isComponent(el.tag) && el.tag !== 'App') { // App.vue } else if (isComponent(el.tag) && el.tag !== 'App') { // App.vue
......
...@@ -78,12 +78,12 @@ module.exports = { ...@@ -78,12 +78,12 @@ module.exports = {
console.error(source) console.error(source)
throw e throw e
} }
} else if (options['quickapp-vue']) { } else if (options['quickapp-native']) {
// 后续改版,应统一由具体包实现 // 后续改版,应统一由具体包实现
(options.modules || (options.modules = [])).push(require('@dcloudio/uni-quickapp-vue/lib/compiler-module')) (options.modules || (options.modules = [])).push(require('@dcloudio/uni-quickapp-native/lib/compiler-module'))
} }
if (!options.mp) { // h5,quickapp-vue if (!options.mp) { // h5,quickapp-native
return compileTemplate(source, options, compile) return compileTemplate(source, options, compile)
} }
......
...@@ -9,23 +9,23 @@ module.exports = (api, options, rootOptions) => { ...@@ -9,23 +9,23 @@ module.exports = (api, options, rootOptions) => {
info: 'node node_modules/@dcloudio/vue-cli-plugin-uni/commands/info.js', info: 'node node_modules/@dcloudio/vue-cli-plugin-uni/commands/info.js',
serve: 'npm run dev:h5', serve: 'npm run dev:h5',
build: 'npm run build:h5', build: 'npm run build:h5',
'serve:quickapp-vue': 'node node_modules/@dcloudio/uni-quickapp-vue/bin/serve.js', 'serve:quickapp-native': 'node node_modules/@dcloudio/uni-quickapp-native/bin/serve.js',
'dev:h5': 'cross-env NODE_ENV=development UNI_PLATFORM=h5 vue-cli-service uni-serve', 'dev:h5': 'cross-env NODE_ENV=development UNI_PLATFORM=h5 vue-cli-service uni-serve',
'dev:mp-qq': 'cross-env NODE_ENV=development UNI_PLATFORM=mp-qq vue-cli-service uni-build --watch', 'dev:mp-qq': 'cross-env NODE_ENV=development UNI_PLATFORM=mp-qq vue-cli-service uni-build --watch',
'dev:mp-weixin': 'cross-env NODE_ENV=development UNI_PLATFORM=mp-weixin vue-cli-service uni-build --watch', 'dev:mp-weixin': 'cross-env NODE_ENV=development UNI_PLATFORM=mp-weixin vue-cli-service uni-build --watch',
'dev:mp-baidu': 'cross-env NODE_ENV=development UNI_PLATFORM=mp-baidu vue-cli-service uni-build --watch', 'dev:mp-baidu': 'cross-env NODE_ENV=development UNI_PLATFORM=mp-baidu vue-cli-service uni-build --watch',
'dev:mp-alipay': 'cross-env NODE_ENV=development UNI_PLATFORM=mp-alipay vue-cli-service uni-build --watch', 'dev:mp-alipay': 'cross-env NODE_ENV=development UNI_PLATFORM=mp-alipay vue-cli-service uni-build --watch',
'dev:mp-toutiao': 'cross-env NODE_ENV=development UNI_PLATFORM=mp-toutiao vue-cli-service uni-build --watch', 'dev:mp-toutiao': 'cross-env NODE_ENV=development UNI_PLATFORM=mp-toutiao vue-cli-service uni-build --watch',
'dev:quickapp-vue': 'cross-env NODE_ENV=development UNI_PLATFORM=quickapp-vue vue-cli-service uni-build --watch', 'dev:quickapp-native': 'cross-env NODE_ENV=development UNI_PLATFORM=quickapp-native vue-cli-service uni-build --watch',
'dev:quickapp-light': 'cross-env NODE_ENV=development UNI_PLATFORM=quickapp-light vue-cli-service uni-build --watch', 'dev:quickapp-webview': 'cross-env NODE_ENV=development UNI_PLATFORM=quickapp-webview vue-cli-service uni-build --watch',
'build:h5': 'cross-env NODE_ENV=production UNI_PLATFORM=h5 vue-cli-service uni-build', 'build:h5': 'cross-env NODE_ENV=production UNI_PLATFORM=h5 vue-cli-service uni-build',
'build:mp-qq': 'cross-env NODE_ENV=production UNI_PLATFORM=mp-qq vue-cli-service uni-build', 'build:mp-qq': 'cross-env NODE_ENV=production UNI_PLATFORM=mp-qq vue-cli-service uni-build',
'build:mp-weixin': 'cross-env NODE_ENV=production UNI_PLATFORM=mp-weixin vue-cli-service uni-build', 'build:mp-weixin': 'cross-env NODE_ENV=production UNI_PLATFORM=mp-weixin vue-cli-service uni-build',
'build:mp-baidu': 'cross-env NODE_ENV=production UNI_PLATFORM=mp-baidu vue-cli-service uni-build', 'build:mp-baidu': 'cross-env NODE_ENV=production UNI_PLATFORM=mp-baidu vue-cli-service uni-build',
'build:mp-alipay': 'cross-env NODE_ENV=production UNI_PLATFORM=mp-alipay vue-cli-service uni-build', 'build:mp-alipay': 'cross-env NODE_ENV=production UNI_PLATFORM=mp-alipay vue-cli-service uni-build',
'build:mp-toutiao': 'cross-env NODE_ENV=production UNI_PLATFORM=mp-toutiao vue-cli-service uni-build', 'build:mp-toutiao': 'cross-env NODE_ENV=production UNI_PLATFORM=mp-toutiao vue-cli-service uni-build',
'build:quickapp-vue': 'cross-env NODE_ENV=production UNI_PLATFORM=quickapp-vue vue-cli-service uni-build', 'build:quickapp-native': 'cross-env NODE_ENV=production UNI_PLATFORM=quickapp-native vue-cli-service uni-build',
'build:quickapp-light': 'cross-env NODE_ENV=production UNI_PLATFORM=quickapp-light vue-cli-service uni-build', 'build:quickapp-webview': 'cross-env NODE_ENV=production UNI_PLATFORM=quickapp-webview vue-cli-service uni-build',
'dev:custom': 'cross-env NODE_ENV=development uniapp-cli custom', 'dev:custom': 'cross-env NODE_ENV=development uniapp-cli custom',
'build:custom': 'cross-env NODE_ENV=production uniapp-cli custom', 'build:custom': 'cross-env NODE_ENV=production uniapp-cli custom',
'test:h5': 'cross-env UNI_PLATFORM=h5 jest -i', 'test:h5': 'cross-env UNI_PLATFORM=h5 jest -i',
...@@ -45,8 +45,8 @@ module.exports = (api, options, rootOptions) => { ...@@ -45,8 +45,8 @@ module.exports = (api, options, rootOptions) => {
'@dcloudio/uni-mp-baidu': version, '@dcloudio/uni-mp-baidu': version,
'@dcloudio/uni-mp-alipay': version, '@dcloudio/uni-mp-alipay': version,
'@dcloudio/uni-mp-toutiao': version, '@dcloudio/uni-mp-toutiao': version,
'@dcloudio/uni-quickapp-light': version, '@dcloudio/uni-quickapp-webview': version,
'@dcloudio/uni-quickapp-vue': version, '@dcloudio/uni-quickapp-native': version,
'@dcloudio/uni-stat': version, '@dcloudio/uni-stat': version,
flyio: '^0.6.2', flyio: '^0.6.2',
vuex: '^3.2.0' vuex: '^3.2.0'
......
...@@ -19,7 +19,7 @@ module.exports = (api, options) => { ...@@ -19,7 +19,7 @@ module.exports = (api, options) => {
initBuildCommand(api, options) initBuildCommand(api, options)
if (process.env.UNI_PLATFORM === 'quickapp-vue') { if (process.env.UNI_PLATFORM === 'quickapp-native') {
process.env.UNI_OUTPUT_DIR = path.resolve(process.env.UNI_OUTPUT_DIR, 'build') process.env.UNI_OUTPUT_DIR = path.resolve(process.env.UNI_OUTPUT_DIR, 'build')
Object.assign(options, { Object.assign(options, {
assetsDir, assetsDir,
...@@ -35,7 +35,7 @@ module.exports = (api, options) => { ...@@ -35,7 +35,7 @@ module.exports = (api, options) => {
api.configureWebpack(require('./lib/configure-webpack')(platformOptions, manifestPlatformOptions, options, api)) api.configureWebpack(require('./lib/configure-webpack')(platformOptions, manifestPlatformOptions, options, api))
api.chainWebpack(require('./lib/chain-webpack')(platformOptions, options, api)) api.chainWebpack(require('./lib/chain-webpack')(platformOptions, options, api))
const vueConfig = require('@dcloudio/uni-quickapp-vue/lib/vue.config.js') const vueConfig = require('@dcloudio/uni-quickapp-native/lib/vue.config.js')
api.configureWebpack(vueConfig.configureWebpack) api.configureWebpack(vueConfig.configureWebpack)
api.chainWebpack(vueConfig.chainWebpack) api.chainWebpack(vueConfig.chainWebpack)
return return
......
...@@ -198,8 +198,10 @@ module.exports = function configureWebpack (platformOptions, manifestPlatformOpt ...@@ -198,8 +198,10 @@ module.exports = function configureWebpack (platformOptions, manifestPlatformOpt
plugins.push(new CopyWebpackPlugin(getCopyWebpackPluginOptions(manifestPlatformOptions, vueOptions))) plugins.push(new CopyWebpackPlugin(getCopyWebpackPluginOptions(manifestPlatformOptions, vueOptions)))
} }
try {
const automatorJson = require.resolve('@dcloudio/uni-automator/dist/automator.json')
plugins.push(new CopyWebpackPlugin([{ plugins.push(new CopyWebpackPlugin([{
from: require.resolve('@dcloudio/uni-automator/dist/automator.json'), from: automatorJson,
to: '../.automator/' + (process.env.UNI_SUB_PLATFORM || process.env.UNI_PLATFORM) + to: '../.automator/' + (process.env.UNI_SUB_PLATFORM || process.env.UNI_PLATFORM) +
'/.automator.json', '/.automator.json',
transform (content) { transform (content) {
...@@ -211,6 +213,7 @@ module.exports = function configureWebpack (platformOptions, manifestPlatformOpt ...@@ -211,6 +213,7 @@ module.exports = function configureWebpack (platformOptions, manifestPlatformOpt
return '' return ''
} }
}])) }]))
} catch (e) {}
if (process.UNI_SCRIPT_ENV && Object.keys(process.UNI_SCRIPT_ENV).length) { if (process.UNI_SCRIPT_ENV && Object.keys(process.UNI_SCRIPT_ENV).length) {
// custom define // custom define
......
...@@ -289,7 +289,7 @@ if (process.env.UNI_USING_NATIVE || process.env.UNI_USING_V3_NATIVE) { ...@@ -289,7 +289,7 @@ if (process.env.UNI_USING_NATIVE || process.env.UNI_USING_V3_NATIVE) {
console.log('当前nvue编译模式' + (process.env.UNI_USING_V3_NATIVE ? '(v3)' : '') + '' + (isNVueCompiler ? 'uni-app' console.log('当前nvue编译模式' + (process.env.UNI_USING_V3_NATIVE ? '(v3)' : '') + '' + (isNVueCompiler ? 'uni-app'
: 'weex') + : 'weex') +
' 。编译模式差异见:https://ask.dcloud.net.cn/article/36074') ' 。编译模式差异见:https://ask.dcloud.net.cn/article/36074')
} else if (process.env.UNI_PLATFORM !== 'h5' && process.env.UNI_PLATFORM !== 'quickapp-vue') { } else if (process.env.UNI_PLATFORM !== 'h5' && process.env.UNI_PLATFORM !== 'quickapp-native') {
try { try {
let info = '' let info = ''
if (process.env.UNI_PLATFORM === 'app-plus') { if (process.env.UNI_PLATFORM === 'app-plus') {
......
...@@ -241,7 +241,7 @@ if (process.env.UNI_USING_V3) { ...@@ -241,7 +241,7 @@ if (process.env.UNI_USING_V3) {
// Transform each property declaration here // Transform each property declaration here
decl.value = tranformValue(decl, opts) decl.value = tranformValue(decl, opts)
}) })
if (process.env.UNI_PLATFORM !== 'quickapp-vue') { if (process.env.UNI_PLATFORM !== 'quickapp-native') {
rule.selectors = rule.selectors.map(complexSelector => { rule.selectors = rule.selectors.map(complexSelector => {
return transformSelector(complexSelector, simpleSelectors => { return transformSelector(complexSelector, simpleSelectors => {
return simpleSelectors.walkTags(tag => { return simpleSelectors.walkTags(tag => {
......
...@@ -69,8 +69,8 @@ module.exports = function (content) { ...@@ -69,8 +69,8 @@ module.exports = function (content) {
if (process.env.UNI_PLATFORM === 'h5') { if (process.env.UNI_PLATFORM === 'h5') {
return require('./platforms/h5')(pagesJson, manifestJson, this) return require('./platforms/h5')(pagesJson, manifestJson, this)
} }
if (process.env.UNI_PLATFORM === 'quickapp-vue') { if (process.env.UNI_PLATFORM === 'quickapp-native') {
return require('./platforms/quickapp-vue')(pagesJson, manifestJson, this) return require('./platforms/quickapp-native')(pagesJson, manifestJson, this)
} }
if (!process.env.UNI_USING_V3) { if (!process.env.UNI_USING_V3) {
......
...@@ -44,7 +44,7 @@ module.exports = function (content) { ...@@ -44,7 +44,7 @@ module.exports = function (content) {
if ( if (
process.env.UNI_USING_COMPONENTS || process.env.UNI_USING_COMPONENTS ||
process.env.UNI_PLATFORM === 'h5' || process.env.UNI_PLATFORM === 'h5' ||
process.env.UNI_PLATFORM === 'quickapp-vue' process.env.UNI_PLATFORM === 'quickapp-native'
) { ) {
return require('./index-new').call(this, content) return require('./index-new').call(this, content)
} }
......
module.exports = function (pagesJson, manifestJson, loader) { module.exports = function (pagesJson, manifestJson, loader) {
return require('@dcloudio/uni-quickapp-vue/lib/manifest')(pagesJson, manifestJson, loader) return require('@dcloudio/uni-quickapp-native/lib/manifest')(pagesJson, manifestJson, loader)
} }
...@@ -16,7 +16,7 @@ module.exports = function (pagesJson, manifestJson) { ...@@ -16,7 +16,7 @@ module.exports = function (pagesJson, manifestJson) {
manifestJson.versionName && (baseJson.versionName = manifestJson.versionName) manifestJson.versionName && (baseJson.versionName = manifestJson.versionName)
manifestJson.versionCode && (baseJson.versionCode = manifestJson.versionCode) manifestJson.versionCode && (baseJson.versionCode = manifestJson.versionCode)
Object.assign(app.content, baseJson, manifestJson['quickapp-light'] || {}) Object.assign(app.content, baseJson, manifestJson['quickapp-webview'] || {})
if (!app.content.package) { if (!app.content.package) {
app.content.package = manifestJson.name app.content.package = manifestJson.name
......
import {
noop
} from 'uni-shared'
import { import {
initState initState
} from './state/index' } from './state/index'
...@@ -19,6 +23,9 @@ export default { ...@@ -19,6 +23,9 @@ export default {
beforeCreate () { beforeCreate () {
// 取消 development 时的 Proxy,避免小程序组件模板中使用尚未定义的属性告警 // 取消 development 时的 Proxy,避免小程序组件模板中使用尚未定义的属性告警
this._renderProxy = this this._renderProxy = this
this._$self = this
this._$noop = noop
}, },
created () { // properties 中可能会访问 methods,故需要在 created 中初始化 created () { // properties 中可能会访问 methods,故需要在 created 中初始化
initState(this) initState(this)
......
...@@ -25,7 +25,7 @@ import { ...@@ -25,7 +25,7 @@ import {
} from 'uni-platforms/mp-weixin/runtime/web-view' } from 'uni-platforms/mp-weixin/runtime/web-view'
import { import {
initWebviewApi as initQuickappWebviewApi initWebviewApi as initQuickappWebviewApi
} from 'uni-platforms/quickapp-light/runtime/web-view' } from 'uni-platforms/quickapp-webview/runtime/web-view'
const UniAppJSBridgeReady = function () { const UniAppJSBridgeReady = function () {
window.UniAppJSBridge = true window.UniAppJSBridge = true
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册