提交 d45ec1ee 编写于 作者: D DCloud_LXH

chore: systemInfo

上级 5a65b4bd
......@@ -2,6 +2,7 @@ import { defineAsyncApi, defineSyncApi, getLocale } from '@dcloudio/uni-api'
import deviceId from '../../../helpers/uuid'
import { extend } from '@vue/shared'
import { getWindowInfo } from './getWindowInfo'
import { sortObject } from '@dcloudio/uni-shared'
let systemInfo: any
let _initSystemInfo = true
......@@ -29,16 +30,16 @@ export const getDeviceInfo = defineSyncApi<typeof uni.getDeviceInfo>(
const _osName = osName.toLowerCase()
return {
brand,
deviceBrand: brand,
deviceModel,
devicePixelRatio: plus.screen.scale!,
deviceId: deviceId(),
deviceOrientation,
deviceType,
brand,
model: deviceModel,
system: `${_osName === 'ios' ? 'iOS' : 'Android'} ${osVersion}`,
platform: _osName,
system: `${_osName === 'ios' ? 'iOS' : 'Android'} ${osVersion}`,
}
}
)
......@@ -61,23 +62,23 @@ export const getAppBaseInfo = defineSyncApi<typeof uni.getAppBaseInfo>(
} = systemInfo
return {
SDKVersion: '',
hostSDKVersion: '',
enableDebug: false,
appId,
appName,
appVersion,
appVersionCode,
appLanguage: getLocale ? getLocale() : osLanguage,
version: plus.runtime.innerVersion!,
language: osLanguage,
theme: '',
enableDebug: false,
hostPackageName,
hostName,
hostVersion,
hostLanguage,
hostTheme,
hostFontSizeSetting: undefined,
hostSDKVersion: undefined,
language: osLanguage,
SDKVersion: '',
theme: undefined,
version: plus.runtime.innerVersion!,
}
}
)
......@@ -93,26 +94,14 @@ export const getSystemInfoSync = defineSyncApi<typeof uni.getSystemInfoSync>(
const appBaseInfo = getAppBaseInfo()
_initSystemInfo = true
const { osName, osLanguage, osVersion } = systemInfo
const _osName = osName.toLowerCase()
const osLanguageSplit = osLanguage.split('-')
const osLanguageSplitLast = osLanguageSplit[osLanguageSplit.length - 1]
let _osLanguage = `${osLanguageSplit[0]}${
osLanguageSplitLast ? '-' + osLanguageSplitLast : ''
}`
let extraData = {
const extraData = {
errMsg: 'getSystemInfo:ok',
fontSizeSetting: appBaseInfo.hostFontSizeSetting,
uniCompileVersion: __uniConfig.compilerVersion,
uniRuntimeVersion: __uniConfig.compilerVersion,
osLanguage: _osLanguage,
osName: _osName,
osName: systemInfo.osName.toLowerCase(),
}
if (_osName === 'ios') {
;(extraData as any).romName = _osName
;(extraData as any).romVersion = osVersion
if (systemInfo.hostName) {
;(extraData as any).hostSDKVersion = systemInfo.uniRuntimeVersion
}
const _systemInfo: UniApp.GetSystemInfoResult = extend(
......@@ -127,7 +116,7 @@ export const getSystemInfoSync = defineSyncApi<typeof uni.getSystemInfoSync>(
delete (_systemInfo as any).enableDebug
delete (_systemInfo as any).theme
return _systemInfo
return sortObject(_systemInfo)
}
)
......
......@@ -5030,9 +5030,9 @@ function decodeEntities(htmlString) {
if (/^#x[0-9a-f]{1,4}$/i.test(stage)) {
return String.fromCharCode("0" + stage.slice(1));
}
const wrap = document.createElement("div");
wrap.innerHTML = match;
return wrap.innerText || wrap.textContent;
{
return match;
}
});
}
function normlizeValue(tagName, name, value) {
......@@ -5197,6 +5197,50 @@ const props$g = {
}
}
};
function getSSRDataType() {
return vue.getCurrentInstance() ? uniShared.UNI_SSR_DATA : uniShared.UNI_SSR_GLOBAL_DATA;
}
function assertKey(key, shallow = false) {
if (!key) {
throw new Error(`${shallow ? "shallowSsrRef" : "ssrRef"}: You must provide a key.`);
}
}
const ssrClientRef = (value, key, shallow = false) => {
const valRef = shallow ? vue.shallowRef(value) : vue.ref(value);
if (typeof window === "undefined") {
return valRef;
}
const __uniSSR = window[uniShared.UNI_SSR];
if (!__uniSSR) {
return valRef;
}
const type = getSSRDataType();
assertKey(key, shallow);
if (shared.hasOwn(__uniSSR[type], key)) {
valRef.value = __uniSSR[type][key];
if (type === uniShared.UNI_SSR_DATA) {
delete __uniSSR[type][key];
}
}
return valRef;
};
const ssrRef = (value, key) => {
return ssrClientRef(value, key);
};
function _createVNode(nodeList) {
if (!nodeList)
return [];
return nodeList.map((node) => {
if (node.name) {
const tagName = node.name.toLowerCase();
if (!shared.hasOwn(TAGS, tagName)) {
return;
}
}
const isNode = !shared.hasOwn(node, "type") || node.type === "node";
return vue.h(isNode ? node.name : "span", node.attrs, isNode ? _createVNode(node.children) : decodeEntities(node.text));
});
}
var index$p = /* @__PURE__ */ defineBuiltInComponent({
name: "RichText",
compatConfig: {
......@@ -5209,28 +5253,33 @@ var index$p = /* @__PURE__ */ defineBuiltInComponent({
attrs
}) {
const vm = vue.getCurrentInstance();
const scopeId = vm && vm.vnode.scopeId || "";
const rootRef = vue.ref(null);
const nodelist = ssrRef(props2.nodes, "nodelist");
const trigger = useCustomEvent(rootRef, emit2);
const hasItemClick = !!attrs.onItemclick;
function triggerItemClick(e2, detail = {}) {
trigger("itemclick", e2, detail);
}
{
if (typeof props2.nodes === "string") {
nodelist.value = parseHtml(props2.nodes);
}
}
function _renderNodes(nodes) {
if (typeof nodes === "string") {
nodes = parseHtml(nodes);
nodelist.value = parseHtml(nodes);
}
const nodeList = parseNodes(nodes, document.createDocumentFragment(), vm && vm.vnode.scopeId || "", hasItemClick && triggerItemClick);
const nodeList = parseNodes(nodelist.value, document.createDocumentFragment(), scopeId, hasItemClick && triggerItemClick);
rootRef.value.firstElementChild.innerHTML = "";
rootRef.value.firstElementChild.appendChild(nodeList);
}
vue.watch(() => props2.nodes, (value) => {
_renderNodes(value);
});
return () => {
return vue.createVNode("uni-rich-text", {
"ref": rootRef
}, [vue.createVNode("div", null, null)], 512);
};
return () => vue.h("uni-rich-text", {
ref: rootRef
}, [vue.h("div", {}, _createVNode(nodelist.value))]);
}
});
const props$f = {
......@@ -10050,39 +10099,39 @@ const getDeviceInfo = /* @__PURE__ */ defineSyncApi("getDeviceInfo", () => {
deviceType
} = browserInfo;
return {
brand,
deviceBrand,
deviceModel,
devicePixelRatio: 1,
deviceId: Date.now() + "" + Math.floor(Math.random() * 1e7),
deviceOrientation,
deviceType,
brand,
model,
system,
platform
platform,
system
};
});
const getAppBaseInfo = /* @__PURE__ */ defineSyncApi("getAppBaseInfo", () => {
initBrowserInfo();
const { theme, browserName, browseVersion, language } = browserInfo;
const { theme, language } = browserInfo;
return {
SDKVersion: "",
hostSDKVersion: "",
enableDebug: false,
hostPackageName: "",
hostFontSizeSetting: void 0,
language,
hostName: browserName,
hostVersion: browseVersion,
hostTheme: theme,
hostLanguage: language,
theme,
appId: __uniConfig.appId,
appName: __uniConfig.appName,
appVersion: __uniConfig.appVersion,
appVersionCode: __uniConfig.appVersionCode,
appLanguage: getLocale ? getLocale() : language,
version: __uniConfig.appVersion
enableDebug: false,
hostSDKVersion: void 0,
hostPackageName: void 0,
hostFontSizeSetting: void 0,
hostName: void 0,
hostVersion: void 0,
hostTheme: void 0,
hostLanguage: void 0,
language,
SDKVersion: "",
theme,
version: ""
};
});
const getSystemInfoSync = /* @__PURE__ */ defineSyncApi("getSystemInfoSync", () => {
......
import { withModifiers, createVNode, getCurrentInstance, ref, defineComponent, openBlock, createElementBlock, provide, computed, watch, onUnmounted, inject, onBeforeUnmount, mergeProps, injectHook, reactive, onActivated, onMounted, nextTick, onBeforeMount, withDirectives, vShow, shallowRef, watchEffect, isVNode, Fragment, markRaw, Comment, createTextVNode, onBeforeActivate, onBeforeDeactivate, createBlock, renderList, onDeactivated, createApp, Transition, effectScope, withCtx, KeepAlive, resolveDynamicComponent, createElementVNode, normalizeStyle, renderSlot } from "vue";
import { withModifiers, createVNode, getCurrentInstance, ref, defineComponent, openBlock, createElementBlock, provide, computed, watch, onUnmounted, inject, onBeforeUnmount, mergeProps, injectHook, reactive, onActivated, onMounted, nextTick, onBeforeMount, withDirectives, vShow, shallowRef, watchEffect, isVNode, Fragment, markRaw, Comment, h, createTextVNode, onBeforeActivate, onBeforeDeactivate, createBlock, renderList, onDeactivated, createApp, Transition, effectScope, withCtx, KeepAlive, resolveDynamicComponent, createElementVNode, normalizeStyle, renderSlot } from "vue";
import { isString, extend, isArray, remove, stringifyStyle, parseStringStyle, isPlainObject, isFunction, capitalize, camelize, hasOwn, isObject, toRawType, makeMap as makeMap$1, isPromise, hyphenate, invokeArrayFns as invokeArrayFns$1 } from "@vue/shared";
import { once, UNI_STORAGE_LOCALE, I18N_JSON_DELIMITERS, Emitter, passive, initCustomDatasetOnce, resolveComponentInstance, addLeadingSlash, invokeArrayFns, resolveOwnerVm, resolveOwnerEl, ON_WXS_INVOKE_CALL_METHOD, normalizeTarget, ON_RESIZE, ON_APP_ENTER_FOREGROUND, ON_APP_ENTER_BACKGROUND, ON_SHOW, ON_HIDE, ON_PAGE_SCROLL, ON_REACH_BOTTOM, EventChannel, SCHEME_RE, DATA_RE, getCustomDataset, LINEFEED, ON_ERROR, callOptions, ON_UNHANDLE_REJECTION, ON_PAGE_NOT_FOUND, PRIMARY_COLOR, removeLeadingSlash, getLen, debounce, ON_LOAD, UniLifecycleHooks, invokeCreateVueAppHook, NAVBAR_HEIGHT, parseQuery, ON_UNLOAD, ON_REACH_BOTTOM_DISTANCE, decodedQuery, WEB_INVOKE_APPSERVICE, ON_WEB_INVOKE_APP_SERVICE, updateElementStyle, ON_BACK_PRESS, parseUrl, addFont, scrollTo, RESPONSIVE_MIN_WIDTH, onCreateVueApp, formatDateTime, ON_NAVIGATION_BAR_BUTTON_TAP, ON_NAVIGATION_BAR_SEARCH_INPUT_CLICKED, ON_NAVIGATION_BAR_SEARCH_INPUT_FOCUS_CHANGED, ON_NAVIGATION_BAR_SEARCH_INPUT_CHANGED, ON_NAVIGATION_BAR_SEARCH_INPUT_CONFIRMED, ON_PULL_DOWN_REFRESH } from "@dcloudio/uni-shared";
import { once, UNI_STORAGE_LOCALE, I18N_JSON_DELIMITERS, Emitter, passive, initCustomDatasetOnce, resolveComponentInstance, addLeadingSlash, invokeArrayFns, resolveOwnerVm, resolveOwnerEl, ON_WXS_INVOKE_CALL_METHOD, normalizeTarget, ON_RESIZE, ON_APP_ENTER_FOREGROUND, ON_APP_ENTER_BACKGROUND, ON_SHOW, ON_HIDE, ON_PAGE_SCROLL, ON_REACH_BOTTOM, EventChannel, SCHEME_RE, DATA_RE, getCustomDataset, LINEFEED, ON_ERROR, callOptions, ON_UNHANDLE_REJECTION, ON_PAGE_NOT_FOUND, PRIMARY_COLOR, removeLeadingSlash, getLen, debounce, UNI_SSR_DATA, UNI_SSR_GLOBAL_DATA, UNI_SSR, ON_LOAD, UniLifecycleHooks, invokeCreateVueAppHook, NAVBAR_HEIGHT, parseQuery, ON_UNLOAD, ON_REACH_BOTTOM_DISTANCE, decodedQuery, WEB_INVOKE_APPSERVICE, ON_WEB_INVOKE_APP_SERVICE, updateElementStyle, sortObject, ON_BACK_PRESS, parseUrl, addFont, scrollTo, RESPONSIVE_MIN_WIDTH, onCreateVueApp, formatDateTime, ON_NAVIGATION_BAR_BUTTON_TAP, ON_NAVIGATION_BAR_SEARCH_INPUT_CLICKED, ON_NAVIGATION_BAR_SEARCH_INPUT_FOCUS_CHANGED, ON_NAVIGATION_BAR_SEARCH_INPUT_CHANGED, ON_NAVIGATION_BAR_SEARCH_INPUT_CONFIRMED, ON_PULL_DOWN_REFRESH } from "@dcloudio/uni-shared";
export { onCreateVueApp } from "@dcloudio/uni-shared";
import { initVueI18n, isI18nStr, LOCALE_EN, LOCALE_ES, LOCALE_FR, LOCALE_ZH_HANS, LOCALE_ZH_HANT } from "@dcloudio/uni-i18n";
import { useRoute, createRouter, createWebHistory, createWebHashHistory, useRouter, isNavigationFailure, RouterView } from "vue-router";
......@@ -9325,7 +9325,7 @@ Spring$1.prototype._solve = function(e2, t2) {
const c = (-n - Math.sqrt(o2)) / (2 * i);
const u = (-n + Math.sqrt(o2)) / (2 * i);
const d = (t2 - c * e2) / (u - c);
const h = e2 - d;
const h2 = e2 - d;
return {
x: function(e3) {
let t3;
......@@ -9341,7 +9341,7 @@ Spring$1.prototype._solve = function(e2, t2) {
if (!n2) {
n2 = this._powER2T = Math.pow(Math.E, u * e3);
}
return h * t3 + d * n2;
return h2 * t3 + d * n2;
},
dx: function(e3) {
let t3;
......@@ -9357,7 +9357,7 @@ Spring$1.prototype._solve = function(e2, t2) {
if (!n2) {
n2 = this._powER2T = Math.pow(Math.E, u * e3);
}
return h * c * t3 + d * u * n2;
return h2 * c * t3 + d * u * n2;
}
};
}
......@@ -11717,9 +11717,11 @@ function decodeEntities(htmlString) {
if (/^#x[0-9a-f]{1,4}$/i.test(stage)) {
return String.fromCharCode("0" + stage.slice(1));
}
const wrap = document.createElement("div");
wrap.innerHTML = match;
return wrap.innerText || wrap.textContent;
{
const wrap = document.createElement("div");
wrap.innerHTML = match;
return wrap.innerText || wrap.textContent;
}
});
}
function normlizeValue(tagName, name, value) {
......@@ -11884,6 +11886,36 @@ const props$n = {
}
}
};
function getSSRDataType() {
return getCurrentInstance() ? UNI_SSR_DATA : UNI_SSR_GLOBAL_DATA;
}
function assertKey(key, shallow = false) {
if (!key) {
throw new Error(`${shallow ? "shallowSsrRef" : "ssrRef"}: You must provide a key.`);
}
}
const ssrClientRef = (value, key, shallow = false) => {
const valRef = shallow ? shallowRef(value) : ref(value);
if (typeof window === "undefined") {
return valRef;
}
const __uniSSR = window[UNI_SSR];
if (!__uniSSR) {
return valRef;
}
const type = getSSRDataType();
assertKey(key, shallow);
if (hasOwn(__uniSSR[type], key)) {
valRef.value = __uniSSR[type][key];
if (type === UNI_SSR_DATA) {
delete __uniSSR[type][key];
}
}
return valRef;
};
const ssrRef = (value, key) => {
return ssrClientRef(value, key);
};
var index$m = /* @__PURE__ */ defineBuiltInComponent({
name: "RichText",
compatConfig: {
......@@ -11896,7 +11928,9 @@ var index$m = /* @__PURE__ */ defineBuiltInComponent({
attrs: attrs2
}) {
const vm = getCurrentInstance();
const scopeId = vm && vm.vnode.scopeId || "";
const rootRef = ref(null);
const nodelist = ssrRef(props2.nodes, "nodelist");
const trigger = useCustomEvent(rootRef, emit2);
const hasItemClick = !!attrs2.onItemclick;
function triggerItemClick(e2, detail = {}) {
......@@ -11904,9 +11938,9 @@ var index$m = /* @__PURE__ */ defineBuiltInComponent({
}
function _renderNodes(nodes) {
if (typeof nodes === "string") {
nodes = parseHtml(nodes);
nodelist.value = parseHtml(nodes);
}
const nodeList = parseNodes(nodes, document.createDocumentFragment(), vm && vm.vnode.scopeId || "", hasItemClick && triggerItemClick);
const nodeList = parseNodes(nodelist.value, document.createDocumentFragment(), scopeId, hasItemClick && triggerItemClick);
rootRef.value.firstElementChild.innerHTML = "";
rootRef.value.firstElementChild.appendChild(nodeList);
}
......@@ -11914,13 +11948,11 @@ var index$m = /* @__PURE__ */ defineBuiltInComponent({
_renderNodes(value);
});
onMounted(() => {
_renderNodes(props2.nodes);
_renderNodes(nodelist.value);
});
return () => {
return createVNode("uni-rich-text", {
"ref": rootRef
}, [createVNode("div", null, null)], 512);
};
return () => h("uni-rich-text", {
ref: rootRef
}, [h("div", {}, [])]);
}
});
const passiveOptions = /* @__PURE__ */ passive(true);
......@@ -12742,9 +12774,9 @@ function useLayout(props2, state2, swiperContexts, slideFrameRef, emit2, trigger
const c = s - n;
const u = Math.max(index2 - (s + 1), s - i, 0);
const d = Math.max(index2 - (l + 1), l - i, 0);
const h = Math.max(index2 - (c + 1), c - i, 0);
const p2 = Math.min(u, d, h);
const position = [s, l, c][[u, d, h].indexOf(p2)];
const h2 = Math.max(index2 - (c + 1), c - i, 0);
const p2 = Math.min(u, d, h2);
const position = [s, l, c][[u, d, h2].indexOf(p2)];
item.updatePosition(position, props2.vertical);
}
}
......@@ -14395,10 +14427,10 @@ function onVisibilityChange() {
}
function formatTime(val) {
val = val > 0 && val < Infinity ? val : 0;
const h = Math.floor(val / 3600);
const h2 = Math.floor(val / 3600);
const m = Math.floor(val % 3600 / 60);
const s = Math.floor(val % 3600 % 60);
const hStr = (h < 10 ? "0" : "") + h;
const hStr = (h2 < 10 ? "0" : "") + h2;
const mStr = (m < 10 ? "0" : "") + m;
const sStr = (s < 10 ? "0" : "") + s;
let str = mStr + ":" + sStr;
......@@ -15615,25 +15647,25 @@ var MapMarker = /* @__PURE__ */ defineSystemComponent({
const anchor = option.anchor || {};
let icon;
let w;
let h;
let h2;
let top;
let x = typeof anchor.x === "number" ? anchor.x : 0.5;
let y = typeof anchor.y === "number" ? anchor.y : 1;
if (option.iconPath && (option.width || option.height)) {
w = option.width || img.width / img.height * option.height;
h = option.height || img.height / img.width * option.width;
h2 = option.height || img.height / img.width * option.width;
} else {
w = img.width / 2;
h = img.height / 2;
h2 = img.height / 2;
}
top = h - (h - y * h);
top = h2 - (h2 - y * h2);
if ("MarkerImage" in maps2) {
icon = new maps2.MarkerImage(img.src, null, null, new maps2.Point(x * w, y * h), new maps2.Size(w, h));
icon = new maps2.MarkerImage(img.src, null, null, new maps2.Point(x * w, y * h2), new maps2.Size(w, h2));
} else {
icon = {
url: img.src,
anchor: new maps2.Point(x, y),
size: new maps2.Size(w, h)
size: new maps2.Size(w, h2)
};
}
marker.setPosition(position);
......@@ -16319,14 +16351,6 @@ function IEVersion() {
return -1;
}
}
function getDeviceBrand(model) {
if (/iphone/gi.test(model) || /ipad/gi.test(model) || /mac/gi.test(model)) {
return "apple";
}
if (/windows/gi.test(model)) {
return "microsoft";
}
}
function getBrowserInfo() {
let osname;
let osversion = "0";
......@@ -16440,13 +16464,13 @@ function getBrowserInfo() {
} else {
osname = "Other";
osversion = "0";
deviceType = "other";
deviceType = "unknown";
}
const system = `${osname} ${osversion}`;
const platform = osname.toLocaleLowerCase();
let browserName = "";
let browseVersion = String(IEVersion());
if (browseVersion !== "-1") {
let browserVersion = String(IEVersion());
if (browserVersion !== "-1") {
browserName = "IE";
} else {
const browseVendors = ["Version", "Firefox", "Chrome", "Edge{0,1}"];
......@@ -16456,34 +16480,29 @@ function getBrowserInfo() {
const reg = new RegExp(`(${vendor})/(\\S*)\\b`);
if (reg.test(ua)) {
browserName = vendors[index2];
browseVersion = ua.match(reg)[2];
browserVersion = ua.match(reg)[2];
}
}
}
let deviceBrand = "";
if (model) {
const _model = model.toLocaleLowerCase();
deviceBrand = getDeviceBrand(_model) || getDeviceBrand(osname.toLocaleLowerCase()) || _model.split(" ")[0];
}
let deviceOrientation = "portrait";
const orientation = typeof window.screen.orientation === "undefined" ? window.orientation : window.screen.orientation.angle;
deviceOrientation = Math.abs(orientation) === 90 ? "landscape" : "portrait";
return {
deviceBrand,
deviceBrand: void 0,
brand: void 0,
deviceModel: model,
deviceOrientation,
brand: deviceBrand,
model,
system,
platform,
browserName: browserName.toLocaleLowerCase(),
browseVersion,
browserVersion,
language,
deviceType,
ua,
osname,
osversion,
theme: ""
theme: void 0
};
}
const getWindowInfo = /* @__PURE__ */ defineSyncApi("getWindowInfo", () => {
......@@ -16545,39 +16564,39 @@ const getDeviceInfo = /* @__PURE__ */ defineSyncApi("getDeviceInfo", () => {
deviceType
} = browserInfo;
return {
brand,
deviceBrand,
deviceModel,
devicePixelRatio: window.devicePixelRatio,
deviceId: deviceId$1(),
deviceOrientation,
deviceType,
brand,
model,
system,
platform
platform,
system
};
});
const getAppBaseInfo = /* @__PURE__ */ defineSyncApi("getAppBaseInfo", () => {
initBrowserInfo();
const { theme, browserName, browseVersion, language } = browserInfo;
const { theme, language } = browserInfo;
return {
SDKVersion: "",
hostSDKVersion: "",
enableDebug: false,
hostPackageName: "",
hostFontSizeSetting: void 0,
language,
hostName: browserName,
hostVersion: browseVersion,
hostTheme: theme,
hostLanguage: language,
theme,
appId: __uniConfig.appId,
appName: __uniConfig.appName,
appVersion: __uniConfig.appVersion,
appVersionCode: __uniConfig.appVersionCode,
appLanguage: getLocale ? getLocale() : language,
version: __uniConfig.appVersion
enableDebug: false,
hostSDKVersion: void 0,
hostPackageName: void 0,
hostFontSizeSetting: void 0,
hostName: void 0,
hostVersion: void 0,
hostTheme: void 0,
hostLanguage: void 0,
language,
SDKVersion: "",
theme,
version: ""
};
});
const getSystemInfoSync = /* @__PURE__ */ defineSyncApi("getSystemInfoSync", () => {
......@@ -16588,15 +16607,15 @@ const getSystemInfoSync = /* @__PURE__ */ defineSyncApi("getSystemInfoSync", ()
const deviceInfo = getDeviceInfo();
const appBaseInfo = getAppBaseInfo();
_initBrowserInfo = true;
const { ua: ua2, browserName, browseVersion, osname, osversion } = browserInfo;
const { ua: ua2, browserName, browserVersion, osname, osversion } = browserInfo;
const systemInfo = extend(windowInfo, deviceInfo, appBaseInfo, {
ua: ua2,
browserName,
browseVersion,
browserVersion,
uniPlatform: "web",
uniCompileVersion: __uniConfig.compilerVersion,
uniRuntimeVersion: __uniConfig.compilerVersion,
fontSizeSetting: appBaseInfo.hostFontSizeSetting,
fontSizeSetting: void 0,
osName: osname.toLocaleLowerCase(),
osVersion: osversion,
osLanguage: void 0,
......@@ -16605,7 +16624,7 @@ const getSystemInfoSync = /* @__PURE__ */ defineSyncApi("getSystemInfoSync", ()
delete systemInfo.screenTop;
delete systemInfo.enableDebug;
delete systemInfo.theme;
return systemInfo;
return sortObject(systemInfo);
});
const getSystemInfo = /* @__PURE__ */ defineAsyncApi("getSystemInfo", (_args, { resolve }) => {
return resolve(getSystemInfoSync());
......
......@@ -33,15 +33,6 @@ function IEVersion() {
}
}
function getDeviceBrand(model: string) {
if (/iphone/gi.test(model) || /ipad/gi.test(model) || /mac/gi.test(model)) {
return 'apple'
}
if (/windows/gi.test(model)) {
return 'microsoft'
}
}
export function getBrowserInfo() {
let osname
let osversion = '0'
......@@ -167,15 +158,15 @@ export function getBrowserInfo() {
} else {
osname = 'Other'
osversion = '0'
deviceType = 'other'
deviceType = 'unknown'
}
const system = `${osname} ${osversion}`
const platform = osname.toLocaleLowerCase()
let browserName = ''
let browseVersion = String(IEVersion())
if (browseVersion !== '-1') {
let browserVersion = String(IEVersion())
if (browserVersion !== '-1') {
browserName = 'IE'
} else {
const browseVendors = ['Version', 'Firefox', 'Chrome', 'Edge{0,1}']
......@@ -185,21 +176,11 @@ export function getBrowserInfo() {
const reg = new RegExp(`(${vendor})/(\\S*)\\b`)
if (reg.test(ua)) {
browserName = vendors[index]
browseVersion = ua.match(reg)![2]
browserVersion = ua.match(reg)![2]
}
}
}
// deviceBrand
let deviceBrand = ''
if (model) {
const _model = model.toLocaleLowerCase()
deviceBrand =
getDeviceBrand(_model) ||
getDeviceBrand(osname.toLocaleLowerCase()) ||
_model.split(' ')[0]
}
// deviceOrientation
let deviceOrientation: 'portrait' | 'landscape' = 'portrait'
const orientation =
......@@ -207,22 +188,22 @@ export function getBrowserInfo() {
? window.orientation
: window.screen.orientation.angle
deviceOrientation = Math.abs(orientation) === 90 ? 'landscape' : 'portrait'
//TODO deviceBrand brand 要是 undeinfed
return {
deviceBrand,
deviceBrand: undefined,
brand: undefined,
deviceModel: model,
deviceOrientation,
brand: deviceBrand,
model,
system,
platform,
browserName: browserName.toLocaleLowerCase(),
browseVersion,
browserVersion,
language,
deviceType,
ua,
osname,
osversion,
theme: '',
theme: undefined,
}
}
......@@ -3,6 +3,7 @@ import deviceId from '../../../helpers/uuid'
import { getBrowserInfo } from '../base/getBrowserInfo'
import { getWindowInfo } from './getWindowInfo'
import { extend } from '@vue/shared'
import { sortObject } from '@dcloudio/uni-shared'
type BrowserInfo = ReturnType<typeof getBrowserInfo>
......@@ -33,6 +34,7 @@ export const getDeviceInfo = defineSyncApi<typeof uni.getDeviceInfo>(
} = browserInfo
return {
brand,
deviceBrand,
deviceModel,
devicePixelRatio: __NODE_JS__ ? 1 : window.devicePixelRatio,
......@@ -41,10 +43,9 @@ export const getDeviceInfo = defineSyncApi<typeof uni.getDeviceInfo>(
: deviceId(),
deviceOrientation,
deviceType,
brand,
model,
system,
platform,
system,
}
}
)
......@@ -52,26 +53,26 @@ export const getAppBaseInfo = defineSyncApi<typeof uni.getAppBaseInfo>(
'getAppBaseInfo',
() => {
initBrowserInfo()
const { theme, browserName, browseVersion, language } = browserInfo
const { theme, language } = browserInfo
return {
SDKVersion: '',
hostSDKVersion: '',
enableDebug: false,
hostPackageName: '',
hostFontSizeSetting: undefined,
language,
hostName: browserName,
hostVersion: browseVersion,
hostTheme: theme,
hostLanguage: language,
theme,
appId: __uniConfig.appId,
appName: __uniConfig.appName,
appVersion: __uniConfig.appVersion,
appVersionCode: __uniConfig.appVersionCode,
appLanguage: getLocale ? getLocale() : language,
version: __uniConfig.appVersion,
enableDebug: false,
hostSDKVersion: undefined,
hostPackageName: undefined,
hostFontSizeSetting: undefined,
hostName: undefined,
hostVersion: undefined,
hostTheme: undefined,
hostLanguage: undefined,
language,
SDKVersion: '',
theme,
version: '',
}
}
)
......@@ -98,7 +99,7 @@ export const getSystemInfoSync = defineSyncApi<typeof uni.getSystemInfoSync>(
const appBaseInfo = getAppBaseInfo()
_initBrowserInfo = true
const { ua, browserName, browseVersion, osname, osversion } = browserInfo
const { ua, browserName, browserVersion, osname, osversion } = browserInfo
const systemInfo: UniApp.GetSystemInfoResult = extend(
windowInfo,
......@@ -107,11 +108,11 @@ export const getSystemInfoSync = defineSyncApi<typeof uni.getSystemInfoSync>(
{
ua,
browserName,
browseVersion,
browserVersion,
uniPlatform: 'web',
uniCompileVersion: __uniConfig.compilerVersion,
uniRuntimeVersion: __uniConfig.compilerVersion,
fontSizeSetting: appBaseInfo.hostFontSizeSetting,
fontSizeSetting: undefined,
osName: osname!.toLocaleLowerCase(),
osVersion: osversion,
osLanguage: undefined,
......@@ -123,6 +124,6 @@ export const getSystemInfoSync = defineSyncApi<typeof uni.getSystemInfoSync>(
delete (systemInfo as any).enableDebug
delete (systemInfo as any).theme
return systemInfo
return sortObject(systemInfo)
}
)
import { extend } from '@vue/shared'
function _getDeviceBrand(model: string) {
if (/iphone/gi.test(model) || /ipad/gi.test(model) || /mac/gi.test(model)) {
return 'apple'
}
if (/windows/gi.test(model)) {
return 'microsoft'
}
return ''
}
import { getLocale } from '../locale'
const UUID_KEY = '__DC_STAT_UUID'
let deviceId: string
......@@ -55,15 +46,13 @@ export function populateParameters(
language = '',
theme,
version,
hostName,
platform,
fontSizeSetting,
SDKVersion,
pixelRatio,
deviceOrientation,
environment,
} = fromRes
const isQuickApp = __PLATFORM__.indexOf('quickapp-webview') !== -1
// const isQuickApp = __PLATFORM__.indexOf('quickapp-webview') !== -1
// osName osVersion
let osName = ''
......@@ -88,27 +77,10 @@ export function populateParameters(
let deviceType = getGetDeviceType(fromRes, model)
// deviceModel
let deviceBrand = getDeviceBrand(brand, model, isQuickApp)
let deviceBrand = getDeviceBrand(brand)
// hostName
const _platform =
__PLATFORM__ === 'mp-weixin' ? 'WeChat' : __PLATFORM__.split('-')[1]
let _hostName = hostName || _platform // mp-jd
if (__PLATFORM__ === 'mp-weixin') {
if (environment) {
_hostName = environment
} else if (fromRes.host && fromRes.host.env) {
_hostName = fromRes.host.env
}
}
if (__PLATFORM__ === 'mp-baidu' || __PLATFORM__ === 'mp-kuaishou') {
_hostName = fromRes.host
}
if (__PLATFORM__ === 'mp-qq') _hostName = fromRes.AppPlatform
if (__PLATFORM__ === 'mp-toutiao' || __PLATFORM__ === 'mp-lark') {
_hostName = fromRes.appName
}
if (__PLATFORM__ === 'mp-alipay') _hostName = fromRes.app
let _hostName = getHostName(fromRes)
// deviceOrientation
let _deviceOrientation = deviceOrientation // 仅 微信 百度 支持
......@@ -128,6 +100,9 @@ export function populateParameters(
_SDKVersion = my.SDKVersion
}
// hostLanguage
const hostLanguage = language.replace(/_/g, '-')
// wx.getAccountInfoSync
const parameters = {
......@@ -135,6 +110,7 @@ export function populateParameters(
appName: process.env.UNI_APP_NAME,
appVersion: process.env.UNI_APP_VERSION_NAME,
appVersionCode: process.env.UNI_APP_VERSION_CODE,
appLanguage: getAppLanguage(hostLanguage),
uniCompileVersion: process.env.UNI_COMPILER_VERSION,
uniRuntimeVersion: process.env.UNI_COMPILER_VERSION,
uniPlatform: process.env.UNI_SUB_PLATFORM || process.env.UNI_PLATFORM,
......@@ -147,7 +123,7 @@ export function populateParameters(
osVersion,
hostTheme: theme,
hostVersion,
hostLanguage: language.replace('_', '-'),
hostLanguage,
hostName: _hostName,
hostSDKVersion: _SDKVersion,
hostFontSizeSetting: fontSizeSetting,
......@@ -159,7 +135,7 @@ export function populateParameters(
ua: undefined,
hostPackageName: undefined,
browserName: undefined,
browseVersion: undefined,
browserVersion: undefined,
}
extend(toRes, parameters)
......@@ -190,21 +166,38 @@ export function getGetDeviceType(fromRes: any, model: string) {
return deviceType
}
export function getDeviceBrand(
brand: string,
model: string,
isQuickApp: boolean = false
) {
export function getDeviceBrand(brand: string) {
// deviceModel
let deviceBrand = model.split(' ')[0].toLocaleLowerCase()
if (
__PLATFORM__ === 'mp-toutiao' ||
__PLATFORM__ === 'mp-lark' ||
isQuickApp
) {
deviceBrand = brand.toLocaleLowerCase()
} else {
deviceBrand = _getDeviceBrand(deviceBrand)
let deviceBrand = brand
if (deviceBrand) {
deviceBrand = deviceBrand.toLocaleLowerCase()
}
return deviceBrand
}
export function getAppLanguage(defaultLanguage: string) {
return getLocale ? getLocale() : defaultLanguage
}
export function getHostName(fromRes: any) {
const _platform =
__PLATFORM__ === 'mp-weixin' ? 'WeChat' : __PLATFORM__.split('-')[1]
let _hostName = fromRes.hostName || _platform // mp-jd
if (__PLATFORM__ === 'mp-weixin') {
if (fromRes.environment) {
_hostName = fromRes.environment
} else if (fromRes.host && fromRes.host.env) {
_hostName = fromRes.host.env
}
}
if (__PLATFORM__ === 'mp-baidu' || __PLATFORM__ === 'mp-kuaishou') {
_hostName = fromRes.host
}
if (__PLATFORM__ === 'mp-qq') _hostName = fromRes.AppPlatform
if (__PLATFORM__ === 'mp-toutiao' || __PLATFORM__ === 'mp-lark') {
_hostName = fromRes.appName
}
if (__PLATFORM__ === 'mp-alipay') _hostName = fromRes.app
return _hostName
}
import { MPProtocol } from './types'
import { extend } from '@vue/shared'
import { getHostName, getAppLanguage } from './enhanceSystemInfo'
import { sortObject } from '@dcloudio/uni-shared'
export const getAppBaseInfo: MPProtocol = {
returnValue: (fromRes, toRes) => {
const { version, language, SDKVersion, theme } = fromRes
let _hostName = __PLATFORM__.split('-')[1] // mp-jd
if (__PLATFORM__ === 'mp-weixin') {
if (fromRes.host && fromRes.host.env) {
_hostName = fromRes.host.env
}
}
let _hostName = getHostName(fromRes)
let hostLanguage = language.replace(/_/g, '-')
extend(toRes, {
hostVersion: version,
hostLanguage: language.replace('_', '-'),
hostName: _hostName,
hostSDKVersion: SDKVersion,
hostTheme: theme,
appId: process.env.UNI_APP_ID,
appName: process.env.UNI_APP_NAME,
appVersion: process.env.UNI_APP_VERSION_NAME,
appVersionCode: process.env.UNI_APP_VERSION_CODE,
})
toRes = sortObject(
extend(toRes, {
hostVersion: version,
hostLanguage,
hostName: _hostName,
hostSDKVersion: SDKVersion,
hostTheme: theme,
appId: process.env.UNI_APP_ID,
appName: process.env.UNI_APP_NAME,
appVersion: process.env.UNI_APP_VERSION_NAME,
appVersionCode: process.env.UNI_APP_VERSION_CODE,
appLanguage: getAppLanguage(hostLanguage),
})
)
},
}
......@@ -5,18 +5,21 @@ import {
useDeviceId,
} from './enhanceSystemInfo'
import { extend } from '@vue/shared'
import { sortObject } from '@dcloudio/uni-shared'
export const getDeviceInfo: MPProtocol = {
returnValue: (fromRes, toRes) => {
const { brand, model } = fromRes
let deviceType = getGetDeviceType(fromRes, model)
let deviceBrand = getDeviceBrand(brand, model)
let deviceBrand = getDeviceBrand(brand)
useDeviceId()(fromRes, toRes)
extend(toRes, {
deviceType,
deviceBrand,
deviceModel: model,
})
toRes = sortObject(
extend(toRes, {
deviceType,
deviceBrand,
deviceModel: model,
})
)
},
}
import { MPProtocol } from './types'
import { extend } from '@vue/shared'
import { addSafeAreaInsets } from './enhanceSystemInfo'
import { sortObject } from '@dcloudio/uni-shared'
export const getWindowInfo: MPProtocol = {
returnValue: (fromRes, toRes) => {
addSafeAreaInsets(fromRes, toRes)
extend(toRes, {
windowTop: 0,
windowBottom: 0,
})
toRes = sortObject(
extend(toRes, {
windowTop: 0,
windowBottom: 0,
})
)
},
}
......@@ -406,6 +406,18 @@ function getValueByDataPath(obj, path) {
return obj[key];
}
return getValueByDataPath(obj[key], parts.slice(1).join('.'));
}
function sortObject(obj) {
let sortObj = {};
if (shared.isPlainObject(obj)) {
Object.keys(obj)
.sort()
.forEach((key) => {
const _key = key;
sortObj[_key] = obj[_key];
});
}
return !Object.keys(sortObj) ? obj : sortObj;
}
function formatKey(key) {
......@@ -1566,5 +1578,6 @@ exports.resolveOwnerEl = resolveOwnerEl;
exports.resolveOwnerVm = resolveOwnerVm;
exports.sanitise = sanitise;
exports.scrollTo = scrollTo;
exports.sortObject = sortObject;
exports.stringifyQuery = stringifyQuery;
exports.updateElementStyle = updateElementStyle;
......@@ -646,6 +646,8 @@ string | number
export declare const SLOT_DEFAULT_NAME = "d";
export declare function sortObject<T>(obj: T): T;
export declare function stringifyQuery(obj?: Record<string, any>, encodeStr?: typeof encodeURIComponent): string;
export declare const TABBAR_HEIGHT = 50;
......
import { isHTMLTag, isSVGTag, hyphenate, camelize, isString, extend, isPlainObject, isArray, toTypeString, toRawType, capitalize } from '@vue/shared';
import { isHTMLTag, isSVGTag, hyphenate, camelize, isString, isPlainObject, extend, isArray, toTypeString, toRawType, capitalize } from '@vue/shared';
const BUILT_IN_TAG_NAMES = [
'ad',
......@@ -402,6 +402,18 @@ function getValueByDataPath(obj, path) {
return obj[key];
}
return getValueByDataPath(obj[key], parts.slice(1).join('.'));
}
function sortObject(obj) {
let sortObj = {};
if (isPlainObject(obj)) {
Object.keys(obj)
.sort()
.forEach((key) => {
const _key = key;
sortObj[_key] = obj[_key];
});
}
return !Object.keys(sortObj) ? obj : sortObj;
}
function formatKey(key) {
......@@ -1406,4 +1418,4 @@ function getEnvLocale() {
return (lang && lang.replace(/[.:].*/, '')) || 'en';
}
export { ACTION_TYPE_ADD_EVENT, ACTION_TYPE_ADD_WXS_EVENT, ACTION_TYPE_CREATE, ACTION_TYPE_EVENT, ACTION_TYPE_INSERT, ACTION_TYPE_PAGE_CREATE, ACTION_TYPE_PAGE_CREATED, ACTION_TYPE_PAGE_SCROLL, ACTION_TYPE_REMOVE, ACTION_TYPE_REMOVE_ATTRIBUTE, ACTION_TYPE_REMOVE_EVENT, ACTION_TYPE_SET_ATTRIBUTE, ACTION_TYPE_SET_TEXT, ATTR_CHANGE_PREFIX, ATTR_CLASS, ATTR_INNER_HTML, ATTR_STYLE, ATTR_TEXT_CONTENT, ATTR_V_OWNER_ID, ATTR_V_RENDERJS, ATTR_V_SHOW, BACKGROUND_COLOR, BUILT_IN_TAGS, BUILT_IN_TAG_NAMES, COMPONENT_NAME_PREFIX, COMPONENT_PREFIX, COMPONENT_SELECTOR_PREFIX, DATA_RE, E$1 as Emitter, EventChannel, EventModifierFlags, I18N_JSON_DELIMITERS, JSON_PROTOCOL, LINEFEED, MINI_PROGRAM_PAGE_RUNTIME_HOOKS, NAVBAR_HEIGHT, NODE_TYPE_COMMENT, NODE_TYPE_ELEMENT, NODE_TYPE_PAGE, NODE_TYPE_TEXT, NVUE_BUILT_IN_TAGS, NVUE_U_BUILT_IN_TAGS, ON_ADD_TO_FAVORITES, ON_APP_ENTER_BACKGROUND, ON_APP_ENTER_FOREGROUND, ON_BACK_PRESS, ON_ERROR, ON_HIDE, ON_INIT, ON_KEYBOARD_HEIGHT_CHANGE, ON_LAUNCH, ON_LOAD, ON_NAVIGATION_BAR_BUTTON_TAP, ON_NAVIGATION_BAR_SEARCH_INPUT_CHANGED, ON_NAVIGATION_BAR_SEARCH_INPUT_CLICKED, ON_NAVIGATION_BAR_SEARCH_INPUT_CONFIRMED, ON_NAVIGATION_BAR_SEARCH_INPUT_FOCUS_CHANGED, ON_PAGE_NOT_FOUND, ON_PAGE_SCROLL, ON_PULL_DOWN_REFRESH, ON_REACH_BOTTOM, ON_REACH_BOTTOM_DISTANCE, ON_READY, ON_RESIZE, ON_SAVE_EXIT_STATE, ON_SHARE_APP_MESSAGE, ON_SHARE_TIMELINE, ON_SHOW, ON_TAB_ITEM_TAP, ON_THEME_CHANGE, ON_UNHANDLE_REJECTION, ON_UNLOAD, ON_WEB_INVOKE_APP_SERVICE, ON_WXS_INVOKE_CALL_METHOD, PLUS_RE, PRIMARY_COLOR, RENDERJS_MODULES, RESPONSIVE_MIN_WIDTH, SCHEME_RE, SELECTED_COLOR, SLOT_DEFAULT_NAME, TABBAR_HEIGHT, TAGS, UNI_SSR, UNI_SSR_DATA, UNI_SSR_GLOBAL_DATA, UNI_SSR_STORE, UNI_SSR_TITLE, UNI_STORAGE_LOCALE, UniBaseNode, UniCommentNode, UniElement, UniEvent, UniInputElement, UniLifecycleHooks, UniNode, UniTextAreaElement, UniTextNode, WEB_INVOKE_APPSERVICE, WXS_MODULES, WXS_PROTOCOL, addFont, addLeadingSlash, cache, cacheStringFunction, callOptions, createIsCustomElement, createRpx2Unit, createUniEvent, customizeEvent, debounce, decode, decodedQuery, defaultMiniProgramRpx2Unit, defaultNVueRpx2Unit, defaultRpx2Unit, dynamicSlotName, forcePatchProp, formatAppLog, formatDateTime, formatH5Log, formatLog, getCustomDataset, getEnvLocale, getLen, getValueByDataPath, initCustomDatasetOnce, invokeArrayFns, invokeCreateVueAppHook, isAppNVueNativeTag, isAppNativeTag, isBuiltInComponent, isComponentInternalInstance, isComponentTag, isH5CustomElement, isH5NativeTag, isMiniProgramNativeTag, isRootHook, isRootImmediateHook, normalizeDataset, normalizeEventType, normalizeTarget, onCreateVueApp, once, parseEventName, parseNVueDataset, parseQuery, parseUrl, passive, plusReady, removeLeadingSlash, resolveComponentInstance, resolveOwnerEl, resolveOwnerVm, sanitise, scrollTo, stringifyQuery, updateElementStyle };
export { ACTION_TYPE_ADD_EVENT, ACTION_TYPE_ADD_WXS_EVENT, ACTION_TYPE_CREATE, ACTION_TYPE_EVENT, ACTION_TYPE_INSERT, ACTION_TYPE_PAGE_CREATE, ACTION_TYPE_PAGE_CREATED, ACTION_TYPE_PAGE_SCROLL, ACTION_TYPE_REMOVE, ACTION_TYPE_REMOVE_ATTRIBUTE, ACTION_TYPE_REMOVE_EVENT, ACTION_TYPE_SET_ATTRIBUTE, ACTION_TYPE_SET_TEXT, ATTR_CHANGE_PREFIX, ATTR_CLASS, ATTR_INNER_HTML, ATTR_STYLE, ATTR_TEXT_CONTENT, ATTR_V_OWNER_ID, ATTR_V_RENDERJS, ATTR_V_SHOW, BACKGROUND_COLOR, BUILT_IN_TAGS, BUILT_IN_TAG_NAMES, COMPONENT_NAME_PREFIX, COMPONENT_PREFIX, COMPONENT_SELECTOR_PREFIX, DATA_RE, E$1 as Emitter, EventChannel, EventModifierFlags, I18N_JSON_DELIMITERS, JSON_PROTOCOL, LINEFEED, MINI_PROGRAM_PAGE_RUNTIME_HOOKS, NAVBAR_HEIGHT, NODE_TYPE_COMMENT, NODE_TYPE_ELEMENT, NODE_TYPE_PAGE, NODE_TYPE_TEXT, NVUE_BUILT_IN_TAGS, NVUE_U_BUILT_IN_TAGS, ON_ADD_TO_FAVORITES, ON_APP_ENTER_BACKGROUND, ON_APP_ENTER_FOREGROUND, ON_BACK_PRESS, ON_ERROR, ON_HIDE, ON_INIT, ON_KEYBOARD_HEIGHT_CHANGE, ON_LAUNCH, ON_LOAD, ON_NAVIGATION_BAR_BUTTON_TAP, ON_NAVIGATION_BAR_SEARCH_INPUT_CHANGED, ON_NAVIGATION_BAR_SEARCH_INPUT_CLICKED, ON_NAVIGATION_BAR_SEARCH_INPUT_CONFIRMED, ON_NAVIGATION_BAR_SEARCH_INPUT_FOCUS_CHANGED, ON_PAGE_NOT_FOUND, ON_PAGE_SCROLL, ON_PULL_DOWN_REFRESH, ON_REACH_BOTTOM, ON_REACH_BOTTOM_DISTANCE, ON_READY, ON_RESIZE, ON_SAVE_EXIT_STATE, ON_SHARE_APP_MESSAGE, ON_SHARE_TIMELINE, ON_SHOW, ON_TAB_ITEM_TAP, ON_THEME_CHANGE, ON_UNHANDLE_REJECTION, ON_UNLOAD, ON_WEB_INVOKE_APP_SERVICE, ON_WXS_INVOKE_CALL_METHOD, PLUS_RE, PRIMARY_COLOR, RENDERJS_MODULES, RESPONSIVE_MIN_WIDTH, SCHEME_RE, SELECTED_COLOR, SLOT_DEFAULT_NAME, TABBAR_HEIGHT, TAGS, UNI_SSR, UNI_SSR_DATA, UNI_SSR_GLOBAL_DATA, UNI_SSR_STORE, UNI_SSR_TITLE, UNI_STORAGE_LOCALE, UniBaseNode, UniCommentNode, UniElement, UniEvent, UniInputElement, UniLifecycleHooks, UniNode, UniTextAreaElement, UniTextNode, WEB_INVOKE_APPSERVICE, WXS_MODULES, WXS_PROTOCOL, addFont, addLeadingSlash, cache, cacheStringFunction, callOptions, createIsCustomElement, createRpx2Unit, createUniEvent, customizeEvent, debounce, decode, decodedQuery, defaultMiniProgramRpx2Unit, defaultNVueRpx2Unit, defaultRpx2Unit, dynamicSlotName, forcePatchProp, formatAppLog, formatDateTime, formatH5Log, formatLog, getCustomDataset, getEnvLocale, getLen, getValueByDataPath, initCustomDatasetOnce, invokeArrayFns, invokeCreateVueAppHook, isAppNVueNativeTag, isAppNativeTag, isBuiltInComponent, isComponentInternalInstance, isComponentTag, isH5CustomElement, isH5NativeTag, isMiniProgramNativeTag, isRootHook, isRootImmediateHook, normalizeDataset, normalizeEventType, normalizeTarget, onCreateVueApp, once, parseEventName, parseNVueDataset, parseQuery, parseUrl, passive, plusReady, removeLeadingSlash, resolveComponentInstance, resolveOwnerEl, resolveOwnerVm, sanitise, scrollTo, sortObject, stringifyQuery, updateElementStyle };
import { isString } from '@vue/shared'
import { isPlainObject, isString } from '@vue/shared'
export function cache<T>(fn: (str: string) => T) {
const cache: Record<string, T> = Object.create(null)
......@@ -129,3 +129,16 @@ export function getValueByDataPath(obj: any, path: string): unknown {
}
return getValueByDataPath(obj[key], parts.slice(1).join('.'))
}
export function sortObject<T>(obj: T) {
let sortObj: T = {} as T
if (isPlainObject(obj)) {
Object.keys(obj)
.sort()
.forEach((key) => {
const _key = key as keyof T
sortObj[_key] = obj[_key]
})
}
return !Object.keys(sortObj) ? obj : sortObj
}
lockfileVersion: 5.3
lockfileVersion: 5.4
importers:
......@@ -6,7 +6,7 @@ importers:
specifiers:
'@babel/core': ^7.17.10
'@babel/preset-env': ^7.16.11
'@dcloudio/types': ^2.6.10
'@dcloudio/types': ^2.6.11
'@dcloudio/uni-api': 3.0.0-alpha-3041320220531001
'@dcloudio/uni-app': 3.0.0-alpha-3041320220531001
'@jest/types': ^27.0.2
......@@ -57,13 +57,13 @@ importers:
devDependencies:
'@babel/core': 7.17.10
'@babel/preset-env': 7.17.10_@babel+core@7.17.10
'@dcloudio/types': 2.6.10
'@dcloudio/types': 2.6.11
'@dcloudio/uni-api': link:packages/uni-api
'@dcloudio/uni-app': link:packages/uni-app
'@jest/types': 27.5.1
'@microsoft/api-extractor': 7.23.1
'@rollup/plugin-alias': 3.1.9_rollup@2.72.0
'@rollup/plugin-babel': 5.3.1_b2ace10b8392be11fbae66c6d89d8c0c
'@rollup/plugin-babel': 5.3.1_wkwocc4dsk7bd65om3dnrhmmbq
'@rollup/plugin-commonjs': 17.1.0_rollup@2.72.0
'@rollup/plugin-json': 4.1.0_rollup@2.72.0
'@rollup/plugin-node-resolve': 11.2.1_rollup@2.72.0
......@@ -71,7 +71,7 @@ importers:
'@rollup/plugin-strip': 2.1.0_rollup@2.72.0
'@types/jest': 27.5.0
'@types/node': 17.0.31
'@typescript-eslint/parser': 5.22.0_eslint@7.32.0+typescript@4.6.4
'@typescript-eslint/parser': 5.22.0_e4zyhrvfnqudwdx5bevnvkluy4
'@vitejs/plugin-vue': 2.3.3_vite@2.9.9+vue@3.2.33
'@vitejs/plugin-vue-jsx': 1.3.10
'@vue/compiler-sfc': 3.2.33
......@@ -96,10 +96,10 @@ importers:
rollup-plugin-node-builtins: 2.1.2
rollup-plugin-node-globals: 1.4.0
rollup-plugin-terser: 7.0.2_rollup@2.72.0
rollup-plugin-typescript2: 0.29.0_rollup@2.72.0+typescript@4.6.4
rollup-plugin-typescript2: 0.29.0_s6zbpzdkhlvcqzhawas6jkergu
rollup-plugin-vue: 6.0.0_@vue+compiler-sfc@3.2.33
semver: 7.3.7
ts-jest: 27.1.4_6b62438663b23957550c965172b78733
ts-jest: 27.1.4_nnrehbtdwi4vovimszixfn4hgm
typescript: 4.6.4
vite: 2.9.9
vue: 3.2.33
......@@ -2096,15 +2096,17 @@ packages:
uuid: 8.3.2
dev: true
/@cypress/xvfb/1.2.4:
/@cypress/xvfb/1.2.4_supports-color@8.1.1:
resolution: {integrity: sha512-skbBzPggOVYCbnGgV+0dmBdW/s77ZkAOXIC1knS8NagwDjBrNC1LuXtQJeiN6l+m7lzmHtaoUw/ctJKdqkG57Q==}
dependencies:
debug: 3.2.7
debug: 3.2.7_supports-color@8.1.1
lodash.once: 4.1.1
transitivePeerDependencies:
- supports-color
dev: true
/@dcloudio/types/2.6.10:
resolution: {integrity: sha512-KBMMb+vDw7XeobwKsBh9RY+yLuL9ZKaWWgRFctd62b1zMrsWhweIyyvigvqutgaE3wCwj7T71HoA7SHxC+SYnw==}
/@dcloudio/types/2.6.11:
resolution: {integrity: sha512-nTlGWxGAI0Xq7twTThdRJTJa0kBtNDyWACO2xYJyhVQXNKKIci1PwDuQmpvZCD1apbwWWVi+jm9RBMNsjAtxZw==}
dev: true
/@dcloudio/types/2.6.6:
......@@ -2516,7 +2518,7 @@ packages:
slash: 3.0.0
dev: true
/@rollup/plugin-babel/5.3.1_b2ace10b8392be11fbae66c6d89d8c0c:
/@rollup/plugin-babel/5.3.1_wkwocc4dsk7bd65om3dnrhmmbq:
resolution: {integrity: sha512-WFfdLWU/xVWKeRQnKmIAQULUI7Il0gZnBIH/ZFO069wYIfPu+8zrfp/KMW0atmELoRDq8FbiP3VCss9MhCut7Q==}
engines: {node: '>= 10.0.0'}
peerDependencies:
......@@ -2897,7 +2899,7 @@ packages:
dev: true
optional: true
/@typescript-eslint/parser/5.22.0_eslint@7.32.0+typescript@4.6.4:
/@typescript-eslint/parser/5.22.0_e4zyhrvfnqudwdx5bevnvkluy4:
resolution: {integrity: sha512-piwC4krUpRDqPaPbFaycN70KCP87+PC5WZmrWs+DlVOxxmF+zI6b6hETv7Quy4s9wbkV16ikMeZgXsvzwI3icQ==}
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
peerDependencies:
......@@ -3498,6 +3500,8 @@ packages:
raw-body: 2.5.1
type-is: 1.6.18
unpipe: 1.0.0
transitivePeerDependencies:
- supports-color
dev: false
/brace-expansion/1.1.11:
......@@ -3859,6 +3863,8 @@ packages:
on-headers: 1.0.2
safe-buffer: 5.1.2
vary: 1.1.2
transitivePeerDependencies:
- supports-color
dev: true
/concat-map/0.0.1:
......@@ -4061,7 +4067,7 @@ packages:
requiresBuild: true
dependencies:
'@cypress/request': 2.88.10
'@cypress/xvfb': 1.2.4
'@cypress/xvfb': 1.2.4_supports-color@8.1.1
'@types/node': 14.18.16
'@types/sinonjs__fake-timers': 6.0.4
'@types/sizzle': 2.3.3
......@@ -4129,13 +4135,24 @@ packages:
/debug/2.6.9:
resolution: {integrity: sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==}
peerDependencies:
supports-color: '*'
peerDependenciesMeta:
supports-color:
optional: true
dependencies:
ms: 2.0.0
/debug/3.2.7:
/debug/3.2.7_supports-color@8.1.1:
resolution: {integrity: sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==}
peerDependencies:
supports-color: '*'
peerDependenciesMeta:
supports-color:
optional: true
dependencies:
ms: 2.1.3
supports-color: 8.1.1
dev: true
/debug/4.3.4:
......@@ -4800,6 +4817,8 @@ packages:
type-is: 1.6.18
utils-merge: 1.0.1
vary: 1.1.2
transitivePeerDependencies:
- supports-color
dev: false
/extend/3.0.2:
......@@ -4895,6 +4914,8 @@ packages:
parseurl: 1.3.3
statuses: 2.0.1
unpipe: 1.0.0
transitivePeerDependencies:
- supports-color
dev: false
/find-cache-dir/3.3.2:
......@@ -7428,7 +7449,7 @@ packages:
terser: 5.13.1
dev: true
/rollup-plugin-typescript2/0.29.0_rollup@2.72.0+typescript@4.6.4:
/rollup-plugin-typescript2/0.29.0_s6zbpzdkhlvcqzhawas6jkergu:
resolution: {integrity: sha512-YytahBSZCIjn/elFugEGQR5qTsVhxhUwGZIsA9TmrSsC88qroGo65O5HZP/TTArH2dm0vUmYWhKchhwi2wL9bw==}
peerDependencies:
rollup: '>=1.26.3'
......@@ -7542,6 +7563,8 @@ packages:
on-finished: 2.4.1
range-parser: 1.2.1
statuses: 2.0.1
transitivePeerDependencies:
- supports-color
/serialize-javascript/4.0.0:
resolution: {integrity: sha512-GaNA54380uFefWghODBWEGisLZFj00nS5ACs6yHa9nLqlLpVLO8ChDGeKRjZnV4Nh4n0Qi7nhYZD/9fCPzEqkw==}
......@@ -7557,6 +7580,8 @@ packages:
escape-html: 1.0.3
parseurl: 1.3.3
send: 0.18.0
transitivePeerDependencies:
- supports-color
/setprototypeof/1.2.0:
resolution: {integrity: sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==}
......@@ -7953,7 +7978,7 @@ packages:
punycode: 2.1.1
dev: true
/ts-jest/27.1.4_6b62438663b23957550c965172b78733:
/ts-jest/27.1.4_nnrehbtdwi4vovimszixfn4hgm:
resolution: {integrity: sha512-qjkZlVPWVctAezwsOD1OPzbZ+k7zA5z3oxII4dGdZo5ggX/PL7kvwTM0pXTr10fAtbiVpJaL3bWd502zAhpgSQ==}
engines: {node: ^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0}
hasBin: true
......@@ -8202,7 +8227,6 @@ packages:
rollup: 2.72.0
optionalDependencies:
fsevents: 2.3.2
dev: true
/vlq/0.2.3:
resolution: {integrity: sha512-DRibZL6DsNhIgYQ+wNdWDL2SL3bKPlVrRiBqV5yuMm++op8W4kGFtaQfCs4KEJn0wBZcHVHJ3eoywX8983k1ow==}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册