nodejs_node_modules
A prebuilt node_modules directory tree, for third-party packages with no nodejs_library target (e.g. a yarn install output). src is a target whose default output is a directory; path (default "node_modules") is the tree's relative, /-separated location inside that output, with no . or .. segments. The default output is the tree itself, and consumers take it via node_modules. The [manifest] sub-target is a JSON file listing each top-level and scoped package of the tree with its name and, from its package.json, version, os, cpu, libc, bin and the names of its dependencies, optional dependencies and peer dependencies; a package reached through a symlink records the link, and dot entries such as .bin and .yarn-integrity are listed under ignored. A nodejs_library compile composes the tree package by package from it, so a package name this tree and another source both provide fails that compile and names both, as does a package or scope that is not excluded and cannot be read or is reached through a symlink that is dangling or resolves to the tree itself or outside it. exclude lists package names (name or @scope/name) and scopes (@scope, every package in it) that such a compile never composes out of this tree; each must be a package or scope the tree provides. A package reached through a symlink is composed alone, from the directory it resolves to, and dot entries such as .pnpm are never composed, so in an isolated layout such as pnpm's a package's dependencies are visible only if they are also at the top level of the tree. nodejs_binary and nodejs_test compose the tree the same way, honouring exclude. The tree is used as installed: a subset, such as the production dependencies only, comes from the installer.
Function Signature
def nodejs_node_modules(
*,
name: str,
default_target_platform: None | str = None,
target_compatible_with: list[str] = [],
compatible_with: list[str] = [],
exec_compatible_with: list[str] = [],
visibility: list[str | target_name_glob] = [],
within_view: list[str | target_name_glob] = ["PUBLIC"],
metadata: OpaqueMetadata = {},
tests: list[str] = [],
modifiers: OpaqueMetadata = [],
_package_tree_tool: str = "prelude//nodejs/tools:package_tree",
contacts: list[str] = [],
exclude: list[str] = [],
labels: list[str] = [],
path: str = "node_modules",
src: str,
) -> None
Parameters
-
name: (required)name of the target
-
default_target_platform: (defaults to:None)specifies the default target platform, used when no platforms are specified on the command line
-
target_compatible_with: (defaults to:[])a list of constraints that are required to be satisfied for this target to be compatible with a configuration
-
compatible_with: (defaults to:[])a list of constraints that are required to be satisfied for this target to be compatible with a configuration
-
exec_compatible_with: (defaults to:[])a list of constraints that are required to be satisfied for this target to be compatible with an execution platform
-
visibility: (defaults to:[])a list of visibility patterns restricting what targets can depend on this one
-
within_view: (defaults to:["PUBLIC"])a list of visibility patterns restricting what this target can depend on
-
metadata: (defaults to:{})a key-value map of metadata associated with this target
-
tests: (defaults to:[])a list of targets that provide tests for this one
-
modifiers: (defaults to:[])an array of modifiers associated with this target
-
contacts: (defaults to:[])A list of organizational contacts for this rule. These could be individuals who you would contact in the event of a failure or other issue with the rule.
contacts = [ 'Joe Sixpack', 'Erika Mustermann' ] -
labels: (defaults to:[])Set of arbitrary strings which allow you to annotate a build rule with tags that can be searched for over an entire dependency tree using
buck query().