@@ -17,7 +17,6 @@ import {
1717 isLiteralWhitelisted ,
1818 NodeTypes ,
1919 unwrapTSNode ,
20- walkIdentifiers ,
2120 type SimpleExpressionNode ,
2221 type TextNode ,
2322} from '@vue/compiler-dom'
@@ -137,7 +136,7 @@ export function resolveExpression(
137136 if ( ! node ) return createSimpleExpression ( '' , true )
138137 node = unwrapTSNode (
139138 node . type === 'JSXExpressionContainer' ? node . expression : node ,
140- )
139+ ) as Node
141140 const isStatic =
142141 node . type === 'StringLiteral' ||
143142 node . type === 'JSXText' ||
@@ -163,20 +162,17 @@ export function resolveExpression(
163162 node . start ! -= 7
164163 }
165164 }
166- if ( ! isResolved ) {
167- const offset = node . start ! - 1
168- walkIdentifiers (
169- node ,
170- ( id ) => {
171- if ( ! id . loc ) return
172- id . start = id . loc . start . index ! - offset
173- id . end = id . loc . end . index ! - offset
174- } ,
175- true ,
176- )
177- resolvedExpressions . add ( node )
178- }
179- return resolveSimpleExpression ( source , isStatic , location , node )
165+
166+ return resolveSimpleExpression (
167+ source ,
168+ isStatic ,
169+ location ,
170+ isStatic
171+ ? undefined
172+ : parseExpression ( `(${ source } )` , {
173+ plugins : context . options . expressionPlugins ,
174+ } ) ,
175+ )
180176}
181177
182178export function resolveSimpleExpression (
@@ -309,7 +305,7 @@ export function resolveExpressionWithFn(node: Node, context: TransformContext) {
309305 false ,
310306 node . loc ,
311307 parseExpression ( `(${ text } )=>{}` , {
312- plugins : [ 'typescript' ] ,
308+ plugins : context . options . expressionPlugins ,
313309 } ) ,
314310 )
315311}
0 commit comments