fix: error on specifiers that fail to resolve - #500
Merged
Conversation
deno_graph's module errors do not include resolution errors, so a specifier that failed to resolve was silently emitted into the output as-is. Walk the graph for those errors as well. Closes denoland#475
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
deno_graph'smodule_errors()explicitly does not include resolution errors, so a specifier that failed to resolve was silently emitted into the output as-is, which is broken for anything that isn't an npm dependency:Now the graph is also walked for resolution errors, which surfaces the same message Deno gives:
The walk uses
GraphKind::Allandfollow_dynamic: truerather than the narrower semantics ofgraph.valid(), because dnt emits type-only and dynamic imports too, so an unresolved specifier in either position is broken in the output in exactly the same way.In the case from the issue the specifier failed to resolve because the deno.json was passed as
importMaprather thanconfigFile. Likedeno --import-map, that is read as a plain import map, so bare specifier mappings are not expanded to cover sub paths (deno run --import-map=deno.jsonfails on the same import). Documented that on the option.Closes #475