node

package
v0.1.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 18, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Detect

func Detect(dir string) capability.CapabilitySet

Detect scans JS/TS source files in dir and returns the combined capability set. It also checks package.json install scripts for network/exec patterns.

func DownloadPackage

func DownloadPackage(pkgName, version string) (string, error)

DownloadPackage fetches pkgName@version from the npm registry, extracts the tarball into a temp directory, and returns that directory path. The caller is responsible for removing the directory when done.

Types

type Adapter

type Adapter struct{}

Adapter implements the Analyzer interface for Node.js projects.

func (*Adapter) Load

func (a *Adapter) Load(dir string) (*graph.DependencyGraph, error)

Load parses the project's lockfile, detects capabilities for each npm package, and returns a *graph.DependencyGraph using the same structure as the Go loader.

func (*Adapter) Name

func (a *Adapter) Name() string

type NpmPackage

type NpmPackage struct {
	Name         string
	Version      string
	Dir          string
	Dependencies []string
	Direct       bool
}

NpmPackage represents an npm package extracted from a lockfile.

func Load

func Load(dir string) ([]NpmPackage, error)

Load detects the lockfile type in dir and parses it. It tries package-lock.json, then yarn.lock, then pnpm-lock.yaml.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL