if you're not locked to javascript you could use python with pep-723[1] to declare inline dependencies

1: https://peps.python.org/pep-0723/

I just migrated that project away from Python to TS :D (cries in corner).