@qwik.dev/core 2.0.0-beta.23 → 2.0.0-beta.25
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.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/package.json +1 -1
- package/dist/build/package.json +1 -1
- package/dist/cli.mjs +142 -179
- package/dist/core-internal.d.ts +81 -38
- package/dist/core.min.mjs +1 -1
- package/dist/core.mjs +1484 -1195
- package/dist/core.mjs.map +1 -1
- package/dist/core.prod.mjs +4466 -3264
- package/dist/loader/index.mjs +2 -2
- package/dist/loader/package.json +1 -1
- package/dist/optimizer.mjs +1076 -1077
- package/dist/qwikloader.debug.js +0 -2
- package/dist/qwikloader.js +1 -1
- package/dist/server.d.ts +11 -7
- package/dist/server.mjs +442 -395
- package/dist/testing/index.d.ts +149 -79
- package/dist/testing/index.mjs +1289 -1139
- package/dist/testing/package.json +1 -1
- package/package.json +2 -2
package/dist/core-internal.d.ts
CHANGED
|
@@ -398,7 +398,30 @@ declare class AsyncJob<T> implements AsyncCtx<T> {
|
|
|
398
398
|
|
|
399
399
|
declare type AsyncQRL<T> = _QRLInternal<AsyncFn<T>>;
|
|
400
400
|
|
|
401
|
-
/**
|
|
401
|
+
/**
|
|
402
|
+
* An AsyncSignal holds the result of the given async function. If the function uses `track()` to
|
|
403
|
+
* track reactive state, and that state changes, the AsyncSignal is recalculated, and if the result
|
|
404
|
+
* changed, all tasks which are tracking the AsyncSignal will be re-run and all subscribers
|
|
405
|
+
* (components, tasks etc) that read the AsyncSignal will be updated.
|
|
406
|
+
*
|
|
407
|
+
* If the async function throws an error, the AsyncSignal will capture the error and set the `error`
|
|
408
|
+
* property. The error can be cleared by re-running the async function successfully.
|
|
409
|
+
*
|
|
410
|
+
* While the async function is running, the `.loading` property will be set to `true`. Once the
|
|
411
|
+
* function completes, `loading` will be set to `false`.
|
|
412
|
+
*
|
|
413
|
+
* If the value has not yet been resolved, reading the AsyncSignal will throw a Promise, which will
|
|
414
|
+
* retry the component or task once the value resolves.
|
|
415
|
+
*
|
|
416
|
+
* If the value has been resolved, but the async function is re-running, reading the AsyncSignal
|
|
417
|
+
* will subscribe to it and return the last resolved value until the new value is ready. As soon as
|
|
418
|
+
* the new value is ready, the subscribers will be updated.
|
|
419
|
+
*
|
|
420
|
+
* If the async function threw an error, reading the `.value` will throw that same error. Read from
|
|
421
|
+
* `.error` to check if there was an error.
|
|
422
|
+
*
|
|
423
|
+
* @public
|
|
424
|
+
*/
|
|
402
425
|
export declare interface AsyncSignal<T = unknown> extends ComputedSignal<T> {
|
|
403
426
|
/**
|
|
404
427
|
* Whether the signal is currently loading. This will trigger lazy loading of the signal, so you
|
|
@@ -428,7 +451,7 @@ export declare interface AsyncSignal<T = unknown> extends ComputedSignal<T> {
|
|
|
428
451
|
|
|
429
452
|
declare const enum AsyncSignalFlags {
|
|
430
453
|
EAGER_CLEANUP = 32,
|
|
431
|
-
|
|
454
|
+
CLIENT_ONLY = 64
|
|
432
455
|
}
|
|
433
456
|
|
|
434
457
|
/**
|
|
@@ -447,11 +470,13 @@ declare class AsyncSignalImpl<T> extends ComputedSignalImpl<T, AsyncQRL<T>> impl
|
|
|
447
470
|
$jobs$: AsyncJob<T>[];
|
|
448
471
|
$concurrency$: number;
|
|
449
472
|
$interval$: number;
|
|
450
|
-
$pollTimeoutId$: ReturnType<typeof setTimeout> | undefined;
|
|
451
473
|
$timeoutMs$: number | undefined;
|
|
474
|
+
$pollTimeoutId$: ReturnType<typeof setTimeout> | undefined;
|
|
452
475
|
$computationTimeoutId$: ReturnType<typeof setTimeout> | undefined;
|
|
453
476
|
[_EFFECT_BACK_REF]: Map<EffectProperty | string, EffectSubscription> | undefined;
|
|
454
477
|
constructor(container: _Container | null, fn: AsyncQRL<T>, flags?: SignalFlags | SerializationSignalFlags, options?: AsyncSignalOptions<T>);
|
|
478
|
+
get untrackedValue(): T;
|
|
479
|
+
set untrackedValue(value: T);
|
|
455
480
|
/**
|
|
456
481
|
* Loading is true if the signal is still waiting for the promise to resolve, false if the promise
|
|
457
482
|
* has resolved or rejected.
|
|
@@ -481,7 +506,6 @@ declare class AsyncSignalImpl<T> extends ComputedSignalImpl<T, AsyncQRL<T>> impl
|
|
|
481
506
|
$runComputation$(running: AsyncJob<T>): Promise<void>;
|
|
482
507
|
/** Called after SSR/unmount */
|
|
483
508
|
$destroy$(): Promise<void>;
|
|
484
|
-
get untrackedValue(): T;
|
|
485
509
|
private $clearNextPoll$;
|
|
486
510
|
private $scheduleNextPoll$;
|
|
487
511
|
private $hasSubscribers$;
|
|
@@ -522,6 +546,13 @@ export declare interface AsyncSignalOptions<T> extends ComputedOptions {
|
|
|
522
546
|
* Defaults to `0`.
|
|
523
547
|
*/
|
|
524
548
|
interval?: number;
|
|
549
|
+
/**
|
|
550
|
+
* When true, the async computation is postponed to the browser. On SSR, the signal remains
|
|
551
|
+
* INVALID and does not execute the function. On the client, it will compute on first read.
|
|
552
|
+
*
|
|
553
|
+
* Defaults to `false`.
|
|
554
|
+
*/
|
|
555
|
+
clientOnly?: boolean;
|
|
525
556
|
/**
|
|
526
557
|
* Maximum time in milliseconds to wait for the async computation to complete. If exceeded, the
|
|
527
558
|
* computation is aborted and an error is thrown.
|
|
@@ -722,16 +753,10 @@ export declare type ComputedReturnType<T> = T extends Promise<any> ? never : Com
|
|
|
722
753
|
*
|
|
723
754
|
* @public
|
|
724
755
|
*/
|
|
725
|
-
export declare interface ComputedSignal<T> extends
|
|
726
|
-
/**
|
|
727
|
-
* Use this to force running subscribers, for example when the calculated value mutates but
|
|
728
|
-
* remains the same object.
|
|
729
|
-
*/
|
|
756
|
+
export declare interface ComputedSignal<T> extends Signal<T> {
|
|
757
|
+
/** @deprecated Use `trigger()` instead */
|
|
730
758
|
force(): void;
|
|
731
|
-
/**
|
|
732
|
-
* Use this to force recalculation and running subscribers, for example when the calculated value
|
|
733
|
-
* mutates but remains the same object.
|
|
734
|
-
*/
|
|
759
|
+
/** Use this to force recalculation. */
|
|
735
760
|
invalidate(): void;
|
|
736
761
|
}
|
|
737
762
|
|
|
@@ -753,6 +778,7 @@ declare class ComputedSignalImpl<T, S extends _QRLInternal = ComputeQRL<T>> exte
|
|
|
753
778
|
constructor(container: _Container | null, fn: S, flags?: SignalFlags | SerializationSignalFlags);
|
|
754
779
|
invalidate(): void;
|
|
755
780
|
get untrackedValue(): T;
|
|
781
|
+
set untrackedValue(value: T);
|
|
756
782
|
$computeIfNeeded$(): void;
|
|
757
783
|
}
|
|
758
784
|
|
|
@@ -1186,6 +1212,8 @@ export declare const _dumpState: (state: unknown[], color?: boolean, prefix?: st
|
|
|
1186
1212
|
/** @internal */
|
|
1187
1213
|
export declare const _EFFECT_BACK_REF: unique symbol;
|
|
1188
1214
|
|
|
1215
|
+
declare type EffectBackRef = SignalImpl | StoreTarget | PropsProxy;
|
|
1216
|
+
|
|
1189
1217
|
declare const enum EffectProperty {
|
|
1190
1218
|
COMPONENT = ":",
|
|
1191
1219
|
VNODE = "."
|
|
@@ -1230,9 +1258,9 @@ declare const enum EffectProperty {
|
|
|
1230
1258
|
declare class EffectSubscription {
|
|
1231
1259
|
consumer: Consumer;
|
|
1232
1260
|
property: EffectProperty | string;
|
|
1233
|
-
backRef: Set<
|
|
1261
|
+
backRef: Set<EffectBackRef> | null;
|
|
1234
1262
|
data: _SubscriptionData | null;
|
|
1235
|
-
constructor(consumer: Consumer, property: EffectProperty | string, backRef?: Set<
|
|
1263
|
+
constructor(consumer: Consumer, property: EffectProperty | string, backRef?: Set<EffectBackRef> | null, data?: _SubscriptionData | null);
|
|
1236
1264
|
}
|
|
1237
1265
|
|
|
1238
1266
|
/** @internal */
|
|
@@ -1245,6 +1273,9 @@ export declare class _ElementVNode extends _VirtualVNode {
|
|
|
1245
1273
|
/** @internal */
|
|
1246
1274
|
export declare const _EMPTY_ARRAY: any[];
|
|
1247
1275
|
|
|
1276
|
+
/** @internal */
|
|
1277
|
+
export declare const _EMPTY_OBJ: Record<string, any>;
|
|
1278
|
+
|
|
1248
1279
|
/** @public */
|
|
1249
1280
|
declare type EntryStrategy = InlineEntryStrategy | HoistEntryStrategy | SingleEntryStrategy | HookEntryStrategy | SegmentEntryStrategy | ComponentEntryStrategy | SmartEntryStrategy;
|
|
1250
1281
|
|
|
@@ -1616,7 +1647,7 @@ declare interface ISsrNode {
|
|
|
1616
1647
|
}
|
|
1617
1648
|
|
|
1618
1649
|
/** @internal */
|
|
1619
|
-
export declare const _isStore: (value:
|
|
1650
|
+
export declare const _isStore: (value: object) => boolean;
|
|
1620
1651
|
|
|
1621
1652
|
/** @internal */
|
|
1622
1653
|
export declare function _isStringifiable(value: unknown): value is _Stringifiable;
|
|
@@ -1624,6 +1655,13 @@ export declare function _isStringifiable(value: unknown): value is _Stringifiabl
|
|
|
1624
1655
|
/** @internal */
|
|
1625
1656
|
export declare const _isTask: (value: any) => value is Task;
|
|
1626
1657
|
|
|
1658
|
+
/** @internal */
|
|
1659
|
+
declare interface IStreamHandler {
|
|
1660
|
+
flush(): void;
|
|
1661
|
+
streamBlockStart(): void;
|
|
1662
|
+
streamBlockEnd(): void;
|
|
1663
|
+
}
|
|
1664
|
+
|
|
1627
1665
|
/**
|
|
1628
1666
|
* Used by the JSX transpilers to create a JSXNode. Note that the optimizer will normally not use
|
|
1629
1667
|
* this, instead using _jsxSplit and _jsxSorted directly.
|
|
@@ -1920,7 +1958,7 @@ export declare const _noopQrlDEV: <T>(symbolName: string, opts: QRLDev, lexicalS
|
|
|
1920
1958
|
* @see noSerialize
|
|
1921
1959
|
*/
|
|
1922
1960
|
export declare type NoSerialize<T> = (T & {
|
|
1923
|
-
__no_serialize__
|
|
1961
|
+
__no_serialize__?: true;
|
|
1924
1962
|
}) | undefined;
|
|
1925
1963
|
|
|
1926
1964
|
/**
|
|
@@ -2655,7 +2693,7 @@ export declare type QwikWheelEvent<T = Element> = NativeWheelEvent;
|
|
|
2655
2693
|
|
|
2656
2694
|
declare type QwikWindowEventMap = Omit<WindowEventHandlersEventMap, keyof QwikDocumentEventMap> & QwikDocumentEventMap;
|
|
2657
2695
|
|
|
2658
|
-
/** @public */
|
|
2696
|
+
/** @public @deprecated not used */
|
|
2659
2697
|
export declare interface ReadonlySignal<T = unknown> {
|
|
2660
2698
|
readonly value: T;
|
|
2661
2699
|
}
|
|
@@ -2908,14 +2946,13 @@ declare interface SerializationContext {
|
|
|
2908
2946
|
$renderSymbols$: Set<string>;
|
|
2909
2947
|
$storeProxyMap$: ObjToProxyMap;
|
|
2910
2948
|
$eagerResume$: Set<unknown>;
|
|
2911
|
-
$resources$: Set<ResourceReturnInternal<any>>;
|
|
2912
|
-
$getProp$: (obj: any, prop: string) => any;
|
|
2913
2949
|
$setProp$: (obj: any, prop: string, value: any) => void;
|
|
2914
2950
|
}
|
|
2915
2951
|
|
|
2916
2952
|
declare const enum SerializationSignalFlags {
|
|
2917
2953
|
SERIALIZATION_STRATEGY_NEVER = 8,
|
|
2918
|
-
SERIALIZATION_STRATEGY_ALWAYS = 16
|
|
2954
|
+
SERIALIZATION_STRATEGY_ALWAYS = 16,
|
|
2955
|
+
SERIALIZATION_ALL_STRATEGIES = 24
|
|
2919
2956
|
}
|
|
2920
2957
|
|
|
2921
2958
|
/**
|
|
@@ -3034,6 +3071,9 @@ export declare const SerializerSymbol: unique symbol;
|
|
|
3034
3071
|
*/
|
|
3035
3072
|
declare type ServerQwikManifest = Pick<QwikManifest, 'manifestHash' | 'injections' | 'bundleGraph' | 'bundleGraphAsset' | 'mapping' | 'preloader' | 'core' | 'qwikLoader'>;
|
|
3036
3073
|
|
|
3074
|
+
/** @internal */
|
|
3075
|
+
export declare function _setEvent(serializationCtx: SerializationContext, key: string, rawValue: unknown, isLoopElement: boolean): string | null;
|
|
3076
|
+
|
|
3037
3077
|
/**
|
|
3038
3078
|
* Sets the `CorePlatform`.
|
|
3039
3079
|
*
|
|
@@ -3093,8 +3133,16 @@ export declare abstract class _SharedContainer implements _Container {
|
|
|
3093
3133
|
*
|
|
3094
3134
|
* @public
|
|
3095
3135
|
*/
|
|
3096
|
-
export declare interface Signal<T = any>
|
|
3136
|
+
export declare interface Signal<T = any> {
|
|
3137
|
+
/** Reading from this subscribes to updates; writing to this triggers updates. */
|
|
3097
3138
|
value: T;
|
|
3139
|
+
/** Reading from this does not subscribe to updates; writing to this does not trigger updates. */
|
|
3140
|
+
untrackedValue: T;
|
|
3141
|
+
/**
|
|
3142
|
+
* Use this to trigger running subscribers, for example when the value mutated but remained the
|
|
3143
|
+
* same object.
|
|
3144
|
+
*/
|
|
3145
|
+
trigger(): void;
|
|
3098
3146
|
}
|
|
3099
3147
|
|
|
3100
3148
|
declare const enum SignalFlags {
|
|
@@ -3110,9 +3158,11 @@ declare class SignalImpl<T = any> implements Signal<T> {
|
|
|
3110
3158
|
$wrappedSignal$: WrappedSignalImpl<T> | null;
|
|
3111
3159
|
constructor(container: _Container | null, value: T);
|
|
3112
3160
|
/**
|
|
3113
|
-
* Use this to
|
|
3161
|
+
* Use this to trigger running subscribers, for example when the calculated value has mutated but
|
|
3114
3162
|
* remained the same object
|
|
3115
3163
|
*/
|
|
3164
|
+
trigger(): void;
|
|
3165
|
+
/** @deprecated Use `trigger()` instead */
|
|
3116
3166
|
force(): void;
|
|
3117
3167
|
get untrackedValue(): T;
|
|
3118
3168
|
set untrackedValue(value: T);
|
|
@@ -3125,8 +3175,6 @@ declare class SignalImpl<T = any> implements Signal<T> {
|
|
|
3125
3175
|
};
|
|
3126
3176
|
}
|
|
3127
3177
|
|
|
3128
|
-
declare type SimpleSsrAttrValue = string | Signal<SimpleSsrAttrValue> | boolean | object | null;
|
|
3129
|
-
|
|
3130
3178
|
declare interface SimplifiedServerRequestEvent<T = unknown> {
|
|
3131
3179
|
url: URL;
|
|
3132
3180
|
locale: string | undefined;
|
|
@@ -3402,12 +3450,6 @@ declare type SpecialAttrs = {
|
|
|
3402
3450
|
[key: string]: {};
|
|
3403
3451
|
};
|
|
3404
3452
|
|
|
3405
|
-
declare type SsrAttrKey = string;
|
|
3406
|
-
|
|
3407
|
-
declare type SsrAttrs = Array<SsrAttrKey | SsrAttrValue>;
|
|
3408
|
-
|
|
3409
|
-
declare type SsrAttrValue = SimpleSsrAttrValue | Promise<SimpleSsrAttrValue>;
|
|
3410
|
-
|
|
3411
3453
|
/** @public */
|
|
3412
3454
|
export declare const SSRComment: FunctionComponent<{
|
|
3413
3455
|
data: string;
|
|
@@ -3418,6 +3460,7 @@ declare interface SSRContainer extends _Container {
|
|
|
3418
3460
|
readonly isHtml: boolean;
|
|
3419
3461
|
readonly size: number;
|
|
3420
3462
|
readonly writer: StreamWriter;
|
|
3463
|
+
readonly streamHandler: IStreamHandler;
|
|
3421
3464
|
readonly serializationCtx: SerializationContext;
|
|
3422
3465
|
readonly symbolToChunkResolver: SymbolToChunkResolver;
|
|
3423
3466
|
readonly resolvedManifest: ResolvedManifest;
|
|
@@ -3426,13 +3469,13 @@ declare interface SSRContainer extends _Container {
|
|
|
3426
3469
|
write(text: string): void;
|
|
3427
3470
|
openContainer(): void;
|
|
3428
3471
|
closeContainer(): ValueOrPromise<void>;
|
|
3429
|
-
openElement(elementName: string, key: string | null, varAttrs:
|
|
3472
|
+
openElement(elementName: string, key: string | null, varAttrs: Props, constAttrs: Props | null, styleScopedId: string | null, currentFile: string | null): string | undefined;
|
|
3430
3473
|
closeElement(): ValueOrPromise<void>;
|
|
3431
|
-
openFragment(attrs:
|
|
3474
|
+
openFragment(attrs: Props): void;
|
|
3432
3475
|
closeFragment(): void;
|
|
3433
|
-
openProjection(attrs:
|
|
3476
|
+
openProjection(attrs: Props): void;
|
|
3434
3477
|
closeProjection(): void;
|
|
3435
|
-
openComponent(attrs:
|
|
3478
|
+
openComponent(attrs: Props): void;
|
|
3436
3479
|
getComponentFrame(projectionDepth: number): ISsrComponentFrame | null;
|
|
3437
3480
|
getParentComponentFrame(): ISsrComponentFrame | null;
|
|
3438
3481
|
closeComponent(): Promise<void>;
|
|
@@ -4636,7 +4679,7 @@ export declare const _VAR_PROPS: unique symbol;
|
|
|
4636
4679
|
export declare const _verifySerializable: <T>(value: T, preMessage?: string) => T;
|
|
4637
4680
|
|
|
4638
4681
|
/**
|
|
4639
|
-
* 2.0.0-beta.
|
|
4682
|
+
* 2.0.0-beta.25-dev+2677279
|
|
4640
4683
|
*
|
|
4641
4684
|
* @public
|
|
4642
4685
|
*/
|
|
@@ -4717,7 +4760,7 @@ export declare function _vnode_toString(this: _VNode | null, depth?: number, off
|
|
|
4717
4760
|
* this data needs to be serialized into a string and stored in the DOM as a script tag which has
|
|
4718
4761
|
* deferent serialization format.
|
|
4719
4762
|
*/
|
|
4720
|
-
declare type VNodeData = [VNodeDataFlag, ...(
|
|
4763
|
+
declare type VNodeData = [VNodeDataFlag, ...(Props | number)[]];
|
|
4721
4764
|
|
|
4722
4765
|
/**
|
|
4723
4766
|
* Flags for VNodeData (Flags con be bitwise combined)
|
|
@@ -4795,7 +4838,7 @@ declare const enum WrappedSignalFlags {
|
|
|
4795
4838
|
UNWRAP = 4
|
|
4796
4839
|
}
|
|
4797
4840
|
|
|
4798
|
-
declare class WrappedSignalImpl<T> extends SignalImpl<T>
|
|
4841
|
+
declare class WrappedSignalImpl<T> extends SignalImpl<T> {
|
|
4799
4842
|
$args$: any[];
|
|
4800
4843
|
$func$: (...args: any[]) => T;
|
|
4801
4844
|
$funcStr$: string | null;
|