From 8ed497de1dded45e51535bd55ac5b91e9718d5a9 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: Sun, 25 Jun 2023 16:52:38 +0800 Subject: [PATCH] fix(jsx): multiline property value closes #598 closes #569 --- packages/babel-plugin-jsx/src/transform-vue-jsx.ts | 2 +- packages/babel-plugin-jsx/src/utils.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/babel-plugin-jsx/src/transform-vue-jsx.ts b/packages/babel-plugin-jsx/src/transform-vue-jsx.ts index 71427a0..57895a0 100644 --- a/packages/babel-plugin-jsx/src/transform-vue-jsx.ts +++ b/packages/babel-plugin-jsx/src/transform-vue-jsx.ts @@ -36,7 +36,7 @@ const getJSXAttributeValue = ( return transformJSXElement(valuePath, state); } if (valuePath.isStringLiteral()) { - return valuePath.node; + return transformJSXText(valuePath); } if (valuePath.isJSXExpressionContainer()) { return transformJSXExpressionContainer(valuePath); diff --git a/packages/babel-plugin-jsx/src/utils.ts b/packages/babel-plugin-jsx/src/utils.ts index 2ee5fc1..0361f55 100644 --- a/packages/babel-plugin-jsx/src/utils.ts +++ b/packages/babel-plugin-jsx/src/utils.ts @@ -138,7 +138,7 @@ export const getJSXAttributeName = (path: NodePath): string => { * @returns StringLiteral | null */ export const transformJSXText = ( - path: NodePath + path: NodePath ): t.StringLiteral | null => { const { node } = path; const lines = node.value.split(/\r\n|\n|\r/);