alibaba / kiwi

🐤 Kiwi-国际化翻译全流程解决方案
2.53k stars 230 forks source link

语言文件解析 getLangJson 方法对象获取改成使用 AST 解析 #108

Closed simonwong closed 2 years ago

simonwong commented 2 years ago

原来使用正则匹配的方式只能解析 export default {}; 类似这样的代码结构。 有一些特殊需求,比如改成 export default {} as const; 这种加了 const 断言的文件就解析不出来了。

所以将获取语言文件对象的方式改成 AST 解析来适应各种场景。

CLAassistant commented 2 years ago

CLA assistant check
All committers have signed the CLA.

linhuiw commented 2 years ago

LGTM