ensure get meteor config only returns proper filtered config

This commit is contained in:
Nacho Codoñer
2025-05-14 10:50:35 +02:00
parent fb400271df
commit 2bf3b1300c

View File

@@ -1819,14 +1819,16 @@ export class MeteorConfig {
// TODO Implement an API for setting these values?
get(...keys) {
let config = this._ensureInitialized();
let filteredConfig = keys.length ? undefined : config;
if (config) {
keys.every(key => {
if (config && _.has(config, key)) {
config = config[key];
filteredConfig = config[key];
return true;
}
return false;
});
return config;
return filteredConfig;
}
}
@@ -1908,6 +1910,8 @@ export class MeteorConfig {
_getEntryModulesByArch(...keys) {
const configEntryModule = this.get(...keys);
console.log("--> (project-context.js-Line: 1911)\n configEntryModule: ", configEntryModule);
console.log("--> (project-context.js-Line: 1911)\n keys: ", keys);
const entryModulesByArch = Object.create(null);
if (typeof configEntryModule === "string" ||
@@ -1927,6 +1931,7 @@ export class MeteorConfig {
});
}
console.log("--> (project-context.js-Line: 1931)\n entryModulesByArch: ", entryModulesByArch);
return entryModulesByArch;
}
@@ -1936,9 +1941,13 @@ export class MeteorConfig {
) {
const entryMatch = archinfo.mostSpecificMatch(
arch, Object.keys(entryModulesByArch));
// console.log("--> (project-context.js-Line: 1939)\n archinfo: ", archinfo);
// console.log("--> (project-context.js-Line: 1939)\n Object.keys(entryModulesByArch): ", Object.keys(entryModulesByArch));
if (entryMatch) {
const entryModule = entryModulesByArch[entryMatch];
console.log("--> (project-context.js-Line: 1944)\n entryModulesByArch: ", entryModulesByArch);
console.log("--> (project-context.js-Line: 1942)\n entryModule: ", entryModule);
if (entryModule === false) {
// If meteor.{main,test}Module.{client,server,...} === false, no
@@ -1967,6 +1976,7 @@ export class MeteorConfig {
"./" + files.pathNormalize(entryModule),
this.packageJsonPath
);
console.log("--> (project-context.js-Line: 1970)\n res: ", res);
if (res && typeof res === "object") {
return files.pathRelative(this.appDirectory, res.path);