Open Klustre opened 2 years ago
Hey @Klustre, great question! Honestly, I hadn't thought beyond collecting these as helper functions, but a transform plugin would be a cool idea!
Looks like there's already babel-preset-extendscript
for Babel and since I've been using adobe-script-starter
I'd lean towards an SWC plugin—although I've never touched Rust!
It would probably be pretty low priority for me, though, since I don't mind using them as helper functions (especially seeing how tricky transform plugins might get with nested calls).
Do you have experience with SWC plugins/Rust and/or would a plugin be something that you'd be interested in helping with?
Supposedly SWC can do ponyfills according to the maintainer but they just said "read the docs". I've read the docs and didn't come across an obvious answer. I tried the corejs
options a while back, but didn't get the right results.
Hope to figure it out at some point to see if Extendscript can execute the result out of the box. If not, it ends there because I don't have any experience in Rust.
Despite Babel, the speed of my starter is still really fast. I recently got access to babel-preset-extendscript
to help maintain it. So far I ran into the nested calls issue only once and was able to work around it.
SWC works with corejs ponyfills, but unfortunately corejs produces code incompatible with ExtendScript.
Will see if I can track down the issue explaining it again, but this is why I ended up not adding it to adobe-script-starter.
Personally I've run into a few issues with babel-preset-extendscript, so have preferred to manually include ponyfills like these ones these days. Though @Klustre if it's in a state to be worked on I would be interested in helping out!
Would also be great to have these improvements to the scripting part of bolt-cep too.
@timhaywood Do you have an example of how to set up ponyfills with SWC? Would love to know even if Extendscript doesn't parse it! Might be able to find a workaround.
I haven't found a need to work on babel-preset-extendscript
yet as I've not ran into any major issues—mostly using array methods. I will pick it up once I find the need though. I've forked it to the aenhancers org, so we can collaborate and release to npm there. Will try and set that up soon.
Yeah nice, I'll post an example repo with the issue when I get a chance!
I did originally find an issue on core-js that addressed it, but I can't remember what the specific error was to find it 😅
On experimenting with SWC and core-js again, I realized I misunderstood the context! I was previously working with the core-js pollyfill support, which I think you also tried out @Klustre. 🤦
Another issue addressing ponyfills is here, doesn't look like there's much interest.
Related: https://github.com/fartinmartin/adobe-lib-starter/issues/1
Thinking about archiving my adobe-script-starter in favour of extender, think esbuild + rollup + babel-preset-extendscript is the way to go (nice work with that repo @Klustre!)
Yeah at this point I'm not going to waste more time on figuring it out 😓 The docs for SWC are pretty sparse. Babel's working great, but we just need to support more JS features. The only reason for SWC would be that it's supposedly faster.
Thanks re. Extender! Let me know what you have to do to make it work with Typescript and I might add the feature or describe it in the docs.
Haha yeah that seems like a good idea.
Will use extender more, and file any issues to improve the TS experience if I run into them. Thanks!
Hey Martin, what are your plans for this repo? It looks like it’s a set of helper functions right now. Will you turn it into a Babel or SWC plugin?