Skip to content

Commit

Permalink
Add check_dependents function and update dependencies
Browse files Browse the repository at this point in the history
- Implement check_dependents function in binding/src/lib.rs to get file dependents
- Add 'petgraph' to VSCode dictionary
- Update package version to 0.0.24
  • Loading branch information
ityuany committed Sep 19, 2024
1 parent 6655cc0 commit 7c1b387
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
1 change: 1 addition & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"kosaraju",
"napi",
"newable",
"petgraph",
"ropey",
"threadpool"
],
Expand Down
12 changes: 12 additions & 0 deletions crates/binding/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
use std::collections::HashSet;

use napi::Result;
use napi_derive::napi;
use utils::GlobOptions;
Expand Down Expand Up @@ -49,3 +51,13 @@ pub fn check_detect_cycle(
napi::Error::new(napi::Status::GenericFailure, err.to_string())
})
}

#[napi]
pub fn check_dependents(
file: String,
options: Option<module_graph::Options>,
) -> Result<Vec<String>> {
module_graph::get_dependents(file, options)
.and_then(|x| Ok(x.into_iter().collect()))
.map_err(|e| napi::Error::new(napi::Status::GenericFailure, e.to_string()))
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@shined/source-code-diagnosis",
"version": "0.0.23",
"version": "0.0.24",
"main": "index.js",
"types": "index.d.ts",
"napi": {
Expand Down

0 comments on commit 7c1b387

Please sign in to comment.