@qwik.dev/core 2.0.0-beta.35 → 2.0.0-beta.36

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.
@@ -7,6 +7,7 @@ import type { JSXNodeInternal } from '../internal';
7
7
  import { JSXOutput } from '..';
8
8
  import type { _QDocument } from '../internal';
9
9
  import { RenderResult } from '..';
10
+ import { StreamWriter } from '..';
10
11
  import type { _Stringifiable } from '../internal';
11
12
  import type { _VirtualVNode } from '../internal';
12
13
  import type { _VNode } from '../internal';
@@ -45,13 +46,14 @@ declare const enum ChoreBits {
45
46
  TASKS = 1,
46
47
  NODE_DIFF = 2,
47
48
  COMPONENT = 4,
48
- NODE_PROPS = 8,
49
- COMPUTE = 16,
50
- CHILDREN = 32,
51
- CLEANUP = 64,
52
- RECONCILE = 128,
53
- ERROR_WRAP = 256,
54
- DIRTY_MASK = 511
49
+ INLINE_COMPONENT = 8,
50
+ NODE_PROPS = 16,
51
+ COMPUTE = 32,
52
+ CHILDREN = 64,
53
+ CLEANUP = 128,
54
+ RECONCILE = 256,
55
+ ERROR_WRAP = 512,
56
+ DIRTY_MASK = 1023
55
57
  }
56
58
 
57
59
  /** @internal */
@@ -72,6 +74,8 @@ declare type Consumer = Task | VNode | SignalImpl | ISsrNode;
72
74
  declare interface Container {
73
75
  readonly $version$: string;
74
76
  readonly $storeProxyMap$: ObjToProxyMap;
77
+ $rootContainer$: Container | null;
78
+ $isOutOfOrderSegment$: boolean;
75
79
  readonly $locale$: string;
76
80
  readonly $getObjectById$: (id: number | string) => any;
77
81
  readonly $serverData$: Record<string, any>;
@@ -106,7 +110,7 @@ declare interface Container {
106
110
  new (...rest: any[]): {
107
111
  __brand__: 'DomRef';
108
112
  };
109
- } | null, symbolToChunkResolver: SymbolToChunkResolver, writer?: StreamWriter): SerializationContext;
113
+ } | null, symbolToChunkResolver: SymbolToChunkResolver, writer?: StreamWriter_2): SerializationContext;
110
114
  }
111
115
 
112
116
  /**
@@ -204,7 +208,7 @@ declare interface DevJSX {
204
208
  }
205
209
 
206
210
  declare type DomRef = {
207
- $ssrNode$: SsrNode;
211
+ $ssrNode$: ISsrNode;
208
212
  };
209
213
 
210
214
  /** @public */
@@ -322,6 +326,26 @@ export declare function getTestPlatform(): TestPlatform;
322
326
 
323
327
  declare type HostElement = VNode | ISsrNode;
324
328
 
329
+ /** @public */
330
+ export declare interface InOrderAuto {
331
+ strategy: 'auto';
332
+ maximumInitialChunk?: number;
333
+ maximumChunk?: number;
334
+ }
335
+
336
+ /** @public */
337
+ export declare interface InOrderDirect {
338
+ strategy: 'direct';
339
+ }
340
+
341
+ /** @public */
342
+ export declare interface InOrderDisabled {
343
+ strategy: 'disabled';
344
+ }
345
+
346
+ /** @public */
347
+ export declare type InOrderStreaming = InOrderAuto | InOrderDisabled | InOrderDirect;
348
+
325
349
  /** The shared state during an invoke() call */
