@qwik.dev/core 2.0.0-beta.41 → 2.0.0-beta.42

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.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@qwik.dev/core/backpatch",
3
- "version": "2.0.0-beta.41-dev+4d04076",
3
+ "version": "2.0.0-beta.42-dev+3473a49",
4
4
  "main": "index.mjs",
5
5
  "types": "index.d.ts",
6
6
  "private": true,
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@qwik.dev/core/build",
3
- "version": "2.0.0-beta.41-dev+4d04076",
3
+ "version": "2.0.0-beta.42-dev+3473a49",
4
4
  "main": "index.mjs",
5
5
  "types": "index.d.ts",
6
6
  "private": true,
package/dist/cli.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * @qwik.dev/core/cli 2.0.0-beta.41-dev+4d04076
3
+ * @qwik.dev/core/cli 2.0.0-beta.42-dev+3473a49
4
4
  * Copyright QwikDev. All Rights Reserved.
5
5
  * Use of this source code is governed by an MIT-style license that can be
6
6
  * found in the LICENSE file at https://github.com/QwikDev/qwik/blob/main/LICENSE
@@ -12966,7 +12966,7 @@ async function printHelp(app) {
12966
12966
  await runCommand2(Object.assign(app, { task: args[0], args }));
12967
12967
  }
12968
12968
  function printVersion() {
12969
- console.log("2.0.0-beta.41-dev+4d04076");
12969
+ console.log("2.0.0-beta.42-dev+3473a49");
12970
12970
  }
