From 4ea2d9f83c84b666fb300197f760905d5d9e348a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=89=E5=92=B2=E6=99=BA=E5=AD=90=20Kevin=20Deng?= Date: Tue, 28 Mar 2023 16:23:39 +0800 Subject: [PATCH] fix(compiler-sfc): properly remove comma of multiple macros in the same declaration (#7423) closes #7422 reverts #6778 --- .../__snapshots__/compileScript.spec.ts.snap | 18 ++++++++++++++++++ .../__tests__/compileScript.spec.ts | 17 +++++++++++++++++ packages/compiler-sfc/src/compileScript.ts | 16 +++++++++++----- 3 files changed, 46 insertions(+), 5 deletions(-) diff --git a/packages/compiler-sfc/__tests__/__snapshots__/compileScript.spec.ts.snap b/packages/compiler-sfc/__tests__/__snapshots__/compileScript.spec.ts.snap index c8bdb1573e9..99f33959159 100644 --- a/packages/compiler-sfc/__tests__/__snapshots__/compileScript.spec.ts.snap +++ b/packages/compiler-sfc/__tests__/__snapshots__/compileScript.spec.ts.snap @@ -754,6 +754,24 @@ return { a, props, emit } }" `; +exports[`SFC compile + `) + assertCode(content) + expect(content).toMatch(`props: ['item'],`) + expect(content).toMatch(`emits: ['foo'],`) + expect(content).toMatch(`const a = 0,`) + expect(content).toMatch(`b = 0;`) + }) + test('defineProps/defineEmits in multi-variable declaration (full removal)', () => { const { content } = compile(`