pichillilorenzo / Deps Report
Licence: mit
Generate reports about dependencies and dependents of your JavaScript/TypeScript files through an AST. It supports import and require statements.
Stars: ✭ 76
Programming Languages
javascript
184084 projects - #8 most used programming language
typescript
32286 projects
flow
126 projects
Projects that are alternatives of or similar to Deps Report
codeparser
Parse Wolfram Language source code as abstract syntax trees (ASTs) or concrete syntax trees (CSTs)
Stars: ✭ 84 (+10.53%)
Mutual labels: ast, abstract-syntax-tree
coAST
Universal and language-independent abstract syntax tree
Stars: ✭ 30 (-60.53%)
Mutual labels: ast, abstract-syntax-tree
abstract-syntax-tree
A library for working with abstract syntax trees.
Stars: ✭ 77 (+1.32%)
Mutual labels: ast, abstract-syntax-tree
Vermin
Concurrently detect the minimum Python versions needed to run code
Stars: ✭ 218 (+186.84%)
Mutual labels: ast, abstract-syntax-tree
Javaparser
Java 1-15 Parser and Abstract Syntax Tree for Java, including preview features to Java 13
Stars: ✭ 3,972 (+5126.32%)
Mutual labels: ast, abstract-syntax-tree
awesome-ruby-ast
A list of awesome tools and libraries which deals with ASTs in Ruby
Stars: ✭ 24 (-68.42%)
Mutual labels: ast, abstract-syntax-tree
vscode-blockman
VSCode extension to highlight nested code blocks
Stars: ✭ 233 (+206.58%)
Mutual labels: ast, abstract-syntax-tree
Rewrite
Semantic code search and transformation
Stars: ✭ 134 (+76.32%)
Mutual labels: ast, abstract-syntax-tree
ast-builder
Build your ASTs directly from code
Stars: ✭ 18 (-76.32%)
Mutual labels: ast, abstract-syntax-tree
tsquery-playground
Playground for TSQuery
Stars: ✭ 30 (-60.53%)
Mutual labels: ast, abstract-syntax-tree
Bellybutton
Custom Python linting through AST expressions
Stars: ✭ 196 (+157.89%)
Mutual labels: ast, abstract-syntax-tree
Patch Package
Fix broken node modules instantly 🏃🏽♀️💨
Stars: ✭ 6,062 (+7876.32%)
Mutual labels: javascript-tools, dependency-manager
React Ast
render abstract syntax trees with react
Stars: ✭ 160 (+110.53%)
Mutual labels: ast, abstract-syntax-tree
open-fortran-parser-xml
XML output generator for Open Fortran Parser, and Python wrapper for it.
Stars: ✭ 21 (-72.37%)
Mutual labels: ast, abstract-syntax-tree
Js Sql Parser
SQL(select) parser written with jison. parse SQL into abstract syntax tree(AST) and stringify back to SQL. sql grammar follows https://dev.mysql.com/doc/refman/5.7/en/select.html
Stars: ✭ 141 (+85.53%)
Mutual labels: ast, abstract-syntax-tree
CastXMLSuperbuild
Build CastXML and its dependencies (LLVM/Clang)
Stars: ✭ 32 (-57.89%)
Mutual labels: ast, abstract-syntax-tree
Cgen
C/C++ source generation from an AST
Stars: ✭ 107 (+40.79%)
Mutual labels: ast, abstract-syntax-tree
verilogAST-cpp
C++17 implementation of an AST for Verilog code generation
Stars: ✭ 14 (-81.58%)
Mutual labels: ast, abstract-syntax-tree
I18nize React
Internationalize react apps within a lunch break
Stars: ✭ 389 (+411.84%)
Mutual labels: ast, abstract-syntax-tree
Spoon
Spoon is a metaprogramming library to analyze and transform Java source code (up to Java 15). 🥄 is made with ❤️, 🍻 and ✨. It parses source files to build a well-designed AST with powerful analysis and transformation API.
Stars: ✭ 1,078 (+1318.42%)
Mutual labels: ast, abstract-syntax-tree
deps-report
Generate reports about dependencies and dependents of your JavaScript/TypeScript files through an AST. It supports import
and require
statements.
Parsers used:
-
flow-parser for
.js
files -
typescript for
.ts
files
Install
npm install -g deps-report
Screenshots
CLI Usage
Usage: deps-report [options] [command]
Options:
-V, --version output the version number
-j, --json Output results in JSON format
-p, --pretty Pretty-print JSON output (implies --json)
-a, --abs-path Print absolute path of dependencies/dependents
-e, --exclude-node-modules Don't consider node_modules dependencies
-w, --webpack-config [webpackConfigFile] Webpack config file for resolving aliased modules
-s, --specifiers Show specifiers imported by the dependency/dependent
--no-color Display terminal output without colors
-h, --help output usage information
Commands:
find-dependencies [options] <glob> [otherGlobs...]
Usage: find-dependencies [options] <glob> [otherGlobs...]
Options:
-c, --circular Show if there are some circular dependencies
--only-not-found Show all modules that have no dependencies
--hide-not-found Hide all modules that have no dependencies
--only-circular Show only circular dependencies
-h, --help output usage information
find-dependents [options] <glob> [otherGlobs...]
Usage: find-dependents [options] <glob> [otherGlobs...]
Options:
-r, --root [root] Root folder from where to start the search. Default is the dirname of each glob entry
-c, --circular Show if there are some circular dependencies
--only-not-found Show all modules that no one is depending on
--hide-not-found Hide all modules that no one is depending on
--only-circular Show only circular dependencies
-h, --help output usage information
Examples find-dependencies
$ deps-report find-dependencies tests/project-react-js-test/src/App.js
Processed 1 file in 122.297ms.
tests/project-react-js-test/src/App.js, found 3 dependencies:
1) react
2) ./logo.svg
3) ./App.css
$ deps-report -s find-dependencies tests/project-react-js-test/src/App.js
Processed 1 file in 127.538ms.
tests/project-react-js-test/src/App.js, found 3 dependencies:
1) react, specifiers imported: default as React, Component
2) ./logo.svg, specifiers imported: default as logo
3) ./App.css
$ deps-report -a find-dependencies 'tests/project-react-js-test/src/*.js'
Processed 4 files in 149.446ms.
tests/project-react-js-test/src/App.js, found 3 dependencies:
1) react
2) /Users/lorenzo/Desktop/deps-report/tests/project-react-js-test/src/logo.svg
3) /Users/lorenzo/Desktop/deps-report/tests/project-react-js-test/src/App.css
tests/project-react-js-test/src/App.test.js, found 3 dependencies:
1) react
2) react-dom
3) /Users/lorenzo/Desktop/deps-report/tests/project-react-js-test/src/App.js
tests/project-react-js-test/src/index.js, found 5 dependencies:
1) react
2) react-dom
3) /Users/lorenzo/Desktop/deps-report/tests/project-react-js-test/src/index.css
4) /Users/lorenzo/Desktop/deps-report/tests/project-react-js-test/src/App.js
5) /Users/lorenzo/Desktop/deps-report/tests/project-react-js-test/src/registerServiceWorker.js
tests/project-react-js-test/src/registerServiceWorker.js, found 0 dependencies:
No dependencies found!
$ deps-report -ae find-dependencies 'tests/project-react-js-test/src/*.js'
Processed 4 files in 139.507ms.
tests/project-react-js-test/src/App.js, found 2 dependencies:
1) /Users/lorenzo/Desktop/deps-report/tests/project-react-js-test/src/logo.svg
2) /Users/lorenzo/Desktop/deps-report/tests/project-react-js-test/src/App.css
tests/project-react-js-test/src/App.test.js, found 1 dependency:
1) /Users/lorenzo/Desktop/deps-report/tests/project-react-js-test/src/App.js
tests/project-react-js-test/src/index.js, found 3 dependencies:
1) /Users/lorenzo/Desktop/deps-report/tests/project-react-js-test/src/index.css
2) /Users/lorenzo/Desktop/deps-report/tests/project-react-js-test/src/App.js
3) /Users/lorenzo/Desktop/deps-report/tests/project-react-js-test/src/registerServiceWorker.js
tests/project-react-js-test/src/registerServiceWorker.js, found 0 dependencies:
No dependencies found!
$ deps-report -ae find-dependencies 'tests/project-react-js-test/src/*.js' '!tests/project-react-js-test/src/**/*.test.js'
Processed 3 files in 141.737ms.
tests/project-react-js-test/src/App.js, found 2 dependencies:
1) /Users/lorenzo/Desktop/deps-report/tests/project-react-js-test/src/logo.svg
2) /Users/lorenzo/Desktop/deps-report/tests/project-react-js-test/src/App.css
tests/project-react-js-test/src/index.js, found 3 dependencies:
1) /Users/lorenzo/Desktop/deps-report/tests/project-react-js-test/src/index.css
2) /Users/lorenzo/Desktop/deps-report/tests/project-react-js-test/src/App.js
3) /Users/lorenzo/Desktop/deps-report/tests/project-react-js-test/src/registerServiceWorker.js
tests/project-react-js-test/src/registerServiceWorker.js, found 0 dependencies:
No dependencies found!
$ deps-report -w tests/project-test/webpack.config.js find-dependencies tests/project-test/a.js
Processed 1 file in 109.559ms.
tests/project-test/a.js, found 12 dependencies:
1) path
2) fs
3) ./c/d.js
4) Utilities/index.js
5) UtilitiesRelativePath
6) Utilities/utilityA.js
7) Templates/main.js
8) TemplatesMain
9) MyPath
10) fs
11) ./e/b.js
12) ./c/d.js
$ deps-report -w tests/project-test/webpack.config.js find-dependencies --only-circular tests/project-test/a.js
Processed 1 file in 153.199ms.
tests/project-test/a.js, found 2 dependencies:
1) ./c/d.js
2) ./c/d.js
$ deps-report -ae -w tests/project-test/webpack.config.js find-dependencies tests/project-test/a.js
Processed 1 file in 118.478ms.
tests/project-test/a.js, found 8 dependencies:
1) /Users/lorenzo/Desktop/deps-report/tests/project-test/c/d.js
2) /Users/lorenzo/Desktop/deps-report/tests/project-test/src/utilities/index.js
3) /Users/lorenzo/Desktop/deps-report/tests/project-test/src/utilities/relative.js
4) /Users/lorenzo/Desktop/deps-report/tests/project-test/src/utilities/utilityA.js
5) /Users/lorenzo/Desktop/deps-report/tests/project-test/src/templates/main.js
6) /Users/lorenzo/Desktop/deps-report/tests/project-test/src/templates/main.js
7) /Users/lorenzo/Desktop/deps-report/tests/project-test/e/b.js
8) /Users/lorenzo/Desktop/deps-report/tests/project-test/c/d.js
$ deps-report -w tests/project-test/webpack.config.js find-dependencies --only-not-found "tests/project-test/*.ts"
Processed 1 file in 42.623ms.
tests/project-test/c.ts
JSON format example:
$ deps-report -jps find-dependencies -c tests/project-react-js-test/src/App.js
{
"tests/project-react-js-test/src/App.js": {
"absolutePath": "/Users/lorenzo/Desktop/deps-report/tests/project-react-js-test/src/App.js",
"files": 3,
"dependencies": [
{
"importPath": "react",
"importAbsolutePath": "react",
"isCircularDependency": null,
"isNodeModule": true,
"specifiers": [
{
"name": "React",
"alias": "",
"isDefault": true
},
{
"name": "Component",
"alias": "",
"isDefault": false
}
]
},
{
"importPath": "./logo.svg",
"importAbsolutePath": "/Users/lorenzo/Desktop/deps-report/tests/project-react-js-test/src/logo.svg",
"isCircularDependency": false,
"isNodeModule": false,
"specifiers": [
{
"name": "logo",
"alias": "",
"isDefault": true
}
]
},
{
"importPath": "./App.css",
"importAbsolutePath": "/Users/lorenzo/Desktop/deps-report/tests/project-react-js-test/src/App.css",
"isCircularDependency": false,
"isNodeModule": false,
"specifiers": []
}
]
}
}
Examples find-dependents
$ deps-report find-dependents tests/project-react-js-test/src/App.js
Processed 1 file in 199.088ms.
tests/project-react-js-test/src/App.js, found 2 dependents:
1) tests/project-react-js-test/src/App.test.js
2) tests/project-react-js-test/src/index.js
$ deps-report -s find-dependents tests/project-react-js-test/src/App.js
Processed 1 file in 197.761ms.
tests/project-react-js-test/src/App.js, found 2 dependents:
1) tests/project-react-js-test/src/App.test.js, specifiers imported: default as App
2) tests/project-react-js-test/src/index.js, specifiers imported: default as App
$ deps-report -as find-dependents tests/project-react-js-test/src/App.js
Processed 1 file in 199.046ms.
tests/project-react-js-test/src/App.js, found 2 dependents:
1) /Users/lorenzo/Desktop/deps-report/tests/project-react-js-test/src/App.test.js, specifiers imported: default as App
2) /Users/lorenzo/Desktop/deps-report/tests/project-react-js-test/src/index.js, specifiers imported: default as App
$ deps-report find-dependents tests/project-test/a1.ts
Processed 1 file in 191.590ms.
tests/project-test/a1.ts, found 0 dependents:
No dependents found!
$ deps-report find-dependents -c -r tests/project-test tests/project-test/c/d.js
Processed 1 file in 218.268ms.
tests/project-test/c/d.js, found 4 dependents:
1) tests/project-test/a.js, Circular Dependency
2) tests/project-test/e/b.js
3) tests/project-test/a.ts
4) tests/project-test/b.ts
$ deps-report -es -w tests/project-test/webpack.config.js find-dependents -r tests/project-test/ tests/project-test/src/utilities/index.js tests/project-test/src/templates/main.js
Processed 2 files in 852.220ms.
tests/project-test/src/utilities/index.js, found 2 dependents:
1) tests/project-test/a.js, specifiers imported: default as Utilities
2) tests/project-test/a.ts, specifiers imported: default as Utilities
tests/project-test/src/templates/main.js, found 3 dependents:
1) tests/project-test/a.js, specifiers imported: default as templates
2) tests/project-test/src/utilities/index.js, specifiers imported: default as templates
3) tests/project-test/a.ts, specifiers imported: default as templates
You can search also images and css files imported in your javascript files (such as in a React project):
$ deps-report -s find-dependents tests/project-react-js-test/src/logo.svg
Processed 1 file in 218.263ms.
tests/project-react-js-test/src/logo.svg, found 1 dependent:
1) tests/project-react-js-test/src/App.js, specifiers imported: default as logo
$ deps-report find-dependents tests/project-react-js-test/src/App.css
Processed 1 file in 213.301ms.
tests/project-react-js-test/src/App.css, found 1 dependent:
1) tests/project-react-js-test/src/App.js
JSON format example:
$ deps-report -jps find-dependents -c tests/project-react-js-test/src/App.js
{
"tests/project-react-js-test/src/App.js": {
"absolutePath": "/Users/lorenzo/Desktop/deps-report/tests/project-react-js-test/src/App.js",
"files": 2,
"dependents": [
{
"filePath": "tests/project-react-js-test/src/App.test.js",
"fileAbsolutePath": "/Users/lorenzo/Desktop/deps-report/tests/project-react-js-test/src/App.test.js",
"importPath": "./App.js",
"importAbsolutePath": "/Users/lorenzo/Desktop/deps-report/tests/project-react-js-test/src/App.js",
"isCircularDependency": false,
"specifiers": [
{
"name": "App",
"alias": "",
"isDefault": true
}
]
},
{
"filePath": "tests/project-react-js-test/src/index.js",
"fileAbsolutePath": "/Users/lorenzo/Desktop/deps-report/tests/project-react-js-test/src/index.js",
"importPath": "./App.js",
"importAbsolutePath": "/Users/lorenzo/Desktop/deps-report/tests/project-react-js-test/src/App.js",
"isCircularDependency": false,
"specifiers": [
{
"name": "App",
"alias": "",
"isDefault": true
}
]
}
]
}
}
API Usage
const depsReport = require('deps-report')
// find-dependencies command options
let optionsFindDependencies = {
circular: false, // if true, it will try to see if there are some circular dependencies with input files
onlyCircular: false, // if true, it will return only dependecies with circular dependency with input files
onlyNotFound: false, // if true, it will return all modules that have no dependencies
hideNotFound: false, // used only for CLI output
parent: {
excludeNodeModules: false, // if true, it will exclude all node modules
json: false, // used only for CLI output
pretty: false, // used only for CLI output
absPath: false, // used only for CLI output
color: false, // used only for CLI output
webpackConfig: 'tests/project-test/webpack.config.js', // used to resolve module aliases
specifiers: false // if true, it will populate the specifiers imported by the dependency
}
}
// see the corresponding JSON format example
depsReport.findDependencies(["tests/project-test/a.js"], optionsFindDependencies)
// find-dependents command options
let optionsFindDependents = {
root: 'tests/project-test', // Root folder from where to start the search of dependents
circular: false, // if true, it will try to see if there are some circular dependencies with input files
onlyCircular: false, // if true, it will return only dependents with circular dependency with input files
onlyNotFound: false, // if true, it will return all modules that no one is depending on
hideNotFound: false, // used only for CLI output
parent: {
excludeNodeModules: false, // if true, it will exclude all node modules
json: false, // used only for CLI output
pretty: false, // used only for CLI output
absPath: false, // used only for CLI output
color: false, // used only for CLI output
webpackConfig: 'tests/project-test/webpack.config.js', // used to resolve module aliases
specifiers: false // if true, it will populate the specifiers imported by the dependent
}
}
// see the corresponding JSON format example
depsReport.findDependents(["tests/project-test/src/templates/*.js", "tests/project-test/src/utilities/*.js"], optionsFindDependents)
Support
Feature request/enhancement
For feature requests/enhancement, create an issue!
License
MIT License
Note that the project description data, including the texts, logos, images, and/or trademarks,
for each open source project belongs to its rightful owner.
If you wish to add or remove any projects, please contact us at [email protected].