@pylonsync/react 0.3.280 → 0.3.281
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/package.json +3 -3
- package/src/index.ts +2 -0
- package/src/ssr.ts +38 -0
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "0.3.
|
|
6
|
+
"version": "0.3.281",
|
|
7
7
|
"type": "module",
|
|
8
8
|
"main": "src/index.ts",
|
|
9
9
|
"types": "src/index.ts",
|
|
@@ -12,8 +12,8 @@
|
|
|
12
12
|
"check": "tsc -p tsconfig.json --noEmit"
|
|
13
13
|
},
|
|
14
14
|
"dependencies": {
|
|
15
|
-
"@pylonsync/sdk": "0.3.
|
|
16
|
-
"@pylonsync/sync": "0.3.
|
|
15
|
+
"@pylonsync/sdk": "0.3.281",
|
|
16
|
+
"@pylonsync/sync": "0.3.281"
|
|
17
17
|
},
|
|
18
18
|
"peerDependencies": {
|
|
19
19
|
"react": ">=19.0.0"
|
package/src/index.ts
CHANGED
package/src/ssr.ts
CHANGED
|
@@ -396,3 +396,41 @@ export type RouteHandler<
|
|
|
396
396
|
TParams extends Record<string, string> = Record<string, string>,
|
|
397
397
|
TSearchParams extends Record<string, string> = Record<string, string>,
|
|
398
398
|
> = (req: FormRequest<TParams, TSearchParams>) => void | Promise<void>;
|
|
399
|
+
|
|
400
|
+
/**
|
|
401
|
+
* What a `route.ts` `GET` (raw) handler returns. The body is streamed verbatim
|
|
402
|
+
* with `contentType` (default `text/plain; charset=utf-8`), `status` (default
|
|
403
|
+
* 200), and any extra `headers` — no React render, no hydration tail. This is
|
|
404
|
+
* the GET analogue of `sitemap.ts`/`robots.ts`, at an arbitrary route path:
|
|
405
|
+
* RSS/Atom feeds, dynamic XML, plain text, JSON, `.well-known` documents.
|
|
406
|
+
*/
|
|
407
|
+
export interface RawResponse {
|
|
408
|
+
body?: string;
|
|
409
|
+
/** Defaults to `text/plain; charset=utf-8`. */
|
|
410
|
+
contentType?: string;
|
|
411
|
+
/** Defaults to 200. */
|
|
412
|
+
status?: number;
|
|
413
|
+
/** Extra response headers (e.g. `cache-control`). Lower-cased by the host. */
|
|
414
|
+
headers?: Record<string, string>;
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
/**
|
|
418
|
+
* Signature of a `route.ts` `GET` export — a RAW handler. Return a
|
|
419
|
+
* {@link RawResponse} to stream a body, or use `response.redirect()` /
|
|
420
|
+
* `response.notFound()` and return nothing.
|
|
421
|
+
*
|
|
422
|
+
* ```ts
|
|
423
|
+
* import type { RawRouteHandler } from "@pylonsync/react";
|
|
424
|
+
* export const GET: RawRouteHandler = async () => ({
|
|
425
|
+
* body: "<rss>…</rss>",
|
|
426
|
+
* contentType: "application/xml; charset=utf-8",
|
|
427
|
+
* headers: { "cache-control": "public, max-age=300" },
|
|
428
|
+
* });
|
|
429
|
+
* ```
|
|
430
|
+
*/
|
|
431
|
+
export type RawRouteHandler<
|
|
432
|
+
TParams extends Record<string, string> = Record<string, string>,
|
|
433
|
+
TSearchParams extends Record<string, string> = Record<string, string>,
|
|
434
|
+
> = (
|
|
435
|
+
req: FormRequest<TParams, TSearchParams>,
|
|
436
|
+
) => RawResponse | void | Promise<RawResponse | void>;
|