MCPcopy
hub / github.com/vitejs/vite / mergeAlias

Function mergeAlias

packages/vite/src/node/utils.ts:1524–1536  ·  view source on GitHub ↗
(
  a?: AliasOptions,
  b?: AliasOptions,
)

Source from the content-addressed store, hash-verified

1522}
1523
1524export function mergeAlias(
1525 a?: AliasOptions,
1526 b?: AliasOptions,
1527): AliasOptions | undefined {
1528 if (!a) return b
1529 if (!b) return a
1530 if (isObject(a) && isObject(b)) {
1531 return { ...a, ...b }
1532 }
1533 // the order is flipped because the alias is resolved from top-down,
1534 // where the later should have higher priority
1535 return [...normalizeAlias(b), ...normalizeAlias(a)]
1536}
1537
1538export function normalizeAlias(o: AliasOptions = []): Alias[] {
1539 return Array.isArray(o)

Callers 2

resolveResolveOptionsFunction · 0.90
mergeConfigRecursivelyFunction · 0.85

Calls 2

isObjectFunction · 0.85
normalizeAliasFunction · 0.85

Tested by

no test coverage detected