diff --git a/WORKSPACE b/WORKSPACE index 0ad52f9b32..178545b45d 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -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( diff --git a/packages/bazel/src/external.bzl b/packages/bazel/src/external.bzl index c082bc487d..d15d777960 100644 --- a/packages/bazel/src/external.bzl +++ b/packages/bazel/src/external.bzl @@ -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 diff --git a/packages/bazel/src/ng_module.bzl b/packages/bazel/src/ng_module.bzl index f19307a750..144fdf08d9 100644 --- a/packages/bazel/src/ng_module.bzl +++ b/packages/bazel/src/ng_module.bzl @@ -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(