@qwik.dev/core 2.0.0-beta.43 → 2.0.0-beta.47

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 (45) hide show
  1. package/build.d.ts +1 -1
  2. package/dist/async-local-storage.d.ts +3 -0
  3. package/dist/async-local-storage.mjs +8 -0
  4. package/dist/async-local-storage.node.mjs +6 -0
  5. package/dist/backpatch/package.json +1 -1
  6. package/dist/build/package.json +1 -1
  7. package/dist/cli.mjs +26 -5
  8. package/dist/core-internal.d.ts +223 -162
  9. package/dist/core.min.mjs +10 -11
  10. package/dist/core.mjs +6268 -6181
  11. package/dist/core.mjs.map +1 -1
  12. package/dist/core.prod.mjs +5104 -5104
  13. package/dist/error-swap-executor.debug.js +2 -2
  14. package/dist/error-swap-executor.js +1 -1
  15. package/dist/insights.d.ts +2 -2
  16. package/dist/jsx-runtime/index.d.ts +1 -1
  17. package/dist/loader/index.mjs +2 -2
  18. package/dist/loader/package.json +1 -1
  19. package/dist/optimizer.d.ts +240 -11
  20. package/dist/optimizer.mjs +879 -656
  21. package/dist/out-of-order-executor.debug.js +2 -2
  22. package/dist/preloader.mjs +77 -69
  23. package/dist/qwikloader.debug.js +12 -10
  24. package/dist/qwikloader.js +1 -1
  25. package/dist/server-modules.d.ts +7 -7
  26. package/dist/server.d.ts +17 -17
  27. package/dist/server.mjs +99 -66
  28. package/dist/server.prod.mjs +485 -448
  29. package/dist/starters/adapters/bun/adapters/bun/vite.config.ts +0 -1
  30. package/dist/testing/index.d.ts +26 -30
  31. package/dist/testing/index.mjs +7560 -7335
  32. package/dist/testing/package.json +1 -1
  33. package/dist/ts-optimizer.mjs +10477 -0
  34. package/dist/worker/index.mjs +12 -10
  35. package/dist/worker/package.json +1 -1
  36. package/dist/worker/worker.shared.js +3 -3
  37. package/handlers.mjs +6 -6
  38. package/jsx-dev-runtime.d.ts +1 -1
  39. package/jsx-runtime.d.ts +1 -1
  40. package/loader.d.ts +1 -1
  41. package/optimizer.d.ts +1 -1
  42. package/package.json +22 -7
  43. package/public.d.ts +6 -6
  44. package/server.d.ts +1 -1
  45. package/testing.d.ts +1 -1
@@ -1,10 +1,10 @@
1
- import type { AsyncLocalStorage } from 'node:async_hooks';
2
1
  import type * as CSS_2 from 'csstype';
3
- import { isBrowser } from './build';
4
- import { isDev } from './build';
5
- import { isServer } from './build';
6
- import { ResolvedManifest } from './optimizer';
7
- import type { ServerQwikManifest } from './optimizer';
2
+ import { getAsyncLocalStorage as _getAsyncLocalStorage } from './async-local-storage.js';
3
+ import { isBrowser } from './build/index.js';
4
+ import { isDev } from './build/index.js';
5
+ import { isServer } from './build/index.js';
6
+ import { ResolvedManifest } from './optimizer.js';
7
+ import type { ServerQwikManifest } from './optimizer.js';
8
8
 
9
9
  /**
10
10
  * Qwik Optimizer marker function.
@@ -381,12 +381,6 @@ declare type AsyncQRL<T> = ComputeQRL<T>;
381
381
  * changed, all tasks which are tracking the AsyncSignal will be re-run and all subscribers
382
382
  * (components, tasks etc) that read the AsyncSignal will be updated.
383
383
  *
384
- * If the async function throws an error, the AsyncSignal will capture the error and set the `error`
385
- * property. The error can be cleared by re-running the async function successfully.
386
- *
387
- * While the async function is running, the `.loading` property will be set to `true`. Once the
388
- * function completes, `loading` will be set to `false`.
389
- *
390
384
  * If the value has not yet been resolved, reading the AsyncSignal will throw a Promise, which will
391
385
  * retry the component or task once the value resolves.
392
386
  *
@@ -394,8 +388,7 @@ declare type AsyncQRL<T> = ComputeQRL<T>;
394
388
  * will subscribe to it and return the last resolved value until the new value is ready. As soon as
395
389
  * the new value is ready, the subscribers will be updated.
396
390
  *
397
- * If the async function threw an error, reading the `.value` will throw that same error. Read from
398
- * `.error` to check if there was an error.
391
+ * If the async function threw an error, reading the `.value` will throw that same error.
399
392
  *
400
393
  * @deprecated Use `ComputedSignal` instead, it has async support now.
401
394
  * @public
@@ -460,19 +453,91 @@ declare type BivariantQrlFn<ARGS extends any[], RETURN> = {
460
453
  /** @public */
