Skip to content

Instantly share code, notes, and snippets.

@meDavid
Created March 18, 2019 15:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save meDavid/8b5d561a355428f4265cda315179b2be to your computer and use it in GitHub Desktop.
Save meDavid/8b5d561a355428f4265cda315179b2be to your computer and use it in GitHub Desktop.
A dummy Typescript transformer that logs the filenames to the console
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