@qwik.dev/router 2.0.0-beta.4 → 2.0.0-beta.41

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 (87) hide show
  1. package/adapters/static/vite.d.ts +1 -1
  2. package/lib/adapters/azure-swa/vite/index.d.ts +2 -2
  3. package/lib/adapters/azure-swa/vite/index.mjs +44 -58
  4. package/lib/adapters/bun-server/vite/index.d.ts +2 -2
  5. package/lib/adapters/bun-server/vite/index.mjs +16 -23
  6. package/lib/adapters/cloud-run/vite/index.d.ts +2 -2
  7. package/lib/adapters/cloud-run/vite/index.mjs +15 -20
  8. package/lib/adapters/cloudflare-pages/vite/index.d.ts +2 -2
  9. package/lib/adapters/cloudflare-pages/vite/index.mjs +45 -77
  10. package/lib/adapters/deno-server/vite/index.d.ts +2 -2
  11. package/lib/adapters/deno-server/vite/index.mjs +25 -35
  12. package/lib/adapters/netlify-edge/vite/index.d.ts +2 -2
  13. package/lib/adapters/netlify-edge/vite/index.mjs +49 -89
  14. package/lib/adapters/node-server/vite/index.d.ts +2 -2
  15. package/lib/adapters/node-server/vite/index.mjs +16 -23
  16. package/lib/adapters/shared/vite/index.d.ts +9 -22
  17. package/lib/adapters/shared/vite/index.mjs +280 -333
  18. package/lib/adapters/ssg/vite/index.d.ts +13 -0
  19. package/lib/adapters/ssg/vite/index.mjs +13 -0
  20. package/lib/adapters/vercel-edge/vite/index.d.ts +3 -3
  21. package/lib/adapters/vercel-edge/vite/index.mjs +73 -80
  22. package/lib/chunks/dev-preloaded-route-loader.mjs +2 -0
  23. package/lib/chunks/format.mjs +24 -0
  24. package/lib/chunks/fs.mjs +140 -0
  25. package/lib/chunks/head.qwik.mjs +1202 -0
  26. package/lib/chunks/http-error.qwik.mjs +27 -0
  27. package/lib/chunks/pathname.mjs +57 -0
  28. package/lib/chunks/request-body-limit.mjs +27 -0
  29. package/lib/chunks/request-path.mjs +49 -0
  30. package/lib/chunks/routes.mjs +26 -0
  31. package/lib/chunks/server-error.mjs +16 -0
  32. package/lib/chunks/system.mjs +265 -0
  33. package/lib/chunks/url.mjs +59 -0
  34. package/lib/chunks/user-response.mjs +1730 -0
  35. package/lib/chunks/worker-thread.mjs +264 -0
  36. package/lib/index.d.ts +631 -174
  37. package/lib/index.qwik.mjs +1656 -1964
  38. package/lib/middleware/aws-lambda/index.d.ts +15 -16
  39. package/lib/middleware/aws-lambda/index.mjs +45 -54
  40. package/lib/middleware/azure-swa/index.mjs +85 -295
  41. package/lib/middleware/bun/index.d.ts +20 -5
  42. package/lib/middleware/bun/index.mjs +119 -205
  43. package/lib/middleware/cloudflare-pages/index.mjs +88 -105
  44. package/lib/middleware/deno/index.d.ts +22 -5
  45. package/lib/middleware/deno/index.mjs +105 -192
  46. package/lib/middleware/firebase/index.mjs +22 -35
  47. package/lib/middleware/netlify-edge/index.mjs +63 -81
  48. package/lib/middleware/node/index.d.ts +17 -5
  49. package/lib/middleware/node/index.mjs +299 -273
  50. package/lib/middleware/request-handler/index.d.ts +206 -99
  51. package/lib/middleware/request-handler/index.mjs +105 -1648
  52. package/lib/middleware/vercel-edge/index.mjs +76 -101
  53. package/lib/modules.d.ts +11 -16
  54. package/lib/service-worker/index.mjs +13 -0
  55. package/lib/{static → ssg}/index.d.ts +46 -22
  56. package/lib/ssg/index.mjs +257 -0
  57. package/lib/vite/index.d.ts +58 -10
  58. package/lib/vite/index.mjs +2471 -27446
  59. package/modules.d.ts +11 -16
  60. package/package.json +62 -70
  61. package/ssg.d.ts +2 -0
  62. package/static.d.ts +1 -1
  63. package/lib/adapters/azure-swa/vite/index.cjs +0 -96
  64. package/lib/adapters/bun-server/vite/index.cjs +0 -50
  65. package/lib/adapters/cloud-run/vite/index.cjs +0 -47
  66. package/lib/adapters/cloudflare-pages/vite/index.cjs +0 -115
  67. package/lib/adapters/deno-server/vite/index.cjs +0 -62
  68. package/lib/adapters/netlify-edge/vite/index.cjs +0 -129
  69. package/lib/adapters/node-server/vite/index.cjs +0 -50
  70. package/lib/adapters/shared/vite/index.cjs +0 -378
  71. package/lib/adapters/static/vite/index.cjs +0 -368
  72. package/lib/adapters/static/vite/index.d.ts +0 -10
  73. package/lib/adapters/static/vite/index.mjs +0 -331
  74. package/lib/adapters/vercel-edge/vite/index.cjs +0 -118
  75. package/lib/index.qwik.cjs +0 -2022
  76. package/lib/middleware/node/index.cjs +0 -314
  77. package/lib/middleware/request-handler/index.cjs +0 -1691
  78. package/lib/service-worker.cjs +0 -17
  79. package/lib/service-worker.mjs +0 -15
  80. package/lib/static/deno.mjs +0 -8
  81. package/lib/static/index.cjs +0 -67
  82. package/lib/static/index.mjs +0 -48
  83. package/lib/static/node.cjs +0 -1126
  84. package/lib/static/node.mjs +0 -1088
  85. package/lib/vite/index.cjs +0 -27525
  86. package/middleware/request-handler/generated/not-found-paths.ts +0 -7
  87. package/middleware/request-handler/generated/static-paths.ts +0 -35
package/lib/index.d.ts CHANGED
@@ -1,17 +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';
19
+ import { Render } from '@qwik.dev/core/server';
20
+ import { RenderToStreamOptions } from '@qwik.dev/core/server';
15
21
  import { RequestEvent } from '@qwik.dev/router/middleware/request-handler';
16
22
  import { RequestEventAction } from '@qwik.dev/router/middleware/request-handler';
17
23
  import { RequestEventBase } from '@qwik.dev/router/middleware/request-handler';
@@ -20,8 +26,11 @@ import { RequestEventLoader } from '@qwik.dev/router/middleware/request-handler'
20
26
  import { RequestHandler } from '@qwik.dev/router/middleware/request-handler';
21
27
  import type { ResolveSyncValue } from '@qwik.dev/router/middleware/request-handler';
22
28
  import type { SerializationStrategy } from '@qwik.dev/core/internal';
29
+ import type { ServerError } from '@qwik.dev/router/middleware/request-handler';
30
+ import type { Signal } from '@qwik.dev/core';
23
31
  import type * as v from 'valibot';
24
32
  import type { ValueOrPromise } from '@qwik.dev/core';
33
+ import { ValueOrPromise as ValueOrPromise_2 } from '@qwik.dev/core/internal';
25
34
  import { z } from 'zod';
26
35
  import type * as z_2 from 'zod';
27
36
 
@@ -32,51 +41,53 @@ export declare type Action<RETURN, INPUT = Record<string, unknown>, OPTIONAL ext
32
41
  * component$(). Like all `use-` functions and methods, it can only be invoked within a
33
42
  * `component$()`.
34
43
  */
35
- (): ActionStore<RETURN, INPUT, OPTIONAL>;
44
+ (): ActionStore<ExcludeControlFlow<RETURN>, INPUT, OPTIONAL>;
36
45
  };
37
46
 
38
47
  /** @public */
