Skip to content

Commit 4f95cc4

Browse files
Lukas Holzeralexeagle
authored andcommitted
fix(builtin): fixes nodejs_binary to collect JSNamedModuleInfo
To be backwards compatible with earlier versions still support the `JSNamedModuleInfo` provider for nodejs_binary dependencies along with the new `JSModuleInfo`. This should help dependencies to transition to the new provider without having to patch it. Fixes #1998
1 parent c1d4885 commit 4f95cc4

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

internal/node/node.bzl

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ They support module mapping: any targets in the transitive dependencies with
2020
a `module_name` attribute can be `require`d by that name.
2121
"""
2222

23-
load("//:providers.bzl", "JSModuleInfo", "NodeRuntimeDepsInfo", "NpmPackageInfo", "node_modules_aspect")
23+
load("//:providers.bzl", "JSModuleInfo", "JSNamedModuleInfo", "NodeRuntimeDepsInfo", "NpmPackageInfo", "node_modules_aspect")
2424
load("//internal/common:expand_into_runfiles.bzl", "expand_location_into_runfiles")
2525
load("//internal/common:module_mappings.bzl", "module_mappings_runtime_aspect")
2626
load("//internal/common:path_utils.bzl", "strip_external")
@@ -167,6 +167,11 @@ def _nodejs_binary_impl(ctx):
167167
for d in ctx.attr.data:
168168
if JSModuleInfo in d:
169169
sources_depsets.append(d[JSModuleInfo].sources)
170+
171+
# Deprecated should be removed with version 3.x.x at least have a transition phase
172+
# for dependencies to provide the output under the JSModuleInfo instead.
173+
if JSNamedModuleInfo in d:
174+
sources_depsets.append(d[JSNamedModuleInfo].sources)
170175
if hasattr(d, "files"):
171176
sources_depsets.append(d.files)
172177
sources = depset(transitive = sources_depsets)

0 commit comments

Comments
 (0)