Security News
Maven Central Adds Sigstore Signature Validation
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.
glob-esm-graph
Advanced tools
Match files by glob pattern and generate their dependencies graph.
npm install glob-esm-graph
# or
yarn add glob-esm-graph
# or
pnpm install glob-esm-graph
type Options = {
/**
* The current working directory in which to search.
*/
cwd: string,
/**
* Glob patterns to match against.
*/
pattern: string | string[],
}
declare function globMatch (options: Options): string[]
Input the work dir and the glob pattern(s), returns the matched files in under dependent modules.
type DependenciesAnalysis = { module: string, dependencies: string[]}
declare function analyze(entries: string[], cwd: string): Promise<DependenciesAnalysis[]>
Input the esm format files as entries and the work dir, returns the analysis which contain the module info and their dependencies info.
type Graph = {
getNodes: () => string[],
getEdges: () => [from: string, to: string][],
getEntryNodes: () => string[],
getEndNodes: () => string[],
getPaths: () => string[][],
getCircular: () => string[][],
getSortedByDependencies: () => string[][],
}
declare function buildGraph (dependenciesAnalysis: DependenciesAnalysis[]): Graph
Input the dependencies analysis comes from
analyze
, returns the graph stats.
getPaths
doesn't contains circular pathsgetSortedByDependencies
will sort the dependencies which are related and keep the other's original order. The sorting priority accords to dependent depth in the graph.import { globMatch, analyze, buildGraph } from 'glob-esm-graph'
const cwd = `${__dirname}/foo-test`
const pattern = '**/*.module.ts'
const matched = globMatch({ cwd, pattern })
const dependenciesAnalysis = await analyze(matched, cwd)
const graph = buildGraph(dependenciesAnalysis)
FAQs
Generate ESM dependencies graph by glob-matching
The npm package glob-esm-graph receives a total of 0 weekly downloads. As such, glob-esm-graph popularity was classified as not popular.
We found that glob-esm-graph demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.
Security News
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
Research
Security News
Socket researchers uncovered a backdoored typosquat of BoltDB in the Go ecosystem, exploiting Go Module Proxy caching to persist undetected for years.