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

build runtime

上级 fdb1cca8
...@@ -1281,6 +1281,12 @@ var serviceContext = (function () { ...@@ -1281,6 +1281,12 @@ var serviceContext = (function () {
isConnected: networkType !== 'none', isConnected: networkType !== 'none',
networkType networkType
}); });
});
plus.globalEvent.addEventListener('KeyboardHeightChange', function (event) {
publish('onKeyboardHeightChange', {
height: event.height
});
}); });
} }
...@@ -1506,7 +1512,8 @@ var serviceContext = (function () { ...@@ -1506,7 +1512,8 @@ var serviceContext = (function () {
]; ];
const keyboard = [ const keyboard = [
'hideKeyboard' 'hideKeyboard',
'onKeyboardHeightChange'
]; ];
const ui = [ const ui = [
...@@ -1819,7 +1826,7 @@ var serviceContext = (function () { ...@@ -1819,7 +1826,7 @@ var serviceContext = (function () {
}; };
const SYNC_API_RE = const SYNC_API_RE =
/^\$|interceptors|Interceptor$|getSubNVueById|requireNativePlugin|upx2px|hideKeyboard|canIUse|^create|Sync$|Manager$|base64ToArrayBuffer|arrayBufferToBase64/; /^\$|^report|interceptors|Interceptor$|getSubNVueById|requireNativePlugin|upx2px|hideKeyboard|canIUse|^create|Sync$|Manager$|base64ToArrayBuffer|arrayBufferToBase64/;
const CONTEXT_API_RE = /^create|Manager$/; const CONTEXT_API_RE = /^create|Manager$/;
...@@ -1852,8 +1859,8 @@ var serviceContext = (function () { ...@@ -1852,8 +1859,8 @@ var serviceContext = (function () {
function shouldPromise (name) { function shouldPromise (name) {
if ( if (
isContextApi(name) || isContextApi(name) ||
isSyncApi(name) || isSyncApi(name) ||
isCallbackApi(name) isCallbackApi(name)
) { ) {
return false return false
} }
...@@ -5856,9 +5863,6 @@ var serviceContext = (function () { ...@@ -5856,9 +5863,6 @@ var serviceContext = (function () {
return createDownloadTaskById(++downloadTaskId, args) return createDownloadTaskById(++downloadTaskId, args)
} }
const USER_AGENT =
'Mozilla/5.0 (iPhone; CPU iPhone OS 9_3_5 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) Mobile/13G36 MicroMessenger/6.5.1 NetType/WIFI Language/zh_CN';
let requestTaskId = 0; let requestTaskId = 0;
const requestTasks = {}; const requestTasks = {};
...@@ -5891,9 +5895,7 @@ var serviceContext = (function () { ...@@ -5891,9 +5895,7 @@ var serviceContext = (function () {
if (!hasContentType && method === 'POST') { if (!hasContentType && method === 'POST') {
headers['Content-Type'] = 'application/x-www-form-urlencoded; charset=UTF-8'; headers['Content-Type'] = 'application/x-www-form-urlencoded; charset=UTF-8';
} }
if (__uniConfig.crossDomain === true) {
headers['User-Agent'] = USER_AGENT;
}
const timeout = __uniConfig.networkTimeout.request; const timeout = __uniConfig.networkTimeout.request;
if (timeout) { if (timeout) {
abortTimeout = setTimeout(() => { abortTimeout = setTimeout(() => {
...@@ -5908,7 +5910,7 @@ var serviceContext = (function () { ...@@ -5908,7 +5910,7 @@ var serviceContext = (function () {
} }
const options = { const options = {
method, method,
url, url: url.trim(),
// weex 官方文档有误,headers 类型实际 object,用 string 类型会无响应 // weex 官方文档有误,headers 类型实际 object,用 string 类型会无响应
headers, headers,
type: 'text', type: 'text',
...@@ -8327,6 +8329,22 @@ var serviceContext = (function () { ...@@ -8327,6 +8329,22 @@ var serviceContext = (function () {
createAnimation: createAnimation createAnimation: createAnimation
}); });
const callbacks$7 = [];
onMethod('onKeyboardHeightChange', res => {
callbacks$7.forEach(callbackId => {
invoke(callbackId, res);
});
});
function onKeyboardHeightChange (callbackId) {
callbacks$7.push(callbackId);
}
var require_context_module_1_17 = /*#__PURE__*/Object.freeze({
onKeyboardHeightChange: onKeyboardHeightChange
});
function pageScrollTo$1 (args) { function pageScrollTo$1 (args) {
const pages = getCurrentPages(); const pages = getCurrentPages();
if (pages.length) { if (pages.length) {
...@@ -8335,7 +8353,7 @@ var serviceContext = (function () { ...@@ -8335,7 +8353,7 @@ var serviceContext = (function () {
return {} return {}
} }
var require_context_module_1_17 = /*#__PURE__*/Object.freeze({ var require_context_module_1_18 = /*#__PURE__*/Object.freeze({
pageScrollTo: pageScrollTo$1 pageScrollTo: pageScrollTo$1
}); });
...@@ -8359,29 +8377,29 @@ var serviceContext = (function () { ...@@ -8359,29 +8377,29 @@ var serviceContext = (function () {
const hideTabBarRedDot$1 = removeTabBarBadge$1; const hideTabBarRedDot$1 = removeTabBarBadge$1;
var require_context_module_1_18 = /*#__PURE__*/Object.freeze({ var require_context_module_1_19 = /*#__PURE__*/Object.freeze({
removeTabBarBadge: removeTabBarBadge$1, removeTabBarBadge: removeTabBarBadge$1,
showTabBarRedDot: showTabBarRedDot$1, showTabBarRedDot: showTabBarRedDot$1,
hideTabBarRedDot: hideTabBarRedDot$1 hideTabBarRedDot: hideTabBarRedDot$1
}); });
const callbacks$7 = []; const callbacks$8 = [];
onMethod('onViewDidResize', res => { onMethod('onViewDidResize', res => {
callbacks$7.forEach(callbackId => { callbacks$8.forEach(callbackId => {
invoke(callbackId, res); invoke(callbackId, res);
}); });
}); });
function onWindowResize (callbackId) { function onWindowResize (callbackId) {
callbacks$7.push(callbackId); callbacks$8.push(callbackId);
} }
function offWindowResize (callbackId) { function offWindowResize (callbackId) {
// 此处和微信平台一致查询不到去掉最后一个 // 此处和微信平台一致查询不到去掉最后一个
callbacks$7.splice(callbacks$7.indexOf(callbackId), 1); callbacks$8.splice(callbacks$8.indexOf(callbackId), 1);
} }
var require_context_module_1_19 = /*#__PURE__*/Object.freeze({ var require_context_module_1_20 = /*#__PURE__*/Object.freeze({
onWindowResize: onWindowResize, onWindowResize: onWindowResize,
offWindowResize: offWindowResize offWindowResize: offWindowResize
}); });
...@@ -8408,9 +8426,10 @@ var serviceContext = (function () { ...@@ -8408,9 +8426,10 @@ var serviceContext = (function () {
'./network/upload-file.js': require_context_module_1_14, './network/upload-file.js': require_context_module_1_14,
'./storage/storage.js': require_context_module_1_15, './storage/storage.js': require_context_module_1_15,
'./ui/create-animation.js': require_context_module_1_16, './ui/create-animation.js': require_context_module_1_16,
'./ui/page-scroll-to.js': require_context_module_1_17, './ui/keyboard.js': require_context_module_1_17,
'./ui/tab-bar.js': require_context_module_1_18, './ui/page-scroll-to.js': require_context_module_1_18,
'./ui/window.js': require_context_module_1_19, './ui/tab-bar.js': require_context_module_1_19,
'./ui/window.js': require_context_module_1_20,
}; };
var req = function req(key) { var req = function req(key) {
......
...@@ -122,7 +122,7 @@ function invokeApi (method, api, options, ...params) { ...@@ -122,7 +122,7 @@ function invokeApi (method, api, options, ...params) {
} }
const SYNC_API_RE = const SYNC_API_RE =
/^\$|interceptors|Interceptor$|getSubNVueById|requireNativePlugin|upx2px|hideKeyboard|canIUse|^create|Sync$|Manager$|base64ToArrayBuffer|arrayBufferToBase64/; /^\$|^report|interceptors|Interceptor$|getSubNVueById|requireNativePlugin|upx2px|hideKeyboard|canIUse|^create|Sync$|Manager$|base64ToArrayBuffer|arrayBufferToBase64/;
const CONTEXT_API_RE = /^create|Manager$/; const CONTEXT_API_RE = /^create|Manager$/;
...@@ -149,8 +149,8 @@ function handlePromise (promise) { ...@@ -149,8 +149,8 @@ function handlePromise (promise) {
function shouldPromise (name) { function shouldPromise (name) {
if ( if (
isContextApi(name) || isContextApi(name) ||
isSyncApi(name) || isSyncApi(name) ||
isCallbackApi(name) isCallbackApi(name)
) { ) {
return false return false
} }
...@@ -695,6 +695,9 @@ function initUni (uni, nvue, plus, BroadcastChannel) { ...@@ -695,6 +695,9 @@ function initUni (uni, nvue, plus, BroadcastChannel) {
if (typeof Proxy !== 'undefined') { if (typeof Proxy !== 'undefined') {
return new Proxy({}, { return new Proxy({}, {
get (target, name) { get (target, name) {
if (target[name]) {
return target[name]
}
if (apis[name]) { if (apis[name]) {
return apis[name] return apis[name]
} }
...@@ -705,6 +708,9 @@ function initUni (uni, nvue, plus, BroadcastChannel) { ...@@ -705,6 +708,9 @@ function initUni (uni, nvue, plus, BroadcastChannel) {
return return
} }
return promisify(name, uni[name]) return promisify(name, uni[name])
},
set (target, name, value) {
target[name] = value;
} }
}) })
} }
......
...@@ -231,7 +231,7 @@ const promiseInterceptor = { ...@@ -231,7 +231,7 @@ const promiseInterceptor = {
}; };
const SYNC_API_RE = const SYNC_API_RE =
/^\$|interceptors|Interceptor$|getSubNVueById|requireNativePlugin|upx2px|hideKeyboard|canIUse|^create|Sync$|Manager$|base64ToArrayBuffer|arrayBufferToBase64/; /^\$|^report|interceptors|Interceptor$|getSubNVueById|requireNativePlugin|upx2px|hideKeyboard|canIUse|^create|Sync$|Manager$|base64ToArrayBuffer|arrayBufferToBase64/;
const CONTEXT_API_RE = /^create|Manager$/; const CONTEXT_API_RE = /^create|Manager$/;
...@@ -258,8 +258,8 @@ function handlePromise (promise) { ...@@ -258,8 +258,8 @@ function handlePromise (promise) {
function shouldPromise (name) { function shouldPromise (name) {
if ( if (
isContextApi(name) || isContextApi(name) ||
isSyncApi(name) || isSyncApi(name) ||
isCallbackApi(name) isCallbackApi(name)
) { ) {
return false return false
} }
......
{ {
"name": "@dcloudio/uni-app-plus", "name": "@dcloudio/uni-app-plus",
"version": "0.0.251", "version": "0.0.252",
"description": "uni-app app-plus", "description": "uni-app app-plus",
"main": "dist/index.js", "main": "dist/index.js",
"scripts": { "scripts": {
......
...@@ -231,7 +231,7 @@ const promiseInterceptor = { ...@@ -231,7 +231,7 @@ const promiseInterceptor = {
}; };
const SYNC_API_RE = const SYNC_API_RE =
/^\$|interceptors|Interceptor$|getSubNVueById|requireNativePlugin|upx2px|hideKeyboard|canIUse|^create|Sync$|Manager$|base64ToArrayBuffer|arrayBufferToBase64/; /^\$|^report|interceptors|Interceptor$|getSubNVueById|requireNativePlugin|upx2px|hideKeyboard|canIUse|^create|Sync$|Manager$|base64ToArrayBuffer|arrayBufferToBase64/;
const CONTEXT_API_RE = /^create|Manager$/; const CONTEXT_API_RE = /^create|Manager$/;
...@@ -258,8 +258,8 @@ function handlePromise (promise) { ...@@ -258,8 +258,8 @@ function handlePromise (promise) {
function shouldPromise (name) { function shouldPromise (name) {
if ( if (
isContextApi(name) || isContextApi(name) ||
isSyncApi(name) || isSyncApi(name) ||
isCallbackApi(name) isCallbackApi(name)
) { ) {
return false return false
} }
......
{ {
"name": "@dcloudio/uni-mp-alipay", "name": "@dcloudio/uni-mp-alipay",
"version": "0.0.825", "version": "0.0.826",
"description": "uni-app mp-alipay", "description": "uni-app mp-alipay",
"main": "dist/index.js", "main": "dist/index.js",
"scripts": { "scripts": {
......
...@@ -231,7 +231,7 @@ const promiseInterceptor = { ...@@ -231,7 +231,7 @@ const promiseInterceptor = {
}; };
const SYNC_API_RE = const SYNC_API_RE =
/^\$|interceptors|Interceptor$|getSubNVueById|requireNativePlugin|upx2px|hideKeyboard|canIUse|^create|Sync$|Manager$|base64ToArrayBuffer|arrayBufferToBase64/; /^\$|^report|interceptors|Interceptor$|getSubNVueById|requireNativePlugin|upx2px|hideKeyboard|canIUse|^create|Sync$|Manager$|base64ToArrayBuffer|arrayBufferToBase64/;
const CONTEXT_API_RE = /^create|Manager$/; const CONTEXT_API_RE = /^create|Manager$/;
...@@ -258,8 +258,8 @@ function handlePromise (promise) { ...@@ -258,8 +258,8 @@ function handlePromise (promise) {
function shouldPromise (name) { function shouldPromise (name) {
if ( if (
isContextApi(name) || isContextApi(name) ||
isSyncApi(name) || isSyncApi(name) ||
isCallbackApi(name) isCallbackApi(name)
) { ) {
return false return false
} }
...@@ -426,6 +426,16 @@ function createTodoMethod (contextName, methodName) { ...@@ -426,6 +426,16 @@ function createTodoMethod (contextName, methodName) {
console.error(`百度小程序 ${contextName}暂不支持${methodName}`); console.error(`百度小程序 ${contextName}暂不支持${methodName}`);
} }
} }
function _handleEnvInfo (result) {
result.miniProgram = {
appId: result.appKey
};
result.plugin = {
version: result.sdkVersion
};
}
// 需要做转换的 API 列表 // 需要做转换的 API 列表
const protocols = { const protocols = {
request: { request: {
...@@ -479,6 +489,10 @@ const protocols = { ...@@ -479,6 +489,10 @@ const protocols = {
}, },
showShareMenu: { showShareMenu: {
name: 'openShare' name: 'openShare'
},
getAccountInfoSync: {
name: 'getEnvInfoSync',
returnValue: _handleEnvInfo
} }
}; };
......
{ {
"name": "@dcloudio/uni-mp-baidu", "name": "@dcloudio/uni-mp-baidu",
"version": "0.0.855", "version": "0.0.856",
"description": "uni-app mp-baidu", "description": "uni-app mp-baidu",
"main": "dist/index.js", "main": "dist/index.js",
"scripts": { "scripts": {
......
...@@ -231,7 +231,7 @@ const promiseInterceptor = { ...@@ -231,7 +231,7 @@ const promiseInterceptor = {
}; };
const SYNC_API_RE = const SYNC_API_RE =
/^\$|interceptors|Interceptor$|getSubNVueById|requireNativePlugin|upx2px|hideKeyboard|canIUse|^create|Sync$|Manager$|base64ToArrayBuffer|arrayBufferToBase64/; /^\$|^report|interceptors|Interceptor$|getSubNVueById|requireNativePlugin|upx2px|hideKeyboard|canIUse|^create|Sync$|Manager$|base64ToArrayBuffer|arrayBufferToBase64/;
const CONTEXT_API_RE = /^create|Manager$/; const CONTEXT_API_RE = /^create|Manager$/;
...@@ -258,8 +258,8 @@ function handlePromise (promise) { ...@@ -258,8 +258,8 @@ function handlePromise (promise) {
function shouldPromise (name) { function shouldPromise (name) {
if ( if (
isContextApi(name) || isContextApi(name) ||
isSyncApi(name) || isSyncApi(name) ||
isCallbackApi(name) isCallbackApi(name)
) { ) {
return false return false
} }
...@@ -402,23 +402,11 @@ const todos = [ ...@@ -402,23 +402,11 @@ const todos = [
'canIUse', 'canIUse',
'onMemoryWarning', 'onMemoryWarning',
'onNetworkStatusChange', 'onNetworkStatusChange',
'onAccelerometerChange',
'startAccelerometer',
'stopAccelerometer',
'onCompassChange',
'startCompass',
'scanCode',
'startBeaconDiscovery', 'startBeaconDiscovery',
'stopBeaconDiscovery', 'stopBeaconDiscovery',
'getBeacons', 'getBeacons',
'onBeaconUpdate', 'onBeaconUpdate',
'onBeaconServiceChange', 'onBeaconServiceChange',
'setScreenBrightness',
'getScreenBrightness',
'setKeepScreenOn',
'onUserCaptureScreen',
'vibrateLong',
'vibrateShort',
'addPhoneContact', 'addPhoneContact',
'getHCEState', 'getHCEState',
'startHCE', 'startHCE',
...@@ -449,13 +437,25 @@ const todos = [ ...@@ -449,13 +437,25 @@ const todos = [
'checkIsSupportSoterAuthentication', 'checkIsSupportSoterAuthentication',
'startSoterAuthentication', 'startSoterAuthentication',
'checkIsSoterEnrolledInDevice', 'checkIsSoterEnrolledInDevice',
'createWorker',
'reportMonitor', 'reportMonitor',
'getLogManager', 'getLogManager',
'onUserCaptureScreen',
'reportAnalytics' 'reportAnalytics'
]; ];
const canIUses = []; const canIUses = [
'scanCode',
'startAccelerometer',
'stopAccelerometer',
'onAccelerometerChange',
'startCompass',
'onCompassChange',
'setScreenBrightness',
'getScreenBrightness',
'setKeepScreenOn',
'onUserCaptureScreen',
'vibrateLong',
'vibrateShort',
'createWorker'
];
const CALLBACKS = ['success', 'fail', 'cancel', 'complete']; const CALLBACKS = ['success', 'fail', 'cancel', 'complete'];
......
{ {
"name": "@dcloudio/uni-mp-qq", "name": "@dcloudio/uni-mp-qq",
"version": "0.0.109", "version": "0.0.110",
"description": "uni-app mp-qq", "description": "uni-app mp-qq",
"main": "dist/index.js", "main": "dist/index.js",
"scripts": { "scripts": {
......
...@@ -231,7 +231,7 @@ const promiseInterceptor = { ...@@ -231,7 +231,7 @@ const promiseInterceptor = {
}; };
const SYNC_API_RE = const SYNC_API_RE =
/^\$|interceptors|Interceptor$|getSubNVueById|requireNativePlugin|upx2px|hideKeyboard|canIUse|^create|Sync$|Manager$|base64ToArrayBuffer|arrayBufferToBase64/; /^\$|^report|interceptors|Interceptor$|getSubNVueById|requireNativePlugin|upx2px|hideKeyboard|canIUse|^create|Sync$|Manager$|base64ToArrayBuffer|arrayBufferToBase64/;
const CONTEXT_API_RE = /^create|Manager$/; const CONTEXT_API_RE = /^create|Manager$/;
...@@ -258,8 +258,8 @@ function handlePromise (promise) { ...@@ -258,8 +258,8 @@ function handlePromise (promise) {
function shouldPromise (name) { function shouldPromise (name) {
if ( if (
isContextApi(name) || isContextApi(name) ||
isSyncApi(name) || isSyncApi(name) ||
isCallbackApi(name) isCallbackApi(name)
) { ) {
return false return false
} }
......
{ {
"name": "@dcloudio/uni-mp-toutiao", "name": "@dcloudio/uni-mp-toutiao",
"version": "0.0.349", "version": "0.0.350",
"description": "uni-app mp-toutiao", "description": "uni-app mp-toutiao",
"main": "dist/index.js", "main": "dist/index.js",
"scripts": { "scripts": {
......
...@@ -231,7 +231,7 @@ const promiseInterceptor = { ...@@ -231,7 +231,7 @@ const promiseInterceptor = {
}; };
const SYNC_API_RE = const SYNC_API_RE =
/^\$|interceptors|Interceptor$|getSubNVueById|requireNativePlugin|upx2px|hideKeyboard|canIUse|^create|Sync$|Manager$|base64ToArrayBuffer|arrayBufferToBase64/; /^\$|^report|interceptors|Interceptor$|getSubNVueById|requireNativePlugin|upx2px|hideKeyboard|canIUse|^create|Sync$|Manager$|base64ToArrayBuffer|arrayBufferToBase64/;
const CONTEXT_API_RE = /^create|Manager$/; const CONTEXT_API_RE = /^create|Manager$/;
...@@ -258,8 +258,8 @@ function handlePromise (promise) { ...@@ -258,8 +258,8 @@ function handlePromise (promise) {
function shouldPromise (name) { function shouldPromise (name) {
if ( if (
isContextApi(name) || isContextApi(name) ||
isSyncApi(name) || isSyncApi(name) ||
isCallbackApi(name) isCallbackApi(name)
) { ) {
return false return false
} }
......
{ {
"name": "@dcloudio/uni-mp-weixin", "name": "@dcloudio/uni-mp-weixin",
"version": "0.0.971", "version": "0.0.972",
"description": "uni-app mp-weixin", "description": "uni-app mp-weixin",
"main": "dist/index.js", "main": "dist/index.js",
"scripts": { "scripts": {
......
...@@ -8,7 +8,7 @@ import { ...@@ -8,7 +8,7 @@ import {
} from './interceptor' } from './interceptor'
const SYNC_API_RE = const SYNC_API_RE =
/^\$|interceptors|Interceptor$|getSubNVueById|requireNativePlugin|upx2px|hideKeyboard|canIUse|^create|Sync$|Manager$|base64ToArrayBuffer|arrayBufferToBase64/ /^\$|^report|interceptors|Interceptor$|getSubNVueById|requireNativePlugin|upx2px|hideKeyboard|canIUse|^create|Sync$|Manager$|base64ToArrayBuffer|arrayBufferToBase64/
const CONTEXT_API_RE = /^create|Manager$/ const CONTEXT_API_RE = /^create|Manager$/
...@@ -41,8 +41,8 @@ function handlePromise (promise) { ...@@ -41,8 +41,8 @@ function handlePromise (promise) {
export function shouldPromise (name) { export function shouldPromise (name) {
if ( if (
isContextApi(name) || isContextApi(name) ||
isSyncApi(name) || isSyncApi(name) ||
isCallbackApi(name) isCallbackApi(name)
) { ) {
return false return false
} }
......
...@@ -106,7 +106,7 @@ const protocols = { ...@@ -106,7 +106,7 @@ const protocols = {
name: 'openShare' name: 'openShare'
}, },
getAccountInfoSync: { getAccountInfoSync: {
name: "getEnvInfoSync", name: 'getEnvInfoSync',
returnValue: _handleEnvInfo returnValue: _handleEnvInfo
} }
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册