461
454
  declare type Booleanish = boolean | `${boolean}`;
462
455
 
456
+ /** @internal */
457
+ export declare const _caC: (props: CatchProps) => JSXOutput;
458
+
463
459
  declare type Capture = {
464
460
  [K in keyof HTMLElementEventMap as `capture:${K}`]?: boolean;
465
461
  };
466
462
 
467
463
  /**
468
- * The current captured scope during QRL invocation. This is used to provide the lexical scope for
469
- * QRL functions. It is used one time per invocation, synchronously, so it is safe to store it in
470
- * module scope.
464
+ * Legacy binding for libraries built before `_capturesObj`; their segments read `_captures[N]` from
465
+ * their own copy of core, so this live binding is kept in sync.
471
466
  *
467
+ * @deprecated Use `_capturesObj._` instead.
472
468
  * @internal
473
469
  */
474
470
  export declare let _captures: Readonly<unknown[]> | null;
475
471
 
472
+ /**
473
+ * Holder for the current captured scope during QRL invocation. This is used to provide the lexical
474
+ * scope for QRL functions. It is used one time per invocation, synchronously, so it is safe to
475
+ * store it in one place.
476
+ *
477
+ * It is an object (instead of a `let` binding) registered as a singleton, so that duplicated Qwik
478
+ * modules (e.g. an externalized library and the app both bundling core) share the same holder.
479
+ * Generated segment code reads captures as `_capturesObj._[N]`.
480
+ *
481
+ * @internal
482
+ */
483
+ export declare const _capturesObj: {
484
+ _: Readonly<unknown[]> | null;
485
+ };
486
+
487
+ /** @internal */
488
+ export declare const _caR: () => void;
489
+
490
+ /** Renders `fallback$` instead of its children when a descendant throws. @public @experimental */
491
+ export declare const Catch: Component<CatchProps>;
492
+
493
+ /** Structured metadata about a caught error, passed to `onError$`. @public @experimental */
494
+ export declare interface CatchInfo {
495
+ /** Where the caught error originated. */
496
+ phase: CatchPhase;
497
+ /**
498
+ * Identifies the boundary within the page. Allocated in render order and kept across a resume, so
499
+ * every report from one boundary shares it — but it shifts when render order changes.
500
+ */
501
+ boundaryId: string;
502
+ /**
503
+ * The code a production fallback shows for a server-origin error, so a user's bug report matches
504
+ * your logs. An error caught during SSR reports a second, different digest if the client
505
+ * re-derives it — the stacks differ.
506
+ */
507
+ digest: string;
508
+ }
509
+
510
+ /** Identifies where an error caught by an error boundary originated. @public @experimental */
511
+ export declare const enum CatchPhase {
512
+ Render = "render",
513
+ Event = "event",
514
+ Hook = "hook"
515
+ }
516
+
517
+ /** @public @experimental */
518
+ export declare interface CatchProps {
519
+ /**
520
+ * Rendered when a descendant throws. The error is always an `Error`, so `{error.message}` is
521
+ * safe: a non-Error throw is wrapped, and production redacts server-origin errors to a generic
522
+ * message plus `digest`. Client-origin errors render as thrown — their messages already live in
523
+ * the browser bundle.
524
+ *
525
+ * Wrap `reset` in a handler — `onClick$={() => reset()}`, not `onClick$={reset}` — so it stays
526
+ * wired in a streamed fallback.
527
+ */
528
+ fallback$: QRL<(error: Error & {
529
+ digest?: string;
530
+ }, reset: QRL<() => void>) => JSXOutput>;
531
+ /**
532
+ * Side effect only; never affects rendering. Receives the original `Error` — a non-Error throw
533
+ * arrives wrapped, with `cause` set to the raw value.
534
+ *
535
+ * An error caught during SSR fires again when the client re-derives it, so dedupe in your
536
+ * reporter.
537
+ */
538
+ onError$?: QRL<(error: Error, info: CatchInfo) => void>;
539
+ }
540
+
476
541
  /**
477
542
  * Handles events for bind:checked
478
543
  *
@@ -691,49 +756,28 @@ export declare type ComputedReturnType<T> = ComputedSignal<Awaited<T>>;
691
756
  * @public
692
757
  */
