pub struct NpmCrawler;Expand description
NPM ecosystem crawler for discovering packages in node_modules.
Implementations§
Source§impl NpmCrawler
impl NpmCrawler
Sourcepub async fn get_node_modules_paths(
&self,
options: &CrawlerOptions,
) -> Result<Vec<PathBuf>, Error>
pub async fn get_node_modules_paths( &self, options: &CrawlerOptions, ) -> Result<Vec<PathBuf>, Error>
Get node_modules paths based on options.
In global mode returns well-known global paths; in local mode walks
the project tree looking for node_modules directories (including
workspace packages).
Sourcepub async fn crawl_all(&self, options: &CrawlerOptions) -> Vec<CrawledPackage>
pub async fn crawl_all(&self, options: &CrawlerOptions) -> Vec<CrawledPackage>
Crawl all discovered node_modules and return every package found.
Sourcepub async fn find_by_purls(
&self,
node_modules_path: &Path,
purls: &[String],
) -> Result<HashMap<String, CrawledPackage>, Error>
pub async fn find_by_purls( &self, node_modules_path: &Path, purls: &[String], ) -> Result<HashMap<String, CrawledPackage>, Error>
Find specific packages by PURL inside a single node_modules tree.
This is an efficient O(n) lookup where n = number of PURLs: we parse each PURL to derive the expected directory path, then do a direct stat
package.jsonread.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for NpmCrawler
impl RefUnwindSafe for NpmCrawler
impl Send for NpmCrawler
impl Sync for NpmCrawler
impl Unpin for NpmCrawler
impl UnsafeUnpin for NpmCrawler
impl UnwindSafe for NpmCrawler
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more