How m-izadmehr/deadfile works
Project type and purpose
• deadfile is a Node.js-based CLI utility for detecting dead code and unused files in JavaScript/TypeScript/Vue/React projects.
• It parses source files (via AST plugins), resolves imports/exports, and reports unused modules either as a JSON/CI report or via a simple HTTP report server with Mustache templates.
File structure
• Top level
• bin.js – CLI entry point
• src/ – core application code
• • ASTPlugins/ – modular parsers and walkers for import/export detection
• • cli/ – classes for argument parsing, logging, and writing report files
• • handlers/ – business-logic units (AllAssets, UsedAssets, fileResolver)
• • models/ – data abstractions (Parsables, Source, Types)
• • reportServer/ – lightweight server offering a web UI (scripts, views, server.js)
• • index.js – orchestrates the analysis pipeline
• example/ – sample projects demonstrating different import syntaxes
• docs/ – static site assets and generated documentation
• test/ – integration and unit test suites, fixtures for various babel configurations
README for additional insights
• Highlights loose parsing strategy and broad syntax support (ES5/ES6, dynamic import, React/Vue).
• Describes CLI options (--dir, --exclude, --output, --ci) and output modes (JSON vs. report server).
Detail
• Explicitly show the filesystem and package.json as the ultimate source of truth for resolving imports and identifying unused dependencies.
• Plugin points for future extension.