@wolfcola/dead-export-finder
v1.1.1
Published
Find dead exports across monorepo package boundaries
Readme
@wolfcola/dead-export-finder
Find unused exports across monorepo package boundaries. Scans all workspace packages, parses exports and imports with oxc-parser, and reports exports that are never imported by any other package.
Installation
npm install -D @wolfcola/dead-export-finderCLI Usage
dead-export-finder [options]Run from the monorepo root. The tool auto-detects workspace packages from pnpm-workspace.yaml or package.json workspaces.
Options
| Option | Alias | Description |
| ------------------- | ----- | ----------------------------------------------------- |
| --packages <name> | -p | Scope analysis to specific package names (repeatable) |
| --ignore <glob> | -i | Glob patterns to exclude from scanning (repeatable) |
| --verbose | -v | Print timing, file counts, and parse warnings |
Examples
# Scan all packages
dead-export-finder
# Scope to specific packages
dead-export-finder -p @wolfcola/devtools-core -p @wolfcola/devtools-types
# Ignore test files
dead-export-finder -i "**/*.test.ts" -i "**/*.spec.ts"
# Verbose output
dead-export-finder --verboseExit code is 1 when dead exports are found, 0 when clean.
Programmatic API
All services are exported for use in custom tooling:
import {
WorkspaceDetector,
WorkspaceDetectorLive,
FileScanner,
FileScannerLive,
ExportParser,
ExportParserLive,
ImportParser,
ImportParserLive,
ExportGraph,
ExportGraphLive,
Reporter,
ReporterLive,
} from '@wolfcola/dead-export-finder';Each service follows the Context.Service + Live layer pattern from Effect.
Types
import type {
PackageInfo,
ExportedSymbol,
ImportedSymbol,
DeadExport,
AnalysisResult,
WorkspaceResult,
} from '@wolfcola/dead-export-finder';Errors
import {
WorkspaceNotFoundError,
ParseError,
EntryPointResolutionError,
} from '@wolfcola/dead-export-finder';How It Works
- Workspace detection — reads
pnpm-workspace.yamlorpackage.jsonworkspaces to find all packages - File scanning — finds all
.ts,.tsx,.js,.jsxfiles in each package, respecting.gitignoreand--ignoreglobs - Export parsing — uses
oxc-parserto extract all exported symbols from each file - Import parsing — uses
oxc-parserto extract all imported symbols from each file - Graph analysis — builds a cross-package dependency graph and identifies exports with zero imports
- Reporting — formats results grouped by package with file paths relative to package root
Parse errors are handled gracefully as warnings — the tool continues with remaining files.
License
MIT
