Skip to content

Commit 639c847

Browse files
committed
refactor(runtime-shared): move Data
1 parent 7cd7050 commit 639c847

21 files changed

+28
-31
lines changed

packages/runtime-core/__tests__/vnode.spec.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ import {
1111
openBlock,
1212
transformVNodeArgs,
1313
} from '../src/vnode'
14-
import { type Data, PatchFlags, ShapeFlags } from '@vue/shared'
14+
import { PatchFlags, ShapeFlags } from '@vue/shared'
15+
import type { Data } from '@vue/runtime-shared'
1516
import { h, isReactive, reactive, ref, setBlockTracking, withCtx } from '../src'
1617
import { createApp, nodeOps, serializeInner } from '@vue/runtime-test'
1718
import { setCurrentRenderingInstance } from '../src/componentRenderContext'

packages/runtime-core/src/apiCreateApp.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ import { warn } from './warning'
2121
import { type VNode, cloneVNode, createVNode } from './vnode'
2222
import type { RootHydrateFunction } from './hydration'
2323
import { devtoolsInitApp, devtoolsUnmountApp } from './devtools'
24-
import { type Data, NO, extend, isFunction, isObject } from '@vue/shared'
24+
import { NO, extend, isFunction, isObject } from '@vue/shared'
25+
import type { Data } from '@vue/runtime-shared'
2526
import { version } from '.'
2627
import { installAppCompatProperties } from './compat/global'
2728
import type { NormalizedPropsOptions } from './componentProps'

packages/runtime-core/src/compat/props.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import { type Data, isArray } from '@vue/shared'
1+
import { isArray } from '@vue/shared'
2+
import type { Data } from '@vue/runtime-shared'
23
import { inject } from '../apiInject'
34
import type { ComponentInternalInstance } from '../component'
45
import {

packages/runtime-core/src/compat/renderFn.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import {
2-
type Data,
32
ShapeFlags,
43
extend,
54
hyphenate,
@@ -11,6 +10,7 @@ import {
1110
normalizeStyle,
1211
toHandlerKey,
1312
} from '@vue/shared'
13+
import type { Data } from '@vue/runtime-shared'
1414
import type {
1515
Component,
1616
ComponentInternalInstance,

packages/runtime-core/src/component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@ import {
6060
normalizeEmitsOptions,
6161
} from './componentEmits'
6262
import {
63-
type Data,
6463
EMPTY_OBJ,
6564
type IfAny,
6665
NOOP,
@@ -73,6 +72,7 @@ import {
7372
isPromise,
7473
makeMap,
7574
} from '@vue/shared'
75+
import type { Data } from '@vue/runtime-shared'
7676
import type { SuspenseBoundary } from './components/Suspense'
7777
import type { CompilerOptions } from '@vue/compiler-core'
7878
import { markAttrsAccessed } from './componentRenderUtils'

packages/runtime-core/src/componentOptions.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import {
88
currentInstance,
99
} from './component'
1010
import {
11-
type Data,
1211
type LooseRequired,
1312
NOOP,
1413
type Prettify,
@@ -19,6 +18,7 @@ import {
1918
isPromise,
2019
isString,
2120
} from '@vue/shared'
21+
import type { Data } from '@vue/runtime-shared'
2222
import { type Ref, getCurrentScope, isRef, traverse } from '@vue/reactivity'
2323
import { computed } from './apiComputed'
2424
import {

packages/runtime-core/src/componentProps.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import {
66
trigger,
77
} from '@vue/reactivity'
88
import {
9-
type Data,
109
EMPTY_ARR,
1110
EMPTY_OBJ,
1211
type IfAny,
@@ -25,6 +24,7 @@ import {
2524
makeMap,
2625
toRawType,
2726
} from '@vue/shared'
27+
import type { Data } from '@vue/runtime-shared'
2828
import { warn } from './warning'
2929
import {
3030
type ComponentInternalInstance,

packages/runtime-core/src/componentPublicInstance.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import {
1111
instanceWatch,
1212
} from './apiWatch'
1313
import {
14-
type Data,
1514
EMPTY_OBJ,
1615
type IfAny,
1716
NOOP,
@@ -23,6 +22,7 @@ import {
2322
isGloballyAllowed,
2423
isString,
2524
} from '@vue/shared'
25+
import type { Data } from '@vue/runtime-shared'
2626
import {
2727
ReactiveFlags,
2828
type ShallowUnwrapRef,

packages/runtime-core/src/componentRenderUtils.ts

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,8 @@ import {
1414
normalizeVNode,
1515
} from './vnode'
1616
import { ErrorCodes, handleError } from './errorHandling'
17-
import {
18-
type Data,
19-
PatchFlags,
20-
ShapeFlags,
21-
isModelListener,
22-
isOn,
23-
} from '@vue/shared'
17+
import { PatchFlags, ShapeFlags, isModelListener, isOn } from '@vue/shared'
18+
import type { Data } from '@vue/runtime-shared'
2419
import { warn } from './warning'
2520
import { isHmrUpdating } from './hmr'
2621
import type { NormalizedProps } from './componentProps'

packages/runtime-core/src/directives.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,8 @@ return withDirectives(h(comp), [
1212
*/
1313

1414
import type { VNode } from './vnode'
15-
import {
16-
type Data,
17-
EMPTY_OBJ,
18-
isBuiltInDirective,
19-
isFunction,
20-
} from '@vue/shared'
15+
import { EMPTY_OBJ, isBuiltInDirective, isFunction } from '@vue/shared'
16+
import type { Data } from '@vue/runtime-shared'
2117
import { warn } from './warning'
2218
import { type ComponentInternalInstance, getExposeProxy } from './component'
2319
import { currentRenderingInstance } from './componentRenderContext'

packages/runtime-core/src/helpers/renderSlot.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ import {
1212
isVNode,
1313
openBlock,
1414
} from '../vnode'
15-
import { type Data, PatchFlags, SlotFlags } from '@vue/shared'
15+
import { PatchFlags, SlotFlags } from '@vue/shared'
16+
import type { Data } from '@vue/runtime-shared'
1617
import { warn } from '../warning'
1718
import { createVNode } from '@vue/runtime-core'
1819
import { isAsyncWrapper } from '../apiAsyncComponent'

packages/runtime-core/src/renderer.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ import {
2626
updateHOCHostEl,
2727
} from './componentRenderUtils'
2828
import {
29-
type Data,
3029
EMPTY_ARR,
3130
EMPTY_OBJ,
3231
NOOP,
@@ -37,6 +36,7 @@ import {
3736
isArray,
3837
isReservedProp,
3938
} from '@vue/shared'
39+
import type { Data } from '@vue/runtime-shared'
4040
import {
4141
type SchedulerFactory,
4242
type SchedulerJob,

packages/runtime-core/src/vnode.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import {
2-
type Data,
32
EMPTY_ARR,
43
PatchFlags,
54
ShapeFlags,
@@ -13,6 +12,7 @@ import {
1312
normalizeClass,
1413
normalizeStyle,
1514
} from '@vue/shared'
15+
import type { Data } from '@vue/runtime-shared'
1616
import {
1717
type ClassComponent,
1818
type Component,

packages/runtime-core/src/warning.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ import {
44
type ConcreteComponent,
55
formatComponentName,
66
} from './component'
7-
import { type Data, isFunction, isString } from '@vue/shared'
7+
import { isFunction, isString } from '@vue/shared'
8+
import type { Data } from '@vue/runtime-shared'
89
import { isRef, pauseTracking, resetTracking, toRaw } from '@vue/reactivity'
910
import { ErrorCodes, callWithErrorHandling } from './errorHandling'
1011

packages/runtime-shared/src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
export { toHandlers } from './toHandlers'
2+
export { type Data } from './typeUtils'
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export type Data = Record<string, unknown>

packages/runtime-vapor/src/component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ import {
2626
import { VaporLifecycleHooks } from './apiLifecycle'
2727
import { warn } from './warning'
2828
import { type AppContext, createAppContext } from './apiCreateVaporApp'
29-
import type { Data } from '@vue/shared'
29+
import type { Data } from '@vue/runtime-shared'
3030

3131
export type Component = FunctionalComponent | ObjectComponent
3232

packages/runtime-vapor/src/componentMetadata.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
import { type Data, remove } from '@vue/shared'
1+
import { remove } from '@vue/shared'
22
import type { DelegatedHandler } from './dom/event'
3+
import type { Data } from '@vue/runtime-shared'
34

45
export enum MetadataKind {
56
prop,

packages/runtime-vapor/src/componentProps.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import {
2-
type Data,
32
EMPTY_ARR,
43
EMPTY_OBJ,
54
camelize,
@@ -9,6 +8,7 @@ import {
98
isArray,
109
isFunction,
1110
} from '@vue/shared'
11+
import type { Data } from '@vue/runtime-shared'
1212
import { shallowReactive } from '@vue/reactivity'
1313
import { warn } from './warning'
1414
import {

packages/runtime-vapor/src/dom/prop.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import {
2-
type Data,
32
includeBooleanAttr,
43
isArray,
54
isFunction,
@@ -18,6 +17,7 @@ import {
1817
recordPropMetadata,
1918
} from '../componentMetadata'
2019
import { on } from './event'
20+
import type { Data } from '@vue/runtime-shared'
2121

2222
export function setClass(el: Element, value: any) {
2323
const prev = recordPropMetadata(el, 'class', (value = normalizeClass(value)))

packages/shared/src/typeUtils.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@ export type Awaited<T> = T extends null | undefined
2222
: never // the argument to `then` was not callable
2323
: T // non-object or non-thenable
2424

25-
export type Data = Record<string, unknown>
26-
2725
/**
2826
* Utility for extracting the parameters from a function overload (for typed emits)
2927
* https://github.com/microsoft/TypeScript/issues/32164#issuecomment-1146737709

0 commit comments

Comments
 (0)