Skip to content

Commit 8840868

Browse files
committed
fix(bazel): only extract types from within the same package as where the extract_types is called
We should only extract types that come from the same package location as where the extract_types are called.
1 parent 6a526a9 commit 8840868

File tree

2 files changed

+6
-40
lines changed

2 files changed

+6
-40
lines changed

bazel/extract_types.bzl

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
1-
load("@build_bazel_rules_nodejs//:providers.bzl", "DeclarationInfo")
1+
load("@aspect_rules_js//js:providers.bzl", "JsInfo")
22

33
def _extract_types_impl(ctx):
44
"""Implementation of the `extract_types` rule."""
5-
depsets = []
5+
types_files = []
66

77
for dep in ctx.attr.deps:
8-
if DeclarationInfo in dep:
9-
depsets.append(dep[DeclarationInfo].transitive_declarations)
8+
if JsInfo in dep:
9+
types_files.extend(dep[JsInfo].transitive_types.to_list())
10+
types_files.extend(dep[JsInfo].types.to_list())
1011

11-
types = depset(transitive = depsets)
12+
types = depset([file for file in types_files if file.short_path.startswith(ctx.label.package)])
1213

1314
return [
1415
DefaultInfo(files = types),

bazel/extract_types_rjs.bzl

Lines changed: 0 additions & 35 deletions
This file was deleted.

0 commit comments

Comments
 (0)