BarrelFile
Creates a source file which re-exports the exports in other files and nested barrel files in the source directory its placed in.
import { BarrelFile } from "@alloy-js/typescript";
<BarrelFile export={boolean | string} path="string" />
import { BarrelFile } from "@alloy-js/typescript/stc";
BarrelFile({ export: boolean | string, path: string }).children(children)
Props
export | optionalboolean | string Whether the source file is exported out of the package. When true, this source file with its source file relative to the project root. Otherwise, it will be exported with the specified path. |
path | optionalstring The name of the source file |
Remarks
This component must be placed directly inside a SourceDirectory component. It will only discover nested barrel files directly within nested source directories.
Example
Creating a barrel file which exports the two other source files in the same directory
<Output> <SourceDirectory path="src"> <SourceFile path="one.ts" /> <SourceFile path="two.ts" /> <BarrelFile /> </SourceDirectory></Output>
The barrel file will contain the following contents:
export * from "./one.js";export * from "./two.js";