feature/stream api - #2
Merged
Merged
Conversation
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.
This pull request introduces major API improvements and refactoring, focusing on a clearer separation of concerns between core modules and public API, as well as new streaming APIs for JSON token processing. It also includes minor workflow and configuration updates. The most important changes are grouped below.
API Refactoring and Public Surface Expansion:
src/api/decoder.tsandsrc/api/encoder.tsforJSONTextDecoderandJSONTextEncoder, with expanded, well-documented interfaces and additional methods for stateful, incremental processing. The old implementations insrc/libs/decoder.tsandsrc/libs/encoder.tswere removed. [1] [2] [3] [4]src/index.tsexport surface to include new types and classes: streaming decoder/encoder/line/selector,Kind,Token,Value, and error types, enabling more granular and flexible usage for library consumers.Streaming API Additions:
JSONTextDecoderStreamandJSONTextEncoderStreamclasses insrc/libs/stream-decoder.tsandsrc/libs/stream-encoder.ts, providing TransformStreams for incremental token-based JSON decoding and encoding, with options for custom queuing strategies. [1] [2]Core Constants and Error Handling Improvements:
ASCIIconstants and introducedSELECTORandSEGMENTenums insrc/common/constants.tsfor future extensibility and selector/segment support. [1] [2] [3] [4]SyntacticErrorclass insrc/common/errors.tsto use a plain string pointer and clarified error message formatting/documentation.Project Configuration and Workflow Updates:
actions/checkout@v6and setGITHUB_TOKENin the test environment. [1] [2]deno.jsonandpackage.jsonscripts, including new tasks for benchmarking and improved formatting for linting and exclusion rules. [1] [2] [3]