Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
ChenYFan_OHHH
uni-app
提交
ce02c608
U
uni-app
项目概览
ChenYFan_OHHH
/
uni-app
与 Fork 源项目一致
Fork自
DCloud / uni-app
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
U
uni-app
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
ce02c608
编写于
2月 19, 2021
作者:
fxy060608
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat(h5): build treeshaking for api
上级
b74ce0ad
变更
11
隐藏空白更改
内联
并排
Showing
11 changed file
with
61 addition
and
49 deletion
+61
-49
packages/uni-api/src/helpers/api/index.ts
packages/uni-api/src/helpers/api/index.ts
+28
-11
packages/uni-h5-vue/dist/vue.runtime.esm.js
packages/uni-h5-vue/dist/vue.runtime.esm.js
+1
-7
packages/uni-h5-vue/src/index.ts
packages/uni-h5-vue/src/index.ts
+0
-7
packages/uni-h5/dist/uni-h5.esm.js
packages/uni-h5/dist/uni-h5.esm.js
+5
-4
packages/uni-mp-alipay/dist/uni.api.esm.js
packages/uni-mp-alipay/dist/uni.api.esm.js
+4
-3
packages/uni-mp-baidu/dist/uni.api.esm.js
packages/uni-mp-baidu/dist/uni.api.esm.js
+4
-3
packages/uni-mp-qq/dist/uni.api.esm.js
packages/uni-mp-qq/dist/uni.api.esm.js
+4
-3
packages/uni-mp-toutiao/dist/uni.api.esm.js
packages/uni-mp-toutiao/dist/uni.api.esm.js
+4
-3
packages/uni-mp-weixin/dist/uni.api.esm.js
packages/uni-mp-weixin/dist/uni.api.esm.js
+4
-3
packages/uni-quickapp-webview/dist/uni.api.esm.js
packages/uni-quickapp-webview/dist/uni.api.esm.js
+4
-3
packages/vite-plugin-uni/src/load/main.ts
packages/vite-plugin-uni/src/load/main.ts
+3
-2
未找到文件。
packages/uni-api/src/helpers/api/index.ts
浏览文件 @
ce02c608
...
...
@@ -19,11 +19,8 @@ type API_TYPES =
|
typeof
API_TYPE_SYNC
|
typeof
API_TYPE_ASYNC
function
validateProtocol
(
_name
:
string
,
_args
:
any
[],
_protocol
:
ApiProtocols
)
{
function
validateProtocol
(
name
:
string
,
args
:
any
[],
protocol
:
ApiProtocols
)
{
console
.
log
(
'
validateProtocol
'
,
name
,
args
,
protocol
)
return
true
}
...
...
@@ -71,10 +68,16 @@ function wrapperApi<T extends Function>(
export
function
createOnApi
<
T
extends
Function
>
(
name
:
string
,
fn
:
T
,
options
?:
ApiOption
s
,
protocol
?:
ApiProtocol
s
protocol
?:
ApiProtocol
s
,
options
?:
ApiOption
s
)
{
return
createApi
(
API_TYPE_ON
,
name
,
fn
,
protocol
,
options
)
return
createApi
(
API_TYPE_ON
,
name
,
fn
,
__DEV__
?
protocol
:
undefined
,
options
)
}
export
function
createTaskApi
<
T
extends
Function
>
(
...
...
@@ -83,7 +86,13 @@ export function createTaskApi<T extends Function>(
protocol
?:
ApiProtocols
,
options
?:
ApiOptions
)
{
return
createApi
(
API_TYPE_TASK
,
name
,
fn
,
protocol
,
options
)
return
createApi
(
API_TYPE_TASK
,
name
,
fn
,
__DEV__
?
protocol
:
undefined
,
options
)
}
export
function
createSyncApi
<
T
extends
Function
>
(
...
...
@@ -92,7 +101,13 @@ export function createSyncApi<T extends Function>(
protocol
?:
ApiProtocols
,
options
?:
ApiOptions
)
{
return
createApi
(
API_TYPE_SYNC
,
name
,
fn
,
protocol
,
options
)
return
createApi
(
API_TYPE_SYNC
,
name
,
fn
,
__DEV__
?
protocol
:
undefined
,
options
)
}
export
function
createAsyncApi
<
T
extends
Function
>
(
...
...
@@ -101,7 +116,9 @@ export function createAsyncApi<T extends Function>(
protocol
?:
ApiProtocols
,
options
?:
ApiOptions
)
{
return
promisify
(
createApi
(
API_TYPE_ASYNC
,
name
,
fn
,
protocol
,
options
))
return
promisify
(
createApi
(
API_TYPE_ASYNC
,
name
,
fn
,
__DEV__
?
protocol
:
undefined
,
options
)
)
}
function
createApi
<
T
extends
Function
>
(
...
...
packages/uni-h5-vue/dist/vue.runtime.esm.js
浏览文件 @
ce02c608
import
{
plugin
}
from
'
@dcloudio/uni-h5
'
;
import
{
isSymbol
,
extend
,
isMap
,
isObject
,
toRawType
,
def
,
isArray
,
isString
,
isFunction
,
isPromise
,
toHandlerKey
,
remove
,
EMPTY_OBJ
,
camelize
,
capitalize
,
EMPTY_ARR
,
normalizeClass
,
normalizeStyle
,
isOn
,
NOOP
,
isGloballyWhitelisted
,
toNumber
,
invokeArrayFns
,
looseIndexOf
,
isSet
,
looseEqual
,
hyphenate
,
isHTMLTag
,
isSVGTag
,
isIntegerKey
,
hasOwn
,
hasChanged
,
getGlobalThis
,
isReservedProp
,
NO
,
isModelListener
,
makeMap
,
isSpecialBooleanAttr
}
from
'
@vue/shared
'
;
export
{
camelize
,
capitalize
,
toDisplayString
,
toHandlerKey
}
from
'
@vue/shared
'
;
...
...
@@ -9122,9 +9121,4 @@ const onNavigationBarSearchInputClicked = /*#__PURE__*/ createHook$1("onNavigati
const
onNavigationBarSearchInputConfirmed
=
/*#__PURE__*/
createHook$1
(
"
onNavigationBarSearchInputConfirmed
"
/* ON_NAVIGATION_BAR_SEARCH_INPUT_CONFIRMED */
);
const
onNavigationBarSearchInputFocusChanged
=
/*#__PURE__*/
createHook$1
(
"
onNavigationBarSearchInputFocusChanged
"
/* ON_NAVIGATION_BAR_SEARCH_INPUT_FOCUS_CHANGED */
);
function
createApp
(
rootComponent
,
rootProps
=
null
)
{
rootComponent
&&
(
rootComponent
.
mpType
=
'
app
'
);
return
createVueApp
(
rootComponent
,
rootProps
).
use
(
plugin
);
}
export
{
BaseTransition
,
Comment
,
Fragment
,
KeepAlive
,
Static
,
Suspense
,
Teleport
,
Text
,
Transition
,
TransitionGroup
,
callWithAsyncErrorHandling
,
callWithErrorHandling
,
cloneVNode
,
compile$1
as
compile
,
computed$1
as
computed
,
createApp
,
createBlock
,
createCommentVNode
,
createHook$1
as
createHook
,
createHydrationRenderer
,
createRenderer
,
createSSRApp
,
createSlots
,
createStaticVNode
,
createTextVNode
,
createVNode
,
createVueApp
,
customRef
,
defineAsyncComponent
,
defineComponent
,
defineEmit
,
defineProps
,
devtools
,
getCurrentInstance
,
getTransitionRawChildren
,
h
,
handleError
,
hydrate
,
initCustomFormatter
,
inject
,
injectHook
,
isInSSRComponentSetup
,
isProxy
,
isReactive
,
isReadonly
,
isRef
,
isVNode
,
markRaw
,
mergeProps
,
nextTick
,
onActivated
,
onAddToFavorites
,
onBackPress
,
onBeforeMount
,
onBeforeUnmount
,
onBeforeUpdate
,
onDeactivated
,
onError
,
onErrorCaptured
,
onHide
,
onLaunch
,
onLoad
,
onMounted
,
onNavigationBarButtonTap
,
onNavigationBarSearchInputChanged
,
onNavigationBarSearchInputClicked
,
onNavigationBarSearchInputConfirmed
,
onNavigationBarSearchInputFocusChanged
,
onPageNotFound
,
onPageScroll
,
onPullDownRefresh
,
onReachBottom
,
onReady
,
onRenderTracked
,
onRenderTriggered
,
onResize
,
onShareAppMessage
,
onShareTimeline
,
onShow
,
onTabItemTap
,
onThemeChange
,
onUnhandledRejection
,
onUnload
,
onUnmounted
,
onUpdated
,
openBlock
,
popScopeId
,
provide
,
proxyRefs
,
pushScopeId
,
queuePostFlushCb
,
reactive
,
readonly
,
ref
,
registerRuntimeCompiler
,
render
,
renderList
,
renderSlot
,
resolveComponent
,
resolveDirective
,
resolveDynamicComponent
,
resolveTransitionHooks
,
setBlockTracking
,
setDevtoolsHook
,
setTransitionHooks
,
shallowReactive
,
shallowReadonly
,
shallowRef
,
ssrContextKey
,
ssrUtils
,
toHandlers
,
toRaw
,
toRef
,
toRefs
,
transformVNodeArgs
,
triggerRef
,
unref
,
useContext
,
useCssModule
,
useCssVars
,
useSSRContext
,
useTransitionState
,
vModelCheckbox
,
vModelDynamic
,
vModelRadio
,
vModelSelect
,
vModelText
,
vShow
,
version
,
warn
,
watch
,
watchEffect
,
withCtx
,
withDirectives
,
withKeys
,
withModifiers
,
withScopeId
};
export
{
BaseTransition
,
Comment
,
Fragment
,
KeepAlive
,
Static
,
Suspense
,
Teleport
,
Text
,
Transition
,
TransitionGroup
,
callWithAsyncErrorHandling
,
callWithErrorHandling
,
cloneVNode
,
compile$1
as
compile
,
computed$1
as
computed
,
createBlock
,
createCommentVNode
,
createHook$1
as
createHook
,
createHydrationRenderer
,
createRenderer
,
createSSRApp
,
createSlots
,
createStaticVNode
,
createTextVNode
,
createVNode
,
createVueApp
,
customRef
,
defineAsyncComponent
,
defineComponent
,
defineEmit
,
defineProps
,
devtools
,
getCurrentInstance
,
getTransitionRawChildren
,
h
,
handleError
,
hydrate
,
initCustomFormatter
,
inject
,
injectHook
,
isInSSRComponentSetup
,
isProxy
,
isReactive
,
isReadonly
,
isRef
,
isVNode
,
markRaw
,
mergeProps
,
nextTick
,
onActivated
,
onAddToFavorites
,
onBackPress
,
onBeforeMount
,
onBeforeUnmount
,
onBeforeUpdate
,
onDeactivated
,
onError
,
onErrorCaptured
,
onHide
,
onLaunch
,
onLoad
,
onMounted
,
onNavigationBarButtonTap
,
onNavigationBarSearchInputChanged
,
onNavigationBarSearchInputClicked
,
onNavigationBarSearchInputConfirmed
,
onNavigationBarSearchInputFocusChanged
,
onPageNotFound
,
onPageScroll
,
onPullDownRefresh
,
onReachBottom
,
onReady
,
onRenderTracked
,
onRenderTriggered
,
onResize
,
onShareAppMessage
,
onShareTimeline
,
onShow
,
onTabItemTap
,
onThemeChange
,
onUnhandledRejection
,
onUnload
,
onUnmounted
,
onUpdated
,
openBlock
,
popScopeId
,
provide
,
proxyRefs
,
pushScopeId
,
queuePostFlushCb
,
reactive
,
readonly
,
ref
,
registerRuntimeCompiler
,
render
,
renderList
,
renderSlot
,
resolveComponent
,
resolveDirective
,
resolveDynamicComponent
,
resolveTransitionHooks
,
setBlockTracking
,
setDevtoolsHook
,
setTransitionHooks
,
shallowReactive
,
shallowReadonly
,
shallowRef
,
ssrContextKey
,
ssrUtils
,
toHandlers
,
toRaw
,
toRef
,
toRefs
,
transformVNodeArgs
,
triggerRef
,
unref
,
useContext
,
useCssModule
,
useCssVars
,
useSSRContext
,
useTransitionState
,
vModelCheckbox
,
vModelDynamic
,
vModelRadio
,
vModelSelect
,
vModelText
,
vShow
,
version
,
warn
,
watch
,
watchEffect
,
withCtx
,
withDirectives
,
withKeys
,
withModifiers
,
withScopeId
};
packages/uni-h5-vue/src/index.ts
浏览文件 @
ce02c608
import
{
plugin
}
from
'
@dcloudio/uni-h5
'
// @ts-ignore
import
{
createVueApp
}
from
'
../lib/vue.runtime.esm.js
'
export
function
createApp
(
rootComponent
:
unknown
,
rootProps
=
null
)
{
rootComponent
&&
((
rootComponent
as
any
).
mpType
=
'
app
'
)
return
createVueApp
(
rootComponent
,
rootProps
).
use
(
plugin
)
}
// @ts-ignore
export
*
from
'
../lib/vue.runtime.esm.js
'
export
*
from
'
@dcloudio/uni-vue/src/apiLifecycle
'
packages/uni-h5/dist/uni-h5.esm.js
浏览文件 @
ce02c608
...
...
@@ -1407,7 +1407,8 @@ const API_TYPE_ON = 0;
const
API_TYPE_TASK
=
1
;
const
API_TYPE_SYNC
=
2
;
const
API_TYPE_ASYNC
=
3
;
function
validateProtocol
(
_name
,
_args
,
_protocol
)
{
function
validateProtocol
(
name
,
args
,
protocol
)
{
console
.
log
(
"
validateProtocol
"
,
name
,
args
,
protocol
);
return
true
;
}
function
formatApiArgs
(
args
,
options
)
{
...
...
@@ -1433,16 +1434,16 @@ function wrapperAsyncApi(name, fn, options) {
}
function
wrapperApi
(
fn
,
name
,
protocol
,
options
)
{
return
function
(...
args
)
{
if
(
!
(
process
.
env
.
NODE_ENV
!==
"
production
"
&&
protocol
&&
!
validateProtocol
()))
{
if
(
!
(
process
.
env
.
NODE_ENV
!==
"
production
"
&&
protocol
&&
!
validateProtocol
(
name
,
args
,
protocol
)))
{
return
fn
.
apply
(
null
,
formatApiArgs
(
args
));
}
};
}
function
createSyncApi
(
name
,
fn
,
protocol
,
options
)
{
return
createApi
(
API_TYPE_SYNC
,
name
,
fn
,
pro
tocol
,
options
);
return
createApi
(
API_TYPE_SYNC
,
name
,
fn
,
pro
cess
.
env
.
NODE_ENV
!==
"
production
"
?
protocol
:
void
0
,
options
);
}
function
createAsyncApi
(
name
,
fn
,
protocol
,
options
)
{
return
promisify
(
createApi
(
API_TYPE_ASYNC
,
name
,
fn
,
pro
tocol
,
options
));
return
promisify
(
createApi
(
API_TYPE_ASYNC
,
name
,
fn
,
pro
cess
.
env
.
NODE_ENV
!==
"
production
"
?
protocol
:
void
0
,
options
));
}
function
createApi
(
type
,
name
,
fn
,
protocol
,
options
)
{
switch
(
type
)
{
...
...
packages/uni-mp-alipay/dist/uni.api.esm.js
浏览文件 @
ce02c608
...
...
@@ -113,7 +113,8 @@ const API_TYPE_ON = 0;
const
API_TYPE_TASK
=
1
;
const
API_TYPE_SYNC
=
2
;
const
API_TYPE_ASYNC
=
3
;
function
validateProtocol
(
_name
,
_args
,
_protocol
)
{
function
validateProtocol
(
name
,
args
,
protocol
)
{
console
.
log
(
'
validateProtocol
'
,
name
,
args
,
protocol
);
return
true
;
}
function
formatApiArgs
(
args
,
options
)
{
...
...
@@ -139,13 +140,13 @@ function wrapperAsyncApi(name, fn, options) {
}
function
wrapperApi
(
fn
,
name
,
protocol
,
options
)
{
return
function
(...
args
)
{
if
(
!
((
process
.
env
.
NODE_ENV
!==
'
production
'
)
&&
protocol
&&
!
validateProtocol
()))
{
if
(
!
((
process
.
env
.
NODE_ENV
!==
'
production
'
)
&&
protocol
&&
!
validateProtocol
(
name
,
args
,
protocol
)))
{
return
fn
.
apply
(
null
,
formatApiArgs
(
args
));
}
};
}
function
createSyncApi
(
name
,
fn
,
protocol
,
options
)
{
return
createApi
(
API_TYPE_SYNC
,
name
,
fn
,
protocol
,
options
);
return
createApi
(
API_TYPE_SYNC
,
name
,
fn
,
(
process
.
env
.
NODE_ENV
!==
'
production
'
)
?
protocol
:
undefined
,
options
);
}
function
createApi
(
type
,
name
,
fn
,
protocol
,
options
)
{
switch
(
type
)
{
...
...
packages/uni-mp-baidu/dist/uni.api.esm.js
浏览文件 @
ce02c608
...
...
@@ -113,7 +113,8 @@ const API_TYPE_ON = 0;
const
API_TYPE_TASK
=
1
;
const
API_TYPE_SYNC
=
2
;
const
API_TYPE_ASYNC
=
3
;
function
validateProtocol
(
_name
,
_args
,
_protocol
)
{
function
validateProtocol
(
name
,
args
,
protocol
)
{
console
.
log
(
'
validateProtocol
'
,
name
,
args
,
protocol
);
return
true
;
}
function
formatApiArgs
(
args
,
options
)
{
...
...
@@ -139,13 +140,13 @@ function wrapperAsyncApi(name, fn, options) {
}
function
wrapperApi
(
fn
,
name
,
protocol
,
options
)
{
return
function
(...
args
)
{
if
(
!
((
process
.
env
.
NODE_ENV
!==
'
production
'
)
&&
protocol
&&
!
validateProtocol
()))
{
if
(
!
((
process
.
env
.
NODE_ENV
!==
'
production
'
)
&&
protocol
&&
!
validateProtocol
(
name
,
args
,
protocol
)))
{
return
fn
.
apply
(
null
,
formatApiArgs
(
args
));
}
};
}
function
createSyncApi
(
name
,
fn
,
protocol
,
options
)
{
return
createApi
(
API_TYPE_SYNC
,
name
,
fn
,
protocol
,
options
);
return
createApi
(
API_TYPE_SYNC
,
name
,
fn
,
(
process
.
env
.
NODE_ENV
!==
'
production
'
)
?
protocol
:
undefined
,
options
);
}
function
createApi
(
type
,
name
,
fn
,
protocol
,
options
)
{
switch
(
type
)
{
...
...
packages/uni-mp-qq/dist/uni.api.esm.js
浏览文件 @
ce02c608
...
...
@@ -113,7 +113,8 @@ const API_TYPE_ON = 0;
const
API_TYPE_TASK
=
1
;
const
API_TYPE_SYNC
=
2
;
const
API_TYPE_ASYNC
=
3
;
function
validateProtocol
(
_name
,
_args
,
_protocol
)
{
function
validateProtocol
(
name
,
args
,
protocol
)
{
console
.
log
(
'
validateProtocol
'
,
name
,
args
,
protocol
);
return
true
;
}
function
formatApiArgs
(
args
,
options
)
{
...
...
@@ -139,13 +140,13 @@ function wrapperAsyncApi(name, fn, options) {
}
function
wrapperApi
(
fn
,
name
,
protocol
,
options
)
{
return
function
(...
args
)
{
if
(
!
((
process
.
env
.
NODE_ENV
!==
'
production
'
)
&&
protocol
&&
!
validateProtocol
()))
{
if
(
!
((
process
.
env
.
NODE_ENV
!==
'
production
'
)
&&
protocol
&&
!
validateProtocol
(
name
,
args
,
protocol
)))
{
return
fn
.
apply
(
null
,
formatApiArgs
(
args
));
}
};
}
function
createSyncApi
(
name
,
fn
,
protocol
,
options
)
{
return
createApi
(
API_TYPE_SYNC
,
name
,
fn
,
protocol
,
options
);
return
createApi
(
API_TYPE_SYNC
,
name
,
fn
,
(
process
.
env
.
NODE_ENV
!==
'
production
'
)
?
protocol
:
undefined
,
options
);
}
function
createApi
(
type
,
name
,
fn
,
protocol
,
options
)
{
switch
(
type
)
{
...
...
packages/uni-mp-toutiao/dist/uni.api.esm.js
浏览文件 @
ce02c608
...
...
@@ -113,7 +113,8 @@ const API_TYPE_ON = 0;
const
API_TYPE_TASK
=
1
;
const
API_TYPE_SYNC
=
2
;
const
API_TYPE_ASYNC
=
3
;
function
validateProtocol
(
_name
,
_args
,
_protocol
)
{
function
validateProtocol
(
name
,
args
,
protocol
)
{
console
.
log
(
'
validateProtocol
'
,
name
,
args
,
protocol
);
return
true
;
}
function
formatApiArgs
(
args
,
options
)
{
...
...
@@ -139,13 +140,13 @@ function wrapperAsyncApi(name, fn, options) {
}
function
wrapperApi
(
fn
,
name
,
protocol
,
options
)
{
return
function
(...
args
)
{
if
(
!
((
process
.
env
.
NODE_ENV
!==
'
production
'
)
&&
protocol
&&
!
validateProtocol
()))
{
if
(
!
((
process
.
env
.
NODE_ENV
!==
'
production
'
)
&&
protocol
&&
!
validateProtocol
(
name
,
args
,
protocol
)))
{
return
fn
.
apply
(
null
,
formatApiArgs
(
args
));
}
};
}
function
createSyncApi
(
name
,
fn
,
protocol
,
options
)
{
return
createApi
(
API_TYPE_SYNC
,
name
,
fn
,
protocol
,
options
);
return
createApi
(
API_TYPE_SYNC
,
name
,
fn
,
(
process
.
env
.
NODE_ENV
!==
'
production
'
)
?
protocol
:
undefined
,
options
);
}
function
createApi
(
type
,
name
,
fn
,
protocol
,
options
)
{
switch
(
type
)
{
...
...
packages/uni-mp-weixin/dist/uni.api.esm.js
浏览文件 @
ce02c608
...
...
@@ -113,7 +113,8 @@ const API_TYPE_ON = 0;
const
API_TYPE_TASK
=
1
;
const
API_TYPE_SYNC
=
2
;
const
API_TYPE_ASYNC
=
3
;
function
validateProtocol
(
_name
,
_args
,
_protocol
)
{
function
validateProtocol
(
name
,
args
,
protocol
)
{
console
.
log
(
'
validateProtocol
'
,
name
,
args
,
protocol
);
return
true
;
}
function
formatApiArgs
(
args
,
options
)
{
...
...
@@ -139,13 +140,13 @@ function wrapperAsyncApi(name, fn, options) {
}
function
wrapperApi
(
fn
,
name
,
protocol
,
options
)
{
return
function
(...
args
)
{
if
(
!
((
process
.
env
.
NODE_ENV
!==
'
production
'
)
&&
protocol
&&
!
validateProtocol
()))
{
if
(
!
((
process
.
env
.
NODE_ENV
!==
'
production
'
)
&&
protocol
&&
!
validateProtocol
(
name
,
args
,
protocol
)))
{
return
fn
.
apply
(
null
,
formatApiArgs
(
args
));
}
};
}
function
createSyncApi
(
name
,
fn
,
protocol
,
options
)
{
return
createApi
(
API_TYPE_SYNC
,
name
,
fn
,
protocol
,
options
);
return
createApi
(
API_TYPE_SYNC
,
name
,
fn
,
(
process
.
env
.
NODE_ENV
!==
'
production
'
)
?
protocol
:
undefined
,
options
);
}
function
createApi
(
type
,
name
,
fn
,
protocol
,
options
)
{
switch
(
type
)
{
...
...
packages/uni-quickapp-webview/dist/uni.api.esm.js
浏览文件 @
ce02c608
...
...
@@ -113,7 +113,8 @@ const API_TYPE_ON = 0;
const
API_TYPE_TASK
=
1
;
const
API_TYPE_SYNC
=
2
;
const
API_TYPE_ASYNC
=
3
;
function
validateProtocol
(
_name
,
_args
,
_protocol
)
{
function
validateProtocol
(
name
,
args
,
protocol
)
{
console
.
log
(
'
validateProtocol
'
,
name
,
args
,
protocol
);
return
true
;
}
function
formatApiArgs
(
args
,
options
)
{
...
...
@@ -139,13 +140,13 @@ function wrapperAsyncApi(name, fn, options) {
}
function
wrapperApi
(
fn
,
name
,
protocol
,
options
)
{
return
function
(...
args
)
{
if
(
!
((
process
.
env
.
NODE_ENV
!==
'
production
'
)
&&
protocol
&&
!
validateProtocol
()))
{
if
(
!
((
process
.
env
.
NODE_ENV
!==
'
production
'
)
&&
protocol
&&
!
validateProtocol
(
name
,
args
,
protocol
)))
{
return
fn
.
apply
(
null
,
formatApiArgs
(
args
));
}
};
}
function
createSyncApi
(
name
,
fn
,
protocol
,
options
)
{
return
createApi
(
API_TYPE_SYNC
,
name
,
fn
,
protocol
,
options
);
return
createApi
(
API_TYPE_SYNC
,
name
,
fn
,
(
process
.
env
.
NODE_ENV
!==
'
production
'
)
?
protocol
:
undefined
,
options
);
}
function
createApi
(
type
,
name
,
fn
,
protocol
,
options
)
{
switch
(
type
)
{
...
...
packages/vite-plugin-uni/src/load/main.ts
浏览文件 @
ce02c608
...
...
@@ -19,8 +19,9 @@ export const main = {
if
(
!
pagesJsPath
)
{
pagesJsPath
=
slash
(
path
.
resolve
(
options
.
inputDir
,
'
pages.json.js
'
))
}
return
`import
'
${
pagesJsPath
}
'
;
${
fs
return
`import
{ plugin } from '@dcloudio/uni-h5';import '
${
pagesJsPath
}
';function createApp(rootComponent,rootProps){rootComponent && (rootComponent.mpType = 'app');return createVueApp(rootComponent, rootProps).use(plugin)}
;
${
fs
.
readFileSync
(
filename
,
'
utf-8
'
)
.
toString
()}
`
.
toString
()
.
replace
(
'
createApp
'
,
'
createVueApp
'
)}
`
},
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录