astro-routify 1.2.0 → 1.2.1

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
@@ -86,7 +86,6 @@ endpoint system.
86
86
  - `streamJsonArray()` — server-side streamed JSON arrays
87
87
 
88
88
  > 🔄 See [CHANGELOG.md](./CHANGELOG.md) for recent updates and improvements.
89
-
90
89
  ---
91
90
 
92
91
  ## 🧠 Core Concepts
@@ -172,7 +171,7 @@ fileResponse(content, "application/pdf", "report.pdf"); // sets Content-Type and
172
171
  ```ts
173
172
  stream('/clock', async ({response}) => {
174
173
  const timer = setInterval(() => {
175
- response.write(`data: ${new Date().toISOString()}\n\n`);
174
+ response.write(new Date().toISOString());
176
175
  }, 1000);
177
176
 
178
177
  setTimeout(() => {
@@ -35,7 +35,9 @@ export function stream(path, handler, options) {
35
35
  write: (chunk) => {
36
36
  if (closed || !controllerRef)
37
37
  return;
38
- const bytes = typeof chunk === 'string' ? encoder.encode(chunk) : chunk;
38
+ const bytes = typeof chunk === 'string' ?
39
+ encoder.encode(`data: ${chunk}\n\n`)
40
+ : chunk;
39
41
  controllerRef.enqueue(bytes);
40
42
  },
41
43
  close: () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "astro-routify",
3
- "version": "1.2.0",
3
+ "version": "1.2.1",
4
4
  "description": "A high-performance API router for Astro using a Trie-based matcher.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",