refactor(reactivity): remove stale API markReadonly

BREAKING CHANGE: `markReadonly` has been removed.
This commit is contained in:
Evan You 2020-04-13 17:39:48 -04:00
parent 9e9d264412
commit e8a866ec99
4 changed files with 0 additions and 24 deletions

View File

@ -5,7 +5,6 @@ import {
isReactive,
isReadonly,
markNonReactive,
markReadonly,
lock,
unlock,
effect,
@ -424,17 +423,6 @@ describe('reactivity/readonly', () => {
expect(isReactive(obj.bar)).toBe(false)
})
test('markReadonly', () => {
const obj = reactive({
foo: { a: 1 },
bar: markReadonly({ b: 2 })
})
expect(isReactive(obj.foo)).toBe(true)
expect(isReactive(obj.bar)).toBe(true)
expect(isReadonly(obj.foo)).toBe(false)
expect(isReadonly(obj.bar)).toBe(true)
})
test('should make ref readonly', () => {
const n: any = readonly(ref(1))
n.value = 2

View File

@ -7,7 +7,6 @@ export {
isReadonly,
shallowReadonly,
toRaw,
markReadonly,
markNonReactive
} from './reactive'
export {

View File

@ -20,7 +20,6 @@ const readonlyToRaw = new WeakMap<any, any>()
// WeakSets for values that are marked readonly or non-reactive during
// observable creation.
const readonlyValues = new WeakSet<any>()
const nonReactiveValues = new WeakSet<any>()
const collectionTypes = new Set<Function>([Set, Map, WeakMap, WeakSet])
@ -47,10 +46,6 @@ export function reactive(target: object) {
if (readonlyToRaw.has(target)) {
return target
}
// target is explicitly marked as readonly by user
if (readonlyValues.has(target)) {
return readonly(target)
}
if (isRef(target)) {
return target
}
@ -156,11 +151,6 @@ export function toRaw<T>(observed: T): T {
return reactiveToRaw.get(observed) || readonlyToRaw.get(observed) || observed
}
export function markReadonly<T>(value: T): T {
readonlyValues.add(value)
return value
}
export function markNonReactive<T extends object>(value: T): T {
nonReactiveValues.add(value)
return value

View File

@ -13,7 +13,6 @@ export {
isReadonly,
shallowReactive,
toRaw,
markReadonly,
markNonReactive
} from '@vue/reactivity'
export { computed } from './apiComputed'