node-modules-hunter 1.4.0 → 1.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/cli.js +8 -2
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -5395,9 +5395,15 @@ async function isNpmGlobal() {
5395
5395
  }
5396
5396
  async function distTagsMap(allowSpawn) {
5397
5397
  const collect = (raw2) => {
5398
- if (raw2 === null || typeof raw2 !== "object" || Array.isArray(raw2)) return null;
5398
+ let source = raw2;
5399
+ if (Array.isArray(raw2)) {
5400
+ const objects = raw2.filter((item) => item !== null && typeof item === "object");
5401
+ if (objects.length === 0) return null;
5402
+ source = objects[objects.length - 1];
5403
+ }
5404
+ if (source === null || typeof source !== "object" || Array.isArray(source)) return null;
5399
5405
  const out = {};
5400
- for (const [name, version] of Object.entries(raw2)) {
5406
+ for (const [name, version] of Object.entries(source)) {
5401
5407
  if (typeof version === "string" && VERSION_SHAPE.test(version)) out[name] = version;
5402
5408
  }
5403
5409
  return Object.keys(out).length > 0 ? out : null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-modules-hunter",
3
- "version": "1.4.0",
3
+ "version": "1.4.1",
4
4
  "description": "Hunt down bloated node_modules folders across your machine — scan, measure, and clean them with one command.",
5
5
  "type": "module",
6
6
  "license": "MIT",