denoland / deno

A modern runtime for JavaScript and TypeScript.
https://deno.com
MIT License
93.99k stars 5.23k forks source link

Improved `deno info --json` output for `npm:` and `node:` modules #18043

Open lucacasonato opened 1 year ago

lucacasonato commented 1 year ago

Right now the representation of npm: specifiers in deno info --json are inconsistent. For example, npm: specifiers are currently added as an entry to the "modules" array if they are a root module, but are not added if they are a dependency of a "standard" (https: or file: module). There are entries in the redirects for NPM modules, but they point to specifiers that are only visible through the deps array on modules. Long story short, dealing with NPM specifiers in deno info --json is a royal PITA right now and requires many special cases. It also breaks backwards compat with the expectation that all RHS of the redirects map have entries in the modules array.

I propose we fix this as follows:

dsherret commented 1 week ago

For this, we'll do the current output by default, but print a warning to provide --format=json.1 flag. Then we'll upgrade --format=json.2 to do this output. We should move this out of deno graph and do serialization from a ModuleGraph that doesn't just call graph.serialize(...) so the format can be more stable.