Signed-off-by: lizhouze <lizhouze@huawei.com>
This commit is contained in:
lizhouze
2022-03-23 14:52:12 +08:00
parent bebd4f0b96
commit c377e82a39
5 changed files with 9 additions and 7 deletions
+2
View File
@@ -221,6 +221,8 @@ export class ResultStates {
if (!(fs.existsSync(parent) && !fs.statSync(parent).isFile())) {
mkDir(parent);
}
} else {
info = fs.readFileSync(projectConfig.aceSoPath, 'utf-8') + '\n';
}
fs.writeFileSync(projectConfig.aceSoPath, info + Array.from(useOSFiles).join('\n'));
}
+3 -3
View File
@@ -76,7 +76,7 @@ export function createLanguageService(rootFileNames: string[]): ts.LanguageServi
}
if (/(?<!\.d)\.(ets|ts)$/.test(fileName)) {
checkUISyntax(fs.readFileSync(fileName).toString(), fileName);
return ts.ScriptSnapshot.fromString(processContent(fs.readFileSync(fileName).toString(), fileName));
return ts.ScriptSnapshot.fromString(processContent(fs.readFileSync(fileName).toString()));
}
return ts.ScriptSnapshot.fromString(fs.readFileSync(fileName).toString());
},
@@ -270,8 +270,8 @@ function processDraw(source: string): string {
});
}
function processContent(source: string, sourcePath: string): string {
source = processSystemApi(source, false, sourcePath);
function processContent(source: string): string {
source = processSystemApi(source);
source = preprocessExtend(source, extendCollection);
source = processDraw(source);
return source;
+1 -1
View File
@@ -89,7 +89,7 @@ export default function processImport(node: ts.ImportDeclaration | ts.ImportEqua
fs.readFileSync(fileResolvePath, { encoding: 'utf-8' }).replace(
new RegExp('\\b' + STRUCT + '\\b.+\\{', 'g'), item => {
return item.replace(new RegExp('\\b' + STRUCT + '\\b', 'g'), `${CLASS} `);
}), false, fileResolvePath));
})));
const sourceFile: ts.SourceFile = ts.createSourceFile(filePath, content,
ts.ScriptTarget.Latest, true, ts.ScriptKind.TS);
visitAllNode(sourceFile, defaultName, asName, path.dirname(fileResolvePath), log);
+1 -1
View File
@@ -35,7 +35,7 @@ import { abilityConfig } from '../main';
module.exports = function resultProcess(source: string, map: any): void {
process.env.compiler = BUILD_OFF;
source = processSystemApi(source, true, this.resourcePath);
source = processSystemApi(source, true);
if (/\.ets$/.test(this.resourcePath)) {
componentInfo.id = 0;
propertyCollection.clear();
+2 -2
View File
@@ -715,7 +715,7 @@ export function sourceReplace(source: string, sourcePath: string): ReplaceResult
const log: LogInfo[] = [];
content = preprocessExtend(content);
// process @system.
content = processSystemApi(content);
content = processSystemApi(content, false, sourcePath);
return {
content: content,
@@ -735,7 +735,7 @@ export function preprocessExtend(content: string, extendCollection?: Set<string>
});
}
export function processSystemApi(content: string, isProcessWhiteList: boolean = false, sourcePath: string): string {
export function processSystemApi(content: string, isProcessWhiteList: boolean = false, sourcePath?: string): string {
let REG_SYSTEM: RegExp;
if (isProcessWhiteList) {
REG_SYSTEM =