NPM.PackageFiles (NPM v0.6.0)

Copy Markdown View Source

Analyzes which files would be included when publishing a package.

Uses the files field from package.json, default inclusions, and .npmignore rules.

Summary

Functions

Checks if a file is always excluded.

Checks if a file is always included regardless of files field.

Returns the list of always-included file patterns.

Lists all entry points (main, module, browser, types, exports).

Checks if package.json has a files whitelist.

Returns the main entry point.

Returns the files whitelist from package.json.

Functions

always_excluded?(filename)

@spec always_excluded?(String.t()) :: boolean()

Checks if a file is always excluded.

always_included?(filename)

@spec always_included?(String.t()) :: boolean()

Checks if a file is always included regardless of files field.

default_includes()

@spec default_includes() :: [String.t()]

Returns the list of always-included file patterns.

entry_points(data)

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

Lists all entry points (main, module, browser, types, exports).

has_whitelist?(data)

@spec has_whitelist?(map()) :: boolean()

Checks if package.json has a files whitelist.

main_entry(arg1)

@spec main_entry(map()) :: String.t()

Returns the main entry point.

whitelist(arg1)

@spec whitelist(map()) :: [String.t()] | nil

Returns the files whitelist from package.json.