typescript-transform-paths icon indicating copy to clipboard operation
typescript-transform-paths copied to clipboard

provided as Transformer Plugin

Open zyf0330 opened this issue 3 years ago • 4 comments

Hello, I use nx which supports to pass transformer to tsc compiler, but it requires plugin is a Transformer Plugin. This is error typescript-transform-paths/register is not a Transformer Plugin. It does not provide neither before(), after(), nor afterDeclarations(). Does this plugin support it? Thanks!

zyf0330 avatar Apr 11 '22 07:04 zyf0330

Hello. This plugin fits the ttypescript and ts-patch export structure, but it is built so that it can be used with other configurations also.

I'm not familiar with nx's transformer structure. It sounds like they have their own expected export structure. You could probably write a wrapper pretty easily that provides before and afterDeclarations exported functions that pass to transform in https://github.com/LeDDGroup/typescript-transform-paths/blob/master/src/transformer.ts

If you get one working, I'd be happy to incorporate it into the library.

nonara avatar Apr 11 '22 19:04 nonara

@nonara This is my PR, but I don't know why it doesn't work. Code executes into ts.Transformer, but not into nodeVisitor in visitor.js. https://github.com/LeDDGroup/typescript-transform-paths/pull/155

zyf0330 avatar Apr 12 '22 08:04 zyf0330

Thanks for the effort! You'll want to make sure current tests pass and add tests for working with nx.

I'll have a closer look this weekend.

nonara avatar Apr 12 '22 12:04 nonara

@nonara I test again, and it works. Just don't know why. I will add tests.

zyf0330 avatar Apr 13 '22 09:04 zyf0330

Added in v3.4.0. Let me know if you have any issues with it!

nonara avatar Oct 20 '22 21:10 nonara