1import { 2 Bundle, 3 chainBundle, Node, SourceFile, TransformationContext, TransformFlags, visitEachChild, VisitResult, 4} from "../_namespaces/ts"; 5 6/** @internal */ 7export function transformESNext(context: TransformationContext): (x: SourceFile | Bundle) => SourceFile | Bundle { 8 return chainBundle(context, transformSourceFile); 9 10 function transformSourceFile(node: SourceFile) { 11 if (node.isDeclarationFile) { 12 return node; 13 } 14 15 return visitEachChild(node, visitor, context); 16 } 17 18 function visitor(node: Node): VisitResult<Node> { 19 if ((node.transformFlags & TransformFlags.ContainsESNext) === 0) { 20 return node; 21 } 22 switch (node.kind) { 23 default: 24 return visitEachChild(node, visitor, context); 25 } 26 } 27} 28