From 499d1d02b4f9f75119c0e9c29dfde2ef78098962 Mon Sep 17 00:00:00 2001 From: Treecat Date: Thu, 12 Jan 2023 15:29:31 +0800 Subject: [PATCH] =?UTF-8?q?KERNEL-14076=20fix:=20=E4=BF=AE=E5=A4=8Dxtype?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- es6.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/es6.js b/es6.js index 7667443e2..fbfede5a2 100644 --- a/es6.js +++ b/es6.js @@ -109,19 +109,20 @@ async function handleFile(srcName) { const sourceCode = fs.readFileSync(srcName).toString(); - const result = /BI\.(.*?)\s\=\sBI\.inherit\(/.exec(sourceCode); + const result = /BI\.(.*?)\s=\sBI\.inherit\(/.exec(sourceCode); if (!result) { - console.log(`已经es6过,替换 xtype => ${srcName}, `); + console.log(`已经es6过,替换 xtype => ${srcName}`); // 处理 xtype // 尝试对 xtype 进行替换 - const noXtypeCode = sourceCode.replace(/"bi\.(.*?)"/g, matchedSentence => { + const noXtypeCode = sourceCode.replace(/type:\s?"bi\.(.*?)"/g, v => { + const matchedSentence = v.replace(/type:\s?/, ""); const loadSuccess = loader.load(srcName, matchedSentence); if (loadSuccess) { const clzName = depts[matchedSentence].clzName; - return `${clzName}.xtype`; + return `type: ${clzName}.xtype`; } else { console.log(`xtype 替换失败 ${matchedSentence} `);