!755 fix system module name case sensitive.

Merge pull request !755 from Bo Jiang/monthly_20220614
This commit is contained in:
openharmony_ci
2022-06-21 09:29:18 +00:00
committed by Gitee
2 changed files with 16 additions and 3 deletions
+10
View File
@@ -46,6 +46,8 @@ const resources = {
};
const abilityPagesFullPath = [];
const systemModules = [];
function initProjectConfig(projectConfig) {
projectConfig.entryObj = {};
projectConfig.projectPath = projectConfig.projectPath || process.env.aceModuleRoot ||
@@ -304,6 +306,13 @@ function filterWorker(workerPath) {
}
})()
;(function readSystemModules() {
const systemModulesPath = path.resolve(__dirname,'../../api');
if (fs.existsSync(systemModulesPath)) {
systemModules.push(...fs.readdirSync(systemModulesPath));
}
})()
function readAppResource(resources, filePath) {
if (fs.existsSync(filePath)) {
const appResource = fs.readFileSync(filePath, "utf-8");
@@ -374,3 +383,4 @@ exports.abilityConfig = abilityConfig;
exports.readWorkerFile = readWorkerFile;
exports.abilityPagesFullPath = abilityPagesFullPath;
exports.loadModuleInfo = loadModuleInfo;
exports.systemModules = systemModules;
+6 -3
View File
@@ -17,7 +17,10 @@ import fs from 'fs';
import path from 'path';
import * as ts from 'typescript';
import { projectConfig } from '../main';
import {
projectConfig,
systemModules
} from '../main';
import {
processSystemApi,
preprocessExtend,
@@ -140,9 +143,9 @@ function resolveModuleNames(moduleNames: string[], containingFile: string): ts.R
} else {
resolvedModules.push(null);
}
} else if (/^@(system|ohos)/.test(moduleName.trim())) {
} else if (/^@(system|ohos)/i.test(moduleName.trim())) {
const modulePath: string = path.resolve(__dirname, '../../../api', moduleName + '.d.ts');
if (ts.sys.fileExists(modulePath)) {
if (systemModules.includes(moduleName + '.d.ts') && ts.sys.fileExists(modulePath)) {
resolvedModules.push(getResolveModule(modulePath, '.d.ts'));
} else {
resolvedModules.push(null);