Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
qianlong66
uni-app
提交
5fe166f3
U
uni-app
项目概览
qianlong66
/
uni-app
与 Fork 源项目一致
Fork自
DCloud / uni-app
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
U
uni-app
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
5fe166f3
编写于
6月 16, 2022
作者:
fxy060608
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
chore: typeof x === 'string' => isString
上级
b91abffa
变更
49
展开全部
隐藏空白更改
内联
并排
Showing
49 changed file
with
163 addition
and
147 deletion
+163
-147
packages/uni-api/src/protocols/media/previewImage.ts
packages/uni-api/src/protocols/media/previewImage.ts
+4
-2
packages/uni-api/src/protocols/network/socket.ts
packages/uni-api/src/protocols/network/socket.ts
+2
-1
packages/uni-api/src/protocols/route/encodeQueryString.ts
packages/uni-api/src/protocols/route/encodeQueryString.ts
+2
-1
packages/uni-api/src/service/base/interceptor.ts
packages/uni-api/src/service/base/interceptor.ts
+9
-3
packages/uni-app-plus/dist/uni-app-view.umd.js
packages/uni-app-plus/dist/uni-app-view.umd.js
+3
-3
packages/uni-app-plus/dist/uni.runtime.esm.js
packages/uni-app-plus/dist/uni.runtime.esm.js
+18
-18
packages/uni-app-plus/src/service/api/device/systemInfo.ts
packages/uni-app-plus/src/service/api/device/systemInfo.ts
+2
-2
packages/uni-app-plus/src/service/api/network/request.ts
packages/uni-app-plus/src/service/api/network/request.ts
+5
-5
packages/uni-app-plus/src/service/api/plugin/share.ts
packages/uni-app-plus/src/service/api/plugin/share.ts
+4
-3
packages/uni-app-plus/src/service/api/storage/storage.ts
packages/uni-app-plus/src/service/api/storage/storage.ts
+4
-3
packages/uni-app-vite/src/nvue/plugin/transforms/vModel.ts
packages/uni-app-vite/src/nvue/plugin/transforms/vModel.ts
+2
-1
packages/uni-cli-shared/src/checkUpdate.ts
packages/uni-cli-shared/src/checkUpdate.ts
+1
-1
packages/uni-cli-shared/src/hbx/log.ts
packages/uni-cli-shared/src/hbx/log.ts
+2
-3
packages/uni-cli-shared/src/logs/format.ts
packages/uni-cli-shared/src/logs/format.ts
+2
-1
packages/uni-cli-shared/src/vite/plugins/inject.ts
packages/uni-cli-shared/src/vite/plugins/inject.ts
+2
-2
packages/uni-cli-shared/src/vite/plugins/vitejs/plugins/asset.ts
...s/uni-cli-shared/src/vite/plugins/vitejs/plugins/asset.ts
+3
-3
packages/uni-cli-shared/src/vite/plugins/vitejs/plugins/css.ts
...ges/uni-cli-shared/src/vite/plugins/vitejs/plugins/css.ts
+4
-6
packages/uni-components/dist/components.js
packages/uni-components/dist/components.js
+4
-4
packages/uni-components/src/helpers/useFormField.ts
packages/uni-components/src/helpers/useFormField.ts
+3
-2
packages/uni-components/src/nvue/picker-view-column/index.tsx
...ages/uni-components/src/nvue/picker-view-column/index.tsx
+2
-2
packages/uni-components/src/nvue/rich-text/index.tsx
packages/uni-components/src/nvue/rich-text/index.tsx
+2
-2
packages/uni-components/src/nvue/swiper/index.tsx
packages/uni-components/src/nvue/swiper/index.tsx
+2
-1
packages/uni-components/src/vue/editor/quill/index.ts
packages/uni-components/src/vue/editor/quill/index.ts
+3
-3
packages/uni-components/src/vue/editor/quill/loadScript.ts
packages/uni-components/src/vue/editor/quill/loadScript.ts
+5
-4
packages/uni-components/src/vue/rich-text/index.tsx
packages/uni-components/src/vue/rich-text/index.tsx
+2
-1
packages/uni-components/src/vue/rich-text/nodes-parser.ts
packages/uni-components/src/vue/rich-text/nodes-parser.ts
+2
-6
packages/uni-core/src/helpers/util.ts
packages/uni-core/src/helpers/util.ts
+2
-1
packages/uni-core/src/view/plugin/componentWxs.ts
packages/uni-core/src/view/plugin/componentWxs.ts
+2
-1
packages/uni-h5-vite/src/plugins/css.ts
packages/uni-h5-vite/src/plugins/css.ts
+3
-3
packages/uni-h5-vite/src/utils/ssr.ts
packages/uni-h5-vite/src/utils/ssr.ts
+1
-1
packages/uni-h5/dist/uni-h5.cjs.js
packages/uni-h5/dist/uni-h5.cjs.js
+7
-7
packages/uni-h5/dist/uni-h5.es.js
packages/uni-h5/dist/uni-h5.es.js
+19
-19
packages/uni-h5/src/service/api/network/request.ts
packages/uni-h5/src/service/api/network/request.ts
+2
-2
packages/uni-h5/src/service/api/network/socket.ts
packages/uni-h5/src/service/api/network/socket.ts
+2
-2
packages/uni-h5/src/service/api/storage/storage.ts
packages/uni-h5/src/service/api/storage/storage.ts
+4
-2
packages/uni-mp-alipay/dist/uni.api.esm.js
packages/uni-mp-alipay/dist/uni.api.esm.js
+2
-2
packages/uni-mp-baidu/dist/uni.api.esm.js
packages/uni-mp-baidu/dist/uni.api.esm.js
+3
-3
packages/uni-mp-baidu/src/api/shims.ts
packages/uni-mp-baidu/src/api/shims.ts
+2
-1
packages/uni-mp-kuaishou/dist/uni.api.esm.js
packages/uni-mp-kuaishou/dist/uni.api.esm.js
+2
-2
packages/uni-mp-lark/dist/uni.api.esm.js
packages/uni-mp-lark/dist/uni.api.esm.js
+2
-2
packages/uni-mp-qq/dist/uni.api.esm.js
packages/uni-mp-qq/dist/uni.api.esm.js
+2
-2
packages/uni-mp-toutiao/dist/uni.api.esm.js
packages/uni-mp-toutiao/dist/uni.api.esm.js
+2
-2
packages/uni-mp-weixin/dist/uni.api.esm.js
packages/uni-mp-weixin/dist/uni.api.esm.js
+2
-2
packages/uni-quickapp-webview/dist/uni.api.esm.js
packages/uni-quickapp-webview/dist/uni.api.esm.js
+2
-2
packages/uni-shared/dist/uni-shared.cjs.js
packages/uni-shared/dist/uni-shared.cjs.js
+1
-1
packages/uni-shared/dist/uni-shared.es.js
packages/uni-shared/dist/uni-shared.es.js
+2
-2
packages/uni-shared/src/utils.ts
packages/uni-shared/src/utils.ts
+1
-1
packages/vite-plugin-uni/src/configResolved/index.ts
packages/vite-plugin-uni/src/configResolved/index.ts
+2
-2
packages/vite-plugin-uni/src/configResolved/plugins/index.ts
packages/vite-plugin-uni/src/configResolved/plugins/index.ts
+2
-2
未找到文件。
packages/uni-api/src/protocols/media/previewImage.ts
浏览文件 @
5fe166f3
import
{
isString
}
from
'
@vue/shared
'
import
{
getRealPath
}
from
'
@dcloudio/uni-platform
'
export
const
API_PREVIEW_IMAGE
=
'
previewImage
'
...
...
@@ -7,14 +9,14 @@ export const PreviewImageOptions: ApiOptions<API_TYPE_PREVIEW_IMAGE> = {
formatArgs
:
{
urls
(
urls
,
params
)
{
params
.
urls
=
urls
.
map
((
url
)
=>
typeof
url
===
'
string
'
&&
url
?
getRealPath
(
url
)
:
''
isString
(
url
)
&&
url
?
getRealPath
(
url
)
:
''
)
},
current
(
current
,
params
)
{
if
(
typeof
current
===
'
number
'
)
{
params
.
current
=
current
>
0
&&
current
<
params
.
urls
.
length
?
current
:
0
}
else
if
(
typeof
current
===
'
string
'
&&
current
)
{
}
else
if
(
isString
(
current
)
&&
current
)
{
params
.
current
=
getRealPath
(
current
)
}
},
...
...
packages/uni-api/src/protocols/network/socket.ts
浏览文件 @
5fe166f3
import
{
isString
}
from
'
@vue/shared
'
import
{
elemInArray
,
HTTP_METHODS
}
from
'
../../helpers/protocol
'
export
const
API_CONNECT_SOCKET
=
'
connectSocket
'
export
type
API_TYPE_CONNECT_SOCKET
=
typeof
uni
.
connectSocket
...
...
@@ -13,7 +14,7 @@ export const ConnectSocketOptions: ApiOptions<API_TYPE_CONNECT_SOCKET> = {
)
as
any
},
protocols
(
protocols
,
params
)
{
if
(
typeof
protocols
===
'
string
'
)
{
if
(
isString
(
protocols
)
)
{
params
.
protocols
=
[
protocols
]
}
},
...
...
packages/uni-api/src/protocols/route/encodeQueryString.ts
浏览文件 @
5fe166f3
import
{
isString
}
from
'
@vue/shared
'
export
function
encodeQueryString
(
url
:
string
)
{
if
(
typeof
url
!==
'
string
'
)
{
if
(
!
isString
(
url
)
)
{
return
url
}
const
index
=
url
.
indexOf
(
'
?
'
)
...
...
packages/uni-api/src/service/base/interceptor.ts
浏览文件 @
5fe166f3
import
{
isArray
,
isFunction
,
isPlainObject
,
remove
}
from
'
@vue/shared
'
import
{
isArray
,
isFunction
,
isPlainObject
,
isString
,
remove
,
}
from
'
@vue/shared
'
import
{
HOOKS
,
...
...
@@ -74,7 +80,7 @@ function dedupeHooks(hooks: Function[]) {
export
const
addInterceptor
=
defineSyncApi
(
API_ADD_INTERCEPTOR
,
(
method
:
string
|
Interceptor
,
interceptor
:
Interceptor
|
undefined
)
=>
{
if
(
typeof
method
===
'
string
'
&&
isPlainObject
(
interceptor
))
{
if
(
isString
(
method
)
&&
isPlainObject
(
interceptor
))
{
mergeInterceptorHook
(
scopedInterceptors
[
method
]
||
(
scopedInterceptors
[
method
]
=
{}),
interceptor
...
...
@@ -89,7 +95,7 @@ export const addInterceptor = defineSyncApi(
export
const
removeInterceptor
=
defineSyncApi
(
API_REMOVE_INTERCEPTOR
,
(
method
:
string
|
Interceptor
,
interceptor
:
Interceptor
|
undefined
)
=>
{
if
(
typeof
method
===
'
string
'
)
{
if
(
isString
(
method
)
)
{
if
(
isPlainObject
(
interceptor
))
{
removeInterceptorHook
(
scopedInterceptors
[
method
],
interceptor
)
}
else
{
...
...
packages/uni-app-plus/dist/uni-app-view.umd.js
浏览文件 @
5fe166f3
此差异已折叠。
点击以展开。
packages/uni-app-plus/dist/uni.runtime.esm.js
浏览文件 @
5fe166f3
...
...
@@ -1452,7 +1452,7 @@ function rpx2px(str, replace = false) {
if (replace) {
return rpx2pxWithReplace(str);
}
if (
typeof str === 'string'
) {
if (
isString(str)
) {
const res = parseInt(str) || 0;
if (hasRpx(str)) {
return uni.upx2px(res);
...
...
@@ -9249,7 +9249,7 @@ function dedupeHooks(hooks) {
return res;
}
const addInterceptor = defineSyncApi(API_ADD_INTERCEPTOR, (method, interceptor) => {
if (
typeof method === 'string'
&& isPlainObject(interceptor)) {
if (
isString(method)
&& isPlainObject(interceptor)) {
mergeInterceptorHook(scopedInterceptors[method] || (scopedInterceptors[method] = {}), interceptor);
}
else if (isPlainObject(method)) {
...
...
@@ -9257,7 +9257,7 @@ const addInterceptor = defineSyncApi(API_ADD_INTERCEPTOR, (method, interceptor)
}
}, AddInterceptorProtocol);
const removeInterceptor = defineSyncApi(API_REMOVE_INTERCEPTOR, (method, interceptor) => {
if (
typeof method === 'string'
) {
if (
isString(method)
) {
if (isPlainObject(interceptor)) {
removeInterceptorHook(scopedInterceptors[method], interceptor);
}
...
...
@@ -11707,14 +11707,14 @@ const API_PREVIEW_IMAGE = 'previewImage';
const PreviewImageOptions = {
formatArgs: {
urls(urls, params) {
params.urls = urls.map((url) =>
typeof url === 'string'
&& url ? getRealPath(url) : '');
params.urls = urls.map((url) =>
isString(url)
&& url ? getRealPath(url) : '');
},
current(current, params) {
if (typeof current === 'number') {
params.current =
current > 0 && current < params.urls.length ? current : 0;
}
else if (
typeof current === 'string'
&& current) {
else if (
isString(current)
&& current) {
params.current = getRealPath(current);
}
},
...
...
@@ -11968,7 +11968,7 @@ const ConnectSocketOptions = {
params.method = elemInArray((value || '').toUpperCase(), HTTP_METHODS);
},
protocols(protocols, params) {
if (
typeof protocols === 'string'
) {
if (
isString(protocols)
) {
params.protocols = [protocols];
}
},
...
...
@@ -11996,7 +11996,7 @@ const CloseSocketProtocol = {
};
function encodeQueryString(url) {
if (
typeof url !== 'string'
) {
if (
!isString(url)
) {
return url;
}
const index = url.indexOf('?');
...
...
@@ -12748,7 +12748,7 @@ const STORAGE_KEYS = 'uni-storage-keys';
function parseValue(value) {
const types = ['object', 'string', 'number', 'boolean', 'undefined'];
try {
const object =
typeof value === 'string'
? JSON.parse(value) : value;
const object =
isString(value)
? JSON.parse(value) : value;
const type = object.type;
if (types.indexOf(type) >= 0) {
const keys = Object.keys(object);
...
...
@@ -12826,7 +12826,7 @@ function parseGetStorage(type, value) {
else if (type) {
// 兼容App端历史格式
data = object;
if (
typeof object === 'string'
) {
if (
isString(object)
) {
object = JSON.parse(object);
const objectType = typeof object;
if (objectType === 'number' && type === 'date') {
...
...
@@ -12847,7 +12847,7 @@ const getStorageSync = defineSyncApi(API_GET_STORAGE_SYNC, (key, t) => {
const value = plus.storage.getItem(key);
const typeOrigin = plus.storage.getItem(key + STORAGE_DATA_TYPE) || '';
const type = typeOrigin.toLowerCase();
if (
typeof value !== 'string'
) {
if (
!isString(value)
) {
return '';
}
return parseGetStorage(type, value);
...
...
@@ -13358,7 +13358,7 @@ function weexGetSystemInfoSync() {
return;
const { getSystemInfoSync } = weex.requireModule('plus');
systemInfo = getSystemInfoSync();
if (
typeof systemInfo === 'string'
) {
if (
isString(systemInfo)
) {
try {
systemInfo = JSON.parse(systemInfo);
}
...
...
@@ -14573,7 +14573,7 @@ const cookiesParse = (header) => {
return cookiesArr;
};
function formatResponse(res, args) {
if (
typeof res.data === 'string'
&& res.data.charCodeAt(0) === 65279) {
if (
isString(res.data)
&& res.data.charCodeAt(0) === 65279) {
res.data = res.data.slice(1);
}
res.statusCode = parseInt(String(res.statusCode), 10);
...
...
@@ -14583,7 +14583,7 @@ function formatResponse(res, args) {
if (isArray(value)) {
ret[key] = value.join(',');
}
else if (
typeof value === 'string'
) {
else if (
isString(value)
) {
ret[key] = value;
}
return ret;
...
...
@@ -14638,7 +14638,7 @@ const request = defineTaskApi(API_REQUEST, (args, { resolve, reject }) => {
// TODO 需要重构
if (method !== 'GET' &&
header[name].indexOf('application/x-www-form-urlencoded') === 0 &&
typeof data !== 'string'
&&
!isString(data)
&&
!(data instanceof ArrayBuffer)) {
const bodyArray = [];
for (const key in data) {
...
...
@@ -14680,7 +14680,7 @@ const request = defineTaskApi(API_REQUEST, (args, { resolve, reject }) => {
withArrayBuffer = true;
}
else {
options.body =
typeof data === 'string'
? data : JSON.stringify(data);
options.body =
isString(data)
? data : JSON.stringify(data);
}
}
const callback = ({ ok, status, data, headers, errorMsg, }) => {
...
...
@@ -16735,7 +16735,7 @@ const TYPES = {
const parseParams = (args) => {
args.type = args.type || 0;
let { provider, type, title, summary: content, href, imageUrl, mediaUrl: media, scene, miniProgram, openCustomerServiceChat, corpid, customerUrl: url, } = args;
if (
typeof imageUrl === 'string'
&& imageUrl) {
if (
isString(imageUrl)
&& imageUrl) {
imageUrl = getRealPath(imageUrl);
}
const shareType = TYPES[type];
...
...
@@ -16784,7 +16784,7 @@ const sendShareMsg = function (service, params, resolve, reject, method = 'share
const share = defineAsyncApi(API_SHREA, (params, { resolve, reject }) => {
const parsedParams = parseParams(params);
const errorCallback = warpPlusErrorCallback(reject);
if (
typeof parsedParams === 'string'
) {
if (
isString(parsedParams)
) {
return reject(parsedParams);
}
plus.share.getServices((services) => {
...
...
@@ -16804,7 +16804,7 @@ const share = defineAsyncApi(API_SHREA, (params, { resolve, reject }) => {
}, ShareProtocols, SahreOptions);
const shareWithSystem = defineAsyncApi(API_SHARE_WITH_SYSTEM, ({ type, imageUrl, summary, href }, { resolve, reject }) => {
const errorCallback = warpPlusErrorCallback(reject);
if (
typeof imageUrl === 'string'
&& imageUrl) {
if (
isString(imageUrl)
&& imageUrl) {
imageUrl = getRealPath(imageUrl);
}
plus.share.sendWithSystem({
...
...
packages/uni-app-plus/src/service/api/device/systemInfo.ts
浏览文件 @
5fe166f3
import
{
defineAsyncApi
,
defineSyncApi
,
getLocale
}
from
'
@dcloudio/uni-api
'
import
deviceId
from
'
../../../helpers/uuid
'
import
{
extend
}
from
'
@vue/shared
'
import
{
extend
,
isString
}
from
'
@vue/shared
'
import
{
getWindowInfo
}
from
'
./getWindowInfo
'
import
{
sortObject
}
from
'
@dcloudio/uni-shared
'
...
...
@@ -11,7 +11,7 @@ function weexGetSystemInfoSync() {
if
(
!
_initSystemInfo
)
return
const
{
getSystemInfoSync
}
=
weex
.
requireModule
(
'
plus
'
)
systemInfo
=
getSystemInfoSync
()
if
(
typeof
systemInfo
===
'
string
'
)
{
if
(
isString
(
systemInfo
)
)
{
try
{
systemInfo
=
JSON
.
parse
(
systemInfo
)
}
catch
(
error
)
{}
...
...
packages/uni-app-plus/src/service/api/network/request.ts
浏览文件 @
5fe166f3
import
{
hasOwn
,
isArray
,
isPlainObject
}
from
'
@vue/shared
'
import
{
hasOwn
,
isArray
,
isPlainObject
,
isString
}
from
'
@vue/shared
'
import
{
API_REQUEST
,
API_TYPE_REQUEST
,
...
...
@@ -53,7 +53,7 @@ const cookiesParse = (header: Record<string, string>) => {
}
function
formatResponse
(
res
:
RequestTaskState
,
args
:
UniApp
.
RequestOptions
)
{
if
(
typeof
res
.
data
===
'
string
'
&&
res
.
data
.
charCodeAt
(
0
)
===
65279
)
{
if
(
isString
(
res
.
data
)
&&
res
.
data
.
charCodeAt
(
0
)
===
65279
)
{
res
.
data
=
res
.
data
.
slice
(
1
)
}
...
...
@@ -64,7 +64,7 @@ function formatResponse(res: RequestTaskState, args: UniApp.RequestOptions) {
const
value
=
res
.
header
[
key
]
if
(
isArray
(
value
))
{
;(
ret
as
any
)[
key
]
=
value
.
join
(
'
,
'
)
}
else
if
(
typeof
value
===
'
string
'
)
{
}
else
if
(
isString
(
value
)
)
{
;(
ret
as
any
)[
key
]
=
value
}
return
ret
...
...
@@ -145,7 +145,7 @@ export const request = defineTaskApi<API_TYPE_REQUEST>(
if
(
method
!==
'
GET
'
&&
header
[
name
].
indexOf
(
'
application/x-www-form-urlencoded
'
)
===
0
&&
typeof
data
!==
'
string
'
&&
!
isString
(
data
)
&&
!
(
data
instanceof
ArrayBuffer
)
)
{
const
bodyArray
=
[]
...
...
@@ -191,7 +191,7 @@ export const request = defineTaskApi<API_TYPE_REQUEST>(
if
(
toString
.
call
(
data
)
===
'
[object ArrayBuffer]
'
)
{
withArrayBuffer
=
true
}
else
{
options
.
body
=
typeof
data
===
'
string
'
?
data
:
JSON
.
stringify
(
data
)
options
.
body
=
isString
(
data
)
?
data
:
JSON
.
stringify
(
data
)
}
}
const
callback
:
FetchCallback
=
({
...
...
packages/uni-app-plus/src/service/api/plugin/share.ts
浏览文件 @
5fe166f3
import
{
isString
}
from
'
@vue/shared
'
import
{
getRealPath
}
from
'
@dcloudio/uni-platform
'
import
{
warpPlusErrorCallback
}
from
'
../../../helpers/plus
'
import
{
...
...
@@ -58,7 +59,7 @@ const parseParams = (args: UniApp.ShareOptions) => {
customerUrl
:
url
,
}
=
args
if
(
typeof
imageUrl
===
'
string
'
&&
imageUrl
)
{
if
(
isString
(
imageUrl
)
&&
imageUrl
)
{
imageUrl
=
getRealPath
(
imageUrl
)
}
...
...
@@ -123,7 +124,7 @@ export const share = defineAsyncApi<API_TYPE_SHARE>(
const
parsedParams
=
parseParams
(
params
)
const
errorCallback
=
warpPlusErrorCallback
(
reject
)
if
(
typeof
parsedParams
===
'
string
'
)
{
if
(
isString
(
parsedParams
)
)
{
return
reject
(
parsedParams
)
}
...
...
@@ -152,7 +153,7 @@ export const shareWithSystem = defineAsyncApi<API_TYPE_SHARE_WITH_SYSTEM>(
({
type
,
imageUrl
,
summary
,
href
},
{
resolve
,
reject
})
=>
{
const
errorCallback
=
warpPlusErrorCallback
(
reject
)
if
(
typeof
imageUrl
===
'
string
'
&&
imageUrl
)
{
if
(
isString
(
imageUrl
)
&&
imageUrl
)
{
imageUrl
=
getRealPath
(
imageUrl
)
}
plus
.
share
.
sendWithSystem
(
...
...
packages/uni-app-plus/src/service/api/storage/storage.ts
浏览文件 @
5fe166f3
import
{
isString
}
from
'
@vue/shared
'
import
{
defineSyncApi
,
defineAsyncApi
,
...
...
@@ -28,7 +29,7 @@ const STORAGE_KEYS = 'uni-storage-keys'
function
parseValue
(
value
:
any
)
{
const
types
=
[
'
object
'
,
'
string
'
,
'
number
'
,
'
boolean
'
,
'
undefined
'
]
try
{
const
object
=
typeof
value
===
'
string
'
?
JSON
.
parse
(
value
)
:
value
const
object
=
isString
(
value
)
?
JSON
.
parse
(
value
)
:
value
const
type
=
object
.
type
if
(
types
.
indexOf
(
type
)
>=
0
)
{
const
keys
=
Object
.
keys
(
object
)
...
...
@@ -116,7 +117,7 @@ function parseGetStorage(type: string, value: string) {
}
else
if
(
type
)
{
// 兼容App端历史格式
data
=
object
if
(
typeof
object
===
'
string
'
)
{
if
(
isString
(
object
)
)
{
object
=
JSON
.
parse
(
object
)
const
objectType
=
typeof
object
if
(
objectType
===
'
number
'
&&
type
===
'
date
'
)
{
...
...
@@ -140,7 +141,7 @@ export const getStorageSync = <API_TYPE_GET_STORAGE_SYNC>defineSyncApi(
const
value
=
plus
.
storage
.
getItem
(
key
)
const
typeOrigin
=
plus
.
storage
.
getItem
(
key
+
STORAGE_DATA_TYPE
)
||
''
const
type
=
typeOrigin
.
toLowerCase
()
if
(
typeof
value
!==
'
string
'
)
{
if
(
!
isString
(
value
)
)
{
return
''
}
return
parseGetStorage
(
type
,
value
)
...
...
packages/uni-app-vite/src/nvue/plugin/transforms/vModel.ts
浏览文件 @
5fe166f3
...
...
@@ -4,6 +4,7 @@ import {
isStaticExp
,
NodeTypes
,
}
from
'
@vue/compiler-core
'
import
{
isString
}
from
'
@vue/shared
'
const
tags
=
[
'
u-input
'
,
'
u-textarea
'
]
export
const
transformModel
:
DirectiveTransform
=
(
dir
,
node
,
context
)
=>
{
const
result
=
baseTransform
(
dir
,
node
,
context
)
...
...
@@ -22,7 +23,7 @@ export const transformModel: DirectiveTransform = (dir, node, context) => {
key
.
content
=
'
onInput
'
// 替换 $event 为 $event.detail.value
value
.
children
=
value
.
children
.
map
((
child
)
=>
{
if
(
typeof
child
===
'
string
'
)
{
if
(
isString
(
child
)
)
{
return
child
.
replace
(
/=
\s\$
event/g
,
`= $event.detail.value`
)
}
return
child
...
...
packages/uni-cli-shared/src/checkUpdate.ts
浏览文件 @
5fe166f3
...
...
@@ -210,7 +210,7 @@ export function getMac() {
if
(
// Node < v18
typeof
item
.
family
===
'
string
'
&&
isString
(
item
.
family
)
&&
(
item
.
family
===
'
IPv4
'
||
item
.
family
===
'
IPv6
'
)
)
{
mac
=
item
.
mac
...
...
packages/uni-cli-shared/src/hbx/log.ts
浏览文件 @
5fe166f3
...
...
@@ -4,6 +4,7 @@ import colors from 'picocolors'
import
type
{
RollupError
}
from
'
rollup
'
import
type
{
LogErrorOptions
}
from
'
vite
'
import
{
NodeTypes
}
from
'
@vue/compiler-core
'
import
{
isString
}
from
'
@vue/shared
'
import
{
normalizePath
}
from
'
../utils
'
import
{
Formatter
}
from
'
../logs/format
'
...
...
@@ -63,9 +64,7 @@ const REMOVED_MSGS = [
]
export
const
removeInfoFormatter
:
Formatter
=
{
test
(
msg
)
{
return
!!
REMOVED_MSGS
.
find
((
m
)
=>
typeof
m
===
'
string
'
?
msg
.
includes
(
m
)
:
m
(
msg
)
)
return
!!
REMOVED_MSGS
.
find
((
m
)
=>
(
isString
(
m
)
?
msg
.
includes
(
m
)
:
m
(
msg
)))
},
format
()
{
return
''
...
...
packages/uni-cli-shared/src/logs/format.ts
浏览文件 @
5fe166f3
import
{
once
}
from
'
@dcloudio/uni-shared
'
import
{
isString
}
from
'
@vue/shared
'
import
{
isInHBuilderX
,
runByHBuilderX
}
from
'
../hbx/env
'
import
{
moduleAliasFormatter
}
from
'
../hbx/alias
'
...
...
@@ -62,7 +63,7 @@ const REMOVED_NVUE_MSGS = [
export
const
removeNVueInfoFormatter
:
Formatter
=
{
test
(
msg
)
{
return
!!
REMOVED_NVUE_MSGS
.
find
((
m
)
=>
typeof
m
===
'
string
'
?
msg
.
includes
(
m
)
:
m
(
msg
)
isString
(
m
)
?
msg
.
includes
(
m
)
:
m
(
msg
)
)
},
format
()
{
...
...
packages/uni-cli-shared/src/vite/plugins/inject.ts
浏览文件 @
5fe166f3
...
...
@@ -13,7 +13,7 @@ import {
import
{
AcornNode
}
from
'
rollup
'
import
{
walk
}
from
'
estree-walker
'
import
{
extend
,
isArray
}
from
'
@vue/shared
'
import
{
extend
,
isArray
,
isString
}
from
'
@vue/shared
'
import
MagicString
from
'
magic-string
'
import
{
...
...
@@ -133,7 +133,7 @@ export function uniViteInjectPlugin(
}
}
if
(
mod
&&
!
imports
.
has
(
name
)
&&
!
scope
.
contains
(
name
))
{
if
(
typeof
mod
===
'
string
'
)
mod
=
[
mod
,
'
default
'
]
if
(
isString
(
mod
)
)
mod
=
[
mod
,
'
default
'
]
if
(
mod
[
0
]
===
id
)
return
false
const
hash
=
`
${
keypath
}
:
${
mod
[
0
]}
:
${
mod
[
1
]}
`
// 当 API 被覆盖定义后,不再摇树
...
...
packages/uni-cli-shared/src/vite/plugins/vitejs/plugins/asset.ts
浏览文件 @
5fe166f3
...
...
@@ -9,7 +9,7 @@ import { Plugin } from '../plugin'
import
{
ResolvedConfig
}
from
'
../config
'
import
{
cleanUrl
,
normalizePath
}
from
'
../utils
'
import
{
withSourcemap
}
from
'
../../../../vite/utils/utils
'
import
{
isFunction
}
from
'
@vue/shared
'
import
{
isFunction
,
isString
}
from
'
@vue/shared
'
export
const
assetUrlRE
=
/__VITE_ASSET__
([
a-z
\d]{8})
__
(?:\$
_
(
.*
?)
__
)?
/g
...
...
@@ -197,10 +197,10 @@ export function assetFileNamesToFileName(
source
:
content
,
type
:
'
asset
'
,
})
if
(
typeof
assetFileNames
!==
'
string
'
)
{
if
(
!
isString
(
assetFileNames
)
)
{
throw
new
TypeError
(
'
assetFileNames must return a string
'
)
}
}
else
if
(
typeof
assetFileNames
!==
'
string
'
)
{
}
else
if
(
!
isString
(
assetFileNames
)
)
{
throw
new
TypeError
(
'
assetFileNames must be a string or a function
'
)
}
...
...
packages/uni-cli-shared/src/vite/plugins/vitejs/plugins/css.ts
浏览文件 @
5fe166f3
...
...
@@ -40,7 +40,7 @@ import { transform, formatMessages } from 'esbuild'
import
{
preCss
,
preNVueCss
}
from
'
../../../../preprocess
'
import
{
PAGES_JSON_JS
}
from
'
../../../../constants
'
import
{
emptyCssComments
}
from
'
../cleanString
'
import
{
isArray
,
isFunction
}
from
'
@vue/shared
'
import
{
isArray
,
isFunction
,
isString
}
from
'
@vue/shared
'
// const debug = createDebugger('vite:css')
export
interface
CSSOptions
{
...
...
@@ -711,8 +711,7 @@ async function resolvePostcssConfig(
plugins
:
inlineOptions
.
plugins
||
[],
}
}
else
{
const
searchPath
=
typeof
inlineOptions
===
'
string
'
?
inlineOptions
:
config
.
root
const
searchPath
=
isString
(
inlineOptions
)
?
inlineOptions
:
config
.
root
try
{
// @ts-ignore
result
=
await
postcssrc
({},
searchPath
)
...
...
@@ -1152,8 +1151,7 @@ async function rebaseUrls(
if
(
url
.
startsWith
(
'
/
'
))
return
url
// match alias, no need to rewrite
for
(
const
{
find
}
of
alias
)
{
const
matches
=
typeof
find
===
'
string
'
?
url
.
startsWith
(
find
)
:
find
.
test
(
url
)
const
matches
=
isString
(
find
)
?
url
.
startsWith
(
find
)
:
find
.
test
(
url
)
if
(
matches
)
{
return
url
}
...
...
@@ -1397,7 +1395,7 @@ async function getSource(
if
(
isFunction
(
additionalData
))
{
const
newContent
=
await
additionalData
(
source
,
filename
)
if
(
typeof
newContent
===
'
string
'
)
{
if
(
isString
(
newContent
)
)
{
return
{
content
:
newContent
}
}
return
newContent
...
...
packages/uni-components/dist/components.js
浏览文件 @
5fe166f3
import
{
createElementVNode
,
defineComponent
,
createVNode
,
mergeProps
,
getCurrentInstance
,
provide
,
watch
,
onUnmounted
,
shallowRef
,
reactive
,
watchEffect
,
ref
,
inject
,
onBeforeUnmount
,
computed
,
Text
as
Text$1
,
isVNode
,
Fragment
,
onMounted
,
resolveComponent
,
parseClassList
}
from
"
vue
"
;
import
{
extend
,
hasOwn
,
isFunction
,
isPlainObject
,
isArray
}
from
"
@vue/shared
"
;
import
{
extend
,
hasOwn
,
isFunction
,
isPlainObject
,
isArray
,
isString
}
from
"
@vue/shared
"
;
import
{
cacheStringFunction
,
PRIMARY_COLOR
}
from
"
@dcloudio/uni-shared
"
;
const
OPEN_TYPES
=
[
"
navigate
"
,
...
...
@@ -2342,7 +2342,7 @@ function useState(props2) {
const
dom
=
weex
.
requireModule
(
"
dom
"
);
const
isAndroid$1
=
weex
.
config
.
env
.
platform
.
toLowerCase
()
===
"
android
"
;
function
getStyle
(
val
)
{
return
extend
({},
typeof
val
===
"
string
"
?
parseStyleText
(
val
)
:
val
);
return
extend
({},
isString
(
val
)
?
parseStyleText
(
val
)
:
val
);
}
var
PickerViewColumn
=
defineComponent
({
name
:
"
PickerViewColumn
"
,
...
...
@@ -4090,7 +4090,7 @@ function useSwiperListeners(state, props2, swiperItems, trigger) {
}
};
const
onChange
=
(
event
)
=>
{
if
(
typeof
event
.
detail
.
source
===
"
string
"
)
{
if
(
isString
(
event
.
detail
.
source
)
)
{
state
.
currentChangeSource
=
event
.
detail
.
source
;
}
state
.
currentSync
=
event
.
detail
.
index
;
...
...
@@ -4395,7 +4395,7 @@ var RichText = defineComponent({
const
instance
=
getCurrentInstance
();
return
()
=>
{
let
nodes
=
props2
.
nodes
;
if
(
typeof
nodes
===
"
string
"
)
{
if
(
isString
(
nodes
)
)
{
nodes
=
parseHtml
(
nodes
);
}
return
createVNode
(
resolveComponent
(
"
u-rich-text
"
),
{
...
...
packages/uni-components/src/helpers/useFormField.ts
浏览文件 @
5fe166f3
import
{
getCurrentInstance
,
inject
,
onBeforeUnmount
}
from
'
vue
'
import
{
isString
}
from
'
@vue/shared
'
import
{
UniFormCtx
,
uniFormKey
}
from
'
../vue/form
'
interface
ValueState
{
...
...
@@ -24,11 +25,11 @@ export function useFormField(
const
proxy
=
instance
.
proxy
return
[
(
proxy
as
any
)[
nameKey
],
typeof
value
===
'
string
'
?
(
proxy
as
any
)[
value
]
:
value
.
value
,
isString
(
value
)
?
(
proxy
as
any
)[
value
]
:
value
.
value
,
]
},
reset
()
{
if
(
typeof
value
===
'
string
'
)
{
if
(
isString
(
value
)
)
{
;(
instance
.
proxy
as
any
)[
value
]
=
''
}
else
{
value
.
value
=
''
...
...
packages/uni-components/src/nvue/picker-view-column/index.tsx
浏览文件 @
5fe166f3
...
...
@@ -9,7 +9,7 @@ import {
getCurrentInstance
,
onMounted
,
}
from
'
vue
'
import
{
extend
}
from
'
@vue/shared
'
import
{
extend
,
isString
}
from
'
@vue/shared
'
import
{
Props
,
GetPickerViewColumn
}
from
'
../picker-view
'
import
{
parseStyleText
,
getComponentSize
}
from
'
../helpers
'
...
...
@@ -24,7 +24,7 @@ type ScrollOptions = {
const
dom
=
weex
.
requireModule
(
'
dom
'
)
const
isAndroid
=
weex
.
config
.
env
.
platform
.
toLowerCase
()
===
'
android
'
function
getStyle
(
val
:
string
)
{
return
extend
({},
typeof
val
===
'
string
'
?
parseStyleText
(
val
)
:
val
)
return
extend
({},
isString
(
val
)
?
parseStyleText
(
val
)
:
val
)
}
export
default
defineComponent
({
...
...
packages/uni-components/src/nvue/rich-text/index.tsx
浏览文件 @
5fe166f3
...
...
@@ -6,7 +6,7 @@ import {
// @ts-ignore
parseClassList
,
}
from
'
vue
'
import
{
isArray
}
from
'
@vue/shared
'
import
{
isArray
,
isString
}
from
'
@vue/shared
'
import
{
props
,
parseHtml
}
from
'
../../components/rich-text
'
import
{
parseStyleText
}
from
'
../helpers
'
...
...
@@ -21,7 +21,7 @@ export default defineComponent({
return
()
=>
{
let
nodes
=
props
.
nodes
if
(
typeof
nodes
===
'
string
'
)
{
if
(
isString
(
nodes
)
)
{
nodes
=
parseHtml
(
nodes
)
}
...
...
packages/uni-components/src/nvue/swiper/index.tsx
浏览文件 @
5fe166f3
...
...
@@ -8,6 +8,7 @@ import {
ExtractPropTypes
,
VNode
,
}
from
'
vue
'
import
{
isString
}
from
'
@vue/shared
'
import
{
useCustomEvent
,
EmitEvent
,
...
...
@@ -181,7 +182,7 @@ function useSwiperListeners(
}
const
onChange
=
(
event
:
any
)
=>
{
if
(
typeof
event
.
detail
.
source
===
'
string
'
)
{
if
(
isString
(
event
.
detail
.
source
)
)
{
state
.
currentChangeSource
=
event
.
detail
.
source
}
state
.
currentSync
=
event
.
detail
.
index
...
...
packages/uni-components/src/vue/editor/quill/index.ts
浏览文件 @
5fe166f3
import
{
extend
}
from
'
@vue/shared
'
import
{
extend
,
isString
}
from
'
@vue/shared
'
import
{
onMounted
,
Ref
,
watch
}
from
'
vue
'
import
QuillClass
,
{
QuillOptionsStatic
,
...
...
@@ -236,7 +236,7 @@ export function useQuill(
}
if
(
delta
.
ops
)
{
delta
.
ops
=
delta
.
ops
.
filter
(({
insert
})
=>
typeof
insert
===
'
string
'
)
.
filter
(({
insert
})
=>
isString
(
insert
)
)
.
map
(({
insert
})
=>
({
insert
}))
}
return
delta
...
...
@@ -371,7 +371,7 @@ export function useQuill(
const
{
delta
,
html
}
=
options
if
(
typeof
delta
===
'
object
'
)
{
quill
.
setContents
(
delta
,
'
silent
'
)
}
else
if
(
typeof
html
===
'
string
'
)
{
}
else
if
(
isString
(
html
)
)
{
quill
.
setContents
(
html2delta
(
html
),
'
silent
'
)
}
else
{
errMsg
=
'
contents is missing
'
...
...
packages/uni-components/src/vue/editor/quill/loadScript.ts
浏览文件 @
5fe166f3
import
{
isString
}
from
'
@vue/shared
'
const
scripts
:
Record
<
string
,
Function
[]
>
=
{}
interface
WindowExt
extends
Window
{
...
...
@@ -9,10 +11,9 @@ export default function loadScript(
src
:
string
,
callback
:
()
=>
void
)
{
const
globalObject
=
typeof
globalName
===
'
string
'
?
(
window
as
WindowExt
)[
globalName
]
:
globalName
const
globalObject
=
isString
(
globalName
)
?
(
window
as
WindowExt
)[
globalName
]
:
globalName
if
(
globalObject
)
{
callback
()
return
...
...
packages/uni-components/src/vue/rich-text/index.tsx
浏览文件 @
5fe166f3
import
{
ref
,
watch
,
getCurrentInstance
,
h
,
VNode
}
from
'
vue
'
import
{
isString
}
from
'
@vue/shared
'
import
{
defineBuiltInComponent
,
useCustomEvent
,
...
...
@@ -35,7 +36,7 @@ export default /*#__PURE__*/ defineBuiltInComponent({
function
renderVNode
()
{
let
nodeList
=
props
.
nodes
if
(
typeof
nodeList
===
'
string
'
)
{
if
(
isString
(
nodeList
)
)
{
nodeList
=
parseHtml
(
props
.
nodes
)
}
_vnode
.
value
=
nodeList2VNode
(
scopeId
,
triggerItemClick
,
nodeList
as
[])
...
...
packages/uni-components/src/vue/rich-text/nodes-parser.ts
浏览文件 @
5fe166f3
import
{
hasOwn
,
extend
,
isPlainObject
,
isArray
}
from
'
@vue/shared
'
import
{
hasOwn
,
extend
,
isPlainObject
,
isArray
,
isString
}
from
'
@vue/shared
'
import
{
getRealPath
}
from
'
@dcloudio/uni-platform
'
import
{
createTextVNode
,
h
,
VNode
}
from
'
vue
'
...
...
@@ -166,11 +166,7 @@ export const nodeList2VNode = /*#__PURE__*/ (
nodeList2VNode
(
scopeId
,
triggerItemClick
,
node
.
children
)
)
}
if
(
node
.
type
===
'
text
'
&&
typeof
node
.
text
===
'
string
'
&&
node
.
text
!==
''
)
if
(
node
.
type
===
'
text
'
&&
isString
(
node
.
text
)
&&
node
.
text
!==
''
)
return
createTextVNode
(
decodeEntities
(
node
.
text
||
''
))
})
}
packages/uni-core/src/helpers/util.ts
浏览文件 @
5fe166f3
import
{
isString
}
from
'
@vue/shared
'
export
function
PolySymbol
(
name
:
string
)
{
return
Symbol
(
__DEV__
?
'
[uni-app]:
'
+
name
:
name
)
}
...
...
@@ -16,7 +17,7 @@ export function rpx2px(str: string | number, replace = false) {
if
(
__NODE_JS__
)
{
return
parseInt
(
str
+
''
)
}
if
(
typeof
str
===
'
string
'
)
{
if
(
isString
(
str
)
)
{
const
res
=
parseInt
(
str
)
||
0
if
(
hasRpx
(
str
))
{
return
uni
.
upx2px
(
res
)
...
...
packages/uni-core/src/view/plugin/componentWxs.ts
浏览文件 @
5fe166f3
...
...
@@ -2,6 +2,7 @@ import { ComponentInternalInstance, ComponentPublicInstance } from 'vue'
import
{
isFunction
,
isPlainObject
,
isString
,
parseStringStyle
,
stringifyStyle
,
}
from
'
@vue/shared
'
...
...
@@ -112,7 +113,7 @@ export class ComponentDescriptor {
if
(
!
this
.
$el
||
!
style
)
{
return
this
}
if
(
typeof
style
===
'
string
'
)
{
if
(
isString
(
style
)
)
{
style
=
parseStringStyle
(
style
)
}
if
(
isPlainObject
(
style
))
{
...
...
packages/uni-h5-vite/src/plugins/css.ts
浏览文件 @
5fe166f3
...
...
@@ -11,7 +11,7 @@ import {
isExternalUrl
,
}
from
'
@dcloudio/uni-cli-shared
'
import
{
OutputOptions
}
from
'
rollup
'
import
{
isFunction
}
from
'
@vue/shared
'
import
{
isFunction
,
isString
}
from
'
@vue/shared
'
function
isCombineBuiltInCss
(
config
:
ResolvedConfig
)
{
return
config
.
command
===
'
build
'
&&
config
.
build
.
cssCodeSplit
...
...
@@ -133,10 +133,10 @@ export function assetFileNamesToFileName(
source
:
content
,
type
:
'
asset
'
,
})
if
(
typeof
assetFileNames
!==
'
string
'
)
{
if
(
!
isString
(
assetFileNames
)
)
{
throw
new
TypeError
(
'
assetFileNames must return a string
'
)
}
}
else
if
(
typeof
assetFileNames
!==
'
string
'
)
{
}
else
if
(
!
isString
(
assetFileNames
)
)
{
throw
new
TypeError
(
'
assetFileNames must be a string or a function
'
)
}
...
...
packages/uni-h5-vite/src/utils/ssr.ts
浏览文件 @
5fe166f3
...
...
@@ -44,7 +44,7 @@ function serializeDefine(define: Record<string, any>): string {
for
(
const
key
in
define
)
{
const
val
=
define
[
key
]
res
+=
`
${
JSON
.
stringify
(
key
)}
:
${
typeof
val
===
'
string
'
?
`(
${
val
}
)`
:
JSON
.
stringify
(
val
)
isString
(
val
)
?
`(
${
val
}
)`
:
JSON
.
stringify
(
val
)
}
, `
}
return
res
+
`}`
...
...
packages/uni-h5/dist/uni-h5.cjs.js
浏览文件 @
5fe166f3
...
...
@@ -2812,11 +2812,11 @@ function useFormField(nameKey, value) {
const
proxy
=
instance
.
proxy
;
return
[
proxy
[
nameKey
],
typeof
value
===
"
string
"
?
proxy
[
value
]
:
value
.
value
shared
.
isString
(
value
)
?
proxy
[
value
]
:
value
.
value
];
},
reset
()
{
if
(
typeof
value
===
"
string
"
)
{
if
(
shared
.
isString
(
value
)
)
{
instance
.
proxy
[
value
]
=
""
;
}
else
{
value
.
value
=
""
;
...
...
@@ -5082,7 +5082,7 @@ const nodeList2VNode = (scopeId, triggerItemClick, nodeList) => {
nodeProps
=
shared
.
extend
(
nodeProps
,
processClickEvent
(
node
,
triggerItemClick
),
node
.
attrs
);
return
vue
.
h
(
node
.
name
,
nodeProps
,
nodeList2VNode
(
scopeId
,
triggerItemClick
,
node
.
children
));
}
if
(
node
.
type
===
"
text
"
&&
typeof
node
.
text
===
"
string
"
&&
node
.
text
!==
""
)
if
(
node
.
type
===
"
text
"
&&
shared
.
isString
(
node
.
text
)
&&
node
.
text
!==
""
)
return
vue
.
createTextVNode
(
decodeEntities
(
node
.
text
||
""
));
});
};
...
...
@@ -5204,7 +5204,7 @@ var index$p = /* @__PURE__ */ defineBuiltInComponent({
}
function
renderVNode
()
{
let
nodeList
=
props2
.
nodes
;
if
(
typeof
nodeList
===
"
string
"
)
{
if
(
shared
.
isString
(
nodeList
)
)
{
nodeList
=
parseHtml
(
props2
.
nodes
);
}
_vnode
.
value
=
nodeList2VNode
(
scopeId
,
triggerItemClick
,
nodeList
);
...
...
@@ -9797,7 +9797,7 @@ const request = /* @__PURE__ */ defineTaskApi(API_REQUEST, ({
let
body
=
null
;
const
contentType
=
normalizeContentType
(
header
);
if
(
method
!==
"
GET
"
)
{
if
(
typeof
data
===
"
string
"
||
data
instanceof
ArrayBuffer
)
{
if
(
shared
.
isString
(
data
)
||
data
instanceof
ArrayBuffer
)
{
body
=
data
;
}
else
{
if
(
contentType
===
"
json
"
)
{
...
...
@@ -9911,7 +9911,7 @@ const STORAGE_KEYS = "uni-storage-keys";
function
parseValue
(
value
)
{
const
types
=
[
"
object
"
,
"
string
"
,
"
number
"
,
"
boolean
"
,
"
undefined
"
];
try
{
const
object
=
typeof
value
===
"
string
"
?
JSON
.
parse
(
value
)
:
value
;
const
object
=
shared
.
isString
(
value
)
?
JSON
.
parse
(
value
)
:
value
;
const
type
=
object
.
type
;
if
(
types
.
indexOf
(
type
)
>=
0
)
{
const
keys
=
Object
.
keys
(
object
);
...
...
@@ -9947,7 +9947,7 @@ const setStorage = /* @__PURE__ */ defineAsyncApi(API_SET_STORAGE, ({ key, data
},
SetStorageProtocol
);
function
getStorageOrigin
(
key
)
{
const
value
=
localStorage
&&
localStorage
.
getItem
(
key
);
if
(
typeof
value
!==
"
string
"
)
{
if
(
!
shared
.
isString
(
value
)
)
{
throw
new
Error
(
"
data not found
"
);
}
let
data
=
value
;
...
...
packages/uni-h5/dist/uni-h5.es.js
浏览文件 @
5fe166f3
...
...
@@ -766,7 +766,7 @@ function rpx2px(str, replace = false) {
if (replace) {
return rpx2pxWithReplace(str);
}
if (
typeof str === "string"
) {
if (
isString(str)
) {
const res = parseInt(str) || 0;
if (hasRpx(str)) {
return uni.upx2px(res);
...
...
@@ -1101,7 +1101,7 @@ class ComponentDescriptor {
if (!this.$el || !style) {
return this;
}
if (
typeof style === "string"
) {
if (
isString(style)
) {
style = parseStringStyle(style);
}
if (isPlainObject(style)) {
...
...
@@ -2911,14 +2911,14 @@ function dedupeHooks(hooks) {
return res;
}
const addInterceptor = /* @__PURE__ */ defineSyncApi(API_ADD_INTERCEPTOR, (method, interceptor) => {
if (
typeof method === "string"
&& isPlainObject(interceptor)) {
if (
isString(method)
&& isPlainObject(interceptor)) {
mergeInterceptorHook(scopedInterceptors[method] || (scopedInterceptors[method] = {}), interceptor);
} else if (isPlainObject(method)) {
mergeInterceptorHook(globalInterceptors, method);
}
}, AddInterceptorProtocol);
const removeInterceptor = /* @__PURE__ */ defineSyncApi(API_REMOVE_INTERCEPTOR, (method, interceptor) => {
if (
typeof method === "string"
) {
if (
isString(method)
) {
if (isPlainObject(interceptor)) {
removeInterceptorHook(scopedInterceptors[method], interceptor);
} else {
...
...
@@ -4937,12 +4937,12 @@ const API_PREVIEW_IMAGE = "previewImage";
const PreviewImageOptions = {
formatArgs: {
urls(urls, params) {
params.urls = urls.map((url) =>
typeof url === "string"
&& url ? getRealPath(url) : "");
params.urls = urls.map((url) =>
isString(url)
&& url ? getRealPath(url) : "");
},
current(current, params) {
if (typeof current === "number") {
params.current = current > 0 && current < params.urls.length ? current : 0;
} else if (
typeof current === "string"
&& current) {
} else if (
isString(current)
&& current) {
params.current = getRealPath(current);
}
}
...
...
@@ -5105,7 +5105,7 @@ const ConnectSocketOptions = {
params.method = elemInArray((value || "").toUpperCase(), HTTP_METHODS);
},
protocols(protocols, params) {
if (
typeof protocols === "string"
) {
if (
isString(protocols)
) {
params.protocols = [protocols];
}
}
...
...
@@ -5132,7 +5132,7 @@ const CloseSocketProtocol = {
reason: String
};
function encodeQueryString(url) {
if (
typeof url !== "string"
) {
if (
!isString(url)
) {
return url;
}
const index2 = url.indexOf("?");
...
...
@@ -7342,7 +7342,7 @@ function makeMap(str) {
}
const scripts = {};
function loadScript(globalName, src, callback) {
const globalObject =
typeof globalName === "string"
? window[globalName] : globalName;
const globalObject =
isString(globalName)
? window[globalName] : globalName;
if (globalObject) {
callback();
return;
...
...
@@ -7776,7 +7776,7 @@ function useQuill(props2, rootRef, trigger) {
return delta;
}
if (delta.ops) {
delta.ops = delta.ops.filter(({ insert }) =>
typeof insert === "string"
).map(({ insert }) => ({ insert }));
delta.ops = delta.ops.filter(({ insert }) =>
isString(insert)
).map(({ insert }) => ({ insert }));
}
return delta;
});
...
...
@@ -7891,7 +7891,7 @@ function useQuill(props2, rootRef, trigger) {
const { delta, html } = options;
if (typeof delta === "object") {
quill.setContents(delta, "silent");
} else if (
typeof html === "string"
) {
} else if (
isString(html)
) {
quill.setContents(html2delta(html), "silent");
} else {
errMsg = "contents is missing";
...
...
@@ -8385,11 +8385,11 @@ function useFormField(nameKey, value) {
const proxy = instance2.proxy;
return [
proxy[nameKey],
typeof value === "string"
? proxy[value] : value.value
isString(value)
? proxy[value] : value.value
];
},
reset() {
if (
typeof value === "string"
) {
if (
isString(value)
) {
instance2.proxy[value] = "";
} else {
value.value = "";
...
...
@@ -11789,7 +11789,7 @@ const nodeList2VNode = (scopeId, triggerItemClick, nodeList) => {
nodeProps = extend(nodeProps, processClickEvent(node, triggerItemClick), node.attrs);
return h(node.name, nodeProps, nodeList2VNode(scopeId, triggerItemClick, node.children));
}
if (node.type === "text" &&
typeof node.text === "string"
&& node.text !== "")
if (node.type === "text" &&
isString(node.text)
&& node.text !== "")
return createTextVNode(decodeEntities(node.text || ""));
});
};
...
...
@@ -11911,7 +11911,7 @@ var index$m = /* @__PURE__ */ defineBuiltInComponent({
}
function renderVNode() {
let nodeList = props2.nodes;
if (
typeof nodeList === "string"
) {
if (
isString(nodeList)
) {
nodeList = parseHtml(props2.nodes);
}
_vnode.value = nodeList2VNode(scopeId, triggerItemClick, nodeList);
...
...
@@ -16981,7 +16981,7 @@ const STORAGE_KEYS = "uni-storage-keys";
function parseValue(value) {
const types = ["object", "string", "number", "boolean", "undefined"];
try {
const object =
typeof value === "string"
? JSON.parse(value) : value;
const object =
isString(value)
? JSON.parse(value) : value;
const type = object.type;
if (types.indexOf(type) >= 0) {
const keys = Object.keys(object);
...
...
@@ -17017,7 +17017,7 @@ const setStorage = /* @__PURE__ */ defineAsyncApi(API_SET_STORAGE, ({ key, data
}, SetStorageProtocol);
function getStorageOrigin(key) {
const value = localStorage && localStorage.getItem(key);
if (
typeof value !== "string"
) {
if (
!isString(value)
) {
throw new Error("data not found");
}
let data = value;
...
...
@@ -17661,7 +17661,7 @@ const request = /* @__PURE__ */ defineTaskApi(API_REQUEST, ({
let body = null;
const contentType = normalizeContentType(header);
if (method !== "GET") {
if (
typeof data === "string"
|| data instanceof ArrayBuffer) {
if (
isString(data)
|| data instanceof ArrayBuffer) {
body = data;
} else {
if (contentType === "json") {
...
...
@@ -18048,7 +18048,7 @@ ${e2};at socketTask.on${capitalize(name)} callback function
try {
const code = options.code || 1e3;
const reason = options.reason;
if (
typeof reason === "string"
) {
if (
isString(reason)
) {
ws.close(code, reason);
} else {
ws.close(code);
...
...
packages/uni-h5/src/service/api/network/request.ts
浏览文件 @
5fe166f3
import
{
hasOwn
}
from
'
@vue/shared
'
import
{
hasOwn
,
isString
}
from
'
@vue/shared
'
import
{
API_REQUEST
,
API_TYPE_REQUEST
,
...
...
@@ -27,7 +27,7 @@ export const request = defineTaskApi<API_TYPE_REQUEST>(
// 根据请求类型处理数据
const
contentType
=
normalizeContentType
(
header
)
if
(
method
!==
'
GET
'
)
{
if
(
typeof
data
===
'
string
'
||
data
instanceof
ArrayBuffer
)
{
if
(
isString
(
data
)
||
data
instanceof
ArrayBuffer
)
{
body
=
data
}
else
{
if
(
contentType
===
'
json
'
)
{
...
...
packages/uni-h5/src/service/api/network/socket.ts
浏览文件 @
5fe166f3
import
{
extend
,
capitalize
,
isFunction
}
from
'
@vue/shared
'
import
{
extend
,
capitalize
,
isFunction
,
isString
}
from
'
@vue/shared
'
import
{
defineTaskApi
,
defineAsyncApi
,
...
...
@@ -133,7 +133,7 @@ class SocketTask implements UniApp.SocketTask {
try
{
const
code
=
options
.
code
||
1000
const
reason
=
options
.
reason
if
(
typeof
reason
===
'
string
'
)
{
if
(
isString
(
reason
)
)
{
ws
.
close
(
code
,
reason
)
}
else
{
ws
.
close
(
code
)
...
...
packages/uni-h5/src/service/api/storage/storage.ts
浏览文件 @
5fe166f3
import
{
isString
}
from
'
@vue/shared
'
import
{
defineSyncApi
,
defineAsyncApi
,
...
...
@@ -25,7 +27,7 @@ const STORAGE_KEYS = 'uni-storage-keys'
function
parseValue
(
value
:
any
)
{
const
types
=
[
'
object
'
,
'
string
'
,
'
number
'
,
'
boolean
'
,
'
undefined
'
]
try
{
const
object
=
typeof
value
===
'
string
'
?
JSON
.
parse
(
value
)
:
value
const
object
=
isString
(
value
)
?
JSON
.
parse
(
value
)
:
value
const
type
=
object
.
type
if
(
types
.
indexOf
(
type
)
>=
0
)
{
const
keys
=
Object
.
keys
(
object
)
...
...
@@ -80,7 +82,7 @@ export const setStorage = <API_TYPE_SET_STORAGE>defineAsyncApi(
function
getStorageOrigin
(
key
:
string
):
any
{
const
value
=
localStorage
&&
localStorage
.
getItem
(
key
)
if
(
typeof
value
!==
'
string
'
)
{
if
(
!
isString
(
value
)
)
{
throw
new
Error
(
'
data not found
'
)
}
let
data
:
any
=
value
...
...
packages/uni-mp-alipay/dist/uni.api.esm.js
浏览文件 @
5fe166f3
...
...
@@ -460,7 +460,7 @@ function dedupeHooks(hooks) {
return
res
;
}
const
addInterceptor
=
defineSyncApi
(
API_ADD_INTERCEPTOR
,
(
method
,
interceptor
)
=>
{
if
(
typeof
method
===
'
string
'
&&
isPlainObject
(
interceptor
))
{
if
(
isString
(
method
)
&&
isPlainObject
(
interceptor
))
{
mergeInterceptorHook
(
scopedInterceptors
[
method
]
||
(
scopedInterceptors
[
method
]
=
{}),
interceptor
);
}
else
if
(
isPlainObject
(
method
))
{
...
...
@@ -468,7 +468,7 @@ const addInterceptor = defineSyncApi(API_ADD_INTERCEPTOR, (method, interceptor)
}
},
AddInterceptorProtocol
);
const
removeInterceptor
=
defineSyncApi
(
API_REMOVE_INTERCEPTOR
,
(
method
,
interceptor
)
=>
{
if
(
typeof
method
===
'
string
'
)
{
if
(
isString
(
method
)
)
{
if
(
isPlainObject
(
interceptor
))
{
removeInterceptorHook
(
scopedInterceptors
[
method
],
interceptor
);
}
...
...
packages/uni-mp-baidu/dist/uni.api.esm.js
浏览文件 @
5fe166f3
...
...
@@ -460,7 +460,7 @@ function dedupeHooks(hooks) {
return
res
;
}
const
addInterceptor
=
defineSyncApi
(
API_ADD_INTERCEPTOR
,
(
method
,
interceptor
)
=>
{
if
(
typeof
method
===
'
string
'
&&
isPlainObject
(
interceptor
))
{
if
(
isString
(
method
)
&&
isPlainObject
(
interceptor
))
{
mergeInterceptorHook
(
scopedInterceptors
[
method
]
||
(
scopedInterceptors
[
method
]
=
{}),
interceptor
);
}
else
if
(
isPlainObject
(
method
))
{
...
...
@@ -468,7 +468,7 @@ const addInterceptor = defineSyncApi(API_ADD_INTERCEPTOR, (method, interceptor)
}
},
AddInterceptorProtocol
);
const
removeInterceptor
=
defineSyncApi
(
API_REMOVE_INTERCEPTOR
,
(
method
,
interceptor
)
=>
{
if
(
typeof
method
===
'
string
'
)
{
if
(
isString
(
method
)
)
{
if
(
isPlainObject
(
interceptor
))
{
removeInterceptorHook
(
scopedInterceptors
[
method
],
interceptor
);
}
...
...
@@ -1036,7 +1036,7 @@ const getProvider = initGetProvider({
});
function
requestPayment
(
params
)
{
let
parseError
=
false
;
if
(
typeof
params
.
orderInfo
===
'
string
'
)
{
if
(
isString
(
params
.
orderInfo
)
)
{
try
{
params
.
orderInfo
=
JSON
.
parse
(
params
.
orderInfo
);
}
...
...
packages/uni-mp-baidu/src/api/shims.ts
浏览文件 @
5fe166f3
import
{
isString
}
from
'
@vue/shared
'
import
{
initGetProvider
}
from
'
@dcloudio/uni-mp-core
'
export
const
getProvider
=
initGetProvider
({
...
...
@@ -9,7 +10,7 @@ export const getProvider = initGetProvider({
export
function
requestPayment
(
params
:
UniApp
.
RequestPaymentOptions
)
{
let
parseError
=
false
if
(
typeof
params
.
orderInfo
===
'
string
'
)
{
if
(
isString
(
params
.
orderInfo
)
)
{
try
{
params
.
orderInfo
=
JSON
.
parse
(
params
.
orderInfo
)
}
catch
(
e
)
{
...
...
packages/uni-mp-kuaishou/dist/uni.api.esm.js
浏览文件 @
5fe166f3
...
...
@@ -460,7 +460,7 @@ function dedupeHooks(hooks) {
return
res
;
}
const
addInterceptor
=
defineSyncApi
(
API_ADD_INTERCEPTOR
,
(
method
,
interceptor
)
=>
{
if
(
typeof
method
===
'
string
'
&&
isPlainObject
(
interceptor
))
{
if
(
isString
(
method
)
&&
isPlainObject
(
interceptor
))
{
mergeInterceptorHook
(
scopedInterceptors
[
method
]
||
(
scopedInterceptors
[
method
]
=
{}),
interceptor
);
}
else
if
(
isPlainObject
(
method
))
{
...
...
@@ -468,7 +468,7 @@ const addInterceptor = defineSyncApi(API_ADD_INTERCEPTOR, (method, interceptor)
}
},
AddInterceptorProtocol
);
const
removeInterceptor
=
defineSyncApi
(
API_REMOVE_INTERCEPTOR
,
(
method
,
interceptor
)
=>
{
if
(
typeof
method
===
'
string
'
)
{
if
(
isString
(
method
)
)
{
if
(
isPlainObject
(
interceptor
))
{
removeInterceptorHook
(
scopedInterceptors
[
method
],
interceptor
);
}
...
...
packages/uni-mp-lark/dist/uni.api.esm.js
浏览文件 @
5fe166f3
...
...
@@ -460,7 +460,7 @@ function dedupeHooks(hooks) {
return
res
;
}
const
addInterceptor
=
defineSyncApi
(
API_ADD_INTERCEPTOR
,
(
method
,
interceptor
)
=>
{
if
(
typeof
method
===
'
string
'
&&
isPlainObject
(
interceptor
))
{
if
(
isString
(
method
)
&&
isPlainObject
(
interceptor
))
{
mergeInterceptorHook
(
scopedInterceptors
[
method
]
||
(
scopedInterceptors
[
method
]
=
{}),
interceptor
);
}
else
if
(
isPlainObject
(
method
))
{
...
...
@@ -468,7 +468,7 @@ const addInterceptor = defineSyncApi(API_ADD_INTERCEPTOR, (method, interceptor)
}
},
AddInterceptorProtocol
);
const
removeInterceptor
=
defineSyncApi
(
API_REMOVE_INTERCEPTOR
,
(
method
,
interceptor
)
=>
{
if
(
typeof
method
===
'
string
'
)
{
if
(
isString
(
method
)
)
{
if
(
isPlainObject
(
interceptor
))
{
removeInterceptorHook
(
scopedInterceptors
[
method
],
interceptor
);
}
...
...
packages/uni-mp-qq/dist/uni.api.esm.js
浏览文件 @
5fe166f3
...
...
@@ -460,7 +460,7 @@ function dedupeHooks(hooks) {
return
res
;
}
const
addInterceptor
=
defineSyncApi
(
API_ADD_INTERCEPTOR
,
(
method
,
interceptor
)
=>
{
if
(
typeof
method
===
'
string
'
&&
isPlainObject
(
interceptor
))
{
if
(
isString
(
method
)
&&
isPlainObject
(
interceptor
))
{
mergeInterceptorHook
(
scopedInterceptors
[
method
]
||
(
scopedInterceptors
[
method
]
=
{}),
interceptor
);
}
else
if
(
isPlainObject
(
method
))
{
...
...
@@ -468,7 +468,7 @@ const addInterceptor = defineSyncApi(API_ADD_INTERCEPTOR, (method, interceptor)
}
},
AddInterceptorProtocol
);
const
removeInterceptor
=
defineSyncApi
(
API_REMOVE_INTERCEPTOR
,
(
method
,
interceptor
)
=>
{
if
(
typeof
method
===
'
string
'
)
{
if
(
isString
(
method
)
)
{
if
(
isPlainObject
(
interceptor
))
{
removeInterceptorHook
(
scopedInterceptors
[
method
],
interceptor
);
}
...
...
packages/uni-mp-toutiao/dist/uni.api.esm.js
浏览文件 @
5fe166f3
...
...
@@ -460,7 +460,7 @@ function dedupeHooks(hooks) {
return
res
;
}
const
addInterceptor
=
defineSyncApi
(
API_ADD_INTERCEPTOR
,
(
method
,
interceptor
)
=>
{
if
(
typeof
method
===
'
string
'
&&
isPlainObject
(
interceptor
))
{
if
(
isString
(
method
)
&&
isPlainObject
(
interceptor
))
{
mergeInterceptorHook
(
scopedInterceptors
[
method
]
||
(
scopedInterceptors
[
method
]
=
{}),
interceptor
);
}
else
if
(
isPlainObject
(
method
))
{
...
...
@@ -468,7 +468,7 @@ const addInterceptor = defineSyncApi(API_ADD_INTERCEPTOR, (method, interceptor)
}
},
AddInterceptorProtocol
);
const
removeInterceptor
=
defineSyncApi
(
API_REMOVE_INTERCEPTOR
,
(
method
,
interceptor
)
=>
{
if
(
typeof
method
===
'
string
'
)
{
if
(
isString
(
method
)
)
{
if
(
isPlainObject
(
interceptor
))
{
removeInterceptorHook
(
scopedInterceptors
[
method
],
interceptor
);
}
...
...
packages/uni-mp-weixin/dist/uni.api.esm.js
浏览文件 @
5fe166f3
...
...
@@ -424,7 +424,7 @@ function dedupeHooks(hooks) {
return
res
;
}
const
addInterceptor
=
defineSyncApi
(
API_ADD_INTERCEPTOR
,
(
method
,
interceptor
)
=>
{
if
(
typeof
method
===
'
string
'
&&
isPlainObject
(
interceptor
))
{
if
(
isString
(
method
)
&&
isPlainObject
(
interceptor
))
{
mergeInterceptorHook
(
scopedInterceptors
[
method
]
||
(
scopedInterceptors
[
method
]
=
{}),
interceptor
);
}
else
if
(
isPlainObject
(
method
))
{
...
...
@@ -432,7 +432,7 @@ const addInterceptor = defineSyncApi(API_ADD_INTERCEPTOR, (method, interceptor)
}
},
AddInterceptorProtocol
);
const
removeInterceptor
=
defineSyncApi
(
API_REMOVE_INTERCEPTOR
,
(
method
,
interceptor
)
=>
{
if
(
typeof
method
===
'
string
'
)
{
if
(
isString
(
method
)
)
{
if
(
isPlainObject
(
interceptor
))
{
removeInterceptorHook
(
scopedInterceptors
[
method
],
interceptor
);
}
...
...
packages/uni-quickapp-webview/dist/uni.api.esm.js
浏览文件 @
5fe166f3
...
...
@@ -460,7 +460,7 @@ function dedupeHooks(hooks) {
return
res
;
}
const
addInterceptor
=
defineSyncApi
(
API_ADD_INTERCEPTOR
,
(
method
,
interceptor
)
=>
{
if
(
typeof
method
===
'
string
'
&&
isPlainObject
(
interceptor
))
{
if
(
isString
(
method
)
&&
isPlainObject
(
interceptor
))
{
mergeInterceptorHook
(
scopedInterceptors
[
method
]
||
(
scopedInterceptors
[
method
]
=
{}),
interceptor
);
}
else
if
(
isPlainObject
(
method
))
{
...
...
@@ -468,7 +468,7 @@ const addInterceptor = defineSyncApi(API_ADD_INTERCEPTOR, (method, interceptor)
}
},
AddInterceptorProtocol
);
const
removeInterceptor
=
defineSyncApi
(
API_REMOVE_INTERCEPTOR
,
(
method
,
interceptor
)
=>
{
if
(
typeof
method
===
'
string
'
)
{
if
(
isString
(
method
)
)
{
if
(
isPlainObject
(
interceptor
))
{
removeInterceptorHook
(
scopedInterceptors
[
method
],
interceptor
);
}
...
...
packages/uni-shared/dist/uni-shared.cjs.js
浏览文件 @
5fe166f3
...
...
@@ -373,7 +373,7 @@ function formatDateTime({ date = new Date(), mode = 'date' }) {
}
function
callOptions
(
options
,
data
)
{
options
=
options
||
{};
if
(
typeof
data
===
'
string
'
)
{
if
(
shared
.
isString
(
data
)
)
{
data
=
{
errMsg
:
data
,
};
...
...
packages/uni-shared/dist/uni-shared.es.js
浏览文件 @
5fe166f3
import
{
isHTMLTag
,
isSVGTag
,
hyphenate
,
camelize
,
is
Function
,
isString
,
isPlainObject
,
extend
,
isArray
,
toTypeString
,
toRawType
,
capitalize
}
from
'
@vue/shared
'
;
import
{
isHTMLTag
,
isSVGTag
,
hyphenate
,
camelize
,
is
String
,
isFunction
,
isPlainObject
,
extend
,
isArray
,
toTypeString
,
toRawType
,
capitalize
}
from
'
@vue/shared
'
;
const
BUILT_IN_TAG_NAMES
=
[
'
ad
'
,
...
...
@@ -369,7 +369,7 @@ function formatDateTime({ date = new Date(), mode = 'date' }) {
}
function
callOptions
(
options
,
data
)
{
options
=
options
||
{};
if
(
typeof
data
===
'
string
'
)
{
if
(
isString
(
data
)
)
{
data
=
{
errMsg
:
data
,
};
...
...
packages/uni-shared/src/utils.ts
浏览文件 @
5fe166f3
...
...
@@ -95,7 +95,7 @@ export function callOptions(
data
:
{
[
key
:
string
]:
any
;
errMsg
:
string
}
|
string
):
void
{
options
=
options
||
{}
if
(
typeof
data
===
'
string
'
)
{
if
(
isString
(
data
)
)
{
data
=
{
errMsg
:
data
,
}
...
...
packages/vite-plugin-uni/src/configResolved/index.ts
浏览文件 @
5fe166f3
import
{
Plugin
,
ResolvedConfig
}
from
'
vite
'
import
{
extend
}
from
'
@vue/shared
'
import
{
extend
,
isString
}
from
'
@vue/shared
'
import
{
checkUpdate
,
isWindows
,
...
...
@@ -31,7 +31,7 @@ export function createConfigResolved(options: VitePluginUniResolvedOptions) {
// TODO 等 https://github.com/vitejs/vite/issues/3331 修复后,可以移除下列代码
// 2.8.0 已修复,但为了兼容旧版本,先不移除
const
item
=
config
.
resolve
.
alias
.
find
((
item
)
=>
typeof
item
.
find
!==
'
string
'
?
item
.
find
.
test
(
'
@/
'
)
:
false
!
isString
(
item
.
find
)
?
item
.
find
.
test
(
'
@/
'
)
:
false
)
if
(
item
)
{
item
.
customResolver
=
customResolver
...
...
packages/vite-plugin-uni/src/configResolved/plugins/index.ts
浏览文件 @
5fe166f3
import
path
from
'
path
'
import
debug
from
'
debug
'
import
{
extend
}
from
'
@vue/shared
'
import
{
extend
,
isString
}
from
'
@vue/shared
'
import
{
Plugin
,
ResolvedConfig
}
from
'
vite
'
import
{
FilterPattern
}
from
'
@rollup/pluginutils
'
...
...
@@ -89,7 +89,7 @@ function addPlugin(
index
:
string
|
number
,
type
:
'
pre
'
|
'
post
'
=
'
post
'
)
{
if
(
typeof
index
===
'
string
'
)
{
if
(
isString
(
index
)
)
{
index
=
plugins
.
findIndex
((
plugin
)
=>
(
plugin
as
Plugin
).
name
===
index
)
}
return
plugins
.
splice
(
index
+
(
type
===
'
pre
'
?
0
:
1
),
0
,
plugin
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录