refactor(types): move shapeFlags to shared
This commit is contained in:
parent
167f8241bd
commit
6df2aca070
@ -6,13 +6,13 @@ import {
|
||||
NodeTypes,
|
||||
TestElement,
|
||||
Fragment,
|
||||
PatchFlags,
|
||||
resetOps,
|
||||
dumpOps,
|
||||
NodeOpTypes,
|
||||
serializeInner,
|
||||
createTextVNode
|
||||
} from '@vue/runtime-test'
|
||||
import { PatchFlags } from '@vue/shared'
|
||||
|
||||
describe('renderer: fragment', () => {
|
||||
it('should allow returning multiple component root nodes', () => {
|
||||
|
@ -9,9 +9,8 @@ import {
|
||||
mergeProps,
|
||||
normalizeVNode
|
||||
} from '../src/vnode'
|
||||
import { ShapeFlags } from '../src/shapeFlags'
|
||||
import { Data } from '../src/component'
|
||||
import { PatchFlags } from '@vue/shared'
|
||||
import { ShapeFlags, PatchFlags } from '@vue/shared'
|
||||
|
||||
describe('vnode', () => {
|
||||
test('create with just tag', () => {
|
||||
|
@ -26,7 +26,8 @@ import {
|
||||
makeMap,
|
||||
isPromise,
|
||||
isArray,
|
||||
hyphenate
|
||||
hyphenate,
|
||||
ShapeFlags
|
||||
} from '@vue/shared'
|
||||
import { SuspenseBoundary } from './components/Suspense'
|
||||
import { CompilerOptions } from '@vue/compiler-core'
|
||||
@ -34,7 +35,6 @@ import {
|
||||
currentRenderingInstance,
|
||||
markAttrsAccessed
|
||||
} from './componentRenderUtils'
|
||||
import { ShapeFlags } from './shapeFlags'
|
||||
|
||||
export type Data = { [key: string]: unknown }
|
||||
|
||||
|
@ -10,9 +10,8 @@ import {
|
||||
Comment,
|
||||
cloneVNode
|
||||
} from './vnode'
|
||||
import { ShapeFlags } from './shapeFlags'
|
||||
import { handleError, ErrorCodes } from './errorHandling'
|
||||
import { PatchFlags, EMPTY_OBJ } from '@vue/shared'
|
||||
import { PatchFlags, ShapeFlags, EMPTY_OBJ } from '@vue/shared'
|
||||
import { warn } from './warning'
|
||||
|
||||
// mark the current rendering instance for asset resolution (e.g.
|
||||
|
@ -5,8 +5,7 @@ import {
|
||||
normalizeVNode,
|
||||
VNodeChild
|
||||
} from './vnode'
|
||||
import { isArray, isFunction, EMPTY_OBJ } from '@vue/shared'
|
||||
import { ShapeFlags } from './shapeFlags'
|
||||
import { isArray, isFunction, EMPTY_OBJ, ShapeFlags } from '@vue/shared'
|
||||
import { warn } from './warning'
|
||||
import { isKeepAlive } from './components/KeepAlive'
|
||||
|
||||
|
@ -15,7 +15,7 @@ import { warn } from '../warning'
|
||||
import { isKeepAlive } from './KeepAlive'
|
||||
import { toRaw } from '@vue/reactivity'
|
||||
import { callWithAsyncErrorHandling, ErrorCodes } from '../errorHandling'
|
||||
import { ShapeFlags } from '../shapeFlags'
|
||||
import { ShapeFlags } from '@vue/shared'
|
||||
import { onBeforeUnmount, onMounted } from '../apiLifecycle'
|
||||
|
||||
export interface BaseTransitionProps {
|
||||
|
@ -10,9 +10,8 @@ import {
|
||||
import { VNode, cloneVNode, isVNode } from '../vnode'
|
||||
import { warn } from '../warning'
|
||||
import { onBeforeUnmount, injectHook, onUnmounted } from '../apiLifecycle'
|
||||
import { isString, isArray } from '@vue/shared'
|
||||
import { isString, isArray, ShapeFlags } from '@vue/shared'
|
||||
import { watch } from '../apiWatch'
|
||||
import { ShapeFlags } from '../shapeFlags'
|
||||
import { SuspenseBoundary } from './Suspense'
|
||||
import {
|
||||
RendererInternals,
|
||||
|
@ -1,6 +1,5 @@
|
||||
import { VNode, normalizeVNode, VNodeChild } from '../vnode'
|
||||
import { ShapeFlags } from '../shapeFlags'
|
||||
import { isFunction, isArray } from '@vue/shared'
|
||||
import { isFunction, isArray, ShapeFlags } from '@vue/shared'
|
||||
import { ComponentInternalInstance, handleSetupResult } from '../component'
|
||||
import { Slots } from '../componentSlots'
|
||||
import { RendererInternals, MoveType } from '../renderer'
|
||||
|
@ -10,9 +10,8 @@ import {
|
||||
import { queuePostFlushCb, flushPostFlushCbs } from './scheduler'
|
||||
import { ComponentInternalInstance } from './component'
|
||||
import { invokeDirectiveHook } from './directives'
|
||||
import { ShapeFlags } from './shapeFlags'
|
||||
import { warn } from './warning'
|
||||
import { PatchFlags, isReservedProp, isOn } from '@vue/shared'
|
||||
import { PatchFlags, ShapeFlags, isReservedProp, isOn } from '@vue/shared'
|
||||
|
||||
// Note: hydration is DOM-specific
|
||||
// But we have to place it in core due to tight coupling with core - splitting
|
||||
|
@ -56,8 +56,6 @@ export {
|
||||
BaseTransition,
|
||||
BaseTransitionProps
|
||||
} from './components/BaseTransition'
|
||||
export { PatchFlags } from '@vue/shared'
|
||||
export { ShapeFlags } from './shapeFlags'
|
||||
|
||||
// SFC CSS Modules
|
||||
export { useCSSModule } from './helpers/useCssModule'
|
||||
|
@ -30,6 +30,7 @@ import {
|
||||
isReservedProp,
|
||||
isFunction,
|
||||
PatchFlags,
|
||||
ShapeFlags,
|
||||
NOOP
|
||||
} from '@vue/shared'
|
||||
import {
|
||||
@ -49,11 +50,10 @@ import {
|
||||
} from '@vue/reactivity'
|
||||
import { resolveProps } from './componentProps'
|
||||
import { resolveSlots } from './componentSlots'
|
||||
import { ShapeFlags } from './shapeFlags'
|
||||
import { pushWarningContext, popWarningContext, warn } from './warning'
|
||||
import { invokeDirectiveHook } from './directives'
|
||||
import { ComponentPublicInstance } from './componentProxy'
|
||||
import { createAppAPI } from './apiCreateApp'
|
||||
import { createAppAPI, CreateAppFunction } from './apiCreateApp'
|
||||
import {
|
||||
SuspenseBoundary,
|
||||
queueEffectWithSuspense,
|
||||
@ -1858,7 +1858,7 @@ function baseCreateRenderer<
|
||||
return {
|
||||
render,
|
||||
hydrate,
|
||||
createApp: createAppAPI<HostNode, HostElement>(render, hydrate)
|
||||
createApp: createAppAPI(render, hydrate) as CreateAppFunction<HostElement>
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -7,7 +7,8 @@ import {
|
||||
extend,
|
||||
normalizeClass,
|
||||
normalizeStyle,
|
||||
PatchFlags
|
||||
PatchFlags,
|
||||
ShapeFlags
|
||||
} from '@vue/shared'
|
||||
import {
|
||||
ComponentInternalInstance,
|
||||
@ -16,7 +17,6 @@ import {
|
||||
Component
|
||||
} from './component'
|
||||
import { RawSlots } from './componentSlots'
|
||||
import { ShapeFlags } from './shapeFlags'
|
||||
import { isReactive, Ref } from '@vue/reactivity'
|
||||
import { AppContext } from './apiCreateApp'
|
||||
import { SuspenseBoundary } from './components/Suspense'
|
||||
|
@ -9,12 +9,12 @@ import {
|
||||
Comment,
|
||||
Fragment,
|
||||
Portal,
|
||||
ShapeFlags,
|
||||
ssrUtils,
|
||||
Slots,
|
||||
warn
|
||||
} from 'vue'
|
||||
import {
|
||||
ShapeFlags,
|
||||
isString,
|
||||
isPromise,
|
||||
isArray,
|
||||
|
@ -2,6 +2,7 @@ import { makeMap } from './makeMap'
|
||||
|
||||
export { makeMap }
|
||||
export * from './patchFlags'
|
||||
export * from './shapeFlags'
|
||||
export * from './globalsWhitelist'
|
||||
export * from './codeframe'
|
||||
export * from './mockWarn'
|
||||
|
12
packages/shared/src/shapeFlags.ts
Normal file
12
packages/shared/src/shapeFlags.ts
Normal file
@ -0,0 +1,12 @@
|
||||
export const enum ShapeFlags {
|
||||
ELEMENT = 1,
|
||||
FUNCTIONAL_COMPONENT = 1 << 1,
|
||||
STATEFUL_COMPONENT = 1 << 2,
|
||||
TEXT_CHILDREN = 1 << 3,
|
||||
ARRAY_CHILDREN = 1 << 4,
|
||||
SLOTS_CHILDREN = 1 << 5,
|
||||
SUSPENSE = 1 << 6,
|
||||
COMPONENT_SHOULD_KEEP_ALIVE = 1 << 7,
|
||||
COMPONENT_KEPT_ALIVE = 1 << 8,
|
||||
COMPONENT = ShapeFlags.STATEFUL_COMPONENT | ShapeFlags.FUNCTIONAL_COMPONENT
|
||||
}
|
@ -18,7 +18,7 @@ describe('e2e: markdown', () => {
|
||||
await page().type('textarea', '\n## foo\n\n- bar\n- baz')
|
||||
// assert the output is not updated yet because of debounce
|
||||
expect(await html('#editor div')).toBe('<h1 id="hello">hello</h1>\n')
|
||||
await page().waitFor(16)
|
||||
await page().waitFor(30)
|
||||
expect(await html('#editor div')).toBe(
|
||||
'<h1 id="hello">hello</h1>\n' +
|
||||
'<h2 id="foo">foo</h2>\n' +
|
||||
|
Loading…
Reference in New Issue
Block a user