diff --git a/packages/compiler-core/__tests__/transforms/vFor.spec.ts b/packages/compiler-core/__tests__/transforms/vFor.spec.ts index 30f54dce..5dfcc068 100644 --- a/packages/compiler-core/__tests__/transforms/vFor.spec.ts +++ b/packages/compiler-core/__tests__/transforms/vFor.spec.ts @@ -259,7 +259,7 @@ describe('compiler: transform v-for', () => { }) test('de-structured value', () => { - const source = '' + const source = '' const forNode = parseWithForTransform(source) const valueIndex = source.indexOf('{ id, key }') diff --git a/packages/compiler-core/src/transforms/vFor.ts b/packages/compiler-core/src/transforms/vFor.ts index 04c6bf34..9c6b315e 100644 --- a/packages/compiler-core/src/transforms/vFor.ts +++ b/packages/compiler-core/src/transforms/vFor.ts @@ -13,10 +13,6 @@ import { getInnerRange } from '../utils' import { RENDER_LIST } from '../runtimeConstants' import { processExpression } from './transformExpression' -const forAliasRE = /([\s\S]*?)(?:(?<=\))|\s+)(?:in|of)\s+([\s\S]*)/ -const forIteratorRE = /,([^,\}\]]*)(?:,([^,\}\]]*))?$/ -const stripParensRE = /^\(|\)$/g - export const transformFor = createStructuralDirectiveTransform( 'for', (node, dir, context) => { @@ -64,6 +60,10 @@ export const transformFor = createStructuralDirectiveTransform( } ) +const forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/ +const forIteratorRE = /,([^,\}\]]*)(?:,([^,\}\]]*))?$/ +const stripParensRE = /^\(|\)$/g + interface ForParseResult { source: ExpressionNode value: ExpressionNode | undefined