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

build uni runtime(caniuse)

上级 60146762
......@@ -40,7 +40,7 @@ const camelize = cached((str) => {
return str.replace(camelizeRE, (_, c) => c ? c.toUpperCase() : '')
});
const SYNC_API_RE = /requireNativePlugin|upx2px|hideKeyboard|canIUse|^create|Sync$|Manager$/;
const SYNC_API_RE = /subNVue|requireNativePlugin|upx2px|hideKeyboard|canIUse|^create|Sync$|Manager$/;
const CONTEXT_API_RE = /^create|Manager$/;
......@@ -145,7 +145,7 @@ function upx2px (number, newDeviceWidth) {
}
// 不支持的 API 列表
const TODOS = [
const todos = [
'saveImageToPhotosAlbum',
'getRecorderManager',
'getBackgroundAudioManager',
......@@ -170,7 +170,6 @@ const TODOS = [
'hideTabBarRedDot',
'setBackgroundColor',
'setBackgroundTextStyle',
'startPullDownRefresh',
'createIntersectionObserver',
'authorize',
'openSetting',
......@@ -191,6 +190,11 @@ const TODOS = [
'offWindowResize'
];
// 存在兼容性的 API 列表
const canIUses = [
'startPullDownRefresh'
];
function _handleNetworkInfo (result) {
switch (result.networkType) {
case 'NOTREACHABLE':
......@@ -462,7 +466,7 @@ const protocols = { // 需要做转换的 API 列表
requestPayment: {
name: 'tradePay',
args: {
orderInfo: 'orderStr'
orderInfo: 'tradeNO'
}
},
getBLEDeviceServices: {
......@@ -503,11 +507,7 @@ const protocols = { // 需要做转换的 API 列表
brightness: 'value'
}
}
};
TODOS.forEach(todoApi => {
protocols[todoApi] = false;
});
};
const CALLBACKS = ['success', 'fail', 'cancel', 'complete'];
......@@ -586,7 +586,7 @@ function wrapper (methodName, method) {
const todoApis = Object.create(null);
const TODOS$1 = [
const TODOS = [
'subscribePush',
'unsubscribePush',
'onPush',
......@@ -607,7 +607,7 @@ function createTodoApi (name) {
}
}
TODOS$1.forEach(function (name) {
TODOS.forEach(function (name) {
todoApis[name] = createTodoApi(name);
});
......@@ -655,12 +655,8 @@ function getStorageSync (key) {
const result = my.getStorageSync({
key
});
// 不知道会不会出现 success 为 false 情况,暂时这样处理下。
if (result.success) {
return result.data || ''
} else {
return ''
}
// 支付宝平台会返回一个 success 值,但是目前测试的结果这个始终是 true。当没有存储数据的时候,其它平台会返回空字符串。
return result.data !== null ? result.data : ''
}
function removeStorageSync (key) {
return my.removeStorageSync({
......@@ -1547,6 +1543,17 @@ function createComponent (vueOptions) {
return initComponent(componentOptions, vueOptions)
}
todos.forEach(todoApi => {
protocols[todoApi] = false;
});
canIUses.forEach(canIUseApi => {
const apiName = protocols[canIUseApi] && protocols[canIUseApi].name ? protocols[canIUseApi].name : canIUseApi;
if (!my.canIUse(apiName)) {
protocols[canIUseApi] = false;
}
});
let uni = {};
if (typeof Proxy !== 'undefined') {
......
{
"name": "@dcloudio/uni-mp-alipay",
"version": "0.0.801",
"version": "0.0.802",
"description": "uni-app mp-alipay",
"main": "dist/index.js",
"scripts": {
......
......@@ -40,7 +40,7 @@ const camelize = cached((str) => {
return str.replace(camelizeRE, (_, c) => c ? c.toUpperCase() : '')
});
const SYNC_API_RE = /requireNativePlugin|upx2px|hideKeyboard|canIUse|^create|Sync$|Manager$/;
const SYNC_API_RE = /subNVue|requireNativePlugin|upx2px|hideKeyboard|canIUse|^create|Sync$|Manager$/;
const CONTEXT_API_RE = /^create|Manager$/;
......@@ -145,7 +145,7 @@ function upx2px (number, newDeviceWidth) {
}
// 不支持的 API 列表
const TODOS = [
const todos = [
'hideKeyboard',
'onGyroscopeChange',
'startGyroscope',
......@@ -178,6 +178,9 @@ const TODOS = [
'offWindowResize'
];
// 存在兼容性的 API 列表
const canIUses = [];
function createTodoMethod (contextName, methodName) {
return function unsupported () {
console.error(`百度小程序 ${contextName}暂不支持${methodName}`);
......@@ -237,11 +240,7 @@ const protocols = {
showShareMenu: {
name: 'openShare'
}
};
TODOS.forEach(todoApi => {
protocols[todoApi] = false;
});
};
const CALLBACKS = ['success', 'fail', 'cancel', 'complete'];
......@@ -320,7 +319,7 @@ function wrapper (methodName, method) {
const todoApis = Object.create(null);
const TODOS$1 = [
const TODOS = [
'subscribePush',
'unsubscribePush',
'onPush',
......@@ -341,7 +340,7 @@ function createTodoApi (name) {
}
}
TODOS$1.forEach(function (name) {
TODOS.forEach(function (name) {
todoApis[name] = createTodoApi(name);
});
......@@ -1159,6 +1158,17 @@ function createComponent (vueOptions) {
return initComponent$1(componentOptions, vueOptions)
}
todos.forEach(todoApi => {
protocols[todoApi] = false;
});
canIUses.forEach(canIUseApi => {
const apiName = protocols[canIUseApi] && protocols[canIUseApi].name ? protocols[canIUseApi].name : canIUseApi;
if (!swan.canIUse(apiName)) {
protocols[canIUseApi] = false;
}
});
let uni = {};
if (typeof Proxy !== 'undefined') {
......
{
"name": "@dcloudio/uni-mp-baidu",
"version": "0.0.827",
"version": "0.0.828",
"description": "uni-app mp-baidu",
"main": "dist/index.js",
"scripts": {
......
......@@ -40,7 +40,7 @@ const camelize = cached((str) => {
return str.replace(camelizeRE, (_, c) => c ? c.toUpperCase() : '')
});
const SYNC_API_RE = /requireNativePlugin|upx2px|hideKeyboard|canIUse|^create|Sync$|Manager$/;
const SYNC_API_RE = /subNVue|requireNativePlugin|upx2px|hideKeyboard|canIUse|^create|Sync$|Manager$/;
const CONTEXT_API_RE = /^create|Manager$/;
......@@ -145,7 +145,7 @@ function upx2px (number, newDeviceWidth) {
}
// 不支持的 API 列表
const TODOS = [
const todos = [
'hideKeyboard',
'onSocketOpen',
'onSocketError',
......@@ -227,6 +227,9 @@ const TODOS = [
'offWindowResize'
];
// 存在兼容性的 API 列表
const canIUses = [];
// 需要做转换的 API 列表
const protocols = {
chooseImage: {
......@@ -298,11 +301,7 @@ const protocols = {
requestPayment: {
orderInfo: 'data'
}
};
TODOS.forEach(todoApi => {
protocols[todoApi] = false;
});
};
const CALLBACKS = ['success', 'fail', 'cancel', 'complete'];
......@@ -381,7 +380,7 @@ function wrapper (methodName, method) {
const todoApis = Object.create(null);
const TODOS$1 = [
const TODOS = [
'subscribePush',
'unsubscribePush',
'onPush',
......@@ -402,7 +401,7 @@ function createTodoApi (name) {
}
}
TODOS$1.forEach(function (name) {
TODOS.forEach(function (name) {
todoApis[name] = createTodoApi(name);
});
......@@ -1166,6 +1165,17 @@ function createComponent (vueOptions) {
return initComponent$1(componentOptions, vueOptions)
}
todos.forEach(todoApi => {
protocols[todoApi] = false;
});
canIUses.forEach(canIUseApi => {
const apiName = protocols[canIUseApi] && protocols[canIUseApi].name ? protocols[canIUseApi].name : canIUseApi;
if (!tt.canIUse(apiName)) {
protocols[canIUseApi] = false;
}
});
let uni = {};
if (typeof Proxy !== 'undefined') {
......
{
"name": "@dcloudio/uni-mp-toutiao",
"version": "0.0.325",
"version": "0.0.326",
"description": "uni-app mp-toutiao",
"main": "dist/index.js",
"scripts": {
......
......@@ -40,7 +40,7 @@ const camelize = cached((str) => {
return str.replace(camelizeRE, (_, c) => c ? c.toUpperCase() : '')
});
const SYNC_API_RE = /requireNativePlugin|upx2px|hideKeyboard|canIUse|^create|Sync$|Manager$/;
const SYNC_API_RE = /subNVue|requireNativePlugin|upx2px|hideKeyboard|canIUse|^create|Sync$|Manager$/;
const CONTEXT_API_RE = /^create|Manager$/;
......@@ -144,7 +144,9 @@ function upx2px (number, newDeviceWidth) {
return number < 0 ? -result : result
}
var protocols = {};
const protocols = {};
const todos = [];
const canIUses = [];
const CALLBACKS = ['success', 'fail', 'cancel', 'complete'];
......@@ -1004,6 +1006,17 @@ function createComponent (vueOptions) {
return initComponent(componentOptions, vueOptions)
}
todos.forEach(todoApi => {
protocols[todoApi] = false;
});
canIUses.forEach(canIUseApi => {
const apiName = protocols[canIUseApi] && protocols[canIUseApi].name ? protocols[canIUseApi].name : canIUseApi;
if (!wx.canIUse(apiName)) {
protocols[canIUseApi] = false;
}
});
let uni = {};
if (typeof Proxy !== 'undefined') {
......
{
"name": "@dcloudio/uni-mp-weixin",
"version": "0.0.949",
"version": "0.0.950",
"description": "uni-app mp-weixin",
"main": "dist/index.js",
"scripts": {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册