diff --git a/examples/jsx/expected_outputs.txt b/examples/jsx/expected_outputs.txt index 9b86c6b0..6dabc98a 100644 --- a/examples/jsx/expected_outputs.txt +++ b/examples/jsx/expected_outputs.txt @@ -4,4 +4,5 @@ examples/jsx/out/b.d.ts examples/jsx/out/b.d.ts.map examples/jsx/out/a.jsx examples/jsx/out/a.jsx.map -examples/jsx/out/b.jsx \ No newline at end of file +examples/jsx/out/b.jsx +examples/jsx/out/b.jsx.map \ No newline at end of file diff --git a/examples/module_ext/expected_outputs.txt b/examples/module_ext/expected_outputs.txt index 218dcffc..cd356b6e 100644 --- a/examples/module_ext/expected_outputs.txt +++ b/examples/module_ext/expected_outputs.txt @@ -9,6 +9,8 @@ examples/module_ext/out/d.d.cts.map examples/module_ext/out/a.mjs examples/module_ext/out/a.mjs.map examples/module_ext/out/b.mjs +examples/module_ext/out/b.mjs.map examples/module_ext/out/c.cjs examples/module_ext/out/c.cjs.map -examples/module_ext/out/d.cjs \ No newline at end of file +examples/module_ext/out/d.cjs +examples/module_ext/out/d.cjs.map \ No newline at end of file diff --git a/ts/defs.bzl b/ts/defs.bzl index 9ff154d6..f832c1f4 100644 --- a/ts/defs.bzl +++ b/ts/defs.bzl @@ -354,7 +354,7 @@ def ts_project( tsc_map_outs = [] if emit_tsc_js: tsc_js_outs = _lib.calculate_js_outs(srcs, out_dir, root_dir, allow_js, resolve_json_module, preserve_jsx, emit_declaration_only) - tsc_map_outs = _lib.calculate_map_outs(srcs, out_dir, root_dir, source_map, preserve_jsx, emit_declaration_only) + tsc_map_outs = _lib.calculate_map_outs(srcs, out_dir, root_dir, source_map, allow_js, preserve_jsx, emit_declaration_only) # Custom typing transpiler if emit_transpiler_dts: diff --git a/ts/private/ts_lib.bzl b/ts/private/ts_lib.bzl index 206df138..a8125aa5 100644 --- a/ts/private/ts_lib.bzl +++ b/ts/private/ts_lib.bzl @@ -269,7 +269,7 @@ def _calculate_js_outs(srcs, out_dir, root_dir, allow_js, resolve_json_module, p return _to_js_out_paths(srcs, out_dir, root_dir, allow_js, resolve_json_module, exts, ".js") -def _calculate_map_outs(srcs, out_dir, root_dir, source_map, preserve_jsx, emit_declaration_only): +def _calculate_map_outs(srcs, out_dir, root_dir, source_map, allow_js, preserve_jsx, emit_declaration_only): if not source_map or emit_declaration_only: return [] @@ -281,8 +281,10 @@ def _calculate_map_outs(srcs, out_dir, root_dir, source_map, preserve_jsx, emit_ } if preserve_jsx: exts[".tsx"] = ".jsx.map" + if allow_js: + exts[".jsx"] = ".jsx.map" - return _to_js_out_paths(srcs, out_dir, root_dir, False, False, exts, ".js.map") + return _to_js_out_paths(srcs, out_dir, root_dir, allow_js, False, exts, ".js.map") def _calculate_typings_outs(srcs, typings_out_dir, root_dir, declaration, composite, allow_js): if not (declaration or composite): diff --git a/ts/private/ts_project.bzl b/ts/private/ts_project.bzl index 702aa552..71d38468 100644 --- a/ts/private/ts_project.bzl +++ b/ts/private/ts_project.bzl @@ -68,7 +68,7 @@ def _ts_project_impl(ctx): map_outs = [] if not ctx.attr.no_emit and ctx.attr.transpile != 0: js_outs = _lib.declare_outputs(ctx, _lib.calculate_js_outs(srcs, ctx.attr.out_dir, ctx.attr.root_dir, ctx.attr.allow_js, ctx.attr.resolve_json_module, ctx.attr.preserve_jsx, ctx.attr.emit_declaration_only)) - map_outs = _lib.declare_outputs(ctx, _lib.calculate_map_outs(srcs, ctx.attr.out_dir, ctx.attr.root_dir, ctx.attr.source_map, ctx.attr.preserve_jsx, ctx.attr.emit_declaration_only)) + map_outs = _lib.declare_outputs(ctx, _lib.calculate_map_outs(srcs, ctx.attr.out_dir, ctx.attr.root_dir, ctx.attr.source_map, ctx.attr.allow_js, ctx.attr.preserve_jsx, ctx.attr.emit_declaration_only)) # dts+map file outputs typings_outs = [] diff --git a/ts/test/mock_transpiler.bzl b/ts/test/mock_transpiler.bzl index 5f141558..e0b9caba 100644 --- a/ts/test/mock_transpiler.bzl +++ b/ts/test/mock_transpiler.bzl @@ -54,6 +54,6 @@ def mock(name, srcs, source_map = False, **kwargs): # Calculate pre-declared outputs so they can be referenced as targets. # This is an optional transpiler feature aligning with the default tsc transpiler. js_outs = lib.calculate_js_outs(srcs, ".", ".", False, False, False, False), - map_outs = lib.calculate_map_outs(srcs, ".", ".", True, False, False) if source_map else [], + map_outs = lib.calculate_map_outs(srcs, ".", ".", True, False, False, False) if source_map else [], **kwargs )