chore: run updated prettier
This commit is contained in:
@@ -59,8 +59,8 @@ describe('compiler sfc: transform asset url', () => {
|
||||
test('with explicit base', () => {
|
||||
const { code } = compileWithAssetUrls(
|
||||
`<img src="./bar.png"></img>` + // -> /foo/bar.png
|
||||
`<img src="bar.png"></img>` + // -> bar.png (untouched)
|
||||
`<img src="~bar.png"></img>` + // -> still converts to import
|
||||
`<img src="bar.png"></img>` + // -> bar.png (untouched)
|
||||
`<img src="~bar.png"></img>` + // -> still converts to import
|
||||
`<img src="@theme/bar.png"></img>`, // -> still converts to import
|
||||
{
|
||||
base: '/foo'
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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[],
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user