From 9dc7f258259e95fcdb1d5d7d3db0a41992efa79e Mon Sep 17 00:00:00 2001 From: Jarred Sumner Date: Fri, 4 Jun 2021 19:30:08 -0700 Subject: [PATCH] oops typescript Former-commit-id: 7c400c9b248c2e4c9e07270d1c23a370cfd5f660 --- src/bundler.zig | 8 ++++++-- src/cli.zig | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/bundler.zig b/src/bundler.zig index 2e8c0133c3..aa630e2e0a 100644 --- a/src/bundler.zig +++ b/src/bundler.zig @@ -227,7 +227,7 @@ pub fn NewBundler(cache_files: bool) type { file_path.pretty = Linker.relative_paths_list.append(bundler.fs.relativeTo(file_path.text)) catch unreachable; switch (loader) { - .jsx, .tsx, .js, .json => { + .jsx, .tsx, .js, .ts, .json => { var result = bundler.parse(bundler.allocator, file_path, loader, resolve_result.dirname_fd) orelse { js_ast.Expr.Data.Store.reset(); js_ast.Stmt.Data.Store.reset(); @@ -314,7 +314,11 @@ pub fn NewBundler(cache_files: bool) type { const source = logger.Source.initFile(Fs.File{ .path = path, .contents = entry.contents }, bundler.allocator) catch return null; switch (loader) { - .js, .jsx, .ts, .tsx => { + .js, + .jsx, + .ts, + .tsx, + => { var jsx = bundler.options.jsx; jsx.parse = loader.isJSX(); var opts = js_parser.Parser.Options.init(jsx, loader); diff --git a/src/cli.zig b/src/cli.zig index a69ac88331..cdf71b5682 100644 --- a/src/cli.zig +++ b/src/cli.zig @@ -344,7 +344,7 @@ pub const Cli = struct { for (result.output_files) |f, i| { max_path_len = std.math.max( - f.input.text[from_path.len..].len + 2, + std.math.max(from_path.len, f.input.text.len) + 2 - from_path.len, max_path_len, ); }