denoify
denoify copied to clipboard
denoify creates imports from comments
Denoifying a TypeScript file with a comment containing the word "Buffer" led to an output file importing the Buffer
package, subsequently breaking our backend build.
See this commit for context.
Observed behaviour:
The word "Buffer" in a comment makes denoify create an import statement for Buffer.
Desired behaviour:
Denoify will not treat comments as code.
Hi @hermann-p,
Damn, I know this day would come.
Denoifiy is using Regexp, instead of an actuall parser. Part because it's started as a toy project to convert my own libraries and grown from here and part because I didn't want to be worried about a new keyword breaking it. (We still can't use satisfies
in many context).
I don't know, I could introduce yet another hack so that it wont happen.
Or maybe I should properly parse at least comments.
I ran across grubber the other day. Looks interesting.
What do you thing @Gin-Quin? Could Denoify be a good usecase for grubber?
Yep, it's exactly the kind of tasks Grubber has been designed for. Think of Grubber as something in-between a full parser and a basic search and replace system.
This is especially suited for top-level static declarations, like ESM imports. You'll have 100% safety with a very simple usage.
Ok thanks for the insight @Gin-Quin,
Grubber did seems like a well executed good offer.
I'll see if I can make it work