rev-dep 2.1.0 → 2.2.1
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 +38 -65
- package/bin.js +5 -3
- package/package.json +4 -3
package/Readme.md
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
<p align="center">
|
|
2
|
-
<img src="https://github.com/jayu/rev-dep/raw/master/logo.png" width="400">
|
|
2
|
+
<img src="https://github.com/jayu/rev-dep/raw/master/logo.png" width="400" alt="Rev-dep logo">
|
|
3
3
|
</p>
|
|
4
4
|
|
|
5
5
|
<p align="center">
|
|
6
6
|
<a href="#key-features-">Key Features</a> •
|
|
7
7
|
<a href="#installation-">Installation</a> •
|
|
8
|
-
<a href="#quick-examples-">Quick Examples</a> •
|
|
9
8
|
<a href="#practical-examples-">Practical Examples</a> •
|
|
10
9
|
<a href="#cli-reference-">CLI Reference</a>
|
|
11
10
|
</p>
|
|
@@ -18,11 +17,9 @@
|
|
|
18
17
|
|
|
19
18
|
---
|
|
20
19
|
|
|
21
|
-
<img alt="rev-dep version" src="https://img.shields.io/npm/v/rev-dep">
|
|
22
|
-
|
|
23
|
-
<img alt="rev-dep PRs welcome" src="https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square">
|
|
20
|
+
<img alt="rev-dep version" src="https://img.shields.io/npm/v/rev-dep"> <img alt="rev-dep license" src="https://img.shields.io/npm/l/rev-dep"> <img alt="rev-dep PRs welcome" src="https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square">
|
|
21
|
+
|
|
24
22
|
|
|
25
|
-
---
|
|
26
23
|
|
|
27
24
|
# **About 📣**
|
|
28
25
|
|
|
@@ -35,15 +32,14 @@ Working in large JS/TS projects makes it difficult to answer simple but crucial
|
|
|
35
32
|
* Which packages in node_modules are unused?
|
|
36
33
|
* Which modules take the most disk space?
|
|
37
34
|
|
|
38
|
-
|
|
35
|
+
Rev-dep helps you understand the real structure of your codebase so you can debug issues faster, refactor safely, and keep your dependencies clean.
|
|
39
36
|
|
|
40
37
|
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
|
|
41
38
|
|
|
42
|
-
---
|
|
43
39
|
|
|
44
|
-
## **Why
|
|
40
|
+
## **Why Rev-dep? 🤔**
|
|
45
41
|
|
|
46
|
-
|
|
42
|
+
Rev-dep is designed for **fast iteration** and **minimal, actionable results** — no noise, just answers.
|
|
47
43
|
|
|
48
44
|
### ✅ **Results in milliseconds**
|
|
49
45
|
|
|
@@ -61,35 +57,27 @@ Works with mixed JS/TS projects, path aliases and thousands of files without con
|
|
|
61
57
|
|
|
62
58
|
Unused files, unused or missing dependencies, reverse-imports, entry point detection, node_modules insights, dependency paths — everything in one tool.
|
|
63
59
|
|
|
64
|
-
<!--
|
|
65
|
-
### ✔ **Much faster than alternatives**
|
|
66
60
|
|
|
67
|
-
|
|
61
|
+
### ✅ **Much faster than alternatives**
|
|
68
62
|
|
|
69
|
-
|
|
70
|
-
|
|
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 | |
|
|
85
|
-
|
|
86
|
-
>Benchmark run on WSL Linux Debian Intel(R) Core(TM) i9-14900KF CPU @ 2.80GHz
|
|
63
|
+
Rev-dep outperforms Madge, dpdm, dependency-cruiser, skott, knip, depcheck and other similar tools.
|
|
87
64
|
|
|
88
|
-
|
|
65
|
+
For large project with 500k+ lines of code and 6k+ source code files get checks as fast as:
|
|
89
66
|
|
|
90
|
-
|
|
67
|
+
| Task | Execution Time [ms] | Alternative | Alternative Time [ms] | Slower Than Rev-dep |
|
|
68
|
+
|------|-------|--------------|------|----|
|
|
69
|
+
| Find circular dependencies | 289 | dpdm-fast | 7061| 24x|
|
|
70
|
+
| Find unused files | 588 | knip | 6346 | 11x |
|
|
71
|
+
| Find unused node modules | 594 | knip | 6230 | 10x |
|
|
72
|
+
| Find missing node modules | 553 | knip| 6226 | 11x |
|
|
73
|
+
| List all files imported by an entry point | 229 | madge | 4467 | 20x |
|
|
74
|
+
| Discover entry points | 323 | madge | 67000 | 207x
|
|
75
|
+
| Resolve dependency path between files | 228 | please suggest |
|
|
76
|
+
| Count lines of code | 342 | please suggest |
|
|
77
|
+
| Check node_modules disk usage | 1619 | please suggest |
|
|
78
|
+
| Analyze node_modules directory sizes | 521 | please suggest |
|
|
91
79
|
|
|
92
|
-
|
|
80
|
+
>Benchmark run on WSL Linux Debian Intel(R) Core(TM) i9-14900KF CPU @ 2.80GHz
|
|
93
81
|
|
|
94
82
|
# **Key Features 🚀**
|
|
95
83
|
|
|
@@ -100,13 +88,11 @@ If your project feels like a dependency maze, rev-dep gives you a map.
|
|
|
100
88
|
* 🔄 **Circular imports/dependencies detection**
|
|
101
89
|
* 🧭 **Trace all import paths between files**
|
|
102
90
|
* 📁 **List all files imported by any entry point**
|
|
103
|
-
* 📏 **Count actual lines of code (excluding comments
|
|
91
|
+
* 📏 **Count actual lines of code (excluding comments and blanks)**
|
|
104
92
|
* 💽 **Node modules disk usage & size analysis**
|
|
105
93
|
* 💡 **Works with both JavaScript and TypeScript**
|
|
106
94
|
* ⚡ **Built for large codebases**
|
|
107
95
|
|
|
108
|
-
---
|
|
109
|
-
|
|
110
96
|
# **Installation 📦**
|
|
111
97
|
|
|
112
98
|
Install globally to use as a CLI tool:
|
|
@@ -123,34 +109,37 @@ npm install -g rev-dep
|
|
|
123
109
|
pnpm global add rev-dep
|
|
124
110
|
```
|
|
125
111
|
|
|
126
|
-
---
|
|
127
112
|
|
|
128
113
|
# **Quick Examples ⚡**
|
|
129
114
|
|
|
130
115
|
A few instant-use examples to get a feel for the tool:
|
|
131
116
|
|
|
132
117
|
```bash
|
|
133
|
-
#
|
|
134
|
-
rev-dep
|
|
118
|
+
# Detect unused node modules
|
|
119
|
+
rev-dep node-modules unused
|
|
120
|
+
|
|
121
|
+
# Detect circular imports/dependencies
|
|
122
|
+
rev-dep circular
|
|
135
123
|
|
|
136
124
|
# List all entry points in the project
|
|
137
125
|
rev-dep entry-points
|
|
138
126
|
|
|
139
|
-
# Detect unused node modules
|
|
140
|
-
rev-dep node-modules unused
|
|
141
|
-
|
|
142
127
|
# Check which files an entry point imports
|
|
143
128
|
rev-dep files --entry-point src/index.ts
|
|
144
129
|
|
|
145
|
-
#
|
|
146
|
-
rev-dep
|
|
147
|
-
```
|
|
130
|
+
# Find every entry point that depends on a file
|
|
131
|
+
rev-dep resolve --file src/utils/math.ts
|
|
148
132
|
|
|
149
|
-
|
|
133
|
+
# Resolve dependency path between files
|
|
134
|
+
rev-dep resolve --file src/utils/math.ts --entry-point src/index.ts
|
|
135
|
+
|
|
136
|
+
```
|
|
150
137
|
|
|
151
138
|
# **Practical Examples 🔧**
|
|
152
139
|
|
|
153
140
|
|
|
141
|
+
Practical examples show how to use rev-dep commands to build code quality checks for your project.
|
|
142
|
+
|
|
154
143
|
### **How to identify where a file is used in the project**
|
|
155
144
|
|
|
156
145
|
```
|
|
@@ -159,8 +148,6 @@ rev-dep resolve --file path/to/file.ts
|
|
|
159
148
|
|
|
160
149
|
You’ll see all entry points that implicitly require that file, along with resolution paths.
|
|
161
150
|
|
|
162
|
-
---
|
|
163
|
-
|
|
164
151
|
### **How to check if a file is used**
|
|
165
152
|
|
|
166
153
|
```
|
|
@@ -169,8 +156,6 @@ rev-dep resolve --file path/to/file.ts --compact-summary
|
|
|
169
156
|
|
|
170
157
|
Shows how many entry points indirectly depend on the file.
|
|
171
158
|
|
|
172
|
-
---
|
|
173
|
-
|
|
174
159
|
### **How to identify dead files**
|
|
175
160
|
|
|
176
161
|
```
|
|
@@ -179,8 +164,6 @@ rev-dep entry-points
|
|
|
179
164
|
|
|
180
165
|
Exclude framework entry points if needed using `--result-exclude`.
|
|
181
166
|
|
|
182
|
-
---
|
|
183
|
-
|
|
184
167
|
### **How to list all files imported by an entry point**
|
|
185
168
|
|
|
186
169
|
```
|
|
@@ -189,8 +172,6 @@ rev-dep files --entry-point path/to/file.ts
|
|
|
189
172
|
|
|
190
173
|
Useful for identifying heavy components or unintended dependencies.
|
|
191
174
|
|
|
192
|
-
---
|
|
193
|
-
|
|
194
175
|
### **How to reduce unnecessary imports for an entry point**
|
|
195
176
|
|
|
196
177
|
1. List all files imported:
|
|
@@ -205,32 +186,24 @@ Useful for identifying heavy components or unintended dependencies.
|
|
|
205
186
|
rev-dep resolve --file path/to/suspect --entry-points path/to/entry.ts --all
|
|
206
187
|
```
|
|
207
188
|
|
|
208
|
-
---
|
|
209
|
-
|
|
210
189
|
### **How to detect circular dependencies**
|
|
211
190
|
|
|
212
191
|
```
|
|
213
192
|
rev-dep circular
|
|
214
193
|
```
|
|
215
194
|
|
|
216
|
-
---
|
|
217
|
-
|
|
218
195
|
### **How to find unused node modules**
|
|
219
196
|
|
|
220
197
|
```
|
|
221
198
|
rev-dep node-modules unused
|
|
222
199
|
```
|
|
223
200
|
|
|
224
|
-
---
|
|
225
|
-
|
|
226
201
|
### **How to find missing node modules**
|
|
227
202
|
|
|
228
203
|
```
|
|
229
204
|
rev-dep node-modules missing
|
|
230
205
|
```
|
|
231
206
|
|
|
232
|
-
---
|
|
233
|
-
|
|
234
207
|
### **How to check node_modules space usage**
|
|
235
208
|
|
|
236
209
|
```
|
|
@@ -347,9 +320,9 @@ Any other discrepancies between TypeScript module resolution and rev-dep should
|
|
|
347
320
|
|
|
348
321
|
- Linux x64
|
|
349
322
|
- MacOS Apple Silicon
|
|
323
|
+
- Windows x64
|
|
350
324
|
|
|
351
|
-
|
|
352
|
-
Go allows for cross-compiling, so I'm happy to build and distribute binaries for other platforms as well, but I haven't tested it.
|
|
325
|
+
Go allows for cross-compiling, so I'm happy to build and distribute binaries for other platforms as well.
|
|
353
326
|
Feel free to open an issue if you need support for another platform.
|
|
354
327
|
|
|
355
328
|
## CLI reference 📖
|
package/bin.js
CHANGED
|
@@ -11,6 +11,7 @@ const nestedNodeModulesPath = path.join(__dirname, 'node_modules', binaryPackage
|
|
|
11
11
|
const siblingNodeModulesPath = path.join(__dirname, '../', binaryPackageName)
|
|
12
12
|
|
|
13
13
|
const checkedPaths = []
|
|
14
|
+
const fsRoot = path.parse(__dirname).root
|
|
14
15
|
|
|
15
16
|
if (fs.existsSync(nestedNodeModulesPath)) {
|
|
16
17
|
packageDir = nestedNodeModulesPath
|
|
@@ -27,7 +28,7 @@ else if (fs.existsSync(siblingNodeModulesPath)) {
|
|
|
27
28
|
}
|
|
28
29
|
else {
|
|
29
30
|
checkedPaths.push(pathToCheck)
|
|
30
|
-
if (lookupDir ===
|
|
31
|
+
if (lookupDir === fsRoot) {
|
|
31
32
|
lookupDir = undefined
|
|
32
33
|
}
|
|
33
34
|
else {
|
|
@@ -41,10 +42,11 @@ if (packageDir === '') {
|
|
|
41
42
|
console.error("Could not locate rev-dep binary for your platform: ", binaryPackageName)
|
|
42
43
|
console.log('Checked paths', checkedPaths)
|
|
43
44
|
console.log('Please open an issue to request platform support')
|
|
45
|
+
console.log('https://github.com/jayu/rev-dep/issues')
|
|
44
46
|
process.exit(1)
|
|
45
47
|
}
|
|
46
|
-
|
|
47
|
-
const binary = path.join(packageDir, 'bin', 'rev-dep')
|
|
48
|
+
const isWin = process.platform === "win32"
|
|
49
|
+
const binary = path.join(packageDir, 'bin', 'rev-dep' + (isWin ? '.exe' : ''))
|
|
48
50
|
|
|
49
51
|
if (!fs.existsSync(binary)) {
|
|
50
52
|
console.error("Could not locate binary in package directory.")
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rev-dep",
|
|
3
|
-
"version": "2.1
|
|
3
|
+
"version": "2.2.1",
|
|
4
4
|
"description": "Trace imports, detect unused code, clean dependencies — all with a super-fast CLI",
|
|
5
5
|
"bin": "bin.js",
|
|
6
6
|
"files": [
|
|
@@ -17,8 +17,9 @@
|
|
|
17
17
|
"node": ">=18"
|
|
18
18
|
},
|
|
19
19
|
"optionalDependencies": {
|
|
20
|
-
"@rev-dep/darwin-arm64": "2.1
|
|
21
|
-
"@rev-dep/linux-x64": "2.1
|
|
20
|
+
"@rev-dep/darwin-arm64": "2.2.1",
|
|
21
|
+
"@rev-dep/linux-x64": "2.2.1",
|
|
22
|
+
"@rev-dep/win32-x64": "2.2.1"
|
|
22
23
|
},
|
|
23
24
|
"keywords": [
|
|
24
25
|
"dependency-analysis",
|