@qwik.dev/router 2.0.0-beta.8 → 2.0.0-rc.0

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.
Files changed (80) hide show
  1. package/lib/adapters/azure-swa/vite/index.d.ts +2 -2
  2. package/lib/adapters/azure-swa/vite/index.mjs +44 -57
  3. package/lib/adapters/bun-server/vite/index.d.ts +2 -2
  4. package/lib/adapters/bun-server/vite/index.mjs +16 -22
  5. package/lib/adapters/cloud-run/vite/index.d.ts +2 -2
  6. package/lib/adapters/cloud-run/vite/index.mjs +15 -19
  7. package/lib/adapters/cloudflare-pages/vite/index.d.ts +2 -2
  8. package/lib/adapters/cloudflare-pages/vite/index.mjs +45 -76
  9. package/lib/adapters/deno-server/vite/index.d.ts +2 -2
  10. package/lib/adapters/deno-server/vite/index.mjs +25 -34
  11. package/lib/adapters/netlify-edge/vite/index.d.ts +2 -2
  12. package/lib/adapters/netlify-edge/vite/index.mjs +49 -89
  13. package/lib/adapters/node-server/vite/index.d.ts +2 -2
  14. package/lib/adapters/node-server/vite/index.mjs +16 -22
  15. package/lib/adapters/shared/vite/index.d.ts +9 -16
  16. package/lib/adapters/shared/vite/index.mjs +280 -293
  17. package/lib/adapters/ssg/vite/index.d.ts +1 -1
  18. package/lib/adapters/ssg/vite/index.mjs +13 -299
  19. package/lib/adapters/vercel-edge/vite/index.d.ts +3 -3
  20. package/lib/adapters/vercel-edge/vite/index.mjs +75 -79
  21. package/lib/chunks/dev-preloaded-route-loader.mjs +2 -0
  22. package/lib/chunks/format.mjs +24 -0
  23. package/lib/chunks/fs.mjs +143 -0
  24. package/lib/chunks/head.qwik.mjs +1570 -0
  25. package/lib/chunks/http-error.qwik.mjs +28 -0
  26. package/lib/chunks/pathname.mjs +58 -0
  27. package/lib/chunks/request-body-limit.mjs +27 -0
  28. package/lib/chunks/request-path.mjs +53 -0
  29. package/lib/chunks/route-trie-key.mjs +10 -0
  30. package/lib/chunks/routes.mjs +26 -0
  31. package/lib/chunks/server-error.mjs +38 -0
  32. package/lib/chunks/static-file.mjs +70 -0
  33. package/lib/chunks/system.mjs +271 -0
  34. package/lib/chunks/user-response.mjs +1883 -0
  35. package/lib/chunks/worker-thread.mjs +274 -0
  36. package/lib/index.d.ts +550 -182
  37. package/lib/index.qwik.mjs +1742 -2030
  38. package/lib/middleware/aws-lambda/index.d.ts +15 -17
  39. package/lib/middleware/aws-lambda/index.mjs +46 -50
  40. package/lib/middleware/azure-swa/index.mjs +85 -294
  41. package/lib/middleware/bun/index.d.ts +20 -5
  42. package/lib/middleware/bun/index.mjs +117 -201
  43. package/lib/middleware/cloudflare-pages/index.mjs +101 -101
  44. package/lib/middleware/deno/index.d.ts +22 -5
  45. package/lib/middleware/deno/index.mjs +103 -191
  46. package/lib/middleware/firebase/index.mjs +22 -31
  47. package/lib/middleware/netlify-edge/index.mjs +63 -80
  48. package/lib/middleware/node/index.d.ts +17 -5
  49. package/lib/middleware/node/index.mjs +298 -269
  50. package/lib/middleware/request-handler/index.d.ts +259 -58
  51. package/lib/middleware/request-handler/index.mjs +108 -1730
  52. package/lib/middleware/vercel-edge/index.mjs +76 -100
  53. package/lib/modules.d.ts +7 -4
  54. package/lib/service-worker/index.mjs +14 -0
  55. package/lib/ssg/index.d.ts +50 -26
  56. package/lib/ssg/index.mjs +257 -43
  57. package/lib/vite/index.d.ts +59 -11
  58. package/lib/vite/index.mjs +2533 -27535
  59. package/modules.d.ts +7 -4
  60. package/package.json +53 -70
  61. package/lib/adapters/azure-swa/vite/index.cjs +0 -96
  62. package/lib/adapters/bun-server/vite/index.cjs +0 -50
  63. package/lib/adapters/cloud-run/vite/index.cjs +0 -47
  64. package/lib/adapters/cloudflare-pages/vite/index.cjs +0 -115
  65. package/lib/adapters/deno-server/vite/index.cjs +0 -62
  66. package/lib/adapters/netlify-edge/vite/index.cjs +0 -130
  67. package/lib/adapters/node-server/vite/index.cjs +0 -50
  68. package/lib/adapters/shared/vite/index.cjs +0 -338
  69. package/lib/adapters/ssg/vite/index.cjs +0 -339
  70. package/lib/adapters/vercel-edge/vite/index.cjs +0 -118
  71. package/lib/index.qwik.cjs +0 -2085
  72. package/lib/middleware/node/index.cjs +0 -310
  73. package/lib/middleware/request-handler/index.cjs +0 -1766
  74. package/lib/service-worker.cjs +0 -17
  75. package/lib/service-worker.mjs +0 -15
  76. package/lib/ssg/deno.mjs +0 -8
  77. package/lib/ssg/index.cjs +0 -67
  78. package/lib/ssg/node.cjs +0 -1126
  79. package/lib/ssg/node.mjs +0 -1088
  80. package/lib/vite/index.cjs +0 -27607
package/lib/index.d.ts CHANGED
@@ -1,19 +1,23 @@
1
1
  /// <reference path="./modules.d.ts" />
2
2
 
3
+ import type { AbortMessage } from '@qwik.dev/router/middleware/request-handler';
4
+ import type { CacheControl } from '@qwik.dev/router/middleware/request-handler';
3
5
  import { Component } from '@qwik.dev/core';
6
+ import type { ComputedSignal } from '@qwik.dev/core';
4
7
  import { Cookie } from '@qwik.dev/router/middleware/request-handler';
5
8
  import { CookieOptions } from '@qwik.dev/router/middleware/request-handler';
6
9
  import { CookieValue } from '@qwik.dev/router/middleware/request-handler';
7
10
  import { DeferReturn } from '@qwik.dev/router/middleware/request-handler';
8
11
  import type { EnvGetter } from '@qwik.dev/router/middleware/request-handler';
9
- import { JSXOutput as JSXOutput_2 } from '@qwik.dev/core';
12
+ import { InternalRequest } from '@qwik.dev/router/middleware/request-handler';
13
+ import { JSXOutput } from '@qwik.dev/core';
14
+ import { NoSerialize } from '@qwik.dev/core';
10
15
  import { QRL } from '@qwik.dev/core';
11
16
  import { QRLEventHandlerMulti } from '@qwik.dev/core';
12
17
  import { QwikIntrinsicElements } from '@qwik.dev/core';
13
18
  import { QwikJSX } from '@qwik.dev/core';
14
- import type { ReadonlySignal } from '@qwik.dev/core';
15
19
  import { Render } from '@qwik.dev/core/server';
16
- import { RenderOptions } from '@qwik.dev/core/server';
20
+ import { RenderToStreamOptions } from '@qwik.dev/core/server';
17
21
  import { RequestEvent } from '@qwik.dev/router/middleware/request-handler';
18
22
  import { RequestEventAction } from '@qwik.dev/router/middleware/request-handler';
19
23
  import { RequestEventBase } from '@qwik.dev/router/middleware/request-handler';
@@ -22,10 +26,13 @@ import { RequestEventLoader } from '@qwik.dev/router/middleware/request-handler'
22
26
  import { RequestHandler } from '@qwik.dev/router/middleware/request-handler';
23
27
  import type { ResolveSyncValue } from '@qwik.dev/router/middleware/request-handler';
24
28
  import type { SerializationStrategy } from '@qwik.dev/core/internal';
