Skip to content

esm: add limited support for `--print`

Rodrigo Muino Tomonari requested to merge github/fork/aduh95/esm--print into main

The idea is to enable the following use-case:

$ ./node --input-type=module -p 'await fetch("https://nodejs.org/docs/latest/api/index.json").then(r=>r.json())'   
{ type: 'module', source: 'doc/api/index.md' }

Obviously it only work for a tiny portion of modules (only modules that have a single expression that is not import or export), but since there was no support at all before this PR, it's not going to break anyone.

Merge request reports

Loading