From 4d0c445ea5770e9bd6dbee6c6ce6606ac9354418 Mon Sep 17 00:00:00 2001 From: xiaozheng Date: Fri, 1 Sep 2023 09:36:33 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E8=A7=A3=E5=86=B3convertor=E7=BC=96?= =?UTF-8?q?=E8=AF=91=E8=BF=87=E7=A8=8B=E4=B8=AD=E5=87=BA=E7=8E=B0=E7=9A=84?= =?UTF-8?q?=E7=B1=BB=E5=9E=8B=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/taro-cli-convertor/src/util/astConvert.ts | 2 +- packages/taro-transformer-wx/src/functional.ts | 2 +- packages/taro-transformer-wx/src/jsx.ts | 4 ++-- packages/taro-transformer-wx/src/utils.ts | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/taro-cli-convertor/src/util/astConvert.ts b/packages/taro-cli-convertor/src/util/astConvert.ts index 2bbb6b7cadfb..202ba360dfbb 100644 --- a/packages/taro-cli-convertor/src/util/astConvert.ts +++ b/packages/taro-cli-convertor/src/util/astConvert.ts @@ -3,7 +3,7 @@ import * as t from '@babel/types' // 最低限度的转义: https://github.com/mathiasbynens/jsesc#minimal export function generateMinimalEscapeCode (ast: t.File) { - return generate(ast, { + return generate(ast as any, { jsescOption: { minimal: true, }, diff --git a/packages/taro-transformer-wx/src/functional.ts b/packages/taro-transformer-wx/src/functional.ts index f445b7daeabe..bc0010da9ab6 100644 --- a/packages/taro-transformer-wx/src/functional.ts +++ b/packages/taro-transformer-wx/src/functional.ts @@ -109,7 +109,7 @@ export const functionalComponent: () => { id, `普通函数式组件命名规则请遵守帕斯卡命名法(Pascal Case), 如果是在函数内声明闭包组件,则需要使用函数表达式的写法。 形如: -const ${id?.name} = ${generate(t.arrowFunctionExpression(params as any, body as any)).code} +const ${id?.name} = ${generate(t.arrowFunctionExpression(params as any, body as any) as any).code} ` ) } diff --git a/packages/taro-transformer-wx/src/jsx.ts b/packages/taro-transformer-wx/src/jsx.ts index 41ad45016e04..c9f58d8ae66d 100644 --- a/packages/taro-transformer-wx/src/jsx.ts +++ b/packages/taro-transformer-wx/src/jsx.ts @@ -110,7 +110,7 @@ export function generateJSXAttr(ast: t.Node) { quotes: 'single', retainFunctionParens: true, // 如果您需要 JSON 兼容的字符串,请改用此选项 } - const code = decodeUnicode(generate(ast, options).code).replace(/