25
- import type * as v from 'valibot';
26
- import type { ValueOrPromise } from '@qwik.dev/core';
29
+ import type { ServerError } from '@qwik.dev/router/middleware/request-handler';
30
+ import type { Signal } from '@qwik.dev/core';
31
+ import * as v from 'valibot';
32
+ import { ValueOrPromise } from '@qwik.dev/core';
33
+ import { ValueOrPromise as ValueOrPromise_2 } from '@qwik.dev/core/internal';
27
34
  import { z } from 'zod';
28
- import type * as z_2 from 'zod';
35
+ import * as z_2 from 'zod';
29
36
 
30
37
  /** @public */
31
38
  export declare type Action<RETURN, INPUT = Record<string, unknown>, OPTIONAL extends boolean = true> = {
@@ -34,51 +41,36 @@ export declare type Action<RETURN, INPUT = Record<string, unknown>, OPTIONAL ext
34
41
  * component$(). Like all `use-` functions and methods, it can only be invoked within a
35
42
  * `component$()`.
36
43
  */
37
- (): ActionStore<RETURN, INPUT, OPTIONAL>;
44
+ (): ActionStore<ExcludeControlFlow<RETURN>, INPUT, OPTIONAL>;
38
45
  };
39
46
 
40
47
  /** @public */
