Browse Source

KERNEL-14076 fix: 修复xtype

es6
Treecat 2 years ago
parent
commit
499d1d02b4
  1. 9
      es6.js

9
es6.js

@ -109,19 +109,20 @@ async function handleFile(srcName) {
const sourceCode = fs.readFileSync(srcName).toString(); const sourceCode = fs.readFileSync(srcName).toString();
const result = /BI\.(.*?)\s\=\sBI\.inherit\(/.exec(sourceCode); const result = /BI\.(.*?)\s=\sBI\.inherit\(/.exec(sourceCode);
if (!result) { if (!result) {
console.log(`已经es6过,替换 xtype => ${srcName}, `); console.log(`已经es6过,替换 xtype => ${srcName}`);
// 处理 xtype // 处理 xtype
// 尝试对 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); const loadSuccess = loader.load(srcName, matchedSentence);
if (loadSuccess) { if (loadSuccess) {
const clzName = depts[matchedSentence].clzName; const clzName = depts[matchedSentence].clzName;
return `${clzName}.xtype`; return `type: ${clzName}.xtype`;
} else { } else {
console.log(`xtype 替换失败 ${matchedSentence} `); console.log(`xtype 替换失败 ${matchedSentence} `);

Loading…
Cancel
Save