deps-walker
Advanced tools
Comparing version 1.1.0 to 2.0.0
@@ -8,3 +8,3 @@ /** | ||
const util = require('util'); | ||
const mkdirp = util.promisify(require('mkdirp')); | ||
const { mkdirp } = require('mkdirp'); | ||
@@ -29,3 +29,3 @@ const readFile = util.promisify(fs.readFile); | ||
cache.load = async function(filePath) { | ||
cache.load = async function (filePath) { | ||
try { | ||
@@ -39,3 +39,3 @@ const json = await readFile(filePath, 'utf8'); | ||
cache.save = async function(filePath) { | ||
cache.save = async function (filePath) { | ||
await mkdirp(path.dirname(filePath)); | ||
@@ -45,3 +45,3 @@ await writeFile(filePath, JSON.stringify(Array.from(cache.map))); | ||
cache.reset = function() { | ||
cache.reset = function () { | ||
cache.map = new Map(); | ||
@@ -48,0 +48,0 @@ }; |
@@ -48,6 +48,7 @@ /** | ||
visitor(undefined, { filePath, dependencies }); | ||
return await traverse(dependencies, visitor); | ||
const result = await traverse(dependencies, visitor); | ||
return [{ filePath, dependencies }, ...(result?.flat() || [])]; | ||
}); | ||
return await Promise.all(traverseRoots); | ||
return (await Promise.all(traverseRoots))?.flat(); | ||
} | ||
@@ -54,0 +55,0 @@ |
{ | ||
"name": "deps-walker", | ||
"version": "1.1.0", | ||
"version": "2.0.0", | ||
"description": "Walks the module dependency graph. It's highly configurable.", | ||
"main": "lib/index.js", | ||
"files": [ | ||
"lib" | ||
], | ||
"scripts": { | ||
"pretty": "prettier ./lib/**/*.js --list-different", | ||
"lint": "eslint ./" | ||
"lint": "eslint ./", | ||
"test": "jest --coverage" | ||
}, | ||
@@ -17,2 +21,3 @@ "repository": "https://github.com/sergei-startsev/deps-walker", | ||
"static-analysis", | ||
"esm", | ||
"es6", | ||
@@ -22,3 +27,11 @@ "es2015", | ||
], | ||
"author": "sergei-startsev <ai@programist.ru>", | ||
"engines": { | ||
"node": ">=16.0.0", | ||
"yarn": "^1.22" | ||
}, | ||
"cpu": [ | ||
"x64", | ||
"arm64" | ||
], | ||
"author": "sergei-startsev", | ||
"license": "MIT", | ||
@@ -30,15 +43,13 @@ "bugs": { | ||
"dependencies": { | ||
"@babel/parser": "^7.16.3", | ||
"debug": "^4.3.2", | ||
"graceful-fs": "^4.2.8", | ||
"mkdirp": "^1.0.4", | ||
"resolve": "^1.20.0" | ||
"@babel/parser": "^7.21.4", | ||
"debug": "^4.3.4", | ||
"graceful-fs": "^4.2.11", | ||
"mkdirp": "^3.0.0", | ||
"resolve": "^1.22.2" | ||
}, | ||
"devDependencies": { | ||
"eslint": "^5.16.0", | ||
"prettier": "^1.17.0" | ||
}, | ||
"engines": { | ||
"node": ">=8.0.0" | ||
"eslint": "^8.39.0", | ||
"jest": "^29.5.0", | ||
"prettier": "^2.8.8" | ||
} | ||
} |
# deps-walker | ||
[![Build Status](https://travis-ci.org/sergei-startsev/deps-walker.svg?branch=master)](https://travis-ci.org/sergei-startsev/deps-walker) | ||
[![Build status](https://ci.appveyor.com/api/projects/status/b622r5eccu8gid1l/branch/master?svg=true)](https://ci.appveyor.com/project/sergei-startsev/deps-walker/branch/master) | ||
[Graph traversal](https://en.wikipedia.org/wiki/Graph_traversal) to walk through ESM dependency graph for further static analysis. The traversal algorithm is classified as [Breadth-first search (BFS)](https://en.wikipedia.org/wiki/Breadth-first_search). | ||
[Graph traversal](https://en.wikipedia.org/wiki/Graph_traversal) to walk through ES6/ES2015 module dependency graph for further static analysis. The traversal algorithm is classified as [Breadth-first search (BFS)](https://en.wikipedia.org/wiki/Breadth-first_search). | ||
## Install | ||
@@ -9,0 +6,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
11436
3
7
170
182
+ Addedmkdirp@3.0.1(transitive)
- Removedmkdirp@1.0.4(transitive)
Updated@babel/parser@^7.21.4
Updateddebug@^4.3.4
Updatedgraceful-fs@^4.2.11
Updatedmkdirp@^3.0.0
Updatedresolve@^1.22.2