Function
File
({
filename,
maxLines,
type
}: {
filename: string;
maxLines?: number;
type?: 'vanilla' | 'tailwind' | 's2';
})
Source from the content-addressed store, hash-verified
| 273 | const readFile = cache((file: string) => fs.readFileSync(file, 'utf8')); |
| 274 | |
| 275 | export function File({ |
| 276 | filename, |
| 277 | maxLines, |
| 278 | type |
| 279 | }: { |
| 280 | filename: string; |
| 281 | maxLines?: number; |
| 282 | type?: 'vanilla' | 'tailwind' | 's2'; |
| 283 | }) { |
| 284 | let contents = readFile(path.resolve(baseDir, filename)).replace(STARTER_ALIAS_RE, './'); |
| 285 | return ( |
| 286 | <CodePlatter type={type}> |
| 287 | <TruncatedCode lang={path.extname(filename).slice(1)} hideImports={false} maxLines={maxLines}> |
| 288 | {contents} |
| 289 | </TruncatedCode> |
| 290 | </CodePlatter> |
| 291 | ); |
| 292 | } |
| 293 | |
| 294 | const readFileReplace = cache((file: string) => { |
| 295 | let contents = readFile(file) |
Callers
nothing calls this directly
Tested by
no test coverage detected