@rshono/core 1.0.0-rc.6 → 1.0.0-rc.8
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 +195 -168
- package/dist/builder/page-files.d.ts.map +1 -1
- package/dist/builder/page-files.js +7 -3
- package/dist/builder/page-files.js.map +1 -1
- package/dist/builder/public-env.d.ts +6 -0
- package/dist/builder/public-env.d.ts.map +1 -1
- package/dist/builder/public-env.js +6 -0
- package/dist/builder/public-env.js.map +1 -1
- package/dist/builder/rspack-config.d.ts.map +1 -1
- package/dist/builder/rspack-config.js +16 -19
- package/dist/builder/rspack-config.js.map +1 -1
- package/dist/cli/dev.d.ts.map +1 -1
- package/dist/cli/dev.js +63 -35
- package/dist/cli/dev.js.map +1 -1
- package/dist/cli/index.js +3 -4
- package/dist/cli/index.js.map +1 -1
- package/dist/config.d.ts +56 -55
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +17 -1
- package/dist/config.js.map +1 -1
- package/dist/deploy/contract.d.ts +15 -10
- package/dist/deploy/contract.d.ts.map +1 -1
- package/dist/deploy/contract.js.map +1 -1
- package/dist/deploy/filesystem.d.ts.map +1 -1
- package/dist/deploy/filesystem.js +6 -7
- package/dist/deploy/filesystem.js.map +1 -1
- package/dist/deploy/node/runtime.d.ts +5 -5
- package/dist/deploy/node/runtime.d.ts.map +1 -1
- package/dist/deploy/node/runtime.js +7 -11
- package/dist/deploy/node/runtime.js.map +1 -1
- package/dist/deploy/presets.d.ts +2 -6
- package/dist/deploy/presets.d.ts.map +1 -1
- package/dist/deploy/presets.js +2 -6
- package/dist/deploy/presets.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -3
- package/dist/index.js.map +1 -1
- package/dist/router.d.ts +74 -36
- package/dist/router.d.ts.map +1 -1
- package/dist/router.js +2 -3
- package/dist/router.js.map +1 -1
- package/dist/runtime/boundaries.d.ts +10 -0
- package/dist/runtime/boundaries.d.ts.map +1 -1
- package/dist/runtime/boundaries.js +6 -0
- package/dist/runtime/boundaries.js.map +1 -1
- package/dist/runtime/client.d.ts +5 -3
- package/dist/runtime/client.d.ts.map +1 -1
- package/dist/runtime/client.js +5 -3
- package/dist/runtime/client.js.map +1 -1
- package/dist/runtime/context.d.ts +195 -45
- package/dist/runtime/context.d.ts.map +1 -1
- package/dist/runtime/context.js +277 -59
- package/dist/runtime/context.js.map +1 -1
- package/dist/runtime/control.d.ts.map +1 -1
- package/dist/runtime/control.js +7 -0
- package/dist/runtime/control.js.map +1 -1
- package/dist/runtime/entry.client.js +29 -47
- package/dist/runtime/entry.client.js.map +1 -1
- package/dist/runtime/entry.rsc.d.ts.map +1 -1
- package/dist/runtime/entry.rsc.js +109 -140
- package/dist/runtime/entry.rsc.js.map +1 -1
- package/dist/runtime/flight-inject.d.ts +4 -4
- package/dist/runtime/flight-inject.js +2 -2
- package/dist/runtime/flight-inject.js.map +1 -1
- package/dist/runtime/navigation.d.ts +11 -0
- package/dist/runtime/navigation.d.ts.map +1 -1
- package/dist/runtime/navigation.js +3 -0
- package/dist/runtime/navigation.js.map +1 -1
- package/dist/runtime/request.d.ts +3 -3
- package/dist/runtime/request.js +3 -3
- package/dist/runtime/request.js.map +1 -1
- package/dist/runtime/server.d.ts +7 -12
- package/dist/runtime/server.d.ts.map +1 -1
- package/dist/runtime/server.js +15 -12
- package/dist/runtime/server.js.map +1 -1
- package/dist/server/prerendered.d.ts +20 -35
- package/dist/server/prerendered.d.ts.map +1 -1
- package/dist/server/prerendered.js +8 -18
- package/dist/server/prerendered.js.map +1 -1
- package/dist/server/server-config.d.ts +10 -29
- package/dist/server/server-config.d.ts.map +1 -1
- package/dist/server/server-config.js +4 -70
- package/dist/server/server-config.js.map +1 -1
- package/dist/server/ssg.d.ts.map +1 -1
- package/dist/server/ssg.js +10 -11
- package/dist/server/ssg.js.map +1 -1
- package/package.json +1 -1
|
@@ -18,8 +18,21 @@ import type { CookieOptions } from 'hono/utils/cookie';
|
|
|
18
18
|
* - `302` Found, `307` Temporary Redirect — temporary.
|
|
19
19
|
* - `303` See Other — the default; forces a `GET` on the target, which is what
|
|
20
20
|
* you almost always want after a form action (post/redirect/get).
|
|
21
|
+
*
|
|
22
|
+
* @see {@link https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Status#redirection_messages | MDN — redirection status codes}
|
|
21
23
|
*/
|
|
22
24
|
export type RedirectStatus = 301 | 302 | 303 | 307 | 308;
|
|
25
|
+
/**
|
|
26
|
+
* Marks the request as having entered its page render, which is what makes
|
|
27
|
+
* {@link RequestContext.setHeader} and `ctx.cookies.set()` start throwing.
|
|
28
|
+
*
|
|
29
|
+
* Framework internal — `renderComponent` calls this immediately before handing the page to React.
|
|
30
|
+
* Everything that legitimately writes to the response (middleware, a `'use server'` action, an
|
|
31
|
+
* endpoint route) has already run by then, so none of them are affected.
|
|
32
|
+
*
|
|
33
|
+
* @internal
|
|
34
|
+
*/
|
|
35
|
+
export declare function beginPageRender(c: Context): void;
|
|
23
36
|
/**
|
|
24
37
|
* Runs `fn` with the given Hono {@link Context} bound as the ambient request
|
|
25
38
|
* context, so that {@link getRequestContext} resolves to it anywhere in the call tree.
|
|
@@ -31,35 +44,53 @@ export type RedirectStatus = 301 | 302 | 303 | 307 | 308;
|
|
|
31
44
|
*/
|
|
32
45
|
export declare function runWithContext<T>(c: Context, fn: () => T): T;
|
|
33
46
|
/**
|
|
34
|
-
*
|
|
35
|
-
* active route match (rather than throwing), so the fallback behaviour stays in
|
|
36
|
-
* one place.
|
|
47
|
+
* The matched route params, or an empty object when there is no active match.
|
|
37
48
|
*
|
|
38
|
-
* Framework internal — the request renderer calls this to build a page's `params`
|
|
39
|
-
*
|
|
49
|
+
* Framework internal — the request renderer calls this to build a page's `params` prop, and
|
|
50
|
+
* {@link RequestContext.params} caches it. Read them from that prop, or from `ctx.params`.
|
|
40
51
|
*
|
|
41
52
|
* @internal
|
|
42
53
|
*/
|
|
43
54
|
export declare function readParams(c: Context): Record<string, string>;
|
|
44
55
|
/**
|
|
45
|
-
* Resolves the browser-facing {@link URL} for a request.
|
|
56
|
+
* Resolves the browser-facing {@link URL} for a request, from a Hono {@link Context}.
|
|
46
57
|
*
|
|
47
|
-
* `c.req.url` reflects the internal address the server was reached on, which is wrong behind a
|
|
48
|
-
*
|
|
49
|
-
* `
|
|
50
|
-
*
|
|
51
|
-
*
|
|
52
|
-
* poison a shared cache with them. So the default is to ignore them entirely.
|
|
58
|
+
* `c.req.url` reflects the internal address the server was reached on, which is wrong behind a proxy.
|
|
59
|
+
* `X-Forwarded-Host` / `X-Forwarded-Proto` fix that up — **but only when `trustProxy` is enabled in
|
|
60
|
+
* `rshono.config.ts`** (always so under `rshono dev`). They are client-supplied, so honouring them
|
|
61
|
+
* unconditionally would let anyone who can reach the server dictate the origin of every absolute URL
|
|
62
|
+
* the app builds, and poison a shared cache with it.
|
|
53
63
|
*
|
|
54
|
-
*
|
|
64
|
+
* This is the form for **middleware**, which is handed `c` and runs outside the request context. In
|
|
65
|
+
* a server component or a `'use server'` action prefer {@link RequestContext.url}, which is this same
|
|
66
|
+
* value cached per request.
|
|
55
67
|
*
|
|
56
|
-
*
|
|
68
|
+
* Its main use is giving Hono's own middleware the origin the browser actually used, since they all
|
|
69
|
+
* read `c.req.url` on their own and so see the internal one:
|
|
70
|
+
*
|
|
71
|
+
* @example
|
|
72
|
+
* ```ts
|
|
73
|
+
* // src/server.ts — a CSRF check that still works behind a proxy that rewrites Host
|
|
74
|
+
* import { publicUrl } from '@rshono/core/server';
|
|
75
|
+
* import { csrf } from 'hono/csrf';
|
|
76
|
+
*
|
|
77
|
+
* server.use(csrf({ origin: (origin, c) => origin === publicUrl(c).origin }));
|
|
78
|
+
* ```
|
|
79
|
+
*
|
|
80
|
+
* A fresh instance per call, so mutating it disturbs nothing else.
|
|
81
|
+
*
|
|
82
|
+
* @param c - The Hono {@link Context} for the request.
|
|
83
|
+
* @returns The browser-facing URL — proxy-corrected under `trustProxy`, `c.req.url` otherwise.
|
|
84
|
+
*
|
|
85
|
+
* @see {@link https://www.rshono.com/docs/configuration#proxy-headers | Docs — proxy headers}
|
|
57
86
|
*/
|
|
58
87
|
export declare function publicUrl(c: Context): URL;
|
|
59
88
|
/**
|
|
60
89
|
* The environment available to a request: Cloudflare/Workers `Bindings` merged
|
|
61
90
|
* with process env vars. Values not declared in `Bindings` are typed as
|
|
62
91
|
* `string | undefined`. See {@link RequestContext.env}.
|
|
92
|
+
*
|
|
93
|
+
* @see {@link https://hono.dev/docs/getting-started/cloudflare-workers#bindings | Hono — bindings}
|
|
63
94
|
*/
|
|
64
95
|
export type EnvVars<E extends Env> = E['Bindings'] & Record<string, string | undefined>;
|
|
65
96
|
/**
|
|
@@ -84,37 +115,87 @@ export type EnvVars<E extends Env> = E['Bindings'] & Record<string, string | und
|
|
|
84
115
|
* return <p>{ctx.url.pathname} — {session ?? 'anonymous'}</p>;
|
|
85
116
|
* }
|
|
86
117
|
* ```
|
|
118
|
+
*
|
|
119
|
+
* @see {@link https://www.rshono.com/docs/api#rshonocoreserver | Docs — `@rshono/core/server`}
|
|
120
|
+
* @see {@link https://hono.dev/docs/api/context | Hono — Context}, reachable in full via {@link RequestContext.hono}
|
|
87
121
|
*/
|
|
88
122
|
export declare class RequestContext<E extends Env = Env> {
|
|
89
123
|
#private;
|
|
124
|
+
/**
|
|
125
|
+
* Framework internal — one instance is created per request and handed to you by
|
|
126
|
+
* {@link getRequestContext} or the `ctx` page prop. Application code never calls this.
|
|
127
|
+
*
|
|
128
|
+
* @internal
|
|
129
|
+
*/
|
|
90
130
|
constructor(c: Context<E>);
|
|
91
131
|
/**
|
|
92
|
-
* The underlying Hono {@link Context}
|
|
93
|
-
*
|
|
94
|
-
*
|
|
95
|
-
*
|
|
96
|
-
*
|
|
97
|
-
*
|
|
132
|
+
* The underlying Hono {@link Context} — the escape hatch for what this wrapper does not expose,
|
|
133
|
+
* such as `executionCtx.waitUntil()` on Workers.
|
|
134
|
+
*
|
|
135
|
+
* Its response builders (`redirect`, `notFound`, `json`, `body`, `status`, …) still do nothing from
|
|
136
|
+
* inside a page, for the reason the stubs on this class explain: reaching them through here
|
|
137
|
+
* bypasses the error, it does not make them work.
|
|
138
|
+
*
|
|
139
|
+
* @example
|
|
140
|
+
* ```ts
|
|
141
|
+
* getRequestContext().hono.executionCtx.waitUntil(logAsync()); // Workers
|
|
142
|
+
* ```
|
|
143
|
+
*
|
|
144
|
+
* @see {@link https://hono.dev/docs/api/context | Hono — Context}
|
|
145
|
+
*/
|
|
146
|
+
get hono(): Context<E>;
|
|
147
|
+
/**
|
|
148
|
+
* The parsed request — method, headers, path params, query and the body readers. Hono's
|
|
149
|
+
* {@link Context.req}, unwrapped, so `ctx.req.header('authorization')` rather than
|
|
150
|
+
* `ctx.hono.req.header(…)`.
|
|
151
|
+
*
|
|
152
|
+
* Reads only. Setting a *response* header is {@link RequestContext.setHeader}, deliberately in a
|
|
153
|
+
* different place — Hono's `c.header()` writing the response while `c.req.header()` reads the
|
|
154
|
+
* request is a well-worn source of confusion.
|
|
155
|
+
*
|
|
156
|
+
* @example
|
|
157
|
+
* ```ts
|
|
158
|
+
* const ctx = getRequestContext();
|
|
159
|
+
* ctx.req.method; // 'GET'
|
|
160
|
+
* ctx.req.header('authorization'); // string | undefined
|
|
161
|
+
* ctx.req.query('tab'); // string | undefined
|
|
162
|
+
* ```
|
|
163
|
+
*
|
|
164
|
+
* @see {@link https://hono.dev/docs/api/request | Hono — HonoRequest}
|
|
165
|
+
*/
|
|
166
|
+
get req(): Context<E>['req'];
|
|
167
|
+
/**
|
|
168
|
+
* Matched route params for this request, e.g. `{ id: '42' }` for `/profile/:id`. Empty when there
|
|
169
|
+
* is no active route match.
|
|
98
170
|
*
|
|
99
|
-
* A
|
|
100
|
-
*
|
|
101
|
-
*
|
|
102
|
-
* limit and no cycle guard, and the Hono context graph reaches the socket and the whole server
|
|
103
|
-
* through `req.raw` and `env`. While this was a plain property, passing a `RequestContext` to a `'use client'`
|
|
104
|
-
* component blew the stack *inside that message builder* — so React's actual, accurate "you cannot
|
|
105
|
-
* pass this" error never got printed. Hidden from `Object.keys`, the walk stops here.
|
|
171
|
+
* A **page** is handed the same record as its `params` prop, typed key-by-key from its route path,
|
|
172
|
+
* and that is the better read where it is available. This is for everywhere else — a nested server
|
|
173
|
+
* component, or a `'use server'` action — which get no props from the framework.
|
|
106
174
|
*/
|
|
107
|
-
get
|
|
175
|
+
get params(): Record<string, string>;
|
|
108
176
|
/**
|
|
109
|
-
* The browser-facing request URL
|
|
110
|
-
*
|
|
111
|
-
*
|
|
112
|
-
*
|
|
177
|
+
* The browser-facing request URL — read `url.pathname`, `url.searchParams` and the
|
|
178
|
+
* rest off it. Parsed once and cached, so the same instance comes back on every
|
|
179
|
+
* read within a request; treat it as read-only for that reason.
|
|
180
|
+
*
|
|
181
|
+
* `X-Forwarded-Host` / `-Proto` are honoured only when `trustProxy` is enabled in
|
|
182
|
+
* `rshono.config.ts`, since any client can send them.
|
|
183
|
+
*
|
|
184
|
+
* @see {@link https://www.rshono.com/docs/configuration#proxy-headers | Docs — proxy headers}
|
|
113
185
|
*/
|
|
114
186
|
get url(): URL;
|
|
115
187
|
/**
|
|
116
188
|
* Typed variables set by middleware via `c.set('user', …)`, read here as
|
|
117
189
|
* `ctx.var.user`. Type them by parameterising this class's {@link Env}.
|
|
190
|
+
*
|
|
191
|
+
* @example
|
|
192
|
+
* ```ts
|
|
193
|
+
* type AppEnv = { Variables: { user: { id: string } } };
|
|
194
|
+
* const { user } = getRequestContext<AppEnv>().var; // typed, set by your middleware
|
|
195
|
+
* ```
|
|
196
|
+
*
|
|
197
|
+
* @see {@link https://hono.dev/docs/api/context#var | Hono — c.var}
|
|
198
|
+
* @see {@link https://www.rshono.com/docs/hono#typing-the-context | Docs — typing the context}
|
|
118
199
|
*/
|
|
119
200
|
get var(): Readonly<E['Variables']>;
|
|
120
201
|
/**
|
|
@@ -122,6 +203,9 @@ export declare class RequestContext<E extends Env = Env> {
|
|
|
122
203
|
* (bindings win on conflict). Computed once and cached.
|
|
123
204
|
*
|
|
124
205
|
* @example `const key = getRequestContext().env.STRIPE_SECRET_KEY;`
|
|
206
|
+
*
|
|
207
|
+
* @see {@link https://hono.dev/docs/api/context#env | Hono — c.env}
|
|
208
|
+
* @see {@link https://www.rshono.com/docs/configuration#environment-and-secrets | Docs — environment and secrets}
|
|
125
209
|
*/
|
|
126
210
|
get env(): EnvVars<E>;
|
|
127
211
|
/**
|
|
@@ -134,29 +218,91 @@ export declare class RequestContext<E extends Env = Env> {
|
|
|
134
218
|
* ctx.cookies.set('session', id, { httpOnly: true, sameSite: 'Lax', path: '/' });
|
|
135
219
|
* ctx.cookies.delete('session', { path: '/' });
|
|
136
220
|
* ```
|
|
221
|
+
*
|
|
222
|
+
* @see {@link https://hono.dev/docs/helpers/cookie | Hono — cookie helper}, which this wraps
|
|
137
223
|
*/
|
|
138
224
|
cookies: {
|
|
139
|
-
/** Reads a single cookie by name, or `undefined` if absent. */
|
|
225
|
+
/** Reads a single cookie by name, or `undefined` if absent. Safe anywhere, a page included. */
|
|
140
226
|
get: (name: string) => string | undefined;
|
|
141
|
-
/** Reads every cookie as a `{ name: value }` record. */
|
|
227
|
+
/** Reads every cookie as a `{ name: value }` record. Safe anywhere, a page included. */
|
|
142
228
|
all: () => Record<string, string>;
|
|
143
|
-
/**
|
|
229
|
+
/**
|
|
230
|
+
* Sets a cookie on the response. See Hono's {@link CookieOptions} for `path`, `httpOnly`,
|
|
231
|
+
* `maxAge`, etc.
|
|
232
|
+
*
|
|
233
|
+
* **Throws inside a page render** — see {@link RequestContext.setHeader}, of which a `Set-Cookie`
|
|
234
|
+
* is a special case. Set cookies from a `'use server'` action, or with Hono's `setCookie(c, …)`
|
|
235
|
+
* in middleware and endpoint routes.
|
|
236
|
+
*
|
|
237
|
+
* @throws If called while a page is rendering, where it could not reach the browser reliably.
|
|
238
|
+
*
|
|
239
|
+
* @see {@link https://hono.dev/docs/helpers/cookie#options | Hono — cookie options}
|
|
240
|
+
*/
|
|
144
241
|
set: (name: string, value: string, options?: CookieOptions) => void;
|
|
145
|
-
/**
|
|
242
|
+
/**
|
|
243
|
+
* Clears a cookie. Pass the same `path`/`domain` it was set with so the browser matches it.
|
|
244
|
+
* Throws inside a page render, exactly as `set` does.
|
|
245
|
+
*
|
|
246
|
+
* @throws If called while a page is rendering.
|
|
247
|
+
*/
|
|
146
248
|
delete: (name: string, options?: CookieOptions) => void;
|
|
147
249
|
};
|
|
250
|
+
/**
|
|
251
|
+
* Sets a header on the response — from a `'use server'` action, which is the one place a request
|
|
252
|
+
* context exists *and* the response is still open.
|
|
253
|
+
*
|
|
254
|
+
* From inside a page it throws: a page streams, so by then the response head is committed. Hono's
|
|
255
|
+
* `c.header()` fails there silently and inconsistently — landing on a full page load, vanishing on
|
|
256
|
+
* a soft navigation — so this refuses rather than doing it half the time.
|
|
257
|
+
*
|
|
258
|
+
* Middleware and `{ type: 'endpoint' }` routes run outside the request context but are handed
|
|
259
|
+
* Hono's `c` directly, so they use `c.header(…)`. That is also where a header belonging to the
|
|
260
|
+
* *page* rather than to one action goes — `Cache-Control`, `X-Robots-Tag` — since middleware runs
|
|
261
|
+
* before the render.
|
|
262
|
+
*
|
|
263
|
+
* @param name - Header name, case-insensitive.
|
|
264
|
+
* @param value - Header value.
|
|
265
|
+
* @param options - `{ append: true }` to add another value rather than replace.
|
|
266
|
+
* @throws If called while a page is rendering, where it could not reach the browser reliably.
|
|
267
|
+
*
|
|
268
|
+
* @example
|
|
269
|
+
* ```ts
|
|
270
|
+
* 'use server';
|
|
271
|
+
* export async function logout() {
|
|
272
|
+
* const ctx = getRequestContext();
|
|
273
|
+
* ctx.cookies.delete('session', { path: '/' });
|
|
274
|
+
* ctx.setHeader('clear-site-data', '"cache", "storage"');
|
|
275
|
+
* redirect('/');
|
|
276
|
+
* }
|
|
277
|
+
* ```
|
|
278
|
+
*/
|
|
279
|
+
setHeader(name: string, value: string, options?: {
|
|
280
|
+
append?: boolean;
|
|
281
|
+
}): void;
|
|
282
|
+
/** @deprecated Not available on a page's context — use `redirect()` from `@rshono/core/server`. */
|
|
283
|
+
redirect(...args: unknown[]): never;
|
|
284
|
+
/** @deprecated Not available on a page's context — use `notFound()` from `@rshono/core/server`. */
|
|
285
|
+
notFound(...args: unknown[]): never;
|
|
286
|
+
/** @deprecated A page renders JSX. For a JSON response, use an `{ type: 'endpoint' }` route. */
|
|
287
|
+
json(...args: unknown[]): never;
|
|
288
|
+
/** @deprecated A page renders JSX. For a text response, use an `{ type: 'endpoint' }` route. */
|
|
289
|
+
text(...args: unknown[]): never;
|
|
290
|
+
/** @deprecated A page renders JSX, which the framework turns into HTML for you. */
|
|
291
|
+
html(...args: unknown[]): never;
|
|
292
|
+
/** @deprecated Not available on a page's context. To read the request body, use `ctx.req`. */
|
|
293
|
+
body(...args: unknown[]): never;
|
|
294
|
+
/** @deprecated A page's status is set by the framework — use `notFound()`, or an endpoint route. */
|
|
295
|
+
status(...args: unknown[]): never;
|
|
296
|
+
/** @deprecated Renamed — use `ctx.setHeader(name, value)`, which is valid from a `'use server'` action. */
|
|
297
|
+
header(...args: unknown[]): never;
|
|
148
298
|
}
|
|
149
299
|
/**
|
|
150
|
-
* Returns the {@link RequestContext} for the current request
|
|
300
|
+
* Returns the {@link RequestContext} for the current request — the URL, cookies, params, env and
|
|
301
|
+
* middleware variables, read from a server component or a server action. Memoised per request, so
|
|
302
|
+
* repeated calls return the same instance.
|
|
151
303
|
*
|
|
152
|
-
*
|
|
153
|
-
*
|
|
154
|
-
* variables. The returned wrapper is memoised per request, so repeated calls in
|
|
155
|
-
* the same request are cheap and return the same instance.
|
|
156
|
-
*
|
|
157
|
-
* A **page** component is handed the very same object as its `ctx` prop, so this
|
|
158
|
-
* import is for everywhere else: a nested server component, or a `'use server'`
|
|
159
|
-
* action module — neither of which receives props from the framework.
|
|
304
|
+
* A **page** component is handed that same object as its `ctx` prop, so this import is for everywhere
|
|
305
|
+
* else: a nested server component, or a `'use server'` action module.
|
|
160
306
|
*
|
|
161
307
|
* @typeParam E - The app's Hono {@link Env}, to type {@link RequestContext.var} and {@link RequestContext.env}.
|
|
162
308
|
* @throws If called at module load, where there is no ambient context to resolve.
|
|
@@ -173,6 +319,8 @@ export declare class RequestContext<E extends Env = Env> {
|
|
|
173
319
|
* redirect('/dashboard');
|
|
174
320
|
* }
|
|
175
321
|
* ```
|
|
322
|
+
*
|
|
323
|
+
* @see {@link https://www.rshono.com/docs/api#rshonocoreserver | Docs — `@rshono/core/server`}
|
|
176
324
|
*/
|
|
177
325
|
export declare function getRequestContext<E extends Env = Env>(): RequestContext<E>;
|
|
178
326
|
/**
|
|
@@ -251,6 +399,8 @@ export type ServerErrorHandler = (error: unknown, context: ServerErrorContext) =
|
|
|
251
399
|
* Sentry.captureException(error, { tags: { source }, extra: { url: request.url } });
|
|
252
400
|
* });
|
|
253
401
|
* ```
|
|
402
|
+
*
|
|
403
|
+
* @see {@link https://www.rshono.com/docs/hono#error-reporting | Docs — error reporting}
|
|
254
404
|
*/
|
|
255
405
|
export declare function onServerError(handler: ServerErrorHandler): void;
|
|
256
406
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../src/runtime/context.ts"],"names":[],"mappings":"AACA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,MAAM,CAAC;AAEzC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAIvD
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../src/runtime/context.ts"],"names":[],"mappings":"AACA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,MAAM,CAAC;AAEzC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAIvD;;;;;;;;;GASG;AACH,MAAM,MAAM,cAAc,GAAG,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