@qwik.dev/router 2.0.0-beta.3 → 2.0.0-beta.30

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 (84) 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 +39 -44
  4. package/lib/adapters/bun-server/vite/index.d.ts +2 -2
  5. package/lib/adapters/bun-server/vite/index.mjs +6 -7
  6. package/lib/adapters/cloud-run/vite/index.d.ts +2 -2
  7. package/lib/adapters/cloud-run/vite/index.mjs +6 -7
  8. package/lib/adapters/cloudflare-pages/vite/index.d.ts +2 -2
  9. package/lib/adapters/cloudflare-pages/vite/index.mjs +23 -32
  10. package/lib/adapters/deno-server/vite/index.d.ts +2 -2
  11. package/lib/adapters/deno-server/vite/index.mjs +13 -9
  12. package/lib/adapters/netlify-edge/vite/index.d.ts +2 -2
  13. package/lib/adapters/netlify-edge/vite/index.mjs +22 -36
  14. package/lib/adapters/node-server/vite/index.d.ts +2 -2
  15. package/lib/adapters/node-server/vite/index.mjs +6 -7
  16. package/lib/adapters/shared/vite/index.d.ts +7 -19
  17. package/lib/adapters/shared/vite/index.mjs +244 -233
  18. package/lib/adapters/ssg/vite/index.d.ts +13 -0
  19. package/lib/adapters/ssg/vite/index.mjs +17 -0
  20. package/lib/adapters/vercel-edge/vite/index.d.ts +3 -3
  21. package/lib/adapters/vercel-edge/vite/index.mjs +33 -19
  22. package/lib/chunks/deepFreeze.qwik.mjs +18 -0
  23. package/lib/chunks/error-handler.mjs +57 -0
  24. package/lib/chunks/fs.mjs +144 -0
  25. package/lib/chunks/http-error.qwik.mjs +35 -0
  26. package/lib/chunks/mime-types.mjs +52 -0
  27. package/lib/chunks/not-found-wrapper.qwik.mjs +25 -0
  28. package/lib/chunks/pathname.mjs +105 -0
  29. package/lib/chunks/redirect-handler.mjs +6 -0
  30. package/lib/chunks/routing.qwik.mjs +820 -0
  31. package/lib/chunks/system.mjs +333 -0
  32. package/lib/chunks/use-functions.qwik.mjs +35 -0
  33. package/lib/chunks/worker-thread.qwik.mjs +2572 -0
  34. package/lib/index.d.ts +358 -141
  35. package/lib/index.qwik.mjs +865 -1156
  36. package/lib/middleware/aws-lambda/index.d.ts +3 -2
  37. package/lib/middleware/aws-lambda/index.mjs +15 -13
  38. package/lib/middleware/azure-swa/index.mjs +17 -218
  39. package/lib/middleware/bun/index.d.ts +11 -0
  40. package/lib/middleware/bun/index.mjs +51 -94
  41. package/lib/middleware/cloudflare-pages/index.mjs +23 -28
  42. package/lib/middleware/deno/index.d.ts +11 -0
  43. package/lib/middleware/deno/index.mjs +50 -94
  44. package/lib/middleware/firebase/index.mjs +7 -11
  45. package/lib/middleware/netlify-edge/index.mjs +23 -29
  46. package/lib/middleware/node/index.mjs +31 -100
  47. package/lib/middleware/request-handler/index.d.ts +161 -83
  48. package/lib/middleware/request-handler/index.mjs +1458 -1257
  49. package/lib/middleware/vercel-edge/index.mjs +28 -33
  50. package/lib/modules.d.ts +11 -16
  51. package/lib/service-worker/index.mjs +4 -0
  52. package/lib/{static → ssg}/index.d.ts +45 -13
  53. package/lib/ssg/index.mjs +336 -0
  54. package/lib/vite/index.d.ts +38 -10
  55. package/lib/vite/index.mjs +2067 -26841
  56. package/modules.d.ts +11 -16
  57. package/package.json +62 -67
  58. package/ssg.d.ts +2 -0
  59. package/static.d.ts +1 -1
  60. package/lib/adapters/azure-swa/vite/index.cjs +0 -96
  61. package/lib/adapters/bun-server/vite/index.cjs +0 -50
  62. package/lib/adapters/cloud-run/vite/index.cjs +0 -47
  63. package/lib/adapters/cloudflare-pages/vite/index.cjs +0 -115
  64. package/lib/adapters/deno-server/vite/index.cjs +0 -62
  65. package/lib/adapters/netlify-edge/vite/index.cjs +0 -129
  66. package/lib/adapters/node-server/vite/index.cjs +0 -50
  67. package/lib/adapters/shared/vite/index.cjs +0 -378
  68. package/lib/adapters/static/vite/index.cjs +0 -368
  69. package/lib/adapters/static/vite/index.d.ts +0 -10
  70. package/lib/adapters/static/vite/index.mjs +0 -331
  71. package/lib/adapters/vercel-edge/vite/index.cjs +0 -118
  72. package/lib/index.qwik.cjs +0 -1947
  73. package/lib/middleware/node/index.cjs +0 -314
  74. package/lib/middleware/request-handler/index.cjs +0 -1614
  75. package/lib/service-worker.cjs +0 -17
  76. package/lib/service-worker.mjs +0 -15
  77. package/lib/static/deno.mjs +0 -8
  78. package/lib/static/index.cjs +0 -67
  79. package/lib/static/index.mjs +0 -48
  80. package/lib/static/node.cjs +0 -1124
  81. package/lib/static/node.mjs +0 -1086
  82. package/lib/vite/index.cjs +0 -27445
  83. package/middleware/request-handler/generated/not-found-paths.ts +0 -7
  84. package/middleware/request-handler/generated/static-paths.ts +0 -35
