Skip to content

Commit 075d769

Browse files
authored
chore: fix typo for babelParserDefautPlugins (vuejs#1897)
1 parent 7dd0672 commit 075d769

File tree

5 files changed

+14
-16
lines changed

5 files changed

+14
-16
lines changed

packages/compiler-core/src/transforms/transformExpression.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import { advancePositionWithClone, isSimpleIdentifier } from '../utils'
2020
import {
2121
isGloballyWhitelisted,
2222
makeMap,
23-
babelParserDefautPlugins,
23+
babelParserDefaultPlugins,
2424
hasOwn
2525
} from '@vue/shared'
2626
import { createCompilerError, ErrorCodes } from '../errors'
@@ -135,7 +135,7 @@ export function processExpression(
135135
: `(${rawExp})${asParams ? `=>{}` : ``}`
136136
try {
137137
ast = parse(source, {
138-
plugins: [...context.expressionPlugins, ...babelParserDefautPlugins]
138+
plugins: [...context.expressionPlugins, ...babelParserDefaultPlugins]
139139
}).program
140140
} catch (e) {
141141
context.onError(

packages/compiler-dom/src/transforms/vModel.ts

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -113,15 +113,13 @@ export const transformModel: DirectiveTransform = (dir, node, context) => {
113113

114114
// native vmodel doesn't need the `modelValue` props since they are also
115115
// passed to the runtime as `binding.value`. removing it reduces code size.
116-
baseResult.props = baseResult.props.filter(p => {
117-
if (
118-
p.key.type === NodeTypes.SIMPLE_EXPRESSION &&
119-
p.key.content === 'modelValue'
120-
) {
121-
return false
122-
}
123-
return true
124-
})
116+
baseResult.props = baseResult.props.filter(
117+
p =>
118+
!(
119+
p.key.type === NodeTypes.SIMPLE_EXPRESSION &&
120+
p.key.content === 'modelValue'
121+
)
122+
)
125123

126124
return baseResult
127125
}

packages/compiler-sfc/__tests__/compileScript.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { parse, SFCScriptCompileOptions, compileScript } from '../src'
22
import { parse as babelParse } from '@babel/parser'
3-
import { babelParserDefautPlugins } from '@vue/shared'
3+
import { babelParserDefaultPlugins } from '@vue/shared'
44

55
function compile(src: string, options?: SFCScriptCompileOptions) {
66
const { descriptor } = parse(src)
@@ -12,7 +12,7 @@ function assertCode(code: string) {
1212
try {
1313
babelParse(code, {
1414
sourceType: 'module',
15-
plugins: [...babelParserDefautPlugins, 'typescript']
15+
plugins: [...babelParserDefaultPlugins, 'typescript']
1616
})
1717
} catch (e) {
1818
console.log(code)

packages/compiler-sfc/src/compileScript.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import MagicString from 'magic-string'
22
import { BindingMetadata } from '@vue/compiler-core'
33
import { SFCDescriptor, SFCScriptBlock } from './parse'
44
import { parse, ParserPlugin } from '@babel/parser'
5-
import { babelParserDefautPlugins, generateCodeFrame } from '@vue/shared'
5+
import { babelParserDefaultPlugins, generateCodeFrame } from '@vue/shared'
66
import {
77
Node,
88
Declaration,
@@ -58,7 +58,7 @@ export function compileScript(
5858
const isTS = scriptLang === 'ts' || scriptSetupLang === 'ts'
5959
const plugins: ParserPlugin[] = [
6060
...(options.babelParserPlugins || []),
61-
...babelParserDefautPlugins,
61+
...babelParserDefaultPlugins,
6262
...(isTS ? (['typescript'] as const) : [])
6363
]
6464

packages/shared/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export * from './toDisplayString'
1919
* for ES2020. This will need to be updated as the spec moves forward.
2020
* Full list at https://babeljs.io/docs/en/next/babel-parser#plugins
2121
*/
22-
export const babelParserDefautPlugins = [
22+
export const babelParserDefaultPlugins = [
2323
'bigInt',
2424
'optionalChaining',
2525
'nullishCoalescingOperator'

0 commit comments

Comments
 (0)