fix: fail dts builds when the worker dies without a result - #1414
Open
cpruijsen wants to merge 1 commit into
Open
fix: fail dts builds when the worker dies without a result#1414cpruijsen wants to merge 1 commit into
cpruijsen wants to merge 1 commit into
Conversation
Otherwise tsup exits 0 with a declaration-less dist/, which caches as a successful build.
Review or Edit in CodeSandboxOpen the branch in Web Editor • VS Code • Insiders |
|
@cpruijsen is attempting to deploy a commit to the EGOIST's projects Team on Vercel. A member of the Team first needs to authorize it. |
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
--dtslistens for'error'and'exit'on the dts worker and rejects withdts build worker exited with code ${code} without reporting a result. A DTS pass that produced nothing now fails the build.The parent promise used to settle only on
worker'message'('success'/'error'). If the worker died without posting a result, that promise stayed pending, the event loop drained, and tsup exited 0 with JS indist/and no.d.tsfiles. Build caches then stored that artifact as a success; consumers later sawTS7016.Closes #1410
Decision
Both
'error'and'exit'handlers,reject(new Error(...)), nosettledflag. Alternative:PrettyError(message-only CLI output) and/or a boolean so'exit'afterterminate()is ignored explicitly.This is the patch the issue verified on 8.5.1, and it matches the existing dts-worker failure
reject(new Error('error occurred in dts build')). Rejecting an already-resolved promise is a no-op; existing--dtstests still pass. Can switch toPrettyErroror a settled guard.Test plan
vitest run test/dts.test.ts -t "dts worker exiting without a result"fails without the handlers (exit 0, no.d.ts), passes with them (exit 1, error names the worker)vitest run test/dts.test.tsall 13 dts tests pass (healthy declaration emit unchanged)vitest run96 tests passed locally (Node 26, darwin)