-
Notifications
You must be signed in to change notification settings - Fork 43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
specifiers inversion? #270
Comments
The current structure is intentional, though with lots of room for improvement. The 'short' specifier is what dependencies are keyed by so it goes at the top level. The value in The whole thing would be made a lot more sound by #247, or feedback there would be appreciated. |
I has seen the #247 but this issue here is not about restructuring the whole output that may be a bit complicated for dependent tools... The question here is just about one case of value inversion that looks not correct (one issue, not a feature request)...
Yes but indeed the "key" here is not the same format as the "key" for root modules (aka
So it sould be the "key" that identifies a It looks wrong! |
It's not technically impossible to instead key dependencies by the resolved specifier and maybe both approaches are valid, but keying by the relative specifier happens to be much more convenient when validating against resolution errors. It's also more true to the ES modules spec which operates on Anyway #247 would go far to address the wrong look since it puts them both at the top-level with better names. Note that swapping these two fields would also be dangerous for dependents. |
So why
If I want to get the ModuleJson corresponding to a dependency, I should rely on what is already resolved: graph.modules.find( m=> m.specifier == dependency.specifier ) // wont work
// aka find by id<specifier> it's way more convenient to write than: graph.modules.find( m=> m.specifier == resolve( dirname(m.specifier), dependency.specifier ) )
// or whatever the resolution mecanism, default or custom, you re-do what's already done once by createGraph ... To make it work right now with this json output, I sould use graph.modules.find( m=> m.specifier == dependency.code.specifier ) ... what sounds wrong, I'm not actualy searching by "what's written in code" , but by "what's resolved for me already to be a global identifier"! |
Great, #247 would make that work. I agree that |
It's also now possible for the code and types specifier to be different. For example, a specifier like |
Hi!
I may be wrong, but it looks like
specifier
values are inverted betweenDependency
andRange
?I looks more logical to me to have an absolute URL specifier for a dependency as it's the same format as
ModuleJson.specifier
and theRange
being the string extracted from code... Usingdependency.specifier
to reference it anddependency.code.specifer
to parse code...So this exemple should be :
The text was updated successfully, but these errors were encountered: