fix(bazel): transitive npm deps in ng_module (#30065)

BREAKING CHANGE:

ng_module now depends on a minimum of build_bazel_rules_nodejs 0.27.12

PR Close #30065
This commit is contained in:
Greg Magolan 2019-04-23 10:50:55 -07:00 committed by Andrew Kushnir
parent 3a9d2473ca
commit 61365a94ed
3 changed files with 9 additions and 4 deletions

View File

@ -41,7 +41,8 @@ Try running `yarn bazel` instead.
# - 0.15.3 Includes a fix for the `jasmine_node_test` rule ignoring target tags
# - 0.16.8 Supports npm installed bazel workspaces
# - 0.26.0 Fix for data files in yarn_install and npm_install
check_rules_nodejs_version("0.26.0")
# - 0.27.12 Adds NodeModuleSources provider for transtive npm deps support
check_rules_nodejs_version("0.27.12")
# Setup the Node.js toolchain
node_repositories(

View File

@ -16,6 +16,7 @@ load(
load(
"@build_bazel_rules_nodejs//internal/common:node_module_info.bzl",
_NodeModuleInfo = "NodeModuleInfo",
_NodeModuleSources = "NodeModuleSources",
_collect_node_modules_aspect = "collect_node_modules_aspect",
)
load(
@ -24,6 +25,7 @@ load(
)
NodeModuleInfo = _NodeModuleInfo
NodeModuleSources = _NodeModuleSources
collect_node_modules_aspect = _collect_node_modules_aspect
tsc_wrapped_tsconfig = _tsc_wrapped_tsconfig

View File

@ -14,6 +14,7 @@ load(
"DEFAULT_NG_XI18N",
"DEPS_ASPECTS",
"NodeModuleInfo",
"NodeModuleSources",
"TsConfigInfo",
"collect_node_modules_aspect",
"compile_ts",
@ -498,10 +499,11 @@ def _compile_action(ctx, inputs, outputs, dts_bundles_out, messages_out, tsconfi
file_inputs += ctx.attr.tsconfig[TsConfigInfo].deps
# Also include files from npm fine grained deps as action_inputs.
# These deps are identified by the NodeModuleInfo provider.
# These deps are identified by the NodeModuleSources provider.
for d in ctx.attr.deps:
if NodeModuleInfo in d:
file_inputs.extend(_filter_ts_inputs(d.files))
if NodeModuleSources in d:
# Note: we can't avoid calling .to_list() on sources
file_inputs.extend(_filter_ts_inputs(d[NodeModuleSources].sources.to_list()))
# Collect the inputs and summary files from our deps
action_inputs = depset(