package/lib/index.d.ts CHANGED
@@ -1,17 +1,19 @@
1
1
  /// <reference path="./modules.d.ts" />
2
2
 
3
+ import type { AsyncSignal } from '@qwik.dev/core';
3
4
  import { Component } from '@qwik.dev/core';
4
5
  import { Cookie } from '@qwik.dev/router/middleware/request-handler';
5
6
  import { CookieOptions } from '@qwik.dev/router/middleware/request-handler';
6
7
  import { CookieValue } from '@qwik.dev/router/middleware/request-handler';
7
8
  import { DeferReturn } from '@qwik.dev/router/middleware/request-handler';
8
9
  import type { EnvGetter } from '@qwik.dev/router/middleware/request-handler';
9
- import { JSXOutput as JSXOutput_2 } from '@qwik.dev/core';
10
+ import { JSXOutput } from '@qwik.dev/core';
10
11
  import { QRL } from '@qwik.dev/core';
11
12
  import { QRLEventHandlerMulti } from '@qwik.dev/core';
12
13
  import { QwikIntrinsicElements } from '@qwik.dev/core';
13
14
  import { QwikJSX } from '@qwik.dev/core';
14
- import type { ReadonlySignal } from '@qwik.dev/core';
15
+ import { Render } from '@qwik.dev/core/server';
16
+ import { RenderOptions } from '@qwik.dev/core/server';
15
17
  import { RequestEvent } from '@qwik.dev/router/middleware/request-handler';
16
18
  import { RequestEventAction } from '@qwik.dev/router/middleware/request-handler';
17
19
  import { RequestEventBase } from '@qwik.dev/router/middleware/request-handler';
@@ -19,8 +21,11 @@ import { RequestEventCommon } from '@qwik.dev/router/middleware/request-handler'
19
21
  import { RequestEventLoader } from '@qwik.dev/router/middleware/request-handler';
20
22
  import { RequestHandler } from '@qwik.dev/router/middleware/request-handler';
21
23
  import type { ResolveSyncValue } from '@qwik.dev/router/middleware/request-handler';
24
+ import type { SerializationStrategy } from '@qwik.dev/core/internal';
25
+ import type { Signal } from '@qwik.dev/core';
22
26
  import type * as v from 'valibot';
23
27
  import type { ValueOrPromise } from '@qwik.dev/core';
28
+ import { ValueOrPromise as ValueOrPromise_2 } from '@qwik.dev/core/internal';
24
29
  import { z } from 'zod';
25
30
  import type * as z_2 from 'zod';
26
31
 
@@ -156,6 +161,17 @@ export declare type ActionStore<RETURN, INPUT, OPTIONAL extends boolean = true>
156
161
 
157
162
  declare type AnchorAttributes = QwikIntrinsicElements['a'];
158
163
 
164
+ /**
165
+ * The cacheKey export type. When exported from a page module alongside eTag, enables in-memory SSR
166
+ * caching.
167
+ *
168
+ * - `true`: use the default cache key `status|eTag|pathname`
169
+ * - Function: receives status, eTag, and pathname; returns a cache key string or null (no cache)
170
+ *
171
+ * @public
172
+ */
173
+ export declare type CacheKeyFn = true | ((status: number, eTag: string, pathname: string) => string | null);
174
+
159
175
  /** @public */
