Compare commits

...

1 Commits

Author SHA1 Message Date
pfg
608e7eac9c doesn't work 2025-02-21 17:52:35 -08:00
3 changed files with 15 additions and 2 deletions

View File

@@ -4016,8 +4016,12 @@ 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.appendToMaybeRecycled(log, &source) catch bun.outOfMemory();
}
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";');
});