chore: type [ci skip]

This commit is contained in:
那里好脏不可以
2022-05-10 10:51:51 +08:00
committed by GitHub
parent 181872f744
commit 6042ab0f2f
22 changed files with 32 additions and 32 deletions

View File

@@ -64,7 +64,7 @@ const bar = 1
`)
// should generate working code
assertCode(content)
// should anayze bindings
// should analyze bindings
expect(bindings).toStrictEqual({
foo: BindingTypes.PROPS,
bar: BindingTypes.SETUP_CONST,
@@ -403,7 +403,7 @@ defineExpose({ foo: 123 })
assertCode(content)
})
// #4340 interpolations in tempalte strings
// #4340 interpolations in template strings
test('js template string interpolations', () => {
const { content } = compile(`
<script setup lang="ts">

View File

@@ -33,7 +33,7 @@ function genVarName(id: string, raw: string, isProd: boolean): string {
}
}
function noramlizeExpression(exp: string) {
function normalizeExpression(exp: string) {
exp = exp.trim()
if (
(exp[0] === `'` && exp[exp.length - 1] === `'`) ||
@@ -51,7 +51,7 @@ export function parseCssVars(sfc: SFCDescriptor): string[] {
// ignore v-bind() in comments /* ... */
const content = style.content.replace(/\/\*([\s\S]*?)\*\//g, '')
while ((match = cssVarRE.exec(content))) {
const variable = noramlizeExpression(match[1])
const variable = normalizeExpression(match[1])
if (!vars.includes(variable)) {
vars.push(variable)
}
@@ -74,7 +74,7 @@ export const cssVarsPlugin: PluginCreator<CssVarsPluginOptions> = opts => {
// rewrite CSS variables
if (cssVarRE.test(decl.value)) {
decl.value = decl.value.replace(cssVarRE, (_, $1) => {
return `var(--${genVarName(id, noramlizeExpression($1), isProd)})`
return `var(--${genVarName(id, normalizeExpression($1), isProd)})`
})
}
}