mirror of
https://github.com/openharmony/developtools_ace-ets2bundle.git
synced 2026-07-21 03:55:23 -04:00
lihong67@huawei.com fix system module name case sensitive. Signed-off-by: lihong <lihong67@huawei.com> Change-Id: I7cacd2c618a000215d21049fc6098860c0472ad0
This commit is contained in:
@@ -14,7 +14,22 @@
|
||||
*/
|
||||
|
||||
import { processSystemApi } from './validate_ui_syntax';
|
||||
import { systemModules } from '../main';
|
||||
|
||||
module.exports = function processSystemModule(source: string): string {
|
||||
return processSystemApi(source, false, this.resourcePath, true);
|
||||
const REG_IMPORT: RegExp =
|
||||
/(import|export)\s+(.+)\s+from\s+['"](\S+)['"]|import\s+(.+)\s*=\s*require\(\s*['"](\S+)['"]\s*\)/g;
|
||||
source.replace(REG_IMPORT, (item, item1, item2, item3, item4, item5) => {
|
||||
const moduleRequest: string = item3 || item5;
|
||||
if (/^@(system|ohos)\./i.test(moduleRequest.trim())) {
|
||||
if (!systemModules.includes(moduleRequest.trim() + '.d.ts')) {
|
||||
const message: string =
|
||||
`Cannot find module '${moduleRequest}' or its corresponding type declarations.`;
|
||||
this.emitError(`BUILDERROR File: ${this.resourcePath}\n ${message}`);
|
||||
}
|
||||
}
|
||||
return item;
|
||||
});
|
||||
source = processSystemApi(source, false, this.resourcePath, true);
|
||||
return source;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user