@qwik.dev/core 2.0.0-beta.23 → 2.0.0-beta.24
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 +76 -35
- package/dist/core.min.mjs +1 -1
- package/dist/core.mjs +1362 -1112
- package/dist/core.mjs.map +1 -1
- package/dist/core.prod.mjs +4410 -3255
- 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 +17 -78
- package/dist/testing/index.mjs +1172 -1050
- 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
|
|
|
@@ -1245,6 +1271,9 @@ export declare class _ElementVNode extends _VirtualVNode {
|
|
|
1245
1271
|
/** @internal */
|
|
1246
1272
|
export declare const _EMPTY_ARRAY: any[];
|
|
1247
1273
|
|
|
1274
|
+
/** @internal */
|
|
1275
|
+
export declare const _EMPTY_OBJ: Record<string, any>;
|
|
1276
|
+
|
|
1248
1277
|
/** @public */
|
|
1249
1278
|
declare type EntryStrategy = InlineEntryStrategy | HoistEntryStrategy | SingleEntryStrategy | HookEntryStrategy | SegmentEntryStrategy | ComponentEntryStrategy | SmartEntryStrategy;
|
|
1250
1279
|
|
|
@@ -1616,7 +1645,7 @@ declare interface ISsrNode {
|
|
|
1616
1645
|
}
|
|
1617
1646
|
|
|
1618
1647
|
/** @internal */
|
|
1619
|
-
export declare const _isStore: (value:
|
|
1648
|
+
export declare const _isStore: (value: object) => boolean;
|
|
1620
1649
|
|
|
1621
1650
|
/** @internal */
|
|
1622
1651
|
export declare function _isStringifiable(value: unknown): value is _Stringifiable;
|
|
@@ -1624,6 +1653,13 @@ export declare function _isStringifiable(value: unknown): value is _Stringifiabl
|
|
|
1624
1653
|
/** @internal */
|
|
1625
1654
|
export declare const _isTask: (value: any) => value is Task;
|
|
1626
1655
|
|
|
1656
|
+
/** @internal */
|
|
1657
|
+
declare interface IStreamHandler {
|
|
1658
|
+
flush(): void;
|
|
1659
|
+
streamBlockStart(): void;
|
|
1660
|
+
streamBlockEnd(): void;
|
|
1661
|
+
}
|
|
1662
|
+
|
|
1627
1663
|
/**
|
|
1628
1664
|
* Used by the JSX transpilers to create a JSXNode. Note that the optimizer will normally not use
|
|
1629
1665
|
* this, instead using _jsxSplit and _jsxSorted directly.
|
|
@@ -2655,7 +2691,7 @@ export declare type QwikWheelEvent<T = Element> = NativeWheelEvent;
|
|
|
2655
2691
|
|
|
2656
2692
|
declare type QwikWindowEventMap = Omit<WindowEventHandlersEventMap, keyof QwikDocumentEventMap> & QwikDocumentEventMap;
|
|
2657
2693
|
|
|
2658
|
-
/** @public */
|
|
2694
|
+
/** @public @deprecated not used */
|
|
2659
2695
|
export declare interface ReadonlySignal<T = unknown> {
|
|
2660
2696
|
readonly value: T;
|
|
2661
2697
|
}
|
|
@@ -2908,14 +2944,13 @@ declare interface SerializationContext {
|
|
|
2908
2944
|
$renderSymbols$: Set<string>;
|
|
2909
2945
|
$storeProxyMap$: ObjToProxyMap;
|
|
2910
2946
|
$eagerResume$: Set<unknown>;
|
|
2911
|
-
$resources$: Set<ResourceReturnInternal<any>>;
|
|
2912
|
-
$getProp$: (obj: any, prop: string) => any;
|
|
2913
2947
|
$setProp$: (obj: any, prop: string, value: any) => void;
|
|
2914
2948
|
}
|
|
2915
2949
|
|
|
2916
2950
|
declare const enum SerializationSignalFlags {
|
|
2917
2951
|
SERIALIZATION_STRATEGY_NEVER = 8,
|
|
2918
|
-
SERIALIZATION_STRATEGY_ALWAYS = 16
|
|
2952
|
+
SERIALIZATION_STRATEGY_ALWAYS = 16,
|
|
2953
|
+
SERIALIZATION_ALL_STRATEGIES = 24
|
|
2919
2954
|
}
|
|
2920
2955
|
|
|
2921
2956
|
/**
|
|
@@ -3034,6 +3069,9 @@ export declare const SerializerSymbol: unique symbol;
|
|
|
3034
3069
|
*/
|
|
3035
3070
|
declare type ServerQwikManifest = Pick<QwikManifest, 'manifestHash' | 'injections' | 'bundleGraph' | 'bundleGraphAsset' | 'mapping' | 'preloader' | 'core' | 'qwikLoader'>;
|
|
3036
3071
|
|
|
3072
|
+
/** @internal */
|
|
3073
|
+
export declare function _setEvent(serializationCtx: SerializationContext, key: string, rawValue: unknown, isLoopElement: boolean): string | null;
|
|
3074
|
+
|
|
3037
3075
|
/**
|
|
3038
3076
|
* Sets the `CorePlatform`.
|
|
3039
3077
|
*
|
|
@@ -3093,8 +3131,16 @@ export declare abstract class _SharedContainer implements _Container {
|
|
|
3093
3131
|
*
|
|
3094
3132
|
* @public
|
|
3095
3133
|
*/
|
|
3096
|
-
export declare interface Signal<T = any>
|
|
3134
|
+
export declare interface Signal<T = any> {
|
|
3135
|
+
/** Reading from this subscribes to updates; writing to this triggers updates. */
|
|
3097
3136
|
value: T;
|
|
3137
|
+
/** Reading from this does not subscribe to updates; writing to this does not trigger updates. */
|
|
3138
|
+
untrackedValue: T;
|
|
3139
|
+
/**
|
|
3140
|
+
* Use this to trigger running subscribers, for example when the value mutated but remained the
|
|
3141
|
+
* same object.
|
|
3142
|
+
*/
|
|
3143
|
+
trigger(): void;
|
|
3098
3144
|
}
|
|
3099
3145
|
|
|
3100
3146
|
declare const enum SignalFlags {
|
|
@@ -3110,9 +3156,11 @@ declare class SignalImpl<T = any> implements Signal<T> {
|
|
|
3110
3156
|
$wrappedSignal$: WrappedSignalImpl<T> | null;
|
|
3111
3157
|
constructor(container: _Container | null, value: T);
|
|
3112
3158
|
/**
|
|
3113
|
-
* Use this to
|
|
3159
|
+
* Use this to trigger running subscribers, for example when the calculated value has mutated but
|
|
3114
3160
|
* remained the same object
|
|
3115
3161
|
*/
|
|
3162
|
+
trigger(): void;
|
|
3163
|
+
/** @deprecated Use `trigger()` instead */
|
|
3116
3164
|
force(): void;
|
|
3117
3165
|
get untrackedValue(): T;
|
|
3118
3166
|
set untrackedValue(value: T);
|
|
@@ -3125,8 +3173,6 @@ declare class SignalImpl<T = any> implements Signal<T> {
|
|
|
3125
3173
|
};
|
|
3126
3174
|
}
|
|
3127
3175
|
|
|
3128
|
-
declare type SimpleSsrAttrValue = string | Signal<SimpleSsrAttrValue> | boolean | object | null;
|
|
3129
|
-
|
|
3130
3176
|
declare interface SimplifiedServerRequestEvent<T = unknown> {
|
|
3131
3177
|
url: URL;
|
|
3132
3178
|
locale: string | undefined;
|
|
@@ -3402,12 +3448,6 @@ declare type SpecialAttrs = {
|
|
|
3402
3448
|
[key: string]: {};
|
|
3403
3449
|
};
|
|
3404
3450
|
|
|
3405
|
-
declare type SsrAttrKey = string;
|
|
3406
|
-
|
|
3407
|
-
declare type SsrAttrs = Array<SsrAttrKey | SsrAttrValue>;
|
|
3408
|
-
|
|
3409
|
-
declare type SsrAttrValue = SimpleSsrAttrValue | Promise<SimpleSsrAttrValue>;
|
|
3410
|
-
|
|
3411
3451
|
/** @public */
|
|
3412
3452
|
export declare const SSRComment: FunctionComponent<{
|
|
3413
3453
|
data: string;
|
|
@@ -3418,6 +3458,7 @@ declare interface SSRContainer extends _Container {
|
|
|
3418
3458
|
readonly isHtml: boolean;
|
|
3419
3459
|
readonly size: number;
|
|
3420
3460
|
readonly writer: StreamWriter;
|
|
3461
|
+
readonly streamHandler: IStreamHandler;
|
|
3421
3462
|
readonly serializationCtx: SerializationContext;
|
|
3422
3463
|
readonly symbolToChunkResolver: SymbolToChunkResolver;
|
|
3423
3464
|
readonly resolvedManifest: ResolvedManifest;
|
|
@@ -3426,13 +3467,13 @@ declare interface SSRContainer extends _Container {
|
|
|
3426
3467
|
write(text: string): void;
|
|
3427
3468
|
openContainer(): void;
|
|
3428
3469
|
closeContainer(): ValueOrPromise<void>;
|
|
3429
|
-
openElement(elementName: string, key: string | null, varAttrs:
|
|
3470
|
+
openElement(elementName: string, key: string | null, varAttrs: Props, constAttrs: Props | null, styleScopedId: string | null, currentFile: string | null): string | undefined;
|
|
3430
3471
|
closeElement(): ValueOrPromise<void>;
|
|
3431
|
-
openFragment(attrs:
|
|
3472
|
+
openFragment(attrs: Props): void;
|
|
3432
3473
|
closeFragment(): void;
|
|
3433
|
-
openProjection(attrs:
|
|
3474
|
+
openProjection(attrs: Props): void;
|
|
3434
3475
|
closeProjection(): void;
|
|
3435
|
-
openComponent(attrs:
|
|
3476
|
+
openComponent(attrs: Props): void;
|
|
3436
3477
|
getComponentFrame(projectionDepth: number): ISsrComponentFrame | null;
|
|
3437
3478
|
getParentComponentFrame(): ISsrComponentFrame | null;
|
|
3438
3479
|
closeComponent(): Promise<void>;
|
|
@@ -4636,7 +4677,7 @@ export declare const _VAR_PROPS: unique symbol;
|
|
|
4636
4677
|
export declare const _verifySerializable: <T>(value: T, preMessage?: string) => T;
|
|
4637
4678
|
|
|
4638
4679
|
/**
|
|
4639
|
-
* 2.0.0-beta.
|
|
4680
|
+
* 2.0.0-beta.24-dev+314726b
|
|
4640
4681
|
*
|
|
4641
4682
|
* @public
|
|
4642
4683
|
*/
|
|
@@ -4717,7 +4758,7 @@ export declare function _vnode_toString(this: _VNode | null, depth?: number, off
|
|
|
4717
4758
|
* this data needs to be serialized into a string and stored in the DOM as a script tag which has
|
|
4718
4759
|
* deferent serialization format.
|
|
4719
4760
|
*/
|
|
4720
|
-
declare type VNodeData = [VNodeDataFlag, ...(
|
|
4761
|
+
declare type VNodeData = [VNodeDataFlag, ...(Props | number)[]];
|
|
4721
4762
|
|
|
4722
4763
|
/**
|
|
4723
4764
|
* Flags for VNodeData (Flags con be bitwise combined)
|
|
@@ -4795,7 +4836,7 @@ declare const enum WrappedSignalFlags {
|
|
|
4795
4836
|
UNWRAP = 4
|
|
4796
4837
|
}
|
|
4797
4838
|
|
|
4798
|
-
declare class WrappedSignalImpl<T> extends SignalImpl<T>
|
|
4839
|
+
declare class WrappedSignalImpl<T> extends SignalImpl<T> {
|
|
4799
4840
|
$args$: any[];
|
|
4800
4841
|
$func$: (...args: any[]) => T;
|
|
4801
4842
|
$funcStr$: string | null;
|