kentcdodds / babel-plugin-codegen

💥 Generate code at build-time
https://www.npmjs.com/package/babel-plugin-codegen
MIT License
348 stars 30 forks source link

Potential next steps? ("codegen-preval-core", dynamic identifier name) #13

Closed djfarly closed 6 years ago

djfarly commented 6 years ago

I'd like to use this Issue for discussion for some ideas I have in mind. As of #11 and #12 some significant updates have been made to the structure of this plugin. Codegen and preval are sharing a significant amount of code. Does it make sense to bring those codebases closer together? Now that this repo has dropped all direct babel dependencies it feels quite archaic to me to still have them in preval. As far as I can see the main difference lies in what is done with the replacement result and the name of the identifier. It should be possible to create a plugin that shares most of the code and exposes configuration to either do pre evaluation or code generation (including a dynamic name for the identifier). babel-plugin-preval and babel-plugin-codegen could become a very thin wrapper around this core package. Maybe another sensible step could be to concentrate all efforts in a mono-repo.

Hopefully I am making sense. 😃

kentcdodds commented 6 years ago

Thanks for the idea. Honestly I don't think the this package will change a whole lot so I don't see a while lot of reason to abstract things out. I don't think we would see the benefits.

Why don't we wait and see. We can always do the abstraction work when we can see it's necessary later.

djfarly commented 6 years ago

👍 Let's close this for now!