build: improve treeshakeability (#5682)

This commit is contained in:
宋铄运 (Alan Song)
2022-04-13 17:39:02 +08:00
committed by GitHub
parent 053c65bc5e
commit c6eb3cccce
7 changed files with 33 additions and 31 deletions

View File

@@ -223,9 +223,10 @@ const getPublicInstance = (
return getPublicInstance(i.parent)
}
export const publicPropertiesMap: PublicPropertiesMap = /*#__PURE__*/ extend(
Object.create(null),
{
export const publicPropertiesMap: PublicPropertiesMap =
// Move PURE marker to new line to workaround compiler discarding it
// due to type annotation
/*#__PURE__*/ extend(Object.create(null), {
$: i => i,
$el: i => i.vnode.el,
$data: i => i.data,
@@ -240,8 +241,7 @@ export const publicPropertiesMap: PublicPropertiesMap = /*#__PURE__*/ extend(
$forceUpdate: i => () => queueJob(i.update),
$nextTick: i => nextTick.bind(i.proxy!),
$watch: i => (__FEATURE_OPTIONS_API__ ? instanceWatch.bind(i) : NOOP)
} as PublicPropertiesMap
)
} as PublicPropertiesMap)
if (__COMPAT__) {
installCompatInstanceProperties(publicPropertiesMap)
@@ -456,8 +456,8 @@ export const PublicInstanceProxyHandlers: ProxyHandler<any> = {
) {
if (descriptor.get != null) {
// invalidate key cache of a getter based property #5417
target.$.accessCache[key] = 0;
} else if (hasOwn(descriptor,'value')) {
target.$.accessCache[key] = 0
} else if (hasOwn(descriptor, 'value')) {
this.set!(target, key, descriptor.value, null)
}
return Reflect.defineProperty(target, key, descriptor)

View File

@@ -47,7 +47,7 @@ const pendingPostFlushCbs: SchedulerJob[] = []
let activePostFlushCbs: SchedulerJob[] | null = null
let postFlushIndex = 0
const resolvedPromise: Promise<any> = Promise.resolve()
const resolvedPromise = /*#__PURE__*/ Promise.resolve() as Promise<any>
let currentFlushPromise: Promise<void> | null = null
let currentPreFlushParentJob: SchedulerJob | null = null