unjs / runtime-compat

Display APIs compatibility across different JavaScript runtimes
https://runtime-compat.unjs.io/
MIT License
230 stars 5 forks source link

Missing features: arbitrary JS string evaluation (`eval()` and `Function()`) #86

Open samijaber opened 6 months ago

samijaber commented 6 months ago

I was not able to find this in the list of features, and I know that some do and others don't support it, so it would be good to add it in 🙏🏽

QuiiBz commented 6 months ago

I'm a bit hesitant about this since many cloud providers disable code generation from strings when you actually deploy the code to the cloud - even though it works when you run it locally.

It might be confusing for users to see something marked as supported, but it's not always true depending where the code runs.

samijaber commented 6 months ago

That's exactly why I think it should be listed as "not supported" for any cloud provider that forbids it on production servers, to differentiate from runtimes like Node that fully support it (and I assume Bun/Deno, although I haven't explicitly checked)

ascorbic commented 6 months ago

Netlify and Deno Deploy do support it when deployed as well as locally. It would be an annoying one though as it would need lots of special-casing. I'm assuming there isn't a BCD test for it