wip: compiler deprecation config

This commit is contained in:
Evan You
2021-04-12 19:42:09 -04:00
parent 115372dd5b
commit e130c7db23
9 changed files with 198 additions and 18 deletions

View File

@@ -12,12 +12,12 @@ export interface DOMCompilerError extends CompilerError {
export function createDOMCompilerError(
code: DOMErrorCodes,
loc?: SourceLocation
): DOMCompilerError {
) {
return createCompilerError(
code,
loc,
__DEV__ || !__BROWSER__ ? DOMErrorMessages : undefined
)
) as DOMCompilerError
}
export const enum DOMErrorCodes {

View File

@@ -8,7 +8,9 @@ import {
createCompoundExpression,
ExpressionNode,
SimpleExpressionNode,
isStaticExp
isStaticExp,
warnDeprecation,
CompilerDeprecationTypes
} from '@vue/compiler-core'
import { V_ON_WITH_MODIFIERS, V_ON_WITH_KEYS } from '../runtimeHelpers'
import { makeMap, capitalize } from '@vue/shared'
@@ -93,7 +95,11 @@ export const transformOn: DirectiveTransform = (dir, node, context) => {
if (!modifiers.length) return baseResult
if (__COMPAT__ && __DEV__ && modifiers.includes('native')) {
console.warn('.native modifier for v-on has been removed')
warnDeprecation(
CompilerDeprecationTypes.V_ON_NATIVE_MODIFIER,
context,
dir.loc
)
}
let { key, value: handlerExp } = baseResult.props[0]