Skip to content

Commit

Permalink
refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
sxzz committed Jun 16, 2024
1 parent 54d8aca commit 24a8309
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 22 deletions.
19 changes: 3 additions & 16 deletions packages/runtime-vapor/src/component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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, '')
10 changes: 4 additions & 6 deletions packages/runtime-vapor/src/devtools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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__ || [])
Expand All @@ -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) {
Expand Down

0 comments on commit 24a8309

Please sign in to comment.