wip: generate codeframe for compiler deprecations
This commit is contained in:
@@ -124,13 +124,8 @@ export function warnDeprecation(
|
||||
typeof message === 'function' ? message(...args) : message
|
||||
}${link ? `\n Details: ${link}` : ``}`
|
||||
|
||||
if (loc) {
|
||||
const err = new SyntaxError(msg) as CompilerError
|
||||
err.code = key
|
||||
err.loc = loc
|
||||
context.onWarn(err)
|
||||
return
|
||||
}
|
||||
|
||||
context.onWarn(msg)
|
||||
const err = new SyntaxError(msg) as CompilerError
|
||||
err.code = key
|
||||
if (loc) err.loc = loc
|
||||
context.onWarn(err)
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ import { CompilerCompatOptions } from './compat/compatConfig'
|
||||
import { ParserPlugin } from '@babel/parser'
|
||||
|
||||
export interface ErrorHandlingOptions {
|
||||
onWarn?: (msg: string | CompilerError) => void
|
||||
onWarn?: (warning: CompilerError) => void
|
||||
onError?: (error: CompilerError) => void
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user