build: move cssVars logic into compiler-sfc entry

This commit is contained in:
Evan You 2022-06-20 16:10:14 +08:00
parent d3916b69b4
commit 0f2cede374
2 changed files with 5 additions and 4 deletions

View File

@ -10,6 +10,7 @@ import {
import hash from 'hash-sum'
import LRU from 'lru-cache'
import { hmrShouldReload } from './compileScript'
import { parseCssVars } from './cssVars'
const cache = new LRU<string, SFCDescriptor>(100)
@ -57,6 +58,10 @@ export function parse(options: SFCParseOptions): SFCDescriptor {
}
output.filename = filename
// parse CSS vars
output.cssVars = parseCssVars(output)
output.shouldForceReload = prevImports =>
hmrShouldReload(prevImports, output!)

View File

@ -4,7 +4,6 @@ import { makeMap } from 'shared/util'
import { ASTAttr, WarningMessage } from 'types/compiler'
import { BindingMetadata, RawSourceMap } from './types'
import type { ImportBinding } from './compileScript'
import { parseCssVars } from './cssVars'
export const DEFAULT_FILENAME = 'anonymous.vue'
@ -209,8 +208,5 @@ export function parseComponent(
outputSourceRange: options.outputSourceRange
})
// parse CSS vars
sfc.cssVars = parseCssVars(sfc)
return sfc
}