wip: add private api compat flag
This commit is contained in:
parent
6f8fe4eac9
commit
7b37f78dc9
@ -58,7 +58,9 @@ export const enum DeprecationTypes {
|
|||||||
|
|
||||||
RENDER_FUNCTION = 'RENDER_FUNCTION',
|
RENDER_FUNCTION = 'RENDER_FUNCTION',
|
||||||
|
|
||||||
FILTERS = 'FILTERS'
|
FILTERS = 'FILTERS',
|
||||||
|
|
||||||
|
PRIVATE_APIS = 'PRIVATE_APIS'
|
||||||
}
|
}
|
||||||
|
|
||||||
type DeprecationData = {
|
type DeprecationData = {
|
||||||
@ -404,6 +406,13 @@ const deprecationData: Record<DeprecationTypes, DeprecationData> = {
|
|||||||
`The "|" symbol will be treated as native JavaScript bitwise OR operator. ` +
|
`The "|" symbol will be treated as native JavaScript bitwise OR operator. ` +
|
||||||
`Use method calls or computed properties instead.`,
|
`Use method calls or computed properties instead.`,
|
||||||
link: `https://v3.vuejs.org/guide/migration/filters.html`
|
link: `https://v3.vuejs.org/guide/migration/filters.html`
|
||||||
|
},
|
||||||
|
|
||||||
|
[DeprecationTypes.PRIVATE_APIS]: {
|
||||||
|
message: name =>
|
||||||
|
`"${name}" is a Vue 2 private API that no longer exists in Vue 3. ` +
|
||||||
|
`If you are seeing this warning only due to a dependency, you can ` +
|
||||||
|
`suppress this warning via { PRIVATE_APIS: 'supress-warning' }.`
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -91,8 +91,11 @@ export function installCompatInstanceProperties(map: PublicPropertiesMap) {
|
|||||||
$off: i => off.bind(null, i),
|
$off: i => off.bind(null, i),
|
||||||
|
|
||||||
$children: getCompatChildren,
|
$children: getCompatChildren,
|
||||||
$listeners: getCompatListeners,
|
$listeners: getCompatListeners
|
||||||
|
} as PublicPropertiesMap)
|
||||||
|
|
||||||
|
if (isCompatEnabled(DeprecationTypes.PRIVATE_APIS, null)) {
|
||||||
|
extend(map, {
|
||||||
$vnode: i => i.vnode,
|
$vnode: i => i.vnode,
|
||||||
|
|
||||||
// inject addtional properties into $options for compat
|
// inject addtional properties into $options for compat
|
||||||
@ -127,4 +130,5 @@ export function installCompatInstanceProperties(map: PublicPropertiesMap) {
|
|||||||
_d: () => legacyBindDynamicKeys,
|
_d: () => legacyBindDynamicKeys,
|
||||||
_p: () => legacyPrependModifier
|
_p: () => legacyPrependModifier
|
||||||
} as PublicPropertiesMap)
|
} as PublicPropertiesMap)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -310,7 +310,11 @@ function convertLegacySlots(vnode: VNode): VNode {
|
|||||||
|
|
||||||
export function defineLegacyVNodeProperties(vnode: VNode) {
|
export function defineLegacyVNodeProperties(vnode: VNode) {
|
||||||
if (
|
if (
|
||||||
isCompatEnabled(DeprecationTypes.RENDER_FUNCTION, currentRenderingInstance)
|
isCompatEnabled(
|
||||||
|
DeprecationTypes.RENDER_FUNCTION,
|
||||||
|
currentRenderingInstance
|
||||||
|
) &&
|
||||||
|
isCompatEnabled(DeprecationTypes.PRIVATE_APIS, currentRenderingInstance)
|
||||||
) {
|
) {
|
||||||
const context = currentRenderingInstance
|
const context = currentRenderingInstance
|
||||||
const getInstance = () => vnode.component && vnode.component.proxy
|
const getInstance = () => vnode.component && vnode.component.proxy
|
||||||
|
Loading…
x
Reference in New Issue
Block a user