feat: migrate to typescript and expose a hook for parsing ndjson - #9
Merged
Conversation
Rename src to .ts and type the hooks, so the public API types live in the source and tsdown generates the .d.ts (dropping the hand-written typings that could drift). Add tsconfig and a typecheck step; oxlint, Vitest, and the build already handle TypeScript natively. Assisted-by: Claude:claude-opus-4-8
Add BOM stripping, id-with-NUL rejection, non-numeric retry, and colon-less field lines to raise branch coverage. Assisted-by: Claude:claude-opus-4-8
useStream wraps each reader.read() chunk as-is without buffering or splitting, so framing (e.g. NDJSON) is the caller's responsibility. Document the contract in the README and in the source. Assisted-by: Claude:claude-opus-4-8
Stream NDJSON with a streaming decoder and line buffer, calling onData with each parsed line. Standalone rather than wrapping useStream, so multi-byte characters split across chunk boundaries are not corrupted. Assisted-by: Claude:claude-opus-4-8
rolandjitsu
enabled auto-merge (rebase)
August 9, 2026 03:38
rolandjitsu
disabled auto-merge
August 9, 2026 03:38
|
🎉 This PR is included in version 1.3.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
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.
What kind of change does this PR introduce?
Did you add tests for your changes?
If relevant, did you update the documentation?
Summary
useNdjsonStream()hook.Does this PR introduce a breaking change?
No.
Other information