]> git.ipfire.org Git - thirdparty/vuejs/core.git/commitdiff
refactor: extract Data
author三咲智子 Kevin Deng <sxzz@sxzz.moe>
Wed, 6 Dec 2023 17:51:57 +0000 (01:51 +0800)
committer三咲智子 Kevin Deng <sxzz@sxzz.moe>
Wed, 6 Dec 2023 17:55:00 +0000 (01:55 +0800)
17 files changed:
packages/runtime-core/__tests__/vnode.spec.ts
packages/runtime-core/src/apiCreateApp.ts
packages/runtime-core/src/compat/props.ts
packages/runtime-core/src/compat/renderFn.ts
packages/runtime-core/src/component.ts
packages/runtime-core/src/componentOptions.ts
packages/runtime-core/src/componentProps.ts
packages/runtime-core/src/componentPublicInstance.ts
packages/runtime-core/src/componentRenderUtils.ts
packages/runtime-core/src/directives.ts
packages/runtime-core/src/helpers/renderSlot.ts
packages/runtime-core/src/renderer.ts
packages/runtime-core/src/vnode.ts
packages/runtime-core/src/warning.ts
packages/runtime-vapor/src/component.ts
packages/runtime-vapor/src/directives.ts
packages/shared/src/typeUtils.ts

index 11b2044a9e3650f9987dd8cd80e2e1438ae1ac28..78429b40401db3187dee9df814b23cd41d20b8a1 100644 (file)
@@ -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'
index 7c0a15b2e981d5d329ee6289f321e021b45eb3e3..51b52fc5de3d9fb230216c912fd320f8cc85a666 100644 (file)
@@ -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'
index e2fccb6675fccad563f9693545f5fdec5997f409..b0167c233113a020772cc9047731f172fe75af74 100644 (file)
@@ -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'
 
index 4cf2fc226cf25d083d3549ae3a9e0cabfb223104..e1745cf294668dbc69fbaa5556cfff7c5db26b28 100644 (file)
@@ -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'
index 348228081ffe218757e65d0b90896d63bddb2ea4..6843bb26fe55514a5aa156879de4a1ba104ffdb7 100644 (file)
@@ -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
  */
index 9633cbfe907199278a381058c1533666ada8b105..4e9829091403c572f7a3a4f70668c3c26b33820c 100644 (file)
@@ -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'
index 4b7be8a8e73b9787cf36cb82d7706ee834fb3ae1..c0dbc2d76a6868023e2cbf345f2ed2e8f33d31d3 100644 (file)
@@ -23,11 +23,11 @@ import {
   def,
   extend,
   isOn,
-  IfAny
+  IfAny,
+  Data
 } from '@vue/shared'
 import { warn } from './warning'
 import {
-  Data,
   ComponentInternalInstance,
   ComponentOptions,
   ConcreteComponent,
index 06e9965094bca20bacfdae83f751a8379769dacd..77c42ff6ab586f2689a25164fd2c86d488336fe8 100644 (file)
@@ -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,
index 2ed64f7b5773896c0693bcb3c13161d5793d910e..8b9450fd3219be2ea4a38a157ead4e1bd5e7a674 100644 (file)
@@ -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'
index 18c3352b002a72a59f7123719bfe9e9994b2c3ad..496b558503daf3e690b85f454adff0473d383228 100644 (file)
@@ -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'
index 452fc8272692bfdde360f88222ad066a1b3870ed..1d8618800d0ca946fc266a6987387c75e0c62184 100644 (file)
@@ -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'
index fc762af3d96553937d5866415735efca758c3ff9..d54b61d9372dbf8acb42ef8b8f7ffbd5c30e944c 100644 (file)
@@ -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,
index 7a271f54047d51eccf03bbbacf0eeae5b2252991..533fb600b1d6f99b8ebbab9d638ee543334e6a29 100644 (file)
@@ -10,11 +10,11 @@ import {
   PatchFlags,
   ShapeFlags,
   SlotFlags,
-  isOn
+  isOn,
+  Data
 } from '@vue/shared'
 import {
   ComponentInternalInstance,
-  Data,
   ConcreteComponent,
   ClassComponent,
   Component,
index 8e93d9efe59da24f1306fc3fbce5ef88cdb8d60d..f22c18b8a6686ec74c7b549d6da8ab9a7d773c5e 100644 (file)
@@ -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'
 
index 0ea657d24e5d06630ad6fd216568fabee0a9bb9d..421b2bdfb30503ed85b959fb2636c7f511baea41 100644 (file)
@@ -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>
index 24bc39ae7d0c0121b3b316ebec599b26be5586cf..7060a92f4f6584df06753db235cfd45f93f6c568 100644 (file)
@@ -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
index 63372d829169e273459201dfcee8832f99057a3a..21e56f9a4fc84e0693178f4f4b41b22dcb82c632 100644 (file)
@@ -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>