Skip to content

SourceFile

import { SourceFile } from "@alloy-js/core";
<SourceFile
filetype="string"
header={Children}
insertFinalNewLine
noFlush
path="string"
printWidth={number}
reference={ComponentDefinition<{
refkey: Refkey;
}>}
tabWidth={number}
useTabs
>
{children}
</SourceFile>
childrenoptional Children
filetypestringThe type of contents in this file. This is a metadata hint only. It does not trigger formatting or content processing. The value is forwarded to debug tooling and the ContentOutputFile output metadata.
headeroptional ChildrenContent rendered before the file body, separated from it by a hard line break. The separator is emitted whenever header is not undefined — including when it is an empty string or a component that renders nothing. To suppress both the header and the separator, omit this prop entirely.
insertFinalNewLineoptional booleanIf files should end with a final new line.
noFlushoptional booleanSkip flushing scheduled jobs before printing.
pathstringThe path of this file relative to its parent directory
printWidthoptional numberThe number of characters the printer will wrap on. Defaults to 100 characters.
referenceoptional ComponentDefinition<{ refkey: Refkey; }>The component to use to render refkeys references within the file’s contents.
tabWidthoptional numberThe number of spaces to use for indentation. Defaults to 2 spaces.
useTabsoptional booleanWhether to use tabs instead of spaces for indentation. Defaults to false.