node-modules-tools 0.6.2 → 0.6.4
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/constants.d.mts +1 -1
- package/dist/constants.d.ts +1 -1
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.mjs +20 -8
- package/dist/shared/{node-modules-tools.rYmxZoRW.d.mts → node-modules-tools.CNJ4umjk.d.mts} +1 -1
- package/dist/shared/{node-modules-tools.rYmxZoRW.d.ts → node-modules-tools.CNJ4umjk.d.ts} +1 -1
- package/package.json +3 -3
package/dist/constants.d.mts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { d as CLUSTER_DEP_DEV, e as CLUSTER_DEP_OPTIONAL, C as CLUSTER_DEP_PROD, c as PackageModuleTypes } from './shared/node-modules-tools.
|
|
1
|
+
export { d as CLUSTER_DEP_DEV, e as CLUSTER_DEP_OPTIONAL, C as CLUSTER_DEP_PROD, c as PackageModuleTypes } from './shared/node-modules-tools.CNJ4umjk.mjs';
|
|
2
2
|
import 'pkg-types';
|
|
3
3
|
import 'publint';
|
package/dist/constants.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { d as CLUSTER_DEP_DEV, e as CLUSTER_DEP_OPTIONAL, C as CLUSTER_DEP_PROD, c as PackageModuleTypes } from './shared/node-modules-tools.
|
|
1
|
+
export { d as CLUSTER_DEP_DEV, e as CLUSTER_DEP_OPTIONAL, C as CLUSTER_DEP_PROD, c as PackageModuleTypes } from './shared/node-modules-tools.CNJ4umjk.js';
|
|
2
2
|
import 'pkg-types';
|
|
3
3
|
import 'publint';
|
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AgentName } from 'package-manager-detector';
|
|
2
|
-
import { P as PackageNodeRaw, a as PackageNodeBase, b as PackageNode } from './shared/node-modules-tools.
|
|
3
|
-
export { d as CLUSTER_DEP_DEV, e as CLUSTER_DEP_OPTIONAL, C as CLUSTER_DEP_PROD, F as FileCategory, N as NpmMeta, h as NpmMetaLatest, i as PackageInstallSizeInfo, g as PackageModuleType, f as PackageModuleTypeSimple, c as PackageModuleTypes } from './shared/node-modules-tools.
|
|
2
|
+
import { P as PackageNodeRaw, a as PackageNodeBase, b as PackageNode } from './shared/node-modules-tools.CNJ4umjk.mjs';
|
|
3
|
+
export { d as CLUSTER_DEP_DEV, e as CLUSTER_DEP_OPTIONAL, C as CLUSTER_DEP_PROD, F as FileCategory, N as NpmMeta, h as NpmMetaLatest, i as PackageInstallSizeInfo, g as PackageModuleType, f as PackageModuleTypeSimple, c as PackageModuleTypes } from './shared/node-modules-tools.CNJ4umjk.mjs';
|
|
4
4
|
export { PackageJson } from 'pkg-types';
|
|
5
5
|
export { Message as PublintMessage } from 'publint';
|
|
6
6
|
export { NormalizedFunding, PackageNodeLike, ParsedFunding, ParsedLicense, constructPackageFilter, constructPackageFilters, normalizePkgAuthors, normalizePkgFundings, normalizePkgLicense, normalizePkgRepository, parseAuthor, parseFunding } from './utils.mjs';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AgentName } from 'package-manager-detector';
|
|
2
|
-
import { P as PackageNodeRaw, a as PackageNodeBase, b as PackageNode } from './shared/node-modules-tools.
|
|
3
|
-
export { d as CLUSTER_DEP_DEV, e as CLUSTER_DEP_OPTIONAL, C as CLUSTER_DEP_PROD, F as FileCategory, N as NpmMeta, h as NpmMetaLatest, i as PackageInstallSizeInfo, g as PackageModuleType, f as PackageModuleTypeSimple, c as PackageModuleTypes } from './shared/node-modules-tools.
|
|
2
|
+
import { P as PackageNodeRaw, a as PackageNodeBase, b as PackageNode } from './shared/node-modules-tools.CNJ4umjk.js';
|
|
3
|
+
export { d as CLUSTER_DEP_DEV, e as CLUSTER_DEP_OPTIONAL, C as CLUSTER_DEP_PROD, F as FileCategory, N as NpmMeta, h as NpmMetaLatest, i as PackageInstallSizeInfo, g as PackageModuleType, f as PackageModuleTypeSimple, c as PackageModuleTypes } from './shared/node-modules-tools.CNJ4umjk.js';
|
|
4
4
|
export { PackageJson } from 'pkg-types';
|
|
5
5
|
export { Message as PublintMessage } from 'publint';
|
|
6
6
|
export { NormalizedFunding, PackageNodeLike, ParsedFunding, ParsedLicense, constructPackageFilter, constructPackageFilters, normalizePkgAuthors, normalizePkgFundings, normalizePkgLicense, normalizePkgRepository, parseAuthor, parseFunding } from './utils.js';
|
package/dist/index.mjs
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
export { CLUSTER_DEP_DEV, CLUSTER_DEP_OPTIONAL, CLUSTER_DEP_PROD, PackageModuleTypes } from './constants.mjs';
|
|
2
2
|
import pLimit from 'p-limit';
|
|
3
3
|
import { detect } from 'package-manager-detector';
|
|
4
|
-
import
|
|
4
|
+
import { existsSync } from 'node:fs';
|
|
5
|
+
import fs, { readFile } from 'node:fs/promises';
|
|
5
6
|
import { o as objectPick } from './shared/node-modules-tools.CC43M-MZ.mjs';
|
|
6
7
|
export { c as constructPackageFilter, a as constructPackageFilters, e as normalizePkgAuthors, b as normalizePkgFundings, n as normalizePkgLicense, f as normalizePkgRepository, d as parseAuthor, p as parseFunding } from './shared/node-modules-tools.CC43M-MZ.mjs';
|
|
7
8
|
import { join as join$1 } from 'pathe';
|
|
@@ -210,6 +211,8 @@ async function getPackageInstallSize(pkg) {
|
|
|
210
211
|
return;
|
|
211
212
|
if (pkg.version.match(/^(?:file|link|workspace):/))
|
|
212
213
|
return;
|
|
214
|
+
if (!pkg.filepath)
|
|
215
|
+
return;
|
|
213
216
|
const root = pkg.filepath;
|
|
214
217
|
const files = [];
|
|
215
218
|
async function traverse(dir) {
|
|
@@ -321,13 +324,22 @@ async function resolvePackage(_packageManager, pkg, _options) {
|
|
|
321
324
|
const _pkg = pkg;
|
|
322
325
|
if (_pkg.resolved)
|
|
323
326
|
return _pkg;
|
|
324
|
-
const
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
327
|
+
const path = join$1(pkg.filepath, "package.json");
|
|
328
|
+
if (existsSync(path)) {
|
|
329
|
+
const content = await readFile(path, "utf-8");
|
|
330
|
+
const json = JSON.parse(stripBomTag(content));
|
|
331
|
+
_pkg.resolved = {
|
|
332
|
+
module: analyzePackageModuleType(json),
|
|
333
|
+
packageJson: objectPick(json, PACKAGE_JSON_KEYS),
|
|
334
|
+
installSize: await getPackageInstallSize(_pkg)
|
|
335
|
+
};
|
|
336
|
+
} else {
|
|
337
|
+
_pkg.filepath = "";
|
|
338
|
+
_pkg.resolved = {
|
|
339
|
+
module: "unknown",
|
|
340
|
+
packageJson: {}
|
|
341
|
+
};
|
|
342
|
+
}
|
|
331
343
|
return _pkg;
|
|
332
344
|
}
|
|
333
345
|
function stripBomTag(content) {
|
|
@@ -11,7 +11,7 @@ interface PackageInstallSizeInfo {
|
|
|
11
11
|
type FileCategory = 'comp' | 'css' | 'doc' | 'dts' | 'html' | 'image' | 'js' | 'json' | 'other' | 'test' | 'ts' | 'bin' | 'map' | 'wasm' | 'flow' | 'font';
|
|
12
12
|
|
|
13
13
|
type PackageModuleTypeSimple = 'cjs' | 'esm';
|
|
14
|
-
type PackageModuleType = 'cjs' | 'esm' | 'dual' | 'faux' | 'dts';
|
|
14
|
+
type PackageModuleType = 'cjs' | 'esm' | 'dual' | 'faux' | 'dts' | 'unknown';
|
|
15
15
|
interface PackageNodeRaw {
|
|
16
16
|
/** Package Name */
|
|
17
17
|
name: string;
|
|
@@ -11,7 +11,7 @@ interface PackageInstallSizeInfo {
|
|
|
11
11
|
type FileCategory = 'comp' | 'css' | 'doc' | 'dts' | 'html' | 'image' | 'js' | 'json' | 'other' | 'test' | 'ts' | 'bin' | 'map' | 'wasm' | 'flow' | 'font';
|
|
12
12
|
|
|
13
13
|
type PackageModuleTypeSimple = 'cjs' | 'esm';
|
|
14
|
-
type PackageModuleType = 'cjs' | 'esm' | 'dual' | 'faux' | 'dts';
|
|
14
|
+
type PackageModuleType = 'cjs' | 'esm' | 'dual' | 'faux' | 'dts' | 'unknown';
|
|
15
15
|
interface PackageNodeRaw {
|
|
16
16
|
/** Package Name */
|
|
17
17
|
name: string;
|
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.4",
|
|
5
5
|
"description": "Tools for inspecting node_modules",
|
|
6
6
|
"author": "Anthony Fu <anthonyfu117@hotmail.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -37,8 +37,8 @@
|
|
|
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.14",
|
|
41
|
+
"@pnpm/types": "^1000.4.0",
|
|
42
42
|
"@types/js-yaml": "^4.0.9",
|
|
43
43
|
"@types/stream-json": "^1.7.8",
|
|
44
44
|
"stream-json": "^1.9.1",
|