From 487da0aeac2066d52b0cf8a8c430f105a7c6d14f Mon Sep 17 00:00:00 2001 From: chloe caruso Date: Fri, 10 Jan 2025 20:58:14 -0800 Subject: [PATCH] fix building bun with new version of bun (#16328) --- src/codegen/bindgen-lib-internal.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/codegen/bindgen-lib-internal.ts b/src/codegen/bindgen-lib-internal.ts index 7c4ee555fa49c2..f969c30fd11954 100644 --- a/src/codegen/bindgen-lib-internal.ts +++ b/src/codegen/bindgen-lib-internal.ts @@ -886,7 +886,9 @@ function snapshotCallerLocation(): string { } function stackTraceFileName(line: string): string { - return / \(((?:[A-Za-z]:)?.*?)[:)]/.exec(line)![1].replaceAll("\\", "/"); + const match = /(?:at\s+|\()(.:?[^:\n(\)]*)[^(\n]*$/i.exec(line); + assert(match, `Couldn't extract filename from stack trace line: ${line}`); + return match[1].replaceAll("\\", "/"); } export type CAbiType =