mirror of
https://github.com/oven-sh/bun
synced 2026-02-18 06:41:50 +00:00
toml log fix
This commit is contained in:
@@ -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{
|
||||
|
||||
1
test/js/bun/resolve/toml/crash/not.toml
Normal file
1
test/js/bun/resolve/toml/crash/not.toml
Normal file
@@ -0,0 +1 @@
|
||||
export const a = "demo";
|
||||
8
test/js/bun/resolve/toml/crash/toml-crash.test.ts
Normal file
8
test/js/bun/resolve/toml/crash/toml-crash.test.ts
Normal 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";');
|
||||
});
|
||||
Reference in New Issue
Block a user