12971
12971
  export {
12972
12972
  runCli,
@@ -897,7 +897,7 @@ export declare interface _Container {
897
897
  $resolveRenderPromise$: (() => void) | null;
898
898
  $pendingCount$: number;
899
899
  $checkPendingCount$(): void;
900
- handleError(err: any, $host$: _HostElement | null): void;
900
+ handleError(err: any, $host$: _HostElement | null, phase?: ErrorBoundaryPhase): void;
901
901
  getParentHost(host: _HostElement): _HostElement | null;
902
902
  setContext<T>(host: _HostElement, context: ContextId<T>, value: T): void;
903
903
  resolveContext<T>(host: _HostElement, contextId: ContextId<T>): T | undefined;
@@ -1292,9 +1292,10 @@ declare class DomContainer extends _SharedContainer implements ClientContainer {
1292
1292
  $hoistStyles$(): void;
1293
1293
  $setRawState$(id: number, vParent: _VNode): void;
1294
1294
  parseQRL<T = unknown>(qrlStr: string): QRL<T>;
1295
- handleError(err: any, host: _VNode | null): void;
1295
+ handleError(err: any, host: _VNode | null, phase?: ErrorBoundaryPhase): void;
1296
1296
  setContext<T>(host: _VNode, context: ContextId<T>, value: T): void;
1297
1297
  resolveContext<T>(host: _VNode, contextId: ContextId<T>): T | undefined;
1298
+ resolveContextHost(host: _VNode, contextId: ContextId<unknown>): _VNode | null;
1298
1299
  getParentHost(host: _VNode): _VNode | null;
1299
1300
  setHostProp<T>(host: _HostElement, name: string, value: T): void;
1300
1301
  getHostProp<T>(host: _HostElement, name: string): T | null;
@@ -1333,6 +1334,12 @@ declare interface EachProps<T, ITEM extends JSXOutput = JSXOutput> {
1333
1334
  /** @internal */
1334
1335
  export declare const _eaT: ({ track }: TaskCtx) => Promise<void>;
1335
1336
 
1337
+ /** @internal */
1338
+ export declare const _ebC: (props: ErrorBoundaryProps) => JSXOutput;
1339
+
1340
+ /** @internal */
1341
+ export declare const _ebR: () => void;
1342
+
1336
1343
  /** @internal */
1337
1344
  export declare const _EFFECT_BACK_REF: unique symbol;
1338
1345
 
@@ -1404,9 +1411,55 @@ export declare const _EMPTY_ARRAY: any[];
1404
1411
  /** @internal */
1405
1412
  export declare const _EMPTY_OBJ: Record<string, any>;
1406
1413
 
1407
- /** @public */
1408
- export declare interface ErrorBoundaryStore {
1409
- error: any | undefined;
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>;
1410
1463
  }
1411
1464
 
1412
1465
  /** @public */
@@ -1546,6 +1599,9 @@ declare function h<TYPE extends string | FunctionComponent<PROPS>, PROPS extends
1546
1599
  export { h as createElement }
1547
1600
  export { h }
1548
1601
 
1602
+ /** @internal */
1603
+ export declare function _handleSSRError(container: SSRContainer, err: any, host: ISsrNode | null, phase: ErrorBoundaryPhase): void;
1604
+
1549
1605
  /**
1550
1606
  * @returns True if the store has effects for the given prop
1551
1607
  * @internal
@@ -1760,6 +1816,9 @@ declare interface InvokeContext {
1760
1816
  $container$: _Container | undefined;
1761
1817
  }
1762
1818
 
1819
+ declare class InvokeJSXFunction {
1820
+ }
1821
+
1763
1822
  declare type IsAcceptableDOMValue<T> = T extends boolean | number | string | null | undefined ? ((...args: any[]) => any) extends T ? false : true : false;
1764
1823
 
1765
1824
  declare type IsAny<T> = 0 extends T & 1 ? true : false;
@@ -2455,7 +2514,9 @@ export declare interface _QDocument extends Document {
2455
2514
  /** Processes one vnode patch script. */
2456
2515
  qProcessVNodeDataPatch?: (script: Element | null) => void;
2457
2516
  /** Processes an out-of-order Suspense segment after its resolved HTML is swapped in. */
2458
- qProcessOOOS?: (boundaryId: number, content: Element | null) => void;
2517
+ qProcessOOOS?: (boundaryId: number, revealNode: Element | null) => void;
2518
+ /** Routes `qerror` to the owning container; installed once per document, shared by all bundles. */
2519
+ qErrorHandler?: (e: Event) => void;
2459
2520
  }
2460
2521
 
2461
2522
  /**
@@ -2890,10 +2951,10 @@ export declare interface ReadonlySignal<T = unknown> {
2890
2951
  }
2891
2952
 
2892
2953
  /** @internal */
2893
- export declare const _reC: (props: RevealProps) => JSXNodeInternal<InternalServerComponent<SSRRevealSlotProps>> | JSXNodeInternal<FunctionComponent< {
2954
+ export declare const _reC: (props: RevealProps) => JSXNodeInternal<FunctionComponent< {
2894
2955
  name?: string;
2895
2956
  children?: JSXChildren;
2896
- }>>;
2957
+ }>> | JSXNodeInternal<InternalServerComponent<SSRRevealSlotProps>>;
2897
2958
 
2898
2959
  /**
2899
2960
  * A ref can be either a signal or a function. Note that the type of Signal is Element so that it
@@ -3386,7 +3447,7 @@ export declare abstract class _SharedContainer implements _Container {
3386
3447
  } | null, symbolToChunkResolver: SymbolToChunkResolver, writer?: StreamWriter): SerializationContext;
3387
3448
  $checkPendingCount$(): void;
3388
3449
  abstract ensureProjectionResolved(host: _HostElement): void;
3389
- abstract handleError(err: any, $host$: _HostElement | null): void;
3450
+ abstract handleError(err: any, $host$: _HostElement | null, phase?: ErrorBoundaryPhase): void;
3390
3451
  abstract getParentHost(host: _HostElement): _HostElement | null;
3391
3452
  abstract setContext<T>(host: _HostElement, context: ContextId<T>, value: T): void;
3392
3453
  abstract resolveContext<T>(host: _HostElement, contextId: ContextId<T>): T | undefined;
@@ -3741,9 +3802,14 @@ declare interface SSRContainer extends _Container {
3741
3802
  readonly symbolToChunkResolver: SymbolToChunkResolver;
3742
3803
  readonly resolvedManifest: ResolvedManifest;
3743
3804
  readonly outOfOrderStreaming: boolean;
3805
+ readonly $transformError$: ((error: unknown) => unknown) | undefined;
3744
3806
  additionalHeadNodes: Array<JSXNodeInternal>;
3745
3807
  additionalBodyNodes: Array<JSXNodeInternal>;
3746
3808
  $noScriptHere$: number;
3809
+ /** Innermost open ErrorBoundary content host, so the walker can skip an errored subtree. */
3810
+ $errorContentHost$: ISsrNode | null;
3811
+ /** Set when an ErrorBoundary caught during this container's render. */
3812
+ $hasBoundaryError$?: boolean;
3747
3813
  /**
3748
3814
  * Lets the container place a root-level `useOn` placeholder `<script>` itself when injecting it
3749
3815
  * inline would put it at an illegal position. Returns `true` if the container took the node, in
@@ -3773,11 +3839,15 @@ declare interface SSRContainer extends _Container {
3773
3839
  render(jsx: JSXOutput): Promise<void>;
3774
3840
  renderJSX(jsx: JSXOutput, options: SSRRenderJSXOptions): Promise<void>;
3775
3841
  $runQueuedRender$<T>(render: () => ValueOrPromise<T>): ValueOrPromise<T>;
3776
- nextOutOfOrderId(): number;
3842
+ nextOutOfOrderId(markUsed?: boolean): number;
3777
3843
  emitOutOfOrderSegmentScripts(scripts: string): void;
3778
3844
  segment(segmentId: string, jsx: JSXOutput, options: SSRRenderJSXOptions): Promise<SSROutOfOrderSegment>;
3779
3845
  queueOutOfOrderSegment(segment: Promise<void>): void;
3780
3846
  emitOutOfOrderExecutorIfNeeded(): void;
3847
+ emitErrorSwapExecutorIfNeeded(): void;
3848
+ $registerErrorSwap$(boundaryId: number): void;
3849
+ /** Keeps the node re-renderable after resume. */
3850
+ $retainForResume$(node: ISsrNode | null | undefined): void;
3781
3851
  emitInlineScript(script: string): void;
3782
3852
  writeScript(attrs: Props, body?: string): void;
3783
3853
  emitPreloaderPre(): void;
@@ -3834,6 +3904,7 @@ declare interface SSRRootRefPathChunk {
3834
3904
 
3835
3905
  declare interface SSRSegmentContainer extends SSRContainer {
3836
3906
  $rootContainer$: SSRContainer;
3907
+ $errorSwapIds$: number[] | null;
3837
3908
  $recordExternalRootEffect$(producer: unknown, effect: EffectSubscription, prop: string | symbol | null, sourceEffects?: Map<string | symbol, Set<EffectSubscription>>): void;
3838
3909
  $finalizeOutOfOrderSegment$(segmentId: string, segment: SSROutOfOrderSegment): Promise<{
3839
3910
  html: string;
@@ -3880,7 +3951,7 @@ declare type SSRWriteChunk = string | number | SSRRootRefPathChunk | SSRRootRefD
3880
3951
 
3881
3952
  declare type StackFn = () => ValueOrPromise<void>;
3882
3953
 
3883
- declare type StackValue = ValueOrPromise<JSXOutput | StackFn | Promise<JSXOutput> | typeof Promise | AsyncGenerator | typeof MaybeAsyncSignal>;
3954
+ declare type StackValue = ValueOrPromise<JSXOutput | StackFn | Promise<JSXOutput> | typeof Promise | AsyncGenerator | typeof MaybeAsyncSignal | typeof InvokeJSXFunction>;
3884
3955
 
3885
3956
  declare type StopPropagation = {
3886
3957
  [K in keyof HTMLElementEventMap as `stoppropagation:${K}`]?: boolean;
@@ -4565,9 +4636,6 @@ export declare const useContext: UseContext;
4565
4636
  */
4566
4637
  export declare const useContextProvider: <STATE>(context: ContextId<STATE>, newValue: STATE) => void;
4567
4638
 
4568
- /** @public */
4569
- export declare const useErrorBoundary: () => ErrorBoundaryStore;
4570
-
4571
4639
  /**
4572
4640
  * Injected by the optimizer into component$ bodies in HMR mode. Registers a document event listener
4573
4641
  * that triggers component re-render on HMR updates.
@@ -5073,7 +5141,7 @@ export declare const _VAR_PROPS: unique symbol;
5073
5141
  export declare const _verifySerializable: <T>(value: T, preMessage?: string) => T;
5074
5142
 
5075
5143
  /**
5076
- * 2.0.0-beta.41-dev+4d04076
5144
+ * 2.0.0-beta.42-dev+3473a49
5077
5145
  *
5078
5146
  * @public
5079
5147
  */
@@ -5191,7 +5259,8 @@ declare const enum VNodeDataFlag {
5191
5259
  VIRTUAL_NODE = 2,
5192
5260
  ELEMENT_NODE = 4,
5193
5261
  REFERENCE = 8,
5194
- SERIALIZE = 16
5262
+ SERIALIZE = 16,
5263
+ INERT = 32
5195
5264
  }
5196
5265
 
5197
5266
  /**