Skip to content

Commit 61365a9

Browse files
gregmagolanAndrewKushnir
authored andcommittedApr 25, 2019
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
1 parent 3a9d247 commit 61365a9

File tree

3 files changed

+9
-4
lines changed

3 files changed

+9
-4
lines changed
 

‎WORKSPACE

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@ Try running `yarn bazel` instead.
4141
# - 0.15.3 Includes a fix for the `jasmine_node_test` rule ignoring target tags
4242
# - 0.16.8 Supports npm installed bazel workspaces
4343
# - 0.26.0 Fix for data files in yarn_install and npm_install
44-
check_rules_nodejs_version("0.26.0")
44+
# - 0.27.12 Adds NodeModuleSources provider for transtive npm deps support
45+
check_rules_nodejs_version("0.27.12")
4546

4647
# Setup the Node.js toolchain
4748
node_repositories(

‎packages/bazel/src/external.bzl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ load(
1616
load(
1717
"@build_bazel_rules_nodejs//internal/common:node_module_info.bzl",
1818
_NodeModuleInfo = "NodeModuleInfo",
19+
_NodeModuleSources = "NodeModuleSources",
1920
_collect_node_modules_aspect = "collect_node_modules_aspect",
2021
)
2122
load(
@@ -24,6 +25,7 @@ load(
2425
)
2526

2627
NodeModuleInfo = _NodeModuleInfo
28+
NodeModuleSources = _NodeModuleSources
2729
collect_node_modules_aspect = _collect_node_modules_aspect
2830

2931
tsc_wrapped_tsconfig = _tsc_wrapped_tsconfig

‎packages/bazel/src/ng_module.bzl

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ load(
1414
"DEFAULT_NG_XI18N",
1515
"DEPS_ASPECTS",
1616
"NodeModuleInfo",
17+
"NodeModuleSources",
1718
"TsConfigInfo",
1819
"collect_node_modules_aspect",
1920
"compile_ts",
@@ -498,10 +499,11 @@ def _compile_action(ctx, inputs, outputs, dts_bundles_out, messages_out, tsconfi
498499
file_inputs += ctx.attr.tsconfig[TsConfigInfo].deps
499500

500501
# Also include files from npm fine grained deps as action_inputs.
501-
# These deps are identified by the NodeModuleInfo provider.
502+
# These deps are identified by the NodeModuleSources provider.
502503
for d in ctx.attr.deps:
503-
if NodeModuleInfo in d:
504-
file_inputs.extend(_filter_ts_inputs(d.files))
504+
if NodeModuleSources in d:
505+
# Note: we can't avoid calling .to_list() on sources
506+
file_inputs.extend(_filter_ts_inputs(d[NodeModuleSources].sources.to_list()))
505507

506508
# Collect the inputs and summary files from our deps
507509
action_inputs = depset(

0 commit comments

Comments
 (0)
Please sign in to comment.