rev-dep 2.0.0 → 2.1.0
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/Readme.md +251 -98
- package/package.json +25 -23
package/Readme.md
CHANGED
|
@@ -1,168 +1,242 @@
|
|
|
1
1
|
<p align="center">
|
|
2
2
|
<img src="https://github.com/jayu/rev-dep/raw/master/logo.png" width="400">
|
|
3
3
|
</p>
|
|
4
|
+
|
|
4
5
|
<p align="center">
|
|
5
|
-
<a href="#
|
|
6
|
-
<a href="#
|
|
7
|
-
<a href="#
|
|
8
|
-
<a href="#
|
|
6
|
+
<a href="#key-features-">Key Features</a> •
|
|
7
|
+
<a href="#installation-">Installation</a> •
|
|
8
|
+
<a href="#quick-examples-">Quick Examples</a> •
|
|
9
|
+
<a href="#practical-examples-">Practical Examples</a> •
|
|
10
|
+
<a href="#cli-reference-">CLI Reference</a>
|
|
9
11
|
</p>
|
|
10
12
|
|
|
11
13
|
<p align="center">
|
|
12
|
-
Dependency analysis and optimization toolkit for modern TypeScript projects.
|
|
14
|
+
Dependency analysis and optimization toolkit for modern JavaScript and TypeScript projects.
|
|
13
15
|
<br>
|
|
14
|
-
|
|
16
|
+
Trace imports, find unused code, clean dependencies — all from a blazing-fast CLI.
|
|
15
17
|
</p>
|
|
16
18
|
|
|
17
19
|
---
|
|
18
20
|
|
|
19
|
-
<img alt="rev-dep version" src="https://img.shields.io/npm/v/rev-dep">
|
|
21
|
+
<img alt="rev-dep version" src="https://img.shields.io/npm/v/rev-dep">
|
|
22
|
+
<img alt="rev-dep license" src="https://img.shields.io/npm/l/rev-dep">
|
|
23
|
+
<img alt="rev-dep PRs welcome" src="https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square">
|
|
24
|
+
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
# **About 📣**
|
|
28
|
+
|
|
29
|
+
Working in large JS/TS projects makes it difficult to answer simple but crucial questions:
|
|
20
30
|
|
|
31
|
+
* Which files depend on this file?
|
|
32
|
+
* Is this file even used?
|
|
33
|
+
* Which files does this entry point import?
|
|
34
|
+
* Do I have circular dependencies?
|
|
35
|
+
* Which packages in node_modules are unused?
|
|
36
|
+
* Which modules take the most disk space?
|
|
21
37
|
|
|
22
|
-
|
|
38
|
+
rev-dep helps you understand the real structure of your codebase so you can debug issues faster, refactor safely, and keep your dependencies clean.
|
|
23
39
|
|
|
24
|
-
|
|
40
|
+
It's particularly useful for JavaScript projects without TypeScript or test coverage — places where answering question "What will break if I change this" is not straightforward
|
|
25
41
|
|
|
26
|
-
|
|
42
|
+
---
|
|
27
43
|
|
|
28
|
-
|
|
44
|
+
## **Why rev-dep? 🤔**
|
|
29
45
|
|
|
30
|
-
|
|
46
|
+
rev-dep is designed for **fast iteration** and **minimal, actionable results** — no noise, just answers.
|
|
31
47
|
|
|
32
|
-
|
|
48
|
+
### ✅ **Results in milliseconds**
|
|
33
49
|
|
|
34
|
-
|
|
50
|
+
Built in Go for speed. Even on large codebases, rev-dep responds almost instantly.
|
|
35
51
|
|
|
36
|
-
|
|
52
|
+
### ✅ **Actionable, list-based output**
|
|
37
53
|
|
|
54
|
+
You get **exact file paths**, **import chains**, and **clear dependency relationships** — the kind of information you can fix or clean up right away.
|
|
38
55
|
|
|
39
|
-
|
|
56
|
+
### ✅ **Designed for real-world JS/TS**
|
|
40
57
|
|
|
41
|
-
|
|
58
|
+
Works with mixed JS/TS projects, path aliases and thousands of files without configuration hassles.
|
|
42
59
|
|
|
43
|
-
|
|
60
|
+
### ✅ **Deep analysis, one CLI**
|
|
44
61
|
|
|
45
|
-
|
|
62
|
+
Unused files, unused or missing dependencies, reverse-imports, entry point detection, node_modules insights, dependency paths — everything in one tool.
|
|
46
63
|
|
|
47
|
-
|
|
64
|
+
<!--
|
|
65
|
+
### ✔ **Much faster than alternatives**
|
|
48
66
|
|
|
49
|
-
-
|
|
50
|
-
- [You are wondering wether a given source file is used](#how-to-check-if-a-file-is-used-in-the-project)
|
|
51
|
-
- [You wonder if there are any dead files in your project](#how-to-identify-dead-files-in-the-project)
|
|
52
|
-
- [You want to verify if a given entry point imports only the required files](#how-to-check-which-files-are-imported-by-a-given-file)
|
|
53
|
-
- [You want to optimize the amount of files imported by an entry point](#how-to-reduce-amount-of-files-imported-by-entry-point)
|
|
54
|
-
- [You want to detect circular dependencies in your project](#how-to-detect-circular-dependencies-in-the-project)
|
|
55
|
-
- [You want to find unused node modules to clean up dependencies](#how-to-find-unused-node-modules)
|
|
56
|
-
- [You want to identify which node modules are consuming the most disk space](#how-to-identify-space-consuming-node-modules)
|
|
67
|
+
rev-dep outperforms Madge, dpdm, dependency-cruiser, skott, knip, depcheck and other similar tools.
|
|
57
68
|
|
|
58
|
-
|
|
69
|
+
For 500k+ lines of code and 6k+ source code files get checks as fast as:
|
|
59
70
|
|
|
60
|
-
|
|
71
|
+
| Task | Execution Time |
|
|
72
|
+
|------|----------------|
|
|
73
|
+
| Find circular dependencies | |
|
|
74
|
+
| Find unused files | |
|
|
75
|
+
| Find unused node modules | |
|
|
76
|
+
| Find missing node modules | |
|
|
77
|
+
| Trace reverse dependencies for a file | |
|
|
78
|
+
| Trace full dependency paths | |
|
|
79
|
+
| List all files imported by an entry point | |
|
|
80
|
+
| Discover entry points | |
|
|
81
|
+
| Count lines of code | |
|
|
82
|
+
| Check node_modules disk usage | |
|
|
83
|
+
| Analyze node_modules directory sizes | |
|
|
84
|
+
| List file-to-file dependency graph | |
|
|
61
85
|
|
|
62
|
-
|
|
86
|
+
>Benchmark run on WSL Linux Debian Intel(R) Core(TM) i9-14900KF CPU @ 2.80GHz
|
|
63
87
|
|
|
64
|
-
|
|
88
|
+
--->
|
|
65
89
|
|
|
66
|
-
|
|
90
|
+
If your project feels like a dependency maze, rev-dep gives you a map.
|
|
67
91
|
|
|
68
|
-
|
|
92
|
+
---
|
|
69
93
|
|
|
70
|
-
|
|
94
|
+
# **Key Features 🚀**
|
|
71
95
|
|
|
72
|
-
|
|
96
|
+
* 🔍 **Reverse dependency lookup** — see all entry points that require a given file
|
|
97
|
+
* 🗂️ **Entry point discovery**
|
|
98
|
+
* 🧹 **Dead file detection**
|
|
99
|
+
* 📦 **Unused / missing / used node modules / dependencies analysis**
|
|
100
|
+
* 🔄 **Circular imports/dependencies detection**
|
|
101
|
+
* 🧭 **Trace all import paths between files**
|
|
102
|
+
* 📁 **List all files imported by any entry point**
|
|
103
|
+
* 📏 **Count actual lines of code (excluding comments, blanks and ai prompts)**
|
|
104
|
+
* 💽 **Node modules disk usage & size analysis**
|
|
105
|
+
* 💡 **Works with both JavaScript and TypeScript**
|
|
106
|
+
* ⚡ **Built for large codebases**
|
|
73
107
|
|
|
74
|
-
|
|
108
|
+
---
|
|
75
109
|
|
|
76
|
-
|
|
110
|
+
# **Installation 📦**
|
|
77
111
|
|
|
78
|
-
|
|
112
|
+
Install globally to use as a CLI tool:
|
|
79
113
|
|
|
80
|
-
|
|
114
|
+
```
|
|
115
|
+
yarn global add rev-dep
|
|
116
|
+
```
|
|
81
117
|
|
|
82
|
-
|
|
118
|
+
```
|
|
119
|
+
npm install -g rev-dep
|
|
120
|
+
```
|
|
83
121
|
|
|
84
|
-
|
|
122
|
+
```
|
|
123
|
+
pnpm global add rev-dep
|
|
124
|
+
```
|
|
85
125
|
|
|
86
|
-
|
|
126
|
+
---
|
|
87
127
|
|
|
88
|
-
|
|
128
|
+
# **Quick Examples ⚡**
|
|
89
129
|
|
|
90
|
-
|
|
130
|
+
A few instant-use examples to get a feel for the tool:
|
|
91
131
|
|
|
92
|
-
|
|
132
|
+
```bash
|
|
133
|
+
# Find every entry point that depends on a file
|
|
134
|
+
rev-dep resolve --file src/utils/math.ts
|
|
93
135
|
|
|
94
|
-
|
|
136
|
+
# List all entry points in the project
|
|
137
|
+
rev-dep entry-points
|
|
95
138
|
|
|
96
|
-
|
|
139
|
+
# Detect unused node modules
|
|
140
|
+
rev-dep node-modules unused
|
|
97
141
|
|
|
98
|
-
|
|
142
|
+
# Check which files an entry point imports
|
|
143
|
+
rev-dep files --entry-point src/index.ts
|
|
99
144
|
|
|
100
|
-
|
|
145
|
+
# Detect circular imports/dependencies
|
|
146
|
+
rev-dep circular
|
|
147
|
+
```
|
|
101
148
|
|
|
102
|
-
|
|
149
|
+
---
|
|
103
150
|
|
|
104
|
-
|
|
151
|
+
# **Practical Examples 🔧**
|
|
105
152
|
|
|
106
|
-
Use `rev-dep entry-points` to get list of all files that are not required by any other files in the project.
|
|
107
153
|
|
|
108
|
-
|
|
154
|
+
### **How to identify where a file is used in the project**
|
|
109
155
|
|
|
110
|
-
|
|
156
|
+
```
|
|
157
|
+
rev-dep resolve --file path/to/file.ts
|
|
158
|
+
```
|
|
111
159
|
|
|
112
|
-
|
|
160
|
+
You’ll see all entry points that implicitly require that file, along with resolution paths.
|
|
113
161
|
|
|
114
|
-
|
|
162
|
+
---
|
|
115
163
|
|
|
116
|
-
|
|
164
|
+
### **How to check if a file is used**
|
|
117
165
|
|
|
118
|
-
|
|
166
|
+
```
|
|
167
|
+
rev-dep resolve --file path/to/file.ts --compact-summary
|
|
168
|
+
```
|
|
119
169
|
|
|
120
|
-
|
|
170
|
+
Shows how many entry points indirectly depend on the file.
|
|
121
171
|
|
|
122
|
-
|
|
172
|
+
---
|
|
123
173
|
|
|
124
|
-
### How to
|
|
174
|
+
### **How to identify dead files**
|
|
125
175
|
|
|
126
|
-
|
|
176
|
+
```
|
|
177
|
+
rev-dep entry-points
|
|
178
|
+
```
|
|
127
179
|
|
|
128
|
-
|
|
180
|
+
Exclude framework entry points if needed using `--result-exclude`.
|
|
129
181
|
|
|
130
|
-
|
|
182
|
+
---
|
|
131
183
|
|
|
132
|
-
|
|
133
|
-
3. Get all resolution paths for a suspicious file
|
|
184
|
+
### **How to list all files imported by an entry point**
|
|
134
185
|
|
|
135
|
-
|
|
186
|
+
```
|
|
187
|
+
rev-dep files --entry-point path/to/file.ts
|
|
188
|
+
```
|
|
136
189
|
|
|
137
|
-
|
|
190
|
+
Useful for identifying heavy components or unintended dependencies.
|
|
138
191
|
|
|
139
|
-
|
|
192
|
+
---
|
|
140
193
|
|
|
141
|
-
|
|
194
|
+
### **How to reduce unnecessary imports for an entry point**
|
|
142
195
|
|
|
143
|
-
|
|
196
|
+
1. List all files imported:
|
|
144
197
|
|
|
145
|
-
|
|
198
|
+
```
|
|
199
|
+
rev-dep files --entry-point path/to/entry.ts
|
|
200
|
+
```
|
|
201
|
+
2. Identify suspicious files.
|
|
202
|
+
3. Trace why they are included:
|
|
146
203
|
|
|
147
|
-
|
|
204
|
+
```
|
|
205
|
+
rev-dep resolve --file path/to/suspect --entry-points path/to/entry.ts --all
|
|
206
|
+
```
|
|
148
207
|
|
|
149
|
-
|
|
208
|
+
---
|
|
150
209
|
|
|
151
|
-
|
|
210
|
+
### **How to detect circular dependencies**
|
|
152
211
|
|
|
153
|
-
|
|
212
|
+
```
|
|
213
|
+
rev-dep circular
|
|
214
|
+
```
|
|
154
215
|
|
|
155
|
-
|
|
216
|
+
---
|
|
156
217
|
|
|
157
|
-
### How to
|
|
218
|
+
### **How to find unused node modules**
|
|
158
219
|
|
|
159
|
-
|
|
220
|
+
```
|
|
221
|
+
rev-dep node-modules unused
|
|
222
|
+
```
|
|
160
223
|
|
|
161
|
-
|
|
224
|
+
---
|
|
162
225
|
|
|
163
|
-
|
|
226
|
+
### **How to find missing node modules**
|
|
227
|
+
|
|
228
|
+
```
|
|
229
|
+
rev-dep node-modules missing
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
---
|
|
233
|
+
|
|
234
|
+
### **How to check node_modules space usage**
|
|
235
|
+
|
|
236
|
+
```
|
|
237
|
+
rev-dep node-modules dirs-size
|
|
238
|
+
```
|
|
164
239
|
|
|
165
|
-
[`node-modules dirs-size` command CLI reference](#rev-dep-node-modules-dirs-size)
|
|
166
240
|
|
|
167
241
|
## Reimplemented to achieve 7x-37x speedup
|
|
168
242
|
|
|
@@ -177,7 +251,7 @@ Benchmark was run on TypeScript codebase with 507658 lines of code and 5977 sour
|
|
|
177
251
|
|
|
178
252
|
Memory usage on Mac was measure using `/usr/bin/time` utility. Memory usage on Linux was not measured because I could't find reliable way to measure RAM usage on Linux. Subsequent runs had too much fluctuation.
|
|
179
253
|
|
|
180
|
-
###
|
|
254
|
+
### MacBook Pro with Apple M1 chip, 16GB of RAM and 256GB of storage. Power save mode off
|
|
181
255
|
|
|
182
256
|
| Command | V1 Time | V2 Time | Time Change | V1 RAM | V2 RAM | RAM Change |
|
|
183
257
|
| ------------------------------------------------------------ | ------- | ------- | ----------- | ------ | ------ | ---------- |
|
|
@@ -307,8 +381,8 @@ rev-dep circular --ignore-types-imports
|
|
|
307
381
|
-c, --cwd string Working directory for the command (default "$PWD")
|
|
308
382
|
-h, --help help for circular
|
|
309
383
|
-t, --ignore-type-imports Exclude type imports from the analysis
|
|
310
|
-
--package-json string Path to package.json (default: ./package.json)
|
|
311
|
-
--tsconfig-json string Path to tsconfig.json (default: ./tsconfig.json)
|
|
384
|
+
--package-json string Path to package.json (default: ./package.json)
|
|
385
|
+
--tsconfig-json string Path to tsconfig.json (default: ./tsconfig.json)
|
|
312
386
|
```
|
|
313
387
|
|
|
314
388
|
|
|
@@ -339,11 +413,11 @@ rev-dep entry-points --print-deps-count
|
|
|
339
413
|
--graph-exclude strings Exclude files matching these glob patterns from analysis
|
|
340
414
|
-h, --help help for entry-points
|
|
341
415
|
-t, --ignore-type-imports Exclude type imports from the analysis
|
|
342
|
-
--package-json string Path to package.json (default: ./package.json)
|
|
416
|
+
--package-json string Path to package.json (default: ./package.json)
|
|
343
417
|
--print-deps-count Show the number of dependencies for each entry point
|
|
344
418
|
--result-exclude strings Exclude files matching these glob patterns from results
|
|
345
419
|
--result-include strings Only include files matching these glob patterns in results
|
|
346
|
-
--tsconfig-json string Path to tsconfig.json (default: ./tsconfig.json)
|
|
420
|
+
--tsconfig-json string Path to tsconfig.json (default: ./tsconfig.json)
|
|
347
421
|
```
|
|
348
422
|
|
|
349
423
|
|
|
@@ -374,8 +448,8 @@ rev-dep files --entry-point src/index.ts
|
|
|
374
448
|
-p, --entry-point string Entry point file to analyze (required)
|
|
375
449
|
-h, --help help for files
|
|
376
450
|
-t, --ignore-type-imports Exclude type imports from the analysis
|
|
377
|
-
--package-json string Path to package.json (default: ./package.json)
|
|
378
|
-
--tsconfig-json string Path to tsconfig.json (default: ./tsconfig.json)
|
|
451
|
+
--package-json string Path to package.json (default: ./package.json)
|
|
452
|
+
--tsconfig-json string Path to tsconfig.json (default: ./tsconfig.json)
|
|
379
453
|
```
|
|
380
454
|
|
|
381
455
|
|
|
@@ -575,9 +649,9 @@ rev-dep node-modules missing --entry-points=src/main.ts
|
|
|
575
649
|
-h, --help help for missing
|
|
576
650
|
-t, --ignore-type-imports Exclude type imports from the analysis
|
|
577
651
|
-i, --include-modules strings list of modules to include in the output
|
|
578
|
-
--package-json string Path to package.json (default: ./package.json)
|
|
652
|
+
--package-json string Path to package.json (default: ./package.json)
|
|
579
653
|
--pkg-fields-with-binaries strings Additional package.json fields to check for binary usages
|
|
580
|
-
--tsconfig-json string Path to tsconfig.json (default: ./tsconfig.json)
|
|
654
|
+
--tsconfig-json string Path to tsconfig.json (default: ./tsconfig.json)
|
|
581
655
|
--zero-exit-code Use this flag to always return zero exit code
|
|
582
656
|
```
|
|
583
657
|
|
|
@@ -613,9 +687,9 @@ rev-dep node-modules unused --exclude-modules=@types/*
|
|
|
613
687
|
-h, --help help for unused
|
|
614
688
|
-t, --ignore-type-imports Exclude type imports from the analysis
|
|
615
689
|
-i, --include-modules strings list of modules to include in the output
|
|
616
|
-
--package-json string Path to package.json (default: ./package.json)
|
|
690
|
+
--package-json string Path to package.json (default: ./package.json)
|
|
617
691
|
--pkg-fields-with-binaries strings Additional package.json fields to check for binary usages
|
|
618
|
-
--tsconfig-json string Path to tsconfig.json (default: ./tsconfig.json)
|
|
692
|
+
--tsconfig-json string Path to tsconfig.json (default: ./tsconfig.json)
|
|
619
693
|
--zero-exit-code Use this flag to always return zero exit code
|
|
620
694
|
```
|
|
621
695
|
|
|
@@ -653,9 +727,9 @@ rev-dep node-modules used -p src/index.ts --group-by-module
|
|
|
653
727
|
-h, --help help for used
|
|
654
728
|
-t, --ignore-type-imports Exclude type imports from the analysis
|
|
655
729
|
-i, --include-modules strings list of modules to include in the output
|
|
656
|
-
--package-json string Path to package.json (default: ./package.json)
|
|
730
|
+
--package-json string Path to package.json (default: ./package.json)
|
|
657
731
|
--pkg-fields-with-binaries strings Additional package.json fields to check for binary usages
|
|
658
|
-
--tsconfig-json string Path to tsconfig.json (default: ./tsconfig.json)
|
|
732
|
+
--tsconfig-json string Path to tsconfig.json (default: ./tsconfig.json)
|
|
659
733
|
```
|
|
660
734
|
|
|
661
735
|
|
|
@@ -689,14 +763,93 @@ rev-dep resolve -p src/index.ts -f src/utils/helpers.ts
|
|
|
689
763
|
--graph-exclude strings Glob patterns to exclude files from dependency analysis
|
|
690
764
|
-h, --help help for resolve
|
|
691
765
|
-t, --ignore-type-imports Exclude type imports from the analysis
|
|
692
|
-
--package-json string Path to package.json (default: ./package.json)
|
|
693
|
-
--tsconfig-json string Path to tsconfig.json (default: ./tsconfig.json)
|
|
766
|
+
--package-json string Path to package.json (default: ./package.json)
|
|
767
|
+
--tsconfig-json string Path to tsconfig.json (default: ./tsconfig.json)
|
|
694
768
|
```
|
|
695
769
|
|
|
696
770
|
|
|
697
771
|
|
|
698
772
|
<!-- cli-docs-end -->
|
|
699
773
|
|
|
774
|
+
## Circular check performance comparison
|
|
775
|
+
|
|
776
|
+
Benchmark performed on TypeScript codebase with `6034` source code files and `518862` lines of code.
|
|
777
|
+
|
|
778
|
+
Benchmark performed on MacBook Pro with Apple M1 chip, 16GB of RAM and 256GB of Storage. Power save mode off.
|
|
779
|
+
|
|
780
|
+
Benchmark performed with `hyperfine` using 8 runs per test and 4 warm up runs, taking mean time values as a result. If single run was taking more than 10s, only 1 run was performed.
|
|
781
|
+
|
|
782
|
+
`rev-dep` circular check is **12 times** faster than the fastest alternative❗
|
|
783
|
+
|
|
784
|
+
| Tool | Version | Command to Run Circular Check | Time |
|
|
785
|
+
|------|---------|-------------------------------|------|
|
|
786
|
+
| 🥇 [rev-dep](https://github.com/jayu/rev-dep) | 2.0.0 | `rev-dep circular` | 397 ms |
|
|
787
|
+
| 🥈 [dpdm-fast](https://github.com/SunSince90/dpdm-fast) | 1.0.14 | `dpdm --no-tree --no-progress --no-warning` + list of directories with source code | 4960 ms |
|
|
788
|
+
| 🥉 [dpdm](https://github.com/acrazing/dpdm) | 3.14.0 | `dpdm --no-warning` + list of directories with source code | 5030 ms |
|
|
789
|
+
| [skott](https://github.com/antoine-coulon/skott) | 0.35.6 | node skoscript using `findCircularDependencies` function | 29575 ms |
|
|
790
|
+
| [madge](https://github.com/pahen/madge) | 8.0.0 | `madge --circular --extensions js,ts,jsx,tsx .` | 69328 ms |
|
|
791
|
+
| [circular-dependency-scanner](https://github.com/emosheeep/circular-dependency-scanner) | 2.3.0 | `ds` - out of memory error | n/a |
|
|
792
|
+
|
|
793
|
+
## Glossary
|
|
794
|
+
|
|
795
|
+
Some of the terms used in the problem space that **rev-dep** covers can be confusing.
|
|
796
|
+
Here is a small glossary to help you navigate the concepts.
|
|
797
|
+
|
|
798
|
+
### Dependency
|
|
799
|
+
|
|
800
|
+
A *dependency* can be understood literally. In the context of a project’s dependency graph, it may refer to:
|
|
801
|
+
|
|
802
|
+
* a **node module / package** (a package is a dependency of a project or file), or
|
|
803
|
+
* a **source code file** (a file is a dependency of another file if it imports it).
|
|
804
|
+
|
|
805
|
+
### Entry point
|
|
806
|
+
|
|
807
|
+
An *entry point* is a source file that is **not imported by any other file**.
|
|
808
|
+
It can represent:
|
|
809
|
+
|
|
810
|
+
* the main entry of the application
|
|
811
|
+
* an individual page or feature
|
|
812
|
+
* configuration or test bootstrap files
|
|
813
|
+
|
|
814
|
+
— depending on the project structure.
|
|
815
|
+
|
|
816
|
+
### Unused / Dead file
|
|
817
|
+
|
|
818
|
+
A file is considered *unused* or *dead* when:
|
|
819
|
+
|
|
820
|
+
* it is an **entry point** (nothing imports it), **and**
|
|
821
|
+
* running it does **not produce any meaningful output** or side effect.
|
|
822
|
+
|
|
823
|
+
In practice, such files can often be removed safely.
|
|
824
|
+
|
|
825
|
+
### Circular dependency
|
|
826
|
+
|
|
827
|
+
A *circular dependency* occurs when a file **directly or indirectly imports itself** through a chain of imports.
|
|
828
|
+
|
|
829
|
+
This can lead to unpredictable runtime behavior, uninitialized values, or subtle bugs.
|
|
830
|
+
However, circular dependencies between **TypeScript type-only imports** are usually harmless.
|
|
831
|
+
|
|
832
|
+
### Reverse dependency (or "dependents")
|
|
833
|
+
|
|
834
|
+
Files that *import* a given file.
|
|
835
|
+
Useful for answering: "What breaks if I change or delete this file?"
|
|
836
|
+
|
|
837
|
+
### Import graph / Dependency graph
|
|
838
|
+
|
|
839
|
+
A visual representation of how files or modules import each other.
|
|
840
|
+
|
|
841
|
+
### Missing dependency / unused node module
|
|
842
|
+
|
|
843
|
+
A module that your code imports but is **not listed in package.json**.
|
|
844
|
+
|
|
845
|
+
### Unused dependency / unused node module
|
|
846
|
+
|
|
847
|
+
A dependency listed in **package.json** that is **never imported** in the source code.
|
|
848
|
+
|
|
849
|
+
### Root directory / Project root
|
|
850
|
+
|
|
851
|
+
The top-level directory used as the starting point for dependency analysis.
|
|
852
|
+
|
|
700
853
|
## Made in 🇵🇱 and 🇯🇵 with 🧠 by [@jayu](https://github.com/jayu)
|
|
701
854
|
|
|
702
855
|
I hope that this small piece of software will help you discover and understood complexity of your project hence make you more confident while refactoring. If this tool was useful, don't hesitate to give it a ⭐!
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rev-dep",
|
|
3
|
-
"version": "2.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "2.1.0",
|
|
4
|
+
"description": "Trace imports, detect unused code, clean dependencies — all with a super-fast CLI",
|
|
5
5
|
"bin": "bin.js",
|
|
6
6
|
"files": [
|
|
7
7
|
"bin.js"
|
|
@@ -17,28 +17,30 @@
|
|
|
17
17
|
"node": ">=18"
|
|
18
18
|
},
|
|
19
19
|
"optionalDependencies": {
|
|
20
|
-
"@rev-dep/darwin-arm64": "2.
|
|
21
|
-
"@rev-dep/linux-x64": "2.
|
|
20
|
+
"@rev-dep/darwin-arm64": "2.1.0",
|
|
21
|
+
"@rev-dep/linux-x64": "2.1.0"
|
|
22
22
|
},
|
|
23
23
|
"keywords": [
|
|
24
|
-
"
|
|
25
|
-
"
|
|
26
|
-
"dependency
|
|
27
|
-
"
|
|
28
|
-
"
|
|
29
|
-
"
|
|
30
|
-
"
|
|
31
|
-
"
|
|
32
|
-
"
|
|
33
|
-
"
|
|
34
|
-
"
|
|
35
|
-
"
|
|
36
|
-
"dependency
|
|
37
|
-
"
|
|
38
|
-
"
|
|
39
|
-
"
|
|
40
|
-
"
|
|
41
|
-
"
|
|
42
|
-
"
|
|
24
|
+
"dependency-analysis",
|
|
25
|
+
"reverse-dependencies",
|
|
26
|
+
"dependency-resolution",
|
|
27
|
+
"file-dependencies",
|
|
28
|
+
"unused-files",
|
|
29
|
+
"dead-files",
|
|
30
|
+
"unused-dependencies",
|
|
31
|
+
"missing-dependencies",
|
|
32
|
+
"used-dependencies",
|
|
33
|
+
"module-analysis",
|
|
34
|
+
"import-analysis",
|
|
35
|
+
"entry-point-analysis",
|
|
36
|
+
"dependency-path",
|
|
37
|
+
"circular-dependency-detection",
|
|
38
|
+
"node-modules-analysis",
|
|
39
|
+
"module-size-analysis",
|
|
40
|
+
"lines-of-code",
|
|
41
|
+
"project-audit",
|
|
42
|
+
"typescript-analysis",
|
|
43
|
+
"javascript-analysis",
|
|
44
|
+
"monorepo-analysis"
|
|
43
45
|
]
|
|
44
46
|
}
|