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

wip(app): uni-app-plus

上级 eca0cc12
......@@ -86,7 +86,7 @@
"semver": "^7.3.4",
"ts-jest": "^27.0.3",
"typescript": "~4.1.3",
"vite": "^2.4.0",
"vite": "^2.4.1",
"vue": "^3.1.2",
"yorkie": "^2.0.0"
},
......
......@@ -31,6 +31,6 @@
"compression": "^1.7.4",
"cypress": "^7.3.0",
"serve-static": "^1.14.1",
"vite": "^2.4.0"
"vite": "^2.4.1"
}
}
......@@ -148,39 +148,39 @@
integrity sha512-LfZwXoGUDo0C3me81HXgkBg5CTQYb6xzEl+fNmbO4JdRiSKQ8A0GD1OBBvKAIsbCUgoyAty7m99GqqMQe784ew==
"@types/fs-extra@^8.0.1":
version "8.1.1"
resolved "https://registry.yarnpkg.com/@types/fs-extra/-/fs-extra-8.1.1.tgz#1e49f22d09aa46e19b51c0b013cb63d0d923a068"
integrity sha512-TcUlBem321DFQzBNuz8p0CLLKp0VvF/XH9E4KHNmgwyp4E3AfgI5cjiIVZWlbfThBop2qxFIh4+LeY6hVWWZ2w==
version "8.1.2"
resolved "https://registry.yarnpkg.com/@types/fs-extra/-/fs-extra-8.1.2.tgz#7125cc2e4bdd9bd2fc83005ffdb1d0ba00cca61f"
integrity sha512-SvSrYXfWSc7R4eqnOzbQF4TZmfpNSM9FrSWLU3EUnWBuyZqNBOrv1B1JA3byUDPUl9z4Ab3jeZG2eDdySlgNMg==
dependencies:
"@types/node" "*"
"@types/glob@^7.1.1":
version "7.1.3"
resolved "https://registry.yarnpkg.com/@types/glob/-/glob-7.1.3.tgz#e6ba80f36b7daad2c685acd9266382e68985c183"
integrity sha512-SEYeGAIQIQX8NN6LDKprLjbrd5dARM5EXsd8GI/A5l0apYI1fGMWgPHSe4ZKL4eozlAyI+doUE9XbYS4xCkQ1w==
version "7.1.4"
resolved "https://registry.yarnpkg.com/@types/glob/-/glob-7.1.4.tgz#ea59e21d2ee5c517914cb4bc8e4153b99e566672"
integrity sha512-w+LsMxKyYQm347Otw+IfBXOv9UWVjpHpCDdbBMt8Kz/xbvCYNjP+0qPh91Km3iKfSRLBB0P7fAMf0KHrPu+MyA==
dependencies:
"@types/minimatch" "*"
"@types/node" "*"
"@types/minimatch@*":
version "3.0.4"
resolved "https://registry.yarnpkg.com/@types/minimatch/-/minimatch-3.0.4.tgz#f0ec25dbf2f0e4b18647313ac031134ca5b24b21"
integrity sha512-1z8k4wzFnNjVK/tlxvrWuK5WMt6mydWWP7+zvH5eFep4oj+UkrfiJTRtjCeBXNpwaA/FYqqtb4/QS4ianFpIRA==
version "3.0.5"
resolved "https://registry.yarnpkg.com/@types/minimatch/-/minimatch-3.0.5.tgz#1001cc5e6a3704b83c236027e77f2f58ea010f40"
integrity sha512-Klz949h02Gz2uZCMGwDUSDS1YBlTdDDgbWHi+81l29tQALUtvz4rAYi5uoVhE5Lagoq6DeqAUlbrHvW/mXDgdQ==
"@types/node@*":
version "16.0.0"
resolved "https://registry.yarnpkg.com/@types/node/-/node-16.0.0.tgz#067a6c49dc7a5c2412a505628e26902ae967bf6f"
integrity sha512-TmCW5HoZ2o2/z2EYi109jLqIaPIi9y/lc2LmDCWzuCi35bcaQ+OtUh6nwBiFK7SOu25FAU5+YKdqFZUwtqGSdg==
version "16.0.1"
resolved "https://registry.yarnpkg.com/@types/node/-/node-16.0.1.tgz#70cedfda26af7a2ca073fdcc9beb2fff4aa693f8"
integrity sha512-hBOx4SUlEPKwRi6PrXuTGw1z6lz0fjsibcWCM378YxsSu/6+C30L6CR49zIBKHiwNWCYIcOLjg4OHKZaFeLAug==
"@types/node@^14.14.31":
version "14.17.4"
resolved "https://registry.yarnpkg.com/@types/node/-/node-14.17.4.tgz#218712242446fc868d0e007af29a4408c7765bc0"
integrity sha512-8kQ3+wKGRNN0ghtEn7EGps/B8CzuBz1nXZEIGGLP2GnwbqYn4dbTs7k+VKLTq1HvZLRCIDtN3Snx1Ege8B7L5A==
version "14.17.5"
resolved "https://registry.yarnpkg.com/@types/node/-/node-14.17.5.tgz#b59daf6a7ffa461b5648456ca59050ba8e40ed54"
integrity sha512-bjqH2cX/O33jXT/UmReo2pM7DIJREPMnarixbQ57DOOzzFaI6D2+IcwaJQaJpv0M1E9TIhPCYVxrkcityLjlqA==
"@types/sinonjs__fake-timers@^6.0.2":
version "6.0.2"
resolved "https://registry.yarnpkg.com/@types/sinonjs__fake-timers/-/sinonjs__fake-timers-6.0.2.tgz#3a84cf5ec3249439015e14049bd3161419bf9eae"
integrity sha512-dIPoZ3g5gcx9zZEszaxLSVTvMReD3xxyyDnQUjA6IYDG9Ba2AV0otMPs+77sG9ojB4Qr2N2Vk5RnKeuA0X/0bg==
version "6.0.3"
resolved "https://registry.yarnpkg.com/@types/sinonjs__fake-timers/-/sinonjs__fake-timers-6.0.3.tgz#79df6f358ae8f79e628fe35a63608a0ea8e7cf08"
integrity sha512-E1dU4fzC9wN2QK2Cr1MLCfyHM8BoNnRFvuf45LYMPNDA+WqbNzC45S4UzPxvp1fFJ1rvSGU0bPvdd35VLmXG8g==
"@types/sizzle@^2.3.2":
version "2.3.3"
......@@ -505,9 +505,9 @@ cachedir@^2.3.0:
integrity sha512-A+Fezp4zxnit6FanDmv9EqXNAi3vt9DWp51/71UEhXukb7QUuvtv9344h91dyAxuTLoSYJFU299qzR3tzwPAhw==
caniuse-lite@^1.0.30001219, caniuse-lite@^1.0.30001230:
version "1.0.30001242"
resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001242.tgz#04201627abcd60dc89211f22cbe2347306cda46b"
integrity sha512-KvNuZ/duufelMB3w2xtf9gEWCSxJwUgoxOx5b6ScLXC4kPc9xsczUVCPrQU26j5kOsHM4pSUL54tAZt5THQKug==
version "1.0.30001243"
resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001243.tgz#d9250155c91e872186671c523f3ae50cfc94a3aa"
integrity sha512-vNxw9mkTBtkmLFnJRv/2rhs1yufpDfCkBZexG3Y0xdOH2Z/eE/85E4Dl5j1YUN34nZVsSp6vVRFQRrez9wJMRA==
caseless@~0.12.0:
version "0.12.0"
......@@ -685,9 +685,9 @@ csstype@^2.6.8:
integrity sha512-u1wmTI1jJGzCJzWndZo8mk4wnPTZd1eOIYTYvuEyOQGfmDl3TrabCCfKnOC86FZwW/9djqTl933UF/cS425i9A==
cypress@^7.3.0:
version "7.6.0"
resolved "https://registry.yarnpkg.com/cypress/-/cypress-7.6.0.tgz#80fe7496cd4165a0fa06e25fc11413dda4544463"
integrity sha512-tTwQExY28CKt6cY85/2V1uLExcMfpBEBWXt/EcE2ht/Onl9k4lxUS7ul1UnUO5MrYwMIHMdGVh13DxdzXj4Z5w==
version "7.7.0"
resolved "https://registry.yarnpkg.com/cypress/-/cypress-7.7.0.tgz#0839ae28e5520536f9667d6c9ae81496b3836e64"
integrity sha512-uYBYXNoI5ym0UxROwhQXWTi8JbUEjpC6l/bzoGZNxoKGsLrC1SDPgIDJMgLX/MeEdPL0UInXLDUWN/rSyZUCjQ==
dependencies:
"@cypress/request" "^2.88.5"
"@cypress/xvfb" "^1.2.4"
......@@ -739,9 +739,9 @@ dashdash@^1.12.0:
assert-plus "^1.0.0"
dayjs@^1.10.4:
version "1.10.5"
resolved "https://registry.yarnpkg.com/dayjs/-/dayjs-1.10.5.tgz#5600df4548fc2453b3f163ebb2abbe965ccfb986"
integrity sha512-BUFis41ikLz+65iH6LHQCDm4YPMj5r1YFLdupPIyM4SGcXMmtiLQ7U37i+hGS8urIuqe7I/ou3IS1jVc4nbN4g==
version "1.10.6"
resolved "https://registry.yarnpkg.com/dayjs/-/dayjs-1.10.6.tgz#288b2aa82f2d8418a6c9d4df5898c0737ad02a63"
integrity sha512-AztC/IOW4L1Q41A86phW5Thhcrco3xuAA+YX/BLpLWWjRcTj5TOt/QImBLmCKlrF7u7k47arTnOyL6GnbG8Hvw==
debug@2.6.9:
version "2.6.9"
......@@ -800,9 +800,9 @@ ee-first@1.1.1:
integrity sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0=
electron-to-chromium@^1.3.723:
version "1.3.768"
resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.768.tgz#bbe47394f0073c947168589b7d19388518a7a9a9"
integrity sha512-I4UMZHhVSK2pwt8jOIxTi3GIuc41NkddtKT/hpuxp9GO5UWJgDKTBa4TACppbVAuKtKbMK6BhQZvT5tFF1bcNA==
version "1.3.770"
resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.770.tgz#a9e705a73315f4900880622b3ab76cf1d7221b77"
integrity sha512-Kyh8DGK1KfEZuYKIHvuOmrKotsKZQ+qBkDIWHciE3QoFkxXB1KzPP+tfLilSHAfxTON0yYMnFCWkQtUOR7g6KQ==
emoji-regex@^8.0.0:
version "8.0.0"
......@@ -834,9 +834,9 @@ enquirer@^2.3.6:
ansi-colors "^4.1.1"
esbuild@^0.12.8:
version "0.12.14"
resolved "https://registry.yarnpkg.com/esbuild/-/esbuild-0.12.14.tgz#43157dbd0b36d939247d4eb4909a4886ac40f82e"
integrity sha512-z8p+6FGiplR7a3pPonXREbm+8IeXjBGvDpVidZmGB/AJMsJSfGCU+n7KOMCazA9AwvagadRWBhiKorC0w9WJvw==
version "0.12.15"
resolved "https://registry.yarnpkg.com/esbuild/-/esbuild-0.12.15.tgz#9d99cf39aeb2188265c5983e983e236829f08af0"
integrity sha512-72V4JNd2+48eOVCXx49xoSWHgC3/cCy96e7mbXKY+WOWghN00cCmlGnwVLRhRHorvv0dgCyuMYBZlM2xDM5OQw==
escalade@^3.1.1:
version "3.1.1"
......@@ -1913,9 +1913,9 @@ rollup-plugin-copy@^3.4.0:
is-plain-object "^3.0.0"
rollup@^2.38.5:
version "2.52.7"
resolved "https://registry.yarnpkg.com/rollup/-/rollup-2.52.7.tgz#e15a8bf734f6e4c204b7cdf33521151310250cb2"
integrity sha512-55cSH4CCU6MaPr9TAOyrIC+7qFCHscL7tkNsm1MBfIJRRqRbCEY0mmeFn4Wg8FKsHtEH8r389Fz38r/o+kgXLg==
version "2.52.8"
resolved "https://registry.yarnpkg.com/rollup/-/rollup-2.52.8.tgz#b6462f9c16ffe8995b9a2b313f2e4247fa75e4d9"
integrity sha512-IjAB0C6KK5/lvqzJWAzsvOik+jV5Bt907QdkQ/gDP4j+R9KYNI1tjqdxiPitGPVrWC21Mf/ucXgowUjN/VemaQ==
optionalDependencies:
fsevents "~2.3.2"
......@@ -2243,10 +2243,10 @@ verror@1.10.0:
core-util-is "1.0.2"
extsprintf "^1.2.0"
vite@^2.4.0:
version "2.4.0"
resolved "https://registry.yarnpkg.com/vite/-/vite-2.4.0.tgz#a591e4f2c996ae9a044093f629b418069629ca16"
integrity sha512-FR+1hCyGt8i+ijMe9z4tIfUQ7BQThxGevp3IlmdXDBSJEPjbeDznbuJa/QVzXw2Mpxh7KCmveVI082h8nzcCNw==
vite@^2.4.1:
version "2.4.1"
resolved "https://registry.yarnpkg.com/vite/-/vite-2.4.1.tgz#2e48b8dbfc69e4edbf7f4d1c0798d621585cb8da"
integrity sha512-4BpKRis9uxIqPfIEcJ18LTBsamqnDFxTx45CXwagHjNltHa6PFEvf8Pe6OpgIHb0OyWT30OXOSSQvdOaX4OBiQ==
dependencies:
esbuild "^0.12.8"
postcss "^8.3.5"
......
......@@ -155,6 +155,8 @@ declare namespace UniApp {
'mp-toutiao'?: PagesJsonPageStyle
'mp-weixin'?: PagesJsonPageStyle
'quickapp-webview'?: PagesJsonPageStyle
'quickapp-webview-huawei'?: PagesJsonPageStyle
'quickapp-webview-union'?: PagesJsonPageStyle
}
interface PagesJsonPageStyle extends PagesJsonPagePlatformStyle {
......
......@@ -2,12 +2,12 @@ import { extend, isPlainObject, isFunction } from '@vue/shared'
import { API_SUCCESS, API_FAIL, API_COMPLETE } from './callback'
const callbacks = [API_SUCCESS, API_FAIL, API_COMPLETE]
function hasCallback(args: unknown) {
if (
isPlainObject(args) &&
callbacks.find((cb) => isFunction((args as Record<string, any>)[cb]))
[API_SUCCESS, API_FAIL, API_COMPLETE].find((cb) =>
isFunction((args as Record<string, any>)[cb])
)
) {
return true
}
......
import { getCustomDataset } from '@dcloudio/uni-shared'
import { initIntersectionObserverPolyfill } from './intersection-observer'
export interface RequestComponentObserverOptions {
......@@ -38,8 +39,8 @@ export function requestComponentObserver(
boundingClientRect: normalizeRect(entrie.boundingClientRect),
relativeRect: normalizeRect(entrie.rootBounds!),
time: Date.now(),
// dataset: getCustomDataset(entrie.target),
// id: entrie.target.id,
dataset: getCustomDataset(entrie.target as HTMLElement),
id: entrie.target.id,
})
})
},
......
......@@ -406,10 +406,9 @@ var serviceContext = (function (vue) {
return callbackId;
}
const callbacks$2 = [API_SUCCESS, API_FAIL, API_COMPLETE];
function hasCallback(args) {
if (isPlainObject(args) &&
callbacks$2.find((cb) => isFunction(args[cb]))) {
[API_SUCCESS, API_FAIL, API_COMPLETE].find((cb) => isFunction(args[cb]))) {
return true;
}
return false;
......@@ -2947,15 +2946,6 @@ var serviceContext = (function (vue) {
fail: warpPlusErrorCallback(reject),
}));
};
}
function callApiSync(api, args, resolve, reject) {
api(args)
.then(() => {
resolve();
})
.catch((errMsg) => {
reject(errMsg);
});
}
const STORAGE_DATA_TYPE = '__TYPE';
......@@ -5132,15 +5122,10 @@ var serviceContext = (function (vue) {
let isShowToast = false;
let toastType = '';
let timeout;
const showLoading = defineAsyncApi(API_SHOW_LOADING, (args, { resolve, reject }) => {
callApiSync(showToast, extend({}, args, {
type: 'loading',
}), resolve, reject);
}, ShowLoadingProtocol, ShowLoadingOptions);
const hideLoading = defineAsyncApi(API_HIDE_LOADING, (_, { resolve, reject }) => {
callApiSync(hide, 'loading', resolve, reject);
});
const showToast = defineAsyncApi(API_SHOW_TOAST, ({ title = '', icon = 'success', image = '', duration = 1500, mask = false, position,
const showLoading = defineAsyncApi(API_SHOW_LOADING, (args, callbacks) => _showToast(extend({}, args, {
type: 'loading',
}), callbacks), ShowLoadingProtocol, ShowLoadingOptions);
const _showToast = ({ title = '', icon = 'success', image = '', duration = 1500, mask = false, position,
// @ts-ignore ToastType
type = 'toast',
// @ts-ignore PlusNativeUIWaitingStyles
......@@ -5205,13 +5190,14 @@ var serviceContext = (function (vue) {
hide('');
}, duration);
return resolve();
}, ShowToastProtocol, ShowToastOptions);
const hideToast = defineAsyncApi(API_HIDE_TOAST, (_, { resolve, reject }) => {
callApiSync(hide, 'toast', resolve, reject);
});
function hide(type = 'toast') {
};
const showToast = defineAsyncApi(API_SHOW_TOAST, _showToast, ShowToastProtocol, ShowToastOptions);
const hideToast = defineAsyncApi(API_HIDE_TOAST, (_, callbacks) => hide('toast', callbacks));
const hideLoading = defineAsyncApi(API_HIDE_LOADING, (_, callbacks) => hide('loading', callbacks));
function hide(type = 'toast', callbacks) {
if (type && type !== toastType) {
return;
// 应该不需要失败回调,在页面后退时,会主动 hideToast 和 hideLoading,如果 reject 会出异常。
return callbacks && callbacks.resolve();
}
if (timeout) {
clearTimeout(timeout);
......@@ -5226,9 +5212,7 @@ var serviceContext = (function (vue) {
toast = null;
isShowToast = false;
toastType = '';
return {
errMsg: 'hide:ok',
};
return callbacks && callbacks.resolve();
}
const providers = {
......@@ -7422,10 +7406,9 @@ var serviceContext = (function (vue) {
showModal: showModal,
showActionSheet: showActionSheet,
showLoading: showLoading,
hideLoading: hideLoading,
showToast: showToast,
hideToast: hideToast,
hide: hide,
hideLoading: hideLoading,
getProvider: getProvider,
login: login,
getUserInfo: getUserInfo,
......
......@@ -135,7 +135,8 @@ function hide(
callbacks?: { resolve: Resolve; reject: Reject }
) {
if (type && type !== toastType) {
return callbacks?.reject()
// 应该不需要失败回调,在页面后退时,会主动 hideToast 和 hideLoading,如果 reject 会出异常。
return callbacks && callbacks.resolve()
}
if (timeout) {
clearTimeout(timeout)
......@@ -149,5 +150,5 @@ function hide(
toast = null
isShowToast = false
toastType = ''
return callbacks?.resolve()
return callbacks && callbacks.resolve()
}
export const jsContext = {
VUE3: true,
APP_PLUS: false,
H5: true,
MP_360: false,
MP_ALIPAY: false,
MP_BAIDU: false,
MP_QQ: false,
MP_TOUTIAO: false,
MP_WEIXIN: false,
QUICKAPP_NATIVE: false,
QUICKAPP_WEBVIEW: false,
QUICKAPP_WEBVIEW_UNION: false,
QUICKAPP_WEBVIEW_HUAWEI: false,
MP: false,
APP: false,
APP_PLUS_NVUE: false,
APP_VUE: false,
APP_NVUE: false,
import { extend } from '@vue/shared'
const DEFAULT_KEYS = [
'APP',
'APP_NVUE',
'APP_PLUS',
'APP_PLUS_NVUE',
'APP_VUE',
'H5',
'MP',
'MP_360',
'MP_ALIPAY',
'MP_BAIDU',
'MP_QQ',
'MP_TOUTIAO',
'MP_WEIXIN',
'MP_KUAISHOU',
'QUICKAPP_NATIVE',
'QUICKAPP_WEBVIEW',
'QUICKAPP_WEBVIEW_HUAWEI',
'QUICKAPP_WEBVIEW_UNION',
'VUE2',
'VUE3',
] as const
const preVueContext = Object.create(null)
const preNVueContext = Object.create(null)
export function getPreVueContext() {
return preVueContext
}
export const htmlContext = {
VUE3: true,
APP_PLUS: false,
H5: true,
MP_360: false,
MP_ALIPAY: false,
MP_BAIDU: false,
MP_QQ: false,
MP_TOUTIAO: false,
MP_WEIXIN: false,
QUICKAPP_NATIVE: false,
QUICKAPP_WEBVIEW: false,
MP: false,
APP: false,
APP_PLUS_NVUE: false,
APP_VUE: false,
APP_NVUE: false,
export function getPreNVueContext() {
return preNVueContext
}
export function initPreContext(
platform: UniApp.PLATFORM,
userPreContext?: Record<string, boolean>
) {
const vueContext = Object.create(null)
const nvueContext = Object.create(null)
const defaultContext = Object.create(null)
DEFAULT_KEYS.forEach((key) => {
defaultContext[key] = false
})
defaultContext[normalizeKey(platform)] = true
vueContext.VUE3 = true
nvueContext.VUE2 = true
if (platform === 'app' || platform === 'app-plus') {
defaultContext.APP = true
defaultContext.APP_PLUS = true
vueContext.APP_VUE = true
nvueContext.APP_NVUE = true
nvueContext.APP_PLUS_NVUE = true
} else if (platform.startsWith('mp-')) {
defaultContext.MP = true
} else if (platform.startsWith('quickapp-webview')) {
defaultContext.QUICKAPP_WEBVIEW = true
}
if (userPreContext) {
Object.keys(userPreContext).forEach((key) => {
defaultContext[normalizeKey(key)] = !!userPreContext[key]
})
}
extend(preVueContext, defaultContext, vueContext)
extend(preNVueContext, defaultContext, nvueContext)
}
function normalizeKey(name: string) {
return name.replace(/-/g, '_').toUpperCase()
}
import { jsContext } from './context'
export * from './context'
import { getPreNVueContext, getPreVueContext } from './context'
/* eslint-disable no-restricted-globals */
const { preprocess } = require('../../lib/preprocess')
export { initPreContext } from './context'
export function preJs(jsCode: string) {
return preprocess(jsCode, jsContext, { type: 'js' })
return preprocess(jsCode, getPreVueContext(), { type: 'js' })
}
export function preHtml(htmlCode: string) {
return preprocess(htmlCode, jsContext, { type: 'html' })
return preprocess(htmlCode, getPreVueContext(), { type: 'html' })
}
export const preCss = preJs
export const preJson = preJs
export function preNVueJs(jsCode: string) {
return preprocess(jsCode, getPreNVueContext(), { type: 'js' })
}
export function preNVueHtml(htmlCode: string) {
return preprocess(htmlCode, getPreNVueContext(), { type: 'html' })
}
export const preNVueCss = preNVueJs
export const preNVueJson = preNVueJs
......@@ -536,15 +536,15 @@ function getRealRoute(fromRoute, toRoute) {
fromRouteArray.splice(fromRouteArray.length - i - 1, i + 1);
return "/" + fromRouteArray.concat(toRouteArray).join("/");
}
const callbacks$1 = {};
const callbacks = {};
function createCallbacks(namespace) {
let scopedCallbacks = callbacks$1[namespace];
let scopedCallbacks = callbacks[namespace];
if (!scopedCallbacks) {
scopedCallbacks = {
id: 1,
callbacks: Object.create(null)
};
callbacks$1[namespace] = scopedCallbacks;
callbacks[namespace] = scopedCallbacks;
}
return {
get(id) {
......@@ -1250,9 +1250,8 @@ function createAsyncApiCallback(name, args = {}, { beforeAll, beforeSuccess } =
});
return callbackId;
}
const callbacks = [API_SUCCESS, API_FAIL, API_COMPLETE];
function hasCallback(args) {
if (shared.isPlainObject(args) && callbacks.find((cb) => shared.isFunction(args[cb]))) {
if (shared.isPlainObject(args) && [API_SUCCESS, API_FAIL, API_COMPLETE].find((cb) => shared.isFunction(args[cb]))) {
return true;
}
return false;
......
......@@ -693,14 +693,14 @@ function attrChange(attr2) {
style[attr3] = elementComputedStyle[attr3];
});
changeAttrs.length = 0;
callbacks$3.forEach(function(callback) {
callbacks$2.forEach(function(callback) {
callback(style);
});
}, 0);
}
changeAttrs.push(attr2);
}
var callbacks$3 = [];
var callbacks$2 = [];
function onChange(callback) {
if (!getSupport()) {
return;
......@@ -709,13 +709,13 @@ function onChange(callback) {
init();
}
if (typeof callback === "function") {
callbacks$3.push(callback);
callbacks$2.push(callback);
}
}
function offChange(callback) {
var index2 = callbacks$3.indexOf(callback);
var index2 = callbacks$2.indexOf(callback);
if (index2 >= 0) {
callbacks$3.splice(index2, 1);
callbacks$2.splice(index2, 1);
}
}
var safeAreaInsets = {
......@@ -1039,15 +1039,15 @@ function getRouteOptions(path, alias = false) {
}
return __uniRoutes.find((route) => route.path === path);
}
const callbacks$2 = {};
const callbacks$1 = {};
function createCallbacks(namespace) {
let scopedCallbacks = callbacks$2[namespace];
let scopedCallbacks = callbacks$1[namespace];
if (!scopedCallbacks) {
scopedCallbacks = {
id: 1,
callbacks: Object.create(null)
};
callbacks$2[namespace] = scopedCallbacks;
callbacks$1[namespace] = scopedCallbacks;
}
return {
get(id2) {
......@@ -2371,9 +2371,8 @@ function createAsyncApiCallback(name, args = {}, { beforeAll, beforeSuccess } =
});
return callbackId;
}
const callbacks$1 = [API_SUCCESS, API_FAIL, API_COMPLETE];
function hasCallback(args) {
if (isPlainObject(args) && callbacks$1.find((cb) => isFunction(args[cb]))) {
if (isPlainObject(args) && [API_SUCCESS, API_FAIL, API_COMPLETE].find((cb) => isFunction(args[cb]))) {
return true;
}
return false;
......@@ -5619,7 +5618,9 @@ function requestComponentObserver($el, options, callback) {
intersectionRect: normalizeRect(entrie.intersectionRect),
boundingClientRect: normalizeRect(entrie.boundingClientRect),
relativeRect: normalizeRect(entrie.rootBounds),
time: Date.now()
time: Date.now(),
dataset: getCustomDataset(entrie.target),
id: entrie.target.id
});
});
}, {
......
import { capitalize, hasOwn, isArray, toNumber, isPlainObject, isObject, isFunction, extend, NOOP, EMPTY_OBJ, camelize } from '@vue/shared';
import { hasOwn, isArray, toNumber, isPlainObject, isObject, capitalize, isFunction, extend, NOOP, EMPTY_OBJ, camelize } from '@vue/shared';
function setModel(target, key, value, modifiers) {
if (isArray(modifiers)) {
......
import { isFunction, extend, isSymbol, isMap, isObject, toRawType, def, isArray, isString, isPromise, toHandlerKey, remove, EMPTY_OBJ, camelize, capitalize, normalizeClass, normalizeStyle, isOn, NOOP, isGloballyWhitelisted, isIntegerKey, hasOwn, hasChanged, NO, invokeArrayFns as invokeArrayFns$1, makeMap, isSet, toNumber, hyphenate, isReservedProp, EMPTY_ARR, toTypeString } from '@vue/shared';
import { isFunction, extend, isSymbol, isMap, isObject, toRawType, def, isArray, isString, isPromise, toHandlerKey, remove, EMPTY_OBJ, camelize, capitalize, normalizeClass, normalizeStyle, isOn, NOOP, isGloballyWhitelisted, isIntegerKey, hasOwn, hasChanged, invokeArrayFns as invokeArrayFns$1, makeMap, isSet, NO, toNumber, hyphenate, isReservedProp, EMPTY_ARR, toTypeString } from '@vue/shared';
export { camelize } from '@vue/shared';
import { injectHook as injectHook$1 } from 'vue';
......
import { Plugin } from 'vite'
// import { checkUpdate } from '@dcloudio/uni-cli-shared'
import { initPreContext /*,checkUpdate*/ } from '@dcloudio/uni-cli-shared'
import { VitePluginUniResolvedOptions } from '..'
import { initEnv } from './env'
......@@ -12,6 +12,7 @@ export function createConfigResolved(options: VitePluginUniResolvedOptions) {
initOptions(options, config)
initPlugins(config, options)
initCheckUpdate()
initPreContext(options.platform)
}) as Plugin['configResolved']
}
......
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册