Compare commits

...

1 Commits

Author SHA1 Message Date
pfg
bbce36e5de toml log fix 2025-02-25 21:02:49 -08:00
3 changed files with 16 additions and 2 deletions

View File

@@ -4116,8 +4116,13 @@ pub const ParseTask = struct {
.toml => {
const trace = tracer(@src(), "ParseTOML");
defer trace.end();
const root = try TOML.parse(&source, log, allocator, false);
return JSAst.init((try js_parser.newLazyExportAST(allocator, transpiler.options.define, opts, log, root, &source, "")).?);
var temp_log = bun.logger.Log.init(allocator);
defer {
temp_log.cloneToWithRecycled(log, true) catch bun.outOfMemory();
temp_log.msgs.clearAndFree();
}
const root = try TOML.parse(&source, &temp_log, allocator, false);
return JSAst.init((try js_parser.newLazyExportAST(allocator, transpiler.options.define, opts, &temp_log, root, &source, "")).?);
},
.text => {
const root = Expr.init(E.String, E.String{

View File

@@ -0,0 +1 @@
export const a = "demo";

View File

@@ -0,0 +1,8 @@
test("toml import error has correct lineText", async () => {
const result = await Bun.build({
entrypoints: [import.meta.dirname + "/not.toml"],
throw: false,
target: "bun",
});
expect(result.logs[0].position!.lineText).toBe('export const a = "demo";');
});