41
48
  export declare type ActionConstructor = {
42
- <OBJ extends Record<string, any> | void | null, VALIDATOR extends TypedDataValidator, REST extends [DataValidator, ...DataValidator[]]>(actionQrl: (data: GetValidatorOutputType<VALIDATOR>, event: RequestEventAction) => ValueOrPromise<OBJ>, options: {
43
- readonly id?: string;
49
+ <OBJ extends Record<string, any> | void | null, VALIDATOR extends TypedDataValidator, REST extends [DataValidator, ...DataValidator[]]>(actionQrl: (data: GetValidatorOutputType<VALIDATOR>, event: RequestEventAction) => ValueOrPromise<OBJ>, options: ActionOptions & {
44
50
  readonly validation: [VALIDATOR, ...REST];
45
51
  }): Action<StrictUnion<OBJ | FailReturn<ValidatorErrorType<GetValidatorInputType<VALIDATOR>>> | FailReturn<FailOfRest<REST>>>, GetValidatorInputType<VALIDATOR>, false>;
46
- <OBJ extends Record<string, any> | void | null, VALIDATOR extends TypedDataValidator>(actionQrl: (data: GetValidatorOutputType<VALIDATOR>, event: RequestEventAction) => ValueOrPromise<OBJ>, options: {
47
- readonly id?: string;
52
+ <OBJ extends Record<string, any> | void | null, VALIDATOR extends TypedDataValidator>(actionQrl: (data: GetValidatorOutputType<VALIDATOR>, event: RequestEventAction) => ValueOrPromise<OBJ>, options: ActionOptions & {
48
53
  readonly validation: [VALIDATOR];
49
54
  }): Action<StrictUnion<OBJ | FailReturn<ValidatorErrorType<GetValidatorInputType<VALIDATOR>>>>, GetValidatorInputType<VALIDATOR>, false>;
50
- <OBJ extends Record<string, any> | void | null, REST extends [DataValidator, ...DataValidator[]]>(actionQrl: (data: JSONObject, event: RequestEventAction) => ValueOrPromise<OBJ>, options: {
51
- readonly id?: string;
55
+ <OBJ extends Record<string, any> | void | null, REST extends [DataValidator, ...DataValidator[]]>(actionQrl: (data: JSONObject, event: RequestEventAction) => ValueOrPromise<OBJ>, options: ActionOptions & {
52
56
  readonly validation: REST;
53
57
  }): Action<StrictUnion<OBJ | FailReturn<FailOfRest<REST>>>>;
54
58
  <OBJ extends Record<string, any> | void | null, VALIDATOR extends TypedDataValidator, REST extends [DataValidator, ...DataValidator[]]>(actionQrl: (data: GetValidatorOutputType<VALIDATOR>, event: RequestEventAction) => ValueOrPromise<OBJ>, options: VALIDATOR, ...rest: REST): Action<StrictUnion<OBJ | FailReturn<ValidatorErrorType<GetValidatorInputType<VALIDATOR>>> | FailReturn<FailOfRest<REST>>>, GetValidatorInputType<VALIDATOR>, false>;
55
59
  <OBJ extends Record<string, any> | void | null, VALIDATOR extends TypedDataValidator>(actionQrl: (data: GetValidatorOutputType<VALIDATOR>, event: RequestEventAction) => ValueOrPromise<OBJ>, options: VALIDATOR): Action<StrictUnion<OBJ | FailReturn<ValidatorErrorType<GetValidatorInputType<VALIDATOR>>>>, GetValidatorInputType<VALIDATOR>, false>;
56
60
  <OBJ extends Record<string, any> | void | null, REST extends [DataValidator, ...DataValidator[]]>(actionQrl: (form: JSONObject, event: RequestEventAction) => ValueOrPromise<OBJ>, ...rest: REST): Action<StrictUnion<OBJ | FailReturn<FailOfRest<REST>>>>;
57
- <OBJ>(actionQrl: (form: JSONObject, event: RequestEventAction) => ValueOrPromise<OBJ>, options?: {
58
- readonly id?: string;
59
- }): Action<StrictUnion<OBJ>>;
61
+ <OBJ>(actionQrl: (form: JSONObject, event: RequestEventAction) => ValueOrPromise<OBJ>, options?: ActionOptions): Action<StrictUnion<OBJ>>;
60
62
  };
61
63
 
62
64
  /** @public */
63
- declare type ActionConstructorQRL = {
64
- <OBJ extends Record<string, any> | void | null, VALIDATOR extends TypedDataValidator, REST extends [DataValidator, ...DataValidator[]]>(actionQrl: QRL<(data: GetValidatorOutputType<VALIDATOR>, event: RequestEventAction) => ValueOrPromise<OBJ>>, options: {
65
- readonly id?: string;
66
- readonly validation: [VALIDATOR, ...REST];
67
- }): Action<StrictUnion<OBJ | FailReturn<ValidatorErrorType<GetValidatorInputType<VALIDATOR>>> | FailReturn<FailOfRest<REST>>>, GetValidatorInputType<VALIDATOR>, false>;
68
- <OBJ extends Record<string, any> | void | null, VALIDATOR extends TypedDataValidator>(actionQrl: QRL<(data: GetValidatorOutputType<VALIDATOR>, event: RequestEventAction) => ValueOrPromise<OBJ>>, options: {
69
- readonly id?: string;
70
- readonly validation: [VALIDATOR];
71
- }): Action<StrictUnion<OBJ | FailReturn<ValidatorErrorType<GetValidatorInputType<VALIDATOR>>>>, GetValidatorInputType<VALIDATOR>, false>;
72
- <OBJ extends Record<string, any> | void | null, REST extends [DataValidator, ...DataValidator[]]>(actionQrl: QRL<(data: JSONObject, event: RequestEventAction) => ValueOrPromise<OBJ>>, options: {
73
- readonly id?: string;
74
- readonly validation: REST;
75
- }): Action<StrictUnion<OBJ | FailReturn<FailOfRest<REST>>>>;
76
- <OBJ extends Record<string, any> | void | null, VALIDATOR extends TypedDataValidator, REST extends [DataValidator, ...DataValidator[]]>(actionQrl: QRL<(data: GetValidatorOutputType<VALIDATOR>, event: RequestEventAction) => ValueOrPromise<OBJ>>, options: VALIDATOR, ...rest: REST): Action<StrictUnion<OBJ | FailReturn<ValidatorErrorType<GetValidatorInputType<VALIDATOR>>> | FailReturn<FailOfRest<REST>>>, GetValidatorInputType<VALIDATOR>, false>;
77
- <OBJ extends Record<string, any> | void | null, VALIDATOR extends TypedDataValidator>(actionQrl: QRL<(data: GetValidatorOutputType<VALIDATOR>, event: RequestEventAction) => ValueOrPromise<OBJ>>, options: VALIDATOR): Action<StrictUnion<OBJ | FailReturn<ValidatorErrorType<GetValidatorInputType<VALIDATOR>>>>, GetValidatorInputType<VALIDATOR>, false>;
78
- <OBJ extends Record<string, any> | void | null, REST extends [DataValidator, ...DataValidator[]]>(actionQrl: QRL<(form: JSONObject, event: RequestEventAction) => ValueOrPromise<OBJ>>, ...rest: REST): Action<StrictUnion<OBJ | FailReturn<FailOfRest<REST>>>>;
79
- <OBJ>(actionQrl: QRL<(form: JSONObject, event: RequestEventAction) => ValueOrPromise<OBJ>>, options?: {
80
- readonly id?: string;
81
- }): Action<StrictUnion<OBJ>>;
65
+ export declare type ActionOptions = {
66
+ readonly id?: string;
67
+ readonly validation?: DataValidator[];
68
+ /**
69
+ * Route loaders to invalidate after this action completes. The loader hooks' hashes are sent to
70
+ * the client so it knows which loaders to re-fetch. If omitted, ALL route loaders are invalidated
71
+ * (unless `strictLoaders` is enabled globally in the Vite plugin).
72
+ */
73
+ readonly invalidate?: Loader_2<any>[];
82
74
  };
83
75
 
84
76
  /** @public */
@@ -159,6 +151,27 @@ export declare type ActionStore<RETURN, INPUT, OPTIONAL extends boolean = true>
159
151
 
160
152
  declare type AnchorAttributes = QwikIntrinsicElements['a'];
161
153
 
154
+ /**
155
+ * Cache key function. Used by `routeConfig.cacheKey` (SSR HTML cache) and by `routeLoader$`'s
156
+ * `cacheKey` option (per-loader JSON cache).
157
+ *
158
+ * - `true`: use the surface's default key.
159
+ *
160
+ * - SSR default: `${status}|${eTag}|${pathname}` when an eTag is set, otherwise
161
+ * `${status}|${pathname}`.
162
+ * - Loader default: `${pathname}|${filteredSearch}|${loaderId}|${eTag}` when an eTag is set,
163
+ * otherwise `${pathname}|${filteredSearch}|${loaderId}`.
164
+ * - Function: receives the request event and the normalized, unquoted eTag (or an empty string when
165
+ * none was provided). Return the cache key string, or `null` or `''` to skip caching for this
166
+ * request. Loader callbacks receive the loader-scoped request event, with `url`, `query`, and
167
+ * `request.url` filtered by the loader's `search` allowlist.
168
+ *
169
+ * Note: valid cacheKeys are non-empty strings.
170
+ *
171
+ * @public
172
+ */
173
+ export declare type CacheKeyFn = true | ((requestEv: RequestEvent, eTag: string) => string | null);
174
+
162
175
  /** @public */
163
176
  export declare interface ContentHeading {
164
177
  readonly text: string;
@@ -175,9 +188,28 @@ export declare interface ContentMenu {
175
188
 
176
189
  declare type ContentModule = PageModule | LayoutModule;
177
190
 
178
- declare type ContentModuleHead = DocumentHead | ResolvedDocumentHead;
191
+ /**
192
+ * The eTag export type for routeConfig.
193
+ *
194
+ * - `string` — static ETag value.
195
+ * - `(props: DocumentHeadProps) => string | null` — compute the ETag from route context (params, URL,
196
+ * loaded data via `resolveValue`, etc.). Return `null` to skip eTag for this request.
197
+ *
198
+ * Qwik normalizes eTag values by stripping weak-form `W/` prefixes, quotes, and forbidden chars,
199
+ * then sends a strong `ETag` header. Values that normalize to an empty string are treated as
200
+ * absent.
201
+ *
202
+ * When set (and a value is produced), the server includes an `ETag` header and returns `304` if
203
+ * `If-None-Match` matches.
204
+ *
205
+ * @public
206
+ */
207
+ export declare type ContentModuleETag = string | ((props: DocumentHeadProps) => string | null);
208
+
209
+ /** @public */
210
+ export declare type ContentModuleHead = DocumentHead | ResolvedDocumentHead;
179
211
 
180
- declare type ContentModuleLoader = () => Promise<ContentModule>;
212
+ declare type ContentModuleLoader = () => ValueOrPromise<ContentModule>;
181
213
 
182
214
  /** @public */
183
215
  declare interface ContentState {
@@ -219,7 +251,7 @@ export { CookieValue }
219
251
  * @public
220
252
  */
221
253
  export declare const createRenderer: (getOptions: (options: RendererOptions) => {
222
- jsx: JSXOutput_2;
254
+ jsx: JSXOutput;
223
255
  options: RendererOutputOptions;
224
256
  }) => Render;
225
257
 
@@ -230,20 +262,15 @@ export declare type DataValidator<T extends Record<string, any> = {}> = {
230
262
 
231
263
  export { DeferReturn }
232
264
 
233
- /** @public */
234
- declare interface DevJSX {
235
- fileName: string;
236
- lineNumber: number;
237
- columnNumber: number;
238
- stack?: string;
239
- }
240
-
241
265
  /** @public */
242
266
  export declare type DocumentHead = DocumentHeadValue | ((props: DocumentHeadProps) => DocumentHeadValue);
243
267
 
244
268
  /** @public */
245
269
  export declare interface DocumentHeadProps extends RouteLocation {
246
270
  readonly head: ResolvedDocumentHead;
271
+ /** The HTTP status code of the response (e.g. 200, 404). */
272
+ readonly status: number;
273
+ /** @deprecated This is not necessary, it works correctly without */
247
274
  readonly withLocale: <T>(fn: () => T) => T;
248
275
  readonly resolveValue: ResolveSyncValue;
249
276
  }
@@ -336,23 +363,29 @@ export declare type DocumentStyle = Readonly<((Omit<QwikIntrinsicElements['style
336
363
  style?: never;
337
364
  })>;
338
365
 
339
- declare type EndpointModuleLoader = () => Promise<RouteModule>;
366
+ /** @public */
367
+ export declare type Editable<T> = {
368
+ -readonly [P in keyof T]: T[P];
369
+ };
370
+
371
+ declare type EndpointModuleLoader = () => ValueOrPromise<RouteModule>;
340
372
 
341
373
  declare interface EndpointResponse {
342
374
  status: number;
343
- loaders: Record<string, unknown>;
344
- loadersSerializationStrategy: Map<string, SerializationStrategy>;
375
+ statusMessage?: string;
345
376
  formData?: FormData;
346
377
  action?: string;
378
+ actionResult?: unknown;
379
+ loaderHashes?: string[];
347
380
  }
348
381
 
349
- /** @public */
350
- export declare const ErrorBoundary: Component<ErrorBoundaryProps>;
351
-
352
- /** @public */
353
- declare interface ErrorBoundaryProps {
354
- fallback$?: QRL<(error: any) => any>;
355
- }
382
+ /**
383
+ * Drops control-flow signals (`ev.redirect()`, `ev.error()`, etc.) from a loader/action return
384
+ * type: those are thrown, not surfaced as data. `ev.fail()` is plain data and is kept.
385
+ *
386
+ * @public
387
+ */
388
+ export declare type ExcludeControlFlow<T> = Exclude<T, AbortMessage | ServerError>;
356
389
 
357
390
  declare type Failed = {
358
391
  failed: true;
@@ -365,7 +398,7 @@ export declare type FailOfRest<REST extends readonly DataValidator[]> = REST ext
365
398
  export declare type FailReturn<T> = T & Failed;
366
399
 
367
400
  /** @public */
368
- export declare const Form: <O, I>({ action, spaReset, reloadDocument, onSubmit$, ...rest }: FormProps<O, I>, key: string | null) => JSXOutput_2;
401
+ export declare const Form: <O, I>({ action, spaReset, reloadDocument, onSubmit$, ...rest }: FormProps<O, I>, key: string | null) => JSXOutput;
369
402
 
370
403
  /** @public */
371
404
  export declare interface FormProps<O, I> extends Omit<QwikJSX.IntrinsicElements['form'], 'action' | 'method'> {
@@ -383,8 +416,6 @@ export declare interface FormProps<O, I> extends Omit<QwikJSX.IntrinsicElements[
383
416
  * Defaults to `false`
384
417
  */
385
418
  spaReset?: boolean;
386
- /** Event handler executed right when the form is submitted. */
387
- onSubmit$?: QRLEventHandlerMulti<SubmitEvent, HTMLFormElement> | undefined;
388
419
  /** Event handler executed right after the action is executed successfully and returns some data. */
389
420
  onSubmitCompleted$?: QRLEventHandlerMulti<CustomEvent<FormSubmitSuccessDetail<O>>, HTMLFormElement> | undefined;
390
421
  key?: string | number | null;
@@ -397,15 +428,45 @@ export declare interface FormSubmitSuccessDetail<T> {
397
428
  }
398
429
 
399
430
  /**
400
- * Any function taking a props object that returns JSXOutput.
431
+ * The base pathname the app is served under, such as `/` or `/docs/`.
401
432
  *
402
- * The `key`, `flags` and `dev` parameters are for internal use.
433
+ * @public
434
+ */
435
+ export declare const getBasePathname: () => string;
436
+
437
+ /**
438
+ * Returns the current RequestEvent if possible. Only usable on the server, and only during request
439
+ * processing.
440
+ *
441
+ * @public
442
+ */
443
+ export declare const getRequestEvent: (thisArg?: unknown) => RequestEvent | undefined;
444
+
445
+ /**
446
+ * The app's route config: the route trie, server plugins and build options that the Qwik Router
447
+ * Vite plugin generated. Resolves once the config is loaded and its `server$` modules are
448
+ * registered. On the server, the router copy of a Qwik library kept external reads the config of
449
+ * the app serving the current request.
450
+ *
451
+ * @public
452
+ */
453
+ export declare const getRouterConfig: () => Promise<QwikRouterConfig>;
454
+
455
+ /**
456
+ * The route trie of the app, as generated by the Qwik Router Vite plugin.
457
+ *
458
+ * @public
459
+ */
460
+ export declare const getRoutes: () => Promise<RouteData>;
461
+
462
+ /* Excluded from this release type: _getServiceWorkerScript */
463
+
464
+ /**
465
+ * Whether the app's URLs end with a trailing slash.
403
466
  *
404
467
  * @public
405
468
  */
406
- declare type FunctionComponent<P = unknown> = {
407
- renderFn(props: P, key: string | null, flags: number, dev?: DevJSX): JSXOutput;
408
- }['renderFn'];
469
+ export declare const getTrailingSlash: () => boolean;
409
470
 
410
471
  /** @public */
411
472
  export declare type GetValidatorInputType<VALIDATOR extends TypedDataValidator> = VALIDATOR extends ValibotDataValidator<infer TYPE> ? v.InferInput<TYPE> : VALIDATOR extends ZodDataValidator<infer TYPE> ? z_2.input<TYPE> : never;
@@ -421,6 +482,16 @@ export declare const globalAction$: ActionConstructor;
421
482
 
422
483
  /* Excluded from this release type: globalActionQrl */
423
484
 
485
+ /** @public */
486
+ export declare type HttpErrorProps = {
487
+ /** The HTTP status code, e.g. 404 */
488
+ status: number;
489
+ /** The error message, e.g. "Not Found" */
490
+ message: string;
491
+ };
492
+
493
+ export { InternalRequest }
494
+
424
495
  declare type IsAny<Type> = 0 extends 1 & Type ? true : false;
425
496
 
426
497
  /** @public */
@@ -433,31 +504,9 @@ export declare type JSONValue = string | number | boolean | {
433
504
  [x: string]: JSONValue;
434
505
  } | Array<JSONValue>;
435
506
 
436
- /** @public */
437
- declare type JSXChildren = string | number | boolean | null | undefined | Function | RegExp | JSXChildren[] | Promise<JSXChildren> | Signal<JSXChildren> | JSXNode;
438
-
439
- /**
440
- * A JSX Node, an internal structure. You probably want to use `JSXOutput` instead.
441
- *
442
- * @public
443
- */
444
- declare interface JSXNode<T extends string | FunctionComponent | unknown = unknown> {
445
- type: T;
446
- props: T extends FunctionComponent<infer P> ? P : Record<any, unknown>;
447
- children: JSXChildren | null;
448
- key: string | null;
449
- dev?: DevJSX;
450
- }
451
-
452
- /**
453
- * Any valid output for a component
454
- *
455
- * @public
456
- */
457
- declare type JSXOutput = JSXNode | string | number | boolean | null | undefined | JSXOutput[];
458
-
459
507
  declare interface LayoutModule extends RouteModule {
460
- readonly default: unknown;
508
+ readonly default?: (props: Record<string, never>) => JSXOutput;
509
+ readonly routeConfig?: RouteConfig;
461
510
  readonly head?: ContentModuleHead;
462
511
  }
463
512
 
@@ -467,34 +516,67 @@ export declare const Link: Component<LinkProps>;
467
516
  /** @public */
468
517
  export declare interface LinkProps extends AnchorAttributes {
469
518
  /**
470
- * **Defaults to _true_.**
519
+ * @deprecated Use `prefetchBundles` and `prefetchData` instead for more granular control over
520
+ * what is prefetched and when. This prop will be removed in a future major version.
471
521
  *
472
- * Whether Qwik should prefetch and cache the target page of this **`Link`**, this includes
473
- * invoking any **`routeLoader$`**, **`onGet`**, etc.
522
+ * Legacy prefetch control for this **`Link`**.
474
523
  *
475
- * This **improves UX performance** for client-side (**SPA**) navigations.
524
+ * Setting this value to **`"js"`** will prefetch only javascript bundles required to render this
525
+ * page on the client when the link becomes visible. Setting this value to **`true`** will
526
+ * prefetch both javascript bundles and route data when the link becomes visible. Setting this
527
+ * value to **`false`** will disable prefetching altogether.
528
+ */
529
+ prefetch?: boolean | 'js';
530
+ /**
531
+ * Controls when Qwik should prefetch the javascript bundles required to render this **`Link`**
532
+ * target during client-side navigation.
476
533
  *
477
- * Prefetching occurs when a the Link enters the viewport in production (**`on:qvisible`**), or
478
- * with **`mouseover`/`focus`** during dev.
534
+ * Defaults to **`"visible"`**.
479
535
  *
480
536
  * Prefetching will not occur if the user has the **data saver** setting enabled.
537
+ */
538
+ prefetchBundles?: PrefetchStrategy;
539
+ /**
540
+ * Controls when Qwik should prefetch and cache route data for this **`Link`** target, including
541
+ * invoking any **`routeLoader$`**, **`onGet`**, etc.
542
+ *
543
+ * Defaults to **`"intent"`**. When using the deprecated **`prefetch="js"`** prop, route data
544
+ * prefetching defaults to **`"off"`**.
481
545
  *
482
- * Setting this value to **`"js"`** will prefetch only javascript bundles required to render this
483
- * page on the client, **`false`** will disable prefetching altogether.
546
+ * Prefetching route data can improve client-side navigation performance for pages that wait on
547
+ * loaders, server handlers, databases, or API calls.
548
+ *
549
+ * Prefetching will not occur if the user has the **data saver** setting enabled.
484
550
  */
485
- prefetch?: boolean | 'js';
551
+ prefetchData?: PrefetchStrategy;
486
552
  reload?: boolean;
487
553
  replaceState?: boolean;
488
554
  scroll?: boolean;
489
555
  }
490
556
 
491
- declare type LoadedRoute = [
492
- routeName: string,
493
- params: PathParams,
494
- mods: (RouteModule | ContentModule)[],
495
- menu: ContentMenu | undefined,
496
- routeBundleNames: string[] | undefined
497
- ];
557
+ /** The route to render */
558
+ declare interface LoadedRoute {
559
+ /** The canonical path of the route, e.g. `/products/[id]` */
560
+ $routeName$: string;
561
+ /** The route parameters, e.g. `{ id: '123' }` */
562
+ $params$: PathParams;
563
+ /** The modules associated with this route (on 404, contains only the error component) */
564
+ $mods$: (RouteModule | ContentModule)[];
565
+ /** The menu associated with this route */
566
+ $menu$?: ContentMenu | undefined;
567
+ /** The bundle names for this route */
568
+ $routeBundleNames$?: string[] | undefined;
569
+ /** Whether this route is a not-found (404) route */
570
+ $notFound$?: boolean;
571
+ /** The nearest _E (error.tsx) boundary's chain to render on a thrown ServerError (in its layouts). */
572
+ $errorLoader$?: ModuleLoader[];
573
+ /** Merged array of routeLoader$ hashes from all matched nodes (layouts + page) */
574
+ $loaders$?: string[];
575
+ /** Runtime-only mapping of routeLoader$ hashes to the matched pathname used for q-loader fetches */
576
+ $loaderPaths$?: Record<string, string>;
577
+ /** Runtime-only mapping of routeLoader$ hashes to params matched at their loader path */
578
+ $loaderParams$?: Record<string, PathParams>;
579
+ }
498
580
 
499
581
  /** @public */
500
582
  declare type Loader_2<RETURN> = {
@@ -502,7 +584,7 @@ declare type Loader_2<RETURN> = {
502
584
  * Returns the `Signal` containing the data returned by the `loader$` function. Like all `use-`
503
585
  * functions and methods, it can only be invoked within a `component$()`.
504
586
  */
505
- (): LoaderSignal<RETURN>;
587
+ (): LoaderSignal<ExcludeControlFlow<RETURN>>;
506
588
  };
507
589
  export { Loader_2 as Loader }
508
590
 
@@ -512,24 +594,110 @@ declare type LoaderConstructor = {
512
594
  <OBJ extends Record<string, any> | void | null, REST extends readonly DataValidator[]>(loaderFn: (event: RequestEventLoader) => ValueOrPromise<OBJ>, ...rest: REST): Loader_2<StrictUnion<OBJ | FailReturn<FailOfRest<REST>>>>;
513
595
  };
514
596
 
515
- /** @public */
516
- declare type LoaderConstructorQRL = {
517
- <OBJ>(loaderQrl: QRL<(event: RequestEventLoader) => ValueOrPromise<OBJ>>, options?: LoaderOptions): Loader_2<[Extract<OBJ, Failed>] extends [never] ? OBJ : StrictUnion<OBJ>>;
518
- <OBJ extends Record<string, any> | void | null, REST extends readonly DataValidator[]>(loaderQrl: QRL<(event: RequestEventLoader) => ValueOrPromise<OBJ>>, ...rest: REST): Loader_2<StrictUnion<OBJ | FailReturn<FailOfRest<REST>>>>;
519
- };
597
+ declare interface LoaderInternal extends Loader_2<any> {
598
+ readonly __brand?: 'server_loader';
599
+ __qrl: QRL<(event: RequestEventLoader) => ValueOrPromise<unknown>>;
600
+ __id: string;
601
+ __validators: DataValidator[] | undefined;
602
+ __serializationStrategy: SerializationStrategy;
603
+ __cacheControl: CacheControl | ((ev: RequestEvent) => CacheControl | null) | undefined;
604
+ __eTag: string | ((ev: RequestEvent) => string | null) | undefined;
605
+ __cacheKey: CacheKeyFn | undefined;
606
+ __search: string[] | undefined;
607
+ __blockSSR: boolean;
608
+ (): LoaderSignal<unknown>;
609
+ }
520
610
 
521
611
  /** @public */
522
612
  declare type LoaderOptions = {
613
+ /**
614
+ * Explicit loader id, overriding the QRL hash. Pass a distinct value (e.g. `fn.getHash()`) when
615
+ * loaders share a wrapper QRL.
616
+ */
523
617
  readonly id?: string;
524
618
  readonly validation?: DataValidator[];
525
619
  readonly serializationStrategy?: SerializationStrategy;
620
+ /**
621
+ * Cache-Control for this loader's JSON responses. The browser HTTP cache is the single source of
622
+ * freshness for loader data: on every client navigation the loaders re-fetch, and this header
623
+ * decides whether the browser serves the fetch from cache, revalidates, or hits the server.
624
+ *
625
+ * Accepts any `cacheControl()` value (`'immutable'`, `'no-cache'`, a max-age number, an options
626
+ * object) or a function of the request event; the function may return `null` to skip the header.
627
+ * A `Cache-Control` header set inside the loader function wins over this option.
628
+ *
629
+ * Defaults to `private, no-cache` (browser revalidation without shared caching; combine with
630
+ * `eTag` for cheap 304s). Explicit `'no-cache'` and numeric values allow shared caching; numeric
631
+ * values include `s-maxage`.
632
+ *
633
+ * The literal value `'immutable'` also marks the loader's data as static, so SSG writes a
634
+ * per-loader JSON file at build time.
635
+ */
636
+ readonly cacheControl?: CacheControl | ((ev: RequestEvent) => CacheControl | null);
637
+ /**
638
+ * Enable ETag-based caching for this loader's JSON responses.
639
+ *
640
+ * - `string` — static ETag value; if `If-None-Match` matches, the loader is skipped entirely
641
+ * - `(ev: RequestEvent) => string | null` — compute the ETag from the request context (params, URL,
642
+ * headers, etc.); if `If-None-Match` matches, the loader is skipped entirely. Return null to
643
+ * skip eTag for this request.
644
+ *
645
+ * Qwik normalizes eTag values by stripping weak-form `W/` prefixes, quotes, and forbidden chars,
646
+ * then sends a strong `ETag` header. Values that normalize to an empty string are treated as
647
+ * absent.
648
+ *
649
+ * When set, the server includes an `ETag` header on `q-loader-*.json` responses and returns `304`
650
+ * if the client sends a matching `If-None-Match` header.
651
+ *
652
+ * For auto-computed eTags, use `cacheKey` instead — on cache write the eTag is hashed from the
653
+ * serialized response and stored alongside it, so subsequent hits get the same eTag.
654
+ */
655
+ readonly eTag?: string | ((ev: RequestEvent) => string | null);
656
+ /**
657
+ * Enable in-memory server-side caching of this loader's serialized JSON response.
658
+ *
659
+ * - `true` — use the default key `${pathname}|${filteredSearch}|${loaderId}` (suffixed with
660
+ * `|${eTag}` when an eTag is set).
661
+ * - Function `(requestEv, eTag) => string | null` — return a custom key, or `null` to skip caching
662
+ * this request. For user-specific data, include user identity and relevant permissions in the
663
+ * key or disable this cache.
664
+ *
665
+ * On cache miss the loader runs, the serialized response is stored alongside its eTag (computed
666
+ * from the data when no `eTag` option is set), and the response is sent. On cache hit the stored
667
+ * `{ eTag, data }` pair is served directly — `If-None-Match` is checked against the stored eTag
668
+ * and a `304` is returned when it matches.
669
+ */
670
+ readonly cacheKey?: CacheKeyFn;
671
+ /**
672
+ * Allowlist of URL search parameter names that this loader depends on.
673
+ *
674
+ * When set, the loader only re-fetches when the listed search params change — other param changes
675
+ * are ignored. Only the listed params are sent in the loader JSON request URL. During SSR and
676
+ * loader JSON requests, the loader receives a request event with `url`, `query`, and
677
+ * `request.url` filtered to the same params.
678
+ *
679
+ * When not set, the `qwikRouter()` plugin option `strictLoaders` determines the behavior. If
680
+ * `strictLoaders` is `true` (this is the default), no search params are sent and changes do not
681
+ * trigger a re-fetch. If `strictLoaders` is `false`, all search params are sent and any change
682
+ * triggers a re-fetch.
683
+ */
684
+ readonly search?: string[];
685
+ /**
686
+ * When true (default), the loader is awaited before SSR renders, so its redirect or error can
687
+ * short-circuit the response and its value is ready for synchronous reads (e.g. in the head).
688
+ *
689
+ * When false, the loader runs in the background without blocking SSR: rendering starts
690
+ * immediately and reading its `.value` suspends until it resolves. A background loader cannot
691
+ * redirect or error the initial SSR response; treat it as a separate request.
692
+ *
693
+ * Setting `false` is experimental and requires adding `experimental: ["blockSSR"]` to your
694
+ * qwikVite plugin options.
695
+ */
696
+ readonly blockSSR?: boolean;
526
697
  };
527
698
 
528
699
  /** @public */
529
- export declare type LoaderSignal<TYPE> = TYPE extends () => ValueOrPromise<infer VALIDATOR> ? ReadonlySignal<ValueOrPromise<VALIDATOR>> : ReadonlySignal<TYPE>;
530
-
531
- /** @public */
532
- export declare type MenuData = [pathname: string, menuLoader: MenuModuleLoader];
700
+ export declare type LoaderSignal<TYPE> = (TYPE extends () => ValueOrPromise<infer VALIDATOR> ? Signal<ValueOrPromise<VALIDATOR>> : Signal<TYPE>) & Pick<ComputedSignal<any>, 'promise'>;
533
701
 
534
702
  declare interface MenuModule {
535
703
  readonly default: ContentMenu;
@@ -552,16 +720,42 @@ export { NavigationType_2 as NavigationType }
552
720
  export declare function omitProps<T, KEYS extends keyof T>(obj: T, keys: KEYS[]): Omit<T, KEYS>;
553
721
 
554
722
  /** @public */
555
- export declare interface PageModule extends RouteModule {
556
- readonly default: unknown;
723
+ export declare type PageModule = RouteModule & {
724
+ readonly default: (props: Record<string, never>) => JSXOutput;
725
+ readonly routeConfig?: RouteConfig;
557
726
  readonly head?: ContentModuleHead;
727
+ readonly eTag?: ContentModuleETag;
728
+ readonly cacheKey?: CacheKeyFn;
558
729
  readonly headings?: ContentHeading[];
559
730
  readonly onStaticGenerate?: StaticGenerateHandler;
560
- }
731
+ };
561
732
 
562
733
  /** @public */
563
734
  export declare type PathParams = Record<string, string>;
564
735
 
736
+ /**
737
+ * Defines when link prefetching should be triggered.
738
+ *
739
+ * @public
740
+ */
741
+ export declare type PrefetchStrategy =
742
+ /**
743
+ * Prefetch when the user commits to navigating.
744
+ *
745
+ * Triggered by `pointerdown` or the `Enter` key.
746
+ */
747
+ 'commit'
748
+ /**
749
+ * Prefetch when the user shows navigation intent.
750
+ *
751
+ * Triggered by `pointerenter`, hover, or focus.
752
+ */
753
+ | 'intent'
754
+ /** Prefetch when the link becomes visible in the viewport. */
755
+ | 'visible'
756
+ /** Disable link prefetching. */
757
+ | 'off';
758
+
565
759
  declare type Prettify<T> = {} & {
566
760
  [K in keyof T]: T[K];
567
761
  };
@@ -591,12 +785,6 @@ export declare const QWIK_CITY_SCROLLER = "_qCityScroller";
591
785
  /** @public */
592
786
  export declare const QWIK_ROUTER_SCROLLER = "_qRouterScroller";
593
787
 
594
- /**
595
- * @deprecated Use `QwikRouterMockProps` instead. will be removed in V3
596
- * @public
597
- */
598
- export declare type QwikCityMockProps = QwikRouterMockProps;
599
-
600
788
  /**
601
789
  * @deprecated Use `useQwikMockRouter()` instead. Will be removed in V3
602
790
  * @public
@@ -623,12 +811,21 @@ export declare const QwikCityProvider: Component<QwikRouterProps>;
623
811
 
624
812
  /** @public */
625
813
  export declare interface QwikRouterConfig {
626
- readonly routes: RouteData[];
814
+ readonly routes: RouteData;
627
815
  readonly serverPlugins?: RouteModule[];
628
816
  readonly basePathname?: string;
629
- readonly menus?: MenuData[];
630
817
  readonly trailingSlash?: boolean;
631
818
  readonly cacheModules?: boolean;
819
+ /** When true, return null instead of rendering the 404 page, letting the adapter handle it */
820
+ readonly fallthrough?: boolean;
821
+ /**
822
+ * Imports the modules containing `server$` functions so their registration side effects run.
823
+ * Called by the request handler before serving; deliberately async so the config module itself
824
+ * evaluates without touching the runtime (see the import-cycle notes in `route-loaders.ts`).
825
+ */
826
+ readonly importEagerModules?: () => Promise<unknown>;
827
+ /** URL of the app's service worker, when the routes define one. */
828
+ readonly serviceWorkerUrl?: string;
632
829
  }
633
830
 
634
831
  /** @public */
@@ -637,14 +834,67 @@ export declare interface QwikRouterEnvData {
637
834
  ev: RequestEvent;
638
835
  params: PathParams;
639
836
  response: EndpointResponse;
640
- loadedRoute: LoadedRoute | null;
837
+ loadedRoute: LoadedRoute;
838
+ routeLoaderCtx: RouteLoaderCtx;
839
+ loaderValues: Record<string, unknown>;
840
+ }
841
+
842
+ /** @public */
843
+ export declare interface QwikRouterMockActionProp<T = any> {
844
+ /** The action function to mock. */
845
+ action: Action<T>;
846
+ /** The QRL function that will be called when the action is submitted. */
847
+ handler: QRL<(data: T) => ValueOrPromise_2<RouteActionResolver>>;
848
+ }
849
+
850
+ /** @public */
851
+ export declare interface QwikRouterMockLoaderProp<T = any> {
852
+ /** The loader function to mock. */
853
+ loader: Loader_2<T>;
854
+ /** The data to return when the loader is called. */
855
+ data: T;
641
856
  }
642
857
 
643
858
  /** @public */
644
859
  export declare interface QwikRouterMockProps {
860
+ /**
861
+ * Allow mocking the url returned by `useLocation` hook.
862
+ *
863
+ * Default: `http://localhost/`
864
+ */
645
865
  url?: string;
866
+ /** Allow mocking the route params returned by `useLocation` hook. */
646
867
  params?: Record<string, string>;
868
+ /** Allow mocking the `goto` function returned by `useNavigate` hook. */
647
869
  goto?: RouteNavigate;
870
+ /**
871
+ * Allow mocking data for loaders defined with `routeLoader$` function.
872
+ *
873
+ * ```
874
+ * [
875
+ * {
876
+ * loader: useProductData,
877
+ * data: { product: { name: 'Test Product' } },
878
+ * },
879
+ * ];
880
+ * ```
881
+ */
882
+ loaders?: Array<QwikRouterMockLoaderProp<any>>;
883
+ /**
884
+ * Allow mocking actions defined with `routeAction$` function.
885
+ *
886
+ * ```
887
+ * [
888
+ * {
889
+ * action: useAddUser,
890
+ * handler: $(async (data) => {
891
+ * console.log('useAddUser action called with data:', data);
892
+ * }),
893
+ * },
894
+ * ];
895
+ * ```
896
+ */
897
+ actions?: Array<QwikRouterMockActionProp<any>>;
648
898
  }
649
899
 
650
900
  /** @public */
@@ -653,9 +903,9 @@ export declare const QwikRouterMockProvider: Component<QwikRouterMockProps>;
653
903
  /** @public */
654
904
  export declare interface QwikRouterProps {
655
905
  /**
656
- * Enable the ViewTransition API
906
+ * Enable the ViewTransition API on SPA navigation. Opt-in: set to `true` to enable.
657
907
  *
658
- * Default: `true`
908
+ * Default: `false`
659
909
  *
660
910
  * @see https://github.com/WICG/view-transitions/blob/main/explainer.md
661
911
  * @see https://developer.mozilla.org/en-US/docs/Web/API/View_Transitions_API
@@ -664,21 +914,16 @@ export declare interface QwikRouterProps {
664
914
  viewTransition?: boolean;
665
915
  }
666
916
 
667
- /** @public This is a wrapper around the `useQwikRouter()` hook. We recommend using the hook instead of this component. */
917
+ /** @public This is a wrapper around the `useQwikRouter()` hook. We recommend using the hook instead of this component, unless you have a good reason to make your root component reactive. */
668
918
  export declare const QwikRouterProvider: Component<QwikRouterProps>;
669
919
 
670
920
  /** @public */
671
- declare interface ReadonlySignal_2<T = unknown> {
672
- readonly value: T;
673
- }
674
-
675
- /** @public */
676
- export declare type RendererOptions = Omit<RenderOptions, 'serverData'> & {
921
+ export declare type RendererOptions = Omit<RenderToStreamOptions, 'serverData'> & {
677
922
  serverData: ServerData;
678
923
  };
679
924
 
680
925
  /** @public */
681
- export declare type RendererOutputOptions = Omit<RenderOptions, 'serverData'> & {
926
+ export declare type RendererOutputOptions = Omit<RenderToStreamOptions, 'serverData'> & {
682
927
  serverData: ServerData & {
683
928
  documentHead?: DocumentHeadValue;
684
929
  } & Record<string, unknown>;
@@ -697,24 +942,169 @@ export { RequestEventLoader }
697
942
  export { RequestHandler }
698
943
 
699
944
  /** @public */
700
- export declare type ResolvedDocumentHead<FrontMatter extends Record<string, any> = Record<string, unknown>> = Required<DocumentHeadValue<FrontMatter>>;
945
+ export declare type ResolvedDocumentHead<FrontMatter extends Record<string, any> = Record<string, unknown>> = Required<DocumentHeadValue<FrontMatter>> & {
946
+ /** The build's manifest hash, used for per-loader data URLs. Always defined (`'dev'` in dev). */
947
+ readonly manifestHash: string;
948
+ };
701
949
 
702
- /** @public */
950
+ /**
951
+ * Define a route action that handles form submissions or programmatic invocations.
952
+ *
953
+ * Actions run on the server when submitted from the client. The result is returned as an
954
+ * `ActionStore` with `.value` for success data and `.error` for errors (including validation errors
955
+ * from `zod$`/`valibot$` where `.fieldErrors` etc. are accessible directly on `.error`).
956
+ *
957
+ * By default, after an action completes, ALL current route loaders are invalidated on the client
958
+ * and re-fetched as needed (so that the browser cache is correct). This can be controlled with:
959
+ *
960
+ * - `invalidate: [loader1, loader2]`: Only invalidate specific loaders. The client re-fetches them
961
+ * individually. Other loaders keep their current data.
962
+ * - `invalidate: []`: No loaders are invalidated. The action response only contains the action
963
+ * result. Use this when the action doesn't affect any loader data.
964
+ *
965
+ * The `strictLoaders` Vite plugin option applies `invalidate: []` globally for all actions that
966
+ * don't specify an explicit `invalidate` option.
967
+ *
968
+ * @public
969
+ */
703
970
  export declare const routeAction$: ActionConstructor;
704
971
 
705
- /* Excluded from this release type: routeActionQrl */
972
+ /**
973
+ * Hoisted function declarations (not consts) on purpose, like `routeLoaderQrl`: the app's route
974
+ * modules call these factories during their own evaluation, which a bundle may run before this
975
+ * module, where a `const` binding would throw a TDZ ReferenceError.
976
+ *
977
+ * @public
978
+ */
979
+ export declare function routeActionQrl(actionQrl: QRL<(form: JSONObject, event: RequestEventAction) => unknown>, ...rest: (ActionOptions | DataValidator)[]): {
980
+ (): Editable<ActionStore<unknown, unknown>>;
981
+ __brand: "server_action";
982
+ __validators: DataValidator[];
983
+ __qrl: QRL<(form: JSONObject, event: RequestEventAction) => unknown>;
984
+ __id: string;
985
+ __invalidate: string[] | undefined;
986
+ };
706
987
 
707
- /** @public */
708
- export declare type RouteData = [routeName: string, loaders: ModuleLoader[]] | [
709
- routeName: string,
710
- loaders: ModuleLoader[],
711
- originalPathname: string,
712
- routeBundleNames: string[]
713
- ];
988
+ declare type RouteActionResolver = {
989
+ status: number;
990
+ result: unknown;
991
+ };
714
992
 
715
- /** @public */
993
+ /**
994
+ * Unified route configuration export. Groups head, eTag, and cacheKey with the same resolution
995
+ * rules as DocumentHead: can be a static object or a function receiving DocumentHeadProps.
996
+ *
997
+ * When a module exports `routeConfig`, the separate `head`, `eTag`, and `cacheKey` exports are
998
+ * ignored for that module.
999
+ *
1000
+ * @public
1001
+ */
1002
+ export declare type RouteConfig = RouteConfigValue | ((props: DocumentHeadProps) => RouteConfigValue);
1003
+
1004
+ /**
1005
+ * The value shape returned by a routeConfig export (object form or function return).
1006
+ *
1007
+ * @public
1008
+ */
1009
+ export declare interface RouteConfigValue {
1010
+ readonly head?: DocumentHeadValue;
1011
+ readonly eTag?: ContentModuleETag;
1012
+ readonly cacheKey?: CacheKeyFn;
1013
+ }
1014
+
1015
+ /**
1016
+ * A nested route trie structure. The root represents `/` and each level represents a URL segment.
1017
+ *
1018
+ * Keys starting with a single `_` are metadata; all other keys are child route segments. A static
1019
+ * segment that starts with `_` is stored with an extra `_` (`_drafts` → `__drafts`).
1020
+ *
1021
+ * - Use `_W` as the key for a single dynamic segment (param); `_P` on that node names the param.
1022
+ * - Use `_A` as the key for a rest/catch-all segment; `_P` on that node names the param.
1023
+ * - For infix params like `pre[slug]post`, use `_W` with `_0` (prefix) and `_9` (suffix).
1024
+ * - Use `_M` for an array of group (pathless layout) nodes, sorted by group name.
1025
+ *
1026
+ * Exact segments match case-insensitively. When several routes match, the most specific wins,
1027
+ * compared segment by segment: an exact segment beats `_W` (with optional prefix/suffix), which
1028
+ * beats `_A`. When no route matches, the closest `_E` (error.tsx) or `_4` (404.tsx) loader in the
1029
+ * ancestor chain is used to render the error page.
1030
+ *
1031
+ * @public
1032
+ */
1033
+ export declare interface RouteData {
1034
+ /** This node's layout loader (single). Runtime accumulates these during trie traversal. */
1035
+ _L?: ContentModuleLoader;
1036
+ /**
1037
+ * This node's index/page loader. Single = normal (runtime prepends gathered _L). Array = override
1038
+ * (layout stop / named layout — IS the complete chain).
1039
+ */
1040
+ _I?: ContentModuleLoader | ModuleLoader[];
1041
+ /** Rewrite/goto target path. Matcher re-walks trie from root using this path's keys. */
1042
+ _G?: string;
1043
+ /** The JS bundle names for this route (SSR only) */
1044
+ _B?: string[];
1045
+ /**
1046
+ * Not-found (404) boundary: single loader (runtime prepends layouts) or override chain
1047
+ * (`404@layout`/`!`).
1048
+ */
1049
+ _4?: ContentModuleLoader | ModuleLoader[];
1050
+ /** Error (error.tsx) boundary, same single-or-override-chain shape as `_4`. */
1051
+ _E?: ContentModuleLoader | ModuleLoader[];
1052
+ /** The parameter name when this node is reached via `_W` or `_A` from the parent */
1053
+ _P?: string;
1054
+ /** Prefix for infix params (e.g. "pre" for `pre[slug]post`) — only on `_W` nodes */
1055
+ _0?: string;
1056
+ /** Suffix for infix params (e.g. "post" for `pre[slug]post`) — only on `_W` nodes */
1057
+ _9?: string;
1058
+ /** Group (pathless layout) nodes merged into this level, sorted by group name */
1059
+ _M?: RouteData[];
1060
+ /** Menu loader for this subtree (from menu.md). Runtime uses nearest ancestor during traversal. */
1061
+ _N?: MenuModuleLoader;
1062
+ /** Inherited layout and server plugin routeLoader$ hashes. */
1063
+ _R?: string[];
1064
+ /** Page loader hashes; override pages include their selected layouts and plugins. */
1065
+ _D?: string[];
1066
+ /** Child route segments (any key not starting with a single `_`) */
1067
+ [part: string]: RouteData | RouteData[] | ModuleLoader[] | ContentModuleLoader | MenuModuleLoader | string[] | string | undefined;
1068
+ }
1069
+
1070
+ /**
1071
+ * Define a route loader that fetches data before the route renders.
1072
+ *
1073
+ * Route loaders run on the server during SSR and return data as a `ComputedSignal`. On the client,
1074
+ * loaders automatically re-fetch when the route changes (SPA navigation). Each loader gets its own
1075
+ * JSON endpoint (`q-loader-{id}.{hash}.json`), so only the loaders present on the target route are
1076
+ * fetched.
1077
+ *
1078
+ * **Important:** Route loader data uses Qwik's custom serialization format, not standard JSON. This
1079
+ * means the data supports features like circular references, Dates, and other non-JSON types, but
1080
+ * it cannot be consumed by external clients expecting plain JSON.
1081
+ *
1082
+ * ## Options
1083
+ *
1084
+ * - `search: string[]`: Allowlist of URL search params the loader depends on. Only listed params are
1085
+ * sent in the request and changes to other params are ignored. During SSR and loader JSON
1086
+ * requests, the loader's request event is filtered to those params too. `search: []` means no
1087
+ * search params are sent and only route path changes trigger a re-fetch.
1088
+ * - `eTag`: Enable ETag-based caching. Can be `true` (auto-hash), a string, or a function.
1089
+ * - `cacheControl`: Cache-Control for loader JSON responses; the browser HTTP cache controls
1090
+ * client-side freshness. `'immutable'` additionally lets SSG write the loader file.
1091
+ *
1092
+ * The `strictLoaders` Vite plugin option applies `search: []` globally for all loaders that don't
1093
+ * specify an explicit `search` option.
1094
+ *
1095
+ * @public
1096
+ */
716
1097
  export declare const routeLoader$: LoaderConstructor;
717
1098
 
1099
+ /** Shared SSR paths and client-only loader navigation state. */
1100
+ declare type RouteLoaderCtx = {
1101
+ loaderPaths: Record<string, string | undefined>;
1102
+ /** SPA navigation function. Client-only and intentionally omitted from SSR state. */
1103
+ goto?: NoSerialize<RouteNavigate>;
1104
+ /** Client manifest hash for q-loader fetch URLs. */
1105
+ manifestHash?: string;
1106
+ };
1107
+
718
1108
  /* Excluded from this release type: routeLoaderQrl */
719
1109
 
720
1110
  /** @public */
@@ -762,6 +1152,7 @@ declare interface ServerConfig {
762
1152
  export declare type ServerData = {
763
1153
  url: string;
764
1154
  requestHeaders: Record<string, string>;
1155
+ renderMode: 'static' | 'server';
765
1156
  locale: string | undefined;
766
1157
  nonce: string | undefined;
767
1158
  containerAttributes: Record<string, string> & {
@@ -791,27 +1182,19 @@ export declare type ServerQRL<T extends ServerFunction> = QRL<((abort: AbortSign
791
1182
  * JS extensions are allowed) will be picked up, bundled into a separate file, and registered as a
792
1183
  * service worker.
793
1184
  *
1185
+ * Qwik 1.14.0 and above now use `<link rel="modulepreload">` by default. If you didn't add custom
1186
+ * service-worker logic, you should remove your service-worker.ts file(s) for the
1187
+ * `ServiceWorkerRegister` Component to actually unregister the service-worker.js and delete its
1188
+ * related cache. Make sure to keep the `ServiceWorkerRegister` Component in your app (without any
1189
+ * service-worker.ts file) as long as you want to unregister the service-worker.js for your users.
1190
+ *
794
1191
  * @public
795
1192
  */
796
1193
  export declare const ServiceWorkerRegister: (props: {
797
1194
  nonce?: string;
798
1195
  }) => JSXOutput;
799
1196
 
800
- /**
801
- * A signal is a reactive value which can be read and written. When the signal is written, all tasks
802
- * which are tracking the signal will be re-run and all components that read the signal will be
803
- * re-rendered.
804
- *
805
- * Furthermore, when a signal value is passed as a prop to a component, the optimizer will
806
- * automatically forward the signal. This means that `return <div title={signal.value}>hi</div>`
807
- * will update the `title` attribute when the signal changes without having to re-render the
808
- * component.
809
- *
810
- * @public
811
- */
812
- declare interface Signal<T = any> extends ReadonlySignal_2<T> {
813
- value: T;
814
- }
1197
+ /* Excluded from this release type: _setRouterConfig */
815
1198
 
816
1199
  /** @public */
817
1200
  export declare interface StaticGenerate {
@@ -849,6 +1232,9 @@ export declare const useContent: () => ContentState;
849
1232
  */
850
1233
  export declare const useDocumentHead: <FrontMatter extends Record<string, unknown> = Record<string, any>>() => Required<ResolvedDocumentHead<FrontMatter>>;
851
1234
 
1235
+ /** @public */
1236
+ export declare const useHttpStatus: () => HttpErrorProps;
1237
+
852
1238
  /** @public */
853
1239
  export declare const useLocation: () => RouteLocation;
854
1240
 
@@ -910,12 +1296,6 @@ declare type ValibotConstructor = {
910
1296
  <T extends v.GenericSchema | v.GenericSchemaAsync>(schema: (ev: RequestEvent) => T): ValibotDataValidator<T>;
911
1297
  };
912
1298
 
913
- /** @beta */
914
- declare type ValibotConstructorQRL = {
915
- <T extends v.GenericSchema | v.GenericSchemaAsync>(schema: QRL<T>): ValibotDataValidator<T>;
916
- <T extends v.GenericSchema | v.GenericSchemaAsync>(schema: QRL<(ev: RequestEvent) => T>): ValibotDataValidator<T>;
917
- };
918
-
919
1299
  /** @beta */
920
1300
  declare type ValibotDataValidator<T extends v.GenericSchema | v.GenericSchemaAsync = v.GenericSchema | v.GenericSchemaAsync> = {
921
1301
  readonly __brand: 'valibot';
@@ -931,10 +1311,6 @@ declare type ValidatorConstructor = {
931
1311
  <T extends ValidatorReturn>(validator: (ev: RequestEvent, data: unknown) => ValueOrPromise<T>): T extends ValidatorReturnFail<infer ERROR> ? DataValidator<ERROR> : DataValidator<never>;
932
1312
  };
933
1313
 
934
- declare type ValidatorConstructorQRL = {
935
- <T extends ValidatorReturn>(validator: QRL<(ev: RequestEvent, data: unknown) => ValueOrPromise<T>>): T extends ValidatorReturnFail<infer ERROR> ? DataValidator<ERROR> : DataValidator<never>;
936
- };
937
-
938
1314
  /** @public */
939
1315
  export declare type ValidatorErrorKeyDotNotation<T, Prefix extends string = ''> = IsAny<T> extends true ? never : T extends object ? {
940
1316
  [K in keyof T & string]: IsAny<T[K]> extends true ? never : T[K] extends (infer U)[] ? IsAny<U> extends true ? never : U extends object ? `${Prefix}${K}[]` | ValidatorErrorKeyDotNotation<U, `${Prefix}${K}[].`> : `${Prefix}${K}[]` : T[K] extends object ? ValidatorErrorKeyDotNotation<T[K], `${Prefix}${K}.`> : `${Prefix}${K}`;
@@ -973,16 +1349,8 @@ export declare const zod$: ZodConstructor;
973
1349
  export declare type ZodConstructor = {
974
1350
  <T extends z_2.ZodRawShape>(schema: T): ZodDataValidator<z_2.ZodObject<T>>;
975
1351
  <T extends z_2.ZodRawShape>(schema: (zod: typeof z_2.z, ev: RequestEvent) => T): ZodDataValidator<z_2.ZodObject<T>>;
976
- <T extends z_2.Schema>(schema: T): ZodDataValidator<T>;
977
- <T extends z_2.Schema>(schema: (zod: typeof z_2.z, ev: RequestEvent) => T): ZodDataValidator<T>;
978
- };
979
-
980
- /** @public */
981
- declare type ZodConstructorQRL = {
982
- <T extends z_2.ZodRawShape>(schema: QRL<T>): ZodDataValidator<z_2.ZodObject<T>>;
983
- <T extends z_2.ZodRawShape>(schema: QRL<(zod: typeof z_2.z, ev: RequestEvent) => T>): ZodDataValidator<z_2.ZodObject<T>>;
984
- <T extends z_2.Schema>(schema: QRL<T>): ZodDataValidator<T>;
985
- <T extends z_2.Schema>(schema: QRL<(zod: typeof z_2.z, ev: RequestEvent) => T>): ZodDataValidator<T>;
1352
+ <T extends z_2.ZodType>(schema: T): ZodDataValidator<T>;
1353
+ <T extends z_2.ZodType>(schema: (zod: typeof z_2.z, ev: RequestEvent) => T): ZodDataValidator<T>;
986
1354
  };
987
1355
 
988
1356
  /** @public */