New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

deparser

Package Overview
Dependencies
Maintainers
4
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

deparser

Dependency parser for JavaScript dependencies

latest
Source
npmnpm
Version
1.1.1
Version published
Weekly downloads
0
-100%
Maintainers
4
Weekly downloads
 
Created
Source

deparser Build Status

Parse package manager lock files (for now yarn.lock) to generate dependency graph.

Usage

Import Deparser library into your code, and then instantiate with path to package.json and yarn.lock. Start using the methods on your instance.

const Deparser = require('Deparser');
const deparser = new Deparser();

const dependencyTree = deparser.getDependencyTree();
const directDependencies = deparser.getDirectDependencies();
const intents = deparser.getAllIntents();

Example

package.json:

{
  "dependencies": {
    "moment": "^2.22.2",
    "react": "^16.4.2"
  },
  "devDependencies": {
    "mocha": "^5.2.0"
  },
  "optionalDependencies": {
    "fsevents": "^1.2.4"
  }
}

yarn.lock:

Result of dependency tree from the above package.json and yarn.lock is tree.json:

[
  {
    "name": "moment",
    "version": "2.22.2",
    "type": "dependencies"
  },
  {
    "name": "react",
    "version": "16.4.2",
    "type": "dependencies",
    "children": [...]
  },
  {
    "name": "mocha",
    "version": "5.2.0",
    "type": "devDependencies",
    "children": [...]
  },
  {
    "name": "fsevents",
    "version": "1.2.4",
    "type": "optionalDependencies",
    "children": [...]
  }
]

FAQs

Package last updated on 15 Feb 2022

Did you know?

Socket

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.

Install

Related posts