693
758
  export declare interface ComputedSignal<T> extends Signal<T> {
694
- /** @deprecated Use `trigger()` instead */
695
- force(): void;
696
- /** Use this to force recalculation. */
697
- invalidate(): void;
698
- /**
699
- * Clear the value and recompute. Unlike `invalidate()`, readers see the loading state (reads
700
- * throw the computation promise) instead of the stale value while the new value computes.
701
- */
702
- clear(): void;
703
759
  /**
704
- * Whether the signal is currently loading. This will trigger lazy computation of the signal, so
705
- * you can use it like this:
760
+ * Whether the signal is currently loading. Reading it starts a lazy computation if needed.
706
761
  *
707
- * ```tsx
708
- * signal.pending ? <Loading /> : signal.error ? <Error /> : <Component
709
- * value={signal.value} />
710
- * ```
762
+ * @experimental
711
763
  */
712
764
  pending: boolean;
713
765
  /**
714
- * Lets you read the pending state without subscribing to `.pending` updates. It also triggers
715
- * lazy computation of the signal.
766
+ * The computation error, if any. Reading it starts a lazy computation if needed. While set,
767
+ * reading `.value` throws the error.
716
768
  *
717
- * Setting it will trigger listeners for `.pending`.
718
- */
719
- untrackedPending: boolean;
720
- /** @deprecated Use `pending` instead */
721
- loading: boolean;
722
- /** @deprecated Use `untrackedPending` instead */
723
- untrackedLoading: boolean;
724
- /**
725
- * The error that occurred while computing the signal, if any, including synchronous throws. This
726
- * will be cleared when the signal is successfully computed. It also triggers lazy computation of
727
- * the signal. While the error is set, reading `.value` throws it.
769
+ * @experimental
728
770
  */
729
771
  error: Error | undefined;
772
+ /** @deprecated Use `trigger()` instead */
773
+ force(): void;
774
+ /** Use this to force recalculation. */
775
+ invalidate(): void;
730
776
  /**
731
- * Lets you read the error state without subscribing to `.error` updates. It also triggers lazy
732
- * computation of the signal.
733
- *
734
- * Setting it will trigger listeners for `.error`.
777
+ * Clear the value and recompute. Unlike `invalidate()`, readers see the loading state (reads
778
+ * throw the computation promise) instead of the stale value while the new value computes.
735
779
  */
736
- untrackedError: Error | undefined;
780
+ clear(): void;
737
781
  /** A promise that resolves when the value is computed or rejected. */
738
782
  promise(): Promise<void>;
739
783
  /** Abort the current computation and run cleanups if needed. */
@@ -778,6 +822,7 @@ declare class ComputedSignalImpl<T, S extends _QRLInternal = ComputeQRL<T>> exte
778
822
  $timeoutMs$: number | undefined;
779
823
  $loadingEffects$: undefined | Set<EffectSubscription>;
780
824
  $errorEffects$: undefined | Set<EffectSubscription>;
825
+ $disposed$: boolean | undefined;
781
826
  $computationTimeoutId$: ReturnType<typeof setTimeout> | undefined;
782
827
  $info$: unknown | undefined;
783
828
  $infoVersion$: number | undefined;
@@ -855,7 +900,9 @@ declare class ComputedSignalImpl<T, S extends _QRLInternal = ComputeQRL<T>> exte
855
900
  * AbortErrors.
856
901
  */
857
902
  $setError$(job: Job<T>, error: Error): void;
858
- /** Called after SSR/unmount */
903
+ /** Permanently stop computations; keep this cross-package name stable. */
904
+ $dispose(): void;
905
+ /** Clean computations after SSR while preserving dependencies for serialization. */
859
906
  $destroy$(): Promise<void>;
860
907
  private $hasSubscribers$;
861
908
  $requestCleanups$(job: Job<T>, reason?: any): void;
@@ -865,6 +912,32 @@ declare class ComputedSignalImpl<T, S extends _QRLInternal = ComputeQRL<T>> exte
865
912
  $runCleanups$(job: Job<T>): Promise<void> | undefined;
866
913
  }
867
914
 
915
+ /**
916
+ * A computed signal with its pending and error state exposed.
917
+ *
918
+ * @internal
919
+ */
920
+ export declare interface _ComputedSignalInternal<T> extends ComputedSignal<T> {
921
+ /**
922
+ * Lets you read the pending state without subscribing to `.pending` updates. It also triggers
923
+ * lazy computation of the signal.
924
+ *
925
+ * Setting it will trigger listeners for `.pending`.
926
+ */
927
+ untrackedPending: boolean;
928
+ /** @deprecated Use `pending` instead */
929
+ loading: boolean;
930
+ /** @deprecated Use `untrackedPending` instead */
931
+ untrackedLoading: boolean;
932
+ /**
933
+ * Lets you read the error state without subscribing to `.error` updates. It also triggers lazy
934
+ * computation of the signal.
935
+ *
936
+ * Setting it will trigger listeners for `.error`.
937
+ */
938
+ untrackedError: Error | undefined;
939
+ }
940
+
868
941
  declare type ComputeQRL<T> = _QRLInternal<ComputedFn<T>>;
869
942
 
870
943
  /** @internal */
@@ -897,7 +970,7 @@ export declare interface _Container {
897
970
  $resolveRenderPromise$: (() => void) | null;
898
971
  $pendingCount$: number;
899
972
  $checkPendingCount$(): void;
900
- handleError(err: any, $host$: _HostElement | null, phase?: ErrorBoundaryPhase): void;
973
+ handleError(err: any, $host$: _HostElement | null, phase?: CatchPhase): void;
901
974
  getParentHost(host: _HostElement): _HostElement | null;
902
975
  setContext<T>(host: _HostElement, context: ContextId<T>, value: T): void;
903
976
  resolveContext<T>(host: _HostElement, contextId: ContextId<T>): T | undefined;
@@ -1089,9 +1162,9 @@ export declare const createAsyncQrl: <T>(qrl: QRL<ComputedFn<T>>, options?: Asyn
1089
1162
  *
1090
1163
  * The QRL must be a function which returns the value of the signal. The function must not have side
1091
1164
  * effects. Every synchronous signal or store read is tracked automatically; reads after the first
1092
- * `await` must use the `track()` provided on the context argument. When the function is async, the
1093
- * returned signal exposes the async API (`.pending`, `.error`, `.promise()`), and reading an
1094
- * unresolved `.value` throws the computation promise.
1165
+ * `await` must use the `track()` provided on the context argument. When the function is async,
1166
+ * reading an unresolved `.value` throws the computation promise, and reading a failed `.value`
1167
+ * throws the error.
1095
1168
  *
1096
1169
  * @public
1097
1170
  */
@@ -1292,7 +1365,7 @@ declare class DomContainer extends _SharedContainer implements ClientContainer {
1292
1365
  $hoistStyles$(): void;
1293
1366
  $setRawState$(id: number, vParent: _VNode): void;
1294
1367
  parseQRL<T = unknown>(qrlStr: string): QRL<T>;
1295
- handleError(err: any, host: _VNode | null, phase?: ErrorBoundaryPhase): void;
1368
+ handleError(err: any, host: _VNode | null, phase?: CatchPhase): void;
1296
1369
  setContext<T>(host: _VNode, context: ContextId<T>, value: T): void;
1297
1370
  resolveContext<T>(host: _VNode, contextId: ContextId<T>): T | undefined;
1298
1371
  resolveContextHost(host: _VNode, contextId: ContextId<unknown>): _VNode | null;
@@ -1334,12 +1407,6 @@ declare interface EachProps<T, ITEM extends JSXOutput = JSXOutput> {
1334
1407
  /** @internal */
1335
1408
  export declare const _eaT: ({ track }: TaskCtx) => Promise<void>;
1336
1409
 
1337
- /** @internal */
1338
- export declare const _ebC: (props: ErrorBoundaryProps) => JSXOutput;
1339
-
1340
- /** @internal */
1341
- export declare const _ebR: () => void;
1342
-
1343
1410
  /** @internal */
1344
1411
  export declare const _EFFECT_BACK_REF: unique symbol;
1345
1412
 
@@ -1411,57 +1478,6 @@ export declare const _EMPTY_ARRAY: any[];
1411
1478
  /** @internal */
1412
1479
  export declare const _EMPTY_OBJ: Record<string, any>;
1413
1480
 
1414
- /** Renders `fallback$` instead of its children when a descendant throws. @public @experimental */
1415
- export declare const ErrorBoundary: Component<ErrorBoundaryProps>;
1416
-
1417
- /** Structured metadata about a caught error, passed to `onError$`. @public @experimental */
1418
- export declare interface ErrorBoundaryInfo {
1419
- /** Where the caught error originated. */
1420
- phase: ErrorBoundaryPhase;
1421
- /**
1422
- * Identifies the boundary within the page. Allocated in render order and kept across a resume, so
1423
- * every report from one boundary shares it — but it shifts when render order changes.
1424
- */
1425
- boundaryId: string;
1426
- /**
1427
- * The code a production fallback shows for a server-origin error, so a user's bug report matches
1428
- * your logs. An error caught during SSR reports a second, different digest if the client
1429
- * re-derives it — the stacks differ.
1430
- */
1431
- digest: string;
1432
- }
1433
-
1434
- /** Identifies where an error caught by an error boundary originated. @public @experimental */
1435
- export declare const enum ErrorBoundaryPhase {
1436
- Render = "render",
1437
- Event = "event",
1438
- Hook = "hook"
1439
- }
1440
-
1441
- /** @public @experimental */
1442
- export declare interface ErrorBoundaryProps {
1443
- /**
1444
- * Rendered when a descendant throws. The error is always an `Error`, so `{error.message}` is
1445
- * safe: a non-Error throw is wrapped, and production redacts server-origin errors to a generic
1446
- * message plus `digest`. Client-origin errors render as thrown — their messages already live in
1447
- * the browser bundle.
1448
- *
1449
- * Wrap `reset` in a handler — `onClick$={() => reset()}`, not `onClick$={reset}` — so it stays
1450
- * wired in a streamed fallback.
1451
- */
1452
- fallback$: QRL<(error: Error & {
1453
- digest?: string;
1454
- }, reset: QRL<() => void>) => JSXOutput>;
1455
- /**
1456
- * Side effect only; never affects rendering. Receives the original `Error` — a non-Error throw
1457
- * arrives wrapped, with `cause` set to the raw value.
1458
- *
1459
- * An error caught during SSR fires again when the client re-derives it, so dedupe in your
1460
- * reporter.
1461
- */
1462
- onError$?: QRL<(error: Error, info: ErrorBoundaryInfo) => void>;
1463
- }
1464
-
1465
1481
  /** @public */
1466
1482
  export declare const event$: <T>(qrl: T) => QRL<T>;
1467
1483
 
@@ -1528,8 +1544,7 @@ export declare type FunctionComponent<P = unknown> = {
1528
1544
  renderFn(props: P, key: string | null, flags: number, dev?: DevJSX): JSXOutput;
1529
1545
  }['renderFn'];
1530
1546
 
1531
- /** @internal */
1532
- export declare const _getAsyncLocalStorage: () => (new <T>() => AsyncLocalStorage<T>) | undefined;
1547
+ export { _getAsyncLocalStorage }
1533
1548
 
1534
1549
  /**
1535
1550
  * Returns the client build manifest, which includes the mappings from symbols to bundles, the
@@ -1583,6 +1598,13 @@ export declare const getPlatform: () => CorePlatform;
1583
1598
  /** @internal */
1584
1599
  export declare function _getQContainerElement(element: Element): Element | null;
1585
1600
 
1601
+ /**
1602
+ * Read a singleton registered with `registerSingleton`, if any.
1603
+ *
1604
+ * @internal
1605
+ */
1606
+ export declare const _getSingleton: <T>(key: string) => T | undefined;
1607
+
1586
1608
  /** @internal */
1587
1609
  export declare function _getSubscriber(effect: Consumer, prop: _EffectProperty | string, data?: _SubscriptionData): EffectSubscription;
1588
1610
 
@@ -1600,7 +1622,10 @@ export { h as createElement }
1600
1622
  export { h }
1601
1623
 
1602
1624
  /** @internal */
1603
- export declare function _handleSSRError(container: SSRContainer, err: any, host: ISsrNode | null, phase: ErrorBoundaryPhase): void;
1625
+ export declare function _handleSSRError(container: SSRContainer, err: any, host: ISsrNode | null, phase: CatchPhase): void;
1626
+
1627
+ /** @internal */
1628
+ export declare function _hasSlotProps(props: Props | null | undefined): boolean;
1604
1629
 
1605
1630
  /**
1606
1631
  * @returns True if the store has effects for the given prop
@@ -1613,7 +1638,7 @@ export declare const _hasStoreEffects: (value: StoreTarget, prop: keyof StoreTar
1613
1638
  *
1614
1639
  * When called by the qwikloader or the test dispatch, `this` is the serialized captures string
1615
1640
  * which we deserialize to get the host VNode. When called through `_qDispatch` (client-rendered),
1616
- * `_captures` is already set by `ensureQrlCaptures` in the QRL call chain.
1641
+ * `_capturesObj._` is already set by `ensureQrlCaptures` in the QRL call chain.
1617
1642
  *
1618
1643
  * @internal
1619
1644
  */
@@ -1865,6 +1890,7 @@ declare interface ISsrNode {
1865
1890
  readonly [_EFFECT_BACK_REF]: Map<_EffectProperty | string, EffectSubscription> | null;
1866
1891
  setProp(name: string, value: any): void;
1867
1892
  getProp(name: string): any;
1893
+ hasSlotProps(): boolean;
1868
1894
  removeProp(name: string): void;
1869
1895
  addChild(child: ISsrNode): void;
1870
1896
  setTreeNonUpdatable(): void;
@@ -1905,7 +1931,7 @@ declare class Job<T> implements ComputeCtx<T> {
1905
1931
  /** Backward compatible cache method for resource */
1906
1932
  cache(): void;
1907
1933
  get previous(): T | undefined;
1908
- cleanup(callback: () => void): void;
1934
+ cleanup: (callback: () => void) => void;
1909
1935
  }
1910
1936
 
1911
1937
  /**
@@ -2346,9 +2372,24 @@ declare type Passive = {
2346
2372
  [K in keyof HTMLElementEventMap as `passive:${K}`]?: boolean;
2347
2373
  };
2348
2374
 
2375
+ /** @internal */
2376
+ export declare const _peC: (props: PendingProps) => JSXNodeInternal<string>[];
2377
+
2378
+ /** @public @experimental */
2379
+ export declare const Pending: Component<PendingProps>;
2380
+
2381
+ /** @public @experimental */
2382
+ export declare type PendingProps = {
2383
+ fallback$?: QRL<() => JSXOutput>;
2384
+ delay?: number;
2385
+ };
2386
+
2387
+ /** @internal */
2388
+ export declare const _peT: ({ track, cleanup }: TaskCtx) => void;
2389
+
2349
2390
  declare type PopoverTargetAction = 'hide' | 'show' | 'toggle';
2350
2391
 
2351
- declare type PossibleEvents = Event | SimplifiedServerRequestEvent | typeof TaskEvent | typeof RenderEvent;
2392
+ declare type PossibleEvents = Event | typeof TaskEvent | typeof RenderEvent;
2352
2393
 
2353
2394
  /**
2354
2395
  * @deprecated This is no longer needed as the preloading happens automatically in qrl-class. You
@@ -2377,6 +2418,8 @@ export declare const PrefetchServiceWorker: (opts: {
2377
2418
  nonce?: string;
2378
2419
  }) => JSXOutput;
2379
2420
 
2421
+ declare type Preload = (item: string | string[], probability?: number) => void;
2422
+
2380
2423
  /**
2381
2424
  * Preprocess the state data to:
2382
2425
  *
@@ -2513,7 +2556,7 @@ export declare interface _QDocument extends Document {
2513
2556
  qVNodeDataProcessed?: boolean;
2514
2557
  /** Processes one vnode patch script. */
2515
2558
  qProcessVNodeDataPatch?: (script: Element | null) => void;
2516
- /** Processes an out-of-order Suspense segment after its resolved HTML is swapped in. */
2559
+ /** Processes an out-of-order Pending segment after its resolved HTML is swapped in. */
2517
2560
  qProcessOOOS?: (boundaryId: number, revealNode: Element | null) => void;
2518
2561
  /** Routes `qerror` to the owning container; installed once per document, shared by all bundles. */
2519
2562
  qErrorHandler?: (e: Event) => void;
@@ -2910,6 +2953,14 @@ export declare type QwikSVGElements = {
2910
2953
  [K in keyof Omit<SVGElementTagNameMap, keyof HTMLElementTagNameMap>]: SVGProps<SVGElementTagNameMap[K]>;
2911
2954
  };
2912
2955
 
2956
+ /**
2957
+ * A marker symbol shared by every copy of this Qwik version. `Symbol.for` keys are global to the
2958
+ * realm, so the version keeps markers apart when several Qwik versions share a page.
2959
+ *
2960
+ * @internal
2961
+ */
2962
+ export declare const _qwikSymbol: <S extends symbol = symbol>(name: string) => S;
2963
+
2913
2964
  /** Emitted by qwik-loader on document when a module was lazily loaded @public */
2914
2965
  export declare type QwikSymbolEvent = CustomEvent<{
2915
2966
  symbol: string;
@@ -2972,6 +3023,22 @@ declare type RefFnInterface<EL> = {
2972
3023
  (el: EL): void;
2973
3024
  };
2974
3025
 
3026
+ /**
3027
+ * Registers the function of an inlined QRL by its hash, so the server can call it by hash. The
3028
+ * router uses it for the `server$` functions of a library kept external on the server, whose build
3029
+ * inlines its QRLs instead of emitting segments.
3030
+ *
3031
+ * @internal
3032
+ */
3033
+ export declare const _regInlinedQrl: (qrl: QRL) => void;
3034
+
3035
+ /**
3036
+ * Get or create a singleton shared by all Qwik module instances in this process/version.
3037
+ *
3038
+ * @internal
3039
+ */
3040
+ export declare const _registerSingleton: <T>(key: string, factory: () => T) => T;
3041
+
2975
3042
  /**
2976
3043
  * Register a QRL symbol globally for lookup by its hash. This is used by the optimizer to register
2977
3044
  * the names passed in `reg_ctx_name`.
@@ -3037,6 +3104,9 @@ export declare interface RenderSSROptions {
3037
3104
  manifestHash: string;
3038
3105
  }
3039
3106
 
3107
+ /** @internal */
3108
+ export declare const _requestPreload: Preload;
3109
+
3040
3110
  /** @internal */
3041
3111
  export declare const _reR: () => boolean;
3042
3112
 
@@ -3068,21 +3138,13 @@ export declare const _resolveContextWithoutSequentialScope: <STATE>(context: Con
3068
3138
  * return (
3069
3139
  * <div>
3070
3140
  * <input name="city" bind:value={city} />
3071
- * <div>
3072
- * Temperature:{' '}
3073
- * {weather.pending
3074
- * ? 'Loading...'
3075
- * : weather.error
3076
- * ? `Error: ${weather.error.message}`
3077
- * : weather.value.temp}
3078
- * </div>
3141
+ * <div>Temperature: {weather.value.temp}</div>
3079
3142
  * </div>
3080
3143
  * );
3081
3144
  * });
3082
3145
  * ```
3083
3146
  *
3084
- * @deprecated Use `useComputed$` instead. Read the `pending` and `error` properties from the
3085
- * returned signal to determine the status.
3147
+ * @deprecated Use `useComputed$` instead.
3086
3148
  * @public
3087
3149
  */
3088
3150
  export declare const Resource: <T>({ value, onResolved, onPending, onRejected, }: ResourceProps<T>) => JSXOutput;
@@ -3137,7 +3199,7 @@ declare interface ResourceReturnInternal<T> {
3137
3199
  __brand: 'resource';
3138
3200
  value: Promise<T>;
3139
3201
  loading: boolean;
3140
- signal: AsyncSignal<{
3202
+ signal: _ComputedSignalInternal<{
3141
3203
  r: T;
3142
3204
  }>;
3143
3205
  }
@@ -3252,7 +3314,7 @@ declare interface SerializationContext {
3252
3314
  $setSyncFnOffset$(offset: number, existingFns?: string[]): void;
3253
3315
  $isSsrNode$: (obj: unknown) => obj is ISsrNode;
3254
3316
  $isDomRef$: (obj: unknown) => obj is DomRef;
3255
- $markSsrNodeForSerialization$: (node: ISsrNode, flags: number) => void;
3317
+ $markSsrNodeForSerialization$: (node: ISsrNode, flags: number, isStateRoot?: boolean) => void;
3256
3318
  $writer$: SSRInternalStreamWriter;
3257
3319
  $setWriter$(writer: SSRInternalStreamWriter): void;
3258
3320
  $syncFns$: string[];
@@ -3447,7 +3509,7 @@ export declare abstract class _SharedContainer implements _Container {
3447
3509
  } | null, symbolToChunkResolver: SymbolToChunkResolver, writer?: StreamWriter): SerializationContext;
3448
3510
  $checkPendingCount$(): void;
3449
3511
  abstract ensureProjectionResolved(host: _HostElement): void;
3450
- abstract handleError(err: any, $host$: _HostElement | null, phase?: ErrorBoundaryPhase): void;
3512
+ abstract handleError(err: any, $host$: _HostElement | null, phase?: CatchPhase): void;
3451
3513
  abstract getParentHost(host: _HostElement): _HostElement | null;
3452
3514
  abstract setContext<T>(host: _HostElement, context: ContextId<T>, value: T): void;
3453
3515
  abstract resolveContext<T>(host: _HostElement, contextId: ContextId<T>): T | undefined;
@@ -3524,12 +3586,6 @@ declare class SignalImpl<T = any> implements Signal<T> {
3524
3586
  };
3525
3587
  }
3526
3588
 
3527
- declare interface SimplifiedServerRequestEvent<T = unknown> {
3528
- url: URL;
3529
- locale: string | undefined;
3530
- request: Request;
3531
- }
3532
-
3533
3589
  /** @public */
3534
3590
  declare type Size = number | string;
3535
3591
 
@@ -3806,9 +3862,9 @@ declare interface SSRContainer extends _Container {
3806
3862
  additionalHeadNodes: Array<JSXNodeInternal>;
3807
3863
  additionalBodyNodes: Array<JSXNodeInternal>;
3808
3864
  $noScriptHere$: number;
3809
- /** Innermost open ErrorBoundary content host, so the walker can skip an errored subtree. */
3865
+ /** Innermost open Catch content host, so the walker can skip an errored subtree. */
3810
3866
  $errorContentHost$: ISsrNode | null;
3811
- /** Set when an ErrorBoundary caught during this container's render. */
3867
+ /** Set when a Catch caught during this container's render. */
3812
3868
  $hasBoundaryError$?: boolean;
3813
3869
  /**
3814
3870
  * Lets the container place a root-level `useOn` placeholder `<script>` itself when injecting it
@@ -3989,21 +4045,6 @@ export declare class _SubscriptionPatch {
3989
4045
  constructor(rootId?: number, subscriptions?: Set<EffectSubscription> | Map<string | symbol, Set<EffectSubscription>>);
3990
4046
  }
3991
4047
 
3992
- /** @internal */
3993
- export declare const _suC: (props: SuspenseProps) => JSXNodeInternal<string>[];
3994
-
3995
- /** @public @experimental */
3996
- export declare const Suspense: typeof _suC;
3997
-
3998
- /** @public @experimental */
3999
- export declare type SuspenseProps = {
4000
- fallback?: JSXOutput;
4001
- delay?: number;
4002
- };
4003
-
4004
- /** @internal */
4005
- export declare const _suT: ({ track, cleanup }: TaskCtx) => void;
4006
-
4007
4048
  /**
4008
4049
  * The TS types don't include the SVG attributes so we have to define them ourselves
4009
4050
  *
@@ -4346,7 +4387,8 @@ declare const enum TaskFlags {
4346
4387
  DIRTY = 4,
4347
4388
  RENDER_BLOCKING = 8,
4348
4389
  NEEDS_CLEANUP = 16,
4349
- EVENTS_REGISTERED = 32
4390
+ EVENTS_REGISTERED = 32,
4391
+ EXECUTED = 64
4350
4392
  }
4351
4393
 
4352
4394
  /** @public */
@@ -4494,9 +4536,8 @@ export declare function _updateProjectionProps(container: _Container, vnode: _Vi
4494
4536
  *
4495
4537
  * Every synchronous signal or store read is tracked automatically. Reads after an `await` are not:
4496
4538
  * the tracking context is lost, so track them explicitly with the `track()` provided on the context
4497
- * argument. When the function is async, the returned signal exposes the async API: reading an
4498
- * unresolved `.value` throws the computation promise, and `.pending` and `.error` expose the
4499
- * computation state.
4539
+ * argument. When the function is async, reading an unresolved `.value` throws the computation
4540
+ * promise, and reading a failed `.value` throws the error.
4500
4541
  *
4501
4542
  * The function must not have any side effects.
4502
4543
  *
@@ -4655,7 +4696,7 @@ export declare const useId: () => string;
4655
4696
  * NOTE: `useLexicalScope` method can only be used in the synchronous portion of the callback
4656
4697
  * (before any `await` statements.)
4657
4698
  *
4658
- * @deprecated Use `_captures` instead.
4699
+ * @deprecated Use `_capturesObj._` instead.
4659
4700
  * @internal
4660
4701
  */
4661
4702
  export declare const useLexicalScope: <VARS extends any[]>() => VARS;
@@ -5040,6 +5081,12 @@ export declare const useStylesScopedQrl: (styles: QRL<string>) => UseStylesScope
5040
5081
  * function to wrap property reads. This creates subscriptions that will trigger the `taskFn` to
5041
5082
  * rerun.
5042
5083
  *
5084
+ * Cleanup callbacks registered with `cleanup()` or returned from the task may be async. When a task
5085
+ * reruns, Qwik waits for the previous cleanup to finish before starting the next invocation.
5086
+ *
5087
+ * During SSR, the cleanup function is called immediately after SSR completes. Therefore, it is not
5088
+ * called on the client side after resuming, but only the second time the task runs on the client.
5089
+ *
5043
5090
  * @param task - Function which should be re-executed when changes to the inputs are detected
5044
5091
  * @public
5045
5092
  *
@@ -5113,6 +5160,14 @@ export declare const useTaskQrl: (qrl: QRL<TaskFn>, opts?: TaskOptions) => void;
5113
5160
  * });
5114
5161
  * ```
5115
5162
  *
5163
+ * Visible Tasks are a variant of Tasks that only run in the browser, and are registered but not
5164
+ * executed during SSR. They are useful for running code that should only execute in the browser,
5165
+ * such as code that interacts with the DOM or browser APIs.
5166
+ *
5167
+ * Cleanup callbacks registered with `cleanup()` or returned from the task may be async. When a
5168
+ * visible task reruns, Qwik waits for the previous cleanup to finish before starting the next
5169
+ * invocation.
5170
+ *
5116
5171
  * @public
5117
5172
  */
5118
5173
  export declare const useVisibleTask$: (fn: TaskFn, opts?: OnVisibleTaskOptions) => void;
@@ -5141,7 +5196,7 @@ export declare const _VAR_PROPS: unique symbol;
5141
5196
  export declare const _verifySerializable: <T>(value: T, preMessage?: string) => T;
5142
5197
 
5143
5198
  /**
5144
- * 2.0.0-beta.43-dev+e478dfb
5199
+ * 2.0.0-beta.47-dev+919c91b
5145
5200
  *
5146
5201
  * @public
5147
5202
  */
@@ -5315,9 +5370,15 @@ export declare const _waitUntilRendered: (container: _Container) => Promise<void
5315
5370
  /** @internal */
5316
5371
  export declare function _walkJSX(ssr: SSRContainer, value: JSXOutput, options: SSRRenderJSXOptions): Promise<void>;
5317
5372
 
5373
+ /** @internal */
5374
+ export declare const _whenContainerDataReady: <T>(container: ClientContainer, callback: () => T | Promise<T>) => T | Promise<T>;
5375
+
5318
5376
  /**
5319
5377
  * Override the `getLocale` with `lang` within the `fn` execution.
5320
5378
  *
5379
+ * `fn` may be async. The locale stays set until the returned promise settles, even when
5380
+ * AsyncLocalStorage is not available.
5381
+ *
5321
5382
  * @public
5322
5383
  */
5323
5384
  export declare function withLocale<T>(locale: string, fn: () => T): T;