@qwik.dev/core 2.0.0-beta.11 → 2.0.0-beta.13
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.
- package/bindings/qwik.darwin-arm64.node +0 -0
- package/bindings/qwik.darwin-x64.node +0 -0
- package/bindings/qwik.linux-x64-gnu.node +0 -0
- package/bindings/qwik.win32-x64-msvc.node +0 -0
- package/bindings/qwik_wasm_bg.wasm +0 -0
- package/dist/backpatch/index.cjs +2 -2
- package/dist/backpatch/index.mjs +2 -2
- package/dist/backpatch/package.json +1 -1
- package/dist/backpatch-executor.debug.js +7 -2
- package/dist/backpatch-executor.js +1 -1
- package/dist/build/package.json +1 -1
- package/dist/cli.cjs +6484 -1341
- package/dist/core-internal.d.ts +147 -77
- package/dist/core.cjs +9358 -8994
- package/dist/core.cjs.map +1 -1
- package/dist/core.min.mjs +1 -1
- package/dist/core.mjs +9356 -8994
- package/dist/core.mjs.map +1 -1
- package/dist/core.prod.cjs +4738 -4472
- package/dist/core.prod.mjs +5143 -4862
- package/dist/loader/index.cjs +2 -2
- package/dist/loader/index.mjs +2 -2
- package/dist/loader/package.json +1 -1
- package/dist/optimizer.cjs +34 -29
- package/dist/optimizer.d.ts +3 -0
- package/dist/optimizer.mjs +945 -935
- package/dist/qwikloader.debug.js +9 -8
- package/dist/qwikloader.js +1 -1
- package/dist/server.cjs +471 -386
- package/dist/server.d.ts +20 -12
- package/dist/server.mjs +466 -381
- package/dist/starters/adapters/aws-lambda/adapters/aws-lambda/{vite.config.mts → vite.config.ts} +1 -1
- package/dist/starters/adapters/aws-lambda/package.json +1 -1
- package/dist/starters/adapters/azure-swa/adapters/azure-swa/{vite.config.mts → vite.config.ts} +1 -1
- package/dist/starters/adapters/azure-swa/package.json +1 -1
- package/dist/starters/adapters/bun/adapters/bun/{vite.config.mts → vite.config.ts} +1 -1
- package/dist/starters/adapters/bun/package.json +1 -1
- package/dist/starters/adapters/cloud-run/adapters/cloud-run/{vite.config.mts → vite.config.ts} +1 -1
- package/dist/starters/adapters/cloud-run/package.json +1 -1
- package/dist/starters/adapters/cloudflare-pages/adapters/cloudflare-pages/{vite.config.mts → vite.config.ts} +1 -1
- package/dist/starters/adapters/cloudflare-pages/package.json +1 -1
- package/dist/starters/adapters/deno/adapters/deno/{vite.config.mts → vite.config.ts} +1 -1
- package/dist/starters/adapters/deno/package.json +1 -1
- package/dist/starters/adapters/express/adapters/express/{vite.config.mts → vite.config.ts} +1 -1
- package/dist/starters/adapters/express/package.json +1 -1
- package/dist/starters/adapters/fastify/adapters/fastify/{vite.config.mts → vite.config.ts} +1 -1
- package/dist/starters/adapters/fastify/package.json +1 -1
- package/dist/starters/adapters/firebase/adapters/firebase/{vite.config.mts → vite.config.ts} +1 -1
- package/dist/starters/adapters/firebase/package.json +1 -1
- package/dist/starters/adapters/netlify-edge/adapters/netlify-edge/{vite.config.mts → vite.config.ts} +1 -1
- package/dist/starters/adapters/netlify-edge/package.json +1 -1
- package/dist/starters/adapters/node-server/adapters/node-server/{vite.config.mts → vite.config.ts} +1 -1
- package/dist/starters/adapters/node-server/package.json +1 -1
- package/dist/starters/adapters/ssg/adapters/ssg/{vite.config.mts → vite.config.ts} +1 -1
- package/dist/starters/adapters/ssg/package.json +2 -2
- package/dist/starters/adapters/vercel-edge/README.md +2 -2
- package/dist/starters/adapters/vercel-edge/adapters/vercel-edge/{vite.config.mts → vite.config.ts} +1 -1
- package/dist/starters/adapters/vercel-edge/package.json +1 -1
- package/dist/starters/features/csr/package.json +1 -1
- package/dist/testing/index.cjs +2730 -2201
- package/dist/testing/index.d.ts +74 -25
- package/dist/testing/index.mjs +2664 -2139
- package/dist/testing/package.json +1 -1
- package/handlers.mjs +1 -1
- package/package.json +5 -5
- package/public.d.ts +1 -0
- /package/dist/starters/features/csr/{vite.config.mts → vite.config.ts} +0 -0
package/dist/testing/index.d.ts
CHANGED
|
@@ -11,6 +11,13 @@ import type { _Stringifiable } from '../internal';
|
|
|
11
11
|
import type { _VirtualVNode } from '../internal';
|
|
12
12
|
import type { _VNode } from '../internal';
|
|
13
13
|
|
|
14
|
+
declare interface AddRootFn {
|
|
15
|
+
(obj: unknown, returnRef?: never): number;
|
|
16
|
+
(obj: unknown, returnRef: true): SeenRef;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
declare type AllSignalFlags = SignalFlags | WrappedSignalFlags | SerializationSignalFlags;
|
|
20
|
+
|
|
14
21
|
declare type AsyncComputedCtx = {
|
|
15
22
|
track: Tracker;
|
|
16
23
|
cleanup: (callback: () => void) => void;
|
|
@@ -43,7 +50,7 @@ declare interface Chore<T extends ChoreType = ChoreType> {
|
|
|
43
50
|
$target$: ChoreTarget | null;
|
|
44
51
|
$payload$: unknown;
|
|
45
52
|
$state$: ChoreState;
|
|
46
|
-
$blockedChores$:
|
|
53
|
+
$blockedChores$: ChoreArray | null;
|
|
47
54
|
$startTime$: number | undefined;
|
|
48
55
|
$endTime$: number | undefined;
|
|
49
56
|
$resolve$: ((value: any) => void) | undefined;
|
|
@@ -343,9 +350,9 @@ declare interface ElementFixtureOptions {
|
|
|
343
350
|
declare class ElementVNode extends VNode {
|
|
344
351
|
firstChild: VNode | null | undefined;
|
|
345
352
|
lastChild: VNode | null | undefined;
|
|
346
|
-
element:
|
|
353
|
+
element: QElement;
|
|
347
354
|
elementName: string | undefined;
|
|
348
|
-
constructor(flags: VNodeFlags, parent: ElementVNode | VirtualVNode | null, previousSibling: VNode | null | undefined, nextSibling: VNode | null | undefined, firstChild: VNode | null | undefined, lastChild: VNode | null | undefined, element:
|
|
355
|
+
constructor(flags: VNodeFlags, parent: ElementVNode | VirtualVNode | null, previousSibling: VNode | null | undefined, nextSibling: VNode | null | undefined, firstChild: VNode | null | undefined, lastChild: VNode | null | undefined, element: QElement, elementName: string | undefined);
|
|
349
356
|
}
|
|
350
357
|
|
|
351
358
|
/** @public */
|
|
@@ -373,8 +380,6 @@ declare type HostElement = VNode | ISsrNode;
|
|
|
373
380
|
/** The shared state during an invoke() call */
|
|
374
381
|
declare interface InvokeContext {
|
|
375
382
|
$url$: URL | undefined;
|
|
376
|
-
/** The next available index for the sequentialScope array */
|
|
377
|
-
$i$: number;
|
|
378
383
|
/** The Virtual parent component for the current component code */
|
|
379
384
|
$hostElement$: HostElement | undefined;
|
|
380
385
|
/** The current DOM element */
|
|
@@ -469,6 +474,11 @@ declare type PossibleEvents = Event | SimplifiedServerRequestEvent | typeof Task
|
|
|
469
474
|
|
|
470
475
|
declare type Props = Record<string, unknown>;
|
|
471
476
|
|
|
477
|
+
declare interface QElement extends Element {
|
|
478
|
+
qDispatchEvent?: (event: Event, scope: QwikLoaderEventScope) => boolean;
|
|
479
|
+
vNode?: VNode;
|
|
480
|
+
}
|
|
481
|
+
|
|
472
482
|
/**
|
|
473
483
|
* The `QRL` type represents a lazy-loadable AND serializable resource.
|
|
474
484
|
*
|
|
@@ -633,6 +643,8 @@ declare type QRLInternalMethods<TYPE> = {
|
|
|
633
643
|
|
|
634
644
|
declare type QrlReturn<T> = T extends (...args: any) => infer R ? Awaited<R> : unknown;
|
|
635
645
|
|
|
646
|
+
declare type QwikLoaderEventScope = '-document' | '-window' | '';
|
|
647
|
+
|
|
636
648
|
/** @public */
|
|
637
649
|
declare interface ReadonlySignal<T = unknown> {
|
|
638
650
|
readonly value: T;
|
|
@@ -655,10 +667,10 @@ declare interface ResourceReturnInternal<T> {
|
|
|
655
667
|
|
|
656
668
|
declare type Scheduler = ReturnType<typeof createScheduler>;
|
|
657
669
|
|
|
670
|
+
/** Stores the location of an object. If no parent, it's a root. */
|
|
658
671
|
declare type SeenRef = {
|
|
659
|
-
$parent$: unknown | null;
|
|
660
672
|
$index$: number;
|
|
661
|
-
$
|
|
673
|
+
$parent$?: SeenRef | null;
|
|
662
674
|
};
|
|
663
675
|
|
|
664
676
|
declare interface SerializationContext {
|
|
@@ -674,28 +686,21 @@ declare interface SerializationContext {
|
|
|
674
686
|
* - `{ parent, index }` - The parent object and the index within that parent.
|
|
675
687
|
* - `undefined` - Object has not been seen yet.
|
|
676
688
|
*/
|
|
677
|
-
|
|
689
|
+
getSeenRef: (obj: unknown) => SeenRef | undefined;
|
|
690
|
+
/** Returns the root index of the object, if it is a root. Otherwise returns undefined. */
|
|
678
691
|
$hasRootId$: (obj: unknown) => number | undefined;
|
|
679
692
|
/**
|
|
680
693
|
* Root objects which need to be serialized.
|
|
681
694
|
*
|
|
682
695
|
* Roots are entry points into the object graph. Typically the roots are held by the listeners.
|
|
683
696
|
*
|
|
684
|
-
* Returns
|
|
685
|
-
* Format: "3 2 0" where each number is the index within its parent, from root to leaf.
|
|
697
|
+
* Returns the index of the root object.
|
|
686
698
|
*/
|
|
687
|
-
$addRoot$:
|
|
688
|
-
/**
|
|
689
|
-
|
|
690
|
-
*
|
|
691
|
-
* This is used during serialization, as new roots can't be created during serialization.
|
|
692
|
-
*
|
|
693
|
-
* The function throws if the root was not found.
|
|
694
|
-
*/
|
|
695
|
-
$addRootPath$: (obj: any) => string | number;
|
|
696
|
-
$seen$: (obj: unknown, parent: unknown | null, index: number) => void;
|
|
699
|
+
$addRoot$: AddRootFn;
|
|
700
|
+
/** Mark an object as seen during serialization. This is used to handle backreferences and cycles */
|
|
701
|
+
$markSeen$: (obj: unknown, parent: SeenRef | undefined, index: number) => SeenRef;
|
|
697
702
|
$roots$: unknown[];
|
|
698
|
-
$
|
|
703
|
+
$promoteToRoot$: (ref: SeenRef, index?: number) => void;
|
|
699
704
|
$addSyncFn$($funcStr$: string | null, argsCount: number, fn: Function): number;
|
|
700
705
|
$isSsrNode$: (obj: unknown) => obj is SsrNode;
|
|
701
706
|
$isDomRef$: (obj: unknown) => obj is DomRef;
|
|
@@ -710,6 +715,11 @@ declare interface SerializationContext {
|
|
|
710
715
|
$setProp$: (obj: any, prop: string, value: any) => void;
|
|
711
716
|
}
|
|
712
717
|
|
|
718
|
+
declare const enum SerializationSignalFlags {
|
|
719
|
+
SERIALIZATION_STRATEGY_NEVER = 16,
|
|
720
|
+
SERIALIZATION_STRATEGY_ALWAYS = 32
|
|
721
|
+
}
|
|
722
|
+
|
|
713
723
|
/**
|
|
714
724
|
* A signal is a reactive value which can be read and written. When the signal is written, all tasks
|
|
715
725
|
* which are tracking the signal will be re-run and all components that read the signal will be
|
|
@@ -726,11 +736,17 @@ declare interface Signal<T = any> extends ReadonlySignal<T> {
|
|
|
726
736
|
value: T;
|
|
727
737
|
}
|
|
728
738
|
|
|
739
|
+
declare const enum SignalFlags {
|
|
740
|
+
INVALID = 1,
|
|
741
|
+
RUN_EFFECTS = 2
|
|
742
|
+
}
|
|
743
|
+
|
|
729
744
|
declare class SignalImpl<T = any> implements Signal<T> {
|
|
730
745
|
$untrackedValue$: T;
|
|
731
746
|
/** Store a list of effects which are dependent on this signal. */
|
|
732
747
|
$effects$: null | Set<EffectSubscription>;
|
|
733
748
|
$container$: Container | null;
|
|
749
|
+
$wrappedSignal$: WrappedSignalImpl<T> | null;
|
|
734
750
|
constructor(container: Container | null, value: T);
|
|
735
751
|
/**
|
|
736
752
|
* Use this to force running subscribers, for example when the calculated value has mutated but
|
|
@@ -758,7 +774,7 @@ declare type SsrAttrKey = string;
|
|
|
758
774
|
|
|
759
775
|
declare type SsrAttrs = Array<SsrAttrKey | SsrAttrValue>;
|
|
760
776
|
|
|
761
|
-
declare type SsrAttrValue = string | Signal<any> | boolean | object | null;
|
|
777
|
+
declare type SsrAttrValue = string | Signal<any> | Promise<any> | boolean | object | null;
|
|
762
778
|
|
|
763
779
|
/** A selection of attributes of the real thing */
|
|
764
780
|
declare type SsrNode = {
|
|
@@ -774,8 +790,14 @@ declare const enum SsrNodeFlags {
|
|
|
774
790
|
|
|
775
791
|
/** @public */
|
|
776
792
|
export declare function ssrRenderToDom(jsx: JSXOutput, opts?: {
|
|
793
|
+
/** Print debug information to console. */
|
|
777
794
|
debug?: boolean;
|
|
795
|
+
/** Treat JSX as raw, (don't wrap in in head/body) */
|
|
778
796
|
raw?: boolean;
|
|
797
|
+
/** Include QwikLoader */
|
|
798
|
+
qwikLoader?: boolean;
|
|
799
|
+
/** Inject nodes into the document before test runs (for testing purposes) */
|
|
800
|
+
onBeforeResume?: (document: Document) => void;
|
|
779
801
|
}): Promise<{
|
|
780
802
|
container: _DomContainer;
|
|
781
803
|
document: Document;
|
|
@@ -921,7 +943,8 @@ declare interface Tracker {
|
|
|
921
943
|
}
|
|
922
944
|
|
|
923
945
|
/**
|
|
924
|
-
* Trigger an event in unit tests on an element.
|
|
946
|
+
* Trigger an event in unit tests on an element. Needs to be kept in sync with the Qwik Loader event
|
|
947
|
+
* dispatching.
|
|
925
948
|
*
|
|
926
949
|
* Future deprecation candidate.
|
|
927
950
|
*
|
|
@@ -1065,8 +1088,9 @@ declare const enum VNodeJournalOpCode {
|
|
|
1065
1088
|
SetText = 1,// ------ [SetAttribute, target, text]
|
|
1066
1089
|
SetAttribute = 2,// - [SetAttribute, target, ...(key, values)]]
|
|
1067
1090
|
HoistStyles = 3,// -- [HoistStyles, document]
|
|
1068
|
-
Remove = 4,// ------- [
|
|
1069
|
-
|
|
1091
|
+
Remove = 4,// ------- [Remove, target(parent), ...nodes]
|
|
1092
|
+
RemoveAll = 5,// ------- [RemoveAll, target(parent)]
|
|
1093
|
+
Insert = 6
|
|
1070
1094
|
}
|
|
1071
1095
|
|
|
1072
1096
|
/**
|
|
@@ -1086,4 +1110,29 @@ export declare function walkJSX(jsx: JSXOutput, apply: {
|
|
|
1086
1110
|
text: (text: _Stringifiable) => void;
|
|
1087
1111
|
}): void;
|
|
1088
1112
|
|
|
1113
|
+
declare const enum WrappedSignalFlags {
|
|
1114
|
+
UNWRAP = 4
|
|
1115
|
+
}
|
|
1116
|
+
|
|
1117
|
+
declare class WrappedSignalImpl<T> extends SignalImpl<T> implements BackRef {
|
|
1118
|
+
$args$: any[];
|
|
1119
|
+
$func$: (...args: any[]) => T;
|
|
1120
|
+
$funcStr$: string | null;
|
|
1121
|
+
$flags$: AllSignalFlags;
|
|
1122
|
+
$hostElement$: HostElement | null;
|
|
1123
|
+
[_EFFECT_BACK_REF]: Map<EffectProperty | string, EffectSubscription> | null;
|
|
1124
|
+
constructor(container: Container | null, fn: (...args: any[]) => T, args: any[], fnStr: string | null, flags?: SignalFlags);
|
|
1125
|
+
invalidate(): void;
|
|
1126
|
+
/**
|
|
1127
|
+
* Use this to force running subscribers, for example when the calculated value has mutated but
|
|
1128
|
+
* remained the same object.
|
|
1129
|
+
*/
|
|
1130
|
+
force(): void;
|
|
1131
|
+
get untrackedValue(): T;
|
|
1132
|
+
$computeIfNeeded$(): void;
|
|
1133
|
+
$unwrapIfSignal$(): SignalImpl<T> | WrappedSignalImpl<T>;
|
|
1134
|
+
set value(_: any);
|
|
1135
|
+
get value(): any;
|
|
1136
|
+
}
|
|
1137
|
+
|
|
1089
1138
|
export { }
|