I'm not sure what the story is with #198 but it didn't work, because the get_dir function was called inside the catch block which defeats the object.
This PR takes a much simpler approach — it just walks up the tree looking for node_modules/<name>/package.json. Crude, but should work in all the cases we care about (it doesn't need to reimplement the entire Node module resolution algo, it just needs to find libraries with a pkg.svelte).
I assume we also need to respect the svelte export condition, but that seems like something that should happen separately.
I'm not sure what the story is with #198 but it didn't work, because the
get_dir
function was called inside thecatch
block which defeats the object.This PR takes a much simpler approach — it just walks up the tree looking for
node_modules/<name>/package.json
. Crude, but should work in all the cases we care about (it doesn't need to reimplement the entire Node module resolution algo, it just needs to find libraries with apkg.svelte
).I assume we also need to respect the
svelte
export condition, but that seems like something that should happen separately.