npm

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package npm implements a notice.Collector for direct dependencies declared in frontend/package.json. devDependencies are excluded.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Collector

type Collector struct {
	// contains filtered or unexported fields
}

Collector enumerates the `dependencies` listed in frontend/package.json and builds a NOTICE entry for each by reading the matching directory inside frontend/node_modules. devDependencies are ignored.

func New

func New(opts ...Option) *Collector

New constructs a Collector with production defaults.

func (*Collector) Collect

func (c *Collector) Collect(root string) ([]notice.Entry, error)

Collect implements notice.Collector.

func (*Collector) Name

func (c *Collector) Name() string

Name implements notice.Collector.

func (*Collector) Precheck

func (c *Collector) Precheck(root string) error

Precheck implements notice.Collector. The collector requires frontend/node_modules to be populated; we do not auto-install.

type FileSystem

type FileSystem interface {
	ReadFile(path string) ([]byte, error)
	Stat(path string) (os.FileInfo, error)
}

FileSystem is the small slice of os we depend on. Tests inject a fake to avoid materializing real node_modules trees on disk where possible (though most fixtures still use t.TempDir() since pkg directories are looked up by os.ReadFile).

type Option

type Option func(*Collector)

Option configures a Collector.

func WithFS

func WithFS(f FileSystem) Option

WithFS injects a FileSystem. Defaults to the host filesystem.

Jump to

Keyboard shortcuts

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