NPM.BundleDeps (NPM v0.6.0)

Copy Markdown View Source

Handles bundledDependencies in package.json.

bundledDependencies are packages that are included in the tarball when publishing, rather than being fetched from the registry.

Summary

Functions

Checks if a package is bundled.

Returns the count of bundled dependencies.

Extracts bundledDependencies from package.json data.

Validates that all bundled deps are also declared as dependencies.

Functions

bundled?(name, pkg_data)

@spec bundled?(String.t(), map()) :: boolean()

Checks if a package is bundled.

count(pkg_data)

@spec count(map()) :: non_neg_integer()

Returns the count of bundled dependencies.

extract(data)

@spec extract(map()) :: [String.t()]

Extracts bundledDependencies from package.json data.

Handles both bundledDependencies and bundleDependencies fields.

validate(pkg_data)

@spec validate(map()) :: {:ok, [String.t()]} | {:error, [String.t()]}

Validates that all bundled deps are also declared as dependencies.