diff --git a/.eslintrc.cjs b/.eslintrc.cjs index 9d8ae097..3f3d0ec8 100644 --- a/.eslintrc.cjs +++ b/.eslintrc.cjs @@ -8,13 +8,13 @@ module.exports = defineConfig({ 'eslint:recommended', 'plugin:node/recommended', 'plugin:@typescript-eslint/recommended', - 'plugin:regexp/recommended' + 'plugin:regexp/recommended', ], plugins: ['import', 'regexp'], parser: '@typescript-eslint/parser', parserOptions: { sourceType: 'module', - ecmaVersion: 2021 + ecmaVersion: 2021, }, rules: { eqeqeq: ['warn', 'always', { null: 'never' }], @@ -25,36 +25,36 @@ module.exports = defineConfig({ 'prefer-const': [ 'warn', { - destructuring: 'all' - } + destructuring: 'all', + }, ], 'node/no-missing-import': [ 'error', { allowModules: ['types', 'estree', 'less', 'sass', 'stylus'], - tryExtensions: ['.ts', '.js', '.jsx', '.tsx', '.d.ts'] - } + tryExtensions: ['.ts', '.js', '.jsx', '.tsx', '.d.ts'], + }, ], 'node/no-missing-require': [ 'error', { // for try-catching yarn pnp allowModules: ['pnpapi', 'vite'], - tryExtensions: ['.ts', '.js', '.jsx', '.tsx', '.d.ts'] - } + tryExtensions: ['.ts', '.js', '.jsx', '.tsx', '.d.ts'], + }, ], 'node/no-extraneous-import': [ 'error', { - allowModules: ['vite', 'less', 'sass', 'vitest'] - } + allowModules: ['vite', 'less', 'sass', 'vitest'], + }, ], 'node/no-extraneous-require': [ 'error', { - allowModules: ['vite'] - } + allowModules: ['vite'], + }, ], 'node/no-deprecated-api': 'off', 'node/no-unpublished-import': 'off', @@ -65,11 +65,11 @@ module.exports = defineConfig({ '@typescript-eslint/ban-types': 'off', // TODO: we should turn this on in a new PR '@typescript-eslint/explicit-module-boundary-types': [ 'error', - { allowArgumentsExplicitlyTypedAsAny: true } + { allowArgumentsExplicitlyTypedAsAny: true }, ], '@typescript-eslint/no-empty-function': [ 'error', - { allow: ['arrowFunctions'] } + { allow: ['arrowFunctions'] }, ], '@typescript-eslint/no-empty-interface': 'off', '@typescript-eslint/no-explicit-any': 'off', // maybe we should turn this on in a new PR @@ -80,12 +80,12 @@ module.exports = defineConfig({ '@typescript-eslint/no-var-requires': 'off', '@typescript-eslint/consistent-type-imports': [ 'error', - { prefer: 'type-imports' } + { prefer: 'type-imports' }, ], 'import/no-nodejs-modules': [ 'error', - { allow: builtinModules.map((mod) => `node:${mod}`) } + { allow: builtinModules.map((mod) => `node:${mod}`) }, ], 'import/no-duplicates': 'error', 'import/order': 'error', @@ -96,33 +96,38 @@ module.exports = defineConfig({ ignoreDeclarationSort: true, ignoreMemberSort: false, memberSyntaxSortOrder: ['none', 'all', 'multiple', 'single'], - allowSeparatedGroups: false - } + allowSeparatedGroups: false, + }, ], - 'regexp/no-contradiction-with-assertion': 'error' + 'regexp/no-contradiction-with-assertion': 'error', }, overrides: [ { files: ['packages/**'], excludedFiles: '**/__tests__/**', rules: { - 'no-restricted-globals': ['error', 'require', '__dirname', '__filename'] - } + 'no-restricted-globals': [ + 'error', + 'require', + '__dirname', + '__filename', + ], + }, }, { files: ['*.spec.ts'], rules: { - 'node/no-extraneous-import': 'off' - } + 'node/no-extraneous-import': 'off', + }, }, { files: ['**/build.config.ts'], rules: { 'no-undef': 'off', 'node/no-missing-import': 'off', - '@typescript-eslint/explicit-module-boundary-types': 'off' - } + '@typescript-eslint/explicit-module-boundary-types': 'off', + }, }, { files: ['playground/**'], @@ -135,17 +140,17 @@ module.exports = defineConfig({ 'node/no-unsupported-features/es-builtins': [ 'error', { - version: '^14.18.0 || >=16.0.0' - } + version: '^14.18.0 || >=16.0.0', + }, ], 'node/no-unsupported-features/node-builtins': [ 'error', { - version: '^14.18.0 || >=16.0.0' - } + version: '^14.18.0 || >=16.0.0', + }, ], - '@typescript-eslint/explicit-module-boundary-types': 'off' - } + '@typescript-eslint/explicit-module-boundary-types': 'off', + }, }, { files: ['playground/**'], @@ -154,21 +159,21 @@ module.exports = defineConfig({ 'no-undef': 'off', 'no-empty': 'off', 'no-constant-condition': 'off', - '@typescript-eslint/no-empty-function': 'off' - } + '@typescript-eslint/no-empty-function': 'off', + }, }, { files: ['*.js', '*.mjs', '*.cjs'], rules: { - '@typescript-eslint/explicit-module-boundary-types': 'off' - } + '@typescript-eslint/explicit-module-boundary-types': 'off', + }, }, { files: ['*.d.ts'], rules: { - '@typescript-eslint/triple-slash-reference': 'off' - } - } + '@typescript-eslint/triple-slash-reference': 'off', + }, + }, ], - reportUnusedDisableDirectives: true + reportUnusedDisableDirectives: true, }) diff --git a/.github/renovate.json5 b/.github/renovate.json5 index 0014c768..ce03a181 100644 --- a/.github/renovate.json5 +++ b/.github/renovate.json5 @@ -8,8 +8,8 @@ "packageRules": [ { "depTypeList": ["peerDependencies"], - "enabled": false - } + "enabled": false, + }, ], "ignoreDeps": [ // manually bumping @@ -22,6 +22,6 @@ "source-map", // `source-map:v0.7.0+` needs more investigation "dotenv-expand", // `dotenv-expand:6.0.0+` has breaking changes (#6858) "kill-port", // `kill-port:^2.0.0 has perf issues (#8392) - "miniflare" // `miniflare:v2.0.0+` only supports node 16.7 - ] + "miniflare", // `miniflare:v2.0.0+` only supports node 16.7 + ], } diff --git a/.prettierrc.json b/.prettierrc.json index 3a87ddf3..568ce1a2 100644 --- a/.prettierrc.json +++ b/.prettierrc.json @@ -3,7 +3,7 @@ "tabWidth": 2, "singleQuote": true, "printWidth": 80, - "trailingComma": "none", + "trailingComma": "all", "overrides": [ { "files": ["*.json5"], diff --git a/packages/plugin-vue-jsx/README.md b/packages/plugin-vue-jsx/README.md index c75e6d78..5b74fdda 100644 --- a/packages/plugin-vue-jsx/README.md +++ b/packages/plugin-vue-jsx/README.md @@ -10,8 +10,8 @@ export default { plugins: [ vueJsx({ // options are passed on to @vue/babel-plugin-jsx - }) - ] + }), + ], } ``` diff --git a/packages/plugin-vue-jsx/build.config.ts b/packages/plugin-vue-jsx/build.config.ts index 6dcf1a5a..360c2e7c 100644 --- a/packages/plugin-vue-jsx/build.config.ts +++ b/packages/plugin-vue-jsx/build.config.ts @@ -5,6 +5,6 @@ export default defineBuildConfig({ clean: true, declaration: true, rollup: { - emitCJS: true - } + emitCJS: true, + }, }) diff --git a/packages/plugin-vue-jsx/src/index.ts b/packages/plugin-vue-jsx/src/index.ts index 15fcb808..a1e74d2a 100644 --- a/packages/plugin-vue-jsx/src/index.ts +++ b/packages/plugin-vue-jsx/src/index.ts @@ -49,12 +49,12 @@ function vueJsxPlugin(options: Options = {}): Plugin { // only apply esbuild to ts files // since we are handling jsx and tsx now esbuild: { - include: /\.ts$/ + include: /\.ts$/, }, define: { __VUE_OPTIONS_API__: config.define?.__VUE_OPTIONS_API__ ?? true, - __VUE_PROD_DEVTOOLS__: config.define?.__VUE_PROD_DEVTOOLS__ ?? false - } + __VUE_PROD_DEVTOOLS__: config.define?.__VUE_PROD_DEVTOOLS__ ?? false, + }, } }, @@ -88,10 +88,10 @@ function vueJsxPlugin(options: Options = {}): Plugin { plugins.push([ // @ts-ignore missing type await import('@babel/plugin-transform-typescript').then( - (r) => r.default + (r) => r.default, ), // @ts-ignore - { isTSX: true, allowExtensions: true } + { isTSX: true, allowExtensions: true }, ]) } @@ -105,9 +105,9 @@ function vueJsxPlugin(options: Options = {}): Plugin { const callee = _path.node.callee as Identifier callee.name = `/* @__PURE__ */ ${callee.name}` } - } - } - } + }, + }, + }, } }) } @@ -118,14 +118,14 @@ function vueJsxPlugin(options: Options = {}): Plugin { plugins, sourceMaps: needSourceMap, sourceFileName: id, - configFile: false + configFile: false, })! if (!ssr && !needHmr) { if (!result.code) return return { code: result.code, - map: result.map + map: result.map, } } @@ -158,9 +158,9 @@ function vueJsxPlugin(options: Options = {}): Plugin { ({ name }) => ({ local: name, exported: name, - id: getHash(id + name) - }) - ) + id: getHash(id + name), + }), + ), ) } else if (node.specifiers.length) { for (const spec of node.specifiers) { @@ -169,13 +169,13 @@ function vueJsxPlugin(options: Options = {}): Plugin { spec.exported.type === 'Identifier' ) { const matched = declaredComponents.find( - ({ name }) => name === spec.local.name + ({ name }) => name === spec.local.name, ) if (matched) { hotComponents.push({ local: spec.local.name, exported: spec.exported.name, - id: getHash(id + spec.exported.name) + id: getHash(id + spec.exported.name), }) } } @@ -187,13 +187,13 @@ function vueJsxPlugin(options: Options = {}): Plugin { if (node.declaration.type === 'Identifier') { const _name = node.declaration.name const matched = declaredComponents.find( - ({ name }) => name === _name + ({ name }) => name === _name, ) if (matched) { hotComponents.push({ local: node.declaration.name, exported: 'default', - id: getHash(id + 'default') + id: getHash(id + 'default'), }) } } else if (isDefineComponentCall(node.declaration)) { @@ -201,7 +201,7 @@ function vueJsxPlugin(options: Options = {}): Plugin { hotComponents.push({ local: '__default__', exported: 'default', - id: getHash(id + 'default') + id: getHash(id + 'default'), }) } } @@ -212,7 +212,7 @@ function vueJsxPlugin(options: Options = {}): Plugin { result.code = result.code!.replace( /export default defineComponent/g, - `const __default__ = defineComponent` + `const __default__ = defineComponent`, ) + `\nexport default __default__` } @@ -248,10 +248,10 @@ function vueJsxPlugin(options: Options = {}): Plugin { if (!result.code) return return { code: result.code, - map: result.map + map: result.map, } } - } + }, } } @@ -260,7 +260,7 @@ function parseComponentDecls(node: types.VariableDeclaration, source: string) { for (const decl of node.declarations) { if (decl.id.type === 'Identifier' && isDefineComponentCall(decl.init)) { names.push({ - name: decl.id.name + name: decl.id.name, }) } } diff --git a/packages/plugin-vue/README.md b/packages/plugin-vue/README.md index 1b9cdad6..1b6e025c 100644 --- a/packages/plugin-vue/README.md +++ b/packages/plugin-vue/README.md @@ -7,7 +7,7 @@ import vue from '@vitejs/plugin-vue' export default { - plugins: [vue()] + plugins: [vue()], } ``` @@ -113,10 +113,10 @@ export default { }, transformAssetUrls: { // ... - } - } - }) - ] + }, + }, + }), + ], } ``` @@ -138,11 +138,11 @@ const vueI18nPlugin = { return `export default Comp => { Comp.i18n = ${code} }` - } + }, } export default { - plugins: [vue(), vueI18nPlugin] + plugins: [vue(), vueI18nPlugin], } ``` diff --git a/packages/plugin-vue/build.config.ts b/packages/plugin-vue/build.config.ts index 4f9d811a..940aa88c 100644 --- a/packages/plugin-vue/build.config.ts +++ b/packages/plugin-vue/build.config.ts @@ -7,6 +7,6 @@ export default defineBuildConfig({ declaration: true, rollup: { emitCJS: true, - inlineDependencies: true - } + inlineDependencies: true, + }, }) diff --git a/packages/plugin-vue/src/compiler.ts b/packages/plugin-vue/src/compiler.ts index f9338f52..1051eba0 100644 --- a/packages/plugin-vue/src/compiler.ts +++ b/packages/plugin-vue/src/compiler.ts @@ -17,7 +17,7 @@ export function resolveCompiler(root: string): typeof _compiler { throw new Error( `Failed to resolve vue/compiler-sfc.\n` + `@vitejs/plugin-vue requires vue (>=3.2.25) ` + - `to be present in the dependency tree.` + `to be present in the dependency tree.`, ) } diff --git a/packages/plugin-vue/src/handleHotUpdate.ts b/packages/plugin-vue/src/handleHotUpdate.ts index d1dde364..4e256f64 100644 --- a/packages/plugin-vue/src/handleHotUpdate.ts +++ b/packages/plugin-vue/src/handleHotUpdate.ts @@ -6,7 +6,7 @@ import { isCSSRequest } from 'vite' import { createDescriptor, getDescriptor, - setPrevDescriptor + setPrevDescriptor, } from './utils/descriptorCache' import { getResolvedScript, setResolvedScript } from './script' import type { ResolvedOptions } from '.' @@ -20,7 +20,7 @@ const directRequestRE = /(?:\?|&)direct\b/ */ export async function handleHotUpdate( { file, modules, read, server }: HmrContext, - options: ResolvedOptions + options: ResolvedOptions, ): Promise { const prevDescriptor = getDescriptor(file, options, false) if (!prevDescriptor) { @@ -55,7 +55,7 @@ export async function handleHotUpdate( const scriptModuleRE = new RegExp( `type=script.*&lang\.${ descriptor.scriptSetup?.lang || descriptor.script?.lang - }$` + }$`, ) scriptModule = modules.find((m) => scriptModuleRE.test(m.url)) } @@ -71,7 +71,7 @@ export async function handleHotUpdate( setResolvedScript( descriptor, getResolvedScript(prevDescriptor, false)!, - false + false, ) } affectedModules.add(templateModule) @@ -105,7 +105,7 @@ export async function handleHotUpdate( (m) => m.url.includes(`type=style&index=${i}`) && m.url.endsWith(`.${next.lang || 'css'}`) && - !directRequestRE.test(m.url) + !directRequestRE.test(m.url), ) if (mod) { affectedModules.add(mod) @@ -137,7 +137,7 @@ export async function handleHotUpdate( const next = nextCustoms[i] if (!prev || !isEqualBlock(prev, next)) { const mod = modules.find((m) => - m.url.includes(`type=${prev.type}&index=${i}`) + m.url.includes(`type=${prev.type}&index=${i}`), ) if (mod) { affectedModules.add(mod) @@ -156,7 +156,7 @@ export async function handleHotUpdate( affectedModules.add(mainModule) } else if (mainModule && !affectedModules.has(mainModule)) { const styleImporters = [...mainModule.importers].filter((m) => - isCSSRequest(m.url) + isCSSRequest(m.url), ) styleImporters.forEach((m) => affectedModules.add(m)) } @@ -186,7 +186,7 @@ export function isEqualBlock(a: SFCBlock | null, b: SFCBlock | null): boolean { export function isOnlyTemplateChanged( prev: SFCDescriptor, - next: SFCDescriptor + next: SFCDescriptor, ): boolean { return ( !hasScriptChanged(prev, next) && diff --git a/packages/plugin-vue/src/index.ts b/packages/plugin-vue/src/index.ts index 76809f0d..58b69d8e 100644 --- a/packages/plugin-vue/src/index.ts +++ b/packages/plugin-vue/src/index.ts @@ -6,7 +6,7 @@ import type { SFCBlock, SFCScriptCompileOptions, SFCStyleCompileOptions, - SFCTemplateCompileOptions + SFCTemplateCompileOptions, } from 'vue/compiler-sfc' import type * as _compiler from 'vue/compiler-sfc' /* eslint-enable import/no-duplicates */ @@ -85,7 +85,7 @@ export default function vuePlugin(rawOptions: Options = {}): Plugin { include = /\.vue$/, exclude, customElement = /\.ce\.vue$/, - reactivityTransform = false + reactivityTransform = false, } = rawOptions const filter = createFilter(include, exclude) @@ -113,7 +113,7 @@ export default function vuePlugin(rawOptions: Options = {}): Plugin { root: process.cwd(), sourceMap: true, cssDevSourcemap: false, - devToolsEnabled: process.env.NODE_ENV !== 'production' + devToolsEnabled: process.env.NODE_ENV !== 'production', } return { @@ -129,17 +129,17 @@ export default function vuePlugin(rawOptions: Options = {}): Plugin { config(config) { return { resolve: { - dedupe: config.build?.ssr ? [] : ['vue'] + dedupe: config.build?.ssr ? [] : ['vue'], }, define: { __VUE_OPTIONS_API__: config.define?.__VUE_OPTIONS_API__ ?? true, - __VUE_PROD_DEVTOOLS__: config.define?.__VUE_PROD_DEVTOOLS__ ?? false + __VUE_PROD_DEVTOOLS__: config.define?.__VUE_PROD_DEVTOOLS__ ?? false, }, ssr: { external: config.legacy?.buildSsrCjsExternalHeuristics ? ['vue', '@vue/server-renderer'] - : [] - } + : [], + }, } }, @@ -151,7 +151,7 @@ export default function vuePlugin(rawOptions: Options = {}): Plugin { cssDevSourcemap: config.css?.devSourcemap ?? false, isProduction: config.isProduction, devToolsEnabled: - !!config.define!.__VUE_PROD_DEVTOOLS__ || !config.isProduction + !!config.define!.__VUE_PROD_DEVTOOLS__ || !config.isProduction, } }, @@ -201,7 +201,7 @@ export default function vuePlugin(rawOptions: Options = {}): Plugin { if (block) { return { code: block.content, - map: block.map as any + map: block.map as any, } } } @@ -221,7 +221,7 @@ export default function vuePlugin(rawOptions: Options = {}): Plugin { ) { return options.compiler.transformRef(code, { filename, - sourceMap: true + sourceMap: true, }) } return @@ -235,7 +235,7 @@ export default function vuePlugin(rawOptions: Options = {}): Plugin { options, this, ssr, - customElementFilter(filename) + customElementFilter(filename), ) } else { // sub block request @@ -252,10 +252,10 @@ export default function vuePlugin(rawOptions: Options = {}): Plugin { Number(query.index), options, this, - filename + filename, ) } } - } + }, } } diff --git a/packages/plugin-vue/src/main.ts b/packages/plugin-vue/src/main.ts index 64ad9346..708fa7de 100644 --- a/packages/plugin-vue/src/main.ts +++ b/packages/plugin-vue/src/main.ts @@ -10,7 +10,7 @@ import { normalizePath, transformWithEsbuild } from 'vite' import { createDescriptor, getPrevDescriptor, - setSrcDescriptor + setSrcDescriptor, } from './utils/descriptorCache' import { isUseInlineTemplate, resolveScript } from './script' import { transformTemplateInMain } from './template' @@ -26,7 +26,7 @@ export async function transformMain( options: ResolvedOptions, pluginContext: TransformPluginContext, ssr: boolean, - asCustomElement: boolean + asCustomElement: boolean, ) { const { devServer, isProduction, devToolsEnabled } = options @@ -36,7 +36,7 @@ export async function transformMain( if (errors.length) { errors.forEach((error) => - pluginContext.error(createRollupError(filename, error)) + pluginContext.error(createRollupError(filename, error)), ) return null } @@ -50,7 +50,7 @@ export async function transformMain( descriptor, options, pluginContext, - ssr + ssr, ) // template @@ -64,13 +64,13 @@ export async function transformMain( descriptor, options, pluginContext, - ssr + ssr, )) } if (hasTemplateImport) { attachedProps.push( - ssr ? ['ssrRender', '_sfc_ssrRender'] : ['render', '_sfc_render'] + ssr ? ['ssrRender', '_sfc_ssrRender'] : ['render', '_sfc_render'], ) } else { // #2128 @@ -88,7 +88,7 @@ export async function transformMain( descriptor, pluginContext, asCustomElement, - attachedProps + attachedProps, ) // custom blocks @@ -98,7 +98,7 @@ export async function transformMain( scriptCode, templateCode, stylesCode, - customBlocksCode + customBlocksCode, ] if (hasScoped) { attachedProps.push([`__scopeId`, JSON.stringify(`data-v-${descriptor.id}`)]) @@ -107,7 +107,7 @@ export async function transformMain( // expose filename during serve for devtools to pickup attachedProps.push([ `__file`, - JSON.stringify(isProduction ? path.basename(filename) : filename) + JSON.stringify(isProduction ? path.basename(filename) : filename), ]) } @@ -121,7 +121,7 @@ export async function transformMain( output.push(`_sfc_main.__hmrId = ${JSON.stringify(descriptor.id)}`) output.push( `typeof __VUE_HMR_RUNTIME__ !== 'undefined' && ` + - `__VUE_HMR_RUNTIME__.createRecord(_sfc_main.__hmrId, _sfc_main)` + `__VUE_HMR_RUNTIME__.createRecord(_sfc_main.__hmrId, _sfc_main)`, ) // check if the template is the only thing that changed if (prevDescriptor && isOnlyTemplateChanged(prevDescriptor, descriptor)) { @@ -136,14 +136,14 @@ export async function transformMain( ` } else {`, ` __VUE_HMR_RUNTIME__.reload(updated.__hmrId, updated)`, ` }`, - `})` + `})`, ) } // SSR module registration by wrapping user setup if (ssr) { const normalizedFilename = normalizePath( - path.relative(options.root, filename) + path.relative(options.root, filename), ) output.push( `import { useSSRContext as __vite_useSSRContext } from 'vue'`, @@ -151,10 +151,10 @@ export async function transformMain( `_sfc_main.setup = (props, ctx) => {`, ` const ssrContext = __vite_useSSRContext()`, ` ;(ssrContext.modules || (ssrContext.modules = new Set())).add(${JSON.stringify( - normalizedFilename + normalizedFilename, )})`, ` return _sfc_setup ? _sfc_setup(props, ctx) : undefined`, - `}` + `}`, ) } @@ -167,11 +167,11 @@ export async function transformMain( const gen = fromMap( // version property of result.map is declared as string // but actually it is `3` - scriptMap as Omit as TraceEncodedSourceMap + scriptMap as Omit as TraceEncodedSourceMap, ) const tracer = new TraceMap( // same above - templateMap as Omit as TraceEncodedSourceMap + templateMap as Omit as TraceEncodedSourceMap, ) const offset = (scriptCode.match(/\r?\n/g)?.length ?? 0) + 1 eachMapping(tracer, (m) => { @@ -181,8 +181,8 @@ export async function transformMain( original: { line: m.originalLine, column: m.originalColumn }, generated: { line: m.generatedLine + offset, - column: m.generatedColumn - } + column: m.generatedColumn, + }, }) }) @@ -207,7 +207,7 @@ export async function transformMain( `import _export_sfc from '${EXPORT_HELPER_ID}'`, `export default /*#__PURE__*/_export_sfc(_sfc_main, [${attachedProps .map(([key, val]) => `['${key}',${val}]`) - .join(',')}])` + .join(',')}])`, ) } @@ -226,9 +226,9 @@ export async function transformMain( { loader: 'ts', target: 'esnext', - sourcemap: options.sourceMap + sourcemap: options.sourceMap, }, - resolvedMap + resolvedMap, ) resolvedCode = code resolvedMap = resolvedMap ? (map as any) : resolvedMap @@ -237,13 +237,13 @@ export async function transformMain( return { code: resolvedCode, map: resolvedMap || { - mappings: '' + mappings: '', }, meta: { vite: { - lang: descriptor.script?.lang || descriptor.scriptSetup?.lang || 'js' - } - } + lang: descriptor.script?.lang || descriptor.scriptSetup?.lang || 'js', + }, + }, } } @@ -251,7 +251,7 @@ async function genTemplateCode( descriptor: SFCDescriptor, options: ResolvedOptions, pluginContext: PluginContext, - ssr: boolean + ssr: boolean, ) { const template = descriptor.template! const hasScoped = descriptor.styles.some((style) => style.scoped) @@ -265,7 +265,7 @@ async function genTemplateCode( descriptor, options, pluginContext, - ssr + ssr, ) } else { if (template.src) { @@ -273,7 +273,7 @@ async function genTemplateCode( template.src, descriptor, pluginContext, - hasScoped + hasScoped, ) } const src = template.src || descriptor.filename @@ -289,7 +289,7 @@ async function genTemplateCode( const renderFnName = ssr ? 'ssrRender' : 'render' return { code: `import { ${renderFnName} as _sfc_${renderFnName} } from ${request}`, - map: undefined + map: undefined, } } } @@ -298,7 +298,7 @@ async function genScriptCode( descriptor: SFCDescriptor, options: ResolvedOptions, pluginContext: PluginContext, - ssr: boolean + ssr: boolean, ): Promise<{ code: string map: RawSourceMap | undefined @@ -324,7 +324,7 @@ async function genScriptCode( scriptCode = options.compiler.rewriteDefault( script.content, '_sfc_main', - [...defaultPlugins, ...userPlugins] + [...defaultPlugins, ...userPlugins], ) map = script.map } else { @@ -343,7 +343,7 @@ async function genScriptCode( } return { code: scriptCode, - map + map, } } @@ -351,7 +351,7 @@ async function genStyleCode( descriptor: SFCDescriptor, pluginContext: PluginContext, asCustomElement: boolean, - attachedProps: [string, string][] + attachedProps: [string, string][], ) { let stylesCode = `` let cssModulesMap: Record | undefined @@ -363,7 +363,7 @@ async function genStyleCode( style.src, descriptor, pluginContext, - style.scoped + style.scoped, ) } const src = style.src || descriptor.filename @@ -382,20 +382,20 @@ async function genStyleCode( if (style.module) { if (asCustomElement) { throw new Error( - `