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

refactor: quickapp

上级 7834536e
......@@ -51,18 +51,18 @@ dsl.onInitApp(function({
});`
})
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(
path.resolve(__dirname, '../packages/uni-quickapp-vue/dist/' + filename),
path.resolve(__dirname, '../packages/uni-quickapp-native/dist/' + filename),
vueCode + bridgeCode + appCode + pageCode, {
encoding: 'utf8'
}
)
if (process.env.NODE_ENV === 'production') { // 命令会执行dev,prod两次,仅prod时执行copy
const componentsSrc = path.resolve(__dirname, '../src/platforms/quickapp-vue/view/components/**/*')
const componentsDest = path.resolve(__dirname, '../packages/uni-quickapp-vue/components')
const componentsSrc = path.resolve(__dirname, '../src/platforms/quickapp-native/view/components/**/*')
const componentsDest = path.resolve(__dirname, '../packages/uni-quickapp-native/components')
del.sync([componentsDest])
......
......@@ -23,9 +23,9 @@ const PLATFORMS = {
prefix: 'tt',
title: '头条小程序'
},
'quickapp-light': {
'quickapp-webview': {
prefix: 'qa',
title: '快应用(Light)版'
title: '快应用(Webview)版'
},
'app-plus': {
prefix: 'wx',
......
......@@ -6,7 +6,7 @@ const commonjs = require('@rollup/plugin-commonjs')
const terser = require('rollup-plugin-terser')
const requireContext = require('../lib/rollup-plugin-require-context')
process.env.UNI_PLATFORM = 'quickapp-vue'
process.env.UNI_PLATFORM = 'quickapp-native'
const external = []
......@@ -36,7 +36,7 @@ alias({
replacement: resolve('src/core')
}, {
find: 'uni-platform',
replacement: resolve('src/platforms/quickapp-vue')
replacement: resolve('src/platforms/quickapp-native')
}, {
find: 'uni-platforms',
replacement: resolve('src/platforms')
......@@ -48,10 +48,10 @@ alias({
replacement: resolve('src/core/helpers')
}, {
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',
replacement: resolve('src/platforms/quickapp-vue/service/api')
replacement: resolve('src/platforms/quickapp-native/service/api')
}, {
find: 'uni-api-protocol',
replacement: resolve('src/core/helpers/protocol')
......@@ -62,7 +62,7 @@ requireContext(),
commonjs(),
replace({
__PLATFORM__: JSON.stringify(process.env.UNI_PLATFORM),
__PLATFORM_TITLE__: '快应用(Vue)版'
__PLATFORM_TITLE__: '快应用(Native)版'
})
]
......@@ -74,11 +74,11 @@ module.exports = function (type) {
let input = ''
if (type === 'bridge') {
input = 'src/platforms/quickapp-vue/runtime/bridge.js'
input = 'src/platforms/quickapp-native/runtime/bridge.js'
} else if (type === 'app') {
input = 'src/platforms/quickapp-vue/runtime/app.js'
input = 'src/platforms/quickapp-native/runtime/app.js'
} else if (type === 'page') {
input = 'src/platforms/quickapp-vue/runtime/page.js'
input = 'src/platforms/quickapp-native/runtime/page.js'
}
return {
......
......@@ -18,11 +18,11 @@
"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-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: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: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: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-webview && npm run build:quickapp-native",
"build:stat": "npm run lint && rollup -c build/rollup.config.stat.js",
"build:web-view": "rollup -c build/rollup.config.web-view.js",
"test:cli": "cross-env NODE_ENV=test jest",
......
......@@ -698,10 +698,10 @@ function initVueComponent (Vue, vueOptions) {
let VueComponent;
if (isFn(vueOptions)) {
VueComponent = vueOptions;
vueOptions = VueComponent.extendOptions;
} else {
VueComponent = Vue.extend(vueOptions);
}
vueOptions = VueComponent.options;
return [VueComponent, vueOptions]
}
......@@ -901,6 +901,11 @@ function wrapper$2 (event) {
event.detail = {};
}
if (hasOwn(event, 'markerId')) {
event.detail = typeof event.detail === 'object' ? event.detail : {};
event.detail.markerId = event.markerId;
}
if (isPlainObject(event.detail)) {
event.target = Object.assign({}, event.target, event.detail);
}
......@@ -1085,18 +1090,18 @@ function handleEvent (event) {
handlerCtx.$parent.$parent
) { // mp-weixin,mp-toutiao 抽象节点模拟 scoped slots
handlerCtx = handlerCtx.$parent.$parent;
}
if (methodName === '$emit') {
handlerCtx.$emit.apply(handlerCtx,
processEventArgs(
this.$vm,
event,
eventArray[1],
eventArray[2],
isCustom,
methodName
));
return
}
if (methodName === '$emit') {
handlerCtx.$emit.apply(handlerCtx,
processEventArgs(
this.$vm,
event,
eventArray[1],
eventArray[2],
isCustom,
methodName
));
return
}
const handler = handlerCtx[methodName];
if (!isFn(handler)) {
......@@ -1382,6 +1387,10 @@ function parseBaseComponent (vueComponentOptions, {
__e: handleEvent
}
};
// externalClasses
if (vueOptions.externalClasses) {
componentOptions.externalClasses = vueOptions.externalClasses;
}
if (Array.isArray(vueOptions.wxsCallMethods)) {
vueOptions.wxsCallMethods.forEach(callMethod => {
......@@ -1449,13 +1458,14 @@ const hooks$3 = [
'onNavigationBarButtonTap',
'onNavigationBarSearchInputChanged',
'onNavigationBarSearchInputConfirmed',
'onNavigationBarSearchInputClicked'
'onNavigationBarSearchInputClicked',
'onNavigationBarSearchInputFocusChanged'
];
function parsePage$1 (vuePageOptions) {
function parsePage$1 (vuePageOptions) {
const pageOptions = parsePage(vuePageOptions);
initHooks(pageOptions.methods, hooks$3);
initHooks(pageOptions.methods, hooks$3);
return pageOptions
}
......
此差异已折叠。
......@@ -359,10 +359,10 @@ function initAutoImportScanComponents () {
const components = getAutoComponentsByDir(componentsPath)
if (process.env.UNI_PLATFORM === 'quickapp-vue') {
if (process.env.UNI_PLATFORM === 'quickapp-native') {
if (!uniQuickAppAutoImportScanComponents) {
uniQuickAppAutoImportScanComponents = getAutoComponentsByDir(
path.resolve(require.resolve('@dcloudio/uni-quickapp-vue'), '../../components'),
path.resolve(require.resolve('@dcloudio/uni-quickapp-native'), '../../components'),
true
)
}
......
此差异已折叠。
......@@ -569,11 +569,11 @@ const protocols = { // 需要做转换的 API 列表
returnValue: {
apFilePath: 'tempFilePath'
}
},
getFileInfo: {
args: {
filePath: 'apFilePath'
}
},
getFileInfo: {
args: {
filePath: 'apFilePath'
}
},
chooseVideo: {
// 支付宝小程序文档中未找到(仅在getSetting处提及),但实际可用
......@@ -664,22 +664,19 @@ const protocols = { // 需要做转换的 API 列表
scanCode: {
name: 'scan',
args (fromArgs) {
if (fromArgs.scanType === 'qrCode') {
fromArgs.type = 'qr';
return {
onlyFromCamera: 'hideAlbum'
}
} else if (fromArgs.scanType === 'barCode') {
fromArgs.type = 'bar';
return {
onlyFromCamera: 'hideAlbum'
}
} else {
return {
scanType: false,
onlyFromCamera: 'hideAlbum'
if (fromArgs.scanType) {
switch (fromArgs.scanType[0]) {
case 'qrCode':
fromArgs.type = 'qr';
break
case 'barCode':
fromArgs.type = 'bar';
break
}
}
return {
onlyFromCamera: 'hideAlbum'
}
},
returnValue: {
code: 'result'
......@@ -1170,10 +1167,10 @@ function initVueComponent (Vue, vueOptions) {
let VueComponent;
if (isFn(vueOptions)) {
VueComponent = vueOptions;
vueOptions = VueComponent.extendOptions;
} else {
VueComponent = Vue.extend(vueOptions);
}
vueOptions = VueComponent.options;
return [VueComponent, vueOptions]
}
......@@ -1363,6 +1360,11 @@ function wrapper$1 (event) {
event.detail = {};
}
if (hasOwn(event, 'markerId')) {
event.detail = typeof event.detail === 'object' ? event.detail : {};
event.detail.markerId = event.markerId;
}
if (isPlainObject(event.detail)) {
event.target = Object.assign({}, event.target, event.detail);
}
......@@ -1547,18 +1549,18 @@ function handleEvent (event) {
handlerCtx.$parent.$parent
) { // mp-weixin,mp-toutiao 抽象节点模拟 scoped slots
handlerCtx = handlerCtx.$parent.$parent;
}
if (methodName === '$emit') {
handlerCtx.$emit.apply(handlerCtx,
processEventArgs(
this.$vm,
event,
eventArray[1],
eventArray[2],
isCustom,
methodName
));
return
}
if (methodName === '$emit') {
handlerCtx.$emit.apply(handlerCtx,
processEventArgs(
this.$vm,
event,
eventArray[1],
eventArray[2],
isCustom,
methodName
));
return
}
const handler = handlerCtx[methodName];
if (!isFn(handler)) {
......@@ -1807,6 +1809,10 @@ function initSpecialMethods (mpInstance) {
specialMethods.forEach(method => {
if (isFn(mpInstance.$vm[method])) {
mpInstance[method] = function (event) {
if (hasOwn(event, 'markerId')) {
event.detail = typeof event.detail === 'object' ? event.detail : {};
event.detail.markerId = event.markerId;
}
// TODO normalizeEvent
mpInstance.$vm[method](event);
};
......
......@@ -812,10 +812,10 @@ function initVueComponent (Vue, vueOptions) {
let VueComponent;
if (isFn(vueOptions)) {
VueComponent = vueOptions;
vueOptions = VueComponent.extendOptions;
} else {
VueComponent = Vue.extend(vueOptions);
}
vueOptions = VueComponent.options;
return [VueComponent, vueOptions]
}
......@@ -1031,6 +1031,11 @@ function wrapper$1 (event) {
event.detail = {};
}
if (hasOwn(event, 'markerId')) {
event.detail = typeof event.detail === 'object' ? event.detail : {};
event.detail.markerId = event.markerId;
}
{ // mp-baidu,checked=>value
if (
isPlainObject(event.detail) &&
......@@ -1225,18 +1230,18 @@ function handleEvent (event) {
handlerCtx.$parent.$parent
) { // mp-weixin,mp-toutiao 抽象节点模拟 scoped slots
handlerCtx = handlerCtx.$parent.$parent;
}
if (methodName === '$emit') {
handlerCtx.$emit.apply(handlerCtx,
processEventArgs(
this.$vm,
event,
eventArray[1],
eventArray[2],
isCustom,
methodName
));
return
}
if (methodName === '$emit') {
handlerCtx.$emit.apply(handlerCtx,
processEventArgs(
this.$vm,
event,
eventArray[1],
eventArray[2],
isCustom,
methodName
));
return
}
const handler = handlerCtx[methodName];
if (!isFn(handler)) {
......@@ -1415,7 +1420,7 @@ function handleLink (event) {
vueOptions.parent = parentVm;
}
const mocks = ['nodeId', 'componentName'];
const mocks = ['nodeId', 'componentName', '_componentId'];
function isPage () {
return !this.ownerId
......@@ -1518,6 +1523,10 @@ function parseBaseComponent (vueComponentOptions, {
__e: handleEvent
}
};
// externalClasses
if (vueOptions.externalClasses) {
componentOptions.externalClasses = vueOptions.externalClasses;
}
if (Array.isArray(vueOptions.wxsCallMethods)) {
vueOptions.wxsCallMethods.forEach(callMethod => {
......
......@@ -753,10 +753,10 @@ function initVueComponent (Vue, vueOptions) {
let VueComponent;
if (isFn(vueOptions)) {
VueComponent = vueOptions;
vueOptions = VueComponent.extendOptions;
} else {
VueComponent = Vue.extend(vueOptions);
}
vueOptions = VueComponent.options;
return [VueComponent, vueOptions]
}
......@@ -956,6 +956,11 @@ function wrapper$1 (event) {
event.detail = {};
}
if (hasOwn(event, 'markerId')) {
event.detail = typeof event.detail === 'object' ? event.detail : {};
event.detail.markerId = event.markerId;
}
if (isPlainObject(event.detail)) {
event.target = Object.assign({}, event.target, event.detail);
}
......@@ -1140,18 +1145,18 @@ function handleEvent (event) {
handlerCtx.$parent.$parent
) { // mp-weixin,mp-toutiao 抽象节点模拟 scoped slots
handlerCtx = handlerCtx.$parent.$parent;
}
if (methodName === '$emit') {
handlerCtx.$emit.apply(handlerCtx,
processEventArgs(
this.$vm,
event,
eventArray[1],
eventArray[2],
isCustom,
methodName
));
return
}
if (methodName === '$emit') {
handlerCtx.$emit.apply(handlerCtx,
processEventArgs(
this.$vm,
event,
eventArray[1],
eventArray[2],
isCustom,
methodName
));
return
}
const handler = handlerCtx[methodName];
if (!isFn(handler)) {
......@@ -1441,6 +1446,10 @@ function parseBaseComponent (vueComponentOptions, {
__e: handleEvent
}
};
// externalClasses
if (vueOptions.externalClasses) {
componentOptions.externalClasses = vueOptions.externalClasses;
}
if (Array.isArray(vueOptions.wxsCallMethods)) {
vueOptions.wxsCallMethods.forEach(callMethod => {
......
......@@ -845,10 +845,10 @@ function initVueComponent (Vue, vueOptions) {
let VueComponent;
if (isFn(vueOptions)) {
VueComponent = vueOptions;
vueOptions = VueComponent.extendOptions;
} else {
VueComponent = Vue.extend(vueOptions);
}
vueOptions = VueComponent.options;
return [VueComponent, vueOptions]
}
......@@ -1048,6 +1048,11 @@ function wrapper$1 (event) {
event.detail = {};
}
if (hasOwn(event, 'markerId')) {
event.detail = typeof event.detail === 'object' ? event.detail : {};
event.detail.markerId = event.markerId;
}
if (isPlainObject(event.detail)) {
event.target = Object.assign({}, event.target, event.detail);
}
......@@ -1232,18 +1237,18 @@ function handleEvent (event) {
handlerCtx.$parent.$parent
) { // mp-weixin,mp-toutiao 抽象节点模拟 scoped slots
handlerCtx = handlerCtx.$parent.$parent;
}
if (methodName === '$emit') {
handlerCtx.$emit.apply(handlerCtx,
processEventArgs(
this.$vm,
event,
eventArray[1],
eventArray[2],
isCustom,
methodName
));
return
}
if (methodName === '$emit') {
handlerCtx.$emit.apply(handlerCtx,
processEventArgs(
this.$vm,
event,
eventArray[1],
eventArray[2],
isCustom,
methodName
));
return
}
const handler = handlerCtx[methodName];
if (!isFn(handler)) {
......@@ -1606,6 +1611,10 @@ function parseBaseComponent (vueComponentOptions, {
__e: handleEvent
}
};
// externalClasses
if (vueOptions.externalClasses) {
componentOptions.externalClasses = vueOptions.externalClasses;
}
if (Array.isArray(vueOptions.wxsCallMethods)) {
vueOptions.wxsCallMethods.forEach(callMethod => {
......
......@@ -710,10 +710,10 @@ function initVueComponent (Vue, vueOptions) {
let VueComponent;
if (isFn(vueOptions)) {
VueComponent = vueOptions;
vueOptions = VueComponent.extendOptions;
} else {
VueComponent = Vue.extend(vueOptions);
}
vueOptions = VueComponent.options;
return [VueComponent, vueOptions]
}
......@@ -913,6 +913,11 @@ function wrapper$1 (event) {
event.detail = {};
}
if (hasOwn(event, 'markerId')) {
event.detail = typeof event.detail === 'object' ? event.detail : {};
event.detail.markerId = event.markerId;
}
if (isPlainObject(event.detail)) {
event.target = Object.assign({}, event.target, event.detail);
}
......@@ -1097,18 +1102,18 @@ function handleEvent (event) {
handlerCtx.$parent.$parent
) { // mp-weixin,mp-toutiao 抽象节点模拟 scoped slots
handlerCtx = handlerCtx.$parent.$parent;
}
if (methodName === '$emit') {
handlerCtx.$emit.apply(handlerCtx,
processEventArgs(
this.$vm,
event,
eventArray[1],
eventArray[2],
isCustom,
methodName
));
return
}
if (methodName === '$emit') {
handlerCtx.$emit.apply(handlerCtx,
processEventArgs(
this.$vm,
event,
eventArray[1],
eventArray[2],
isCustom,
methodName
));
return
}
const handler = handlerCtx[methodName];
if (!isFn(handler)) {
......@@ -1394,6 +1399,10 @@ function parseBaseComponent (vueComponentOptions, {
__e: handleEvent
}
};
// externalClasses
if (vueOptions.externalClasses) {
componentOptions.externalClasses = vueOptions.externalClasses;
}
if (Array.isArray(vueOptions.wxsCallMethods)) {
vueOptions.wxsCallMethods.forEach(callMethod => {
......
......@@ -24,7 +24,7 @@ function getProjectName(e, t) {
const stripJsonComments = require('strip-json-comments');
const r = _path.default.join(e, t, "manifest.json");
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) {
_sharedUtils.colorconsole.error(`### App Server ### 获取项目名称出错:${e.message}`)
}
......@@ -50,7 +50,7 @@ function getDistFilePath(e, t, r) {
let s;
if (!process.env.UNI_OUTPUT_DIR) {
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 =
_path.default.join(e,
......
......@@ -7,7 +7,7 @@ module.exports = config => {
.use('vue-loader')
.loader(vueLoader.loader)
.tap(options => Object.assign(options, vueLoader.options({}, {
'quickapp-vue': true
'quickapp-native': true
})))
config.module
......
......@@ -6,7 +6,7 @@ const PLATFORMS = [
'mp-baidu',
'mp-alipay',
'mp-toutiao',
'quickapp-vue'
'quickapp-native'
]
const DISPLAY = {
......@@ -44,8 +44,8 @@ function parseStyle(style = {}) {
}
}
})
if (style['quickapp-vue']) {
Object.assign(ret, style['quickapp-vue'])
if (style['quickapp-native']) {
Object.assign(ret, style['quickapp-native'])
}
return ret
}
......
......@@ -27,7 +27,7 @@ function getPages(pagesJson) {
module.exports = function(pagesJson, manifestJson, loader) {
const manifest = manifestJson['quickapp-vue'] || {}
const manifest = manifestJson['quickapp-native'] || {}
parseBase(manifest, manifestJson)
......
......@@ -5,7 +5,7 @@ module.exports = function () {
const manifest = global.framework.manifest
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')
......
{
"name": "@dcloudio/uni-quickapp-vue",
"name": "@dcloudio/uni-quickapp-native",
"version": "2.0.0-alpha-26920200407011",
"description": "uni-app quickapp-vue",
"description": "uni-app quickapp-native",
"main": "dist/vue.prod.js",
"repository": {
"type": "git",
"url": "git+https://github.com/dcloudio/uni-app.git",
"directory": "packages/uni-quickapp-vue"
"directory": "packages/uni-quickapp-native"
},
"files": [
"bin",
......@@ -21,7 +21,7 @@
"license": "Apache-2.0",
"gitHead": "5ed6c58ef3a74a43b11bd65f8f6f488e470716c8",
"uni-app": {
"name": "quickapp-vue",
"name": "quickapp-native",
"title": "快应用(Vue)版"
},
"dependencies": {
......
......@@ -417,7 +417,7 @@ function processArgs (methodName, fromArgs, argsOption = {}, returnValue = {}, k
keyOption = keyOption(fromArgs[key], fromArgs, toArgs);
}
if (!keyOption) { // 不支持的参数
console.warn(`快应用(Light)版 ${methodName}暂不支持${key}`);
console.warn(`快应用(Webview)版 ${methodName}暂不支持${key}`);
} else if (isStr(keyOption)) { // 重写参数 key
toArgs[keyOption] = fromArgs[key];
} else if (isPlainObject(keyOption)) { // {name:newName,value:value}可重新指定参数 key:value
......@@ -450,7 +450,7 @@ function wrapper (methodName, method) {
const protocol = protocols[methodName];
if (!protocol) { // 暂不支持的 api
return function () {
console.error(`快应用(Light)版 暂不支持${methodName}`);
console.error(`快应用(Webview)版 暂不支持${methodName}`);
}
}
return function (arg1, arg2) { // 目前 api 最多两个参数
......@@ -694,10 +694,10 @@ function initVueComponent (Vue, vueOptions) {
let VueComponent;
if (isFn(vueOptions)) {
VueComponent = vueOptions;
vueOptions = VueComponent.extendOptions;
} else {
VueComponent = Vue.extend(vueOptions);
}
vueOptions = VueComponent.options;
return [VueComponent, vueOptions]
}
......@@ -897,6 +897,11 @@ function wrapper$1 (event) {
event.detail = {};
}
if (hasOwn(event, 'markerId')) {
event.detail = typeof event.detail === 'object' ? event.detail : {};
event.detail.markerId = event.markerId;
}
if (isPlainObject(event.detail)) {
event.target = Object.assign({}, event.target, event.detail);
}
......@@ -1081,18 +1086,18 @@ function handleEvent (event) {
handlerCtx.$parent.$parent
) { // mp-weixin,mp-toutiao 抽象节点模拟 scoped slots
handlerCtx = handlerCtx.$parent.$parent;
}
if (methodName === '$emit') {
handlerCtx.$emit.apply(handlerCtx,
processEventArgs(
this.$vm,
event,
eventArray[1],
eventArray[2],
isCustom,
methodName
));
return
}
if (methodName === '$emit') {
handlerCtx.$emit.apply(handlerCtx,
processEventArgs(
this.$vm,
event,
eventArray[1],
eventArray[2],
isCustom,
methodName
));
return
}
const handler = handlerCtx[methodName];
if (!isFn(handler)) {
......@@ -1141,7 +1146,7 @@ function parseBaseApp (vm, {
Vue.prototype.$store = vm.$options.store;
}
Vue.prototype.mpHost = "quickapp-light";
Vue.prototype.mpHost = "quickapp-webview";
Vue.mixin({
beforeCreate () {
......@@ -1206,7 +1211,7 @@ function parseBaseApp (vm, {
return appOptions
}
const mocks = ['nodeId', 'componentName' ,'_componentId'];
const mocks = ['nodeId', 'componentName', '_componentId'];
function isPage () {
return !this.ownerId
......@@ -1436,6 +1441,10 @@ function parseBaseComponent (vueComponentOptions, {
__e: handleEvent
}
};
// externalClasses
if (vueOptions.externalClasses) {
componentOptions.externalClasses = vueOptions.externalClasses;
}
if (Array.isArray(vueOptions.wxsCallMethods)) {
vueOptions.wxsCallMethods.forEach(callMethod => {
......@@ -1571,7 +1580,7 @@ canIUses.forEach(canIUseApi => {
let uni = {};
if (typeof Proxy !== 'undefined' && "quickapp-light" !== 'app-plus') {
if (typeof Proxy !== 'undefined' && "quickapp-webview" !== 'app-plus') {
uni = new Proxy({}, {
get (target, name) {
if (target[name]) {
......
......@@ -31,10 +31,10 @@ module.exports = {
},
validate (platformOptions, manifestJson) {
if (!platformOptions.package) {
console.warn('manifest.json->quickapp-light 缺少 package 配置')
console.warn('manifest.json->quickapp-webview 缺少 package 配置')
}
if (!platformOptions.icon) {
console.warn('manifest.json->quickapp-light 缺少 icon 配置')
console.warn('manifest.json->quickapp-webview 缺少 icon 配置')
}
},
copyWebpackOptions (platformOptions, vueOptions) {
......
{
"name": "@dcloudio/uni-quickapp-light",
"name": "@dcloudio/uni-quickapp-webview",
"version": "2.0.0-alpha-26920200407011",
"description": "uni-app quickapp-light",
"description": "uni-app quickapp-webview",
"main": "dist/index.js",
"repository": {
"type": "git",
"url": "git+https://github.com/dcloudio/uni-app.git",
"directory": "packages/uni-quickapp-light"
"directory": "packages/uni-quickapp-webview"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
......@@ -14,8 +14,8 @@
"author": "fxy060608",
"license": "Apache-2.0",
"uni-app": {
"name": "quickapp-light",
"title": "快应用(Light)版"
"name": "quickapp-webview",
"title": "快应用(Webview)版"
},
"gitHead": "5ed6c58ef3a74a43b11bd65f8f6f488e470716c8"
}
......@@ -6,7 +6,7 @@ function assertCodegen (template, templateCode, renderCode = 'with(this){}', opt
mp: Object.assign({
minified: true,
isTest: true,
platform: 'quickapp-light'
platform: 'quickapp-webview'
}, options)
})
......@@ -14,7 +14,7 @@ function assertCodegen (template, templateCode, renderCode = 'with(this){}', opt
expect(res.render).toBe(renderCode)
}
describe('mp:compiler-quickapp-light', () => {
describe('mp:compiler-quickapp-webview', () => {
it('generate v-for directive', () => {
assertCodegen(
'<view><view v-for="(item,index) in items" :key="index"></view></view>',
......
......@@ -86,7 +86,7 @@ function compileTemplate (source, options, compile) {
const compilerModule = {
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)
} else if (isComponent(el.tag) && el.tag !== 'App') { // App.vue
......
......@@ -78,12 +78,12 @@ module.exports = {
console.error(source)
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)
}
......
......@@ -9,23 +9,23 @@ module.exports = (api, options, rootOptions) => {
info: 'node node_modules/@dcloudio/vue-cli-plugin-uni/commands/info.js',
serve: 'npm run dev: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: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-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-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-light': 'cross-env NODE_ENV=development UNI_PLATFORM=quickapp-light 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-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: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-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-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-light': 'cross-env NODE_ENV=production UNI_PLATFORM=quickapp-light vue-cli-service uni-build',
'build:quickapp-native': 'cross-env NODE_ENV=production UNI_PLATFORM=quickapp-native 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',
'build:custom': 'cross-env NODE_ENV=production uniapp-cli custom',
'test:h5': 'cross-env UNI_PLATFORM=h5 jest -i',
......@@ -45,8 +45,8 @@ module.exports = (api, options, rootOptions) => {
'@dcloudio/uni-mp-baidu': version,
'@dcloudio/uni-mp-alipay': version,
'@dcloudio/uni-mp-toutiao': version,
'@dcloudio/uni-quickapp-light': version,
'@dcloudio/uni-quickapp-vue': version,
'@dcloudio/uni-quickapp-webview': version,
'@dcloudio/uni-quickapp-native': version,
'@dcloudio/uni-stat': version,
flyio: '^0.6.2',
vuex: '^3.2.0'
......
......@@ -19,7 +19,7 @@ module.exports = (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')
Object.assign(options, {
assetsDir,
......@@ -35,7 +35,7 @@ module.exports = (api, options) => {
api.configureWebpack(require('./lib/configure-webpack')(platformOptions, manifestPlatformOptions, 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.chainWebpack(vueConfig.chainWebpack)
return
......
......@@ -198,19 +198,22 @@ module.exports = function configureWebpack (platformOptions, manifestPlatformOpt
plugins.push(new CopyWebpackPlugin(getCopyWebpackPluginOptions(manifestPlatformOptions, vueOptions)))
}
plugins.push(new CopyWebpackPlugin([{
from: require.resolve('@dcloudio/uni-automator/dist/automator.json'),
to: '../.automator/' + (process.env.UNI_SUB_PLATFORM || process.env.UNI_PLATFORM) +
'/.automator.json',
transform (content) {
if (process.env.UNI_AUTOMATOR_WS_ENDPOINT) {
return JSON.stringify({
wsEndpoint: process.env.UNI_AUTOMATOR_WS_ENDPOINT
})
try {
const automatorJson = require.resolve('@dcloudio/uni-automator/dist/automator.json')
plugins.push(new CopyWebpackPlugin([{
from: automatorJson,
to: '../.automator/' + (process.env.UNI_SUB_PLATFORM || process.env.UNI_PLATFORM) +
'/.automator.json',
transform (content) {
if (process.env.UNI_AUTOMATOR_WS_ENDPOINT) {
return JSON.stringify({
wsEndpoint: process.env.UNI_AUTOMATOR_WS_ENDPOINT
})
}
return ''
}
return ''
}
}]))
}]))
} catch (e) {}
if (process.UNI_SCRIPT_ENV && Object.keys(process.UNI_SCRIPT_ENV).length) {
// custom define
......
......@@ -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'
: 'weex') +
' 。编译模式差异见: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 {
let info = ''
if (process.env.UNI_PLATFORM === 'app-plus') {
......
......@@ -241,7 +241,7 @@ if (process.env.UNI_USING_V3) {
// Transform each property declaration here
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 => {
return transformSelector(complexSelector, simpleSelectors => {
return simpleSelectors.walkTags(tag => {
......
......@@ -69,8 +69,8 @@ module.exports = function (content) {
if (process.env.UNI_PLATFORM === 'h5') {
return require('./platforms/h5')(pagesJson, manifestJson, this)
}
if (process.env.UNI_PLATFORM === 'quickapp-vue') {
return require('./platforms/quickapp-vue')(pagesJson, manifestJson, this)
if (process.env.UNI_PLATFORM === 'quickapp-native') {
return require('./platforms/quickapp-native')(pagesJson, manifestJson, this)
}
if (!process.env.UNI_USING_V3) {
......
......@@ -44,7 +44,7 @@ module.exports = function (content) {
if (
process.env.UNI_USING_COMPONENTS ||
process.env.UNI_PLATFORM === 'h5' ||
process.env.UNI_PLATFORM === 'quickapp-vue'
process.env.UNI_PLATFORM === 'quickapp-native'
) {
return require('./index-new').call(this, content)
}
......
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) {
manifestJson.versionName && (baseJson.versionName = manifestJson.versionName)
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) {
app.content.package = manifestJson.name
......
......@@ -25,7 +25,7 @@ import {
} from 'uni-platforms/mp-weixin/runtime/web-view'
import {
initWebviewApi as initQuickappWebviewApi
} from 'uni-platforms/quickapp-light/runtime/web-view'
} from 'uni-platforms/quickapp-webview/runtime/web-view'
const UniAppJSBridgeReady = function () {
window.UniAppJSBridge = true
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册