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

fix(push): getPushClientId support promise

上级 6d569fc0
{"version":3,"sources":["/Users/fxy/Projects/GitHub/uni-app/uni-app-next/packages/playground/uts/nativeplugins/test-uniplugin/android/src/io/dcloud/uniplugin/TestModule.uts"],"names":["TestModule","UniModule","TAG","UniJSMethod","uiThread","testAsyncFunc","options","callback","log","data","JSONObject","invoke","testSyncFunc","onActivityResult","requestCode","resultCode","REQUEST_CODE","hasExtra","getStringExtra"],"mappings":"AAAA;AAAA,OAAmB,sBAAwB,CAAC;AAC5C,OAAuB,+BAAiC,CAAC;AACzD,OAAsB,yCAA2C,CAAC;AAClE,OAAwB,+CAAiD,CAAC;AAC1E,OAA0B,6CAA+C,CAAC;AAC1E,OAAgB,2BAAO,CAAC;AACT,WAAMA,UAAU,GAASC,SAAS,EAAE;IACjDC,SAAAA,GAAG,GAAG,YAAY,CAAC;IAGnB,CAACC,WAAW,CAAC,CAAEC,QAAQ,GAAE,IAAI,CAAE,CAAC;IAAA,SAChCC,aAAa,CAACC,OAAmB,EAAV,UAAU,EAAEC,QAAwB,EAAb,aAAa,CAAA,EAAE;QAC3DC,GAAG,CAAC,IAAI,CAACN,GAAG,EAAE,yBAAyB,CAAC,CAAC;QACzC,IAAIK,QAAQ,IAAI,IAAI,EAAE;YACpB,IAAME,IAAI,GAAG,AAAIC,UAAU,EAAE,AAAC;YAC9BD,IAAI,CAAC,MAAM,CAAC,GAAG,cAAc,CAAC;YAC9BF,QAAQ,CAACI,MAAM,CAACF,IAAI,CAAC,CAAC;;;IAI1B,CAACN,WAAW,CAAC,CAAEC,QAAQ,GAAE,KAAK,CAAE,CAAC;IAAA,SACjCQ,YAAY,CAACN,OAAmB,EAAV,UAAU,GAAG,UAAU,CAAC;QAC5C,IAAMG,IAAI,GAAG,AAAIC,UAAU,EAAE,AAAC;QAC9BD,IAAI,CAAC,MAAM,CAAC,GAAG,YAAY,CAAC;QAC5B,OAAOA,IAAI,CAAC;;IAEd,aAASI,gBAAgB,CAACC,WAAgB,EAAH,GAAG,EAAEC,UAAe,EAAH,GAAG,EAAEN,IAAY,EAAN,MAAM,EAAE;QACzE,IAAIK,WAAW,IAAId,UAAU,CAACgB,YAAY,IAAIP,IAAI,CAACQ,QAAQ,CAAC,SAAS,CAAC,EAAE;YACtET,GAAG,CAAC,IAAI,CAACN,GAAG,EAAE,wBAAY,GAAGO,IAAI,CAACS,cAAc,CAAC,SAAS,CAAC,CAAC,CAAC;;QAC9D,MAAM;YACL,KAAK,CAACL,gBAAgB,CAACC,WAAW,EAAEC,UAAU,EAAEN,IAAI,CAAC,CAAC;;;;QAtB1D,IAAOO,YAAY,GAAG,IAAI,CAAC;;CAyB5B"}
\ No newline at end of file
{"version":3,"sources":["/Users/fxy/Documents/projects/GitHub/uni-app/uni-app-next/packages/playground/uts/nativeplugins/test-uniplugin/android/src/io/dcloud/uniplugin/TestModule.uts"],"names":["TestModule","UniModule","TAG","UniJSMethod","uiThread","testAsyncFunc","options","callback","log","data","JSONObject","invoke","testSyncFunc","onActivityResult","requestCode","resultCode","REQUEST_CODE","hasExtra","getStringExtra"],"mappings":"AAAA;AAAA,OAAmB,sBAAwB,CAAC;AAC5C,OAAuB,+BAAiC,CAAC;AACzD,OAAsB,yCAA2C,CAAC;AAClE,OAAwB,+CAAiD,CAAC;AAC1E,OAA0B,6CAA+C,CAAC;AAC1E,OAAgB,2BAAO,CAAC;AACT,WAAMA,UAAU,GAASC,SAAS,EAAE;IACjDC,SAAAA,GAAG,GAAG,YAAY,CAAC;IAGnB,CAACC,WAAW,CAAC,CAAEC,QAAQ,GAAE,IAAI,CAAE,CAAC;IAAA,SAChCC,aAAa,CAACC,OAAmB,EAAV,UAAU,EAAEC,QAAwB,EAAb,aAAa,CAAA,EAAE;QAC3DC,GAAG,CAAC,IAAI,CAACN,GAAG,EAAE,yBAAyB,CAAC,CAAC;QACzC,IAAIK,QAAQ,IAAI,IAAI,EAAE;YACpB,IAAME,IAAI,GAAG,AAAIC,UAAU,EAAE,AAAC;YAC9BD,IAAI,CAAC,MAAM,CAAC,GAAG,cAAc,CAAC;YAC9BF,QAAQ,CAACI,MAAM,CAACF,IAAI,CAAC,CAAC;;;IAI1B,CAACN,WAAW,CAAC,CAAEC,QAAQ,GAAE,KAAK,CAAE,CAAC;IAAA,SACjCQ,YAAY,CAACN,OAAmB,EAAV,UAAU,GAAG,UAAU,CAAC;QAC5C,IAAMG,IAAI,GAAG,AAAIC,UAAU,EAAE,AAAC;QAC9BD,IAAI,CAAC,MAAM,CAAC,GAAG,YAAY,CAAC;QAC5B,OAAOA,IAAI,CAAC;;IAEd,aAASI,gBAAgB,CAACC,WAAgB,EAAH,GAAG,EAAEC,UAAe,EAAH,GAAG,EAAEN,IAAY,EAAN,MAAM,EAAE;QACzE,IAAIK,WAAW,IAAId,UAAU,CAACgB,YAAY,IAAIP,IAAI,CAACQ,QAAQ,CAAC,SAAS,CAAC,EAAE;YACtET,GAAG,CAAC,IAAI,CAACN,GAAG,EAAE,wBAAY,GAAGO,IAAI,CAACS,cAAc,CAAC,SAAS,CAAC,CAAC,CAAC;;QAC9D,MAAM;YACL,KAAK,CAACL,gBAAgB,CAACC,WAAW,EAAEC,UAAU,EAAEN,IAAI,CAAC,CAAC;;;;QAtB1D,IAAOO,YAAY,GAAG,IAAI,CAAC;;CAyB5B"}
\ No newline at end of file
{"version":3,"sources":["/Users/fxy/Projects/GitHub/uni-app/uni-app-next/packages/playground/uts/nativeplugins/test-uniplugin/android/src/io/dcloud/uniplugin/log.uts"],"names":["log","tag","msg","Log","e"],"mappings":"AAAA;AAAA,OAAgB,gBAAkB,CAAC;AACpB,IAASA,GAAG,CAACC,GAAW,EAAN,MAAM,EAAEC,GAAW,EAAN,MAAM,EAAE;IACpDC,GAAG,GAAEC,CAAC,CAACH,GAAG,EAAEC,GAAG,CAAC,CAAC"}
\ No newline at end of file
{"version":3,"sources":["/Users/fxy/Documents/projects/GitHub/uni-app/uni-app-next/packages/playground/uts/nativeplugins/test-uniplugin/android/src/io/dcloud/uniplugin/log.uts"],"names":["log","tag","msg","Log","e"],"mappings":"AAAA;AAAA,OAAgB,gBAAkB,CAAC;AACpB,IAASA,GAAG,CAACC,GAAW,EAAN,MAAM,EAAEC,GAAW,EAAN,MAAM,EAAE;IACpDC,GAAG,GAAEC,CAAC,CAACH,GAAG,EAAEC,GAAG,CAAC,CAAC"}
\ No newline at end of file
{"version":3,"sources":["/Users/fxy/Projects/GitHub/uni-app/uni-app-next/packages/playground/uts/nativeplugins/test-uniplugin/android/src/test.uts"],"names":["log","tag","msg","Log","e"],"mappings":"AAAA;AAAA,OAAgB,gBAAkB,CAAC;AACpB,IAASA,GAAG,CAACC,GAAW,EAAN,MAAM,EAAEC,GAAW,EAAN,MAAM,EAAE;IACpDC,GAAG,CAACC,CAAC,CAACH,GAAG,EAAEC,GAAG,CAAC,CAAC"}
\ No newline at end of file
{"version":3,"sources":["/Users/fxy/Documents/projects/GitHub/uni-app/uni-app-next/packages/playground/uts/nativeplugins/test-uniplugin/android/src/test.uts"],"names":["log","tag","msg","Log","e"],"mappings":"AAAA;AAAA,OAAgB,gBAAkB,CAAC;AACpB,IAASA,GAAG,CAACC,GAAW,EAAN,MAAM,EAAEC,GAAW,EAAN,MAAM,EAAE;IACpDC,GAAG,CAACC,CAAC,CAACH,GAAG,EAAEC,GAAG,CAAC,CAAC"}
\ No newline at end of file
......@@ -12,7 +12,7 @@ export const getSelectedTextRange =
UniServiceJSBridge.invokeViewMethod<
{},
UniApp.GetSelectedTextRangeSuccessCallbackResult
>('getSelectedTextRange', {}, getCurrentPageId(), (res) => {
>(API_GET_SELECTED_TEXT_RANGE, {}, getCurrentPageId(), (res) => {
if (
typeof res.end === 'undefined' &&
typeof res.start === 'undefined'
......
import { isFunction, isPlainObject } from '@vue/shared'
import { getApiCallbacks } from '../../helpers/api/callback'
import { defineAsyncApi } from '../../helpers/api'
interface OnPushCidCallback {
type: 'clientId'
......@@ -62,10 +61,6 @@ export function invokePushCallback(
}
}
interface GetPushCidOptions {
success?: OnPushMessageSuccess
}
const getPushCidCallbacks: ((cid?: string, errMsg?: string) => void)[] = []
function invokeGetPushCidCallbacks(cid?: string, errMsg?: string) {
......@@ -75,29 +70,22 @@ function invokeGetPushCidCallbacks(cid?: string, errMsg?: string) {
getPushCidCallbacks.length = 0
}
export function getPushClientId(args: GetPushCidOptions) {
if (!isPlainObject(args)) {
args = {}
}
const { success, fail, complete } = getApiCallbacks(args)
const hasSuccess = isFunction(success)
const hasFail = isFunction(fail)
const hasComplete = isFunction(complete)
getPushCidCallbacks.push((cid?: string, errMsg?: string) => {
let res: Record<string, unknown>
if (cid) {
res = { errMsg: 'getPushClientId:ok', cid }
hasSuccess && success(res)
} else {
res = { errMsg: 'getPushClientId:fail' + (errMsg ? ' ' + errMsg : '') }
hasFail && fail(res)
const API_GET_PUSH_CLIENT_ID = 'getPushClientId'
export const getPushClientId = defineAsyncApi(
API_GET_PUSH_CLIENT_ID,
(_, { resolve, reject }) => {
getPushCidCallbacks.push((cid?: string, errMsg?: string) => {
if (cid) {
resolve({ cid })
} else {
reject(errMsg)
}
})
if (typeof cid !== 'undefined') {
Promise.resolve().then(() => invokeGetPushCidCallbacks(cid, cidErrMsg))
}
hasComplete && complete(res)
})
if (typeof cid !== 'undefined') {
Promise.resolve().then(() => invokeGetPushCidCallbacks(cid, cidErrMsg))
}
}
)
interface OnPushMessageSuccess {
type: 'click' | 'receive'
......
......@@ -10994,7 +10994,7 @@ const setPageMeta = defineAsyncApi(API_SET_PAGE_META, (options, { resolve }) =>
const API_GET_SELECTED_TEXT_RANGE = 'getSelectedTextRange';
const getSelectedTextRange = defineAsyncApi(API_GET_SELECTED_TEXT_RANGE, (_, { resolve, reject }) => {
UniServiceJSBridge.invokeViewMethod('getSelectedTextRange', {}, getCurrentPageId(), (res) => {
UniServiceJSBridge.invokeViewMethod(API_GET_SELECTED_TEXT_RANGE, {}, getCurrentPageId(), (res) => {
if (typeof res.end === 'undefined' &&
typeof res.start === 'undefined') {
reject('no focused');
......@@ -11115,30 +11115,20 @@ function invokeGetPushCidCallbacks(cid, errMsg) {
});
getPushCidCallbacks.length = 0;
}
function getPushClientId(args) {
if (!isPlainObject(args)) {
args = {};
}
const { success, fail, complete } = getApiCallbacks(args);
const hasSuccess = isFunction(success);
const hasFail = isFunction(fail);
const hasComplete = isFunction(complete);
const API_GET_PUSH_CLIENT_ID = 'getPushClientId';
const getPushClientId = defineAsyncApi(API_GET_PUSH_CLIENT_ID, (_, { resolve, reject }) => {
getPushCidCallbacks.push((cid, errMsg) => {
let res;
if (cid) {
res = { errMsg: 'getPushClientId:ok', cid };
hasSuccess && success(res);
resolve({ cid });
}
else {
res = { errMsg: 'getPushClientId:fail' + (errMsg ? ' ' + errMsg : '') };
hasFail && fail(res);
reject(errMsg);
}
hasComplete && complete(res);
});
if (typeof cid !== 'undefined') {
Promise.resolve().then(() => invokeGetPushCidCallbacks(cid, cidErrMsg));
}
}
});
const onPushMessageCallbacks = [];
// 不使用 defineOnApi 实现,是因为 defineOnApi 依赖 UniServiceJSBridge ,该对象目前在小程序上未提供,故简单实现
const onPushMessage = (fn) => {
......
......@@ -4508,7 +4508,7 @@ const setPageMeta = /* @__PURE__ */ defineAsyncApi(API_SET_PAGE_META, (options,
});
const API_GET_SELECTED_TEXT_RANGE = "getSelectedTextRange";
const getSelectedTextRange$1 = /* @__PURE__ */ defineAsyncApi(API_GET_SELECTED_TEXT_RANGE, (_, { resolve, reject }) => {
UniServiceJSBridge.invokeViewMethod("getSelectedTextRange", {}, getCurrentPageId(), (res) => {
UniServiceJSBridge.invokeViewMethod(API_GET_SELECTED_TEXT_RANGE, {}, getCurrentPageId(), (res) => {
if (typeof res.end === "undefined" && typeof res.start === "undefined") {
reject("no focused");
} else {
......@@ -4619,29 +4619,19 @@ function invokeGetPushCidCallbacks(cid2, errMsg) {
});
getPushCidCallbacks.length = 0;
}
function getPushClientId(args) {
if (!isPlainObject(args)) {
args = {};
}
const { success, fail, complete } = getApiCallbacks(args);
const hasSuccess = isFunction(success);
const hasFail = isFunction(fail);
const hasComplete = isFunction(complete);
const API_GET_PUSH_CLIENT_ID = "getPushClientId";
const getPushClientId = /* @__PURE__ */ defineAsyncApi(API_GET_PUSH_CLIENT_ID, (_, { resolve, reject }) => {
getPushCidCallbacks.push((cid2, errMsg) => {
let res;
if (cid2) {
res = { errMsg: "getPushClientId:ok", cid: cid2 };
hasSuccess && success(res);
resolve({ cid: cid2 });
} else {
res = { errMsg: "getPushClientId:fail" + (errMsg ? " " + errMsg : "") };
hasFail && fail(res);
reject(errMsg);
}
hasComplete && complete(res);
});
if (typeof cid !== "undefined") {
Promise.resolve().then(() => invokeGetPushCidCallbacks(cid, cidErrMsg));
}
}
});
const onPushMessageCallbacks = [];
const onPushMessage = (fn) => {
if (onPushMessageCallbacks.indexOf(fn) === -1) {
......
import { isArray, hasOwn, isString, isPlainObject, isObject, capitalize, toRawType, makeMap, isFunction, isPromise, remove, extend } from '@vue/shared';
import { isArray, hasOwn, isString, isPlainObject, isObject, capitalize, toRawType, makeMap, isFunction, isPromise, extend, remove } from '@vue/shared';
import { normalizeLocale, LOCALE_EN } from '@dcloudio/uni-i18n';
import { Emitter, onCreateVueApp, invokeCreateVueAppHook } from '@dcloudio/uni-shared';
import { LINEFEED, Emitter, onCreateVueApp, invokeCreateVueAppHook } from '@dcloudio/uni-shared';
const eventChannels = {};
const eventChannelStack = [];
......@@ -190,6 +190,32 @@ function tryCatch(fn) {
};
}
let invokeCallbackId = 1;
const invokeCallbacks = {};
function addInvokeCallback(id, name, callback, keepAlive = false) {
invokeCallbacks[id] = {
name,
keepAlive,
callback,
};
return id;
}
// onNativeEventReceive((event,data)=>{}) 需要两个参数,目前写死最多两个参数
function invokeCallback(id, res, extras) {
if (typeof id === 'number') {
const opts = invokeCallbacks[id];
if (opts) {
if (!opts.keepAlive) {
delete invokeCallbacks[id];
}
return opts.callback(res, extras);
}
}
return res;
}
const API_SUCCESS = 'success';
const API_FAIL = 'fail';
const API_COMPLETE = 'complete';
function getApiCallbacks(args) {
const apiCallbacks = {};
for (const name in args) {
......@@ -200,6 +226,36 @@ function getApiCallbacks(args) {
}
}
return apiCallbacks;
}
function normalizeErrMsg$1(errMsg, name) {
if (!errMsg || errMsg.indexOf(':fail') === -1) {
return name + ':ok';
}
return name + errMsg.substring(errMsg.indexOf(':fail'));
}
function createAsyncApiCallback(name, args = {}, { beforeAll, beforeSuccess } = {}) {
if (!isPlainObject(args)) {
args = {};
}
const { success, fail, complete } = getApiCallbacks(args);
const hasSuccess = isFunction(success);
const hasFail = isFunction(fail);
const hasComplete = isFunction(complete);
const callbackId = invokeCallbackId++;
addInvokeCallback(callbackId, name, (res) => {
res = res || {};
res.errMsg = normalizeErrMsg$1(res.errMsg, name);
isFunction(beforeAll) && beforeAll(res);
if (res.errMsg === name + ':ok') {
isFunction(beforeSuccess) && beforeSuccess(res, args);
hasSuccess && success(res);
}
else {
hasFail && fail(res);
}
hasComplete && complete(res);
});
return callbackId;
}
const HOOK_SUCCESS = 'success';
......@@ -301,6 +357,13 @@ function invokeApi(method, api, options, params) {
return api(options, ...params);
}
function hasCallback(args) {
if (isPlainObject(args) &&
[API_SUCCESS, API_FAIL, API_COMPLETE].find((cb) => isFunction(args[cb]))) {
return true;
}
return false;
}
function handlePromise(promise) {
// if (__UNI_FEATURE_PROMISE__) {
// return promise
......@@ -310,6 +373,16 @@ function handlePromise(promise) {
// .catch((err) => [err])
// }
return promise;
}
function promisify$1(name, fn) {
return (args = {}, ...rest) => {
if (hasCallback(args)) {
return wrapperReturnValue(name, invokeApi(name, fn, args, rest));
}
return wrapperReturnValue(name, handlePromise(new Promise((resolve, reject) => {
invokeApi(name, fn, extend(args, { success: resolve, fail: reject }), rest);
})));
};
}
function formatApiArgs(args, options) {
......@@ -337,6 +410,12 @@ function formatApiArgs(args, options) {
}
}
}
function invokeSuccess(id, name, res) {
return invokeCallback(id, extend(res || {}, { errMsg: name + ':ok' }));
}
function invokeFail(id, name, errMsg, errRes) {
return invokeCallback(id, extend({ errMsg: name + ':fail' + (errMsg ? ' ' + errMsg : '') }, errRes));
}
function beforeInvokeApi(name, args, protocol, options) {
if ((process.env.NODE_ENV !== 'production')) {
validateProtocols(name, args, protocol);
......@@ -352,6 +431,29 @@ function beforeInvokeApi(name, args, protocol, options) {
return errMsg;
}
}
function normalizeErrMsg(errMsg) {
if (!errMsg || isString(errMsg)) {
return errMsg;
}
if (errMsg.stack) {
console.error(errMsg.message + LINEFEED + errMsg.stack);
return errMsg.message;
}
return errMsg;
}
function wrapperTaskApi(name, fn, protocol, options) {
return (args) => {
const id = createAsyncApiCallback(name, args, options);
const errMsg = beforeInvokeApi(name, [args], protocol, options);
if (errMsg) {
return invokeFail(id, name, errMsg);
}
return fn(args, {
resolve: (res) => invokeSuccess(id, name, res),
reject: (errMsg, errRes) => invokeFail(id, name, normalizeErrMsg(errMsg), errRes),
});
};
}
function wrapperSyncApi(name, fn, protocol, options) {
return (...args) => {
const errMsg = beforeInvokeApi(name, args, protocol, options);
......@@ -361,8 +463,14 @@ function wrapperSyncApi(name, fn, protocol, options) {
return fn.apply(null, args);
};
}
function wrapperAsyncApi(name, fn, protocol, options) {
return wrapperTaskApi(name, fn, protocol, options);
}
function defineSyncApi(name, fn, protocol, options) {
return wrapperSyncApi(name, fn, (process.env.NODE_ENV !== 'production') ? protocol : undefined, options);
}
function defineAsyncApi(name, fn, protocol, options) {
return promisify$1(name, wrapperAsyncApi(name, fn, (process.env.NODE_ENV !== 'production') ? protocol : undefined, options));
}
const API_UPX2PX = 'upx2px';
......@@ -582,30 +690,20 @@ function invokeGetPushCidCallbacks(cid, errMsg) {
});
getPushCidCallbacks.length = 0;
}
function getPushClientId(args) {
if (!isPlainObject(args)) {
args = {};
}
const { success, fail, complete } = getApiCallbacks(args);
const hasSuccess = isFunction(success);
const hasFail = isFunction(fail);
const hasComplete = isFunction(complete);
const API_GET_PUSH_CLIENT_ID = 'getPushClientId';
const getPushClientId = defineAsyncApi(API_GET_PUSH_CLIENT_ID, (_, { resolve, reject }) => {
getPushCidCallbacks.push((cid, errMsg) => {
let res;
if (cid) {
res = { errMsg: 'getPushClientId:ok', cid };
hasSuccess && success(res);
resolve({ cid });
}
else {
res = { errMsg: 'getPushClientId:fail' + (errMsg ? ' ' + errMsg : '') };
hasFail && fail(res);
reject(errMsg);
}
hasComplete && complete(res);
});
if (typeof cid !== 'undefined') {
Promise.resolve().then(() => invokeGetPushCidCallbacks(cid, cidErrMsg));
}
}
});
const onPushMessageCallbacks = [];
// 不使用 defineOnApi 实现,是因为 defineOnApi 依赖 UniServiceJSBridge ,该对象目前在小程序上未提供,故简单实现
const onPushMessage = (fn) => {
......
import { isArray, hasOwn, isString, isPlainObject, isObject, capitalize, toRawType, makeMap, isFunction, isPromise, remove, extend } from '@vue/shared';
import { isArray, hasOwn, isString, isPlainObject, isObject, capitalize, toRawType, makeMap, isFunction, isPromise, extend, remove } from '@vue/shared';
import { normalizeLocale, LOCALE_EN } from '@dcloudio/uni-i18n';
import { Emitter, onCreateVueApp, invokeCreateVueAppHook } from '@dcloudio/uni-shared';
import { LINEFEED, Emitter, onCreateVueApp, invokeCreateVueAppHook } from '@dcloudio/uni-shared';
const eventChannels = {};
const eventChannelStack = [];
......@@ -190,6 +190,32 @@ function tryCatch(fn) {
};
}
let invokeCallbackId = 1;
const invokeCallbacks = {};
function addInvokeCallback(id, name, callback, keepAlive = false) {
invokeCallbacks[id] = {
name,
keepAlive,
callback,
};
return id;
}
// onNativeEventReceive((event,data)=>{}) 需要两个参数,目前写死最多两个参数
function invokeCallback(id, res, extras) {
if (typeof id === 'number') {
const opts = invokeCallbacks[id];
if (opts) {
if (!opts.keepAlive) {
delete invokeCallbacks[id];
}
return opts.callback(res, extras);
}
}
return res;
}
const API_SUCCESS = 'success';
const API_FAIL = 'fail';
const API_COMPLETE = 'complete';
function getApiCallbacks(args) {
const apiCallbacks = {};
for (const name in args) {
......@@ -200,6 +226,36 @@ function getApiCallbacks(args) {
}
}
return apiCallbacks;
}
function normalizeErrMsg$1(errMsg, name) {
if (!errMsg || errMsg.indexOf(':fail') === -1) {
return name + ':ok';
}
return name + errMsg.substring(errMsg.indexOf(':fail'));
}
function createAsyncApiCallback(name, args = {}, { beforeAll, beforeSuccess } = {}) {
if (!isPlainObject(args)) {
args = {};
}
const { success, fail, complete } = getApiCallbacks(args);
const hasSuccess = isFunction(success);
const hasFail = isFunction(fail);
const hasComplete = isFunction(complete);
const callbackId = invokeCallbackId++;
addInvokeCallback(callbackId, name, (res) => {
res = res || {};
res.errMsg = normalizeErrMsg$1(res.errMsg, name);
isFunction(beforeAll) && beforeAll(res);
if (res.errMsg === name + ':ok') {
isFunction(beforeSuccess) && beforeSuccess(res, args);
hasSuccess && success(res);
}
else {
hasFail && fail(res);
}
hasComplete && complete(res);
});
return callbackId;
}
const HOOK_SUCCESS = 'success';
......@@ -301,6 +357,13 @@ function invokeApi(method, api, options, params) {
return api(options, ...params);
}
function hasCallback(args) {
if (isPlainObject(args) &&
[API_SUCCESS, API_FAIL, API_COMPLETE].find((cb) => isFunction(args[cb]))) {
return true;
}
return false;
}
function handlePromise(promise) {
// if (__UNI_FEATURE_PROMISE__) {
// return promise
......@@ -310,6 +373,16 @@ function handlePromise(promise) {
// .catch((err) => [err])
// }
return promise;
}
function promisify$1(name, fn) {
return (args = {}, ...rest) => {
if (hasCallback(args)) {
return wrapperReturnValue(name, invokeApi(name, fn, args, rest));
}
return wrapperReturnValue(name, handlePromise(new Promise((resolve, reject) => {
invokeApi(name, fn, extend(args, { success: resolve, fail: reject }), rest);
})));
};
}
function formatApiArgs(args, options) {
......@@ -337,6 +410,12 @@ function formatApiArgs(args, options) {
}
}
}
function invokeSuccess(id, name, res) {
return invokeCallback(id, extend(res || {}, { errMsg: name + ':ok' }));
}
function invokeFail(id, name, errMsg, errRes) {
return invokeCallback(id, extend({ errMsg: name + ':fail' + (errMsg ? ' ' + errMsg : '') }, errRes));
}
function beforeInvokeApi(name, args, protocol, options) {
if ((process.env.NODE_ENV !== 'production')) {
validateProtocols(name, args, protocol);
......@@ -352,6 +431,29 @@ function beforeInvokeApi(name, args, protocol, options) {
return errMsg;
}
}
function normalizeErrMsg(errMsg) {
if (!errMsg || isString(errMsg)) {
return errMsg;
}
if (errMsg.stack) {
console.error(errMsg.message + LINEFEED + errMsg.stack);
return errMsg.message;
}
return errMsg;
}
function wrapperTaskApi(name, fn, protocol, options) {
return (args) => {
const id = createAsyncApiCallback(name, args, options);
const errMsg = beforeInvokeApi(name, [args], protocol, options);
if (errMsg) {
return invokeFail(id, name, errMsg);
}
return fn(args, {
resolve: (res) => invokeSuccess(id, name, res),
reject: (errMsg, errRes) => invokeFail(id, name, normalizeErrMsg(errMsg), errRes),
});
};
}
function wrapperSyncApi(name, fn, protocol, options) {
return (...args) => {
const errMsg = beforeInvokeApi(name, args, protocol, options);
......@@ -361,8 +463,14 @@ function wrapperSyncApi(name, fn, protocol, options) {
return fn.apply(null, args);
};
}
function wrapperAsyncApi(name, fn, protocol, options) {
return wrapperTaskApi(name, fn, protocol, options);
}
function defineSyncApi(name, fn, protocol, options) {
return wrapperSyncApi(name, fn, (process.env.NODE_ENV !== 'production') ? protocol : undefined, options);
}
function defineAsyncApi(name, fn, protocol, options) {
return promisify$1(name, wrapperAsyncApi(name, fn, (process.env.NODE_ENV !== 'production') ? protocol : undefined, options));
}
const API_UPX2PX = 'upx2px';
......@@ -582,30 +690,20 @@ function invokeGetPushCidCallbacks(cid, errMsg) {
});
getPushCidCallbacks.length = 0;
}
function getPushClientId(args) {
if (!isPlainObject(args)) {
args = {};
}
const { success, fail, complete } = getApiCallbacks(args);
const hasSuccess = isFunction(success);
const hasFail = isFunction(fail);
const hasComplete = isFunction(complete);
const API_GET_PUSH_CLIENT_ID = 'getPushClientId';
const getPushClientId = defineAsyncApi(API_GET_PUSH_CLIENT_ID, (_, { resolve, reject }) => {
getPushCidCallbacks.push((cid, errMsg) => {
let res;
if (cid) {
res = { errMsg: 'getPushClientId:ok', cid };
hasSuccess && success(res);
resolve({ cid });
}
else {
res = { errMsg: 'getPushClientId:fail' + (errMsg ? ' ' + errMsg : '') };
hasFail && fail(res);
reject(errMsg);
}
hasComplete && complete(res);
});
if (typeof cid !== 'undefined') {
Promise.resolve().then(() => invokeGetPushCidCallbacks(cid, cidErrMsg));
}
}
});
const onPushMessageCallbacks = [];
// 不使用 defineOnApi 实现,是因为 defineOnApi 依赖 UniServiceJSBridge ,该对象目前在小程序上未提供,故简单实现
const onPushMessage = (fn) => {
......
import { isArray, hasOwn, isString, isPlainObject, isObject, capitalize, toRawType, makeMap, isFunction, isPromise, remove, extend } from '@vue/shared';
import { isArray, hasOwn, isString, isPlainObject, isObject, capitalize, toRawType, makeMap, isFunction, isPromise, extend, remove } from '@vue/shared';
import { normalizeLocale, LOCALE_EN } from '@dcloudio/uni-i18n';
import { Emitter, onCreateVueApp, invokeCreateVueAppHook } from '@dcloudio/uni-shared';
import { LINEFEED, Emitter, onCreateVueApp, invokeCreateVueAppHook } from '@dcloudio/uni-shared';
const eventChannels = {};
const eventChannelStack = [];
......@@ -190,6 +190,32 @@ function tryCatch(fn) {
};
}
let invokeCallbackId = 1;
const invokeCallbacks = {};
function addInvokeCallback(id, name, callback, keepAlive = false) {
invokeCallbacks[id] = {
name,
keepAlive,
callback,
};
return id;
}
// onNativeEventReceive((event,data)=>{}) 需要两个参数,目前写死最多两个参数
function invokeCallback(id, res, extras) {
if (typeof id === 'number') {
const opts = invokeCallbacks[id];
if (opts) {
if (!opts.keepAlive) {
delete invokeCallbacks[id];
}
return opts.callback(res, extras);
}
}
return res;
}
const API_SUCCESS = 'success';
const API_FAIL = 'fail';
const API_COMPLETE = 'complete';
function getApiCallbacks(args) {
const apiCallbacks = {};
for (const name in args) {
......@@ -200,6 +226,36 @@ function getApiCallbacks(args) {
}
}
return apiCallbacks;
}
function normalizeErrMsg$1(errMsg, name) {
if (!errMsg || errMsg.indexOf(':fail') === -1) {
return name + ':ok';
}
return name + errMsg.substring(errMsg.indexOf(':fail'));
}
function createAsyncApiCallback(name, args = {}, { beforeAll, beforeSuccess } = {}) {
if (!isPlainObject(args)) {
args = {};
}
const { success, fail, complete } = getApiCallbacks(args);
const hasSuccess = isFunction(success);
const hasFail = isFunction(fail);
const hasComplete = isFunction(complete);
const callbackId = invokeCallbackId++;
addInvokeCallback(callbackId, name, (res) => {
res = res || {};
res.errMsg = normalizeErrMsg$1(res.errMsg, name);
isFunction(beforeAll) && beforeAll(res);
if (res.errMsg === name + ':ok') {
isFunction(beforeSuccess) && beforeSuccess(res, args);
hasSuccess && success(res);
}
else {
hasFail && fail(res);
}
hasComplete && complete(res);
});
return callbackId;
}
const HOOK_SUCCESS = 'success';
......@@ -301,6 +357,13 @@ function invokeApi(method, api, options, params) {
return api(options, ...params);
}
function hasCallback(args) {
if (isPlainObject(args) &&
[API_SUCCESS, API_FAIL, API_COMPLETE].find((cb) => isFunction(args[cb]))) {
return true;
}
return false;
}
function handlePromise(promise) {
// if (__UNI_FEATURE_PROMISE__) {
// return promise
......@@ -310,6 +373,16 @@ function handlePromise(promise) {
// .catch((err) => [err])
// }
return promise;
}
function promisify$1(name, fn) {
return (args = {}, ...rest) => {
if (hasCallback(args)) {
return wrapperReturnValue(name, invokeApi(name, fn, args, rest));
}
return wrapperReturnValue(name, handlePromise(new Promise((resolve, reject) => {
invokeApi(name, fn, extend(args, { success: resolve, fail: reject }), rest);
})));
};
}
function formatApiArgs(args, options) {
......@@ -337,6 +410,12 @@ function formatApiArgs(args, options) {
}
}
}
function invokeSuccess(id, name, res) {
return invokeCallback(id, extend(res || {}, { errMsg: name + ':ok' }));
}
function invokeFail(id, name, errMsg, errRes) {
return invokeCallback(id, extend({ errMsg: name + ':fail' + (errMsg ? ' ' + errMsg : '') }, errRes));
}
function beforeInvokeApi(name, args, protocol, options) {
if ((process.env.NODE_ENV !== 'production')) {
validateProtocols(name, args, protocol);
......@@ -352,6 +431,29 @@ function beforeInvokeApi(name, args, protocol, options) {
return errMsg;
}
}
function normalizeErrMsg(errMsg) {
if (!errMsg || isString(errMsg)) {
return errMsg;
}
if (errMsg.stack) {
console.error(errMsg.message + LINEFEED + errMsg.stack);
return errMsg.message;
}
return errMsg;
}
function wrapperTaskApi(name, fn, protocol, options) {
return (args) => {
const id = createAsyncApiCallback(name, args, options);
const errMsg = beforeInvokeApi(name, [args], protocol, options);
if (errMsg) {
return invokeFail(id, name, errMsg);
}
return fn(args, {
resolve: (res) => invokeSuccess(id, name, res),
reject: (errMsg, errRes) => invokeFail(id, name, normalizeErrMsg(errMsg), errRes),
});
};
}
function wrapperSyncApi(name, fn, protocol, options) {
return (...args) => {
const errMsg = beforeInvokeApi(name, args, protocol, options);
......@@ -361,8 +463,14 @@ function wrapperSyncApi(name, fn, protocol, options) {
return fn.apply(null, args);
};
}
function wrapperAsyncApi(name, fn, protocol, options) {
return wrapperTaskApi(name, fn, protocol, options);
}
function defineSyncApi(name, fn, protocol, options) {
return wrapperSyncApi(name, fn, (process.env.NODE_ENV !== 'production') ? protocol : undefined, options);
}
function defineAsyncApi(name, fn, protocol, options) {
return promisify$1(name, wrapperAsyncApi(name, fn, (process.env.NODE_ENV !== 'production') ? protocol : undefined, options));
}
const API_UPX2PX = 'upx2px';
......@@ -582,30 +690,20 @@ function invokeGetPushCidCallbacks(cid, errMsg) {
});
getPushCidCallbacks.length = 0;
}
function getPushClientId(args) {
if (!isPlainObject(args)) {
args = {};
}
const { success, fail, complete } = getApiCallbacks(args);
const hasSuccess = isFunction(success);
const hasFail = isFunction(fail);
const hasComplete = isFunction(complete);
const API_GET_PUSH_CLIENT_ID = 'getPushClientId';
const getPushClientId = defineAsyncApi(API_GET_PUSH_CLIENT_ID, (_, { resolve, reject }) => {
getPushCidCallbacks.push((cid, errMsg) => {
let res;
if (cid) {
res = { errMsg: 'getPushClientId:ok', cid };
hasSuccess && success(res);
resolve({ cid });
}
else {
res = { errMsg: 'getPushClientId:fail' + (errMsg ? ' ' + errMsg : '') };
hasFail && fail(res);
reject(errMsg);
}
hasComplete && complete(res);
});
if (typeof cid !== 'undefined') {
Promise.resolve().then(() => invokeGetPushCidCallbacks(cid, cidErrMsg));
}
}
});
const onPushMessageCallbacks = [];
// 不使用 defineOnApi 实现,是因为 defineOnApi 依赖 UniServiceJSBridge ,该对象目前在小程序上未提供,故简单实现
const onPushMessage = (fn) => {
......
import { isArray, hasOwn, isString, isPlainObject, isObject, capitalize, toRawType, makeMap, isFunction, isPromise, remove, extend } from '@vue/shared';
import { isArray, hasOwn, isString, isPlainObject, isObject, capitalize, toRawType, makeMap, isFunction, isPromise, extend, remove } from '@vue/shared';
import { normalizeLocale, LOCALE_EN } from '@dcloudio/uni-i18n';
import { Emitter, onCreateVueApp, invokeCreateVueAppHook } from '@dcloudio/uni-shared';
import { LINEFEED, Emitter, onCreateVueApp, invokeCreateVueAppHook } from '@dcloudio/uni-shared';
const eventChannels = {};
const eventChannelStack = [];
......@@ -190,6 +190,32 @@ function tryCatch(fn) {
};
}
let invokeCallbackId = 1;
const invokeCallbacks = {};
function addInvokeCallback(id, name, callback, keepAlive = false) {
invokeCallbacks[id] = {
name,
keepAlive,
callback,
};
return id;
}
// onNativeEventReceive((event,data)=>{}) 需要两个参数,目前写死最多两个参数
function invokeCallback(id, res, extras) {
if (typeof id === 'number') {
const opts = invokeCallbacks[id];
if (opts) {
if (!opts.keepAlive) {
delete invokeCallbacks[id];
}
return opts.callback(res, extras);
}
}
return res;
}
const API_SUCCESS = 'success';
const API_FAIL = 'fail';
const API_COMPLETE = 'complete';
function getApiCallbacks(args) {
const apiCallbacks = {};
for (const name in args) {
......@@ -200,6 +226,36 @@ function getApiCallbacks(args) {
}
}
return apiCallbacks;
}
function normalizeErrMsg$1(errMsg, name) {
if (!errMsg || errMsg.indexOf(':fail') === -1) {
return name + ':ok';
}
return name + errMsg.substring(errMsg.indexOf(':fail'));
}
function createAsyncApiCallback(name, args = {}, { beforeAll, beforeSuccess } = {}) {
if (!isPlainObject(args)) {
args = {};
}
const { success, fail, complete } = getApiCallbacks(args);
const hasSuccess = isFunction(success);
const hasFail = isFunction(fail);
const hasComplete = isFunction(complete);
const callbackId = invokeCallbackId++;
addInvokeCallback(callbackId, name, (res) => {
res = res || {};
res.errMsg = normalizeErrMsg$1(res.errMsg, name);
isFunction(beforeAll) && beforeAll(res);
if (res.errMsg === name + ':ok') {
isFunction(beforeSuccess) && beforeSuccess(res, args);
hasSuccess && success(res);
}
else {
hasFail && fail(res);
}
hasComplete && complete(res);
});
return callbackId;
}
const HOOK_SUCCESS = 'success';
......@@ -301,6 +357,13 @@ function invokeApi(method, api, options, params) {
return api(options, ...params);
}
function hasCallback(args) {
if (isPlainObject(args) &&
[API_SUCCESS, API_FAIL, API_COMPLETE].find((cb) => isFunction(args[cb]))) {
return true;
}
return false;
}
function handlePromise(promise) {
// if (__UNI_FEATURE_PROMISE__) {
// return promise
......@@ -310,6 +373,16 @@ function handlePromise(promise) {
// .catch((err) => [err])
// }
return promise;
}
function promisify$1(name, fn) {
return (args = {}, ...rest) => {
if (hasCallback(args)) {
return wrapperReturnValue(name, invokeApi(name, fn, args, rest));
}
return wrapperReturnValue(name, handlePromise(new Promise((resolve, reject) => {
invokeApi(name, fn, extend(args, { success: resolve, fail: reject }), rest);
})));
};
}
function formatApiArgs(args, options) {
......@@ -337,6 +410,12 @@ function formatApiArgs(args, options) {
}
}
}
function invokeSuccess(id, name, res) {
return invokeCallback(id, extend(res || {}, { errMsg: name + ':ok' }));
}
function invokeFail(id, name, errMsg, errRes) {
return invokeCallback(id, extend({ errMsg: name + ':fail' + (errMsg ? ' ' + errMsg : '') }, errRes));
}
function beforeInvokeApi(name, args, protocol, options) {
if ((process.env.NODE_ENV !== 'production')) {
validateProtocols(name, args, protocol);
......@@ -352,6 +431,29 @@ function beforeInvokeApi(name, args, protocol, options) {
return errMsg;
}
}
function normalizeErrMsg(errMsg) {
if (!errMsg || isString(errMsg)) {
return errMsg;
}
if (errMsg.stack) {
console.error(errMsg.message + LINEFEED + errMsg.stack);
return errMsg.message;
}
return errMsg;
}
function wrapperTaskApi(name, fn, protocol, options) {
return (args) => {
const id = createAsyncApiCallback(name, args, options);
const errMsg = beforeInvokeApi(name, [args], protocol, options);
if (errMsg) {
return invokeFail(id, name, errMsg);
}
return fn(args, {
resolve: (res) => invokeSuccess(id, name, res),
reject: (errMsg, errRes) => invokeFail(id, name, normalizeErrMsg(errMsg), errRes),
});
};
}
function wrapperSyncApi(name, fn, protocol, options) {
return (...args) => {
const errMsg = beforeInvokeApi(name, args, protocol, options);
......@@ -361,8 +463,14 @@ function wrapperSyncApi(name, fn, protocol, options) {
return fn.apply(null, args);
};
}
function wrapperAsyncApi(name, fn, protocol, options) {
return wrapperTaskApi(name, fn, protocol, options);
}
function defineSyncApi(name, fn, protocol, options) {
return wrapperSyncApi(name, fn, (process.env.NODE_ENV !== 'production') ? protocol : undefined, options);
}
function defineAsyncApi(name, fn, protocol, options) {
return promisify$1(name, wrapperAsyncApi(name, fn, (process.env.NODE_ENV !== 'production') ? protocol : undefined, options));
}
const API_UPX2PX = 'upx2px';
......@@ -582,30 +690,20 @@ function invokeGetPushCidCallbacks(cid, errMsg) {
});
getPushCidCallbacks.length = 0;
}
function getPushClientId(args) {
if (!isPlainObject(args)) {
args = {};
}
const { success, fail, complete } = getApiCallbacks(args);
const hasSuccess = isFunction(success);
const hasFail = isFunction(fail);
const hasComplete = isFunction(complete);
const API_GET_PUSH_CLIENT_ID = 'getPushClientId';
const getPushClientId = defineAsyncApi(API_GET_PUSH_CLIENT_ID, (_, { resolve, reject }) => {
getPushCidCallbacks.push((cid, errMsg) => {
let res;
if (cid) {
res = { errMsg: 'getPushClientId:ok', cid };
hasSuccess && success(res);
resolve({ cid });
}
else {
res = { errMsg: 'getPushClientId:fail' + (errMsg ? ' ' + errMsg : '') };
hasFail && fail(res);
reject(errMsg);
}
hasComplete && complete(res);
});
if (typeof cid !== 'undefined') {
Promise.resolve().then(() => invokeGetPushCidCallbacks(cid, cidErrMsg));
}
}
});
const onPushMessageCallbacks = [];
// 不使用 defineOnApi 实现,是因为 defineOnApi 依赖 UniServiceJSBridge ,该对象目前在小程序上未提供,故简单实现
const onPushMessage = (fn) => {
......
import { isArray, hasOwn, isString, isPlainObject, isObject, capitalize, toRawType, makeMap, isFunction, isPromise, remove, extend } from '@vue/shared';
import { isArray, hasOwn, isString, isPlainObject, isObject, capitalize, toRawType, makeMap, isFunction, isPromise, extend, remove } from '@vue/shared';
import { normalizeLocale, LOCALE_EN } from '@dcloudio/uni-i18n';
import { Emitter, onCreateVueApp, invokeCreateVueAppHook } from '@dcloudio/uni-shared';
import { LINEFEED, Emitter, onCreateVueApp, invokeCreateVueAppHook } from '@dcloudio/uni-shared';
const eventChannels = {};
const eventChannelStack = [];
......@@ -190,6 +190,32 @@ function tryCatch(fn) {
};
}
let invokeCallbackId = 1;
const invokeCallbacks = {};
function addInvokeCallback(id, name, callback, keepAlive = false) {
invokeCallbacks[id] = {
name,
keepAlive,
callback,
};
return id;
}
// onNativeEventReceive((event,data)=>{}) 需要两个参数,目前写死最多两个参数
function invokeCallback(id, res, extras) {
if (typeof id === 'number') {
const opts = invokeCallbacks[id];
if (opts) {
if (!opts.keepAlive) {
delete invokeCallbacks[id];
}
return opts.callback(res, extras);
}
}
return res;
}
const API_SUCCESS = 'success';
const API_FAIL = 'fail';
const API_COMPLETE = 'complete';
function getApiCallbacks(args) {
const apiCallbacks = {};
for (const name in args) {
......@@ -200,6 +226,36 @@ function getApiCallbacks(args) {
}
}
return apiCallbacks;
}
function normalizeErrMsg$1(errMsg, name) {
if (!errMsg || errMsg.indexOf(':fail') === -1) {
return name + ':ok';
}
return name + errMsg.substring(errMsg.indexOf(':fail'));
}
function createAsyncApiCallback(name, args = {}, { beforeAll, beforeSuccess } = {}) {
if (!isPlainObject(args)) {
args = {};
}
const { success, fail, complete } = getApiCallbacks(args);
const hasSuccess = isFunction(success);
const hasFail = isFunction(fail);
const hasComplete = isFunction(complete);
const callbackId = invokeCallbackId++;
addInvokeCallback(callbackId, name, (res) => {
res = res || {};
res.errMsg = normalizeErrMsg$1(res.errMsg, name);
isFunction(beforeAll) && beforeAll(res);
if (res.errMsg === name + ':ok') {
isFunction(beforeSuccess) && beforeSuccess(res, args);
hasSuccess && success(res);
}
else {
hasFail && fail(res);
}
hasComplete && complete(res);
});
return callbackId;
}
const HOOK_SUCCESS = 'success';
......@@ -301,6 +357,13 @@ function invokeApi(method, api, options, params) {
return api(options, ...params);
}
function hasCallback(args) {
if (isPlainObject(args) &&
[API_SUCCESS, API_FAIL, API_COMPLETE].find((cb) => isFunction(args[cb]))) {
return true;
}
return false;
}
function handlePromise(promise) {
// if (__UNI_FEATURE_PROMISE__) {
// return promise
......@@ -310,6 +373,16 @@ function handlePromise(promise) {
// .catch((err) => [err])
// }
return promise;
}
function promisify$1(name, fn) {
return (args = {}, ...rest) => {
if (hasCallback(args)) {
return wrapperReturnValue(name, invokeApi(name, fn, args, rest));
}
return wrapperReturnValue(name, handlePromise(new Promise((resolve, reject) => {
invokeApi(name, fn, extend(args, { success: resolve, fail: reject }), rest);
})));
};
}
function formatApiArgs(args, options) {
......@@ -337,6 +410,12 @@ function formatApiArgs(args, options) {
}
}
}
function invokeSuccess(id, name, res) {
return invokeCallback(id, extend(res || {}, { errMsg: name + ':ok' }));
}
function invokeFail(id, name, errMsg, errRes) {
return invokeCallback(id, extend({ errMsg: name + ':fail' + (errMsg ? ' ' + errMsg : '') }, errRes));
}
function beforeInvokeApi(name, args, protocol, options) {
if ((process.env.NODE_ENV !== 'production')) {
validateProtocols(name, args, protocol);
......@@ -352,6 +431,29 @@ function beforeInvokeApi(name, args, protocol, options) {
return errMsg;
}
}
function normalizeErrMsg(errMsg) {
if (!errMsg || isString(errMsg)) {
return errMsg;
}
if (errMsg.stack) {
console.error(errMsg.message + LINEFEED + errMsg.stack);
return errMsg.message;
}
return errMsg;
}
function wrapperTaskApi(name, fn, protocol, options) {
return (args) => {
const id = createAsyncApiCallback(name, args, options);
const errMsg = beforeInvokeApi(name, [args], protocol, options);
if (errMsg) {
return invokeFail(id, name, errMsg);
}
return fn(args, {
resolve: (res) => invokeSuccess(id, name, res),
reject: (errMsg, errRes) => invokeFail(id, name, normalizeErrMsg(errMsg), errRes),
});
};
}
function wrapperSyncApi(name, fn, protocol, options) {
return (...args) => {
const errMsg = beforeInvokeApi(name, args, protocol, options);
......@@ -361,8 +463,14 @@ function wrapperSyncApi(name, fn, protocol, options) {
return fn.apply(null, args);
};
}
function wrapperAsyncApi(name, fn, protocol, options) {
return wrapperTaskApi(name, fn, protocol, options);
}
function defineSyncApi(name, fn, protocol, options) {
return wrapperSyncApi(name, fn, (process.env.NODE_ENV !== 'production') ? protocol : undefined, options);
}
function defineAsyncApi(name, fn, protocol, options) {
return promisify$1(name, wrapperAsyncApi(name, fn, (process.env.NODE_ENV !== 'production') ? protocol : undefined, options));
}
const API_UPX2PX = 'upx2px';
......@@ -582,30 +690,20 @@ function invokeGetPushCidCallbacks(cid, errMsg) {
});
getPushCidCallbacks.length = 0;
}
function getPushClientId(args) {
if (!isPlainObject(args)) {
args = {};
}
const { success, fail, complete } = getApiCallbacks(args);
const hasSuccess = isFunction(success);
const hasFail = isFunction(fail);
const hasComplete = isFunction(complete);
const API_GET_PUSH_CLIENT_ID = 'getPushClientId';
const getPushClientId = defineAsyncApi(API_GET_PUSH_CLIENT_ID, (_, { resolve, reject }) => {
getPushCidCallbacks.push((cid, errMsg) => {
let res;
if (cid) {
res = { errMsg: 'getPushClientId:ok', cid };
hasSuccess && success(res);
resolve({ cid });
}
else {
res = { errMsg: 'getPushClientId:fail' + (errMsg ? ' ' + errMsg : '') };
hasFail && fail(res);
reject(errMsg);
}
hasComplete && complete(res);
});
if (typeof cid !== 'undefined') {
Promise.resolve().then(() => invokeGetPushCidCallbacks(cid, cidErrMsg));
}
}
});
const onPushMessageCallbacks = [];
// 不使用 defineOnApi 实现,是因为 defineOnApi 依赖 UniServiceJSBridge ,该对象目前在小程序上未提供,故简单实现
const onPushMessage = (fn) => {
......
import { isArray, hasOwn, isString, isPlainObject, isObject, capitalize, toRawType, makeMap, isFunction, isPromise, remove, extend } from '@vue/shared';
import { isArray, hasOwn, isString, isPlainObject, isObject, capitalize, toRawType, makeMap, isFunction, isPromise, extend, remove } from '@vue/shared';
import { normalizeLocale, LOCALE_EN } from '@dcloudio/uni-i18n';
import { Emitter, onCreateVueApp, invokeCreateVueAppHook } from '@dcloudio/uni-shared';
import { LINEFEED, Emitter, onCreateVueApp, invokeCreateVueAppHook } from '@dcloudio/uni-shared';
const eventChannels = {};
const eventChannelStack = [];
......@@ -190,6 +190,32 @@ function tryCatch(fn) {
};
}
let invokeCallbackId = 1;
const invokeCallbacks = {};
function addInvokeCallback(id, name, callback, keepAlive = false) {
invokeCallbacks[id] = {
name,
keepAlive,
callback,
};
return id;
}
// onNativeEventReceive((event,data)=>{}) 需要两个参数,目前写死最多两个参数
function invokeCallback(id, res, extras) {
if (typeof id === 'number') {
const opts = invokeCallbacks[id];
if (opts) {
if (!opts.keepAlive) {
delete invokeCallbacks[id];
}
return opts.callback(res, extras);
}
}
return res;
}
const API_SUCCESS = 'success';
const API_FAIL = 'fail';
const API_COMPLETE = 'complete';
function getApiCallbacks(args) {
const apiCallbacks = {};
for (const name in args) {
......@@ -200,6 +226,36 @@ function getApiCallbacks(args) {
}
}
return apiCallbacks;
}
function normalizeErrMsg$1(errMsg, name) {
if (!errMsg || errMsg.indexOf(':fail') === -1) {
return name + ':ok';
}
return name + errMsg.substring(errMsg.indexOf(':fail'));
}
function createAsyncApiCallback(name, args = {}, { beforeAll, beforeSuccess } = {}) {
if (!isPlainObject(args)) {
args = {};
}
const { success, fail, complete } = getApiCallbacks(args);
const hasSuccess = isFunction(success);
const hasFail = isFunction(fail);
const hasComplete = isFunction(complete);
const callbackId = invokeCallbackId++;
addInvokeCallback(callbackId, name, (res) => {
res = res || {};
res.errMsg = normalizeErrMsg$1(res.errMsg, name);
isFunction(beforeAll) && beforeAll(res);
if (res.errMsg === name + ':ok') {
isFunction(beforeSuccess) && beforeSuccess(res, args);
hasSuccess && success(res);
}
else {
hasFail && fail(res);
}
hasComplete && complete(res);
});
return callbackId;
}
const HOOK_SUCCESS = 'success';
......@@ -301,6 +357,13 @@ function invokeApi(method, api, options, params) {
return api(options, ...params);
}
function hasCallback(args) {
if (isPlainObject(args) &&
[API_SUCCESS, API_FAIL, API_COMPLETE].find((cb) => isFunction(args[cb]))) {
return true;
}
return false;
}
function handlePromise(promise) {
// if (__UNI_FEATURE_PROMISE__) {
// return promise
......@@ -310,6 +373,16 @@ function handlePromise(promise) {
// .catch((err) => [err])
// }
return promise;
}
function promisify$1(name, fn) {
return (args = {}, ...rest) => {
if (hasCallback(args)) {
return wrapperReturnValue(name, invokeApi(name, fn, args, rest));
}
return wrapperReturnValue(name, handlePromise(new Promise((resolve, reject) => {
invokeApi(name, fn, extend(args, { success: resolve, fail: reject }), rest);
})));
};
}
function formatApiArgs(args, options) {
......@@ -337,6 +410,12 @@ function formatApiArgs(args, options) {
}
}
}
function invokeSuccess(id, name, res) {
return invokeCallback(id, extend(res || {}, { errMsg: name + ':ok' }));
}
function invokeFail(id, name, errMsg, errRes) {
return invokeCallback(id, extend({ errMsg: name + ':fail' + (errMsg ? ' ' + errMsg : '') }, errRes));
}
function beforeInvokeApi(name, args, protocol, options) {
if ((process.env.NODE_ENV !== 'production')) {
validateProtocols(name, args, protocol);
......@@ -352,6 +431,29 @@ function beforeInvokeApi(name, args, protocol, options) {
return errMsg;
}
}
function normalizeErrMsg(errMsg) {
if (!errMsg || isString(errMsg)) {
return errMsg;
}
if (errMsg.stack) {
console.error(errMsg.message + LINEFEED + errMsg.stack);
return errMsg.message;
}
return errMsg;
}
function wrapperTaskApi(name, fn, protocol, options) {
return (args) => {
const id = createAsyncApiCallback(name, args, options);
const errMsg = beforeInvokeApi(name, [args], protocol, options);
if (errMsg) {
return invokeFail(id, name, errMsg);
}
return fn(args, {
resolve: (res) => invokeSuccess(id, name, res),
reject: (errMsg, errRes) => invokeFail(id, name, normalizeErrMsg(errMsg), errRes),
});
};
}
function wrapperSyncApi(name, fn, protocol, options) {
return (...args) => {
const errMsg = beforeInvokeApi(name, args, protocol, options);
......@@ -361,8 +463,14 @@ function wrapperSyncApi(name, fn, protocol, options) {
return fn.apply(null, args);
};
}
function wrapperAsyncApi(name, fn, protocol, options) {
return wrapperTaskApi(name, fn, protocol, options);
}
function defineSyncApi(name, fn, protocol, options) {
return wrapperSyncApi(name, fn, (process.env.NODE_ENV !== 'production') ? protocol : undefined, options);
}
function defineAsyncApi(name, fn, protocol, options) {
return promisify$1(name, wrapperAsyncApi(name, fn, (process.env.NODE_ENV !== 'production') ? protocol : undefined, options));
}
const API_UPX2PX = 'upx2px';
......@@ -582,30 +690,20 @@ function invokeGetPushCidCallbacks(cid, errMsg) {
});
getPushCidCallbacks.length = 0;
}
function getPushClientId(args) {
if (!isPlainObject(args)) {
args = {};
}
const { success, fail, complete } = getApiCallbacks(args);
const hasSuccess = isFunction(success);
const hasFail = isFunction(fail);
const hasComplete = isFunction(complete);
const API_GET_PUSH_CLIENT_ID = 'getPushClientId';
const getPushClientId = defineAsyncApi(API_GET_PUSH_CLIENT_ID, (_, { resolve, reject }) => {
getPushCidCallbacks.push((cid, errMsg) => {
let res;
if (cid) {
res = { errMsg: 'getPushClientId:ok', cid };
hasSuccess && success(res);
resolve({ cid });
}
else {
res = { errMsg: 'getPushClientId:fail' + (errMsg ? ' ' + errMsg : '') };
hasFail && fail(res);
reject(errMsg);
}
hasComplete && complete(res);
});
if (typeof cid !== 'undefined') {
Promise.resolve().then(() => invokeGetPushCidCallbacks(cid, cidErrMsg));
}
}
});
const onPushMessageCallbacks = [];
// 不使用 defineOnApi 实现,是因为 defineOnApi 依赖 UniServiceJSBridge ,该对象目前在小程序上未提供,故简单实现
const onPushMessage = (fn) => {
......
import { isArray, hasOwn, isString, isPlainObject, isObject, capitalize, toRawType, makeMap, isFunction, isPromise, remove, extend } from '@vue/shared';
import { isArray, hasOwn, isString, isPlainObject, isObject, capitalize, toRawType, makeMap, isFunction, isPromise, extend, remove } from '@vue/shared';
import { normalizeLocale, LOCALE_EN } from '@dcloudio/uni-i18n';
import { Emitter, onCreateVueApp, invokeCreateVueAppHook, sortObject } from '@dcloudio/uni-shared';
import { LINEFEED, Emitter, onCreateVueApp, invokeCreateVueAppHook, sortObject } from '@dcloudio/uni-shared';
function getBaseSystemInfo() {
return wx.getSystemInfoSync()
......@@ -154,6 +154,32 @@ function tryCatch(fn) {
};
}
let invokeCallbackId = 1;
const invokeCallbacks = {};
function addInvokeCallback(id, name, callback, keepAlive = false) {
invokeCallbacks[id] = {
name,
keepAlive,
callback,
};
return id;
}
// onNativeEventReceive((event,data)=>{}) 需要两个参数,目前写死最多两个参数
function invokeCallback(id, res, extras) {
if (typeof id === 'number') {
const opts = invokeCallbacks[id];
if (opts) {
if (!opts.keepAlive) {
delete invokeCallbacks[id];
}
return opts.callback(res, extras);
}
}
return res;
}
const API_SUCCESS = 'success';
const API_FAIL = 'fail';
const API_COMPLETE = 'complete';
function getApiCallbacks(args) {
const apiCallbacks = {};
for (const name in args) {
......@@ -164,6 +190,36 @@ function getApiCallbacks(args) {
}
}
return apiCallbacks;
}
function normalizeErrMsg$1(errMsg, name) {
if (!errMsg || errMsg.indexOf(':fail') === -1) {
return name + ':ok';
}
return name + errMsg.substring(errMsg.indexOf(':fail'));
}
function createAsyncApiCallback(name, args = {}, { beforeAll, beforeSuccess } = {}) {
if (!isPlainObject(args)) {
args = {};
}
const { success, fail, complete } = getApiCallbacks(args);
const hasSuccess = isFunction(success);
const hasFail = isFunction(fail);
const hasComplete = isFunction(complete);
const callbackId = invokeCallbackId++;
addInvokeCallback(callbackId, name, (res) => {
res = res || {};
res.errMsg = normalizeErrMsg$1(res.errMsg, name);
isFunction(beforeAll) && beforeAll(res);
if (res.errMsg === name + ':ok') {
isFunction(beforeSuccess) && beforeSuccess(res, args);
hasSuccess && success(res);
}
else {
hasFail && fail(res);
}
hasComplete && complete(res);
});
return callbackId;
}
const HOOK_SUCCESS = 'success';
......@@ -265,6 +321,13 @@ function invokeApi(method, api, options, params) {
return api(options, ...params);
}
function hasCallback(args) {
if (isPlainObject(args) &&
[API_SUCCESS, API_FAIL, API_COMPLETE].find((cb) => isFunction(args[cb]))) {
return true;
}
return false;
}
function handlePromise(promise) {
// if (__UNI_FEATURE_PROMISE__) {
// return promise
......@@ -274,6 +337,16 @@ function handlePromise(promise) {
// .catch((err) => [err])
// }
return promise;
}
function promisify$1(name, fn) {
return (args = {}, ...rest) => {
if (hasCallback(args)) {
return wrapperReturnValue(name, invokeApi(name, fn, args, rest));
}
return wrapperReturnValue(name, handlePromise(new Promise((resolve, reject) => {
invokeApi(name, fn, extend(args, { success: resolve, fail: reject }), rest);
})));
};
}
function formatApiArgs(args, options) {
......@@ -301,6 +374,12 @@ function formatApiArgs(args, options) {
}
}
}
function invokeSuccess(id, name, res) {
return invokeCallback(id, extend(res || {}, { errMsg: name + ':ok' }));
}
function invokeFail(id, name, errMsg, errRes) {
return invokeCallback(id, extend({ errMsg: name + ':fail' + (errMsg ? ' ' + errMsg : '') }, errRes));
}
function beforeInvokeApi(name, args, protocol, options) {
if ((process.env.NODE_ENV !== 'production')) {
validateProtocols(name, args, protocol);
......@@ -316,6 +395,29 @@ function beforeInvokeApi(name, args, protocol, options) {
return errMsg;
}
}
function normalizeErrMsg(errMsg) {
if (!errMsg || isString(errMsg)) {
return errMsg;
}
if (errMsg.stack) {
console.error(errMsg.message + LINEFEED + errMsg.stack);
return errMsg.message;
}
return errMsg;
}
function wrapperTaskApi(name, fn, protocol, options) {
return (args) => {
const id = createAsyncApiCallback(name, args, options);
const errMsg = beforeInvokeApi(name, [args], protocol, options);
if (errMsg) {
return invokeFail(id, name, errMsg);
}
return fn(args, {
resolve: (res) => invokeSuccess(id, name, res),
reject: (errMsg, errRes) => invokeFail(id, name, normalizeErrMsg(errMsg), errRes),
});
};
}
function wrapperSyncApi(name, fn, protocol, options) {
return (...args) => {
const errMsg = beforeInvokeApi(name, args, protocol, options);
......@@ -325,8 +427,14 @@ function wrapperSyncApi(name, fn, protocol, options) {
return fn.apply(null, args);
};
}
function wrapperAsyncApi(name, fn, protocol, options) {
return wrapperTaskApi(name, fn, protocol, options);
}
function defineSyncApi(name, fn, protocol, options) {
return wrapperSyncApi(name, fn, (process.env.NODE_ENV !== 'production') ? protocol : undefined, options);
}
function defineAsyncApi(name, fn, protocol, options) {
return promisify$1(name, wrapperAsyncApi(name, fn, (process.env.NODE_ENV !== 'production') ? protocol : undefined, options));
}
const API_UPX2PX = 'upx2px';
......@@ -546,30 +654,20 @@ function invokeGetPushCidCallbacks(cid, errMsg) {
});
getPushCidCallbacks.length = 0;
}
function getPushClientId(args) {
if (!isPlainObject(args)) {
args = {};
}
const { success, fail, complete } = getApiCallbacks(args);
const hasSuccess = isFunction(success);
const hasFail = isFunction(fail);
const hasComplete = isFunction(complete);
const API_GET_PUSH_CLIENT_ID = 'getPushClientId';
const getPushClientId = defineAsyncApi(API_GET_PUSH_CLIENT_ID, (_, { resolve, reject }) => {
getPushCidCallbacks.push((cid, errMsg) => {
let res;
if (cid) {
res = { errMsg: 'getPushClientId:ok', cid };
hasSuccess && success(res);
resolve({ cid });
}
else {
res = { errMsg: 'getPushClientId:fail' + (errMsg ? ' ' + errMsg : '') };
hasFail && fail(res);
reject(errMsg);
}
hasComplete && complete(res);
});
if (typeof cid !== 'undefined') {
Promise.resolve().then(() => invokeGetPushCidCallbacks(cid, cidErrMsg));
}
}
});
const onPushMessageCallbacks = [];
// 不使用 defineOnApi 实现,是因为 defineOnApi 依赖 UniServiceJSBridge ,该对象目前在小程序上未提供,故简单实现
const onPushMessage = (fn) => {
......
import { isArray, hasOwn, isString, isPlainObject, isObject, capitalize, toRawType, makeMap, isFunction, isPromise, remove, extend } from '@vue/shared';
import { isArray, hasOwn, isString, isPlainObject, isObject, capitalize, toRawType, makeMap, isFunction, isPromise, extend, remove } from '@vue/shared';
import { normalizeLocale, LOCALE_EN } from '@dcloudio/uni-i18n';
import { Emitter, onCreateVueApp, invokeCreateVueAppHook } from '@dcloudio/uni-shared';
import { LINEFEED, Emitter, onCreateVueApp, invokeCreateVueAppHook } from '@dcloudio/uni-shared';
const eventChannels = {};
const eventChannelStack = [];
......@@ -190,6 +190,32 @@ function tryCatch(fn) {
};
}
let invokeCallbackId = 1;
const invokeCallbacks = {};
function addInvokeCallback(id, name, callback, keepAlive = false) {
invokeCallbacks[id] = {
name,
keepAlive,
callback,
};
return id;
}
// onNativeEventReceive((event,data)=>{}) 需要两个参数,目前写死最多两个参数
function invokeCallback(id, res, extras) {
if (typeof id === 'number') {
const opts = invokeCallbacks[id];
if (opts) {
if (!opts.keepAlive) {
delete invokeCallbacks[id];
}
return opts.callback(res, extras);
}
}
return res;
}
const API_SUCCESS = 'success';
const API_FAIL = 'fail';
const API_COMPLETE = 'complete';
function getApiCallbacks(args) {
const apiCallbacks = {};
for (const name in args) {
......@@ -200,6 +226,36 @@ function getApiCallbacks(args) {
}
}
return apiCallbacks;
}
function normalizeErrMsg$1(errMsg, name) {
if (!errMsg || errMsg.indexOf(':fail') === -1) {
return name + ':ok';
}
return name + errMsg.substring(errMsg.indexOf(':fail'));
}
function createAsyncApiCallback(name, args = {}, { beforeAll, beforeSuccess } = {}) {
if (!isPlainObject(args)) {
args = {};
}
const { success, fail, complete } = getApiCallbacks(args);
const hasSuccess = isFunction(success);
const hasFail = isFunction(fail);
const hasComplete = isFunction(complete);
const callbackId = invokeCallbackId++;
addInvokeCallback(callbackId, name, (res) => {
res = res || {};
res.errMsg = normalizeErrMsg$1(res.errMsg, name);
isFunction(beforeAll) && beforeAll(res);
if (res.errMsg === name + ':ok') {
isFunction(beforeSuccess) && beforeSuccess(res, args);
hasSuccess && success(res);
}
else {
hasFail && fail(res);
}
hasComplete && complete(res);
});
return callbackId;
}
const HOOK_SUCCESS = 'success';
......@@ -301,6 +357,13 @@ function invokeApi(method, api, options, params) {
return api(options, ...params);
}
function hasCallback(args) {
if (isPlainObject(args) &&
[API_SUCCESS, API_FAIL, API_COMPLETE].find((cb) => isFunction(args[cb]))) {
return true;
}
return false;
}
function handlePromise(promise) {
// if (__UNI_FEATURE_PROMISE__) {
// return promise
......@@ -310,6 +373,16 @@ function handlePromise(promise) {
// .catch((err) => [err])
// }
return promise;
}
function promisify$1(name, fn) {
return (args = {}, ...rest) => {
if (hasCallback(args)) {
return wrapperReturnValue(name, invokeApi(name, fn, args, rest));
}
return wrapperReturnValue(name, handlePromise(new Promise((resolve, reject) => {
invokeApi(name, fn, extend(args, { success: resolve, fail: reject }), rest);
})));
};
}
function formatApiArgs(args, options) {
......@@ -337,6 +410,12 @@ function formatApiArgs(args, options) {
}
}
}
function invokeSuccess(id, name, res) {
return invokeCallback(id, extend(res || {}, { errMsg: name + ':ok' }));
}
function invokeFail(id, name, errMsg, errRes) {
return invokeCallback(id, extend({ errMsg: name + ':fail' + (errMsg ? ' ' + errMsg : '') }, errRes));
}
function beforeInvokeApi(name, args, protocol, options) {
if ((process.env.NODE_ENV !== 'production')) {
validateProtocols(name, args, protocol);
......@@ -352,6 +431,29 @@ function beforeInvokeApi(name, args, protocol, options) {
return errMsg;
}
}
function normalizeErrMsg(errMsg) {
if (!errMsg || isString(errMsg)) {
return errMsg;
}
if (errMsg.stack) {
console.error(errMsg.message + LINEFEED + errMsg.stack);
return errMsg.message;
}
return errMsg;
}
function wrapperTaskApi(name, fn, protocol, options) {
return (args) => {
const id = createAsyncApiCallback(name, args, options);
const errMsg = beforeInvokeApi(name, [args], protocol, options);
if (errMsg) {
return invokeFail(id, name, errMsg);
}
return fn(args, {
resolve: (res) => invokeSuccess(id, name, res),
reject: (errMsg, errRes) => invokeFail(id, name, normalizeErrMsg(errMsg), errRes),
});
};
}
function wrapperSyncApi(name, fn, protocol, options) {
return (...args) => {
const errMsg = beforeInvokeApi(name, args, protocol, options);
......@@ -361,8 +463,14 @@ function wrapperSyncApi(name, fn, protocol, options) {
return fn.apply(null, args);
};
}
function wrapperAsyncApi(name, fn, protocol, options) {
return wrapperTaskApi(name, fn, protocol, options);
}
function defineSyncApi(name, fn, protocol, options) {
return wrapperSyncApi(name, fn, (process.env.NODE_ENV !== 'production') ? protocol : undefined, options);
}
function defineAsyncApi(name, fn, protocol, options) {
return promisify$1(name, wrapperAsyncApi(name, fn, (process.env.NODE_ENV !== 'production') ? protocol : undefined, options));
}
const API_UPX2PX = 'upx2px';
......@@ -582,30 +690,20 @@ function invokeGetPushCidCallbacks(cid, errMsg) {
});
getPushCidCallbacks.length = 0;
}
function getPushClientId(args) {
if (!isPlainObject(args)) {
args = {};
}
const { success, fail, complete } = getApiCallbacks(args);
const hasSuccess = isFunction(success);
const hasFail = isFunction(fail);
const hasComplete = isFunction(complete);
const API_GET_PUSH_CLIENT_ID = 'getPushClientId';
const getPushClientId = defineAsyncApi(API_GET_PUSH_CLIENT_ID, (_, { resolve, reject }) => {
getPushCidCallbacks.push((cid, errMsg) => {
let res;
if (cid) {
res = { errMsg: 'getPushClientId:ok', cid };
hasSuccess && success(res);
resolve({ cid });
}
else {
res = { errMsg: 'getPushClientId:fail' + (errMsg ? ' ' + errMsg : '') };
hasFail && fail(res);
reject(errMsg);
}
hasComplete && complete(res);
});
if (typeof cid !== 'undefined') {
Promise.resolve().then(() => invokeGetPushCidCallbacks(cid, cidErrMsg));
}
}
});
const onPushMessageCallbacks = [];
// 不使用 defineOnApi 实现,是因为 defineOnApi 依赖 UniServiceJSBridge ,该对象目前在小程序上未提供,故简单实现
const onPushMessage = (fn) => {
......
......@@ -5178,7 +5178,7 @@ packages:
resolution: {integrity: sha512-9ByhssR2fPVsNZj478qUUbKfmL0+t5BDVyjShtyZZLiK7ZDAArFFfopyOTj0M05wE2tJPisA4iTnnXl2YoPvOA==}
/graceful-fs/4.2.9:
resolution: {integrity: sha512-NtNxqUcXgpW2iMrfqSfR73Glt39K+BLwWsPs94yR63v45T0Wbej7eRmL5cWfwEgqXnmjQp3zaJTshdRW/qC2ZQ==, registry: https://registry.yarnpkg.com/}
resolution: {integrity: sha512-NtNxqUcXgpW2iMrfqSfR73Glt39K+BLwWsPs94yR63v45T0Wbej7eRmL5cWfwEgqXnmjQp3zaJTshdRW/qC2ZQ==, registry: https://registry.yarnpkg.com/, tarball: https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.9.tgz}
dev: true
/has-flag/3.0.0:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册