Repository navigation
fix(oxc): report oxc parse errors instead of an empty result - #2954
Merged
Merged
Conversation
🦋 Changeset detectedLatest commit: 5b87896 The changes in this PR will be included in the next version bump. This PR includes changesets to release 25 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #2954 +/- ##
========================================
Coverage 98.63% 98.63%
========================================
Files 70 70
Lines 2052 2056 +4
Branches 625 626 +1
========================================
+ Hits 2024 2028 +4
Misses 28 28 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
oxc-minifydoes not throw on a syntax error. It returnscode: ""and puts the error inresult.errors. The compressor ignorederrors, so a syntax error came out asNo content provided, or as a silent empty success withallowEmptyOutput.Warnings and advice still pass through.
String(error.severity)is used becauseSeverityis an ambientconst enum, whichisolatedModulescannot read.Evidence
Real oxc on
tests/fixtures/js-errors:No content providedoxc minification failed: Cannot assign to this expressionallowEmptyOutput: true""oxc minification failed: Cannot assign to this expressionNew tests in
oxc-error.test.ts: anErrorseverity rejects, a warning alone resolves.oxc.test.ts"should throw" now checks the message.bun run test packages/oxc: 24 pass.Merge Danger
Door: two-way
Blast Radius: oxc users
Input oxc cannot parse now fails loudly instead of producing an empty file. Changeset:
@node-minify/oxcpatch.Summary by cubic
Fixes the oxc compressor silently succeeding on unparseable input.
oxc-minifydoes not throw on a syntax error; it returns empty code and puts the error inresult.errors, which the compressor previously ignored. The compressor now throwsoxc minification failed: <error messages>when oxc reports an error severity, so invalid JavaScript fails loudly instead of yielding "No content provided" or silently passing withallowEmptyOutput. Warnings and advice still pass through.Testing
Written for commit 5b87896. Summary will update on new commits.