New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@depanlz/core

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@depanlz/core

这个模块在项目依赖分析中扮演着核心角色,集成了关键的依赖分析功能,将各种依赖分析的任务统一在一个模块中。

  • 0.0.1-alpha.9
  • latest
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

@depanlz/core

这个模块在项目依赖分析中扮演着核心角色,集成了关键的依赖分析功能,将各种依赖分析的任务统一在一个模块中。

DepAnlz 类

declare class DepAnlz {
    depth: number;
    constructor(depth: number);
    preHook(): Config;
    coreHook(config: Config): DepGraph;
    postHook(callback: (config:Config, depGraph: DepGraph) => any): any;
    lifeCycle(): DepGraph;
}

DepAnlz类是我们分析项目依赖的核心,我们可以通过DepAnlz实例对象身上的一些Hook方法,来定制化个人的依赖分析行为。

快速上手

下载

$ npm install @depanlz/core
$ pnpm add @depanlz/core 
$ yarn add @depanlz/core 

构建实例

有关 typescript 的类型声明

type Config = {
    PKG_JSON_DIR: string,
    NODE_MODULES_DIR: string,
    PKG_MANAGER: string,
    DEPTH: number
}

type DepNode = {
    id: string,
    dependence: string,
    version: string,
    level: number
}

type DepRel = {
    source: string,
    target: string
}

declare class DepGraph {
    nodes: Array<DepNode>;
    edges: Array<DepRel>;
    constructor();
    insertEgde(fromNodeId: string, toNodeId: string): void;
    insertNode(dependence: string, version: string, level: number):void ;
}

使用 DepAnlz 类构建实例,以及进行依赖分析,加工处理等。

import { DepAnlz, Config, DepGraph } from "@depanlz/core"

const depth: number = 3

const anlz: DepAnlz = new DepAnlz(depth)

const config: Config = anlz.preHook()

const depGraph: DepGraph = anlz.coreHook(config)

function callback (config: Config, depGraph: DepGraph): void {
    console.log(config)
    console.log(depGraph)
}

anlz.postHook(callback)

FAQs

Package last updated on 31 Aug 2023

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc