node-modules-tools 0.6.8 → 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.
- package/dist/chunks/index2.mjs +3 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.mjs +4 -12
- package/package.json +4 -4
package/dist/chunks/index2.mjs
CHANGED
|
@@ -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.d.mts
CHANGED
|
@@ -54,7 +54,7 @@ declare function getPackageManager(options: BaseOptions): Promise<AgentName>;
|
|
|
54
54
|
*
|
|
55
55
|
* This function will automatically detect the package manager in the current project, and list the dependencies of the packages.
|
|
56
56
|
*/
|
|
57
|
-
declare function listPackageDependenciesRaw(manager: AgentName, options: ListPackageDependenciesOptions): Promise<
|
|
57
|
+
declare function listPackageDependenciesRaw(manager: AgentName, options: ListPackageDependenciesOptions): Promise<ListPackageDependenciesBaseResult>;
|
|
58
58
|
|
|
59
59
|
declare function listPackageDependencies(options: ListPackageDependenciesOptions): Promise<ListPackageDependenciesResult>;
|
|
60
60
|
|
package/dist/index.d.ts
CHANGED
|
@@ -54,7 +54,7 @@ declare function getPackageManager(options: BaseOptions): Promise<AgentName>;
|
|
|
54
54
|
*
|
|
55
55
|
* This function will automatically detect the package manager in the current project, and list the dependencies of the packages.
|
|
56
56
|
*/
|
|
57
|
-
declare function listPackageDependenciesRaw(manager: AgentName, options: ListPackageDependenciesOptions): Promise<
|
|
57
|
+
declare function listPackageDependenciesRaw(manager: AgentName, options: ListPackageDependenciesOptions): Promise<ListPackageDependenciesBaseResult>;
|
|
58
58
|
|
|
59
59
|
declare function listPackageDependencies(options: ListPackageDependenciesOptions): Promise<ListPackageDependenciesResult>;
|
|
60
60
|
|
package/dist/index.mjs
CHANGED
|
@@ -51,7 +51,7 @@ function populateRawResult(input) {
|
|
|
51
51
|
result.packages.get(dep)?.dependents.add(pkg.spec);
|
|
52
52
|
}
|
|
53
53
|
}
|
|
54
|
-
function
|
|
54
|
+
function resolveFlatDependencies(pkg) {
|
|
55
55
|
const postTasks = [];
|
|
56
56
|
function traverseDependencies(node, seen = /* @__PURE__ */ new Set()) {
|
|
57
57
|
for (const dep of node.dependencies) {
|
|
@@ -100,7 +100,7 @@ function populateRawResult(input) {
|
|
|
100
100
|
task();
|
|
101
101
|
}
|
|
102
102
|
for (const pkg of result.packages.values())
|
|
103
|
-
|
|
103
|
+
resolveFlatDependencies(pkg);
|
|
104
104
|
return result;
|
|
105
105
|
}
|
|
106
106
|
|
|
@@ -114,16 +114,8 @@ function analyzePackageModuleType(pkgJson) {
|
|
|
114
114
|
if (pkgJson.module) {
|
|
115
115
|
fauxEsm = true;
|
|
116
116
|
}
|
|
117
|
-
if (exports
|
|
118
|
-
|
|
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.
|
|
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",
|
|
@@ -33,12 +33,12 @@
|
|
|
33
33
|
"pathe": "^2.0.3",
|
|
34
34
|
"pkg-types": "^2.1.0",
|
|
35
35
|
"publint": "^0.3.12",
|
|
36
|
-
"semver": "^7.7.
|
|
36
|
+
"semver": "^7.7.2",
|
|
37
37
|
"tinyexec": "^1.0.1"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
|
-
"@pnpm/list": "^1000.0.
|
|
41
|
-
"@pnpm/types": "^1000.
|
|
40
|
+
"@pnpm/list": "^1000.0.19",
|
|
41
|
+
"@pnpm/types": "^1000.6.0",
|
|
42
42
|
"@types/js-yaml": "^4.0.9",
|
|
43
43
|
"@types/stream-json": "^1.7.8",
|
|
44
44
|
"stream-json": "^1.9.1",
|