feat: aliasedConfig
This commit is contained in:
parent
472f120a5a
commit
c68bb3b6f7
|
@ -40,6 +40,19 @@ export default class ServerFlecks extends Flecks {
|
|||
this.rcs = options.rcs || {};
|
||||
}
|
||||
|
||||
get aliasedConfig() {
|
||||
const aliases = this.aliases();
|
||||
return Object.fromEntries(
|
||||
Object.entries(
|
||||
this.config,
|
||||
)
|
||||
.map(([path, config]) => [
|
||||
this.fleckIsAliased(path) ? `${path}:${aliases[path]}` : path,
|
||||
config,
|
||||
]),
|
||||
);
|
||||
}
|
||||
|
||||
aliases() {
|
||||
return this.constructor.aliases(this.rcs);
|
||||
}
|
||||
|
@ -413,6 +426,9 @@ export default class ServerFlecks extends Flecks {
|
|||
resolvedPath = isAbsolute(alias) ? alias : join(resolvedRoot, alias);
|
||||
}
|
||||
else {
|
||||
if (path.startsWith('.')) {
|
||||
throw new Error(`non-aliased relative path '${path}' in configuration`);
|
||||
}
|
||||
resolvedPath = path;
|
||||
}
|
||||
try {
|
||||
|
|
|
@ -186,7 +186,7 @@ export const hooks = {
|
|||
'@flecks/core.starting': (flecks) => {
|
||||
debug('bootstrapping flecks...');
|
||||
const webFlecks = Flecks.bootstrap({
|
||||
config: flecks.config,
|
||||
config: flecks.aliasedConfig,
|
||||
platforms: ['client', '!server'],
|
||||
});
|
||||
debug('bootstrapped');
|
||||
|
|
Loading…
Reference in New Issue
Block a user