esm: better package.json parser errors
This is a follow-up to https://github.com/nodejs/node/pull/35072 to add more context to package.json parse errors.
Specifically the package / module being imported or imported from when the package.json parser error was encountered.
These kinds of cases make up for the fact that ESM, unlike require, does not have a require stack to see what was the import in the first case that caused the issue.
Checklist
-
make -j4 test
(UNIX), orvcbuild test
(Windows) passes -
tests and/or benchmarks are included -
commit message follows commit guidelines