Skip to content

chore: Scaffold @launchdarkly/eventsource with transport-independent core modules - #2029

Open
joker23 wants to merge 1 commit into
mainfrom
skz/sdk-3147/common-eventsource-scaffold-helpers
Open

joker23 wants to merge 1 commit into
mainfrom
skz/sdk-3147/common-eventsource-scaffold-helpers

Conversation

@joker23

@joker23 joker23 commented Sep 18, 2026 •

Copy link
Copy Markdown
Contributor

Summary

This PR scaffolds @launchdarkly/eventsource, a new shared package that will hold a fetch-based EventSource (server-sent events) client for the LaunchDarkly SDKs. This first slice contains the package skeleton and the transport-independent core modules only; the client itself arrives in the next PR in the stack.

Package scaffold:

  • packages/shared/eventsource at version 0.0.1, with dual ESM/CJS output via tsup, jest, oxlint/oxfmt, and typedoc.
  • CI workflow, release-please wiring, and docs-publish registration.

Core modules (no client or transport logic yet):

  • httpHelpers.ts: structural types for the exact WHATWG fetch subset the client uses (FetchFn, FetchResponse, and friends). Any fetch-shaped transport can satisfy them, and the published declarations resolve without the DOM lib.
  • Event.ts / types.ts: the event payload types (MessageEvent, ErrorEvent, OpenEvent, RetryingEvent, ClosedEvent), the typed EventSourceEventMap, and the pluggable EventListenerRegistry contract. The payload shapes stay interchangeable with the platform types in @launchdarkly/js-sdk-common; the typeCompatibility suite (added with the client) enforces this.
  • listenerRegistry.ts: the default Map-backed registry. Its add/remove/dispatch semantics match Node's EventEmitter, so an emitter-backed substitute stays interchangeable, except that dispatch of a listenerless error type never throws.
  • retryDelay.ts: the backoff/jitter retry-delay strategy, with a reset interval for connections that stay healthy.
  • parsing.ts / capacity.ts: SSE byte constants, BOM handling, reconnect header-value validation, and buffer growth calculation.

Unit tests cover the registry, retry delay, and capacity modules.


Note

Overview
Introduces @launchdarkly/eventsource (packages/shared/eventsource) as a new shared workspace package (v0.0.1) with build/test/lint tooling, dual ESM/CJS output, TypeDoc, license/changelog, and a dedicated GitHub Actions workflow. The root package.json workspace list and tsconfig.json project reference are updated to include the package.

This slice is scaffolding plus transport-independent building blocks for a future fetch-based SSE client—the public index still notes that the full EventSource implementation is coming later. Added modules include fetch-shaped transport types (httpHelpers), W3C-aligned event payloads and EventSourceInitDict (Event, types), a default EventListenerRegistry with EventEmitter-like semantics, reconnect retry delay (backoff/jitter/reset), SSE parsing constants and header validation (parsing), and stream buffer capacity growth (capacity).

Unit tests cover the registry, retry strategy, and capacity logic; Jest is configured with maxWorkers: 1 to avoid port collisions from test helpers.

Reviewed by Cursor Bugbot for commit 19c679b. Bugbot is set up for automated code reviews on this repo. Configure here.

@joker23
joker23 added this pull request to stack #2035 September 18, 2026 20:32
@github-actions

github-actions Bot commented Sep 18, 2026 •

Copy link
Copy Markdown
Contributor

@launchdarkly/js-sdk-common size report
This is the brotli compressed size of the ESM build.
Compressed size: 27065 bytes
Compressed size limit: 29000
Uncompressed size: 131676 bytes

@github-actions

Copy link
Copy Markdown
Contributor

@launchdarkly/js-client-sdk-common size report
This is the brotli compressed size of the ESM build.
Compressed size: 25437 bytes
Compressed size limit: 44000
Uncompressed size: 165420 bytes

@github-actions

github-actions Bot commented Sep 18, 2026 •

Copy link
Copy Markdown
Contributor

@launchdarkly/js-client-sdk size report
This is the brotli compressed size of the ESM build.
Compressed size: 32573 bytes
Compressed size limit: 34000
Uncompressed size: 116865 bytes

@joker23
joker23 force-pushed the skz/sdk-3147/common-eventsource-scaffold-helpers branch from 31bbcc9 to 7973beb Compare September 18, 2026 20:54
@joker23
joker23 force-pushed the skz/sdk-3147/common-eventsource-scaffold-helpers branch from 7973beb to 2052981 Compare September 18, 2026 21:35
@joker23
joker23 force-pushed the skz/sdk-3147/common-eventsource-scaffold-helpers branch from 2052981 to d295aec Compare September 21, 2026 13:43
@joker23
joker23 force-pushed the skz/sdk-3147/common-eventsource-scaffold-helpers branch 2 times, most recently from 898b24f to 1be3dfe Compare September 22, 2026 14:11
Base automatically changed from skz/sdk-3073/common-eventsource-fdv2-error-handling to main September 22, 2026 19:43
@joker23
joker23 force-pushed the skz/sdk-3147/common-eventsource-scaffold-helpers branch 5 times, most recently from 545356d to e258d54 Compare September 23, 2026 16:32
@joker23
joker23 marked this pull request as ready for review September 23, 2026 16:46
@joker23
joker23 requested a review from a team as a code owner September 23, 2026 16:46

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔍 Devin Review: 2 flags

Not posted on this PR by your GitHub settings — view them in Devin Review. (Configure)

Devin Review

@joker23
joker23 force-pushed the skz/sdk-3147/common-eventsource-scaffold-helpers branch from e258d54 to bfbb399 Compare September 23, 2026 19:26
@joker23
joker23 force-pushed the skz/sdk-3147/common-eventsource-scaffold-helpers branch from bfbb399 to 19c679b Compare September 24, 2026 14:07

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant