mirror of
https://github.com/openharmony/developtools_ace-ets2bundle.git
synced 2026-07-19 16:43:34 -04:00
!708 remove srcEntrance @Entry limit
Merge pull request !708 from houhaoyu/master13
This commit is contained in:
+10
-1
@@ -44,6 +44,7 @@ const resources = {
|
||||
app: {},
|
||||
sys: {}
|
||||
};
|
||||
const abilityPagesFullPath = [];
|
||||
|
||||
function initProjectConfig(projectConfig) {
|
||||
projectConfig.entryObj = {};
|
||||
@@ -210,7 +211,7 @@ function setAbilityFile(projectConfig, abilityPages) {
|
||||
if (path.isAbsolute(abilityPath)) {
|
||||
abilityPath = '.' + abilityPath.slice(projectConfig.projectPath.length);
|
||||
}
|
||||
const entryPageKey = abilityPath.replace(/^\.\/ets\//, './').replace(/\.ts$/, '');
|
||||
const entryPageKey = abilityPath.replace(/^\.\/ets\//, './').replace(/\.ts$/, '').replace(/\.ets$/, '');
|
||||
if (fs.existsSync(projectAbilityPath)) {
|
||||
abilityConfig.projectAbilityPath.push(projectAbilityPath);
|
||||
projectConfig.entryObj[entryPageKey] = projectAbilityPath + '?entry';
|
||||
@@ -241,6 +242,13 @@ function setEntrance(abilityConfig, abilityPages) {
|
||||
abilityConfig.forEach(ability => {
|
||||
if (ability.srcEntrance) {
|
||||
abilityPages.push(ability.srcEntrance);
|
||||
let finalPath = path.resolve(path.resolve(projectConfig.projectPath, '../'), ability.srcEntrance);
|
||||
finalPath = finalPath.replace(/\\/g, '/');
|
||||
if (fs.existsSync(finalPath)) {
|
||||
abilityPagesFullPath.push(finalPath);
|
||||
} else {
|
||||
abilityPagesFullPath.push(ability.srcEntrance);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -364,4 +372,5 @@ exports.resources = resources;
|
||||
exports.loadWorker = loadWorker;
|
||||
exports.abilityConfig = abilityConfig;
|
||||
exports.readWorkerFile = readWorkerFile;
|
||||
exports.abilityPagesFullPath = abilityPagesFullPath;
|
||||
exports.loadModuleInfo = loadModuleInfo;
|
||||
|
||||
@@ -69,7 +69,7 @@ import {
|
||||
hasDecorator,
|
||||
toUnixPath
|
||||
} from './utils';
|
||||
import { projectConfig } from '../main';
|
||||
import { projectConfig, abilityPagesFullPath } from '../main';
|
||||
import { collectExtend } from './process_ui_syntax';
|
||||
import { isExtendFunction } from './process_ui_syntax';
|
||||
import { isOhmUrl } from './resolve_ohm_url';
|
||||
@@ -232,7 +232,8 @@ function validateEntryAndPreviewCount(result: DecoratorResult, fileQuery: string
|
||||
+ `decorator, or at least one '@Preview' decorator.`,
|
||||
fileName: fileName
|
||||
});
|
||||
} else if ((!isPreview || isPreview && checkEntry) && result.entryCount !== 1 && fileQuery === '?entry') {
|
||||
} else if ((!isPreview || isPreview && checkEntry) && result.entryCount !== 1 && fileQuery === '?entry' &&
|
||||
!abilityPagesFullPath.includes(fileName)) {
|
||||
log.push({
|
||||
type: LogType.ERROR,
|
||||
message: `A page configured in '${projectConfig.pagesJsonFileName}' must have one and only one '@Entry' `
|
||||
|
||||
Reference in New Issue
Block a user