@qwik.dev/core 2.0.0-beta.31 → 2.0.0-beta.32
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/dist/backpatch/package.json +1 -1
- package/dist/build/package.json +1 -1
- package/dist/cli.mjs +2 -2
- package/dist/core-internal.d.ts +112 -34
- package/dist/core.min.mjs +2 -2
- package/dist/core.mjs +696 -347
- package/dist/core.mjs.map +1 -1
- package/dist/core.prod.mjs +3269 -3020
- package/dist/loader/index.mjs +2 -2
- package/dist/loader/package.json +1 -1
- package/dist/optimizer.mjs +4 -4
- package/dist/qwikloader.debug.js +237 -90
- package/dist/qwikloader.js +1 -1
- package/dist/server.mjs +10 -7
- package/dist/server.prod.mjs +694 -690
- package/dist/starters/adapters/bun/src/entry.bun.ts +2 -8
- package/dist/starters/adapters/cloud-run/src/entry.cloud-run.tsx +2 -4
- package/dist/starters/adapters/deno/src/entry.deno.ts +2 -8
- package/dist/starters/adapters/express/src/entry.express.tsx +1 -4
- package/dist/starters/adapters/fastify/src/plugins/fastify-qwik.ts +1 -2
- package/dist/starters/adapters/node-server/src/entry.node-server.tsx +2 -4
- package/dist/testing/index.d.ts +5 -3
- package/dist/testing/index.mjs +717 -281
- package/dist/testing/package.json +1 -1
- package/package.json +3 -3
package/dist/build/package.json
CHANGED
package/dist/cli.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
|
-
* @qwik.dev/core/cli 2.0.0-beta.
|
|
3
|
+
* @qwik.dev/core/cli 2.0.0-beta.32-dev+0e29f8a
|
|
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
|
|
@@ -12953,7 +12953,7 @@ async function printHelp(app) {
|
|
|
12953
12953
|
await runCommand2(Object.assign(app, { task: args[0], args }));
|
|
12954
12954
|
}
|
|
12955
12955
|
function printVersion() {
|
|
12956
|
-
console.log("2.0.0-beta.
|
|
12956
|
+
console.log("2.0.0-beta.32-dev+0e29f8a");
|
|
12957
12957
|
}
|
|
12958
12958
|
export {
|
|
12959
12959
|
runCli,
|
package/dist/core-internal.d.ts
CHANGED
|
@@ -381,7 +381,7 @@ declare type AsyncCtx<T = unknown> = {
|
|
|
381
381
|
/** The result of the previous computation, if any */
|
|
382
382
|
readonly previous: T | undefined;
|
|
383
383
|
/** Extra info passed to `invalidate(info)` for this computation, if any. */
|
|
384
|
-
readonly info
|
|
384
|
+
readonly info?: unknown;
|
|
385
385
|
};
|
|
386
386
|
|
|
387
387
|
/**
|
|
@@ -396,16 +396,16 @@ export declare type AsyncFn<T> = (ctx: AsyncCtx) => ValueOrPromise<T>;
|
|
|
396
396
|
/** Retains job metadata and also serves as the argument for the compute function */
|
|
397
397
|
declare class AsyncJob<T> implements AsyncCtx<T> {
|
|
398
398
|
readonly $signal$: AsyncSignalImpl<T>;
|
|
399
|
-
readonly info: unknown;
|
|
400
|
-
readonly $infoVersion$: number;
|
|
401
399
|
/** First holds the compute promise and then the cleanup promise */
|
|
402
|
-
$promise$: Promise<void> | null;
|
|
400
|
+
$promise$: Promise<void> | null | void;
|
|
403
401
|
$cleanupRequested$: boolean;
|
|
404
402
|
$canWrite$: boolean;
|
|
405
403
|
$track$: AsyncCtx<T>['track'] | undefined;
|
|
406
404
|
$cleanups$: Parameters<AsyncCtx<T>['cleanup']>[0][] | undefined;
|
|
407
405
|
$abortController$: AbortController | undefined;
|
|
408
|
-
|
|
406
|
+
info: unknown;
|
|
407
|
+
$infoVersion$: number | undefined;
|
|
408
|
+
constructor($signal$: AsyncSignalImpl<T>, info: unknown, $infoVersion$: number | undefined);
|
|
409
409
|
get track(): AsyncCtx<T>['track'];
|
|
410
410
|
get abortSignal(): AbortSignal;
|
|
411
411
|
/** Backward compatible cache method for resource */
|
|
@@ -451,18 +451,40 @@ export declare interface AsyncSignal<T = unknown> extends ComputedSignal<T> {
|
|
|
451
451
|
* ```
|
|
452
452
|
*/
|
|
453
453
|
loading: boolean;
|
|
454
|
+
/**
|
|
455
|
+
* Lets you read the loading state without subscribing to `.loading` updates. It also triggers
|
|
456
|
+
* lazy loading of the signal.
|
|
457
|
+
*
|
|
458
|
+
* Setting it will trigger listeners for `.loading`.
|
|
459
|
+
*/
|
|
460
|
+
untrackedLoading: boolean;
|
|
454
461
|
/**
|
|
455
462
|
* The error that occurred while computing the signal, if any. This will be cleared when the
|
|
456
|
-
* signal is successfully computed.
|
|
463
|
+
* signal is successfully computed. It does not trigger lazy loading of the signal.
|
|
457
464
|
*/
|
|
458
465
|
error: Error | undefined;
|
|
459
466
|
/**
|
|
460
|
-
*
|
|
467
|
+
* Lets you read the error state without subscribing to `.error` updates. It does not trigger lazy
|
|
468
|
+
* loading of the signal.
|
|
469
|
+
*
|
|
470
|
+
* Setting it will trigger listeners for `.error`.
|
|
471
|
+
*/
|
|
472
|
+
untrackedError: Error | undefined;
|
|
473
|
+
/**
|
|
474
|
+
* Expiration time in ms. Writable and immediately effective.
|
|
475
|
+
*
|
|
476
|
+
* When set, the signal is invalidated after this many ms. Whether it auto-recomputes depends on
|
|
477
|
+
* the `poll` property. `0` means no expiration.
|
|
478
|
+
*/
|
|
479
|
+
expires: number;
|
|
480
|
+
/**
|
|
481
|
+
* Whether to automatically re-run the function when the value expires. Writable and immediately
|
|
482
|
+
* effective. Only relevant when `expires` is set.
|
|
461
483
|
*
|
|
462
|
-
*
|
|
463
|
-
* - **Negative**: Stale-only — mark stale after `|interval|` ms, no auto-recompute.
|
|
464
|
-
* - **`0`**: No staleness tracking or polling.
|
|
484
|
+
* Defaults to `true`.
|
|
465
485
|
*/
|
|
486
|
+
poll: boolean;
|
|
487
|
+
/** @deprecated Use `expires` and `poll` instead. Will be removed before v2 */
|
|
466
488
|
interval: number;
|
|
467
489
|
/** A promise that resolves when the value is computed or rejected. */
|
|
468
490
|
promise(): Promise<void>;
|
|
@@ -477,7 +499,9 @@ export declare interface AsyncSignal<T = unknown> extends ComputedSignal<T> {
|
|
|
477
499
|
|
|
478
500
|
declare const enum AsyncSignalFlags {
|
|
479
501
|
EAGER_CLEANUP = 32,
|
|
480
|
-
CLIENT_ONLY = 64
|
|
502
|
+
CLIENT_ONLY = 64,
|
|
503
|
+
CLEAR_ON_INVALIDATE = 128,
|
|
504
|
+
NO_POLL = 256
|
|
481
505
|
}
|
|
482
506
|
|
|
483
507
|
/**
|
|
@@ -486,21 +510,23 @@ declare const enum AsyncSignalFlags {
|
|
|
486
510
|
* AsyncSignalImpl
|
|
487
511
|
*
|
|
488
512
|
* # ================================
|
|
513
|
+
*
|
|
514
|
+
* @internal
|
|
489
515
|
*/
|
|
490
516
|
declare class AsyncSignalImpl<T> extends ComputedSignalImpl<T, AsyncQRL<T>> implements BackRef, AsyncSignal<T> {
|
|
491
517
|
$untrackedLoading$: boolean;
|
|
492
518
|
$untrackedError$: Error | undefined;
|
|
493
|
-
$loadingEffects$: undefined | Set<EffectSubscription>;
|
|
494
|
-
$errorEffects$: undefined | Set<EffectSubscription>;
|
|
495
519
|
$current$: AsyncJob<T> | null;
|
|
496
|
-
$jobs$: AsyncJob<T>[];
|
|
497
|
-
$concurrency$: number;
|
|
498
|
-
$
|
|
520
|
+
$jobs$: AsyncJob<T>[] | undefined;
|
|
521
|
+
$concurrency$: number | undefined;
|
|
522
|
+
$expires$: number | undefined;
|
|
499
523
|
$timeoutMs$: number | undefined;
|
|
500
|
-
$
|
|
501
|
-
$
|
|
524
|
+
$loadingEffects$: undefined | Set<EffectSubscription>;
|
|
525
|
+
$errorEffects$: undefined | Set<EffectSubscription>;
|
|
502
526
|
$pollTimeoutId$: ReturnType<typeof setTimeout> | undefined;
|
|
503
527
|
$computationTimeoutId$: ReturnType<typeof setTimeout> | undefined;
|
|
528
|
+
$info$: unknown | undefined;
|
|
529
|
+
$infoVersion$: number | undefined;
|
|
504
530
|
[_EFFECT_BACK_REF]: Map<EffectProperty | string, EffectSubscription> | undefined;
|
|
505
531
|
constructor(container: _Container | null, fn: AsyncQRL<T>, flags?: SignalFlags | SerializationSignalFlags, options?: AsyncSignalOptions<T>);
|
|
506
532
|
get untrackedValue(): T;
|
|
@@ -532,10 +558,16 @@ declare class AsyncSignalImpl<T> extends ComputedSignalImpl<T, AsyncQRL<T>> impl
|
|
|
532
558
|
get error(): Error | undefined;
|
|
533
559
|
set untrackedError(value: Error | undefined);
|
|
534
560
|
get untrackedError(): Error | undefined;
|
|
561
|
+
get expires(): number;
|
|
562
|
+
set expires(value: number);
|
|
563
|
+
get poll(): boolean;
|
|
564
|
+
set poll(value: boolean);
|
|
565
|
+
/** @deprecated Use `expires` and `poll` instead. */
|
|
535
566
|
get interval(): number;
|
|
536
567
|
set interval(value: number);
|
|
537
568
|
/** Invalidates the signal, causing it to re-compute its value. */
|
|
538
569
|
invalidate(info?: unknown): Promise<void>;
|
|
570
|
+
$setInvalid$(allowRecalc: boolean, mustClear: boolean | number): void;
|
|
539
571
|
/** Abort the current computation and run cleanups if needed. */
|
|
540
572
|
abort(reason?: any): void;
|
|
541
573
|
/** Schedule eager cleanup on next macro task if no subscribers remain. */
|
|
@@ -545,14 +577,19 @@ declare class AsyncSignalImpl<T> extends ComputedSignalImpl<T, AsyncQRL<T>> impl
|
|
|
545
577
|
/** Run the computation if needed */
|
|
546
578
|
$computeIfNeeded$(): void;
|
|
547
579
|
$runComputation$(running: AsyncJob<T>): Promise<void>;
|
|
580
|
+
/**
|
|
581
|
+
* Sets the error from the given job. We only accept errors from the current job and we ignore
|
|
582
|
+
* AbortErrors.
|
|
583
|
+
*/
|
|
584
|
+
$setError$(job: AsyncJob<T>, error: Error): void;
|
|
548
585
|
/** Called after SSR/unmount */
|
|
549
586
|
$destroy$(): Promise<void>;
|
|
550
587
|
private $clearNextPoll$;
|
|
551
588
|
private $scheduleNextPoll$;
|
|
552
589
|
private $hasSubscribers$;
|
|
553
|
-
$requestCleanups$(job: AsyncJob<T>, reason?: any):
|
|
590
|
+
$requestCleanups$(job: AsyncJob<T>, reason?: any): void;
|
|
554
591
|
/** Clean up and trigger signal compute once complete */
|
|
555
|
-
$runCleanups$(job: AsyncJob<T>): Promise<void
|
|
592
|
+
$runCleanups$(job: AsyncJob<T>): Promise<void> | undefined;
|
|
556
593
|
}
|
|
557
594
|
|
|
558
595
|
/** @public */
|
|
@@ -573,21 +610,23 @@ export declare interface AsyncSignalOptions<T> extends ComputedOptions {
|
|
|
573
610
|
*/
|
|
574
611
|
eagerCleanup?: boolean;
|
|
575
612
|
/**
|
|
576
|
-
*
|
|
613
|
+
* Time in milliseconds after which the value expires.
|
|
577
614
|
*
|
|
578
|
-
*
|
|
615
|
+
* When the value expires and subscribers exist, the signal is invalidated. If `poll` is `true`
|
|
616
|
+
* (default), the function is re-run automatically. If `poll` is `false`, the value is marked
|
|
617
|
+
* stale and recomputation happens when reading `.value` or `.loading`.
|
|
579
618
|
*
|
|
580
|
-
*
|
|
619
|
+
* `0` (default) means no expiration.
|
|
581
620
|
*/
|
|
582
|
-
|
|
621
|
+
expires?: number;
|
|
583
622
|
/**
|
|
584
|
-
*
|
|
623
|
+
* Whether to automatically re-run the function when the value expires. Only relevant when
|
|
624
|
+
* `expires` is set.
|
|
585
625
|
*
|
|
586
|
-
*
|
|
587
|
-
* - **Negative**: Mark the value as stale after `|interval|` ms, but do NOT auto-recompute.
|
|
588
|
-
* Consumers can check staleness and manually trigger recomputation.
|
|
589
|
-
* - **`0`** (default): No staleness tracking or polling.
|
|
626
|
+
* Defaults to `true`.
|
|
590
627
|
*/
|
|
628
|
+
poll?: boolean;
|
|
629
|
+
/** @deprecated Use `expires` and `poll` instead. Will be removed before v2 */
|
|
591
630
|
interval?: number;
|
|
592
631
|
/**
|
|
593
632
|
* When true, the async computation is postponed to the browser. On SSR, the signal remains
|
|
@@ -596,6 +635,23 @@ export declare interface AsyncSignalOptions<T> extends ComputedOptions {
|
|
|
596
635
|
* Defaults to `false`.
|
|
597
636
|
*/
|
|
598
637
|
clientOnly?: boolean;
|
|
638
|
+
/**
|
|
639
|
+
* When true (default), the previous value is kept while the signal re-computes after
|
|
640
|
+
* invalidation, so reads return stale data instead of throwing a promise. Reactivity will then
|
|
641
|
+
* update the readers when the new value is ready.
|
|
642
|
+
*
|
|
643
|
+
* When false, invalidation clears the value so reads throw the computation promise (like the
|
|
644
|
+
* initial load), which is useful for navigations where showing old data would be confusing.
|
|
645
|
+
*
|
|
646
|
+
* Note that polling invalidations (`expires` with `poll: true`) are not affected by this option
|
|
647
|
+
* and will keep the old value while the new value is loading, to avoid flashing loaders.
|
|
648
|
+
*
|
|
649
|
+
* This option only affects manual invalidations via `invalidate()`, and non-polling expirations
|
|
650
|
+
* (`poll: false`, or there are no subscribers).
|
|
651
|
+
*
|
|
652
|
+
* Defaults to `true`.
|
|
653
|
+
*/
|
|
654
|
+
allowStale?: boolean;
|
|
599
655
|
/**
|
|
600
656
|
* Maximum time in milliseconds to wait for the async computation to complete. If exceeded, the
|
|
601
657
|
* computation is aborted and an error is thrown.
|
|
@@ -633,6 +689,10 @@ declare type BivariantQrlFn<ARGS extends any[], RETURN> = {
|
|
|
633
689
|
/** @public */
|
|
634
690
|
declare type Booleanish = boolean | `${boolean}`;
|
|
635
691
|
|
|
692
|
+
declare type Capture = {
|
|
693
|
+
[K in keyof HTMLElementEventMap as `capture:${K}`]?: boolean;
|
|
694
|
+
};
|
|
695
|
+
|
|
636
696
|
/**
|
|
637
697
|
* The current captured scope during QRL invocation. This is used to provide the lexical scope for
|
|
638
698
|
* QRL functions. It is used one time per invocation, synchronously, so it is safe to store it in
|
|
@@ -1194,7 +1254,7 @@ export declare interface DOMAttributes<EL extends Element> extends DOMAttributes
|
|
|
1194
1254
|
class?: ClassList | Signal<ClassList> | undefined;
|
|
1195
1255
|
}
|
|
1196
1256
|
|
|
1197
|
-
declare interface DOMAttributesBase<EL extends Element> extends QwikIntrinsicAttributes, PreventDefault, StopPropagation, RefAttr<EL> {
|
|
1257
|
+
declare interface DOMAttributesBase<EL extends Element> extends QwikIntrinsicAttributes, PreventDefault, StopPropagation, Capture, Passive, RefAttr<EL> {
|
|
1198
1258
|
dangerouslySetInnerHTML?: string | undefined;
|
|
1199
1259
|
}
|
|
1200
1260
|
|
|
@@ -2103,6 +2163,10 @@ declare type PascalCaseName<T extends string> = T extends keyof LcEventNameMap ?
|
|
|
2103
2163
|
*/
|
|
2104
2164
|
declare type PascalCaseNames = 'AnimationEnd' | 'AnimationIteration' | 'AnimationStart' | 'AuxClick' | 'BeforeToggle' | 'CanPlay' | 'CanPlayThrough' | 'CompositionEnd' | 'CompositionStart' | 'CompositionUpdate' | 'ContextMenu' | 'DblClick' | 'DragEnd' | 'DragEnter' | 'DragExit' | 'DragLeave' | 'DragOver' | 'DragStart' | 'DurationChange' | 'FocusIn' | 'FocusOut' | 'FullscreenChange' | 'FullscreenError' | 'GotPointerCapture' | 'KeyDown' | 'KeyPress' | 'KeyUp' | 'LoadedData' | 'LoadedMetadata' | 'LoadEnd' | 'LoadStart' | 'LostPointerCapture' | 'MouseDown' | 'MouseEnter' | 'MouseLeave' | 'MouseMove' | 'MouseOut' | 'MouseOver' | 'MouseUp' | 'PointerCancel' | 'PointerDown' | 'PointerEnter' | 'PointerLeave' | 'PointerMove' | 'PointerOut' | 'PointerOver' | 'PointerUp' | 'QIdle' | 'QInit' | 'QResume' | 'QSymbol' | 'QVisible' | 'QViewTransition' | 'RateChange' | 'RateChange' | 'SecurityPolicyViolation' | 'SelectionChange' | 'SelectStart' | 'TimeUpdate' | 'TouchCancel' | 'TouchEnd' | 'TouchMove' | 'TouchStart' | 'TransitionCancel' | 'TransitionEnd' | 'TransitionRun' | 'TransitionStart' | 'VisibilityChange' | 'VolumeChange';
|
|
2105
2165
|
|
|
2166
|
+
declare type Passive = {
|
|
2167
|
+
[K in keyof HTMLElementEventMap as `passive:${K}`]?: boolean;
|
|
2168
|
+
};
|
|
2169
|
+
|
|
2106
2170
|
declare type PopoverTargetAction = 'hide' | 'show' | 'toggle';
|
|
2107
2171
|
|
|
2108
2172
|
declare type PossibleEvents = Event | SimplifiedServerRequestEvent | typeof TaskEvent | typeof RenderEvent;
|
|
@@ -4205,7 +4269,7 @@ export declare const useLexicalScope: <VARS extends any[]>() => VARS;
|
|
|
4205
4269
|
* @public
|
|
4206
4270
|
* @see `useOn`, `useOnWindow`, `useOnDocument`.
|
|
4207
4271
|
*/
|
|
4208
|
-
export declare const useOn: <T extends KnownEventNames>(event: T | T[], eventQrl: EventQRL<T
|
|
4272
|
+
export declare const useOn: <T extends KnownEventNames>(event: T | T[], eventQrl: EventQRL<T>, options?: UseOnOptions) => void;
|
|
4209
4273
|
|
|
4210
4274
|
/**
|
|
4211
4275
|
* Register a listener on `document`.
|
|
@@ -4234,7 +4298,21 @@ export declare const useOn: <T extends KnownEventNames>(event: T | T[], eventQrl
|
|
|
4234
4298
|
* });
|
|
4235
4299
|
* ```
|
|
4236
4300
|
*/
|
|
4237
|
-
export declare const useOnDocument: <T extends KnownEventNames>(event: T | T[], eventQrl: EventQRL<T
|
|
4301
|
+
export declare const useOnDocument: <T extends KnownEventNames>(event: T | T[], eventQrl: EventQRL<T>, options?: UseOnOptions) => void;
|
|
4302
|
+
|
|
4303
|
+
/** @public */
|
|
4304
|
+
export declare type UseOnOptions = UseOnOptionsBase & ({
|
|
4305
|
+
passive?: boolean;
|
|
4306
|
+
preventdefault?: never;
|
|
4307
|
+
} | {
|
|
4308
|
+
passive?: never;
|
|
4309
|
+
preventdefault?: boolean;
|
|
4310
|
+
});
|
|
4311
|
+
|
|
4312
|
+
declare interface UseOnOptionsBase {
|
|
4313
|
+
capture?: boolean;
|
|
4314
|
+
stoppropagation?: boolean;
|
|
4315
|
+
}
|
|
4238
4316
|
|
|
4239
4317
|
/**
|
|
4240
4318
|
* Register a listener on `window`.
|
|
@@ -4264,7 +4342,7 @@ export declare const useOnDocument: <T extends KnownEventNames>(event: T | T[],
|
|
|
4264
4342
|
* });
|
|
4265
4343
|
* ```
|
|
4266
4344
|
*/
|
|
4267
|
-
export declare const useOnWindow: <T extends KnownEventNames>(event: T | T[], eventQrl: EventQRL<T
|
|
4345
|
+
export declare const useOnWindow: <T extends KnownEventNames>(event: T | T[], eventQrl: EventQRL<T>, options?: UseOnOptions) => void;
|
|
4268
4346
|
|
|
4269
4347
|
/**
|
|
4270
4348
|
* This method works like an async memoized function that runs whenever some tracked value changes
|
|
@@ -4661,7 +4739,7 @@ export declare const _VAR_PROPS: unique symbol;
|
|
|
4661
4739
|
export declare const _verifySerializable: <T>(value: T, preMessage?: string) => T;
|
|
4662
4740
|
|
|
4663
4741
|
/**
|
|
4664
|
-
* 2.0.0-beta.
|
|
4742
|
+
* 2.0.0-beta.32-dev+0e29f8a
|
|
4665
4743
|
*
|
|
4666
4744
|
* @public
|
|
4667
4745
|
*/
|