npm / cli

the package manager for JavaScript
https://docs.npmjs.com/cli/
Other
8.09k stars 2.92k forks source link

fix: pass strings to JSON.stringify in --json mode #7540

Closed lukekarrys closed 2 weeks ago

lukekarrys commented 2 weeks ago

In refactoring this behavior previously plain strings were no longer being passed through JSON.stringify even in json mode. This commit changes that to the previous behavior which fixes the bug in npm view. This also required changing the behavior of npm pkg which relied on this.

Fixes #7537

npm-cli-bot commented 2 weeks ago

no statistically significant performance changes detected

timing results |**app-large**|clean|lock-only|cache-only|modules-only|no-lock|no-cache|no-modules|no-clean|show-version|run-script|cache-only
peer-deps|no-clean
audit| |---|---|---|---|---|---|---|---|---|---|---|---|---| |npm@latest|31.815 ±0.29|10.675 ±0.02|11.826 ±0.04|1.578 ±0.01|1.569 ±0.00|1.292 ±0.01|8.426 ±0.01|1.296 ±0.00|0.140 ±0.00|0.168 ±0.00|15.101 ±0.16|2.134 ±0.05| |#7540|33.871 ±6.18|10.658 ±0.04|11.818 ±0.01|1.534 ±0.00|1.548 ±0.00|1.274 ±0.00|8.301 ±0.02|1.280 ±0.04|0.138 ±0.00|0.165 ±0.00|14.673 ±0.21|2.100 ±0.03| |**app-medium**|clean|lock-only|cache-only|modules-only|no-lock|no-cache|no-modules|no-clean|show-version|run-script|cache-only
peer-deps|no-clean
audit| |---|---|---|---|---|---|---|---|---|---|---|---|---| |npm@latest|25.024 ±0.40|8.029 ±0.00|8.932 ±0.02|1.483 ±0.01|1.500 ±0.02|1.432 ±0.02|5.838 ±0.04|1.314 ±0.01|0.138 ±0.00|0.166 ±0.00|9.985 ±0.06|2.013 ±0.09| |#7540|24.886 ±0.76|7.996 ±0.00|8.873 ±0.03|1.500 ±0.02|1.492 ±0.01|1.405 ±0.01|5.826 ±0.01|1.311 ±0.01|0.138 ±0.00|0.165 ±0.00|9.898 ±0.13|1.947 ±0.02|