MCPcopy
hub / github.com/web-infra-dev/garfish / setModuleConfig

Function setModuleConfig

packages/remote-module/src/apis/setModuleConfig.ts:26–42  ·  view source on GitHub ↗
(obj: Partial<ModuleConfig>)

Source from the content-addressed store, hash-verified

24};
25
26export function setModuleConfig(obj: Partial<ModuleConfig>) {
27 assert(isPlainObject(obj), 'Module configuration must be an object.');
28 for (const key in obj) {
29 if (hasOwn(moduleConfig, key)) {
30 if (key === 'env') {
31 Object.assign(moduleConfig[key], obj[key]);
32 } else if (key === 'alias') {
33 const val = obj[key];
34 val && setAlias(val);
35 } else {
36 moduleConfig[key] = obj[key];
37 }
38 } else if (__DEV__) {
39 warn(`Invalid configuration "${key}".`);
40 }
41 }
42}
43
44export function processAlias(url: string): [string, Array<string> | undefined] {
45 // If url is an alias

Callers

nothing calls this directly

Calls 5

assertFunction · 0.90
isPlainObjectFunction · 0.90
hasOwnFunction · 0.90
warnFunction · 0.90
setAliasFunction · 0.85

Tested by

no test coverage detected