diff options
author | 2021-10-30 23:15:47 -0700 | |
---|---|---|
committer | 2021-10-30 23:15:47 -0700 | |
commit | 4ce6e4a9cb7f95f366446a5724ece25482d53284 (patch) | |
tree | 22a5badf5822fa9c46a8094f9b722a3b4b0bc36c | |
parent | 9cf2771549f94b6ee5dcf09c51f4798e4113f1b1 (diff) | |
download | bun-4ce6e4a9cb7f95f366446a5724ece25482d53284.tar.gz bun-4ce6e4a9cb7f95f366446a5724ece25482d53284.tar.zst bun-4ce6e4a9cb7f95f366446a5724ece25482d53284.zip |
[Bun.js] Ensure we print in Latin1 mode
-rw-r--r-- | src/bundler.zig | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/bundler.zig b/src/bundler.zig index 44feeb749..97f975fe9 100644 --- a/src/bundler.zig +++ b/src/bundler.zig @@ -2233,6 +2233,27 @@ pub const Bundler = struct { try bundler.linker.link(file_path, &result, import_path_format, false); + if (bundler.options.platform.isBun()) { + return BuildResolveResultPair{ + .written = switch (result.ast.exports_kind) { + .esm => try bundler.print( + result, + Writer, + writer, + .esm_ascii, + ), + .cjs => try bundler.print( + result, + Writer, + writer, + .cjs_ascii, + ), + else => unreachable, + }, + .input_fd = result.input_fd, + }; + } + return BuildResolveResultPair{ .written = switch (result.ast.exports_kind) { .none, .esm => try bundler.print( @@ -2507,6 +2528,7 @@ pub const Bundler = struct { loader: options.Loader, jsx: options.JSX.Pragma, macro_remappings: MacroRemap, + virtual_source: ?*const logger.Source = null, }; pub fn parse( @@ -2534,6 +2556,10 @@ pub const Bundler = struct { var input_fd: ?StoredFileDescriptorType = null; const source: logger.Source = brk: { + if (this_parse.virtual_source) |virtual_source| { + break :brk virtual_source.*; + } + if (client_entry_point_) |client_entry_point| { if (@hasField(std.meta.Child(@TypeOf(client_entry_point)), "source")) { break :brk client_entry_point.source; |