@qwik.dev/router 2.0.0-beta.4 → 2.0.0-beta.40
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/adapters/static/vite.d.ts +1 -1
- package/lib/adapters/azure-swa/vite/index.d.ts +2 -2
- package/lib/adapters/azure-swa/vite/index.mjs +44 -58
- package/lib/adapters/bun-server/vite/index.d.ts +2 -2
- package/lib/adapters/bun-server/vite/index.mjs +16 -23
- package/lib/adapters/cloud-run/vite/index.d.ts +2 -2
- package/lib/adapters/cloud-run/vite/index.mjs +15 -20
- package/lib/adapters/cloudflare-pages/vite/index.d.ts +2 -2
- package/lib/adapters/cloudflare-pages/vite/index.mjs +45 -77
- package/lib/adapters/deno-server/vite/index.d.ts +2 -2
- package/lib/adapters/deno-server/vite/index.mjs +25 -35
- package/lib/adapters/netlify-edge/vite/index.d.ts +2 -2
- package/lib/adapters/netlify-edge/vite/index.mjs +49 -89
- package/lib/adapters/node-server/vite/index.d.ts +2 -2
- package/lib/adapters/node-server/vite/index.mjs +16 -23
- package/lib/adapters/shared/vite/index.d.ts +9 -22
- package/lib/adapters/shared/vite/index.mjs +273 -333
- package/lib/adapters/ssg/vite/index.d.ts +13 -0
- package/lib/adapters/ssg/vite/index.mjs +13 -0
- package/lib/adapters/vercel-edge/vite/index.d.ts +3 -3
- package/lib/adapters/vercel-edge/vite/index.mjs +73 -80
- package/lib/chunks/dev-preloaded-route-loader.mjs +2 -0
- package/lib/chunks/format.mjs +24 -0
- package/lib/chunks/fs.mjs +133 -0
- package/lib/chunks/head.qwik.mjs +1217 -0
- package/lib/chunks/http-error.qwik.mjs +27 -0
- package/lib/chunks/pathname.mjs +57 -0
- package/lib/chunks/request-body-limit.mjs +27 -0
- package/lib/chunks/request-path.mjs +49 -0
- package/lib/chunks/routes.mjs +26 -0
- package/lib/chunks/server-error.mjs +16 -0
- package/lib/chunks/system.mjs +265 -0
- package/lib/chunks/url.mjs +59 -0
- package/lib/chunks/user-response.mjs +1707 -0
- package/lib/chunks/worker-thread.mjs +264 -0
- package/lib/index.d.ts +626 -170
- package/lib/index.qwik.mjs +1649 -1964
- package/lib/middleware/aws-lambda/index.d.ts +15 -16
- package/lib/middleware/aws-lambda/index.mjs +45 -54
- package/lib/middleware/azure-swa/index.mjs +85 -295
- package/lib/middleware/bun/index.d.ts +20 -5
- package/lib/middleware/bun/index.mjs +119 -205
- package/lib/middleware/cloudflare-pages/index.mjs +83 -105
- package/lib/middleware/deno/index.d.ts +22 -5
- package/lib/middleware/deno/index.mjs +105 -192
- package/lib/middleware/firebase/index.mjs +22 -35
- package/lib/middleware/netlify-edge/index.mjs +63 -81
- package/lib/middleware/node/index.d.ts +17 -5
- package/lib/middleware/node/index.mjs +299 -273
- package/lib/middleware/request-handler/index.d.ts +206 -99
- package/lib/middleware/request-handler/index.mjs +117 -1648
- package/lib/middleware/vercel-edge/index.mjs +76 -101
- package/lib/modules.d.ts +11 -16
- package/lib/service-worker/index.mjs +13 -0
- package/lib/{static → ssg}/index.d.ts +46 -22
- package/lib/ssg/index.mjs +257 -0
- package/lib/vite/index.d.ts +58 -10
- package/lib/vite/index.mjs +2459 -27446
- package/modules.d.ts +11 -16
- package/package.json +63 -67
- package/ssg.d.ts +2 -0
- package/static.d.ts +1 -1
- package/lib/adapters/azure-swa/vite/index.cjs +0 -96
- package/lib/adapters/bun-server/vite/index.cjs +0 -50
- package/lib/adapters/cloud-run/vite/index.cjs +0 -47
- package/lib/adapters/cloudflare-pages/vite/index.cjs +0 -115
- package/lib/adapters/deno-server/vite/index.cjs +0 -62
- package/lib/adapters/netlify-edge/vite/index.cjs +0 -129
- package/lib/adapters/node-server/vite/index.cjs +0 -50
- package/lib/adapters/shared/vite/index.cjs +0 -378
- package/lib/adapters/static/vite/index.cjs +0 -368
- package/lib/adapters/static/vite/index.d.ts +0 -10
- package/lib/adapters/static/vite/index.mjs +0 -331
- package/lib/adapters/vercel-edge/vite/index.cjs +0 -118
- package/lib/index.qwik.cjs +0 -2022
- package/lib/middleware/node/index.cjs +0 -314
- package/lib/middleware/request-handler/index.cjs +0 -1691
- package/lib/service-worker.cjs +0 -17
- package/lib/service-worker.mjs +0 -15
- package/lib/static/deno.mjs +0 -8
- package/lib/static/index.cjs +0 -67
- package/lib/static/index.mjs +0 -48
- package/lib/static/node.cjs +0 -1126
- package/lib/static/node.mjs +0 -1088
- package/lib/vite/index.cjs +0 -27525
- package/middleware/request-handler/generated/not-found-paths.ts +0 -7
- package/middleware/request-handler/generated/static-paths.ts +0 -35
|
@@ -1,25 +1,26 @@
|
|
|
1
1
|
import type { Action } from '@qwik.dev/router';
|
|
2
|
-
import type {
|
|
2
|
+
import type { AsyncLocalStorage } from 'node:async_hooks';
|
|
3
3
|
import type { EnvGetter as EnvGetter_2 } from '@qwik.dev/router/middleware/request-handler';
|
|
4
4
|
import type { FailReturn } from '@qwik.dev/router';
|
|
5
|
+
import type { JSXOutput } from '@qwik.dev/core';
|
|
5
6
|
import type { Loader as Loader_2 } from '@qwik.dev/router';
|
|
6
|
-
import type { QwikCityPlan } from '@qwik.dev/router';
|
|
7
7
|
import type { QwikIntrinsicElements } from '@qwik.dev/core';
|
|
8
|
-
import type { QwikRouterConfig } from '@qwik.dev/router';
|
|
9
8
|
import type { Render } from '@qwik.dev/core/server';
|
|
10
9
|
import type { RenderOptions } from '@qwik.dev/core/server';
|
|
11
10
|
import { RequestEvent as RequestEvent_2 } from '@qwik.dev/router/middleware/request-handler';
|
|
12
11
|
import type { RequestHandler as RequestHandler_2 } from '@qwik.dev/router/middleware/request-handler';
|
|
13
12
|
import type { ResolveSyncValue as ResolveSyncValue_2 } from '@qwik.dev/router/middleware/request-handler';
|
|
14
|
-
import type { SerializationStrategy } from '@qwik.dev/core/internal';
|
|
15
|
-
import type { _serialize } from '@qwik.dev/core/internal';
|
|
16
13
|
import type { ValueOrPromise } from '@qwik.dev/core';
|
|
17
|
-
import type { _verifySerializable } from '@qwik.dev/core/internal';
|
|
18
14
|
|
|
19
15
|
/** @public */
|
|
20
16
|
export declare class AbortMessage {
|
|
17
|
+
/** Type-only brand so `Exclude<>` can drop control-flow signals from resolved loader/action data. */
|
|
18
|
+
readonly __controlFlow: true;
|
|
21
19
|
}
|
|
22
20
|
|
|
21
|
+
/** @internal */
|
|
22
|
+
export declare let _asyncRequestStore: AsyncLocalStorage<RequestEventInternal> | undefined;
|
|
23
|
+
|
|
23
24
|
/** @public */
|
|
24
25
|
export declare type CacheControl = CacheControlOptions | number | 'day' | 'week' | 'month' | 'year' | 'no-cache' | 'immutable' | 'private';
|
|
25
26
|
|
|
@@ -91,6 +92,47 @@ declare interface CacheControlOptions {
|
|
|
91
92
|
/** @public */
|
|
92
93
|
declare type CacheControlTarget = 'Cache-Control' | 'CDN-Cache-Control' | 'Cloudflare-CDN-Cache-Control' | 'Vercel-CDN-Cache-Control' | '~ANY-OTHER-STRING' | (string & {});
|
|
93
94
|
|
|
95
|
+
/**
|
|
96
|
+
* Cache key function. Used by `routeConfig.cacheKey` (SSR HTML cache) and by `routeLoader$`'s
|
|
97
|
+
* `cacheKey` option (per-loader JSON cache).
|
|
98
|
+
*
|
|
99
|
+
* - `true`: use the surface's default key.
|
|
100
|
+
*
|
|
101
|
+
* - SSR default: `${status}|${eTag}|${pathname}` when an eTag is set, otherwise
|
|
102
|
+
* `${status}|${pathname}`.
|
|
103
|
+
* - Loader default: `${pathname}|${filteredSearch}|${loaderId}|${eTag}` when an eTag is set,
|
|
104
|
+
* otherwise `${pathname}|${filteredSearch}|${loaderId}`.
|
|
105
|
+
* - Function: receives the request event and the normalized, unquoted eTag (or an empty string when
|
|
106
|
+
* none was provided). Return the cache key string, or `null` or `''` to skip caching for this
|
|
107
|
+
* request. Loader callbacks receive the loader-scoped request event, with `url`, `query`, and
|
|
108
|
+
* `request.url` filtered by the loader's `search` allowlist.
|
|
109
|
+
*
|
|
110
|
+
* Note: valid cacheKeys are non-empty strings.
|
|
111
|
+
*
|
|
112
|
+
* @public
|
|
113
|
+
*/
|
|
114
|
+
declare type CacheKeyFn = true | ((requestEv: RequestEvent_2, eTag: string) => string | null);
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* Clear the in-memory loader cache. Call after deployments or data changes.
|
|
118
|
+
*
|
|
119
|
+
* When `cacheKey` is provided, only that single entry is removed; otherwise the entire cache is
|
|
120
|
+
* cleared.
|
|
121
|
+
*
|
|
122
|
+
* @public
|
|
123
|
+
*/
|
|
124
|
+
export declare function clearLoaderCache(cacheKey?: string): void;
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* Clear the in-memory SSR cache. Call after deployments or data changes.
|
|
128
|
+
*
|
|
129
|
+
* When `cacheKey` is provided, only that single entry is removed; otherwise the entire cache is
|
|
130
|
+
* cleared.
|
|
131
|
+
*
|
|
132
|
+
* @public
|
|
133
|
+
*/
|
|
134
|
+
export declare function clearSsrCache(cacheKey?: string): void;
|
|
135
|
+
|
|
94
136
|
/** @public */
|
|
95
137
|
export declare interface ClientConn {
|
|
96
138
|
ip?: string;
|
|
@@ -119,8 +161,29 @@ declare interface ContentMenu {
|
|
|
119
161
|
|
|
120
162
|
declare type ContentModule = PageModule | LayoutModule;
|
|
121
163
|
|
|
164
|
+
/**
|
|
165
|
+
* The eTag export type for routeConfig.
|
|
166
|
+
*
|
|
167
|
+
* - `string` — static ETag value.
|
|
168
|
+
* - `(props: DocumentHeadProps) => string | null` — compute the ETag from route context (params, URL,
|
|
169
|
+
* loaded data via `resolveValue`, etc.). Return `null` to skip eTag for this request.
|
|
170
|
+
*
|
|
171
|
+
* Qwik normalizes eTag values by stripping weak-form `W/` prefixes, quotes, and forbidden chars,
|
|
172
|
+
* then sends a strong `ETag` header. Values that normalize to an empty string are treated as
|
|
173
|
+
* absent.
|
|
174
|
+
*
|
|
175
|
+
* When set (and a value is produced), the server includes an `ETag` header and returns `304` if
|
|
176
|
+
* `If-None-Match` matches.
|
|
177
|
+
*
|
|
178
|
+
* @public
|
|
179
|
+
*/
|
|
180
|
+
declare type ContentModuleETag = string | ((props: DocumentHeadProps) => string | null);
|
|
181
|
+
|
|
182
|
+
/** @public */
|
|
122
183
|
declare type ContentModuleHead = DocumentHead | ResolvedDocumentHead;
|
|
123
184
|
|
|
185
|
+
declare type ContentModuleLoader = () => ValueOrPromise<ContentModule>;
|
|
186
|
+
|
|
124
187
|
/** @public */
|
|
125
188
|
export declare interface Cookie {
|
|
126
189
|
/** Gets a `Request` cookie header value by name. */
|
|
@@ -207,6 +270,9 @@ declare type DocumentHead = DocumentHeadValue | ((props: DocumentHeadProps) => D
|
|
|
207
270
|
/** @public */
|
|
208
271
|
declare interface DocumentHeadProps extends RouteLocation {
|
|
209
272
|
readonly head: ResolvedDocumentHead;
|
|
273
|
+
/** The HTTP status code of the response (e.g. 200, 404). */
|
|
274
|
+
readonly status: number;
|
|
275
|
+
/** @deprecated This is not necessary, it works correctly without */
|
|
210
276
|
readonly withLocale: <T>(fn: () => T) => T;
|
|
211
277
|
readonly resolveValue: ResolveSyncValue_2;
|
|
212
278
|
}
|
|
@@ -215,10 +281,7 @@ declare interface DocumentHeadProps extends RouteLocation {
|
|
|
215
281
|
declare interface DocumentHeadValue<FrontMatter extends Record<string, any> = Record<string, unknown>> {
|
|
216
282
|
/** Sets `document.title`. */
|
|
217
283
|
readonly title?: string;
|
|
218
|
-
/**
|
|
219
|
-
* Used to manually set meta tags in the head. Additionally, the `data` property could be used to
|
|
220
|
-
* set arbitrary data which the `<head>` component could later use to generate `<meta>` tags.
|
|
221
|
-
*/
|
|
284
|
+
/** Used to manually set meta tags in the head. */
|
|
222
285
|
readonly meta?: readonly DocumentMeta[];
|
|
223
286
|
/** Used to manually append `<link>` elements to the `<head>`. */
|
|
224
287
|
readonly links?: readonly DocumentLink[];
|
|
@@ -235,50 +298,50 @@ declare interface DocumentHeadValue<FrontMatter extends Record<string, any> = Re
|
|
|
235
298
|
}
|
|
236
299
|
|
|
237
300
|
/** @public */
|
|
238
|
-
declare
|
|
239
|
-
as?: string;
|
|
240
|
-
crossorigin?: string;
|
|
241
|
-
disabled?: boolean;
|
|
242
|
-
href?: string;
|
|
243
|
-
hreflang?: string;
|
|
244
|
-
id?: string;
|
|
245
|
-
imagesizes?: string;
|
|
246
|
-
imagesrcset?: string;
|
|
247
|
-
integrity?: string;
|
|
248
|
-
media?: string;
|
|
249
|
-
prefetch?: string;
|
|
250
|
-
referrerpolicy?: string;
|
|
251
|
-
rel?: string;
|
|
252
|
-
sizes?: string;
|
|
253
|
-
title?: string;
|
|
254
|
-
type?: string;
|
|
255
|
-
key?: string;
|
|
256
|
-
}
|
|
301
|
+
declare type DocumentLink = QwikIntrinsicElements['link'];
|
|
257
302
|
|
|
258
303
|
/** @public */
|
|
259
|
-
declare
|
|
260
|
-
readonly content?: string;
|
|
261
|
-
readonly httpEquiv?: string;
|
|
262
|
-
readonly name?: string;
|
|
263
|
-
readonly property?: string;
|
|
264
|
-
readonly key?: string;
|
|
265
|
-
readonly itemprop?: string;
|
|
266
|
-
readonly media?: string;
|
|
267
|
-
}
|
|
304
|
+
declare type DocumentMeta = QwikIntrinsicElements['meta'];
|
|
268
305
|
|
|
269
|
-
/** @
|
|
270
|
-
declare
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
306
|
+
/** @public */
|
|
307
|
+
declare type DocumentScript = ((Omit<QwikIntrinsicElements['script'], 'dangerouslySetInnerHTML'> & {
|
|
308
|
+
props?: never;
|
|
309
|
+
}) | {
|
|
310
|
+
key?: string;
|
|
311
|
+
/**
|
|
312
|
+
* The props of the script element. @deprecated Prefer setting the properties directly instead
|
|
313
|
+
* of using this property.
|
|
314
|
+
*/
|
|
315
|
+
props: Readonly<QwikIntrinsicElements['script']>;
|
|
316
|
+
}) & ({
|
|
317
|
+
/** The inline script content. */
|
|
318
|
+
script?: string;
|
|
319
|
+
dangerouslySetInnerHTML?: never;
|
|
320
|
+
} | {
|
|
321
|
+
dangerouslySetInnerHTML?: string;
|
|
322
|
+
script?: never;
|
|
323
|
+
});
|
|
275
324
|
|
|
276
325
|
/** @public */
|
|
277
|
-
declare
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
326
|
+
declare type DocumentStyle = Readonly<((Omit<QwikIntrinsicElements['style'], 'dangerouslySetInnerHTML'> & {
|
|
327
|
+
props?: never;
|
|
328
|
+
}) | {
|
|
329
|
+
key?: string;
|
|
330
|
+
/**
|
|
331
|
+
* The props of the style element. @deprecated Prefer setting the properties directly
|
|
332
|
+
* instead of using this property.
|
|
333
|
+
*/
|
|
334
|
+
props: Readonly<QwikIntrinsicElements['style']>;
|
|
335
|
+
}) & ({
|
|
336
|
+
/** The inline style content. */
|
|
337
|
+
style?: string;
|
|
338
|
+
dangerouslySetInnerHTML?: never;
|
|
339
|
+
} | {
|
|
340
|
+
dangerouslySetInnerHTML?: string;
|
|
341
|
+
style?: never;
|
|
342
|
+
})>;
|
|
343
|
+
|
|
344
|
+
declare type EndpointModuleLoader = () => ValueOrPromise<RouteModule>;
|
|
282
345
|
|
|
283
346
|
/** @public */
|
|
284
347
|
export declare interface EnvGetter {
|
|
@@ -296,44 +359,73 @@ export declare function getErrorHtml(status: number, e: any): string;
|
|
|
296
359
|
*/
|
|
297
360
|
declare type InformationalCode = 100 | 101 | 102 | 103;
|
|
298
361
|
|
|
362
|
+
/**
|
|
363
|
+
* Internal JSON request kind handled by Qwik Router, or `false` for normal page requests.
|
|
364
|
+
*
|
|
365
|
+
* @public
|
|
366
|
+
*/
|
|
367
|
+
export declare type InternalRequest = false | 'loader' | 'action';
|
|
368
|
+
|
|
369
|
+
/**
|
|
370
|
+
* Decide whether a given request path is a static path, for optimizing file access.
|
|
371
|
+
*
|
|
372
|
+
* @internal
|
|
373
|
+
*/
|
|
374
|
+
export declare function isStaticPath(method: string, url: URL): boolean;
|
|
375
|
+
|
|
299
376
|
declare interface LayoutModule extends RouteModule {
|
|
300
|
-
readonly default:
|
|
377
|
+
readonly default?: (props: Record<string, never>) => JSXOutput;
|
|
378
|
+
readonly routeConfig?: RouteConfig;
|
|
301
379
|
readonly head?: ContentModuleHead;
|
|
302
380
|
}
|
|
303
381
|
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
382
|
+
/** The route to render */
|
|
383
|
+
declare interface LoadedRoute {
|
|
384
|
+
/** The canonical path of the route, e.g. `/products/[id]` */
|
|
385
|
+
$routeName$: string;
|
|
386
|
+
/** The route parameters, e.g. `{ id: '123' }` */
|
|
387
|
+
$params$: PathParams;
|
|
388
|
+
/** The modules associated with this route (on 404, contains only the error component) */
|
|
389
|
+
$mods$: (RouteModule | ContentModule)[];
|
|
390
|
+
/** The menu associated with this route */
|
|
391
|
+
$menu$?: ContentMenu | undefined;
|
|
392
|
+
/** The bundle names for this route */
|
|
393
|
+
$routeBundleNames$?: string[] | undefined;
|
|
394
|
+
/** Whether this route is a not-found (404) route */
|
|
395
|
+
$notFound$?: boolean;
|
|
396
|
+
/** The nearest _E (error.tsx) boundary's chain to render on a thrown ServerError (in its layouts). */
|
|
397
|
+
$errorLoader$?: ModuleLoader[];
|
|
398
|
+
/** Merged array of routeLoader$ hashes from all matched nodes (layouts + page) */
|
|
399
|
+
$loaders$?: string[];
|
|
400
|
+
/** Runtime-only mapping of routeLoader$ hashes to the matched pathname used for q-loader fetches */
|
|
401
|
+
$loaderPaths$?: Record<string, string>;
|
|
402
|
+
}
|
|
311
403
|
|
|
312
404
|
/** @public */
|
|
313
405
|
export declare const mergeHeadersCookies: (headers: Headers, cookies: Cookie) => Headers;
|
|
314
406
|
|
|
407
|
+
declare type ModuleLoader = ContentModuleLoader | EndpointModuleLoader;
|
|
408
|
+
|
|
315
409
|
/** @public */
|
|
316
|
-
declare
|
|
317
|
-
readonly default:
|
|
410
|
+
declare type PageModule = RouteModule & {
|
|
411
|
+
readonly default: (props: Record<string, never>) => JSXOutput;
|
|
412
|
+
readonly routeConfig?: RouteConfig;
|
|
318
413
|
readonly head?: ContentModuleHead;
|
|
414
|
+
readonly eTag?: ContentModuleETag;
|
|
415
|
+
readonly cacheKey?: CacheKeyFn;
|
|
319
416
|
readonly headings?: ContentHeading[];
|
|
320
417
|
readonly onStaticGenerate?: StaticGenerateHandler;
|
|
321
|
-
}
|
|
418
|
+
};
|
|
322
419
|
|
|
323
420
|
/** @public */
|
|
324
421
|
declare type PathParams = Record<string, string>;
|
|
325
422
|
|
|
423
|
+
declare type QwikRouterCompletion = Error | undefined | object;
|
|
424
|
+
|
|
326
425
|
declare interface QwikRouterRun<T> {
|
|
327
426
|
response: Promise<T | null>;
|
|
328
427
|
requestEv: RequestEvent_2;
|
|
329
|
-
completion: Promise<
|
|
330
|
-
}
|
|
331
|
-
|
|
332
|
-
/** @public */
|
|
333
|
-
declare interface QwikSerializer {
|
|
334
|
-
_deserialize: typeof _deserialize;
|
|
335
|
-
_serialize: typeof _serialize;
|
|
336
|
-
_verifySerializable: typeof _verifySerializable;
|
|
428
|
+
completion: Promise<QwikRouterCompletion>;
|
|
337
429
|
}
|
|
338
430
|
|
|
339
431
|
/**
|
|
@@ -412,6 +504,14 @@ export declare interface RequestEventBase<PLATFORM = QwikRouterPlatform> {
|
|
|
412
504
|
readonly query: URLSearchParams;
|
|
413
505
|
/** HTTP request URL. */
|
|
414
506
|
readonly url: URL;
|
|
507
|
+
/**
|
|
508
|
+
* Identifies Qwik Router internal JSON requests, such as route loader fetches and fetch-based
|
|
509
|
+
* action submissions. Returns `false` for normal page requests.
|
|
510
|
+
*
|
|
511
|
+
* Check this before applying broad rewrite rules so internal JSON requests keep their routing
|
|
512
|
+
* behavior.
|
|
513
|
+
*/
|
|
514
|
+
readonly internalRequest: InternalRequest;
|
|
415
515
|
/**
|
|
416
516
|
* The original HTTP request URL.
|
|
417
517
|
*
|
|
@@ -529,13 +629,9 @@ export declare interface RequestEventCommon<PLATFORM = QwikRouterPlatform> exten
|
|
|
529
629
|
readonly exit: () => AbortMessage;
|
|
530
630
|
}
|
|
531
631
|
|
|
532
|
-
declare interface RequestEventInternal extends RequestEvent
|
|
533
|
-
[
|
|
534
|
-
[
|
|
535
|
-
[RequestEvMode]: ServerRequestMode;
|
|
536
|
-
[RequestEvTrailingSlash]: boolean;
|
|
537
|
-
[RequestEvRoute]: LoadedRoute | null;
|
|
538
|
-
[RequestEvQwikSerializer]: QwikSerializer;
|
|
632
|
+
declare interface RequestEventInternal extends Readonly<RequestEvent>, Readonly<RequestEventLoader> {
|
|
633
|
+
readonly [RequestEvMode]: ServerRequestMode;
|
|
634
|
+
readonly [RequestEvRoute]: LoadedRoute;
|
|
539
635
|
/**
|
|
540
636
|
* Check if this request is already written to.
|
|
541
637
|
*
|
|
@@ -558,44 +654,36 @@ export declare interface RequestEventLoader<PLATFORM = QwikRouterPlatform> exten
|
|
|
558
654
|
defer: <T>(returnData: Promise<T> | (() => Promise<T>)) => DeferReturn<T>;
|
|
559
655
|
}
|
|
560
656
|
|
|
561
|
-
declare const RequestEvLoaders: unique symbol;
|
|
562
|
-
|
|
563
|
-
declare const RequestEvLoaderSerializationStrategyMap: unique symbol;
|
|
564
|
-
|
|
565
657
|
declare const RequestEvMode: unique symbol;
|
|
566
658
|
|
|
567
|
-
declare const RequestEvQwikSerializer: unique symbol;
|
|
568
|
-
|
|
569
659
|
declare const RequestEvRoute: unique symbol;
|
|
570
660
|
|
|
571
|
-
/** @internal */
|
|
572
|
-
export declare const RequestEvShareQData = "qData";
|
|
573
|
-
|
|
574
|
-
declare const RequestEvTrailingSlash: unique symbol;
|
|
575
|
-
|
|
576
661
|
/** @public */
|
|
577
|
-
export declare type RequestHandler<PLATFORM = QwikRouterPlatform> = (ev: RequestEvent<PLATFORM>) => Promise<void> | void;
|
|
662
|
+
export declare type RequestHandler<PLATFORM = QwikRouterPlatform> = (ev: RequestEvent<PLATFORM>) => Promise<void | AbortMessage | ServerError> | void | AbortMessage | ServerError;
|
|
578
663
|
|
|
579
664
|
/**
|
|
580
|
-
* The request handler for QwikRouter. Called by every
|
|
665
|
+
* The request handler for QwikRouter. Called by every adapter.
|
|
581
666
|
*
|
|
582
667
|
* @public
|
|
583
668
|
*/
|
|
584
|
-
export declare function requestHandler<T = unknown>(serverRequestEv: ServerRequestEvent<T>, opts: ServerRenderOptions
|
|
669
|
+
export declare function requestHandler<T = unknown>(serverRequestEv: ServerRequestEvent<T>, opts: ServerRenderOptions): Promise<QwikRouterRun<T> | null>;
|
|
585
670
|
|
|
586
671
|
/** @public */
|
|
587
|
-
declare type ResolvedDocumentHead<FrontMatter extends Record<string, any> = Record<string, unknown>> = Required<DocumentHeadValue<FrontMatter
|
|
672
|
+
declare type ResolvedDocumentHead<FrontMatter extends Record<string, any> = Record<string, unknown>> = Required<DocumentHeadValue<FrontMatter>> & {
|
|
673
|
+
/** The build's manifest hash, used for per-loader data URLs. Always defined (`'dev'` in dev). */
|
|
674
|
+
readonly manifestHash: string;
|
|
675
|
+
};
|
|
588
676
|
|
|
589
677
|
/** @public */
|
|
590
678
|
export declare interface ResolveSyncValue {
|
|
679
|
+
<T, INPUT, OPTIONAL extends boolean>(action: Action<T, INPUT, OPTIONAL>): Awaited<T> | undefined;
|
|
591
680
|
<T>(loader: Loader_2<T>): Awaited<T> extends () => any ? never : Awaited<T>;
|
|
592
|
-
<T>(action: Action<T>): Awaited<T> | undefined;
|
|
593
681
|
}
|
|
594
682
|
|
|
595
683
|
/** @public */
|
|
596
684
|
export declare interface ResolveValue {
|
|
685
|
+
<T, INPUT, OPTIONAL extends boolean>(action: Action<T, INPUT, OPTIONAL>): Promise<T | undefined>;
|
|
597
686
|
<T>(loader: Loader_2<T>): Awaited<T> extends () => any ? never : Promise<T>;
|
|
598
|
-
<T>(action: Action<T>): Promise<T | undefined>;
|
|
599
687
|
}
|
|
600
688
|
|
|
601
689
|
/** @public */
|
|
@@ -604,6 +692,28 @@ export declare class RewriteMessage extends AbortMessage {
|
|
|
604
692
|
constructor(pathname: string);
|
|
605
693
|
}
|
|
606
694
|
|
|
695
|
+
/**
|
|
696
|
+
* Unified route configuration export. Groups head, eTag, and cacheKey with the same resolution
|
|
697
|
+
* rules as DocumentHead: can be a static object or a function receiving DocumentHeadProps.
|
|
698
|
+
*
|
|
699
|
+
* When a module exports `routeConfig`, the separate `head`, `eTag`, and `cacheKey` exports are
|
|
700
|
+
* ignored for that module.
|
|
701
|
+
*
|
|
702
|
+
* @public
|
|
703
|
+
*/
|
|
704
|
+
declare type RouteConfig = RouteConfigValue | ((props: DocumentHeadProps) => RouteConfigValue);
|
|
705
|
+
|
|
706
|
+
/**
|
|
707
|
+
* The value shape returned by a routeConfig export (object form or function return).
|
|
708
|
+
*
|
|
709
|
+
* @public
|
|
710
|
+
*/
|
|
711
|
+
declare interface RouteConfigValue {
|
|
712
|
+
readonly head?: DocumentHeadValue;
|
|
713
|
+
readonly eTag?: ContentModuleETag;
|
|
714
|
+
readonly cacheKey?: CacheKeyFn;
|
|
715
|
+
}
|
|
716
|
+
|
|
607
717
|
/** @public */
|
|
608
718
|
declare interface RouteLocation {
|
|
609
719
|
readonly params: Readonly<Record<string, string>>;
|
|
@@ -645,20 +755,17 @@ declare type ServerErrorCode = 500 | 501 | 502 | 503 | 504 | 505 | 506 | 507 | 5
|
|
|
645
755
|
/** @public */
|
|
646
756
|
export declare interface ServerRenderOptions extends RenderOptions {
|
|
647
757
|
render: Render;
|
|
648
|
-
/** @deprecated Use `QwikRouterConfig` instead. Will be removed in V3 */
|
|
649
|
-
qwikCityPlan?: QwikCityPlan;
|
|
650
|
-
qwikRouterConfig?: QwikRouterConfig;
|
|
651
758
|
/**
|
|
652
759
|
* Protection against cross-site request forgery (CSRF) attacks.
|
|
653
760
|
*
|
|
654
761
|
* When `true`, for every incoming POST, PUT, PATCH, or DELETE form submissions, the request
|
|
655
|
-
* origin is checked to match the server's origin.
|
|
762
|
+
* origin is checked to match the server's origin. `lax-proto` is for SSL-terminating proxies
|
|
656
763
|
*
|
|
657
764
|
* Be careful when disabling this option as it may lead to CSRF attacks.
|
|
658
765
|
*
|
|
659
766
|
* Defaults to `true`.
|
|
660
767
|
*/
|
|
661
|
-
checkOrigin?: boolean;
|
|
768
|
+
checkOrigin?: boolean | 'lax-proto';
|
|
662
769
|
}
|
|
663
770
|
|
|
664
771
|
/**
|
|
@@ -677,10 +784,10 @@ export declare interface ServerRequestEvent<T = unknown> {
|
|
|
677
784
|
}
|
|
678
785
|
|
|
679
786
|
/** @public */
|
|
680
|
-
export declare type ServerRequestMode = '
|
|
787
|
+
export declare type ServerRequestMode = 'static' | 'server';
|
|
681
788
|
|
|
682
789
|
/** @public */
|
|
683
|
-
export declare type ServerResponseHandler<T = any> = (status: number, headers: Headers, cookies: Cookie, resolve: (response: T) => void, requestEv:
|
|
790
|
+
export declare type ServerResponseHandler<T = any> = (status: number, headers: Headers, cookies: Cookie, resolve: (response: T) => void, requestEv: RequestEvent) => WritableStream<Uint8Array>;
|
|
684
791
|
|
|
685
792
|
/** @public */
|
|
686
793
|
declare interface StaticGenerate {
|