-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathrslibConfig.ts
More file actions
26 lines (22 loc) · 893 Bytes
/
Copy pathrslibConfig.ts
File metadata and controls
26 lines (22 loc) · 893 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import {
type ConfigParams,
type RslibConfig,
type RslibConfigDefinition,
mergeRslibConfig,
} from '@rslib/core';
import { withConfigMeta } from '@rstackjs/load-config';
import { loadRstackConfig, type Configs } from './config.ts';
import { resolveConfigLayers } from './configLayers.ts';
export const resolveRslibConfig = async (
layers: readonly Configs[],
params: ConfigParams,
): Promise<RslibConfig> => {
const configs = await resolveConfigLayers(layers, 'lib', params);
return configs.length > 1 ? mergeRslibConfig(...configs) : (configs[0] ?? {});
};
const loadRslibConfig = (async (params: ConfigParams) => {
const { configs, filePath, dependencies } = await loadRstackConfig();
const config = await resolveRslibConfig([configs], params);
return withConfigMeta(config, { filePath, dependencies });
}) as RslibConfigDefinition;
export default loadRslibConfig;