wip: better experimental feature warnings
This commit is contained in:
@@ -11,6 +11,7 @@ import { RawSourceMap, SourceMapGenerator } from 'source-map'
|
||||
import { TemplateCompiler } from './compileTemplate'
|
||||
import { Statement } from '@babel/types'
|
||||
import { parseCssVars } from './cssVars'
|
||||
import { warnExperimental, warnOnce } from './warn'
|
||||
|
||||
export interface SFCParseOptions {
|
||||
filename?: string
|
||||
@@ -165,7 +166,14 @@ export function parse(
|
||||
errors.push(createDuplicateBlockError(node, isSetup))
|
||||
break
|
||||
case 'style':
|
||||
descriptor.styles.push(createBlock(node, source, pad) as SFCStyleBlock)
|
||||
const style = createBlock(node, source, pad) as SFCStyleBlock
|
||||
if (style.attrs.vars) {
|
||||
warnOnce(
|
||||
`<style vars> has been replaced by a new proposal: ` +
|
||||
`https://github.com/vuejs/rfcs/pull/231`
|
||||
)
|
||||
}
|
||||
descriptor.styles.push(style)
|
||||
break
|
||||
default:
|
||||
descriptor.customBlocks.push(createBlock(node, source, pad))
|
||||
@@ -214,6 +222,9 @@ export function parse(
|
||||
|
||||
// parse CSS vars
|
||||
descriptor.cssVars = parseCssVars(descriptor)
|
||||
if (descriptor.cssVars.length) {
|
||||
warnExperimental(`v-bind() CSS variable injection`, 231)
|
||||
}
|
||||
|
||||
const result = {
|
||||
descriptor,
|
||||
|
||||
Reference in New Issue
Block a user