326
350
  declare interface InvokeContext {
327
351
  /** The Virtual parent component for the current component code */
@@ -338,8 +362,10 @@ declare interface ISsrNode {
338
362
  flags: SsrNodeFlags;
339
363
  dirty: ChoreBits;
340
364
  parentComponent: ISsrNode | null;
365
+ children: ISsrNode[] | null;
341
366
  vnodeData: VNodeData;
342
367
  currentFile: string | null;
368
+ readonly [_EFFECT_BACK_REF]: Map<EffectProperty | string, EffectSubscription> | null;
343
369
  setProp(name: string, value: any): void;
344
370
  getProp(name: string): any;
345
371
  removeProp(name: string): void;
@@ -480,6 +506,9 @@ declare interface NodePropData {
480
506
 
481
507
  declare type ObjToProxyMap = WeakMap<any, any>;
482
508
 
509
+ /** @public */
510
+ export declare type OutOfOrderStreaming = boolean;
511
+
483
512
  /** @internal */
484
513
  declare const _OWNER: unique symbol;
485
514
 
@@ -706,6 +735,7 @@ declare type SeenRef = {
706
735
 
707
736
  declare interface SerializationContext {
708
737
  $serialize$: () => ValueOrPromise<void>;
738
+ $serializePatch$: (rootStart: number, rootIds: number[], extraRootId?: number | string | number[], streamedRootLimit?: number) => ValueOrPromise<void>;
709
739
  $symbolToChunkResolver$: SymbolToChunkResolver;
710
740
  /**
711
741
  * Map from object to parent and index reference.
@@ -728,14 +758,26 @@ declare interface SerializationContext {
728
758
  * Returns the index of the root object.
729
759
  */
730
760
  $addRoot$: AddRootFn;
761
+ $addDuplicateRoot$: (obj: unknown) => SeenRef;
762
+ $commitRoot$: (root: unknown, obj: unknown) => number;
731
763
  /** Mark an object as seen during serialization. This is used to handle backreferences and cycles */
732
764
  $markSeen$: (obj: unknown, parent: SeenRef | undefined, index: number) => SeenRef;
733
765
  $roots$: unknown[];
734
- $promoteToRoot$: (ref: SeenRef, index?: number) => void;
766
+ $rootObjs$: unknown[];
767
+ $onAddRoot$?: (id: number, root: unknown, obj: unknown) => void;
768
+ $forwardRefOffset$: number;
769
+ $serializedRootCount$: number;
770
+ $serializedForwardRefCount$: number;
771
+ $rootStateRootCount$: number;
772
+ $hasRootStateForwardRefs$: boolean;
773
+ $promoteToRoot$: (ref: SeenRef, obj: unknown, index?: number) => void;
735
774
  $addSyncFn$($funcStr$: string | null, argsCount: number, fn: Function): number;
736
- $isSsrNode$: (obj: unknown) => obj is SsrNode;
775
+ $setSyncFnOffset$(offset: number, existingFns?: string[]): void;
776
+ $isSsrNode$: (obj: unknown) => obj is ISsrNode;
737
777
  $isDomRef$: (obj: unknown) => obj is DomRef;
738
- $writer$: StreamWriter;
778
+ $markSsrNodeForSerialization$: (node: ISsrNode, flags: number) => void;
779
+ $writer$: SSRInternalStreamWriter;
780
+ $setWriter$(writer: SSRInternalStreamWriter): void;
739
781
  $syncFns$: string[];
740
782
  $eventQrls$: Set<QRL>;
741
783
  $eventNames$: Set<string>;
@@ -811,13 +853,12 @@ declare interface SimplifiedServerRequestEvent<T = unknown> {
811
853
  request: Request;
812
854
  }
813
855
 
814
- /** A selection of attributes of the real thing */
815
- declare type SsrNode = {
816
- id: string;
817
- children: ISsrNode[] | null;
818
- vnodeData: VNodeData;
819
- [_EFFECT_BACK_REF]: Map<EffectProperty | string, EffectSubscription> | null;
820
- };
856
+ /** @internal */
857
+ declare interface SSRInternalStreamWriter extends StreamWriter_2 {
858
+ writeRootRef(id: number): ValueOrPromise<void>;
859
+ writeRootRefPath(path: number[]): ValueOrPromise<void>;
860
+ toString(remap?: number[]): string;
861
+ }
821
862
 
822
863
  declare const enum SsrNodeFlags {
823
864
  Updatable = 1
@@ -831,6 +872,14 @@ export declare function ssrRenderToDom(jsx: JSXOutput, opts?: {
831
872
  raw?: boolean;
832
873
  /** Include QwikLoader */
833
874
  qwikLoader?: boolean;
875
+ /** Override the SSR container tag name. */
876
+ containerTagName?: string;
877
+ /** Stream rendered chunks while still collecting the final HTML. */
878
+ stream?: StreamWriter;
879
+ /** Configure SSR streaming. */
880
+ streaming?: StreamingOptions;
881
+ /** Skip client resume emulation after SSR. */
882
+ resume?: boolean;
834
883
  /** Inject nodes into the document before test runs (for testing purposes) */
835
884
  onBeforeResume?: (document: Document) => void;
836
885
  }): Promise<{
@@ -842,8 +891,14 @@ export declare function ssrRenderToDom(jsx: JSXOutput, opts?: {
842
891
 
843
892
  declare type StoreTarget = Record<string | symbol, any>;
844
893
 
894
+ /** @public */
895
+ export declare interface StreamingOptions {
896
+ inOrder?: InOrderStreaming;
897
+ outOfOrder?: OutOfOrderStreaming;
898
+ }
899
+
845
900
  /** @internal */
846
- declare interface StreamWriter {
901
+ declare interface StreamWriter_2 {
847
902
  write(chunk: string): ValueOrPromise<void>;
848
903
  waitForDrain?(): ValueOrPromise<void>;
849
904
  }