Re:NPM – "is-even", 160k weekly downloads
by mintplant on Tuesday November 16, 2021 @01:20PM
(#29244341)
For a long time, Babel plugins were entirely smoke-and-mirrors. If you looked under the hood at the source code of a "plugin" package, all it would contain was something like:
There was no actual plugin API, just selectively-enabled logic hardcoded into the main packages. The whole thing was fake-it-til-you-make-it.
[ Parent
| on HN ]
Re:NPM – "is-even", 160k weekly downloads
by akiselev on Tuesday November 16, 2021 @01:35PM
(#29244596)
That's actually pretty clever, in a "all hail the dark lord Cthulu" kind of way.
Re:NPM – "is-even", 160k weekly downloads
by acemarke on Tuesday November 16, 2021 @04:09PM
(#29246384)
For built-in syntax parsing, yes - those official plugins just told the parser to enable those specific bits of syntax.
Actual plugins for non-standard syntax were all real AST visitor-based modifications, though.
Re:NPM – "is-even", 160k weekly downloads
by mintplant on Wednesday November 17, 2021 @08:05PM
(#29260947)
I found this out some years ago while investigating how I might write my own Babel plugin for some non-standard syntax. At the time there were no such facilities available, only the hidden built-in parser flags.