import { dirname, relative } from "pathe"; import type { TSModuleScope, TSOutputSymbol } from "../symbols/index.js"; import { modulePath } from "../utils.js"; import { useSourceFile } from "./SourceFile.js"; export interface ExportStatementProps { star?: boolean; from?: TSModuleScope; } export function ExportStatement(props: ExportStatementProps) { if (props.star) { const module = useSourceFile(); const allSymbols = props.from!.getAllSymbols(); for (const symbol of allSymbols) { for (const refkey of symbol.refkeys) { module.scope.exportedSymbols.set(refkey, symbol as TSOutputSymbol); } } return ( <> export * from " {modulePath(relative(dirname(module.scope.name), props.from!.name))}"; ); } return ""; }