Created
March 18, 2019 15:11
-
-
Save meDavid/8b5d561a355428f4265cda315179b2be to your computer and use it in GitHub Desktop.
A dummy Typescript transformer that logs the filenames to the console
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import * as ts from 'typescript'; | |
export const dummyTransformer = <T extends ts.Node>(context: ts.TransformationContext) => { | |
return (rootNode: ts.SourceFile) => { | |
console.log('Transforming file: ' + rootNode.fileName); | |
function visit(node: ts.Node): ts.Node { | |
return ts.visitEachChild(node, visit, context); | |
} | |
return ts.visitNode(rootNode, visit); | |
}; | |
}; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment