chore: run updated prettier

This commit is contained in:
Evan You
2021-07-19 18:24:18 -04:00
parent 69344ff1ae
commit 47f488350c
110 changed files with 695 additions and 698 deletions

View File

@@ -678,7 +678,9 @@ export function compileScript(
.map(key => {
let defaultString: string | undefined
if (hasStaticDefaults) {
const prop = (propsRuntimeDefaults as ObjectExpression).properties.find(
const prop = (
propsRuntimeDefaults as ObjectExpression
).properties.find(
(node: any) => node.key.name === key
) as ObjectProperty
if (prop) {
@@ -776,9 +778,7 @@ export function compileScript(
// rewrite to `import { x as __default__ } from './x'` and
// add to top
s.prepend(
`import { ${
defaultSpecifier.local.name
} as ${defaultTempVar} } from '${node.source.value}'\n`
`import { ${defaultSpecifier.local.name} as ${defaultTempVar} } from '${node.source.value}'\n`
)
} else {
// export { x as default }
@@ -1376,11 +1376,11 @@ export function compileScript(
...scriptSetup,
bindings: bindingMetadata,
content: s.toString(),
map: (s.generateMap({
map: s.generateMap({
source: filename,
hires: true,
includeContent: true
}) as unknown) as RawSourceMap,
}) as unknown as RawSourceMap,
scriptAst,
scriptSetupAst
}
@@ -1470,8 +1470,8 @@ function walkObjectPattern(
const type = isDefineCall
? BindingTypes.SETUP_CONST
: isConst
? BindingTypes.SETUP_MAYBE_REF
: BindingTypes.SETUP_LET
? BindingTypes.SETUP_MAYBE_REF
: BindingTypes.SETUP_LET
registerBinding(bindings, p.key, type)
} else {
walkPattern(p.value, bindings, isConst, isDefineCall)
@@ -1507,8 +1507,8 @@ function walkPattern(
const type = isDefineCall
? BindingTypes.SETUP_CONST
: isConst
? BindingTypes.SETUP_MAYBE_REF
: BindingTypes.SETUP_LET
? BindingTypes.SETUP_MAYBE_REF
: BindingTypes.SETUP_LET
registerBinding(bindings, node, type)
} else if (node.type === 'RestElement') {
// argument can only be identifer when destructuring
@@ -1523,8 +1523,8 @@ function walkPattern(
const type = isDefineCall
? BindingTypes.SETUP_CONST
: isConst
? BindingTypes.SETUP_MAYBE_REF
: BindingTypes.SETUP_LET
? BindingTypes.SETUP_MAYBE_REF
: BindingTypes.SETUP_LET
registerBinding(bindings, node.left, type)
} else {
walkPattern(node.left, bindings, isConst)
@@ -1651,9 +1651,9 @@ function inferRuntimeType(
case 'TSUnionType':
return [
...new Set(
[].concat(node.types.map(t =>
inferRuntimeType(t, declaredTypes)
) as any)
[].concat(
node.types.map(t => inferRuntimeType(t, declaredTypes)) as any
)
)
]
case 'TSIntersectionType':
@@ -1668,8 +1668,8 @@ function toRuntimeTypeString(types: string[]) {
return types.some(t => t === 'null')
? `null`
: types.length > 1
? `[${types.join(', ')}]`
: types[0]
? `[${types.join(', ')}]`
: types[0]
}
function extractRuntimeEmits(

View File

@@ -79,9 +79,10 @@ export function compileStyle(
export function compileStyleAsync(
options: SFCAsyncStyleCompileOptions
): Promise<SFCStyleCompileResults> {
return doCompileStyle({ ...options, isAsync: true }) as Promise<
SFCStyleCompileResults
>
return doCompileStyle({
...options,
isAsync: true
}) as Promise<SFCStyleCompileResults>
}
export function doCompileStyle(

View File

@@ -140,14 +140,10 @@ export function compileTemplate(
code: `export default function render() {}`,
source: options.source,
tips: [
`Component ${
options.filename
} uses lang ${preprocessLang} for template. Please install the language preprocessor.`
`Component ${options.filename} uses lang ${preprocessLang} for template. Please install the language preprocessor.`
],
errors: [
`Component ${
options.filename
} uses lang ${preprocessLang} for template, however it is not installed.`
`Component ${options.filename} uses lang ${preprocessLang} for template, however it is not installed.`
]
}
} else {

View File

@@ -12,7 +12,8 @@ import { PluginCreator } from 'postcss'
import hash from 'hash-sum'
export const CSS_VARS_HELPER = `useCssVars`
export const cssVarRE = /\bv-bind\(\s*(?:'([^']+)'|"([^"]+)"|([^'"][^)]*))\s*\)/g
export const cssVarRE =
/\bv-bind\(\s*(?:'([^']+)'|"([^"]+)"|([^'"][^)]*))\s*\)/g
export function genCssVarsFromList(
vars: string[],

View File

@@ -3,7 +3,8 @@ import MagicString from 'magic-string'
const defaultExportRE = /((?:^|\n|;)\s*)export(\s*)default/
const namedDefaultExportRE = /((?:^|\n|;)\s*)export(.+)as(\s*)default/s
const exportDefaultClassRE = /((?:^|\n|;)\s*)export\s+default\s+class\s+([\w$]+)/
const exportDefaultClassRE =
/((?:^|\n|;)\s*)export\s+default\s+class\s+([\w$]+)/
/**
* Utility for rewriting `export default` in a script block into a variable