chore: remove babelParserDefaultPlugins

The version of @babel/parser we are using now has these plugins enabled by default.
This commit is contained in:
Evan You
2021-10-07 19:32:59 -04:00
parent ed0071ac1a
commit 646e694f0a
7 changed files with 10 additions and 43 deletions

View File

@@ -1,6 +1,5 @@
import { parse, SFCScriptCompileOptions, compileScript } from '../src'
import { parse as babelParse } from '@babel/parser'
import { babelParserDefaultPlugins } from '@vue/shared'
export const mockId = 'xxxxxxxx'
@@ -20,7 +19,7 @@ export function assertCode(code: string) {
try {
babelParse(code, {
sourceType: 'module',
plugins: [...babelParserDefaultPlugins, 'typescript']
plugins: ['typescript']
})
} catch (e: any) {
console.log(code)

View File

@@ -13,13 +13,7 @@ import {
} from '@vue/compiler-dom'
import { SFCDescriptor, SFCScriptBlock } from './parse'
import { parse as _parse, ParserOptions, ParserPlugin } from '@babel/parser'
import {
babelParserDefaultPlugins,
camelize,
capitalize,
generateCodeFrame,
makeMap
} from '@vue/shared'
import { camelize, capitalize, generateCodeFrame, makeMap } from '@vue/shared'
import {
Node,
Declaration,
@@ -161,7 +155,7 @@ export function compileScript(
scriptLang === 'tsx' ||
scriptSetupLang === 'ts' ||
scriptSetupLang === 'tsx'
const plugins: ParserPlugin[] = [...babelParserDefaultPlugins]
const plugins: ParserPlugin[] = []
if (!isTS || scriptLang === 'tsx' || scriptSetupLang === 'tsx') {
plugins.push('jsx')
}