import * as ts from 'typescript' ; import { TypeScriptMacroNodeTransformFunction } from 'typescript-macros' ; param babelMacroFunction function exportBabelMacro ( babelMacroFunction ) { } param tsMacroFunction function exportTypeScriptMacro ( tsMacroFunction ) { } export { exportBabelMacro , exportTypeScriptMacro } ; export const ____$$$$____typescriptMacroNodeTransformFunction____$$$$____ = ( { reference , node , } ) => { if ( ts . isSourceFile ( node . parent ) ) { if ( ts . isExportAssignment ( node ) ) { return ts . createEmptyStatement ( ) ; } if ( ts . isExpressionStatement ( node ) && ts . isCallExpression ( node . expression ) && ts . isIdentifier ( node . expression . expression ) && [ 'exportTypeScriptMacro' , 'exportBabelMacro' ] . includes ( reference ( node . expression . expression ) as string ) ) { const args = node . expression . arguments ; if ( args . length !== 1 ) { throw new Error ( 'only allow 1 arg' ) ; } const arg = args [ 0 ] ; if ( ! ts . isIdentifier ( arg ) ) { throw new Error ( 'only allow Identifier in arg' ) ; } return reference ( node . expression . expression ) === 'exportTypeScriptMacro' ? ts . createExportDeclaration ( [ ] , [ ] , ts . createNamedExports ( [ ts . createExportSpecifier ( arg . text , '____$$$$____typescriptMacroNodeTransformFunction____$$$$____' ) , ] ) ) : ts . createExportAssignment ( [ ] , [ ] , false , ts . createIdentifier ( arg . text ) ) ; } } return node ; } ;