Open sigmaSd opened 1 year ago
I noticed this requires --allow-run=deno (also known as -A)
I also noticed the tests are way slower
deno info
uses deno_graph under the hood. Perhaps, it'd be better to use that instead of spawning a new process. If you'd like a better idea of how it can be implemented, Deno's Standard Library uses it to check for circular dependencies within the Node compatibility layer here.
Thanks @iuioiua I updated the code with deno graph
The tests are not slow anymore, and no new permissions is needed with deno graph
I'm not 100 % confident of the code, but it seems to work and pass tests
This PR implements the search for the import which gives precise location of the urls but this info is not being used currently, maybe in a future pr we can leverage that for url replacement instead of the current regex approach
I just noticed that this pr make udd not work on import map anymore
The problem is with bare specifier like $fresh, those don't get resolved
But it seems like deno info can resolve bare specifiers, so I probably need to look how they do it
deno_graph exposes createGraph(..,{resolve?)
to override resolution for cases like handling urls from import map, but there is not provided resolver, it needs to be written from scratch it seems, like the deno cli one https://github.com/denoland/deno/blob/d0c5ff42f4b5fa9b848e6ed5af2e480d12f15bda/cli/resolver.rs#L216
fix https://github.com/hayd/deno-udd/issues/8
I left couple of notes
This implements the search, and the search gives precise location of the urls, maybe we can in the future use that for replacement.
The tests passes, I did not test more