@qwik.dev/router 2.0.0-beta.3 → 2.0.0-beta.31
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 +39 -44
- package/lib/adapters/bun-server/vite/index.d.ts +2 -2
- package/lib/adapters/bun-server/vite/index.mjs +6 -7
- package/lib/adapters/cloud-run/vite/index.d.ts +2 -2
- package/lib/adapters/cloud-run/vite/index.mjs +6 -7
- package/lib/adapters/cloudflare-pages/vite/index.d.ts +2 -2
- package/lib/adapters/cloudflare-pages/vite/index.mjs +23 -32
- package/lib/adapters/deno-server/vite/index.d.ts +2 -2
- package/lib/adapters/deno-server/vite/index.mjs +13 -9
- package/lib/adapters/netlify-edge/vite/index.d.ts +2 -2
- package/lib/adapters/netlify-edge/vite/index.mjs +22 -36
- package/lib/adapters/node-server/vite/index.d.ts +2 -2
- package/lib/adapters/node-server/vite/index.mjs +6 -7
- package/lib/adapters/shared/vite/index.d.ts +7 -19
- package/lib/adapters/shared/vite/index.mjs +244 -233
- package/lib/adapters/ssg/vite/index.d.ts +13 -0
- package/lib/adapters/ssg/vite/index.mjs +17 -0
- package/lib/adapters/vercel-edge/vite/index.d.ts +3 -3
- package/lib/adapters/vercel-edge/vite/index.mjs +33 -19
- package/lib/chunks/deepFreeze.qwik.mjs +18 -0
- package/lib/chunks/error-handler.mjs +57 -0
- package/lib/chunks/fs.mjs +144 -0
- package/lib/chunks/http-error.qwik.mjs +35 -0
- package/lib/chunks/not-found-wrapper.qwik.mjs +25 -0
- package/lib/chunks/pathname.mjs +105 -0
- package/lib/chunks/redirect-handler.mjs +6 -0
- package/lib/chunks/routing.qwik.mjs +821 -0
- package/lib/chunks/system.mjs +333 -0
- package/lib/chunks/url.mjs +61 -0
- package/lib/chunks/use-functions.qwik.mjs +35 -0
- package/lib/chunks/worker-thread.qwik.mjs +2573 -0
- package/lib/index.d.ts +362 -142
- package/lib/index.qwik.mjs +949 -1244
- package/lib/middleware/aws-lambda/index.d.ts +0 -5
- package/lib/middleware/aws-lambda/index.mjs +14 -17
- package/lib/middleware/azure-swa/index.mjs +16 -221
- package/lib/middleware/bun/index.d.ts +11 -0
- package/lib/middleware/bun/index.mjs +50 -97
- package/lib/middleware/cloudflare-pages/index.mjs +22 -31
- package/lib/middleware/deno/index.d.ts +11 -0
- package/lib/middleware/deno/index.mjs +49 -97
- package/lib/middleware/firebase/index.mjs +6 -15
- package/lib/middleware/netlify-edge/index.mjs +22 -32
- package/lib/middleware/node/index.mjs +31 -105
- package/lib/middleware/request-handler/index.d.ts +163 -88
- package/lib/middleware/request-handler/index.mjs +1458 -1260
- package/lib/middleware/vercel-edge/index.mjs +27 -36
- package/lib/modules.d.ts +11 -16
- package/lib/service-worker/index.mjs +4 -0
- package/lib/{static → ssg}/index.d.ts +45 -13
- package/lib/ssg/index.mjs +336 -0
- package/lib/vite/index.d.ts +38 -10
- package/lib/vite/index.mjs +2067 -26841
- package/modules.d.ts +11 -16
- package/package.json +62 -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 -1947
- package/lib/middleware/node/index.cjs +0 -314
- package/lib/middleware/request-handler/index.cjs +0 -1614
- 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 -1124
- package/lib/static/node.mjs +0 -1086
- package/lib/vite/index.cjs +0 -27445
- package/middleware/request-handler/generated/not-found-paths.ts +0 -7
- package/middleware/request-handler/generated/static-paths.ts +0 -35
|
@@ -1,24 +1,25 @@
|
|
|
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
|
|
13
|
+
import { SerializationStrategy } from '@qwik.dev/core/internal';
|
|
15
14
|
import type { ValueOrPromise } from '@qwik.dev/core';
|
|
16
|
-
import type { _verifySerializable } from '@qwik.dev/core/internal';
|
|
17
15
|
|
|
18
16
|
/** @public */
|
|
19
17
|
export declare class AbortMessage {
|
|
20
18
|
}
|
|
21
19
|
|
|
20
|
+
/** @internal */
|
|
21
|
+
export declare let _asyncRequestStore: AsyncLocalStorage<RequestEventInternal> | undefined;
|
|
22
|
+
|
|
22
23
|
/** @public */
|
|
23
24
|
export declare type CacheControl = CacheControlOptions | number | 'day' | 'week' | 'month' | 'year' | 'no-cache' | 'immutable' | 'private';
|
|
24
25
|
|
|
@@ -90,6 +91,27 @@ declare interface CacheControlOptions {
|
|
|
90
91
|
/** @public */
|
|
91
92
|
declare type CacheControlTarget = 'Cache-Control' | 'CDN-Cache-Control' | 'Cloudflare-CDN-Cache-Control' | 'Vercel-CDN-Cache-Control' | '~ANY-OTHER-STRING' | (string & {});
|
|
92
93
|
|
|
94
|
+
/**
|
|
95
|
+
* The cacheKey export type. When exported from a page module alongside eTag, enables in-memory SSR
|
|
96
|
+
* caching.
|
|
97
|
+
*
|
|
98
|
+
* - `true`: use the default cache key `status|eTag|pathname`
|
|
99
|
+
* - Function: receives status, eTag, and pathname; returns a cache key string or null (no cache)
|
|
100
|
+
*
|
|
101
|
+
* @public
|
|
102
|
+
*/
|
|
103
|
+
declare type CacheKeyFn = true | ((status: number, eTag: string, pathname: string) => string | null);
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* Clear the in-memory SSR cache. Call after deployments or data changes.
|
|
107
|
+
*
|
|
108
|
+
* When `cacheKey` is provided, only that single entry is removed; otherwise the entire cache is
|
|
109
|
+
* cleared.
|
|
110
|
+
*
|
|
111
|
+
* @public
|
|
112
|
+
*/
|
|
113
|
+
export declare function clearSsrCache(cacheKey?: string): void;
|
|
114
|
+
|
|
93
115
|
/** @public */
|
|
94
116
|
export declare interface ClientConn {
|
|
95
117
|
ip?: string;
|
|
@@ -118,8 +140,18 @@ declare interface ContentMenu {
|
|
|
118
140
|
|
|
119
141
|
declare type ContentModule = PageModule | LayoutModule;
|
|
120
142
|
|
|
143
|
+
/**
|
|
144
|
+
* The eTag export type: a static string or a function receiving DocumentHeadProps.
|
|
145
|
+
*
|
|
146
|
+
* @public
|
|
147
|
+
*/
|
|
148
|
+
declare type ContentModuleETag = string | ((props: DocumentHeadProps) => string | null);
|
|
149
|
+
|
|
150
|
+
/** @public */
|
|
121
151
|
declare type ContentModuleHead = DocumentHead | ResolvedDocumentHead;
|
|
122
152
|
|
|
153
|
+
declare type ContentModuleLoader = () => ValueOrPromise<ContentModule>;
|
|
154
|
+
|
|
123
155
|
/** @public */
|
|
124
156
|
export declare interface Cookie {
|
|
125
157
|
/** Gets a `Request` cookie header value by name. */
|
|
@@ -206,6 +238,9 @@ declare type DocumentHead = DocumentHeadValue | ((props: DocumentHeadProps) => D
|
|
|
206
238
|
/** @public */
|
|
207
239
|
declare interface DocumentHeadProps extends RouteLocation {
|
|
208
240
|
readonly head: ResolvedDocumentHead;
|
|
241
|
+
/** The HTTP status code of the response (e.g. 200, 404). */
|
|
242
|
+
readonly status: number;
|
|
243
|
+
/** @deprecated This is not necessary, it works correctly without */
|
|
209
244
|
readonly withLocale: <T>(fn: () => T) => T;
|
|
210
245
|
readonly resolveValue: ResolveSyncValue_2;
|
|
211
246
|
}
|
|
@@ -214,10 +249,7 @@ declare interface DocumentHeadProps extends RouteLocation {
|
|
|
214
249
|
declare interface DocumentHeadValue<FrontMatter extends Record<string, any> = Record<string, unknown>> {
|
|
215
250
|
/** Sets `document.title`. */
|
|
216
251
|
readonly title?: string;
|
|
217
|
-
/**
|
|
218
|
-
* Used to manually set meta tags in the head. Additionally, the `data` property could be used to
|
|
219
|
-
* set arbitrary data which the `<head>` component could later use to generate `<meta>` tags.
|
|
220
|
-
*/
|
|
252
|
+
/** Used to manually set meta tags in the head. */
|
|
221
253
|
readonly meta?: readonly DocumentMeta[];
|
|
222
254
|
/** Used to manually append `<link>` elements to the `<head>`. */
|
|
223
255
|
readonly links?: readonly DocumentLink[];
|
|
@@ -234,50 +266,48 @@ declare interface DocumentHeadValue<FrontMatter extends Record<string, any> = Re
|
|
|
234
266
|
}
|
|
235
267
|
|
|
236
268
|
/** @public */
|
|
237
|
-
declare
|
|
238
|
-
as?: string;
|
|
239
|
-
crossorigin?: string;
|
|
240
|
-
disabled?: boolean;
|
|
241
|
-
href?: string;
|
|
242
|
-
hreflang?: string;
|
|
243
|
-
id?: string;
|
|
244
|
-
imagesizes?: string;
|
|
245
|
-
imagesrcset?: string;
|
|
246
|
-
integrity?: string;
|
|
247
|
-
media?: string;
|
|
248
|
-
prefetch?: string;
|
|
249
|
-
referrerpolicy?: string;
|
|
250
|
-
rel?: string;
|
|
251
|
-
sizes?: string;
|
|
252
|
-
title?: string;
|
|
253
|
-
type?: string;
|
|
254
|
-
key?: string;
|
|
255
|
-
}
|
|
269
|
+
declare type DocumentLink = QwikIntrinsicElements['link'];
|
|
256
270
|
|
|
257
271
|
/** @public */
|
|
258
|
-
declare
|
|
259
|
-
readonly content?: string;
|
|
260
|
-
readonly httpEquiv?: string;
|
|
261
|
-
readonly name?: string;
|
|
262
|
-
readonly property?: string;
|
|
263
|
-
readonly key?: string;
|
|
264
|
-
readonly itemprop?: string;
|
|
265
|
-
readonly media?: string;
|
|
266
|
-
}
|
|
272
|
+
declare type DocumentMeta = QwikIntrinsicElements['meta'];
|
|
267
273
|
|
|
268
|
-
/** @
|
|
269
|
-
declare
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
+
/** @public */
|
|
275
|
+
declare type DocumentScript = ((Omit<QwikIntrinsicElements['script'], 'dangerouslySetInnerHTML'> & {
|
|
276
|
+
props?: never;
|
|
277
|
+
}) | {
|
|
278
|
+
key?: string;
|
|
279
|
+
/**
|
|
280
|
+
* The props of the script element. @deprecated Prefer setting the properties directly instead
|
|
281
|
+
* of using this property.
|
|
282
|
+
*/
|
|
283
|
+
props: Readonly<QwikIntrinsicElements['script']>;
|
|
284
|
+
}) & ({
|
|
285
|
+
/** The inline script content. */
|
|
286
|
+
script?: string;
|
|
287
|
+
dangerouslySetInnerHTML?: never;
|
|
288
|
+
} | {
|
|
289
|
+
dangerouslySetInnerHTML?: string;
|
|
290
|
+
script?: never;
|
|
291
|
+
});
|
|
274
292
|
|
|
275
293
|
/** @public */
|
|
276
|
-
declare
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
294
|
+
declare type DocumentStyle = Readonly<((Omit<QwikIntrinsicElements['style'], 'dangerouslySetInnerHTML'> & {
|
|
295
|
+
props?: never;
|
|
296
|
+
}) | {
|
|
297
|
+
key?: string;
|
|
298
|
+
/**
|
|
299
|
+
* The props of the style element. @deprecated Prefer setting the properties directly
|
|
300
|
+
* instead of using this property.
|
|
301
|
+
*/
|
|
302
|
+
props: Readonly<QwikIntrinsicElements['style']>;
|
|
303
|
+
}) & ({
|
|
304
|
+
/** The inline style content. */
|
|
305
|
+
style?: string;
|
|
306
|
+
dangerouslySetInnerHTML?: never;
|
|
307
|
+
} | {
|
|
308
|
+
dangerouslySetInnerHTML?: string;
|
|
309
|
+
style?: never;
|
|
310
|
+
})>;
|
|
281
311
|
|
|
282
312
|
/** @public */
|
|
283
313
|
export declare interface EnvGetter {
|
|
@@ -289,50 +319,73 @@ declare type ErrorCodes = ClientErrorCode | ServerErrorCode;
|
|
|
289
319
|
/** @public */
|
|
290
320
|
export declare function getErrorHtml(status: number, e: any): string;
|
|
291
321
|
|
|
322
|
+
/**
|
|
323
|
+
* Return the HTML for a 404 page.
|
|
324
|
+
*
|
|
325
|
+
* @internal
|
|
326
|
+
*/
|
|
327
|
+
export declare function getNotFound(prefix: string): string;
|
|
328
|
+
|
|
292
329
|
/**
|
|
293
330
|
* HTTP Informational Status Codes Status codes in the 1xx range indicate that the server has
|
|
294
331
|
* received and is processing the request, but no response is available yet.
|
|
295
332
|
*/
|
|
296
333
|
declare type InformationalCode = 100 | 101 | 102 | 103;
|
|
297
334
|
|
|
335
|
+
/**
|
|
336
|
+
* Decide whether a given request path is a static path, for optimizing file access.
|
|
337
|
+
*
|
|
338
|
+
* @internal
|
|
339
|
+
*/
|
|
340
|
+
export declare function isStaticPath(method: string, url: URL): boolean;
|
|
341
|
+
|
|
298
342
|
declare interface LayoutModule extends RouteModule {
|
|
299
|
-
readonly default:
|
|
343
|
+
readonly default?: (props: Record<string, never>) => JSXOutput;
|
|
344
|
+
readonly routeConfig?: RouteConfig;
|
|
300
345
|
readonly head?: ContentModuleHead;
|
|
301
346
|
}
|
|
302
347
|
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
348
|
+
/** The route to render */
|
|
349
|
+
declare interface LoadedRoute {
|
|
350
|
+
/** The canonical path of the route, e.g. `/products/[id]` */
|
|
351
|
+
$routeName$: string;
|
|
352
|
+
/** The route parameters, e.g. `{ id: '123' }` */
|
|
353
|
+
$params$: PathParams;
|
|
354
|
+
/** The modules associated with this route (on 404, contains only the error component) */
|
|
355
|
+
$mods$: (RouteModule | ContentModule)[];
|
|
356
|
+
/** The menu associated with this route */
|
|
357
|
+
$menu$?: ContentMenu | undefined;
|
|
358
|
+
/** The bundle names for this route */
|
|
359
|
+
$routeBundleNames$?: string[] | undefined;
|
|
360
|
+
/** Whether this route is a not-found (404) route */
|
|
361
|
+
$notFound$?: boolean;
|
|
362
|
+
/** The error module loader (nearest _E ancestor), for rendering ServerErrors */
|
|
363
|
+
$errorLoader$?: ContentModuleLoader;
|
|
364
|
+
}
|
|
310
365
|
|
|
311
366
|
/** @public */
|
|
312
367
|
export declare const mergeHeadersCookies: (headers: Headers, cookies: Cookie) => Headers;
|
|
313
368
|
|
|
314
369
|
/** @public */
|
|
315
|
-
declare
|
|
316
|
-
readonly default:
|
|
370
|
+
declare type PageModule = RouteModule & {
|
|
371
|
+
readonly default: (props: Record<string, never>) => JSXOutput;
|
|
372
|
+
readonly routeConfig?: RouteConfig;
|
|
317
373
|
readonly head?: ContentModuleHead;
|
|
374
|
+
readonly eTag?: ContentModuleETag;
|
|
375
|
+
readonly cacheKey?: CacheKeyFn;
|
|
318
376
|
readonly headings?: ContentHeading[];
|
|
319
377
|
readonly onStaticGenerate?: StaticGenerateHandler;
|
|
320
|
-
}
|
|
378
|
+
};
|
|
321
379
|
|
|
322
380
|
/** @public */
|
|
323
381
|
declare type PathParams = Record<string, string>;
|
|
324
382
|
|
|
383
|
+
declare type QwikRouterCompletion = Error | undefined | object;
|
|
384
|
+
|
|
325
385
|
declare interface QwikRouterRun<T> {
|
|
326
386
|
response: Promise<T | null>;
|
|
327
387
|
requestEv: RequestEvent_2;
|
|
328
|
-
completion: Promise<
|
|
329
|
-
}
|
|
330
|
-
|
|
331
|
-
/** @public */
|
|
332
|
-
declare interface QwikSerializer {
|
|
333
|
-
_deserialize: typeof _deserialize;
|
|
334
|
-
_serialize: typeof _serialize;
|
|
335
|
-
_verifySerializable: typeof _verifySerializable;
|
|
388
|
+
completion: Promise<QwikRouterCompletion>;
|
|
336
389
|
}
|
|
337
390
|
|
|
338
391
|
/**
|
|
@@ -528,12 +581,11 @@ export declare interface RequestEventCommon<PLATFORM = QwikRouterPlatform> exten
|
|
|
528
581
|
readonly exit: () => AbortMessage;
|
|
529
582
|
}
|
|
530
583
|
|
|
531
|
-
declare interface RequestEventInternal extends RequestEvent
|
|
532
|
-
[RequestEvLoaders]: Record<string, ValueOrPromise<unknown> | undefined>;
|
|
533
|
-
[
|
|
534
|
-
[
|
|
535
|
-
[RequestEvRoute]: LoadedRoute
|
|
536
|
-
[RequestEvQwikSerializer]: QwikSerializer;
|
|
584
|
+
declare interface RequestEventInternal extends Readonly<RequestEvent>, Readonly<RequestEventLoader> {
|
|
585
|
+
readonly [RequestEvLoaders]: Record<string, ValueOrPromise<unknown> | undefined>;
|
|
586
|
+
readonly [RequestEvLoaderSerializationStrategyMap]: Map<string, SerializationStrategy>;
|
|
587
|
+
readonly [RequestEvMode]: ServerRequestMode;
|
|
588
|
+
readonly [RequestEvRoute]: LoadedRoute;
|
|
537
589
|
/**
|
|
538
590
|
* Check if this request is already written to.
|
|
539
591
|
*
|
|
@@ -558,37 +610,41 @@ export declare interface RequestEventLoader<PLATFORM = QwikRouterPlatform> exten
|
|
|
558
610
|
|
|
559
611
|
declare const RequestEvLoaders: unique symbol;
|
|
560
612
|
|
|
561
|
-
declare const
|
|
613
|
+
declare const RequestEvLoaderSerializationStrategyMap: unique symbol;
|
|
562
614
|
|
|
563
|
-
declare const
|
|
615
|
+
declare const RequestEvMode: unique symbol;
|
|
564
616
|
|
|
565
617
|
declare const RequestEvRoute: unique symbol;
|
|
566
618
|
|
|
567
|
-
|
|
619
|
+
/** @internal */
|
|
620
|
+
export declare const RequestEvShareQData = "qData";
|
|
568
621
|
|
|
569
622
|
/** @public */
|
|
570
623
|
export declare type RequestHandler<PLATFORM = QwikRouterPlatform> = (ev: RequestEvent<PLATFORM>) => Promise<void> | void;
|
|
571
624
|
|
|
572
625
|
/**
|
|
573
|
-
* The request handler for QwikRouter. Called by every
|
|
626
|
+
* The request handler for QwikRouter. Called by every adapter.
|
|
574
627
|
*
|
|
575
628
|
* @public
|
|
576
629
|
*/
|
|
577
|
-
export declare function requestHandler<T = unknown>(serverRequestEv: ServerRequestEvent<T>, opts: ServerRenderOptions
|
|
630
|
+
export declare function requestHandler<T = unknown>(serverRequestEv: ServerRequestEvent<T>, opts: ServerRenderOptions): Promise<QwikRouterRun<T> | null>;
|
|
578
631
|
|
|
579
632
|
/** @public */
|
|
580
|
-
declare type ResolvedDocumentHead<FrontMatter extends Record<string, any> = Record<string, unknown>> = Required<DocumentHeadValue<FrontMatter
|
|
633
|
+
declare type ResolvedDocumentHead<FrontMatter extends Record<string, any> = Record<string, unknown>> = Required<DocumentHeadValue<FrontMatter>> & {
|
|
634
|
+
/** The build's manifest hash, used for per-loader data URLs. Always defined (`'dev'` in dev). */
|
|
635
|
+
readonly manifestHash: string;
|
|
636
|
+
};
|
|
581
637
|
|
|
582
638
|
/** @public */
|
|
583
639
|
export declare interface ResolveSyncValue {
|
|
640
|
+
<T, INPUT, OPTIONAL extends boolean>(action: Action<T, INPUT, OPTIONAL>): Awaited<T> | undefined;
|
|
584
641
|
<T>(loader: Loader_2<T>): Awaited<T> extends () => any ? never : Awaited<T>;
|
|
585
|
-
<T>(action: Action<T>): Awaited<T> | undefined;
|
|
586
642
|
}
|
|
587
643
|
|
|
588
644
|
/** @public */
|
|
589
645
|
export declare interface ResolveValue {
|
|
646
|
+
<T, INPUT, OPTIONAL extends boolean>(action: Action<T, INPUT, OPTIONAL>): Promise<T | undefined>;
|
|
590
647
|
<T>(loader: Loader_2<T>): Awaited<T> extends () => any ? never : Promise<T>;
|
|
591
|
-
<T>(action: Action<T>): Promise<T | undefined>;
|
|
592
648
|
}
|
|
593
649
|
|
|
594
650
|
/** @public */
|
|
@@ -597,6 +653,28 @@ export declare class RewriteMessage extends AbortMessage {
|
|
|
597
653
|
constructor(pathname: string);
|
|
598
654
|
}
|
|
599
655
|
|
|
656
|
+
/**
|
|
657
|
+
* Unified route configuration export. Groups head, eTag, and cacheKey with the same resolution
|
|
658
|
+
* rules as DocumentHead: can be a static object or a function receiving DocumentHeadProps.
|
|
659
|
+
*
|
|
660
|
+
* When a module exports `routeConfig`, the separate `head`, `eTag`, and `cacheKey` exports are
|
|
661
|
+
* ignored for that module.
|
|
662
|
+
*
|
|
663
|
+
* @public
|
|
664
|
+
*/
|
|
665
|
+
declare type RouteConfig = RouteConfigValue | ((props: DocumentHeadProps) => RouteConfigValue);
|
|
666
|
+
|
|
667
|
+
/**
|
|
668
|
+
* The value shape returned by a routeConfig export (object form or function return).
|
|
669
|
+
*
|
|
670
|
+
* @public
|
|
671
|
+
*/
|
|
672
|
+
declare interface RouteConfigValue {
|
|
673
|
+
readonly head?: DocumentHeadValue;
|
|
674
|
+
readonly eTag?: ContentModuleETag;
|
|
675
|
+
readonly cacheKey?: CacheKeyFn;
|
|
676
|
+
}
|
|
677
|
+
|
|
600
678
|
/** @public */
|
|
601
679
|
declare interface RouteLocation {
|
|
602
680
|
readonly params: Readonly<Record<string, string>>;
|
|
@@ -638,20 +716,17 @@ declare type ServerErrorCode = 500 | 501 | 502 | 503 | 504 | 505 | 506 | 507 | 5
|
|
|
638
716
|
/** @public */
|
|
639
717
|
export declare interface ServerRenderOptions extends RenderOptions {
|
|
640
718
|
render: Render;
|
|
641
|
-
/** @deprecated Use `QwikRouterConfig` instead. Will be removed in V3 */
|
|
642
|
-
qwikCityPlan?: QwikCityPlan;
|
|
643
|
-
qwikRouterConfig?: QwikRouterConfig;
|
|
644
719
|
/**
|
|
645
720
|
* Protection against cross-site request forgery (CSRF) attacks.
|
|
646
721
|
*
|
|
647
722
|
* When `true`, for every incoming POST, PUT, PATCH, or DELETE form submissions, the request
|
|
648
|
-
* origin is checked to match the server's origin.
|
|
723
|
+
* origin is checked to match the server's origin. `lax-proto` is for SSL-terminating proxies
|
|
649
724
|
*
|
|
650
725
|
* Be careful when disabling this option as it may lead to CSRF attacks.
|
|
651
726
|
*
|
|
652
727
|
* Defaults to `true`.
|
|
653
728
|
*/
|
|
654
|
-
checkOrigin?: boolean;
|
|
729
|
+
checkOrigin?: boolean | 'lax-proto';
|
|
655
730
|
}
|
|
656
731
|
|
|
657
732
|
/**
|
|
@@ -670,10 +745,10 @@ export declare interface ServerRequestEvent<T = unknown> {
|
|
|
670
745
|
}
|
|
671
746
|
|
|
672
747
|
/** @public */
|
|
673
|
-
export declare type ServerRequestMode = '
|
|
748
|
+
export declare type ServerRequestMode = 'static' | 'server';
|
|
674
749
|
|
|
675
750
|
/** @public */
|
|
676
|
-
export declare type ServerResponseHandler<T = any> = (status: number, headers: Headers, cookies: Cookie, resolve: (response: T) => void, requestEv:
|
|
751
|
+
export declare type ServerResponseHandler<T = any> = (status: number, headers: Headers, cookies: Cookie, resolve: (response: T) => void, requestEv: RequestEvent) => WritableStream<Uint8Array>;
|
|
677
752
|
|
|
678
753
|
/** @public */
|
|
679
754
|
declare interface StaticGenerate {
|