better-sse 0.15.0 → 0.16.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,10 +1,19 @@
1
1
  # Better SSE
2
2
 
3
3
  <p>
4
- <img src="https://img.shields.io/npm/v/better-sse?color=blue&style=flat-square" />
5
- <img src="https://img.shields.io/npm/l/better-sse?color=green&style=flat-square" />
6
- <img src="https://img.shields.io/npm/dt/better-sse?color=grey&style=flat-square" />
7
- <a href="https://github.com/MatthewWid/better-sse"><img src="https://img.shields.io/github/stars/MatthewWid/better-sse?style=social" /></a>
4
+ <a href="https://www.npmjs.com/package/better-sse">
5
+ <img src="https://img.shields.io/npm/v/better-sse?color=blue&style=flat-square" alt="npm" />
6
+ </a>
7
+ <a href="https://jsr.io/@mwid/better-sse">
8
+ <img src="https://jsr.io/badges/@mwid/better-sse" alt="jsr" />
9
+ </a>
10
+ <a href="https://github.com/MatthewWid/better-sse/blob/master/LICENSE">
11
+ <img src="https://img.shields.io/npm/l/better-sse?color=green&style=flat-square" alt="MIT license" />
12
+ </a>
13
+ <img src="https://img.shields.io/npm/dt/better-sse?color=grey&style=flat-square" alt="Downloads" />
14
+ <a href="https://github.com/MatthewWid/better-sse">
15
+ <img src="https://img.shields.io/github/stars/MatthewWid/better-sse?style=social" alt="GitHub stars" />
16
+ </a>
8
17
  </p>
9
18
 
10
19
  A dead simple, dependency-less, spec-compliant server-sent events implementation written in TypeScript.
@@ -30,7 +39,7 @@ Read the [Getting Started](https://matthewwid.github.io/better-sse/guides/gettin
30
39
 
31
40
  ## Highlights
32
41
 
33
- * Compatible with all popular HTTP frameworks ([Express](https://nodejs.org/api/http.html), [Hono](https://hono.dev/), [Fastify](https://fastify.dev/), [Nest](https://nestjs.com/), [Next.js](https://nextjs.org/), [Bun](https://bun.sh/docs/api/http), [Deno](https://docs.deno.com/runtime/fundamentals/http_server/), [etc.](https://matthewwid.github.io/better-sse/reference/recipes/))
42
+ * Compatible with all popular frameworks and runtimes ([Express](https://nodejs.org/api/http.html), [Hono](https://hono.dev/), [Fastify](https://fastify.dev/), [Nest](https://nestjs.com/), [Next.js](https://nextjs.org/), [Bun](https://bun.sh/docs/api/http), [Deno](https://docs.deno.com/runtime/fundamentals/http_server/), [etc.](https://matthewwid.github.io/better-sse/reference/recipes/))
34
43
  * Fully written in TypeScript (+ ships with types directly).
35
44
  * [Thoroughly tested](./src/Session.test.ts) (+ 100% code coverage!).
36
45
  * [Comprehensively documented](https://matthewwid.github.io/better-sse) with guides and API documentation.
@@ -47,7 +56,7 @@ Read the [Getting Started](https://matthewwid.github.io/better-sse/guides/gettin
47
56
 
48
57
  # Installation
49
58
 
50
- Install with any package manager:
59
+ Better SSE is published as a package on [npm](https://www.npmjs.com/package/better-sse) and the [JSR](https://jsr.io/@mwid/better-sse). You can install it with any package manager:
51
60
 
52
61
  ```sh
53
62
  npm install better-sse
@@ -66,7 +75,7 @@ bun add better-sse
66
75
  ```
67
76
 
68
77
  ```sh
69
- deno install npm:better-sse
78
+ deno install jsr:@mwid/better-sse
70
79
  ```
71
80
 
72
81
  _Better SSE ships with types built in. No need to install from DefinitelyTyped for TypeScript users!_
@@ -106,7 +115,7 @@ app.get("/sse", (c) =>
106
115
  // Client
107
116
  const eventSource = new EventSource("/sse")
108
117
 
109
- eventSource.addEventListener("message", ({ data })) => {
118
+ eventSource.addEventListener("message", ({ data }) => {
110
119
  const contents = JSON.parse(data)
111
120
  console.log(contents) // Hello world!
112
121
  })
@@ -158,7 +167,7 @@ Check the [API documentation](https://matthewwid.github.io/better-sse/reference/
158
167
 
159
168
  # Documentation
160
169
 
161
- API documentation, getting started guides and usage with other frameworks is [available on the documentation website](https://matthewwid.github.io/better-sse/).
170
+ See [the documentation website](https://matthewwid.github.io/better-sse/) for guides, usage examples, compatibility information and an API reference.
162
171
 
163
172
  # Contributing
164
173
 
@@ -203,6 +212,29 @@ Bundle for distribution (with [tsup](https://tsup.egoist.dev/)):
203
212
  pnpm build
204
213
  ```
205
214
 
215
+ ## Documentation
216
+
217
+ The documentation is built with [Astro](https://astro.build/) and [Starlight](https://starlight.astro.build/). Its source is located in the `docs` directory.
218
+
219
+ Install dependencies:
220
+
221
+ ```bash
222
+ cd docs
223
+ pnpm i
224
+ ```
225
+
226
+ Run development server:
227
+
228
+ ```bash
229
+ pnpm dev
230
+ ```
231
+
232
+ Build for distribution:
233
+
234
+ ```bash
235
+ pnpm build
236
+ ```
237
+
206
238
  # License
207
239
 
208
240
  This project is licensed under the [MIT license](https://opensource.org/license/mit/).