Skip to content

Commit 7c24865

Browse files
committed
wip: copy source dts to the outDir
1 parent a8eece6 commit 7c24865

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

ts/private/ts_project.bzl

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,16 @@ See https://github.com/aspect-build/rules_ts/issues/361 for more details.
226226
output_sources.append(s)
227227
elif _lib.is_typings_src(s.path):
228228
output_types.append(s)
229+
else:
230+
# Add DTS inputs that are not transpiled by tsc yet should be copied to the out_dir
231+
for s in srcs_inputs:
232+
if _lib.is_typings_src(s.path):
233+
dts_path = _lib.relative_to_package(s.path, ctx)
234+
dts_out_path = _lib.to_out_path(dts_path, ctx.attr.out_dir, ctx.attr.root_dir)
235+
if s.is_source or dts_path != dts_out_path:
236+
dts_out = ctx.actions.declare_file(dts_out_path)
237+
copy_file_action(ctx, s, dts_out)
238+
output_types.append(dts_out)
229239

230240
# Make sure the user has acknowledged that transpiling is slow
231241
if len(outputs) > 0 and ctx.attr.transpile == -1 and not ctx.attr.emit_declaration_only and not options.default_to_tsc_transpiler:

0 commit comments

Comments
 (0)