chore: fix typo for babelParserDefautPlugins
(#1897)
This commit is contained in:
parent
7dd067206c
commit
075d769e0b
@ -20,7 +20,7 @@ import { advancePositionWithClone, isSimpleIdentifier } from '../utils'
|
||||
import {
|
||||
isGloballyWhitelisted,
|
||||
makeMap,
|
||||
babelParserDefautPlugins,
|
||||
babelParserDefaultPlugins,
|
||||
hasOwn
|
||||
} from '@vue/shared'
|
||||
import { createCompilerError, ErrorCodes } from '../errors'
|
||||
@ -135,7 +135,7 @@ export function processExpression(
|
||||
: `(${rawExp})${asParams ? `=>{}` : ``}`
|
||||
try {
|
||||
ast = parse(source, {
|
||||
plugins: [...context.expressionPlugins, ...babelParserDefautPlugins]
|
||||
plugins: [...context.expressionPlugins, ...babelParserDefaultPlugins]
|
||||
}).program
|
||||
} catch (e) {
|
||||
context.onError(
|
||||
|
@ -113,15 +113,13 @@ export const transformModel: DirectiveTransform = (dir, node, context) => {
|
||||
|
||||
// native vmodel doesn't need the `modelValue` props since they are also
|
||||
// passed to the runtime as `binding.value`. removing it reduces code size.
|
||||
baseResult.props = baseResult.props.filter(p => {
|
||||
if (
|
||||
p.key.type === NodeTypes.SIMPLE_EXPRESSION &&
|
||||
p.key.content === 'modelValue'
|
||||
) {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
})
|
||||
baseResult.props = baseResult.props.filter(
|
||||
p =>
|
||||
!(
|
||||
p.key.type === NodeTypes.SIMPLE_EXPRESSION &&
|
||||
p.key.content === 'modelValue'
|
||||
)
|
||||
)
|
||||
|
||||
return baseResult
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { parse, SFCScriptCompileOptions, compileScript } from '../src'
|
||||
import { parse as babelParse } from '@babel/parser'
|
||||
import { babelParserDefautPlugins } from '@vue/shared'
|
||||
import { babelParserDefaultPlugins } from '@vue/shared'
|
||||
|
||||
function compile(src: string, options?: SFCScriptCompileOptions) {
|
||||
const { descriptor } = parse(src)
|
||||
@ -12,7 +12,7 @@ function assertCode(code: string) {
|
||||
try {
|
||||
babelParse(code, {
|
||||
sourceType: 'module',
|
||||
plugins: [...babelParserDefautPlugins, 'typescript']
|
||||
plugins: [...babelParserDefaultPlugins, 'typescript']
|
||||
})
|
||||
} catch (e) {
|
||||
console.log(code)
|
||||
|
@ -2,7 +2,7 @@ import MagicString from 'magic-string'
|
||||
import { BindingMetadata } from '@vue/compiler-core'
|
||||
import { SFCDescriptor, SFCScriptBlock } from './parse'
|
||||
import { parse, ParserPlugin } from '@babel/parser'
|
||||
import { babelParserDefautPlugins, generateCodeFrame } from '@vue/shared'
|
||||
import { babelParserDefaultPlugins, generateCodeFrame } from '@vue/shared'
|
||||
import {
|
||||
Node,
|
||||
Declaration,
|
||||
@ -58,7 +58,7 @@ export function compileScript(
|
||||
const isTS = scriptLang === 'ts' || scriptSetupLang === 'ts'
|
||||
const plugins: ParserPlugin[] = [
|
||||
...(options.babelParserPlugins || []),
|
||||
...babelParserDefautPlugins,
|
||||
...babelParserDefaultPlugins,
|
||||
...(isTS ? (['typescript'] as const) : [])
|
||||
]
|
||||
|
||||
|
@ -19,7 +19,7 @@ export * from './toDisplayString'
|
||||
* for ES2020. This will need to be updated as the spec moves forward.
|
||||
* Full list at https://babeljs.io/docs/en/next/babel-parser#plugins
|
||||
*/
|
||||
export const babelParserDefautPlugins = [
|
||||
export const babelParserDefaultPlugins = [
|
||||
'bigInt',
|
||||
'optionalChaining',
|
||||
'nullishCoalescingOperator'
|
||||
|
Loading…
Reference in New Issue
Block a user