39
48
  export declare type ActionConstructor = {
40
- <OBJ extends Record<string, any> | void | null, VALIDATOR extends TypedDataValidator, REST extends [DataValidator, ...DataValidator[]]>(actionQrl: (data: GetValidatorOutputType<VALIDATOR>, event: RequestEventAction) => ValueOrPromise<OBJ>, options: {
41
- 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 & {
42
50
  readonly validation: [VALIDATOR, ...REST];
43
51
  }): Action<StrictUnion<OBJ | FailReturn<ValidatorErrorType<GetValidatorInputType<VALIDATOR>>> | FailReturn<FailOfRest<REST>>>, GetValidatorInputType<VALIDATOR>, false>;
44
- <OBJ extends Record<string, any> | void | null, VALIDATOR extends TypedDataValidator>(actionQrl: (data: GetValidatorOutputType<VALIDATOR>, event: RequestEventAction) => ValueOrPromise<OBJ>, options: {
45
- readonly id?: string;
52
+ <OBJ extends Record<string, any> | void | null, VALIDATOR extends TypedDataValidator>(actionQrl: (data: GetValidatorOutputType<VALIDATOR>, event: RequestEventAction) => ValueOrPromise<OBJ>, options: ActionOptions & {
46
53
  readonly validation: [VALIDATOR];
47
54
  }): Action<StrictUnion<OBJ | FailReturn<ValidatorErrorType<GetValidatorInputType<VALIDATOR>>>>, GetValidatorInputType<VALIDATOR>, false>;
48
- <OBJ extends Record<string, any> | void | null, REST extends [DataValidator, ...DataValidator[]]>(actionQrl: (data: JSONObject, event: RequestEventAction) => ValueOrPromise<OBJ>, options: {
49
- readonly id?: string;
55
+ <OBJ extends Record<string, any> | void | null, REST extends [DataValidator, ...DataValidator[]]>(actionQrl: (data: JSONObject, event: RequestEventAction) => ValueOrPromise<OBJ>, options: ActionOptions & {
50
56
  readonly validation: REST;
51
57
  }): Action<StrictUnion<OBJ | FailReturn<FailOfRest<REST>>>>;
52
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>;
53
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>;
54
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>>>>;
55
- <OBJ>(actionQrl: (form: JSONObject, event: RequestEventAction) => ValueOrPromise<OBJ>, options?: {
56
- readonly id?: string;
57
- }): Action<StrictUnion<OBJ>>;
61
+ <OBJ>(actionQrl: (form: JSONObject, event: RequestEventAction) => ValueOrPromise<OBJ>, options?: ActionOptions): Action<StrictUnion<OBJ>>;
58
62
  };
59
63
 
60
64
  /** @public */
61
65
  declare type ActionConstructorQRL = {
62
- <OBJ extends Record<string, any> | void | null, VALIDATOR extends TypedDataValidator, REST extends [DataValidator, ...DataValidator[]]>(actionQrl: QRL<(data: GetValidatorOutputType<VALIDATOR>, event: RequestEventAction) => ValueOrPromise<OBJ>>, options: {
63
- readonly id?: string;
66
+ <OBJ extends Record<string, any> | void | null, VALIDATOR extends TypedDataValidator, REST extends [DataValidator, ...DataValidator[]]>(actionQrl: QRL<(data: GetValidatorOutputType<VALIDATOR>, event: RequestEventAction) => ValueOrPromise<OBJ>>, options: ActionOptions & {
64
67
  readonly validation: [VALIDATOR, ...REST];
65
68
  }): Action<StrictUnion<OBJ | FailReturn<ValidatorErrorType<GetValidatorInputType<VALIDATOR>>> | FailReturn<FailOfRest<REST>>>, GetValidatorInputType<VALIDATOR>, false>;
66
- <OBJ extends Record<string, any> | void | null, VALIDATOR extends TypedDataValidator>(actionQrl: QRL<(data: GetValidatorOutputType<VALIDATOR>, event: RequestEventAction) => ValueOrPromise<OBJ>>, options: {
67
- readonly id?: string;
69
+ <OBJ extends Record<string, any> | void | null, VALIDATOR extends TypedDataValidator>(actionQrl: QRL<(data: GetValidatorOutputType<VALIDATOR>, event: RequestEventAction) => ValueOrPromise<OBJ>>, options: ActionOptions & {
68
70
  readonly validation: [VALIDATOR];
69
71
  }): Action<StrictUnion<OBJ | FailReturn<ValidatorErrorType<GetValidatorInputType<VALIDATOR>>>>, GetValidatorInputType<VALIDATOR>, false>;
70
- <OBJ extends Record<string, any> | void | null, REST extends [DataValidator, ...DataValidator[]]>(actionQrl: QRL<(data: JSONObject, event: RequestEventAction) => ValueOrPromise<OBJ>>, options: {
71
- readonly id?: string;
72
+ <OBJ extends Record<string, any> | void | null, REST extends [DataValidator, ...DataValidator[]]>(actionQrl: QRL<(data: JSONObject, event: RequestEventAction) => ValueOrPromise<OBJ>>, options: ActionOptions & {
72
73
  readonly validation: REST;
73
74
  }): Action<StrictUnion<OBJ | FailReturn<FailOfRest<REST>>>>;
74
75
  <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>;
75
76
  <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>;
76
77
  <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>>>>;
77
- <OBJ>(actionQrl: QRL<(form: JSONObject, event: RequestEventAction) => ValueOrPromise<OBJ>>, options?: {
78
- readonly id?: string;
79
- }): Action<StrictUnion<OBJ>>;
78
+ <OBJ>(actionQrl: QRL<(form: JSONObject, event: RequestEventAction) => ValueOrPromise<OBJ>>, options?: ActionOptions): Action<StrictUnion<OBJ>>;
79
+ };
80
+
81
+ /** @public */
82
+ export declare type ActionOptions = {
83
+ readonly id?: string;
84
+ readonly validation?: DataValidator[];
85
+ /**
86
+ * Route loaders to invalidate after this action completes. The loader hooks' hashes are sent to
87
+ * the client so it knows which loaders to re-fetch. If omitted, ALL route loaders are invalidated
88
+ * (unless `strictLoaders` is enabled globally in the Vite plugin).
89
+ */
90
+ readonly invalidate?: Loader_2<any>[];
80
91
  };
81
92
 
82
93
  /** @public */
@@ -157,6 +168,27 @@ export declare type ActionStore<RETURN, INPUT, OPTIONAL extends boolean = true>
157
168
 
158
169
  declare type AnchorAttributes = QwikIntrinsicElements['a'];
159
170
 
171
+ /**
172
+ * Cache key function. Used by `routeConfig.cacheKey` (SSR HTML cache) and by `routeLoader$`'s
173
+ * `cacheKey` option (per-loader JSON cache).
174
+ *
175
+ * - `true`: use the surface's default key.
176
+ *
177
+ * - SSR default: `${status}|${eTag}|${pathname}` when an eTag is set, otherwise
178
+ * `${status}|${pathname}`.
179
+ * - Loader default: `${pathname}|${filteredSearch}|${loaderId}|${eTag}` when an eTag is set,
180
+ * otherwise `${pathname}|${filteredSearch}|${loaderId}`.
181
+ * - Function: receives the request event and the normalized, unquoted eTag (or an empty string when
182
+ * none was provided). Return the cache key string, or `null` or `''` to skip caching for this
183
+ * request. Loader callbacks receive the loader-scoped request event, with `url`, `query`, and
184
+ * `request.url` filtered by the loader's `search` allowlist.
185
+ *
186
+ * Note: valid cacheKeys are non-empty strings.
187
+ *
188
+ * @public
189
+ */
190
+ export declare type CacheKeyFn = true | ((requestEv: RequestEvent, eTag: string) => string | null);
191
+
160
192
  /** @public */
161
193
  export declare interface ContentHeading {
162
194
  readonly text: string;
@@ -173,9 +205,28 @@ export declare interface ContentMenu {
173
205
 
174
206
  declare type ContentModule = PageModule | LayoutModule;
175
207
 
176
- declare type ContentModuleHead = DocumentHead | ResolvedDocumentHead;
208
+ /**
209
+ * The eTag export type for routeConfig.
210
+ *
211
+ * - `string` — static ETag value.
212
+ * - `(props: DocumentHeadProps) => string | null` — compute the ETag from route context (params, URL,
213
+ * loaded data via `resolveValue`, etc.). Return `null` to skip eTag for this request.
214
+ *
215
+ * Qwik normalizes eTag values by stripping weak-form `W/` prefixes, quotes, and forbidden chars,
216
+ * then sends a strong `ETag` header. Values that normalize to an empty string are treated as
217
+ * absent.
218
+ *
219
+ * When set (and a value is produced), the server includes an `ETag` header and returns `304` if
220
+ * `If-None-Match` matches.
221
+ *
222
+ * @public
223
+ */
224
+ export declare type ContentModuleETag = string | ((props: DocumentHeadProps) => string | null);
177
225
 
178
- declare type ContentModuleLoader = () => Promise<ContentModule>;
226
+ /** @public */
227
+ export declare type ContentModuleHead = DocumentHead | ResolvedDocumentHead;
228
+
229
+ declare type ContentModuleLoader = () => ValueOrPromise<ContentModule>;
179
230
 
180
231
  /** @public */
181
232
  declare interface ContentState {
@@ -189,6 +240,38 @@ export { CookieOptions }
189
240
 
190
241
  export { CookieValue }
191
242
 
243
+ /**
244
+ * Creates the `render()` function that is required by `createQwikRouter()`. It requires a function
245
+ * that returns the `jsx` and `options` for the renderer.
246
+ *
247
+ * @example
248
+ *
249
+ * ```tsx
250
+ * const renderer = createRenderer((opts) => {
251
+ * if (opts.requestHeaders['x-hello'] === 'world') {
252
+ * return { jsx: <Hello />, options: opts };
253
+ * }
254
+ * return { jsx: <Root />, options: {
255
+ * ...opts,
256
+ * serverData: {
257
+ * ...opts.serverData,
258
+ * documentHead: {
259
+ * meta: [
260
+ * { name: 'renderedAt', content: new Date().toISOString() },
261
+ * ],
262
+ * },
263
+ * },
264
+ * } };
265
+ * });
266
+ * ```
267
+ *
268
+ * @public
269
+ */
270
+ export declare const createRenderer: (getOptions: (options: RendererOptions) => {
271
+ jsx: JSXOutput;
272
+ options: RendererOutputOptions;
273
+ }) => Render;
274
+
192
275
  /** @public */
193
276
  export declare type DataValidator<T extends Record<string, any> = {}> = {
194
277
  validate(ev: RequestEvent, data: unknown): Promise<ValidatorReturn<T>>;
@@ -196,32 +279,48 @@ export declare type DataValidator<T extends Record<string, any> = {}> = {
196
279
 
197
280
  export { DeferReturn }
198
281
 
199
- /** @public */
200
- declare interface DevJSX {
201
- fileName: string;
202
- lineNumber: number;
203
- columnNumber: number;
204
- stack?: string;
205
- }
206
-
207
282
  /** @public */
208
283
  export declare type DocumentHead = DocumentHeadValue | ((props: DocumentHeadProps) => DocumentHeadValue);
209
284
 
210
285
  /** @public */
211
286
  export declare interface DocumentHeadProps extends RouteLocation {
212
287
  readonly head: ResolvedDocumentHead;
288
+ /** The HTTP status code of the response (e.g. 200, 404). */
289
+ readonly status: number;
290
+ /** @deprecated This is not necessary, it works correctly without */
213
291
  readonly withLocale: <T>(fn: () => T) => T;
214
292
  readonly resolveValue: ResolveSyncValue;
215
293
  }
216
294
 
295
+ /**
296
+ * This renders all the tags collected from `head`.
297
+ *
298
+ * You can partially override the head, for example if you want to change the title:
299
+ *
300
+ * ```tsx
301
+ * import { DocumentHeadTags, useDocumentHead } from '@qwik.dev/router';
302
+ *
303
+ * export default component$(() => {
304
+ * const head = useDocumentHead();
305
+ * return <DocumentHeadTags title={`${head.title} - My App`} />;
306
+ * });
307
+ * ```
308
+ *
309
+ * You don't have to use this component, you can also do it yourself for full control. Just copy the
310
+ * code from this component and modify it to your needs.
311
+ *
312
+ * Note that this component normally only runs once, during SSR. You can use Signals in your
313
+ * `src/root.tsx` to make runtime changes to `<head>` if needed.
314
+ *
315
+ * @public
316
+ */
317
+ export declare const DocumentHeadTags: Component<DocumentHeadValue<Record<string, unknown>>>;
318
+
217
319
  /** @public */
218
320
  export declare interface DocumentHeadValue<FrontMatter extends Record<string, any> = Record<string, unknown>> {
219
321
  /** Sets `document.title`. */
220
322
  readonly title?: string;
221
- /**
222
- * Used to manually set meta tags in the head. Additionally, the `data` property could be used to
223
- * set arbitrary data which the `<head>` component could later use to generate `<meta>` tags.
224
- */
323
+ /** Used to manually set meta tags in the head. */
225
324
  readonly meta?: readonly DocumentMeta[];
226
325
  /** Used to manually append `<link>` elements to the `<head>`. */
227
326
  readonly links?: readonly DocumentLink[];
@@ -238,53 +337,60 @@ export declare interface DocumentHeadValue<FrontMatter extends Record<string, an
238
337
  }
239
338
 
240
339
  /** @public */
241
- export declare interface DocumentLink {
242
- as?: string;
243
- crossorigin?: string;
244
- disabled?: boolean;
245
- href?: string;
246
- hreflang?: string;
247
- id?: string;
248
- imagesizes?: string;
249
- imagesrcset?: string;
250
- integrity?: string;
251
- media?: string;
252
- prefetch?: string;
253
- referrerpolicy?: string;
254
- rel?: string;
255
- sizes?: string;
256
- title?: string;
257
- type?: string;
258
- key?: string;
259
- }
340
+ export declare type DocumentLink = QwikIntrinsicElements['link'];
260
341
 
261
342
  /** @public */
262
- export declare interface DocumentMeta {
263
- readonly content?: string;
264
- readonly httpEquiv?: string;
265
- readonly name?: string;
266
- readonly property?: string;
267
- readonly key?: string;
268
- readonly itemprop?: string;
269
- readonly media?: string;
270
- }
271
-
272
- /** @beta */
273
- export declare interface DocumentScript {
274
- readonly script?: string;
275
- readonly props?: Readonly<QwikIntrinsicElements['script']>;
276
- readonly key?: string;
277
- }
343
+ export declare type DocumentMeta = QwikIntrinsicElements['meta'];
278
344
 
279
345
  /** @public */
280
- export declare interface DocumentStyle {
281
- readonly style: string;
282
- readonly props?: Readonly<QwikIntrinsicElements['style']>;
283
- readonly key?: string;
346
+ export declare type DocumentScript = ((Omit<QwikIntrinsicElements['script'], 'dangerouslySetInnerHTML'> & {
347
+ props?: never;
348
+ }) | {
349
+ key?: string;
350
+ /**
351
+ * The props of the script element. @deprecated Prefer setting the properties directly instead
352
+ * of using this property.
353
+ */
354
+ props: Readonly<QwikIntrinsicElements['script']>;
355
+ }) & ({
356
+ /** The inline script content. */
357
+ script?: string;
358
+ dangerouslySetInnerHTML?: never;
359
+ } | {
360
+ dangerouslySetInnerHTML?: string;
361
+ script?: never;
362
+ });
363
+
364
+ /** @public */
365
+ export declare type DocumentStyle = Readonly<((Omit<QwikIntrinsicElements['style'], 'dangerouslySetInnerHTML'> & {
366
+ props?: never;
367
+ }) | {
368
+ key?: string;
369
+ /**
370
+ * The props of the style element. @deprecated Prefer setting the properties directly
371
+ * instead of using this property.
372
+ */
373
+ props: Readonly<QwikIntrinsicElements['style']>;
374
+ }) & ({
375
+ /** The inline style content. */
376
+ style?: string;
377
+ dangerouslySetInnerHTML?: never;
378
+ } | {
379
+ dangerouslySetInnerHTML?: string;
380
+ style?: never;
381
+ })>;
382
+
383
+ declare type EndpointModuleLoader = () => ValueOrPromise<RouteModule>;
384
+
385
+ declare interface EndpointResponse {
386
+ status: number;
387
+ statusMessage?: string;
388
+ formData?: FormData;
389
+ action?: string;
390
+ actionResult?: unknown;
391
+ loaderHashes?: string[];
284
392
  }
285
393
 
286
- declare type EndpointModuleLoader = () => Promise<RouteModule>;
287
-
288
394
  /** @public */
289
395
  export declare const ErrorBoundary: Component<ErrorBoundaryProps>;
290
396
 
@@ -293,6 +399,14 @@ declare interface ErrorBoundaryProps {
293
399
  fallback$?: QRL<(error: any) => any>;
294
400
  }
295
401
 
402
+ /**
403
+ * Drops control-flow signals (`ev.redirect()`, `ev.error()`, etc.) from a loader/action return
404
+ * type: those are thrown, not surfaced as data. `ev.fail()` is plain data and is kept.
405
+ *
406
+ * @public
407
+ */
408
+ export declare type ExcludeControlFlow<T> = Exclude<T, AbortMessage | ServerError>;
409
+
296
410
  declare type Failed = {
297
411
  failed: true;
298
412
  };
@@ -304,7 +418,7 @@ export declare type FailOfRest<REST extends readonly DataValidator[]> = REST ext
304
418
  export declare type FailReturn<T> = T & Failed;
305
419
 
306
420
  /** @public */
307
- export declare const Form: <O, I>({ action, spaReset, reloadDocument, onSubmit$, ...rest }: FormProps<O, I>, key: string | null) => JSXOutput_2;
421
+ export declare const Form: <O, I>({ action, spaReset, reloadDocument, onSubmit$, ...rest }: FormProps<O, I>, key: string | null) => JSXOutput;
308
422
 
309
423
  /** @public */
310
424
  export declare interface FormProps<O, I> extends Omit<QwikJSX.IntrinsicElements['form'], 'action' | 'method'> {
@@ -322,8 +436,6 @@ export declare interface FormProps<O, I> extends Omit<QwikJSX.IntrinsicElements[
322
436
  * Defaults to `false`
323
437
  */
324
438
  spaReset?: boolean;
325
- /** Event handler executed right when the form is submitted. */
326
- onSubmit$?: QRLEventHandlerMulti<SubmitEvent, HTMLFormElement> | undefined;
327
439
  /** Event handler executed right after the action is executed successfully and returns some data. */
328
440
  onSubmitCompleted$?: QRLEventHandlerMulti<CustomEvent<FormSubmitSuccessDetail<O>>, HTMLFormElement> | undefined;
329
441
  key?: string | number | null;
@@ -336,15 +448,12 @@ export declare interface FormSubmitSuccessDetail<T> {
336
448
  }
337
449
 
338
450
  /**
339
- * Any function taking a props object that returns JSXOutput.
340
- *
341
- * The `key`, `flags` and `dev` parameters are for internal use.
451
+ * Returns the current RequestEvent if possible. Only usable on the server, and only during request
452
+ * processing.
342
453
  *
343
454
  * @public
344
455
  */
345
- declare type FunctionComponent<P = unknown> = {
346
- renderFn(props: P, key: string | null, flags: number, dev?: DevJSX): JSXOutput;
347
- }['renderFn'];
456
+ export declare const getRequestEvent: (thisArg?: unknown) => RequestEvent | undefined;
348
457
 
349
458
  /** @public */
350
459
  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;
@@ -360,6 +469,16 @@ export declare const globalAction$: ActionConstructor;
360
469
 
361
470
  /* Excluded from this release type: globalActionQrl */
362
471
 
472
+ /** @public */
473
+ export declare type HttpErrorProps = {
474
+ /** The HTTP status code, e.g. 404 */
475
+ status: number;
476
+ /** The error message, e.g. "Not Found" */
477
+ message: string;
478
+ };
479
+
480
+ export { InternalRequest }
481
+
363
482
  declare type IsAny<Type> = 0 extends 1 & Type ? true : false;
364
483
 
365
484
  /** @public */
@@ -372,31 +491,9 @@ export declare type JSONValue = string | number | boolean | {
372
491
  [x: string]: JSONValue;
373
492
  } | Array<JSONValue>;
374
493
 
375
- /** @public */
376
- declare type JSXChildren = string | number | boolean | null | undefined | Function | RegExp | JSXChildren[] | Promise<JSXChildren> | Signal<JSXChildren> | JSXNode;
377
-
378
- /**
379
- * A JSX Node, an internal structure. You probably want to use `JSXOutput` instead.
380
- *
381
- * @public
382
- */
383
- declare interface JSXNode<T extends string | FunctionComponent | unknown = unknown> {
384
- type: T;
385
- props: T extends FunctionComponent<infer P> ? P : Record<any, unknown>;
386
- children: JSXChildren | null;
387
- key: string | null;
388
- dev?: DevJSX;
389
- }
390
-
391
- /**
392
- * Any valid output for a component
393
- *
394
- * @public
395
- */
396
- declare type JSXOutput = JSXNode | string | number | boolean | null | undefined | JSXOutput[];
397
-
398
494
  declare interface LayoutModule extends RouteModule {
399
- readonly default: unknown;
495
+ readonly default?: (props: Record<string, never>) => JSXOutput;
496
+ readonly routeConfig?: RouteConfig;
400
497
  readonly head?: ContentModuleHead;
401
498
  }
402
499
 
@@ -406,34 +503,73 @@ export declare const Link: Component<LinkProps>;
406
503
  /** @public */
407
504
  export declare interface LinkProps extends AnchorAttributes {
408
505
  /**
409
- * **Defaults to _true_.**
506
+ * @deprecated Use `prefetchBundles` and `prefetchData` instead for more granular control over
507
+ * what is prefetched and when. This prop will be removed in a future major version.
410
508
  *
411
- * Whether Qwik should prefetch and cache the target page of this **`Link`**, this includes
412
- * invoking any **`routeLoader$`**, **`onGet`**, etc.
509
+ * Legacy prefetch control for this **`Link`**.
413
510
  *
414
- * This **improves UX performance** for client-side (**SPA**) navigations.
511
+ * Setting this value to **`"js"`** will prefetch only javascript bundles required to render this
512
+ * page on the client when the link becomes visible. Setting this value to **`true`** will
513
+ * prefetch both javascript bundles and route data when the link becomes visible. Setting this
514
+ * value to **`false`** will disable prefetching altogether.
515
+ */
516
+ prefetch?: boolean | 'js';
517
+ /**
518
+ * Controls when Qwik should prefetch the javascript bundles required to render this **`Link`**
519
+ * target during client-side navigation.
415
520
  *
416
- * Prefetching occurs when a the Link enters the viewport in production (**`on:qvisible`**), or
417
- * with **`mouseover`/`focus`** during dev.
521
+ * Defaults to **`"visible"`**.
418
522
  *
419
523
  * Prefetching will not occur if the user has the **data saver** setting enabled.
524
+ */
525
+ prefetchBundles?: PrefetchStrategy;
526
+ /**
527
+ * Controls when Qwik should prefetch and cache route data for this **`Link`** target, including
528
+ * invoking any **`routeLoader$`**, **`onGet`**, etc.
529
+ *
530
+ * Defaults to **`"intent"`**. When using the deprecated **`prefetch="js"`** prop, route data
531
+ * prefetching defaults to **`"off"`**.
420
532
  *
421
- * Setting this value to **`"js"`** will prefetch only javascript bundles required to render this
422
- * page on the client, **`false`** will disable prefetching altogether.
533
+ * Prefetching route data can improve client-side navigation performance for pages that wait on
534
+ * loaders, server handlers, databases, or API calls.
535
+ *
536
+ * Prefetching will not occur if the user has the **data saver** setting enabled.
423
537
  */
424
- prefetch?: boolean | 'js';
538
+ prefetchData?: PrefetchStrategy;
425
539
  reload?: boolean;
426
540
  replaceState?: boolean;
427
541
  scroll?: boolean;
428
542
  }
429
543
 
544
+ /** The route to render */
545
+ declare interface LoadedRoute {
546
+ /** The canonical path of the route, e.g. `/products/[id]` */
547
+ $routeName$: string;
548
+ /** The route parameters, e.g. `{ id: '123' }` */
549
+ $params$: PathParams;
550
+ /** The modules associated with this route (on 404, contains only the error component) */
551
+ $mods$: (RouteModule | ContentModule)[];
552
+ /** The menu associated with this route */
553
+ $menu$?: ContentMenu | undefined;
554
+ /** The bundle names for this route */
555
+ $routeBundleNames$?: string[] | undefined;
556
+ /** Whether this route is a not-found (404) route */
557
+ $notFound$?: boolean;
558
+ /** The nearest _E (error.tsx) boundary's chain to render on a thrown ServerError (in its layouts). */
559
+ $errorLoader$?: ModuleLoader[];
560
+ /** Merged array of routeLoader$ hashes from all matched nodes (layouts + page) */
561
+ $loaders$?: string[];
562
+ /** Runtime-only mapping of routeLoader$ hashes to the matched pathname used for q-loader fetches */
563
+ $loaderPaths$?: Record<string, string>;
564
+ }
565
+
430
566
  /** @public */
431
567
  declare type Loader_2<RETURN> = {
432
568
  /**
433
569
  * Returns the `Signal` containing the data returned by the `loader$` function. Like all `use-`
434
570
  * functions and methods, it can only be invoked within a `component$()`.
435
571
  */
436
- (): LoaderSignal<RETURN>;
572
+ (): LoaderSignal<ExcludeControlFlow<RETURN>>;
437
573
  };
438
574
  export { Loader_2 as Loader }
439
575
 
@@ -451,16 +587,91 @@ declare type LoaderConstructorQRL = {
451
587
 
452
588
  /** @public */
453
589
  declare type LoaderOptions = {
590
+ /**
591
+ * Explicit loader id, overriding the QRL hash. Pass a distinct value (e.g. `fn.getHash()`) when
592
+ * loaders share a wrapper QRL.
593
+ */
454
594
  readonly id?: string;
455
595
  readonly validation?: DataValidator[];
456
596
  readonly serializationStrategy?: SerializationStrategy;
597
+ /**
598
+ * Cache-Control for this loader's JSON responses. The browser HTTP cache is the single source of
599
+ * freshness for loader data: on every client navigation the loaders re-fetch, and this header
600
+ * decides whether the browser serves the fetch from cache, revalidates, or hits the server.
601
+ *
602
+ * Accepts any `cacheControl()` value (`'immutable'`, `'no-cache'`, a max-age number, an options
603
+ * object) or a function of the request event; the function may return `null` to skip the header.
604
+ * A `Cache-Control` header set inside the loader function wins over this option.
605
+ *
606
+ * Defaults to `no-cache` (always revalidate; combine with `eTag` for cheap 304s).
607
+ *
608
+ * The literal value `'immutable'` also marks the loader's data as static, so SSG writes a
609
+ * per-loader JSON file at build time.
610
+ */
611
+ readonly cacheControl?: CacheControl | ((ev: RequestEvent) => CacheControl | null);
612
+ /**
613
+ * Enable ETag-based caching for this loader's JSON responses.
614
+ *
615
+ * - `string` — static ETag value; if `If-None-Match` matches, the loader is skipped entirely
616
+ * - `(ev: RequestEvent) => string | null` — compute the ETag from the request context (params, URL,
617
+ * headers, etc.); if `If-None-Match` matches, the loader is skipped entirely. Return null to
618
+ * skip eTag for this request.
619
+ *
620
+ * Qwik normalizes eTag values by stripping weak-form `W/` prefixes, quotes, and forbidden chars,
621
+ * then sends a strong `ETag` header. Values that normalize to an empty string are treated as
622
+ * absent.
623
+ *
624
+ * When set, the server includes an `ETag` header on `q-loader-*.json` responses and returns `304`
625
+ * if the client sends a matching `If-None-Match` header.
626
+ *
627
+ * For auto-computed eTags, use `cacheKey` instead — on cache write the eTag is hashed from the
628
+ * serialized response and stored alongside it, so subsequent hits get the same eTag.
629
+ */
630
+ readonly eTag?: string | ((ev: RequestEvent) => string | null);
631
+ /**
632
+ * Enable in-memory server-side caching of this loader's serialized JSON response.
633
+ *
634
+ * - `true` — use the default key `${pathname}|${filteredSearch}|${loaderId}` (suffixed with
635
+ * `|${eTag}` when an eTag is set).
636
+ * - Function `(requestEv, eTag) => string | null` — return a custom key, or `null` to skip caching
637
+ * this request.
638
+ *
639
+ * On cache miss the loader runs, the serialized response is stored alongside its eTag (computed
640
+ * from the data when no `eTag` option is set), and the response is sent. On cache hit the stored
641
+ * `{ eTag, data }` pair is served directly — `If-None-Match` is checked against the stored eTag
642
+ * and a `304` is returned when it matches.
643
+ */
644
+ readonly cacheKey?: CacheKeyFn;
645
+ /**
646
+ * Allowlist of URL search parameter names that this loader depends on.
647
+ *
648
+ * When set, the loader only re-fetches when the listed search params change — other param changes
649
+ * are ignored. Only the listed params are sent in the loader JSON request URL. During SSR and
650
+ * loader JSON requests, the loader receives a request event with `url`, `query`, and
651
+ * `request.url` filtered to the same params.
652
+ *
653
+ * When not set, the `qwikRouter()` plugin option `strictLoaders` determines the behavior. If
654
+ * `strictLoaders` is `true` (this is the default), no search params are sent and changes do not
655
+ * trigger a re-fetch. If `strictLoaders` is `false`, all search params are sent and any change
656
+ * triggers a re-fetch.
657
+ */
658
+ readonly search?: string[];
659
+ /**
660
+ * When true (default), the loader is awaited before SSR renders, so its redirect or error can
661
+ * short-circuit the response and its value is ready for synchronous reads (e.g. in the head).
662
+ *
663
+ * When false, the loader runs in the background without blocking SSR: rendering starts
664
+ * immediately and reading its `.value` suspends until it resolves. A background loader cannot
665
+ * redirect or error the initial SSR response; treat it as a separate request.
666
+ *
667
+ * Setting `false` is experimental and requires adding `experimental: ["blockSSR"]` to your
668
+ * qwikVite plugin options.
669
+ */
670
+ readonly blockSSR?: boolean;
457
671
  };
458
672
 
459
673
  /** @public */
460
- export declare type LoaderSignal<TYPE> = TYPE extends () => ValueOrPromise<infer VALIDATOR> ? ReadonlySignal<ValueOrPromise<VALIDATOR>> : ReadonlySignal<TYPE>;
461
-
462
- /** @public */
463
- export declare type MenuData = [pathname: string, menuLoader: MenuModuleLoader];
674
+ export declare type LoaderSignal<TYPE> = (TYPE extends () => ValueOrPromise<infer VALIDATOR> ? Signal<ValueOrPromise<VALIDATOR>> : Signal<TYPE>) & Pick<ComputedSignal<any>, 'promise' | 'pending' | 'error' | 'loading'>;
464
675
 
465
676
  declare interface MenuModule {
466
677
  readonly default: ContentMenu;
@@ -483,16 +694,42 @@ export { NavigationType_2 as NavigationType }
483
694
  export declare function omitProps<T, KEYS extends keyof T>(obj: T, keys: KEYS[]): Omit<T, KEYS>;
484
695
 
485
696
  /** @public */
486
- export declare interface PageModule extends RouteModule {
487
- readonly default: unknown;
697
+ export declare type PageModule = RouteModule & {
698
+ readonly default: (props: Record<string, never>) => JSXOutput;
699
+ readonly routeConfig?: RouteConfig;
488
700
  readonly head?: ContentModuleHead;
701
+ readonly eTag?: ContentModuleETag;
702
+ readonly cacheKey?: CacheKeyFn;
489
703
  readonly headings?: ContentHeading[];
490
704
  readonly onStaticGenerate?: StaticGenerateHandler;
491
- }
705
+ };
492
706
 
493
707
  /** @public */
494
708
  export declare type PathParams = Record<string, string>;
495
709
 
710
+ /**
711
+ * Defines when link prefetching should be triggered.
712
+ *
713
+ * @public
714
+ */
715
+ export declare type PrefetchStrategy =
716
+ /**
717
+ * Prefetch when the user commits to navigating.
718
+ *
719
+ * Triggered by `pointerdown` or the `Enter` key.
720
+ */
721
+ 'commit'
722
+ /**
723
+ * Prefetch when the user shows navigation intent.
724
+ *
725
+ * Triggered by `pointerenter`, hover, or focus.
726
+ */
727
+ | 'intent'
728
+ /** Prefetch when the link becomes visible in the viewport. */
729
+ | 'visible'
730
+ /** Disable link prefetching. */
731
+ | 'off';
732
+
496
733
  declare type Prettify<T> = {} & {
497
734
  [K in keyof T]: T[K];
498
735
  };
@@ -510,6 +747,9 @@ declare type Prettify<T> = {} & {
510
747
  */
511
748
  export declare type PreventNavigateCallback = (url?: number | URL) => ValueOrPromise<boolean>;
512
749
 
750
+ /** @public */
751
+ export declare const Q_ROUTE = "q:route";
752
+
513
753
  /**
514
754
  * @deprecated Use `QWIK_ROUTER_SCROLLER` instead (will be removed in V3)
515
755
  * @public
@@ -520,13 +760,7 @@ export declare const QWIK_CITY_SCROLLER = "_qCityScroller";
520
760
  export declare const QWIK_ROUTER_SCROLLER = "_qRouterScroller";
521
761
 
522
762
  /**
523
- * @deprecated Use `QwikRouterMockProps` instead. will be removed in V3
524
- * @public
525
- */
526
- export declare type QwikCityMockProps = QwikRouterMockProps;
527
-
528
- /**
529
- * @deprecated Use `QwikRouterMockProvider` instead. Will be removed in V3
763
+ * @deprecated Use `useQwikMockRouter()` instead. Will be removed in V3
530
764
  * @public
531
765
  */
532
766
  export declare const QwikCityMockProvider: Component<QwikRouterMockProps>;
@@ -538,32 +772,95 @@ export declare const QwikCityMockProvider: Component<QwikRouterMockProps>;
538
772
  export declare type QwikCityPlan = QwikRouterConfig;
539
773
 
540
774
  /**
541
- * @deprecated Use `QwikRouterProps` instead. will be removed in V3
775
+ * @deprecated Use `QwikRouterProps` instead. Will be removed in v3.
542
776
  * @public
543
777
  */
544
778
  export declare type QwikCityProps = QwikRouterProps;
545
779
 
546
780
  /**
547
- * @deprecated Use `QwikRouterProvider` instead. will be removed in V3
781
+ * @deprecated Use `useQwikRouter()` instead. Will be removed in v3.
548
782
  * @public
549
783
  */
550
784
  export declare const QwikCityProvider: Component<QwikRouterProps>;
551
785
 
552
786
  /** @public */
553
787
  export declare interface QwikRouterConfig {
554
- readonly routes: RouteData[];
788
+ readonly routes: RouteData;
555
789
  readonly serverPlugins?: RouteModule[];
556
790
  readonly basePathname?: string;
557
- readonly menus?: MenuData[];
558
791
  readonly trailingSlash?: boolean;
559
792
  readonly cacheModules?: boolean;
793
+ /** When true, return null instead of rendering the 404 page, letting the adapter handle it */
794
+ readonly fallthrough?: boolean;
795
+ }
796
+
797
+ /** @public */
798
+ export declare interface QwikRouterEnvData {
799
+ routeName: string;
800
+ ev: RequestEvent;
801
+ params: PathParams;
802
+ response: EndpointResponse;
803
+ loadedRoute: LoadedRoute;
804
+ routeLoaderCtx: RouteLoaderCtx;
805
+ loaderValues: Record<string, unknown>;
806
+ }
807
+
808
+ /** @public */
809
+ export declare interface QwikRouterMockActionProp<T = any> {
810
+ /** The action function to mock. */
811
+ action: Action<T>;
812
+ /** The QRL function that will be called when the action is submitted. */
813
+ handler: QRL<(data: T) => ValueOrPromise_2<RouteActionResolver>>;
814
+ }
815
+
816
+ /** @public */
817
+ export declare interface QwikRouterMockLoaderProp<T = any> {
818
+ /** The loader function to mock. */
819
+ loader: Loader_2<T>;
820
+ /** The data to return when the loader is called. */
821
+ data: T;
560
822
  }
561
823
 
562
824
  /** @public */
563
825
  export declare interface QwikRouterMockProps {
826
+ /**
827
+ * Allow mocking the url returned by `useLocation` hook.
828
+ *
829
+ * Default: `http://localhost/`
830
+ */
564
831
  url?: string;
832
+ /** Allow mocking the route params returned by `useLocation` hook. */
565
833
  params?: Record<string, string>;
834
+ /** Allow mocking the `goto` function returned by `useNavigate` hook. */
566
835
  goto?: RouteNavigate;
836
+ /**
837
+ * Allow mocking data for loaders defined with `routeLoader$` function.
838
+ *
839
+ * ```
840
+ * [
841
+ * {
842
+ * loader: useProductData,
843
+ * data: { product: { name: 'Test Product' } },
844
+ * },
845
+ * ];
846
+ * ```
847
+ */
848
+ loaders?: Array<QwikRouterMockLoaderProp<any>>;
849
+ /**
850
+ * Allow mocking actions defined with `routeAction$` function.
851
+ *
852
+ * ```
853
+ * [
854
+ * {
855
+ * action: useAddUser,
856
+ * handler: $(async (data) => {
857
+ * console.log('useAddUser action called with data:', data);
858
+ * }),
859
+ * },
860
+ * ];
861
+ * ```
862
+ */
863
+ actions?: Array<QwikRouterMockActionProp<any>>;
567
864
  }
568
865
 
569
866
  /** @public */
@@ -572,9 +869,9 @@ export declare const QwikRouterMockProvider: Component<QwikRouterMockProps>;
572
869
  /** @public */
573
870
  export declare interface QwikRouterProps {
574
871
  /**
575
- * Enable the ViewTransition API
872
+ * Enable the ViewTransition API on SPA navigation. Opt-in: set to `true` to enable.
576
873
  *
577
- * Default: `true`
874
+ * Default: `false`
578
875
  *
579
876
  * @see https://github.com/WICG/view-transitions/blob/main/explainer.md
580
877
  * @see https://developer.mozilla.org/en-US/docs/Web/API/View_Transitions_API
@@ -583,13 +880,20 @@ export declare interface QwikRouterProps {
583
880
  viewTransition?: boolean;
584
881
  }
585
882
 
586
- /** @public */
883
+ /** @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. */
587
884
  export declare const QwikRouterProvider: Component<QwikRouterProps>;
588
885
 
589
886
  /** @public */
590
- declare interface ReadonlySignal_2<T = unknown> {
591
- readonly value: T;
592
- }
887
+ export declare type RendererOptions = Omit<RenderToStreamOptions, 'serverData'> & {
888
+ serverData: ServerData;
889
+ };
890
+
891
+ /** @public */
892
+ export declare type RendererOutputOptions = Omit<RenderToStreamOptions, 'serverData'> & {
893
+ serverData: ServerData & {
894
+ documentHead?: DocumentHeadValue;
895
+ } & Record<string, unknown>;
896
+ };
593
897
 
594
898
  export { RequestEvent }
595
899
 
@@ -604,24 +908,163 @@ export { RequestEventLoader }
604
908
  export { RequestHandler }
605
909
 
606
910
  /** @public */
607
- export declare type ResolvedDocumentHead<FrontMatter extends Record<string, any> = Record<string, unknown>> = Required<DocumentHeadValue<FrontMatter>>;
911
+ export declare type ResolvedDocumentHead<FrontMatter extends Record<string, any> = Record<string, unknown>> = Required<DocumentHeadValue<FrontMatter>> & {
912
+ /** The build's manifest hash, used for per-loader data URLs. Always defined (`'dev'` in dev). */
913
+ readonly manifestHash: string;
914
+ };
608
915
 
609
- /** @public */
916
+ /**
917
+ * Define a route action that handles form submissions or programmatic invocations.
918
+ *
919
+ * Actions run on the server when submitted from the client. The result is returned as an
920
+ * `ActionStore` with `.value` for success data and `.error` for errors (including validation errors
921
+ * from `zod$`/`valibot$` where `.fieldErrors` etc. are accessible directly on `.error`).
922
+ *
923
+ * By default, after an action completes, ALL current route loaders are invalidated on the client
924
+ * and re-fetched as needed (so that the browser cache is correct). This can be controlled with:
925
+ *
926
+ * - `invalidate: [loader1, loader2]`: Only invalidate specific loaders. The client re-fetches them
927
+ * individually. Other loaders keep their current data.
928
+ * - `invalidate: []`: No loaders are invalidated. The action response only contains the action
929
+ * result. Use this when the action doesn't affect any loader data.
930
+ *
931
+ * The `strictLoaders` Vite plugin option applies `invalidate: []` globally for all actions that
932
+ * don't specify an explicit `invalidate` option.
933
+ *
934
+ * @public
935
+ */
610
936
  export declare const routeAction$: ActionConstructor;
611
937
 
612
- /* Excluded from this release type: routeActionQrl */
613
-
614
938
  /** @public */
615
- export declare type RouteData = [routeName: string, loaders: ModuleLoader[]] | [
616
- routeName: string,
617
- loaders: ModuleLoader[],
618
- originalPathname: string,
619
- routeBundleNames: string[]
620
- ];
939
+ export declare const routeActionQrl: ActionConstructorQRL;
621
940
 
622
- /** @public */
941
+ declare type RouteActionResolver = {
942
+ status: number;
943
+ result: unknown;
944
+ };
945
+
946
+ /**
947
+ * Unified route configuration export. Groups head, eTag, and cacheKey with the same resolution
948
+ * rules as DocumentHead: can be a static object or a function receiving DocumentHeadProps.
949
+ *
950
+ * When a module exports `routeConfig`, the separate `head`, `eTag`, and `cacheKey` exports are
951
+ * ignored for that module.
952
+ *
953
+ * @public
954
+ */
955
+ export declare type RouteConfig = RouteConfigValue | ((props: DocumentHeadProps) => RouteConfigValue);
956
+
957
+ /**
958
+ * The value shape returned by a routeConfig export (object form or function return).
959
+ *
960
+ * @public
961
+ */
962
+ export declare interface RouteConfigValue {
963
+ readonly head?: DocumentHeadValue;
964
+ readonly eTag?: ContentModuleETag;
965
+ readonly cacheKey?: CacheKeyFn;
966
+ }
967
+
968
+ /**
969
+ * A nested route trie structure. The root represents `/` and each level represents a URL segment.
970
+ *
971
+ * Keys starting with `_` are metadata; all other keys are child route segments.
972
+ *
973
+ * - Use `_W` as the key for a single dynamic segment (param); `_P` on that node names the param.
974
+ * - Use `_A` as the key for a rest/catch-all segment; `_P` on that node names the param.
975
+ * - For infix params like `pre[slug]post`, use `_W` with `_0` (prefix) and `_9` (suffix).
976
+ * - Use `_M` for an array of group (pathless layout) nodes, sorted by group name.
977
+ *
978
+ * When matching, exact segments are tried first (case-insensitive), then `_W` (with optional
979
+ * prefix/suffix), then `_A`. When no route matches, the closest `_E` (error.tsx) or `_4` (404.tsx)
980
+ * loader in the ancestor chain is used to render the error page.
981
+ *
982
+ * @public
983
+ */
984
+ export declare interface RouteData {
985
+ /** This node's layout loader (single). Runtime accumulates these during trie traversal. */
986
+ _L?: ContentModuleLoader;
987
+ /**
988
+ * This node's index/page loader. Single = normal (runtime prepends gathered _L). Array = override
989
+ * (layout stop / named layout — IS the complete chain).
990
+ */
991
+ _I?: ContentModuleLoader | ModuleLoader[];
992
+ /** Rewrite/goto target path. Matcher re-walks trie from root using this path's keys. */
993
+ _G?: string;
994
+ /** The JS bundle names for this route (SSR only) */
995
+ _B?: string[];
996
+ /**
997
+ * Not-found (404) boundary: single loader (runtime prepends layouts) or override chain
998
+ * (`404@layout`/`!`).
999
+ */
1000
+ _4?: ContentModuleLoader | ModuleLoader[];
1001
+ /** Error (error.tsx) boundary, same single-or-override-chain shape as `_4`. */
1002
+ _E?: ContentModuleLoader | ModuleLoader[];
1003
+ /** The parameter name when this node is reached via `_W` or `_A` from the parent */
1004
+ _P?: string;
1005
+ /** Prefix for infix params (e.g. "pre" for `pre[slug]post`) — only on `_W` nodes */
1006
+ _0?: string;
1007
+ /** Suffix for infix params (e.g. "post" for `pre[slug]post`) — only on `_W` nodes */
1008
+ _9?: string;
1009
+ /** Group (pathless layout) nodes merged into this level, sorted by group name */
1010
+ _M?: RouteData[];
1011
+ /** Menu loader for this subtree (from menu.md). Runtime uses nearest ancestor during traversal. */
1012
+ _N?: MenuModuleLoader;
1013
+ /** Array of routeLoader$ hashes for this node's loaders */
1014
+ _R?: string[];
1015
+ /** Child route segments (any key not starting with `_`) */
1016
+ [part: string]: RouteData | RouteData[] | ModuleLoader[] | ContentModuleLoader | MenuModuleLoader | string[] | string | undefined;
1017
+ }
1018
+
1019
+ /**
1020
+ * Define a route loader that fetches data before the route renders.
1021
+ *
1022
+ * Route loaders run on the server during SSR and return data as a `ComputedSignal`. On the client,
1023
+ * loaders automatically re-fetch when the route changes (SPA navigation). Each loader gets its own
1024
+ * JSON endpoint (`q-loader-{id}.{hash}.json`), so only the loaders present on the target route are
1025
+ * fetched.
1026
+ *
1027
+ * **Important:** Route loader data uses Qwik's custom serialization format, not standard JSON. This
1028
+ * means the data supports features like circular references, Dates, and other non-JSON types, but
1029
+ * it cannot be consumed by external clients expecting plain JSON.
1030
+ *
1031
+ * ## Options
1032
+ *
1033
+ * - `search: string[]`: Allowlist of URL search params the loader depends on. Only listed params are
1034
+ * sent in the request and changes to other params are ignored. During SSR and loader JSON
1035
+ * requests, the loader's request event is filtered to those params too. `search: []` means no
1036
+ * search params are sent and only route path changes trigger a re-fetch.
1037
+ * - `eTag`: Enable ETag-based caching. Can be `true` (auto-hash), a string, or a function.
1038
+ * - `cacheControl`: Cache-Control for loader JSON responses; the browser HTTP cache controls
1039
+ * client-side freshness. `'immutable'` additionally lets SSG write the loader file.
1040
+ *
1041
+ * The `strictLoaders` Vite plugin option applies `search: []` globally for all loaders that don't
1042
+ * specify an explicit `search` option.
1043
+ *
1044
+ * @public
1045
+ */
623
1046
  export declare const routeLoader$: LoaderConstructor;
624
1047
 
1048
+ /**
1049
+ * Reactive context for route loaders. On the server this is stored in sharedMap, on the client it's
1050
+ * a store that gets updated on navigation.
1051
+ *
1052
+ * - `loaderPaths`: loader ID → fetch path (the longest route path for that loader)
1053
+ * - `pagePathname` / `pageSearch`: client-only navigation state used for loader invalidation and
1054
+ * q-loader fetches. They are intentionally omitted from SSR state and fall back to `location`
1055
+ * until the first SPA navigation.
1056
+ */
1057
+ declare type RouteLoaderCtx = {
1058
+ loaderPaths: Record<string, string | undefined>;
1059
+ pagePathname?: string;
1060
+ pageSearch?: string;
1061
+ /** SPA navigation function. Client-only and intentionally omitted from SSR state. */
1062
+ goto?: NoSerialize<RouteNavigate>;
1063
+ /** Client manifest hash for q-loader fetch URLs. */
1064
+ manifestHash?: string;
1065
+ routeLoaderCandidates?: Record<string, string>;
1066
+ };
1067
+
625
1068
  /* Excluded from this release type: routeLoaderQrl */
626
1069
 
627
1070
  /** @public */
@@ -665,6 +1108,19 @@ declare interface ServerConfig {
665
1108
  fetchOptions?: any;
666
1109
  }
667
1110
 
1111
+ /** @public The server data that is provided by Qwik Router during SSR rendering. It can be retrieved with `useServerData(key)` in the server, but it is not available in the client. */
1112
+ export declare type ServerData = {
1113
+ url: string;
1114
+ requestHeaders: Record<string, string>;
1115
+ renderMode: 'static' | 'server';
1116
+ locale: string | undefined;
1117
+ nonce: string | undefined;
1118
+ containerAttributes: Record<string, string> & {
1119
+ [Q_ROUTE]: string;
1120
+ };
1121
+ qwikrouter: QwikRouterEnvData;
1122
+ };
1123
+
668
1124
  /** @public */
669
1125
  export declare type ServerFunction = {
670
1126
  (this: RequestEventBase, ...args: any[]): any;
@@ -686,28 +1142,18 @@ export declare type ServerQRL<T extends ServerFunction> = QRL<((abort: AbortSign
686
1142
  * JS extensions are allowed) will be picked up, bundled into a separate file, and registered as a
687
1143
  * service worker.
688
1144
  *
1145
+ * Qwik 1.14.0 and above now use `<link rel="modulepreload">` by default. If you didn't add custom
1146
+ * service-worker logic, you should remove your service-worker.ts file(s) for the
1147
+ * `ServiceWorkerRegister` Component to actually unregister the service-worker.js and delete its
1148
+ * related cache. Make sure to keep the `ServiceWorkerRegister` Component in your app (without any
1149
+ * service-worker.ts file) as long as you want to unregister the service-worker.js for your users.
1150
+ *
689
1151
  * @public
690
1152
  */
691
1153
  export declare const ServiceWorkerRegister: (props: {
692
1154
  nonce?: string;
693
1155
  }) => JSXOutput;
694
1156
 
695
- /**
696
- * A signal is a reactive value which can be read and written. When the signal is written, all tasks
697
- * which are tracking the signal will be re-run and all components that read the signal will be
698
- * re-rendered.
699
- *
700
- * Furthermore, when a signal value is passed as a prop to a component, the optimizer will
701
- * automatically forward the signal. This means that `return <div title={signal.value}>hi</div>`
702
- * will update the `title` attribute when the signal changes without having to re-render the
703
- * component.
704
- *
705
- * @public
706
- */
707
- declare interface Signal<T = any> extends ReadonlySignal_2<T> {
708
- value: T;
709
- }
710
-
711
1157
  /** @public */
712
1158
  export declare interface StaticGenerate {
713
1159
  params?: PathParams[];
@@ -744,6 +1190,9 @@ export declare const useContent: () => ContentState;
744
1190
  */
745
1191
  export declare const useDocumentHead: <FrontMatter extends Record<string, unknown> = Record<string, any>>() => Required<ResolvedDocumentHead<FrontMatter>>;
746
1192
 
1193
+ /** @public */
1194
+ export declare const useHttpStatus: () => HttpErrorProps;
1195
+
747
1196
  /** @public */
748
1197
  export declare const useLocation: () => RouteLocation;
749
1198
 
@@ -788,6 +1237,14 @@ export declare const usePreventNavigate$: (qrl: PreventNavigateCallback) => void
788
1237
 
789
1238
  /* Excluded from this release type: usePreventNavigateQrl */
790
1239
 
1240
+ /**
1241
+ * @public
1242
+ * This hook initializes Qwik Router, providing the necessary context for it to work.
1243
+ *
1244
+ * This hook should be used once, at the root of your application.
1245
+ */
1246
+ export declare const useQwikRouter: (props?: QwikRouterProps) => void;
1247
+
791
1248
  /** @beta */
792
1249
  export declare const valibot$: ValibotConstructor;
793
1250
 
@@ -860,16 +1317,16 @@ export declare const zod$: ZodConstructor;
860
1317
  export declare type ZodConstructor = {
861
1318
  <T extends z_2.ZodRawShape>(schema: T): ZodDataValidator<z_2.ZodObject<T>>;
862
1319
  <T extends z_2.ZodRawShape>(schema: (zod: typeof z_2.z, ev: RequestEvent) => T): ZodDataValidator<z_2.ZodObject<T>>;
863
- <T extends z_2.Schema>(schema: T): ZodDataValidator<T>;
864
- <T extends z_2.Schema>(schema: (zod: typeof z_2.z, ev: RequestEvent) => T): ZodDataValidator<T>;
1320
+ <T extends z_2.ZodType>(schema: T): ZodDataValidator<T>;
1321
+ <T extends z_2.ZodType>(schema: (zod: typeof z_2.z, ev: RequestEvent) => T): ZodDataValidator<T>;
865
1322
  };
866
1323
 
867
1324
  /** @public */
868
1325
  declare type ZodConstructorQRL = {
869
1326
  <T extends z_2.ZodRawShape>(schema: QRL<T>): ZodDataValidator<z_2.ZodObject<T>>;
870
1327
  <T extends z_2.ZodRawShape>(schema: QRL<(zod: typeof z_2.z, ev: RequestEvent) => T>): ZodDataValidator<z_2.ZodObject<T>>;
871
- <T extends z_2.Schema>(schema: QRL<T>): ZodDataValidator<T>;
872
- <T extends z_2.Schema>(schema: QRL<(zod: typeof z_2.z, ev: RequestEvent) => T>): ZodDataValidator<T>;
1328
+ <T extends z_2.ZodType>(schema: QRL<T>): ZodDataValidator<T>;
1329
+ <T extends z_2.ZodType>(schema: QRL<(zod: typeof z_2.z, ev: RequestEvent) => T>): ZodDataValidator<T>;
873
1330
  };
874
1331
 
875
1332
  /** @public */