refactor: rename reactivity package name and APIs
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { createComponent } from '../src/component'
|
||||
import { value } from '@vue/observer'
|
||||
import { value } from '@vue/reactivity'
|
||||
import { PropType } from '../src/componentProps'
|
||||
|
||||
test('createComponent type inference', () => {
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
export {
|
||||
value,
|
||||
isValue,
|
||||
observable,
|
||||
immutable,
|
||||
isObservable,
|
||||
isImmutable,
|
||||
unwrap,
|
||||
state,
|
||||
isState,
|
||||
immutableState,
|
||||
isImmutableState,
|
||||
toRaw,
|
||||
markImmutable,
|
||||
markNonReactive,
|
||||
effect,
|
||||
@@ -17,13 +17,13 @@ export {
|
||||
Value,
|
||||
ComputedValue,
|
||||
UnwrapValue
|
||||
} from '@vue/observer'
|
||||
} from '@vue/reactivity'
|
||||
|
||||
import {
|
||||
computed as _computed,
|
||||
ComputedValue,
|
||||
ReactiveEffect
|
||||
} from '@vue/observer'
|
||||
} from '@vue/reactivity'
|
||||
|
||||
import { currentInstance } from './component'
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ import {
|
||||
isValue,
|
||||
Value,
|
||||
ReactiveEffectOptions
|
||||
} from '@vue/observer'
|
||||
} from '@vue/reactivity'
|
||||
import { queueJob, queuePostFlushCb } from './scheduler'
|
||||
import { EMPTY_OBJ, isObject, isArray } from '@vue/shared'
|
||||
import { recordEffect } from './apiState'
|
||||
|
||||
@@ -2,9 +2,9 @@ import { VNode, normalizeVNode, VNodeChild } from './vnode'
|
||||
import {
|
||||
ReactiveEffect,
|
||||
UnwrapValue,
|
||||
observable,
|
||||
immutable
|
||||
} from '@vue/observer'
|
||||
state,
|
||||
immutableState
|
||||
} from '@vue/reactivity'
|
||||
import { EMPTY_OBJ } from '@vue/shared'
|
||||
import { RenderProxyHandlers } from './componentProxy'
|
||||
import { ComponentPropsOptions, ExtractPropTypes } from './componentProps'
|
||||
@@ -151,9 +151,9 @@ export function setupStatefulComponent(instance: ComponentInstance) {
|
||||
// only need to create it if setup() actually expects it
|
||||
// it will be updated in resolveProps() on updates before render
|
||||
const propsProxy = (instance.propsProxy = setup.length
|
||||
? immutable(instance.props)
|
||||
? immutableState(instance.props)
|
||||
: null)
|
||||
instance.state = observable(setup.call(proxy, propsProxy))
|
||||
instance.state = state(setup.call(proxy, propsProxy))
|
||||
currentInstance = null
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { immutable, unwrap, lock, unlock } from '@vue/observer'
|
||||
import { immutableState, toRaw, lock, unlock } from '@vue/reactivity'
|
||||
import {
|
||||
EMPTY_OBJ,
|
||||
camelize,
|
||||
@@ -140,7 +140,7 @@ export function resolveProps(
|
||||
}
|
||||
// runtime validation
|
||||
if (__DEV__ && rawProps) {
|
||||
validateProp(key, unwrap(rawProps[key]), opt, isAbsent)
|
||||
validateProp(key, toRaw(rawProps[key]), opt, isAbsent)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@@ -152,7 +152,7 @@ export function resolveProps(
|
||||
// the props proxy
|
||||
const { patchFlag } = instance.vnode
|
||||
if (propsProxy !== null && (patchFlag === 0 || patchFlag & FULL_PROPS)) {
|
||||
const rawInitialProps = unwrap(propsProxy)
|
||||
const rawInitialProps = toRaw(propsProxy)
|
||||
for (const key in rawInitialProps) {
|
||||
if (!props.hasOwnProperty(key)) {
|
||||
delete propsProxy[key]
|
||||
@@ -163,10 +163,10 @@ export function resolveProps(
|
||||
// lock immutable
|
||||
lock()
|
||||
|
||||
instance.props = __DEV__ ? immutable(props) : props
|
||||
instance.props = __DEV__ ? immutableState(props) : props
|
||||
instance.attrs = options
|
||||
? __DEV__
|
||||
? immutable(attrs)
|
||||
? immutableState(attrs)
|
||||
: attrs
|
||||
: instance.props
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ import {
|
||||
FULL_PROPS
|
||||
} from './patchFlags'
|
||||
import { queueJob, queuePostFlushCb, flushPostFlushCbs } from './scheduler'
|
||||
import { effect, stop, ReactiveEffectOptions } from '@vue/observer'
|
||||
import { effect, stop, ReactiveEffectOptions } from '@vue/reactivity'
|
||||
import { resolveProps } from './componentProps'
|
||||
import { resolveSlots } from './componentSlots'
|
||||
import {
|
||||
|
||||
0
packages/runtime-core/src/errorHandling.ts
Normal file
0
packages/runtime-core/src/errorHandling.ts
Normal file
Reference in New Issue
Block a user