Skip to main content

Function: synthesizeRootBarrels()

function synthesizeRootBarrels(
files,
artifactsByGenerator?,
logger?
): VirtualFile[];

Defined in: packages/core/src/writer/barrel.ts:32

One VirtualFile { path: '<ns>/index.ts' } per namespace present in files, its content one sorted export * from './<generatorName>'; line per generator that contributed a file under <ns>/<generatorName>/, except the generators whose artifact sets exportFromRoot: false (UI-framework output such as angular: reachable from <ns>/<generatorName> only). A single-generator namespace still gets a barrel, an empty one (export {};) when every contributor opted out.

When generator barrels expose the same identifier, an explicit re-export resolves the otherwise ambiguous star exports. The lexically first generator owns the root name; every generator remains available from its own subpath. Each namespace emits a single plain-language debug message explaining the clash, backed by a structured meta object for programmatic reporters or --debug. Export names are read from the emitted TypeScript module graph, rather than artifacts, because artifacts only describe dependency-facing entity symbols.

Parameters​

ParameterType
filesVirtualFile[]
artifactsByGenerator?Record<string, GeneratorArtifact>
logger?Logger

Returns​

VirtualFile[]