chore: move style vars deprecation warning to a parse error

This commit is contained in:
Evan You 2020-11-21 23:53:32 -05:00
parent ac80ea2c19
commit 9cb74960ac

View File

@ -11,7 +11,7 @@ import { RawSourceMap, SourceMapGenerator } from 'source-map'
import { TemplateCompiler } from './compileTemplate' import { TemplateCompiler } from './compileTemplate'
import { Statement } from '@babel/types' import { Statement } from '@babel/types'
import { parseCssVars } from './cssVars' import { parseCssVars } from './cssVars'
import { warnExperimental, warnOnce } from './warn' import { warnExperimental } from './warn'
export interface SFCParseOptions { export interface SFCParseOptions {
filename?: string filename?: string
@ -168,10 +168,12 @@ export function parse(
case 'style': case 'style':
const style = createBlock(node, source, pad) as SFCStyleBlock const style = createBlock(node, source, pad) as SFCStyleBlock
if (style.attrs.vars) { if (style.attrs.vars) {
warnOnce( errors.push(
new SyntaxError(
`<style vars> has been replaced by a new proposal: ` + `<style vars> has been replaced by a new proposal: ` +
`https://github.com/vuejs/rfcs/pull/231` `https://github.com/vuejs/rfcs/pull/231`
) )
)
} }
descriptor.styles.push(style) descriptor.styles.push(style)
break break