160
176
  export declare interface ContentHeading {
161
177
  readonly text: string;
@@ -172,9 +188,17 @@ export declare interface ContentMenu {
172
188
 
173
189
  declare type ContentModule = PageModule | LayoutModule;
174
190
 
175
- declare type ContentModuleHead = DocumentHead | ResolvedDocumentHead;
191
+ /**
192
+ * The eTag export type: a static string or a function receiving DocumentHeadProps.
193
+ *
194
+ * @public
195
+ */
196
+ export declare type ContentModuleETag = string | ((props: DocumentHeadProps) => string | null);
197
+
198
+ /** @public */
199
+ export declare type ContentModuleHead = DocumentHead | ResolvedDocumentHead;
176
200
 
177
- declare type ContentModuleLoader = () => Promise<ContentModule>;
201
+ declare type ContentModuleLoader = () => ValueOrPromise<ContentModule>;
178
202
 
179
203
  /** @public */
180
204
  declare interface ContentState {
@@ -188,6 +212,38 @@ export { CookieOptions }
188
212
 
189
213
  export { CookieValue }
190
214
 
215
+ /**
216
+ * Creates the `render()` function that is required by `createQwikRouter()`. It requires a function
217
+ * that returns the `jsx` and `options` for the renderer.
218
+ *
219
+ * @example
220
+ *
221
+ * ```tsx
222
+ * const renderer = createRenderer((opts) => {
223
+ * if (opts.requestHeaders['x-hello'] === 'world') {
224
+ * return { jsx: <Hello />, options: opts };
225
+ * }
226
+ * return { jsx: <Root />, options: {
227
+ * ...opts,
228
+ * serverData: {
229
+ * ...opts.serverData,
230
+ * documentHead: {
231
+ * meta: [
232
+ * { name: 'renderedAt', content: new Date().toISOString() },
233
+ * ],
234
+ * },
235
+ * },
236
+ * } };
237
+ * });
238
+ * ```
239
+ *
240
+ * @public
241
+ */
242
+ export declare const createRenderer: (getOptions: (options: RendererOptions) => {
243
+ jsx: JSXOutput;
244
+ options: RendererOutputOptions;
245
+ }) => Render;
246
+
191
247
  /** @public */
192
248
  export declare type DataValidator<T extends Record<string, any> = {}> = {
193
249
  validate(ev: RequestEvent, data: unknown): Promise<ValidatorReturn<T>>;
@@ -195,32 +251,48 @@ export declare type DataValidator<T extends Record<string, any> = {}> = {
195
251
 
196
252
  export { DeferReturn }
197
253
 
198
- /** @public */
199
- declare interface DevJSX {
200
- fileName: string;
201
- lineNumber: number;
202
- columnNumber: number;
203
- stack?: string;
204
- }
205
-
206
254
  /** @public */
207
255
  export declare type DocumentHead = DocumentHeadValue | ((props: DocumentHeadProps) => DocumentHeadValue);
208
256
 
209
257
  /** @public */
210
258
  export declare interface DocumentHeadProps extends RouteLocation {
211
259
  readonly head: ResolvedDocumentHead;
260
+ /** The HTTP status code of the response (e.g. 200, 404). */
261
+ readonly status: number;
262
+ /** @deprecated This is not necessary, it works correctly without */
212
263
  readonly withLocale: <T>(fn: () => T) => T;
213
264
  readonly resolveValue: ResolveSyncValue;
214
265
  }
215
266
 
267
+ /**
268
+ * This renders all the tags collected from `head`.
269
+ *
270
+ * You can partially override the head, for example if you want to change the title:
271
+ *
272
+ * ```tsx
273
+ * import { DocumentHeadTags, useDocumentHead } from '@qwik.dev/router';
274
+ *
275
+ * export default component$(() => {
276
+ * const head = useDocumentHead();
277
+ * return <DocumentHeadTags title={`${head.title} - My App`} />;
278
+ * });
279
+ * ```
280
+ *
281
+ * You don't have to use this component, you can also do it yourself for full control. Just copy the
282
+ * code from this component and modify it to your needs.
283
+ *
284
+ * Note that this component normally only runs once, during SSR. You can use Signals in your
285
+ * `src/root.tsx` to make runtime changes to `<head>` if needed.
286
+ *
287
+ * @public
288
+ */
289
+ export declare const DocumentHeadTags: Component<DocumentHeadValue<Record<string, unknown>>>;
290
+
216
291
  /** @public */
217
292
  export declare interface DocumentHeadValue<FrontMatter extends Record<string, any> = Record<string, unknown>> {
218
293
  /** Sets `document.title`. */
219
294
  readonly title?: string;
220
- /**
221
- * Used to manually set meta tags in the head. Additionally, the `data` property could be used to
222
- * set arbitrary data which the `<head>` component could later use to generate `<meta>` tags.
223
- */
295
+ /** Used to manually set meta tags in the head. */
224
296
  readonly meta?: readonly DocumentMeta[];
225
297
  /** Used to manually append `<link>` elements to the `<head>`. */
226
298
  readonly links?: readonly DocumentLink[];
@@ -237,53 +309,60 @@ export declare interface DocumentHeadValue<FrontMatter extends Record<string, an
237
309
  }
238
310
 
239
311
  /** @public */
240
- export declare interface DocumentLink {
241
- as?: string;
242
- crossorigin?: string;
243
- disabled?: boolean;
244
- href?: string;
245
- hreflang?: string;
246
- id?: string;
247
- imagesizes?: string;
248
- imagesrcset?: string;
249
- integrity?: string;
250
- media?: string;
251
- prefetch?: string;
252
- referrerpolicy?: string;
253
- rel?: string;
254
- sizes?: string;
255
- title?: string;
256
- type?: string;
257
- key?: string;
258
- }
312
+ export declare type DocumentLink = QwikIntrinsicElements['link'];
259
313
 
260
314
  /** @public */
261
- export declare interface DocumentMeta {
262
- readonly content?: string;
263
- readonly httpEquiv?: string;
264
- readonly name?: string;
265
- readonly property?: string;
266
- readonly key?: string;
267
- readonly itemprop?: string;
268
- readonly media?: string;
269
- }
270
-
271
- /** @beta */
272
- export declare interface DocumentScript {
273
- readonly script?: string;
274
- readonly props?: Readonly<QwikIntrinsicElements['script']>;
275
- readonly key?: string;
276
- }
315
+ export declare type DocumentMeta = QwikIntrinsicElements['meta'];
277
316
 
278
317
  /** @public */
279
- export declare interface DocumentStyle {
280
- readonly style: string;
281
- readonly props?: Readonly<QwikIntrinsicElements['style']>;
282
- readonly key?: string;
318
+ export declare type DocumentScript = ((Omit<QwikIntrinsicElements['script'], 'dangerouslySetInnerHTML'> & {
319
+ props?: never;
320
+ }) | {
321
+ key?: string;
322
+ /**
323
+ * The props of the script element. @deprecated Prefer setting the properties directly instead
324
+ * of using this property.
325
+ */
326
+ props: Readonly<QwikIntrinsicElements['script']>;
327
+ }) & ({
328
+ /** The inline script content. */
329
+ script?: string;
330
+ dangerouslySetInnerHTML?: never;
331
+ } | {
332
+ dangerouslySetInnerHTML?: string;
333
+ script?: never;
334
+ });
335
+
336
+ /** @public */
337
+ export declare type DocumentStyle = Readonly<((Omit<QwikIntrinsicElements['style'], 'dangerouslySetInnerHTML'> & {
338
+ props?: never;
339
+ }) | {
340
+ key?: string;
341
+ /**
342
+ * The props of the style element. @deprecated Prefer setting the properties directly
343
+ * instead of using this property.
344
+ */
345
+ props: Readonly<QwikIntrinsicElements['style']>;
346
+ }) & ({
347
+ /** The inline style content. */
348
+ style?: string;
349
+ dangerouslySetInnerHTML?: never;
350
+ } | {
351
+ dangerouslySetInnerHTML?: string;
352
+ style?: never;
353
+ })>;
354
+
355
+ declare type EndpointModuleLoader = () => ValueOrPromise<RouteModule>;
356
+
357
+ declare interface EndpointResponse {
358
+ status: number;
359
+ statusMessage?: string;
360
+ loaders: Record<string, unknown>;
361
+ loadersSerializationStrategy: Map<string, SerializationStrategy>;
362
+ formData?: FormData;
363
+ action?: string;
283
364
  }
284
365
 
285
- declare type EndpointModuleLoader = () => Promise<RouteModule>;
286
-
287
366
  /** @public */
288
367
  export declare const ErrorBoundary: Component<ErrorBoundaryProps>;
289
368
 
@@ -303,7 +382,7 @@ export declare type FailOfRest<REST extends readonly DataValidator[]> = REST ext
303
382
  export declare type FailReturn<T> = T & Failed;
304
383
 
305
384
  /** @public */
306
- export declare const Form: <O, I>({ action, spaReset, reloadDocument, onSubmit$, ...rest }: FormProps<O, I>, key: string | null) => JSXOutput_2;
385
+ export declare const Form: <O, I>({ action, spaReset, reloadDocument, onSubmit$, ...rest }: FormProps<O, I>, key: string | null) => JSXOutput;
307
386
 
308
387
  /** @public */
309
388
  export declare interface FormProps<O, I> extends Omit<QwikJSX.IntrinsicElements['form'], 'action' | 'method'> {
@@ -334,17 +413,6 @@ export declare interface FormSubmitSuccessDetail<T> {
334
413
  value: T;
335
414
  }
336
415
 
337
- /**
338
- * Any function taking a props object that returns JSXOutput.
339
- *
340
- * The `key`, `flags` and `dev` parameters are for internal use.
341
- *
342
- * @public
343
- */
344
- declare type FunctionComponent<P = unknown> = {
345
- renderFn(props: P, key: string | null, flags: number, dev?: DevJSX): JSXOutput;
346
- }['renderFn'];
347
-
348
416
  /** @public */
349
417
  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;
350
418
 
@@ -359,6 +427,14 @@ export declare const globalAction$: ActionConstructor;
359
427
 
360
428
  /* Excluded from this release type: globalActionQrl */
361
429
 
430
+ /** @public */
431
+ export declare type HttpErrorProps = {
432
+ /** The HTTP status code, e.g. 404 */
433
+ status: number;
434
+ /** The error message, e.g. "Not Found" */
435
+ message: string;
436
+ };
437
+
362
438
  declare type IsAny<Type> = 0 extends 1 & Type ? true : false;
363
439
 
364
440
  /** @public */
@@ -371,31 +447,9 @@ export declare type JSONValue = string | number | boolean | {
371
447
  [x: string]: JSONValue;
372
448
  } | Array<JSONValue>;
373
449
 
374
- /** @public */
375
- declare type JSXChildren = string | number | boolean | null | undefined | Function | RegExp | JSXChildren[] | Promise<JSXChildren> | Signal<JSXChildren> | JSXNode;
376
-
377
- /**
378
- * A JSX Node, an internal structure. You probably want to use `JSXOutput` instead.
379
- *
380
- * @public
381
- */
382
- declare interface JSXNode<T extends string | FunctionComponent | unknown = unknown> {
383
- type: T;
384
- props: T extends FunctionComponent<infer P> ? P : Record<any, unknown>;
385
- children: JSXChildren | null;
386
- key: string | null;
387
- dev?: DevJSX;
388
- }
389
-
390
- /**
391
- * Any valid output for a component
392
- *
393
- * @public
394
- */
395
- declare type JSXOutput = JSXNode | string | number | boolean | null | undefined | JSXOutput[];
396
-
397
450
  declare interface LayoutModule extends RouteModule {
398
- readonly default: unknown;
451
+ readonly default?: (props: Record<string, never>) => JSXOutput;
452
+ readonly routeConfig?: RouteConfig;
399
453
  readonly head?: ContentModuleHead;
400
454
  }
401
455
 
@@ -412,7 +466,7 @@ export declare interface LinkProps extends AnchorAttributes {
412
466
  *
413
467
  * This **improves UX performance** for client-side (**SPA**) navigations.
414
468
  *
415
- * Prefetching occurs when a the Link enters the viewport in production (**`on:qvisible`**), or
469
+ * Prefetching occurs when a the Link enters the viewport in production (**`q-e:qvisible`**), or
416
470
  * with **`mouseover`/`focus`** during dev.
417
471
  *
418
472
  * Prefetching will not occur if the user has the **data saver** setting enabled.
@@ -426,6 +480,24 @@ export declare interface LinkProps extends AnchorAttributes {
426
480
  scroll?: boolean;
427
481
  }
428
482
 
483
+ /** The route to render */
484
+ declare interface LoadedRoute {
485
+ /** The canonical path of the route, e.g. `/products/[id]` */
486
+ $routeName$: string;
487
+ /** The route parameters, e.g. `{ id: '123' }` */
488
+ $params$: PathParams;
489
+ /** The modules associated with this route (on 404, contains only the error component) */
490
+ $mods$: (RouteModule | ContentModule)[];
491
+ /** The menu associated with this route */
492
+ $menu$?: ContentMenu | undefined;
493
+ /** The bundle names for this route */
494
+ $routeBundleNames$?: string[] | undefined;
495
+ /** Whether this route is a not-found (404) route */
496
+ $notFound$?: boolean;
497
+ /** The error module loader (nearest _E ancestor), for rendering ServerErrors */
498
+ $errorLoader$?: ContentModuleLoader;
499
+ }
500
+
429
501
  /** @public */
430
502
  declare type Loader_2<RETURN> = {
431
503
  /**
@@ -450,14 +522,13 @@ declare type LoaderConstructorQRL = {
450
522
 
451
523
  /** @public */
452
524
  declare type LoaderOptions = {
453
- id?: string;
525
+ readonly id?: string;
526
+ readonly validation?: DataValidator[];
527
+ readonly serializationStrategy?: SerializationStrategy;
454
528
  };
455
529
 
456
530
  /** @public */
457
- export declare type LoaderSignal<TYPE> = TYPE extends () => ValueOrPromise<infer VALIDATOR> ? ReadonlySignal<ValueOrPromise<VALIDATOR>> : ReadonlySignal<TYPE>;
458
-
459
- /** @public */
460
- export declare type MenuData = [pathname: string, menuLoader: MenuModuleLoader];
531
+ export declare type LoaderSignal<TYPE> = (TYPE extends () => ValueOrPromise<infer VALIDATOR> ? Signal<ValueOrPromise<VALIDATOR>> : Signal<TYPE>) & Pick<AsyncSignal, 'promise' | 'loading' | 'error'>;
461
532
 
462
533
  declare interface MenuModule {
463
534
  readonly default: ContentMenu;
@@ -480,12 +551,15 @@ export { NavigationType_2 as NavigationType }
480
551
  export declare function omitProps<T, KEYS extends keyof T>(obj: T, keys: KEYS[]): Omit<T, KEYS>;
481
552
 
482
553
  /** @public */
483
- export declare interface PageModule extends RouteModule {
484
- readonly default: unknown;
554
+ export declare type PageModule = RouteModule & {
555
+ readonly default: (props: Record<string, never>) => JSXOutput;
556
+ readonly routeConfig?: RouteConfig;
485
557
  readonly head?: ContentModuleHead;
558
+ readonly eTag?: ContentModuleETag;
559
+ readonly cacheKey?: CacheKeyFn;
486
560
  readonly headings?: ContentHeading[];
487
561
  readonly onStaticGenerate?: StaticGenerateHandler;
488
- }
562
+ };
489
563
 
490
564
  /** @public */
491
565
  export declare type PathParams = Record<string, string>;
@@ -507,6 +581,9 @@ declare type Prettify<T> = {} & {
507
581
  */
508
582
  export declare type PreventNavigateCallback = (url?: number | URL) => ValueOrPromise<boolean>;
509
583
 
584
+ /** @public */
585
+ export declare const Q_ROUTE = "q:route";
586
+
510
587
  /**
511
588
  * @deprecated Use `QWIK_ROUTER_SCROLLER` instead (will be removed in V3)
512
589
  * @public
@@ -517,13 +594,7 @@ export declare const QWIK_CITY_SCROLLER = "_qCityScroller";
517
594
  export declare const QWIK_ROUTER_SCROLLER = "_qRouterScroller";
518
595
 
519
596
  /**
520
- * @deprecated Use `QwikRouterMockProps` instead. will be removed in V3
521
- * @public
522
- */
523
- export declare type QwikCityMockProps = QwikRouterMockProps;
524
-
525
- /**
526
- * @deprecated Use `QwikRouterMockProvider` instead. Will be removed in V3
597
+ * @deprecated Use `useQwikMockRouter()` instead. Will be removed in V3
527
598
  * @public
528
599
  */
529
600
  export declare const QwikCityMockProvider: Component<QwikRouterMockProps>;
@@ -535,32 +606,93 @@ export declare const QwikCityMockProvider: Component<QwikRouterMockProps>;
535
606
  export declare type QwikCityPlan = QwikRouterConfig;
536
607
 
537
608
  /**
538
- * @deprecated Use `QwikRouterProps` instead. will be removed in V3
609
+ * @deprecated Use `QwikRouterProps` instead. Will be removed in v3.
539
610
  * @public
540
611
  */
541
612
  export declare type QwikCityProps = QwikRouterProps;
542
613
 
543
614
  /**
544
- * @deprecated Use `QwikRouterProvider` instead. will be removed in V3
615
+ * @deprecated Use `useQwikRouter()` instead. Will be removed in v3.
545
616
  * @public
546
617
  */
547
618
  export declare const QwikCityProvider: Component<QwikRouterProps>;
548
619
 
549
620
  /** @public */
550
621
  export declare interface QwikRouterConfig {
551
- readonly routes: RouteData[];
622
+ readonly routes: RouteData;
552
623
  readonly serverPlugins?: RouteModule[];
553
624
  readonly basePathname?: string;
554
- readonly menus?: MenuData[];
555
625
  readonly trailingSlash?: boolean;
556
626
  readonly cacheModules?: boolean;
627
+ /** When true, return null instead of rendering the 404 page, letting the adapter handle it */
628
+ readonly fallthrough?: boolean;
629
+ }
630
+
631
+ /** @public */
632
+ export declare interface QwikRouterEnvData {
633
+ routeName: string;
634
+ ev: RequestEvent;
635
+ params: PathParams;
636
+ response: EndpointResponse;
637
+ loadedRoute: LoadedRoute;
638
+ }
639
+
640
+ /** @public */
641
+ export declare interface QwikRouterMockActionProp<T = any> {
642
+ /** The action function to mock. */
643
+ action: Action<T>;
644
+ /** The QRL function that will be called when the action is submitted. */
645
+ handler: QRL<(data: T) => ValueOrPromise_2<RouteActionResolver>>;
646
+ }
647
+
648
+ /** @public */
649
+ export declare interface QwikRouterMockLoaderProp<T = any> {
650
+ /** The loader function to mock. */
651
+ loader: Loader_2<T>;
652
+ /** The data to return when the loader is called. */
653
+ data: T;
557
654
  }
558
655
 
559
656
  /** @public */
560
657
  export declare interface QwikRouterMockProps {
658
+ /**
659
+ * Allow mocking the url returned by `useLocation` hook.
660
+ *
661
+ * Default: `http://localhost/`
662
+ */
561
663
  url?: string;
664
+ /** Allow mocking the route params returned by `useLocation` hook. */
562
665
  params?: Record<string, string>;
666
+ /** Allow mocking the `goto` function returned by `useNavigate` hook. */
563
667
  goto?: RouteNavigate;
668
+ /**
669
+ * Allow mocking data for loaders defined with `routeLoader$` function.
670
+ *
671
+ * ```
672
+ * [
673
+ * {
674
+ * loader: useProductData,
675
+ * data: { product: { name: 'Test Product' } },
676
+ * },
677
+ * ];
678
+ * ```
679
+ */
680
+ loaders?: Array<QwikRouterMockLoaderProp<any>>;
681
+ /**
682
+ * Allow mocking actions defined with `routeAction$` function.
683
+ *
684
+ * ```
685
+ * [
686
+ * {
687
+ * action: useAddUser,
688
+ * handler: $(async (data) => {
689
+ * console.log('useAddUser action called with data:', data);
690
+ * }),
691
+ * },
692
+ * ];
693
+ * ```
694
+ */
695
+ actions?: Array<QwikRouterMockActionProp<any>>;
564
696
  }
565
697
 
566
698
  /** @public */
@@ -575,18 +707,25 @@ export declare interface QwikRouterProps {
575
707
  *
576
708
  * @see https://github.com/WICG/view-transitions/blob/main/explainer.md
577
709
  * @see https://developer.mozilla.org/en-US/docs/Web/API/View_Transitions_API
578
- * @see https://caniuse.com/mdn-api_viewtransition
710
+ * @see https://caniuse.com/mdn_api_viewtransition
579
711
  */
580
712
  viewTransition?: boolean;
581
713
  }
582
714
 
583
- /** @public */
715
+ /** @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. */
584
716
  export declare const QwikRouterProvider: Component<QwikRouterProps>;
585
717
 
586
718
  /** @public */
587
- declare interface ReadonlySignal_2<T = unknown> {
588
- readonly value: T;
589
- }
719
+ export declare type RendererOptions = Omit<RenderOptions, 'serverData'> & {
720
+ serverData: ServerData;
721
+ };
722
+
723
+ /** @public */
724
+ export declare type RendererOutputOptions = Omit<RenderOptions, 'serverData'> & {
725
+ serverData: ServerData & {
726
+ documentHead?: DocumentHeadValue;
727
+ } & Record<string, unknown>;
728
+ };
590
729
 
591
730
  export { RequestEvent }
592
731
 
@@ -608,13 +747,78 @@ export declare const routeAction$: ActionConstructor;
608
747
 
609
748
  /* Excluded from this release type: routeActionQrl */
610
749
 
611
- /** @public */
612
- export declare type RouteData = [routeName: string, loaders: ModuleLoader[]] | [
613
- routeName: string,
614
- loaders: ModuleLoader[],
615
- originalPathname: string,
616
- routeBundleNames: string[]
617
- ];
750
+ declare type RouteActionResolver = {
751
+ status: number;
752
+ result: unknown;
753
+ };
754
+
755
+ /**
756
+ * Unified route configuration export. Groups head, eTag, and cacheKey with the same resolution
757
+ * rules as DocumentHead: can be a static object or a function receiving DocumentHeadProps.
758
+ *
759
+ * When a module exports `routeConfig`, the separate `head`, `eTag`, and `cacheKey` exports are
760
+ * ignored for that module.
761
+ *
762
+ * @public
763
+ */
764
+ export declare type RouteConfig = RouteConfigValue | ((props: DocumentHeadProps) => RouteConfigValue);
765
+
766
+ /**
767
+ * The value shape returned by a routeConfig export (object form or function return).
768
+ *
769
+ * @public
770
+ */
771
+ export declare interface RouteConfigValue {
772
+ readonly head?: DocumentHeadValue;
773
+ readonly eTag?: ContentModuleETag;
774
+ readonly cacheKey?: CacheKeyFn;
775
+ }
776
+
777
+ /**
778
+ * A nested route trie structure. The root represents `/` and each level represents a URL segment.
779
+ *
780
+ * Keys starting with `_` are metadata; all other keys are child route segments.
781
+ *
782
+ * - Use `_W` as the key for a single dynamic segment (param); `_P` on that node names the param.
783
+ * - Use `_A` as the key for a rest/catch-all segment; `_P` on that node names the param.
784
+ * - For infix params like `pre[slug]post`, use `_W` with `_0` (prefix) and `_9` (suffix).
785
+ * - Use `_M` for an array of group (pathless layout) nodes, sorted by group name.
786
+ *
787
+ * When matching, exact segments are tried first (case-insensitive), then `_W` (with optional
788
+ * prefix/suffix), then `_A`. When no route matches, the closest `_E` (error.tsx) or `_4` (404.tsx)
789
+ * loader in the ancestor chain is used to render the error page.
790
+ *
791
+ * @public
792
+ */
793
+ export declare interface RouteData {
794
+ /** This node's layout loader (single). Runtime accumulates these during trie traversal. */
795
+ _L?: ContentModuleLoader;
796
+ /**
797
+ * This node's index/page loader. Single = normal (runtime prepends gathered _L). Array = override
798
+ * (layout stop / named layout — IS the complete chain).
799
+ */
800
+ _I?: ContentModuleLoader | ModuleLoader[];
801
+ /** Rewrite/goto target path. Matcher re-walks trie from root using this path's keys. */
802
+ _G?: string;
803
+ /** The JS bundle names for this route (SSR only) */
804
+ _B?: string[];
805
+ /** The not-found (404) module loader for this subtree */
806
+ _4?: ContentModuleLoader;
807
+ /** The error page module loader for this subtree (error.tsx, takes precedence over _4) */
808
+ _E?: ContentModuleLoader;
809
+ /** The parameter name when this node is reached via `_W` or `_A` from the parent */
810
+ _P?: string;
811
+ /** Prefix for infix params (e.g. "pre" for `pre[slug]post`) — only on `_W` nodes */
812
+ _0?: string;
813
+ /** Suffix for infix params (e.g. "post" for `pre[slug]post`) — only on `_W` nodes */
814
+ _9?: string;
815
+ /** Group (pathless layout) nodes merged into this level, sorted by group name */
816
+ _M?: RouteData[];
817
+ /** Menu loader for this subtree (from menu.md). Runtime uses nearest ancestor during traversal. */
818
+ _N?: MenuModuleLoader;
819
+ /** Child route segments (any key not starting with `_`) */
820
+ [part: string]: RouteData | RouteData[] | ModuleLoader[] | ContentModuleLoader | MenuModuleLoader | string[] | string | undefined;
821
+ }
618
822
 
619
823
  /** @public */
620
824
  export declare const routeLoader$: LoaderConstructor;
@@ -662,6 +866,18 @@ declare interface ServerConfig {
662
866
  fetchOptions?: any;
663
867
  }
664
868
 
869
+ /** @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. */
870
+ export declare type ServerData = {
871
+ url: string;
872
+ requestHeaders: Record<string, string>;
873
+ locale: string | undefined;
874
+ nonce: string | undefined;
875
+ containerAttributes: Record<string, string> & {
876
+ [Q_ROUTE]: string;
877
+ };
878
+ qwikrouter: QwikRouterEnvData;
879
+ };
880
+
665
881
  /** @public */
666
882
  export declare type ServerFunction = {
667
883
  (this: RequestEventBase, ...args: any[]): any;
@@ -683,28 +899,18 @@ export declare type ServerQRL<T extends ServerFunction> = QRL<((abort: AbortSign
683
899
  * JS extensions are allowed) will be picked up, bundled into a separate file, and registered as a
684
900
  * service worker.
685
901
  *
902
+ * Qwik 1.14.0 and above now use `<link rel="modulepreload">` by default. If you didn't add custom
903
+ * service-worker logic, you should remove your service-worker.ts file(s) for the
904
+ * `ServiceWorkerRegister` Component to actually unregister the service-worker.js and delete its
905
+ * related cache. Make sure to keep the `ServiceWorkerRegister` Component in your app (without any
906
+ * service-worker.ts file) as long as you want to unregister the service-worker.js for your users.
907
+ *
686
908
  * @public
687
909
  */
688
910
  export declare const ServiceWorkerRegister: (props: {
689
911
  nonce?: string;
690
912
  }) => JSXOutput;
691
913
 
692
- /**
693
- * A signal is a reactive value which can be read and written. When the signal is written, all tasks
694
- * which are tracking the signal will be re-run and all components that read the signal will be
695
- * re-rendered.
696
- *
697
- * Furthermore, when a signal value is passed as a prop to a component, the optimizer will
698
- * automatically forward the signal. This means that `return <div title={signal.value}>hi</div>`
699
- * will update the `title` attribute when the signal changes without having to re-render the
700
- * component.
701
- *
702
- * @public
703
- */
704
- declare interface Signal<T = any> extends ReadonlySignal_2<T> {
705
- value: T;
706
- }
707
-
708
914
  /** @public */
709
915
  export declare interface StaticGenerate {
710
916
  params?: PathParams[];
@@ -741,6 +947,9 @@ export declare const useContent: () => ContentState;
741
947
  */
742
948
  export declare const useDocumentHead: <FrontMatter extends Record<string, unknown> = Record<string, any>>() => Required<ResolvedDocumentHead<FrontMatter>>;
743
949
 
950
+ /** @public */
951
+ export declare const useHttpStatus: () => HttpErrorProps;
952
+
744
953
  /** @public */
745
954
  export declare const useLocation: () => RouteLocation;
746
955
 
@@ -785,6 +994,14 @@ export declare const usePreventNavigate$: (qrl: PreventNavigateCallback) => void
785
994
 
786
995
  /* Excluded from this release type: usePreventNavigateQrl */
787
996
 
997
+ /**
998
+ * @public
999
+ * This hook initializes Qwik Router, providing the necessary context for it to work.
1000
+ *
1001
+ * This hook should be used once, at the root of your application.
1002
+ */
1003
+ export declare const useQwikRouter: (props?: QwikRouterProps) => void;
1004
+
788
1005
  /** @beta */
789
1006
  export declare const valibot$: ValibotConstructor;
790
1007