From 24a830946e99d849522c6c67d05691f060cb802b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=89=E5=92=B2=E6=99=BA=E5=AD=90=20Kevin=20Deng?= Date: Sun, 16 Jun 2024 16:42:53 +0800 Subject: [PATCH] refactor --- packages/runtime-vapor/src/component.ts | 19 +++---------------- packages/runtime-vapor/src/devtools.ts | 10 ++++------ 2 files changed, 7 insertions(+), 22 deletions(-) diff --git a/packages/runtime-vapor/src/component.ts b/packages/runtime-vapor/src/component.ts index e8ed1b892..8b94d54b8 100644 --- a/packages/runtime-vapor/src/component.ts +++ b/packages/runtime-vapor/src/component.ts @@ -413,9 +413,6 @@ function getAttrsProxy(instance: ComponentInternalInstance): Data { )) ) } -const classifyRE = /(?:^|[-_])(\w)/g -const classify = (str: string): string => - str.replace(classifyRE, c => c.toUpperCase()).replace(/[-_]/g, '') export function getComponentName( Component: Component, @@ -454,16 +451,6 @@ export function formatComponentName( return name ? classify(name) : isRoot ? `App` : `Anonymous` } -/** - * Dev-only - */ -function getSlotsProxy(instance: ComponentInternalInstance): Slots { - return ( - instance.slotsProxy || - (instance.slotsProxy = new Proxy(instance.slots, { - get(target, key: string) { - return target[key] - }, - })) - ) -} +const classifyRE = /(?:^|[-_])(\w)/g +const classify = (str: string): string => + str.replace(classifyRE, c => c.toUpperCase()).replace(/[-_]/g, '') diff --git a/packages/runtime-vapor/src/devtools.ts b/packages/runtime-vapor/src/devtools.ts index de912d61f..4dff1bd99 100644 --- a/packages/runtime-vapor/src/devtools.ts +++ b/packages/runtime-vapor/src/devtools.ts @@ -60,9 +60,10 @@ export function setDevtoolsHook(hook: DevtoolsHook, target: any) { // (#4815) typeof window !== 'undefined' && // some envs mock window but not fully - window.HTMLElement // && + window.HTMLElement && // also exclude jsdom - // !window.navigator?.userAgent?.includes('jsdom') + // eslint-disable-next-line no-restricted-syntax + !window.navigator?.userAgent?.includes('jsdom') ) { const replay = (target.__VUE_DEVTOOLS_HOOK_REPLAY__ = target.__VUE_DEVTOOLS_HOOK_REPLAY__ || []) @@ -86,10 +87,7 @@ export function setDevtoolsHook(hook: DevtoolsHook, target: any) { } export function devtoolsInitApp(app: App, version: string) { - emit(DevtoolsHooks.APP_INIT, app, version, { - Text, - Comment, - }) + emit(DevtoolsHooks.APP_INIT, app, version, {}) } export function devtoolsUnmountApp(app: App) {