Skip to content

Commit 25e3ba3

Browse files
committed
fix(bazel): forward provided module names for interop compatible ts_projects (#2612)
Forward the provided module name as a valid import module name for downstream usages in strict deps checks for interop compatible ts_project usage. PR Close #2612
1 parent 89fd28e commit 25e3ba3

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

bazel/ts_project/strict_deps/index.bzl

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,18 @@
11
load("@aspect_rules_js//js:providers.bzl", "JsInfo")
2+
load("@build_bazel_rules_nodejs//:providers.bzl", "LinkablePackageInfo")
23

34
# A custom provider to pass along the npm package name for linked npm packages
45
NpmPackage = provider()
56

67
def _npm_package_aspect_impl(target, ctx):
8+
# Extract the module_name provided to an interop compatible ts_project to be made
9+
# available as an imported module by downstream usages.
10+
# TODO: Remove after all interop usage is removed.
11+
if ctx.rule.kind == "ts_project_module":
12+
package_name = target[LinkablePackageInfo].package_name
13+
if package_name != "":
14+
return [NpmPackage(name = package_name)]
15+
716
if (ctx.rule.kind == "npm_link_package_store"):
817
package_name = ctx.rule.attr.package
918

0 commit comments

Comments
 (0)