node-modules-tools 0.6.9 → 0.6.10

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.
@@ -37,7 +37,9 @@ async function queryDependencies(options, query, lockfileOnly = false) {
37
37
  const json = await import('./json-parse-stream.mjs').then((r) => r.parseJsonStreamWithConcatArrays(process.process.stdout, "npm query"));
38
38
  if (!Array.isArray(json))
39
39
  throw new Error(`Failed to parse \`npm query\` output, expected an array but got: ${String(json)}`);
40
- return json;
40
+ return json.filter((pkg) => {
41
+ return pkg && typeof pkg === "object" && typeof pkg._id === "string" && typeof pkg.name === "string" && typeof pkg.version === "string";
42
+ });
41
43
  }
42
44
  async function listPackageDependencies(options) {
43
45
  const [
package/dist/index.mjs CHANGED
@@ -114,16 +114,8 @@ function analyzePackageModuleType(pkgJson) {
114
114
  if (pkgJson.module) {
115
115
  fauxEsm = true;
116
116
  }
117
- if (exports && typeof exports === "object") {
118
- for (const exportId in exports) {
119
- if (Object.hasOwn(exports, exportId) && typeof exportId === "string") {
120
- const value = (
121
- /** @type {unknown} */
122
- exports[exportId]
123
- );
124
- analyzeThing(value, `${pkgJson.name}#exports`);
125
- }
126
- }
117
+ if (exports) {
118
+ analyzeThing(exports, `${pkgJson.name}#exports`);
127
119
  }
128
120
  if (esm && type === "commonjs") {
129
121
  cjs = true;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "node-modules-tools",
3
3
  "type": "module",
4
- "version": "0.6.9",
4
+ "version": "0.6.10",
5
5
  "description": "Tools for inspecting node_modules",
6
6
  "author": "Anthony Fu <anthonyfu117@hotmail.com>",
7
7
  "license": "MIT",
@@ -37,7 +37,7 @@
37
37
  "tinyexec": "^1.0.1"
38
38
  },
39
39
  "devDependencies": {
40
- "@pnpm/list": "^1000.0.17",
40
+ "@pnpm/list": "^1000.0.19",
41
41
  "@pnpm/types": "^1000.6.0",
42
42
  "@types/js-yaml": "^4.0.9",
43
43
  "@types/stream-json": "^1.7.8",