Skip to content

Commit

Permalink
Add comments describing differences between NodeModuleInfo and NodeMo…
Browse files Browse the repository at this point in the history
…duleSources providers
  • Loading branch information
gregmagolan committed Apr 9, 2019
1 parent 11c3168 commit 0504719
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions internal/common/node_module_info.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,29 @@
"""NodeModuleInfo & NodeModuleSources providers and apsect to collect node_modules from deps.
"""

# NodeModuleInfo provider is only provided by targets that are npm dependencies by the
# `node_module_library` rule. This provider is currently used by different rules to filter out
# npm dependencies such as
# ```
# [d for d in ctx.attr.deps if not NodeModuleInfo in d]
# ```
# in `packages/typescript/internal/build_defs.bzl` or
# ```
# hasattr(target, "files") and not NodeModuleInfo in target:
# ```
# in `internal/common/sources_aspect.bzl`.
# Similar filtering is done in downstream repositories such as angular/angular so this provider
# needs to go through a deprecation period before it can be phased out.
NodeModuleInfo = provider(
doc = "Provides information about npm dependencies installed with yarn_install and npm_install rules",
fields = {
"workspace": "The workspace name that the npm dependencies are provided from",
},
)

# NodeModuleSources provider is provided by targets that are npm dependencies by the
# `node_module_library` rule as well as other targets that have direct or transitive deps on
# `node_module_library` targets via the `collect_node_modules_aspect` below.
NodeModuleSources = provider(
doc = "Provides sources for npm dependencies installed with yarn_install and npm_install rules",
fields = {
Expand Down

0 comments on commit 0504719

Please sign in to comment.