Skip to content

Commit

Permalink
Fix showing source code that looks like export default "file-path" (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
Jarred-Sumner authored Dec 23, 2024
1 parent 1fa6d9e commit c6b22d3
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/bun.js/javascript.zig
Original file line number Diff line number Diff line change
Expand Up @@ -3620,7 +3620,8 @@ pub const VirtualMachine = struct {
if (frame.source_url.hasPrefixComptime("bun:") or
frame.source_url.hasPrefixComptime("node:") or
frame.source_url.isEmpty() or
frame.source_url.eqlComptime("native"))
frame.source_url.eqlComptime("native") or
frame.source_url.eqlComptime("unknown"))
{
top_frame_is_builtin = true;
continue;
Expand Down
13 changes: 13 additions & 0 deletions src/bun.js/module_loader.zig
Original file line number Diff line number Diff line change
Expand Up @@ -1505,6 +1505,19 @@ pub const ModuleLoader = struct {
) !ResolvedSource {
const disable_transpilying = comptime flags.disableTranspiling();

if (comptime disable_transpilying) {
if (!(loader.isJavaScriptLike() or loader == .toml or loader == .text or loader == .json)) {
// Don't print "export default <file path>"
return ResolvedSource{
.allocator = null,
.source_code = bun.String.empty,
.specifier = input_specifier,
.source_url = input_specifier.createIfDifferent(path.text),
.hash = 0,
};
}
}

switch (loader) {
.js, .jsx, .ts, .tsx, .json, .toml, .text => {
jsc_vm.transpiled_count += 1;
Expand Down

0 comments on commit c6b22d3

Please sign in to comment.