import { strict as assert } from "assert" ; import ts , { StringLiteral } from "typescript" ; import { ComponentFinder , ComponentFinderResult , ResultType } from "./types" ; import { findSourceFiles , isExportStar } from "./utils" ; /**
 * Extracts SourceFiles from `export * from "./path/to/file"` syntax.
 */ export const exportStarFinder = { extract ( node , program ) { if ( ! ts . isExportDeclaration ( node ) || ! isExportStar ( node ) ) return [ ] ; const pathNode = node . getChildren ( ) . find ( ts . isStringLiteral ) as StringLiteral ; assert ( pathNode , `Expected node ${ node . getText ( ) } to have a string literal` ) ; return findSourceFiles ( program , pathNode ) . map ( sourceFile => { return { type : ResultType . SourceFile , sourceFile , } ; } ) ; } , } ;