Skip to content

Commit

Permalink
fix: ShapeFlags is undefined
Browse files Browse the repository at this point in the history
  • Loading branch information
okxiaoliang4 committed Jul 2, 2022
1 parent d6e9602 commit 1cca9f9
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/utils/getRootNodes.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { ShapeFlags } from '@vue/shared'
import { isNotNullOrUndefined } from '../utils'
import { VNode, VNodeArrayChildren } from 'vue'
import { ShapeFlags } from './vueShared'

export function getRootNodes(vnode: VNode): Node[] {
if (vnode.shapeFlag & ShapeFlags.ELEMENT) {
Expand Down
14 changes: 14 additions & 0 deletions src/utils/vueShared.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,17 @@ const hyphenateRE = /\B([A-Z])/g
export const hyphenate = cacheStringFunction((str: string): string => {
return str.replace(hyphenateRE, '-$1').toLowerCase()
})

export const enum ShapeFlags {
ELEMENT = 1,
FUNCTIONAL_COMPONENT = 2,
STATEFUL_COMPONENT = 4,
TEXT_CHILDREN = 8,
ARRAY_CHILDREN = 16,
SLOTS_CHILDREN = 32,
TELEPORT = 64,
SUSPENSE = 128,
COMPONENT_SHOULD_KEEP_ALIVE = 256,
COMPONENT_KEPT_ALIVE = 512,
COMPONENT = 6
}
2 changes: 1 addition & 1 deletion src/vueWrapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import {
ComponentCustomProperties,
ComponentPublicInstance
} from 'vue'
import { ShapeFlags } from '@vue/shared'
// @ts-ignore todo - No DefinitelyTyped package exists for this
import pretty from 'pretty'

Expand All @@ -22,6 +21,7 @@ import {
WrapperType
} from './wrapperFactory'
import { VNode } from '@vue/runtime-core'
import { ShapeFlags } from './utils/vueShared'

export class VueWrapper<
T extends Omit<
Expand Down

0 comments on commit 1cca9f9

Please sign in to comment.