diff --git a/packages/compiler-core/src/transform.ts b/packages/compiler-core/src/transform.ts index 4d9e8c6ed..d26c11bba 100644 --- a/packages/compiler-core/src/transform.ts +++ b/packages/compiler-core/src/transform.ts @@ -117,7 +117,7 @@ export interface TransformContext removeIdentifiers(exp: ExpressionNode | string): void hoist(exp: string | JSChildNode | ArrayExpression): SimpleExpressionNode cache(exp: T, isVNode?: boolean): CacheExpression | T - constantCache: Map + constantCache: WeakMap // 2.x Compat only filters?: Set @@ -181,7 +181,7 @@ export function createTransformContext( directives: new Set(), hoists: [], imports: [], - constantCache: new Map(), + constantCache: new WeakMap(), temps: 0, cached: 0, identifiers: Object.create(null), diff --git a/packages/runtime-core/src/apiCreateApp.ts b/packages/runtime-core/src/apiCreateApp.ts index c5ac9d68a..8e4ab1f3a 100644 --- a/packages/runtime-core/src/apiCreateApp.ts +++ b/packages/runtime-core/src/apiCreateApp.ts @@ -227,7 +227,7 @@ export function createAppAPI( }) } - const installedPlugins = new Set() + const installedPlugins = new WeakSet() let isMounted = false diff --git a/packages/runtime-core/src/compat/componentAsync.ts b/packages/runtime-core/src/compat/componentAsync.ts index 0a0dee72b..5b2ac22c2 100644 --- a/packages/runtime-core/src/compat/componentAsync.ts +++ b/packages/runtime-core/src/compat/componentAsync.ts @@ -18,7 +18,10 @@ type LegacyAsyncComponent = ( reject?: (reason?: any) => void ) => LegacyAsyncReturnValue | undefined -const normalizedAsyncComponentMap = new Map() +const normalizedAsyncComponentMap = new WeakMap< + LegacyAsyncComponent, + Component +>() export function convertLegacyAsyncComponent(comp: LegacyAsyncComponent) { if (normalizedAsyncComponentMap.has(comp)) { diff --git a/packages/runtime-core/src/compat/componentFunctional.ts b/packages/runtime-core/src/compat/componentFunctional.ts index 1b1146bba..90d24e1ba 100644 --- a/packages/runtime-core/src/compat/componentFunctional.ts +++ b/packages/runtime-core/src/compat/componentFunctional.ts @@ -8,11 +8,10 @@ import { InternalSlots } from '../componentSlots' import { getCompatListeners } from './instanceListeners' import { compatH } from './renderFn' -const normalizedFunctionalComponentMap = new Map< +const normalizedFunctionalComponentMap = new WeakMap< ComponentOptions, FunctionalComponent >() - export const legacySlotProxyHandlers: ProxyHandler = { get(target, key: string) { const slot = target[key]