mirror of
https://github.com/openharmony/developtools_ace-ets2bundle.git
synced 2026-07-22 04:25:23 -04:00
!755 fix system module name case sensitive.
Merge pull request !755 from Bo Jiang/monthly_20220614
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user