mirror of
https://github.com/openharmony/developtools_ace-ets2bundle.git
synced 2026-07-21 12:05:24 -04:00
lizhouze@huawei.com Signed-off-by: lizhouze <lizhouze@huawei.com>
This commit is contained in:
@@ -214,6 +214,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'));
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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 =
|
||||
|
||||
Reference in New Issue
Block a user