{"id":17402912,"url":"https://github.com/thlorenz/depstats","last_synced_at":"2025-07-12T00:08:00.816Z","repository":{"id":65995343,"uuid":"337093105","full_name":"thlorenz/depstats","owner":"thlorenz","description":"Groups modules by package and includes stats.","archived":false,"fork":false,"pushed_at":"2021-02-09T18:49:49.000Z","size":26,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-29T20:14:08.708Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/thlorenz.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-02-08T13:56:31.000Z","updated_at":"2021-02-24T16:28:12.000Z","dependencies_parsed_at":"2023-04-10T11:16:28.604Z","dependency_job_id":null,"html_url":"https://github.com/thlorenz/depstats","commit_stats":{"total_commits":7,"total_committers":1,"mean_commits":7.0,"dds":0.0,"last_synced_commit":"d69589e0633901b29af41f067b882e70c53ee1e6"},"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/thlorenz/depstats","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thlorenz%2Fdepstats","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thlorenz%2Fdepstats/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thlorenz%2Fdepstats/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thlorenz%2Fdepstats/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/thlorenz","download_url":"https://codeload.github.com/thlorenz/depstats/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thlorenz%2Fdepstats/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264916028,"owners_count":23682957,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-16T18:37:48.951Z","updated_at":"2025-07-12T00:08:00.766Z","avatar_url":"https://github.com/thlorenz.png","language":"JavaScript","readme":"# depstats [![](https://github.com/thlorenz/depstats/workflows/Node/badge.svg?branch=master)](https://github.com/thlorenz/depstats/actions)\n\nGroups modules by package and includes stats.\n\n## Example\n\nGiven an app with express dependency at `expressAppDir`.\n\n```js\nconst { depStats } = require('depstats')\nconst { inspect } = require('util')\n\nconst res = await depStats(expressAppDir, [\n  './node_modules/express/lib/middleware/query.js',\n  './node_modules/express/lib/middleware/init.js',\n  './node_modules/express/lib/router/layer.js',\n  './node_modules/express/lib/router/index.js',\n  './node_modules/express/lib/express.js',\n  './node_modules/express/index.js',\n  './node_modules/express/application.js',\n  './node_modules/body-parser/lib/types/json.js',\n  './node_modules/body-parser/lib/read.js',\n  './node_modules/body-parser/index.js',\n])\nconsole.log(inspect(Array.from(res), { depth: 5 }))\n```\n\nOutputs the below where `full:` is the actual full path for your case.\n\n```js\n[\n  [\n    'body-parser@1.19.0',\n    {\n      name: 'body-parser',\n      version: '1.19.0',\n      main: 'index.js',\n      fullPath: 'full:node_modules/body-parser',\n      relPath: 'node_modules/body-parser',\n      modules: [\n        {\n          modulePath: 'index.js',\n          relPath: 'node_modules/body-parser/index.js',\n          fullPath: 'full:node_modules/body-parser/index.js',\n          size: 2656,\n          humanSize: '2.66 kB'\n        },\n        {\n          modulePath: 'lib/read.js',\n          relPath: 'node_modules/body-parser/lib/read.js',\n          fullPath: 'full:node_modules/body-parser/lib/read.js',\n          size: 3894,\n          humanSize: '3.89 kB'\n        },\n        {\n          modulePath: 'lib/types/json.js',\n          relPath: 'node_modules/body-parser/lib/types/json.js',\n          fullPath: 'full:node_modules/body-parser/lib/types/json.js',\n          size: 4918,\n          humanSize: '4.92 kB'\n        }\n      ]\n    }\n  ],\n  [\n    'express@4.17.1',\n    {\n      name: 'express',\n      version: '4.17.1',\n      main: 'index.js',\n      fullPath: 'full:node_modules/express',\n      relPath: 'node_modules/express',\n      modules: [\n        {\n          modulePath: 'index.js',\n          relPath: 'node_modules/express/index.js',\n          fullPath: 'full:node_modules/express/index.js',\n          size: 224,\n          humanSize: '224 B'\n        },\n        {\n          modulePath: 'lib/express.js',\n          relPath: 'node_modules/express/lib/express.js',\n          fullPath: 'full:node_modules/express/lib/express.js',\n          size: 2409,\n          humanSize: '2.41 kB'\n        },\n        {\n          modulePath: 'lib/middleware/init.js',\n          relPath: 'node_modules/express/lib/middleware/init.js',\n          fullPath: 'full:node_modules/express/lib/middleware/init.js',\n          size: 853,\n          humanSize: '853 B'\n        },\n        {\n          modulePath: 'lib/middleware/query.js',\n          relPath: 'node_modules/express/lib/middleware/query.js',\n          fullPath: 'full:node_modules/express/lib/middleware/query.js',\n          size: 885,\n          humanSize: '885 B'\n        },\n        {\n          modulePath: 'lib/router/index.js',\n          relPath: 'node_modules/express/lib/router/index.js',\n          fullPath: 'full:node_modules/express/lib/router/index.js',\n          size: 14883,\n          humanSize: '14.9 kB'\n        },\n        {\n          modulePath: 'lib/router/layer.js',\n          relPath: 'node_modules/express/lib/router/layer.js',\n          fullPath: 'full:node_modules/express/lib/router/layer.js',\n          size: 3296,\n          humanSize: '3.3 kB'\n        }\n      ]\n    }\n  ]\n]\n```\n\n### ModuleInfo\n\nAllows retrieving info including of its containing package for a specific file.\n\nGiven `depstats` obtained previously.\n\n```js\nconst file = path.resolve(\n  appRootDir,\n  './node_modules/body-parser/lib/types/text.js'\n)\nconst packageInfo = modulePackageInfo(depstats, file)\nconsole.log(inspect(packageInfo, { depth: 5 }))\n```\n\nOutputs the below where `full:` is the actual full path for your case.\n\n```\n{\n  pkg: {\n    name: 'body-parser',\n    version: '1.19.0',\n    main: 'index.js',\n    fullPath: 'full:node_modules/body-parser',\n    relPath: 'node_modules/body-parser'\n  },\n  mdl: {\n    modulePath: 'lib/types/text.js',\n    relPath: 'node_modules/body-parser/lib/types/text.js',\n    fullPath: 'full:node_modules/body-parser/lib/types/text.js',\n    size: 2285,\n    humanSize: '2.29 kB'\n  }\n}\n```\n\n## LICENSE\n\nMIT\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthlorenz%2Fdepstats","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthlorenz%2Fdepstats","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthlorenz%2Fdepstats/lists"}