{"id":16296167,"url":"https://github.com/scinos/module-coverage","last_synced_at":"2025-04-09T13:36:54.202Z","repository":{"id":66129735,"uuid":"572889274","full_name":"scinos/module-coverage","owner":"scinos","description":null,"archived":false,"fork":false,"pushed_at":"2022-12-14T06:32:05.000Z","size":893,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-02-15T07:42:14.657Z","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/scinos.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2022-12-01T08:47:48.000Z","updated_at":"2022-12-19T19:39:47.000Z","dependencies_parsed_at":"2023-03-10T23:39:23.041Z","dependency_job_id":null,"html_url":"https://github.com/scinos/module-coverage","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scinos%2Fmodule-coverage","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scinos%2Fmodule-coverage/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scinos%2Fmodule-coverage/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scinos%2Fmodule-coverage/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/scinos","download_url":"https://codeload.github.com/scinos/module-coverage/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248050238,"owners_count":21039347,"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-10T20:21:28.879Z","updated_at":"2025-04-09T13:36:54.176Z","avatar_url":"https://github.com/scinos.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# module-coverage\n\nDisplays information about module coverage (on a webpack bundle) using Code Coverage report from Chrome DevTools.\n\n\n## Usage\n\n### Pre-requisites\nThis assume your bundle (split into one or more chunks) will have the structure:\n\n```\n(window.webpackJsonp = window.webpackJsonp || []).push([[\u003cid\u003e], {\n    \"\u003cmodule-name-1\u003e\": function() {...},\n    \"\u003cmodule-name-2\u003e\": function() {...},\n    ...\n})\n```\n\nIt works best if `module-name-1` is not hashed (i.e. if you use `moduleId: \"named\"`) in webpack config.\n\n### Running the tool\n\n1. Generate the code coverage from Chrome Dev Tools (see https://developer.chrome.com/docs/devtools/coverage/)\n2. Export it as a JSON\n3. Run `yarn dlx module-coverage -f \u003cjson-report-path\u003e`\n\n\n### Getting size info\n\nOptionally, you can also display the size information of unused modules. Please note this will desplay the raw unminified, uncompressed size.\n\nThis works by specifying the root of your projects, where your `node_modules` are.\n\n```\nyarn dlx module-coverage -f \u003cjson-report-path\u003e -r \u003croot\u003e\n```\n\n\n## Details\n\nThis tool will look for the AST path `Program \u003e ExpressionStatement \u003e CallExpression \u003e ArrayExpression \u003e ObjectExpression`, and expect that object to have module names as keys, and their implementation as values.\n\nThen it will extract the ranges from the Code Coverage report, and interset those ranges with the AST mentioned above to determine if there is an overlapping range with the module implementation. If there is not, it will mark that module as unused.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fscinos%2Fmodule-coverage","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fscinos%2Fmodule-coverage","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fscinos%2Fmodule-coverage/lists"}