New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cleanup how build errors are displayed slightly #7223
Conversation
❌ @Jarred-Sumner 4 files with test failures on bun-darwin-aarch64:
|
✅ test failures on linux-x64-baseline have been resolved. |
❌ @Jarred-Sumner 1 files with test failures on linux-x64:
|
❌ @Jarred-Sumner 8 files with test failures on bun-darwin-x64:
|
❌ @Jarred-Sumner 8 files with test failures on bun-darwin-x64-baseline:
|
if (after.len > 40) { | ||
after = after[0..40]; | ||
} | ||
try to.writeAll(after); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we also need a color reset here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh, I don't think we do because it would've reset on line 341
* Cleanup error formatting a little * Add error for using import statement with CommonJS-only features * Update js_ast.zig * Further tweaks to formatting, also print error.cause * Add some snapshot tests for errors * Make these snapshot tests * Ignore mimalloc warnings * Update error message parsing in bundling tests * Increase timeout on the test * Update expectBundled.ts * Update test --------- Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
What does this PR do?
Two things:
Formatting tweaks
logger.rangeOfIdentifier
to include the complete length of the identifier (usage ofdefer
broke that)Before:
After:
Build-time error for unsupported ESM<>CommonJS features
You can use
require
andimport
in the same file in Bun, but you cannot useimport
andmodule.exports
in the same file. You also cannot useexports
,module
,with
or top-level return.Currently, we rely on JavaScriptCore's errors for these things, but they're really hard to read and don't give us an easy way to show a stack trace pointing to which line exactly caused it.
This moves those errors to build-time.
Input:
Before (note how it says "import call"):
After:
Input:
Before:
After:
How did you verify your code works?
I wrote a few tests