Skip to content

Commit 125f77a

Browse files
committed
Include TsInfo in nodejs_modules_package transitive files instead
This avoids breaking several rules that expect JsInfo not to include type declarations. Seems like "transitive files" are just the files going in the package.
1 parent 5c3562c commit 125f77a

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

nodejs/rules.bzl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ load("@rules_pkg//pkg:providers.bzl", "PackageFilegroupInfo", "PackageFilesInfo"
55
load("@rules_pkg//pkg:tar.bzl", "pkg_tar")
66
load("//commonjs:providers.bzl", "CjsInfo", "create_globals", "gen_manifest", "package_path")
77
load("//javascript:providers.bzl", "JsInfo")
8+
load("//typescript:providers.bzl", "TsInfo")
89
load("//util:path.bzl", "nearest", "relativize", "runfile_path")
910
load(":providers.bzl", "NodejsInfo", "NodejsRuntimeInfo")
1011

@@ -372,6 +373,7 @@ def nodejs_modules(name, deps, **kwargs):
372373
def _nodejs_modules_package_impl(ctx):
373374
deps_cjs = [target[CjsInfo] for target in ctx.attr.deps]
374375
deps_js = [target[JsInfo] for target in ctx.attr.deps]
376+
deps_ts = [target[TsInfo] for target in ctx.attr.deps if (TsInfo in target)]
375377
label = ctx.label
376378
links_cjs = [target[CjsInfo] for target in ctx.attr.links]
377379
workspace = ctx.workspace_name
@@ -390,7 +392,7 @@ def _nodejs_modules_package_impl(ctx):
390392
package_paths_nonempty = {}
391393

392394
transitive_files = depset(
393-
transitive = [js_info.transitive_files for js_info in deps_js],
395+
transitive = [info.transitive_files for info in (deps_js + deps_ts)],
394396
)
395397
files_map = {}
396398
for file in transitive_files.to_list():

ts-proto/rules.bzl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ def _ts_proto_libraries_impl(ctx):
247247

248248
js_infos[lib.label] = create_js_info(
249249
cjs_root = cjs_root,
250-
files = js + declarations,
250+
files = js,
251251
deps = ts_proto.deps_js + [js_infos[label] for label in lib.deps],
252252
)
253253

typescript/rules.bzl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -360,7 +360,7 @@ def _ts_library_impl(ctx):
360360
js_info = create_js_info(
361361
cjs_root = cjs_root,
362362
deps = js_deps + compiler.runtime_js,
363-
files = js + declarations,
363+
files = js,
364364
)
365365

366366
ts_info = create_ts_info(

0 commit comments

Comments
 (0)