TypeStrong / dts-bundle

Export TypeScript .d.ts files as an external module definition
MIT License
308 stars 57 forks source link

Hook for modifying module body code #80

Open arshaw opened 5 years ago

arshaw commented 5 years ago

I had a need to modify each module's code before writing it to disk. String manipulation is weird on .d.ts code, I know, but I needed a workaround for https://github.com/Microsoft/TypeScript/issues/14080

Instead of baking in a solution for 14080 into the code for dts-bundle, I made a callback that allows arbitrary manipulation of generated module-body code. It's an option called transformModuleBody.