Open intellild opened 2 years ago
Hi @leonardfactory can you look at this ?
@leonardfactory I made the babel-plugin-macros dependency optional
Hi @intellild, I didn't have time to analyze this correctly before; now I'm wondering which use case you are trying to cover here. I'm genuinely curious about your proposal, I'll try to explain my point of view. The plugin works well when you need to work with Reflect.metadata
outputs, and this usually requires every decorated class / property / etc. to be processed: in this situation so, manually decorating everything could be cumbersome, and it can be considered an implicit side effect and, like babel-plugin-macros
already states:
Explicit is often a better pattern than implicit because it requires others to understand how things are globally configured. This is in this spirit are babel-plugin-macros designed. However, some things do need to be implicit, and those kinds of babel plugins can't be turned into macros.
Furtermore this plugin tries to emulate (with a best-effort strategy) the official TypeScript feature --emitDecoratorMetadata
, which is implict too.
Given all of that, I'm curious about the macro usage and I'd like to hear back from you before including it in the package – I'm just worried it could bring a bit of confusion to future and existing users.
@leonardfactory There are two problems.
support babel-plugin-macros example: