@qwik.dev/core 2.0.0-beta.43 → 2.0.0-beta.45

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.
@@ -521,7 +521,7 @@ export declare type OutOfOrderStreaming = boolean;
521
521
  /** @internal */
522
522
  declare const _OWNER: unique symbol;
523
523
 
524
- declare type PossibleEvents = Event | SimplifiedServerRequestEvent | typeof TaskEvent | typeof RenderEvent;
524
+ declare type PossibleEvents = Event | typeof TaskEvent | typeof RenderEvent;
525
525
 
526
526
  declare type Props = Record<string, unknown>;
527
527
 
@@ -856,12 +856,6 @@ declare class SignalImpl<T = any> implements Signal<T> {
856
856
  };
857
857
  }
858
858
 
859
- declare interface SimplifiedServerRequestEvent<T = unknown> {
860
- url: URL;
861
- locale: string | undefined;
862
- request: Request;
863
- }
864
-
865
859
  /** @internal */
866
860
  declare interface SSRInternalStreamWriter extends StreamWriter_2 {
867
861
  writeRootRef(id: number): ValueOrPromise<void>;
@@ -946,7 +940,8 @@ declare const enum TaskFlags {
946
940
  DIRTY = 4,
947
941
  RENDER_BLOCKING = 8,
948
942
  NEEDS_CLEANUP = 16,
949
- EVENTS_REGISTERED = 32
943
+ EVENTS_REGISTERED = 32,
944
+ EXECUTED = 64
950
945
  }
951
946
 
952
947
  /** @public */
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * @qwik.dev/core/testing 2.0.0-beta.43-dev+e478dfb
3
+ * @qwik.dev/core/testing 2.0.0-beta.45-dev+596de70
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
@@ -21640,14 +21640,16 @@ Verify that the Qwik libraries you're using are in "resolve.noExternal[]" and in
21640
21640
  // 33
21641
21641
  "Serialization Error: Cannot serialize function: {{0}}",
21642
21642
  // 34
21643
- "Cannot read .value of a clientOnly async signal during SSR. Use .loading to check state, or provide an initial value.",
21643
+ "Cannot read .value of a clientOnly async signal during SSR. Provide an initial value.",
21644
21644
  // 35
21645
21645
  "Invalid element name for SSR {{0}}",
21646
21646
  // 36
21647
21647
  "Invalid serialized Promise dependency",
21648
21648
  // 37
21649
- "Invalid serialized Uint8Array payload"
21649
+ "Invalid serialized Uint8Array payload",
21650
21650
  // 38
21651
+ "Computed signal was disposed"
21652
+ // 39
21651
21653
  ];
21652
21654
  let text = MAP[code2] ?? "";
21653
21655
  if (parts.length) {
@@ -21777,6 +21779,7 @@ var XLINK_NS = "http://www.w3.org/1999/xlink";
21777
21779
  var XML_NS = "http://www.w3.org/XML/1998/namespace";
21778
21780
  var RenderEvent = "qRender";
21779
21781
  var TaskEvent = "qTask";
21782
+ var QVisibleAttr = "q-e:qvisible";
21780
21783
  var QDefaultSlot = "";
21781
21784
  var ELEMENT_ID = "q:id";
21782
21785
  var ELEMENT_KEY = "q:key";
@@ -22501,16 +22504,35 @@ var Job = class {
22501
22504
  __publicField(this, "$promise$", null);
22502
22505
  __publicField(this, "$cleanupRequested$", false);
22503
22506
  __publicField(this, "$canWrite$", true);
22507
+ // Arrow property so the compute function can destructure `cleanup` from the context.
22508
+ __publicField(this, "cleanup", (callback) => {
22509
+ if (typeof callback === "function") {
22510
+ (this.$cleanups$ || (this.$cleanups$ = [])).push(callback);
22511
+ }
22512
+ });
22504
22513
  if (info !== void 0) {
22505
22514
  this.info = info;
22506
22515
  this.$infoVersion$ = $infoVersion$;
22507
22516
  }
22508
22517
  }
22509
22518
  get track() {
22510
- return this.$track$ || (this.$track$ = trackFn(this.$signal$, this.$signal$.$container$));
22519
+ if (!this.$track$) {
22520
+ const track = trackFn(this.$signal$, this.$signal$.$container$);
22521
+ this.$track$ = (obj, prop) => {
22522
+ if (this.$signal$.$disposed$) {
22523
+ throw qError(39 /* computedSignalDisposed */);
22524
+ }
22525
+ return track(obj, prop);
22526
+ };
22527
+ }
22528
+ return this.$track$;
22511
22529
  }
22512
22530
  get abortSignal() {
22513
- return (this.$abortController$ || (this.$abortController$ = new AbortController())).signal;
22531
+ const controller = this.$abortController$ || (this.$abortController$ = new AbortController());
22532
+ if (this.$cleanupRequested$) {
22533
+ controller.abort();
22534
+ }
22535
+ return controller.signal;
22514
22536
  }
22515
22537
  /** Backward compatible cache method for resource */
22516
22538
  cache() {
@@ -22524,11 +22546,6 @@ var Job = class {
22524
22546
  return val;
22525
22547
  }
22526
22548
  }
22527
- cleanup(callback) {
22528
- if (typeof callback === "function") {
22529
- (this.$cleanups$ || (this.$cleanups$ = [])).push(callback);
22530
- }
22531
- }
22532
22549
  };
22533
22550
  var _a2, _b;
22534
22551
  var ComputedSignalImpl = class extends (_b = SignalImpl, _a2 = _EFFECT_BACK_REF, _b) {
@@ -22573,6 +22590,9 @@ var ComputedSignalImpl = class extends (_b = SignalImpl, _a2 = _EFFECT_BACK_REF,
22573
22590
  this.invalidate();
22574
22591
  }
22575
22592
  invalidate(info) {
22593
+ if (this.$disposed$) {
22594
+ return;
22595
+ }
22576
22596
  if (arguments.length > 0) {
22577
22597
  this.$info$ = info;
22578
22598
  this.$infoVersion$ = this.$infoVersion$ === void 0 ? 1 : this.$infoVersion$ + 1;
@@ -22743,6 +22763,9 @@ var ComputedSignalImpl = class extends (_b = SignalImpl, _a2 = _EFFECT_BACK_REF,
22743
22763
  return this.$untrackedError$;
22744
22764
  }
22745
22765
  $setInvalid$(allowRecalc) {
22766
+ if (this.$disposed$) {
22767
+ return;
22768
+ }
22746
22769
  this.$flags$ |= 1 /* INVALID */;
22747
22770
  if (allowRecalc && (this.$effects$?.size || this.$loadingEffects$?.size || this.$errorEffects$?.size)) {
22748
22771
  Promise.resolve().then(() => this.$computeIfNeeded$());
@@ -22770,14 +22793,14 @@ var ComputedSignalImpl = class extends (_b = SignalImpl, _a2 = _EFFECT_BACK_REF,
22770
22793
  }
22771
22794
  /** Returns a promise resolves when the signal finished computing. */
22772
22795
  async promise() {
22773
- this.$computeIfNeeded$();
22796
+ await retryOnPromise(() => this.$computeIfNeeded$());
22774
22797
  while (this.$current$?.$promise$) {
22775
22798
  await this.$current$?.$promise$;
22776
22799
  }
22777
22800
  }
22778
22801
  /** Run the computation if needed */
22779
22802
  $computeIfNeeded$() {
22780
- if (!(this.$flags$ & 1 /* INVALID */)) {
22803
+ if (this.$disposed$ || !(this.$flags$ & 1 /* INVALID */)) {
22781
22804
  return;
22782
22805
  }
22783
22806
  if (this.$flags$ & 512 /* ASYNC_MODE */) {
@@ -22833,6 +22856,9 @@ var ComputedSignalImpl = class extends (_b = SignalImpl, _a2 = _EFFECT_BACK_REF,
22833
22856
  * instead; after the first await they must use the explicit track() too.
22834
22857
  */
22835
22858
  $invokeComputeFn$(fn, job) {
22859
+ if (this.$disposed$) {
22860
+ throw qError(39 /* computedSignalDisposed */);
22861
+ }
22836
22862
  const computeFn = fn;
22837
22863
  if (this.$flags$ & 1024 /* CTX_ARG */) {
22838
22864
  let iCtx = tryGetInvokeContext();
@@ -22883,7 +22909,7 @@ var ComputedSignalImpl = class extends (_b = SignalImpl, _a2 = _EFFECT_BACK_REF,
22883
22909
  if (!fn) {
22884
22910
  this.untrackedPending = true;
22885
22911
  fn = await this.$computeQrl$.resolve();
22886
- if (running.$abortController$?.signal.aborted) {
22912
+ if (this.$disposed$ || running.$abortController$?.signal.aborted) {
22887
22913
  DEBUG2 && log2("Computation aborted before it started");
22888
22914
  running.$promise$ = null;
22889
22915
  return;
@@ -22935,7 +22961,7 @@ var ComputedSignalImpl = class extends (_b = SignalImpl, _a2 = _EFFECT_BACK_REF,
22935
22961
  DEBUG2 && log2("Error caught in promise.catch", err);
22936
22962
  this.$setError$(running, err);
22937
22963
  }
22938
- if (isCurrent()) {
22964
+ if (isCurrent() && !this.$disposed$) {
22939
22965
  clearTimeout(this.$computationTimeoutId$);
22940
22966
  if (running.$infoVersion$ === this.$infoVersion$) {
22941
22967
  this.$info$ = void 0;
@@ -22963,7 +22989,27 @@ var ComputedSignalImpl = class extends (_b = SignalImpl, _a2 = _EFFECT_BACK_REF,
22963
22989
  this.untrackedError = error;
22964
22990
  this.untrackedValue = NEEDS_COMPUTATION;
22965
22991
  }
22966
- /** Called after SSR/unmount */
22992
+ /** Permanently stop computations; keep this cross-package name stable. */
22993
+ $dispose() {
22994
+ if (this.$disposed$) {
22995
+ return;
22996
+ }
22997
+ this.$disposed$ = true;
22998
+ this.$flags$ &= ~1 /* INVALID */;
22999
+ clearTimeout(this.$computationTimeoutId$);
23000
+ if (this.$container$) {
23001
+ clearAllEffects(this.$container$, this);
23002
+ }
23003
+ const jobs = new Set(this.$jobs$);
23004
+ if (this.$current$) {
23005
+ jobs.add(this.$current$);
23006
+ }
23007
+ for (const job of jobs) {
23008
+ job.$canWrite$ = false;
23009
+ this.$requestCleanups$(job);
23010
+ }
23011
+ }
23012
+ /** Clean computations after SSR while preserving dependencies for serialization. */
22967
23013
  async $destroy$() {
22968
23014
  clearTimeout(this.$computationTimeoutId$);
22969
23015
  const current = this.$current$;
@@ -23041,7 +23087,7 @@ var ComputedSignalImpl = class extends (_b = SignalImpl, _a2 = _EFFECT_BACK_REF,
23041
23087
  };
23042
23088
 
23043
23089
  // packages/qwik/src/core/shared/qrl/qrl-class.ts
23044
- import { isBrowser as isBrowser3, isDev as isDev19, isServer as isServer10 } from "@qwik.dev/core/build";
23090
+ import { isBrowser as isBrowser3, isDev as isDev19, isServer as isServer11 } from "@qwik.dev/core/build";
23045
23091
 
23046
23092
  // packages/qwik/src/core/shared/qrl/qrl-class-dev.ts
23047
23093
  import { isBrowser as isBrowser2 } from "@qwik.dev/core/build";
@@ -23144,7 +23190,7 @@ var setupHmr = (LazyRefClass, setGetLazyRef) => {
23144
23190
  import { p as preload } from "@qwik.dev/core/preloader";
23145
23191
 
23146
23192
  // packages/qwik/src/core/shared/serdes/inflate.ts
23147
- import { isServer as isServer9 } from "@qwik.dev/core/build";
23193
+ import { isServer as isServer10 } from "@qwik.dev/core/build";
23148
23194
 
23149
23195
  // packages/qwik/src/core/shared/serdes/qrl-to-string.ts
23150
23196
  import { isDev as isDev10 } from "@qwik.dev/core/build";
@@ -23372,6 +23418,23 @@ var NODE_DIFF_DATA_KEY = ":nodeDiff";
23372
23418
  var ERROR_DATA_KEY = ":errorData";
23373
23419
  var HOST_SIGNAL = ":signal";
23374
23420
  var INLINE_COMPONENT_DATA_KEY = ":inlineComponentData";
23421
+ var pendingQwikLoaderEvents = /* @__PURE__ */ new WeakMap();
23422
+ function queueQwikLoaderEvent(cursorData, eventName) {
23423
+ let loaderEvents = pendingQwikLoaderEvents.get(cursorData);
23424
+ if (!loaderEvents) {
23425
+ pendingQwikLoaderEvents.set(cursorData, loaderEvents = []);
23426
+ }
23427
+ if (!loaderEvents.includes(eventName)) {
23428
+ loaderEvents.push(eventName);
23429
+ }
23430
+ }
23431
+ function getPendingQwikLoaderEvents(cursorData) {
23432
+ const loaderEvents = pendingQwikLoaderEvents.get(cursorData);
23433
+ if (loaderEvents) {
23434
+ pendingQwikLoaderEvents.delete(cursorData);
23435
+ }
23436
+ return loaderEvents;
23437
+ }
23375
23438
  function setCursorPosition(container, cursorData, position) {
23376
23439
  cursorData.position = position;
23377
23440
  if (position && isCursor(position)) {
@@ -23399,6 +23462,12 @@ function mergeCursorData(newCursorData, oldCursorData) {
23399
23462
  newCursorData.afterFlushTasks = oldAfterFlushTasks;
23400
23463
  }
23401
23464
  }
23465
+ const oldLoaderEvents = getPendingQwikLoaderEvents(oldCursorData);
23466
+ if (oldLoaderEvents) {
23467
+ for (let i2 = 0; i2 < oldLoaderEvents.length; i2++) {
23468
+ queueQwikLoaderEvent(newCursorData, oldLoaderEvents[i2]);
23469
+ }
23470
+ }
23402
23471
  const oldExtraPromises = oldCursorData.extraPromises;
23403
23472
  if (oldExtraPromises && oldExtraPromises.length > 0) {
23404
23473
  const newExtraPromises = newCursorData.extraPromises;
@@ -23879,6 +23948,12 @@ function executeFlushPhase(cursor, container) {
23879
23948
  _flushJournal(journal);
23880
23949
  cursorData.journal = null;
23881
23950
  }
23951
+ const loaderEvents = getPendingQwikLoaderEvents(cursorData);
23952
+ if (loaderEvents) {
23953
+ for (let i2 = 0; i2 < loaderEvents.length; i2++) {
23954
+ registerQwikLoaderEvent(container, loaderEvents[i2]);
23955
+ }
23956
+ }
23882
23957
  executeAfterFlush(container, cursorData);
23883
23958
  }
23884
23959
  var _insertBefore = null;
@@ -24275,11 +24350,11 @@ function walkCursor(cursor, until) {
24275
24350
  );
24276
24351
  finishWalk(container, cursor, cursorData, isRunningOnServer);
24277
24352
  }
24278
- function finishWalk(container, cursor, cursorData, isServer13) {
24353
+ function finishWalk(container, cursor, cursorData, isServer14) {
24279
24354
  if (!(cursor.dirty & 1023 /* DIRTY_MASK */)) {
24280
24355
  removeCursorFromQueue(cursor, container);
24281
24356
  DEBUG4 && console.warn("walkCursor: cursor done", cursor.toString());
24282
- if (!isServer13) {
24357
+ if (!isServer14) {
24283
24358
  executeFlushPhase(cursor, container);
24284
24359
  }
24285
24360
  resolveCursorBoundaries(cursorData);
@@ -24597,7 +24672,7 @@ var runTask = (task, container, host) => {
24597
24672
  if (pendingTask) {
24598
24673
  return pendingTask;
24599
24674
  }
24600
- task.$flags$ &= ~4 /* DIRTY */;
24675
+ task.$flags$ = task.$flags$ & ~4 /* DIRTY */ | 64 /* EXECUTED */;
24601
24676
  const handleError = (reason) => {
24602
24677
  tagErrorPhase(reason, "hook" /* Hook */);
24603
24678
  container.handleError(reason, host, "hook" /* Hook */);
@@ -24620,7 +24695,7 @@ var runTask = (task, container, host) => {
24620
24695
  task.$taskPromise$ = null;
24621
24696
  }
24622
24697
  return runTask(task, container, host);
24623
- });
24698
+ }, handleError);
24624
24699
  } else {
24625
24700
  handleError(err);
24626
24701
  }
@@ -24658,11 +24733,12 @@ var isTask = (value) => {
24658
24733
  import { isDev as isDev14 } from "@qwik.dev/core/build";
24659
24734
  function _executeSsrChores(container, ssrNode) {
24660
24735
  if (!(ssrNode.flags & 1 /* Updatable */)) {
24736
+ let result = void 0;
24661
24737
  if (ssrNode.dirty & 16 /* NODE_PROPS */) {
24662
24738
  executeNodePropChore(container, ssrNode);
24663
24739
  }
24664
24740
  if (ssrNode.dirty & 32 /* COMPUTE */) {
24665
- executeCompute(ssrNode, container);
24741
+ result = executeCompute(ssrNode, container);
24666
24742
  }
24667
24743
  if (isDev14 && ssrNode.dirty & 1023 /* DIRTY_MASK */ && !(ssrNode.flags & 2 /* WarnedStreamedChore */)) {
24668
24744
  ssrNode.flags |= 2 /* WarnedStreamedChore */;
@@ -24677,7 +24753,7 @@ function _executeSsrChores(container, ssrNode) {
24677
24753
  logWarn(warningMessage);
24678
24754
  }
24679
24755
  ssrNode.dirty &= ~1023 /* DIRTY_MASK */;
24680
- return;
24756
+ return result;
24681
24757
  }
24682
24758
  let promise = null;
24683
24759
  if (ssrNode.dirty & 1 /* TASKS */) {
@@ -24732,6 +24808,9 @@ function executeNodePropChore(container, ssrNode) {
24732
24808
  }
24733
24809
  async function executeReconcileChore(container, ssrNode) {
24734
24810
  ssrNode.dirty &= ~256 /* RECONCILE */;
24811
+ if (!__EXPERIMENTAL__.each) {
24812
+ return;
24813
+ }
24735
24814
  const host = ssrNode;
24736
24815
  const props = container.getHostProp(host, ELEMENT_PROPS) || null;
24737
24816
  if (!props) {
@@ -24757,11 +24836,8 @@ async function executeReconcileChore(container, ssrNode) {
24757
24836
  });
24758
24837
  }
24759
24838
 
24760
- // packages/qwik/src/core/shared/platform/async-local-storage.ts
24761
- var getAsyncLocalStorage = () => {
24762
- const process = globalThis.process;
24763
- return process?.getBuiltinModule?.("node:async_hooks")?.AsyncLocalStorage;
24764
- };
24839
+ // packages/qwik/src/core/internal.ts
24840
+ import { getAsyncLocalStorage } from "@qwik.dev/core/async-local-storage";
24765
24841
 
24766
24842
  // packages/qwik/src/core/reactive-primitives/subscription-data.ts
24767
24843
  var SubscriptionData = class {
@@ -25160,6 +25236,9 @@ var SubscriptionPatch = class {
25160
25236
  }
25161
25237
  };
25162
25238
 
25239
+ // packages/qwik/src/core/shared/shared-container.ts
25240
+ import { isServer as isServer8 } from "@qwik.dev/core/build";
25241
+
25163
25242
  // packages/qwik/src/core/version.ts
25164
25243
  var version = globalThis.QWIK_VERSION;
25165
25244
 
@@ -26367,14 +26446,17 @@ var _SharedContainer = class {
26367
26446
  return trackSignalAndAssignHost(signal, subscriber, property, this, data);
26368
26447
  }
26369
26448
  serializationCtxFactory(NodeConstructor, DomRefConstructor, symbolToChunkResolver, writer) {
26370
- return createSerializationContext(
26371
- NodeConstructor,
26372
- DomRefConstructor,
26373
- symbolToChunkResolver,
26374
- this.setHostProp.bind(this),
26375
- this.$storeProxyMap$,
26376
- writer
26377
- );
26449
+ if (isServer8) {
26450
+ return createSerializationContext(
26451
+ NodeConstructor,
26452
+ DomRefConstructor,
26453
+ symbolToChunkResolver,
26454
+ this.setHostProp.bind(this),
26455
+ this.$storeProxyMap$,
26456
+ writer
26457
+ );
26458
+ }
26459
+ throw new Error("Serialization context is only available on the server");
26378
26460
  }
26379
26461
  $checkPendingCount$() {
26380
26462
  if (this.$pendingCount$ === 0) {
@@ -26418,7 +26500,7 @@ function getFileLocationFromJsx(jsxDev) {
26418
26500
  }
26419
26501
 
26420
26502
  // packages/qwik/src/core/shared/component-execution.ts
26421
- import { isDev as isDev16, isServer as isServer8 } from "@qwik.dev/core/build";
26503
+ import { isDev as isDev16, isServer as isServer9 } from "@qwik.dev/core/build";
26422
26504
  var executeComponent = (container, renderHost, subscriptionHost, componentQRL, props) => {
26423
26505
  const iCtx = newRenderInvokeContext(
26424
26506
  container.$locale$,
@@ -26450,7 +26532,7 @@ var executeComponent = (container, renderHost, subscriptionHost, componentQRL, p
26450
26532
  const inlineComponent = componentQRL;
26451
26533
  componentFn = () => invokeApply(iCtx, inlineComponent, [props || EMPTY_OBJ]);
26452
26534
  }
26453
- const isSsr = qTest ? isServerPlatform() : isServer8;
26535
+ const isSsr = qTest ? isServerPlatform() : isServer9;
26454
26536
  const executeComponentWithPromiseExceptionRetry = (retryCount = 0) => safeCall(
26455
26537
  () => {
26456
26538
  if (!isInlineComponent) {
@@ -26496,7 +26578,6 @@ var executeComponent = (container, renderHost, subscriptionHost, componentQRL, p
26496
26578
  function addUseOnEvents(container, jsx2, useOnEvents) {
26497
26579
  const jsxElement = findFirstElementNode(jsx2);
26498
26580
  let jsxResult = jsx2;
26499
- const qVisibleEvent = "q-e:qvisible";
26500
26581
  return maybeThen(jsxElement, (jsxElement2) => {
26501
26582
  const isHeadless = !jsxElement2;
26502
26583
  let placeholderElement = null;
@@ -26505,10 +26586,10 @@ function addUseOnEvents(container, jsx2, useOnEvents) {
26505
26586
  let targetElement = jsxElement2;
26506
26587
  let eventKey = key;
26507
26588
  if (isHeadless) {
26508
- if (key === qVisibleEvent || key.startsWith("q-d:" /* document */) || key.startsWith("q-w:" /* window */)) {
26589
+ if (key === QVisibleAttr || key.startsWith("q-d:" /* document */) || key.startsWith("q-w:" /* window */)) {
26509
26590
  if (!placeholderElement) {
26510
26591
  placeholderElement = createPlaceholderScriptNode();
26511
- const isSsr = qTest ? isServerPlatform() : isServer8;
26592
+ const isSsr = qTest ? isServerPlatform() : isServer9;
26512
26593
  if (!(isSsr && container.$deferRootPlaceholder$(placeholderElement))) {
26513
26594
  jsxResult = injectPlaceholderElement(jsxResult, placeholderElement);
26514
26595
  }
@@ -26525,7 +26606,7 @@ function addUseOnEvents(container, jsx2, useOnEvents) {
26525
26606
  }
26526
26607
  }
26527
26608
  if (targetElement) {
26528
- if (targetElement.type === "script" && key === qVisibleEvent) {
26609
+ if (targetElement.type === "script" && key === QVisibleAttr) {
26529
26610
  eventKey = "q-d:qinit";
26530
26611
  if (isDev16) {
26531
26612
  const sourceLocation = getUseOnSourceLocation(useOnEvents[key].qrls);
@@ -27369,7 +27450,7 @@ function inflateWrappedSignalValue(signal) {
27369
27450
  }
27370
27451
  function restoreEffectBackRefForConsumer(effect) {
27371
27452
  var _a5;
27372
- const isServerSide = qTest ? isServerPlatform() : isServer9;
27453
+ const isServerSide = qTest ? isServerPlatform() : isServer10;
27373
27454
  const consumerBackRef = effect.consumer;
27374
27455
  if (isServerSide && !consumerBackRef) {
27375
27456
  return;
@@ -27472,7 +27553,7 @@ var LazyRef = class {
27472
27553
  (r) => this.$ref$ = r,
27473
27554
  (err) => {
27474
27555
  const errorMessage = `qrl ${this.$symbol$} failed to load`;
27475
- if (qTest ? isServerPlatform() : isServer10) {
27556
+ if (qTest ? isServerPlatform() : isServer11) {
27476
27557
  console.error(errorMessage, err);
27477
27558
  } else if (qTest ? !isServerPlatform() : isBrowser3) {
27478
27559
  const failureKey = this.$chunk$ === null ? `symbol:${this.$symbol$}` : `chunk:${this.$chunk$}`;
@@ -27519,7 +27600,7 @@ var LazyRef = class {
27519
27600
  return this.$ref$;
27520
27601
  }
27521
27602
  };
27522
- isBrowser3 && import.meta.hot && setupHmr(LazyRef, (fn) => {
27603
+ qDev && isBrowser3 && import.meta.hot && setupHmr(LazyRef, (fn) => {
27523
27604
  getLazyRef = fn;
27524
27605
  });
27525
27606
  var QRL_STATE = /* @__PURE__ */ Symbol("qrl-state");
@@ -29065,10 +29146,15 @@ function registerEventHandlers(key, value, element, vnode, diffContext) {
29065
29146
  value
29066
29147
  );
29067
29148
  }
29068
- if (key.charAt(2) !== "e") {
29149
+ const isQVisible = scopedKebabName === "e:qvisible" /* qvisible */;
29150
+ if (key.charAt(2) !== "e" || isQVisible) {
29069
29151
  vnode_setAttr(diffContext.$journal$, vnode, key, "");
29070
29152
  }
29071
- registerQwikLoaderEvent(diffContext, scopedKebabName);
29153
+ if (isQVisible || scopedKebabName === "d:qinit" /* qinit */ || scopedKebabName === "d:qidle" /* qidle */) {
29154
+ queueQwikLoaderEvent(getCursorData(diffContext.$cursor$), scopedKebabName);
29155
+ } else {
29156
+ registerQwikLoaderEvent(diffContext.$container$, scopedKebabName);
29157
+ }
29072
29158
  }
29073
29159
  function createElementWithNamespace(diffContext, elementName) {
29074
29160
  const domParentVNode = vnode_getDomParentVNode(diffContext.$vParent$, true);
@@ -29206,12 +29292,6 @@ var patchProperty = (diffContext, vnode, key, value, currentFile) => {
29206
29292
  originalValue
29207
29293
  );
29208
29294
  };
29209
- function registerQwikLoaderEvent(diffContext, eventName) {
29210
- const qWindow = qTest ? diffContext.$container$.document.defaultView : window;
29211
- if (qWindow) {
29212
- (qWindow._qwikEv || (qWindow._qwikEv = [])).push(eventName);
29213
- }
29214
- }
29215
29295
  function retrieveChildWithKey(diffContext, nodeName, key) {
29216
29296
  let vNodeWithKey = null;
29217
29297
  if (diffContext.$vSiblings$ === null) {
@@ -29592,6 +29672,10 @@ function handleChangedProps(src, dst, propsHandler, container, triggerEffects =
29592
29672
  }
29593
29673
  const newValue = src[key];
29594
29674
  const oldValue = dst?.[key];
29675
+ if (dst && newValue !== oldValue && areDiffValuesEqual(newValue, oldValue)) {
29676
+ src[key] = oldValue;
29677
+ continue;
29678
+ }
29595
29679
  if (!dst || !(areDiffValuesEqual(newValue, oldValue) || areSignalValuesEqual(newValue, oldValue))) {
29596
29680
  if (key === "class") {
29597
29681
  if (areClassValuesEqual(newValue, oldValue)) {
@@ -29671,14 +29755,17 @@ function cleanup(container, journal, vNode, cursorRoot = null) {
29671
29755
  markVNodeDirty(container, vCursor, 128 /* CLEANUP */, cursorRoot);
29672
29756
  continue;
29673
29757
  }
29758
+ cleanupDestroyable(obj);
29674
29759
  } else if (obj instanceof ComputedSignalImpl || obj instanceof WrappedSignalImpl) {
29675
- if (!(obj.$flags$ & 4 /* PRESERVE_ON_SEQ_CLEANUP */)) {
29760
+ if (obj.$flags$ & 4 /* PRESERVE_ON_SEQ_CLEANUP */) {
29761
+ continue;
29762
+ }
29763
+ if (obj instanceof ComputedSignalImpl) {
29764
+ obj.$dispose();
29765
+ } else {
29676
29766
  clearAllEffects(container, obj);
29677
29767
  }
29678
29768
  }
29679
- if (objIsTask || obj instanceof ComputedSignalImpl && (obj.$flags$ & 512 /* ASYNC_MODE */ || obj.$current$)) {
29680
- cleanupDestroyable(obj);
29681
- }
29682
29769
  }
29683
29770
  }
29684
29771
  }
@@ -30190,7 +30277,10 @@ function executeComponentChore(vNode, container, journal, cursor) {
30190
30277
  OnRenderProp
30191
30278
  );
30192
30279
  if (componentQRL && !componentQRL.resolved) {
30193
- return componentQRL.resolve();
30280
+ return componentQRL.resolve().catch((error) => {
30281
+ vNode.dirty &= ~4 /* COMPONENT */;
30282
+ throw error;
30283
+ });
30194
30284
  }
30195
30285
  vNode.dirty &= ~4 /* COMPONENT */;
30196
30286
  if (!componentQRL) {
@@ -30336,6 +30426,9 @@ function executeCompute(vNode, container) {
30336
30426
  }
30337
30427
  function executeReconcile(vNode, container, journal, cursor) {
30338
30428
  vNode.dirty &= ~256 /* RECONCILE */;
30429
+ if (!__EXPERIMENTAL__.each) {
30430
+ return;
30431
+ }
30339
30432
  const host = vNode;
30340
30433
  const props = container.getHostProp(host, ELEMENT_PROPS) || null;
30341
30434
  if (!props) {
@@ -31513,11 +31606,12 @@ var DomContainer = class extends _SharedContainer {
31513
31606
  };
31514
31607
 
31515
31608
  // packages/qwik/src/core/use/use-locale.ts
31516
- import { isServer as isServer11 } from "@qwik.dev/core/build";
31609
+ import { getAsyncLocalStorage as getAsyncLocalStorage2 } from "@qwik.dev/core/async-local-storage";
31610
+ import { isServer as isServer12 } from "@qwik.dev/core/build";
31517
31611
  var _locale = void 0;
31518
31612
  var localAsyncStore;
31519
- if (isServer11) {
31520
- const AsyncLocalStorage = getAsyncLocalStorage();
31613
+ if (isServer12) {
31614
+ const AsyncLocalStorage = getAsyncLocalStorage2();
31521
31615
  if (AsyncLocalStorage) {
31522
31616
  localAsyncStore = new AsyncLocalStorage();
31523
31617
  }
@@ -31568,12 +31662,11 @@ function newRenderInvokeContext(locale, hostElement, container) {
31568
31662
  return ctx;
31569
31663
  }
31570
31664
  function newInvokeContext(locale, hostElement, event) {
31571
- const $locale$ = locale || (event && isObject(event) && "locale" in event ? event.locale : void 0);
31572
31665
  const ctx = {
31573
31666
  $hostElement$: hostElement,
31574
31667
  $event$: event,
31575
31668
  $effectSubscriber$: void 0,
31576
- $locale$,
31669
+ $locale$: locale,
31577
31670
  $container$: void 0
31578
31671
  };
31579
31672
  seal(ctx);
@@ -31619,7 +31712,7 @@ var trackSignalAndAssignHost = (value, host, property, container, data) => {
31619
31712
  };
31620
31713
 
31621
31714
  // packages/qwik/src/core/reactive-primitives/impl/store.ts
31622
- import { isDev as isDev24, isServer as isServer12 } from "@qwik.dev/core/build";
31715
+ import { isDev as isDev24, isServer as isServer13 } from "@qwik.dev/core/build";
31623
31716
  var DEBUG6 = false;
31624
31717
  var log4 = (...args) => console.log("STORE", ...args.map(qwikDebugToString));
31625
31718
  var getStoreHandler = (value) => {
@@ -31794,7 +31887,7 @@ function addStoreEffect(target, prop, store, effectSubscription, renderContainer
31794
31887
  effects = /* @__PURE__ */ new Set();
31795
31888
  effectsMap.set(prop, effects);
31796
31889
  }
31797
- const isOnServer = qTest ? isServerPlatform() : isServer12;
31890
+ const isOnServer = qTest ? isServerPlatform() : isServer13;
31798
31891
  const shouldRecordExternalRootEffect = __EXPERIMENTAL__.suspense && store instanceof StoreHandler2 && isOnServer;
31799
31892
  ensureContainsSubscription(effects, effectSubscription);
31800
31893
  ensureContainsBackRef(effectSubscription, target);
@@ -32463,6 +32556,12 @@ var vnode_setAttr = (journal, vNode, key, value, scopedStyleIdPrefix = null) =>
32463
32556
  );
32464
32557
  }
32465
32558
  };
32559
+ var registerQwikLoaderEvent = (container, eventName) => {
32560
+ const win = qTest ? container.document.defaultView : window;
32561
+ if (win) {
32562
+ (win._qwikEv || (win._qwikEv = [])).push(eventName);
32563
+ }
32564
+ };
32466
32565
  var vnode_ensureElementKeyInflated = (vnode) => {
32467
32566
  if (vnode.key) {
32468
32567
  return;
@@ -34336,7 +34435,13 @@ expect.extend({
34336
34435
  const { isNot } = this;
34337
34436
  const container = getContainerElement(received);
34338
34437
  const isSsr = typeof isCsr === "boolean" ? !isCsr : isSsrRenderer(container);
34339
- const diffs = diffJsxVNode(received, expected, [], container, isSsr);
34438
+ const diffs = diffJsxVNode(
34439
+ received,
34440
+ expected,
34441
+ [],
34442
+ container,
34443
+ isSsr
34444
+ );
34340
34445
  return {
34341
34446
  pass: isNot ? diffs.length !== 0 : diffs.length === 0,
34342
34447
  message: () => diffs.join("\n")
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@qwik.dev/core/testing",
3
- "version": "2.0.0-beta.43-dev+e478dfb",
3
+ "version": "2.0.0-beta.45-dev+596de70",
4
4
  "main": "index.mjs",
5
5
  "types": "index.d.ts",
6
6
  "private": true,