|
|
|
@ -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} `); |
|
|
|
|
|
|
|
|
|