mirror of https://github.com/vuejs/core.git
refactor: extract Data
This commit is contained in:
parent
0cca23f574
commit
41a7079493
|
@ -11,8 +11,7 @@ import {
|
|||
transformVNodeArgs,
|
||||
isBlockTreeEnabled
|
||||
} from '../src/vnode'
|
||||
import { Data } from '../src/component'
|
||||
import { ShapeFlags, PatchFlags } from '@vue/shared'
|
||||
import { ShapeFlags, PatchFlags, Data } from '@vue/shared'
|
||||
import { h, reactive, isReactive, setBlockTracking, ref, withCtx } from '../src'
|
||||
import { createApp, nodeOps, serializeInner } from '@vue/runtime-test'
|
||||
import { setCurrentRenderingInstance } from '../src/componentRenderContext'
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
import {
|
||||
ConcreteComponent,
|
||||
Data,
|
||||
validateComponentName,
|
||||
Component,
|
||||
ComponentInternalInstance,
|
||||
|
@ -22,7 +21,7 @@ import { warn } from './warning'
|
|||
import { createVNode, cloneVNode, VNode } from './vnode'
|
||||
import { RootHydrateFunction } from './hydration'
|
||||
import { devtoolsInitApp, devtoolsUnmountApp } from './devtools'
|
||||
import { isFunction, NO, isObject, extend } from '@vue/shared'
|
||||
import { isFunction, NO, isObject, extend, Data } from '@vue/shared'
|
||||
import { version } from '.'
|
||||
import { installAppCompatProperties } from './compat/global'
|
||||
import { NormalizedPropsOptions } from './componentProps'
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { isArray } from '@vue/shared'
|
||||
import { isArray, Data } from '@vue/shared'
|
||||
import { inject } from '../apiInject'
|
||||
import { ComponentInternalInstance, Data } from '../component'
|
||||
import { ComponentInternalInstance } from '../component'
|
||||
import { ComponentOptions, resolveMergedOptions } from '../componentOptions'
|
||||
import { DeprecationTypes, warnDeprecation } from './compatConfig'
|
||||
|
||||
|
|
|
@ -8,13 +8,13 @@ import {
|
|||
normalizeClass,
|
||||
normalizeStyle,
|
||||
ShapeFlags,
|
||||
toHandlerKey
|
||||
toHandlerKey,
|
||||
Data
|
||||
} from '@vue/shared'
|
||||
import {
|
||||
Component,
|
||||
ComponentInternalInstance,
|
||||
ComponentOptions,
|
||||
Data,
|
||||
InternalRenderFunction
|
||||
} from '../component'
|
||||
import { currentRenderingInstance } from '../componentRenderContext'
|
||||
|
|
|
@ -65,7 +65,8 @@ import {
|
|||
ShapeFlags,
|
||||
extend,
|
||||
getGlobalThis,
|
||||
IfAny
|
||||
IfAny,
|
||||
Data
|
||||
} from '@vue/shared'
|
||||
import { SuspenseBoundary } from './components/Suspense'
|
||||
import { CompilerOptions } from '@vue/compiler-core'
|
||||
|
@ -81,8 +82,6 @@ import {
|
|||
import { SchedulerJob } from './scheduler'
|
||||
import { LifecycleHooks } from './enums'
|
||||
|
||||
export type Data = Record<string, unknown>
|
||||
|
||||
/**
|
||||
* For extending allowed non-declared props on components in TSX
|
||||
*/
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
import {
|
||||
ComponentInternalInstance,
|
||||
Data,
|
||||
SetupContext,
|
||||
ComponentInternalOptions,
|
||||
Component,
|
||||
|
@ -16,7 +15,8 @@ import {
|
|||
NOOP,
|
||||
isPromise,
|
||||
LooseRequired,
|
||||
Prettify
|
||||
Prettify,
|
||||
Data
|
||||
} from '@vue/shared'
|
||||
import { isRef, Ref } from '@vue/reactivity'
|
||||
import { computed } from './apiComputed'
|
||||
|
|
|
@ -23,11 +23,11 @@ import {
|
|||
def,
|
||||
extend,
|
||||
isOn,
|
||||
IfAny
|
||||
IfAny,
|
||||
Data
|
||||
} from '@vue/shared'
|
||||
import { warn } from './warning'
|
||||
import {
|
||||
Data,
|
||||
ComponentInternalInstance,
|
||||
ComponentOptions,
|
||||
ConcreteComponent,
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
import {
|
||||
ComponentInternalInstance,
|
||||
Data,
|
||||
getExposeProxy,
|
||||
isStatefulComponent
|
||||
} from './component'
|
||||
|
@ -16,7 +15,8 @@ import {
|
|||
isFunction,
|
||||
UnionToIntersection,
|
||||
Prettify,
|
||||
IfAny
|
||||
IfAny,
|
||||
Data
|
||||
} from '@vue/shared'
|
||||
import {
|
||||
toRaw,
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
import {
|
||||
ComponentInternalInstance,
|
||||
FunctionalComponent,
|
||||
Data,
|
||||
getComponentName
|
||||
} from './component'
|
||||
import {
|
||||
|
@ -15,7 +14,13 @@ import {
|
|||
blockStack
|
||||
} from './vnode'
|
||||
import { handleError, ErrorCodes } from './errorHandling'
|
||||
import { PatchFlags, ShapeFlags, isOn, isModelListener } from '@vue/shared'
|
||||
import {
|
||||
PatchFlags,
|
||||
ShapeFlags,
|
||||
isOn,
|
||||
isModelListener,
|
||||
Data
|
||||
} from '@vue/shared'
|
||||
import { warn } from './warning'
|
||||
import { isHmrUpdating } from './hmr'
|
||||
import { NormalizedProps } from './componentProps'
|
||||
|
|
|
@ -12,9 +12,9 @@ return withDirectives(h(comp), [
|
|||
*/
|
||||
|
||||
import { VNode } from './vnode'
|
||||
import { isFunction, EMPTY_OBJ, isBuiltInDirective } from '@vue/shared'
|
||||
import { isFunction, EMPTY_OBJ, isBuiltInDirective, Data } from '@vue/shared'
|
||||
import { warn } from './warning'
|
||||
import { ComponentInternalInstance, Data, getExposeProxy } from './component'
|
||||
import { ComponentInternalInstance, getExposeProxy } from './component'
|
||||
import { currentRenderingInstance } from './componentRenderContext'
|
||||
import { callWithAsyncErrorHandling, ErrorCodes } from './errorHandling'
|
||||
import { ComponentPublicInstance } from './componentPublicInstance'
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
import { Data } from '../component'
|
||||
import { Slots, RawSlots } from '../componentSlots'
|
||||
import {
|
||||
ContextualRenderFn,
|
||||
|
@ -13,7 +12,7 @@ import {
|
|||
Fragment,
|
||||
VNode
|
||||
} from '../vnode'
|
||||
import { PatchFlags, SlotFlags } from '@vue/shared'
|
||||
import { PatchFlags, SlotFlags, Data } from '@vue/shared'
|
||||
import { warn } from '../warning'
|
||||
import { createVNode } from '@vue/runtime-core'
|
||||
import { isAsyncWrapper } from '../apiAsyncComponent'
|
||||
|
|
|
@ -17,7 +17,6 @@ import {
|
|||
ComponentInternalInstance,
|
||||
ComponentOptions,
|
||||
createComponentInstance,
|
||||
Data,
|
||||
setupComponent
|
||||
} from './component'
|
||||
import {
|
||||
|
@ -35,7 +34,8 @@ import {
|
|||
NOOP,
|
||||
invokeArrayFns,
|
||||
isArray,
|
||||
getGlobalThis
|
||||
getGlobalThis,
|
||||
Data
|
||||
} from '@vue/shared'
|
||||
import {
|
||||
queueJob,
|
||||
|
|
|
@ -10,11 +10,11 @@ import {
|
|||
PatchFlags,
|
||||
ShapeFlags,
|
||||
SlotFlags,
|
||||
isOn
|
||||
isOn,
|
||||
Data
|
||||
} from '@vue/shared'
|
||||
import {
|
||||
ComponentInternalInstance,
|
||||
Data,
|
||||
ConcreteComponent,
|
||||
ClassComponent,
|
||||
Component,
|
||||
|
|
|
@ -1,11 +1,10 @@
|
|||
import { VNode } from './vnode'
|
||||
import {
|
||||
Data,
|
||||
ComponentInternalInstance,
|
||||
ConcreteComponent,
|
||||
formatComponentName
|
||||
} from './component'
|
||||
import { isString, isFunction } from '@vue/shared'
|
||||
import { isString, isFunction, Data } from '@vue/shared'
|
||||
import { toRaw, isRef, pauseTracking, resetTracking } from '@vue/reactivity'
|
||||
import { callWithErrorHandling, ErrorCodes } from './errorHandling'
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import { EffectScope } from '@vue/reactivity'
|
||||
import { Block } from './render'
|
||||
import { DirectiveBinding } from './directives'
|
||||
import type { Data } from '@vue/shared'
|
||||
|
||||
export type SetupFn = (props: any, ctx: any) => Block | Data
|
||||
export type FunctionalComponent = SetupFn & {
|
||||
|
@ -57,6 +58,3 @@ export const createComponentInstance = (
|
|||
}
|
||||
return instance
|
||||
}
|
||||
|
||||
// FIXME: duplicated with runtime-core
|
||||
export type Data = Record<string, unknown>
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import { isFunction } from '@vue/shared'
|
||||
import { currentInstance, type ComponentInternalInstance } from './component'
|
||||
import type { DirectiveModifiers } from '@vue/runtime-dom'
|
||||
|
||||
export interface DirectiveBinding<V = any> {
|
||||
instance: ComponentInternalInstance | null
|
||||
value: V
|
||||
|
|
|
@ -21,3 +21,5 @@ export type Awaited<T> = T extends null | undefined
|
|||
? Awaited<V> // recursively unwrap the value
|
||||
: never // the argument to `then` was not callable
|
||||
: T // non-object or non-thenable
|
||||
|
||||
export type Data = Record<string, unknown>
|
||||
|
|
Loading…
Reference in New Issue