@qwik.dev/core 2.0.0-beta.42 → 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.42-dev+3473a49
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
@@ -21558,9 +21558,6 @@ var isString = (v) => {
21558
21558
  var isFunction = (v) => {
21559
21559
  return typeof v === "function";
21560
21560
  };
21561
- var isPrimitiveOrNullUndefined = (v) => {
21562
- return typeof v !== "object" && typeof v !== "function" || v === null || v === void 0;
21563
- };
21564
21561
 
21565
21562
  // packages/qwik/src/core/shared/error/error.ts
21566
21563
  var baseUrl = "https://qwikdev-build-v2.qwik-8nx.pages.dev/docs/errors/#q";
@@ -21643,14 +21640,16 @@ Verify that the Qwik libraries you're using are in "resolve.noExternal[]" and in
21643
21640
  // 33
21644
21641
  "Serialization Error: Cannot serialize function: {{0}}",
21645
21642
  // 34
21646
- "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.",
21647
21644
  // 35
21648
21645
  "Invalid element name for SSR {{0}}",
21649
21646
  // 36
21650
21647
  "Invalid serialized Promise dependency",
21651
21648
  // 37
21652
- "Invalid serialized Uint8Array payload"
21649
+ "Invalid serialized Uint8Array payload",
21653
21650
  // 38
21651
+ "Computed signal was disposed"
21652
+ // 39
21654
21653
  ];
21655
21654
  let text = MAP[code2] ?? "";
21656
21655
  if (parts.length) {
@@ -21780,10 +21779,12 @@ var XLINK_NS = "http://www.w3.org/1999/xlink";
21780
21779
  var XML_NS = "http://www.w3.org/XML/1998/namespace";
21781
21780
  var RenderEvent = "qRender";
21782
21781
  var TaskEvent = "qTask";
21782
+ var QVisibleAttr = "q-e:qvisible";
21783
21783
  var QDefaultSlot = "";
21784
21784
  var ELEMENT_ID = "q:id";
21785
21785
  var ELEMENT_KEY = "q:key";
21786
21786
  var ELEMENT_PROPS = "q:props";
21787
+ var USE_ON_PLACEHOLDER_KEY = ":useOn";
21787
21788
  var ELEMENT_SEQ = "q:seq";
21788
21789
  var ELEMENT_SEQ_IDX = "q:seqIdx";
21789
21790
  var ELEMENT_BACKPATCH_DATA = "qwik/backpatch";
@@ -22503,16 +22504,35 @@ var Job = class {
22503
22504
  __publicField(this, "$promise$", null);
22504
22505
  __publicField(this, "$cleanupRequested$", false);
22505
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
+ });
22506
22513
  if (info !== void 0) {
22507
22514
  this.info = info;
22508
22515
  this.$infoVersion$ = $infoVersion$;
22509
22516
  }
22510
22517
  }
22511
22518
  get track() {
22512
- 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$;
22513
22529
  }
22514
22530
  get abortSignal() {
22515
- 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;
22516
22536
  }
22517
22537
  /** Backward compatible cache method for resource */
22518
22538
  cache() {
@@ -22526,11 +22546,6 @@ var Job = class {
22526
22546
  return val;
22527
22547
  }
22528
22548
  }
22529
- cleanup(callback) {
22530
- if (typeof callback === "function") {
22531
- (this.$cleanups$ || (this.$cleanups$ = [])).push(callback);
22532
- }
22533
- }
22534
22549
  };
22535
22550
  var _a2, _b;
22536
22551
  var ComputedSignalImpl = class extends (_b = SignalImpl, _a2 = _EFFECT_BACK_REF, _b) {
@@ -22575,6 +22590,9 @@ var ComputedSignalImpl = class extends (_b = SignalImpl, _a2 = _EFFECT_BACK_REF,
22575
22590
  this.invalidate();
22576
22591
  }
22577
22592
  invalidate(info) {
22593
+ if (this.$disposed$) {
22594
+ return;
22595
+ }
22578
22596
  if (arguments.length > 0) {
22579
22597
  this.$info$ = info;
22580
22598
  this.$infoVersion$ = this.$infoVersion$ === void 0 ? 1 : this.$infoVersion$ + 1;
@@ -22745,6 +22763,9 @@ var ComputedSignalImpl = class extends (_b = SignalImpl, _a2 = _EFFECT_BACK_REF,
22745
22763
  return this.$untrackedError$;
22746
22764
  }
22747
22765
  $setInvalid$(allowRecalc) {
22766
+ if (this.$disposed$) {
22767
+ return;
22768
+ }
22748
22769
  this.$flags$ |= 1 /* INVALID */;
22749
22770
  if (allowRecalc && (this.$effects$?.size || this.$loadingEffects$?.size || this.$errorEffects$?.size)) {
22750
22771
  Promise.resolve().then(() => this.$computeIfNeeded$());
@@ -22772,14 +22793,14 @@ var ComputedSignalImpl = class extends (_b = SignalImpl, _a2 = _EFFECT_BACK_REF,
22772
22793
  }
22773
22794
  /** Returns a promise resolves when the signal finished computing. */
22774
22795
  async promise() {
22775
- this.$computeIfNeeded$();
22796
+ await retryOnPromise(() => this.$computeIfNeeded$());
22776
22797
  while (this.$current$?.$promise$) {
22777
22798
  await this.$current$?.$promise$;
22778
22799
  }
22779
22800
  }
22780
22801
  /** Run the computation if needed */
22781
22802
  $computeIfNeeded$() {
22782
- if (!(this.$flags$ & 1 /* INVALID */)) {
22803
+ if (this.$disposed$ || !(this.$flags$ & 1 /* INVALID */)) {
22783
22804
  return;
22784
22805
  }
22785
22806
  if (this.$flags$ & 512 /* ASYNC_MODE */) {
@@ -22835,6 +22856,9 @@ var ComputedSignalImpl = class extends (_b = SignalImpl, _a2 = _EFFECT_BACK_REF,
22835
22856
  * instead; after the first await they must use the explicit track() too.
22836
22857
  */
22837
22858
  $invokeComputeFn$(fn, job) {
22859
+ if (this.$disposed$) {
22860
+ throw qError(39 /* computedSignalDisposed */);
22861
+ }
22838
22862
  const computeFn = fn;
22839
22863
  if (this.$flags$ & 1024 /* CTX_ARG */) {
22840
22864
  let iCtx = tryGetInvokeContext();
@@ -22885,7 +22909,7 @@ var ComputedSignalImpl = class extends (_b = SignalImpl, _a2 = _EFFECT_BACK_REF,
22885
22909
  if (!fn) {
22886
22910
  this.untrackedPending = true;
22887
22911
  fn = await this.$computeQrl$.resolve();
22888
- if (running.$abortController$?.signal.aborted) {
22912
+ if (this.$disposed$ || running.$abortController$?.signal.aborted) {
22889
22913
  DEBUG2 && log2("Computation aborted before it started");
22890
22914
  running.$promise$ = null;
22891
22915
  return;
@@ -22937,7 +22961,7 @@ var ComputedSignalImpl = class extends (_b = SignalImpl, _a2 = _EFFECT_BACK_REF,
22937
22961
  DEBUG2 && log2("Error caught in promise.catch", err);
22938
22962
  this.$setError$(running, err);
22939
22963
  }
22940
- if (isCurrent()) {
22964
+ if (isCurrent() && !this.$disposed$) {
22941
22965
  clearTimeout(this.$computationTimeoutId$);
22942
22966
  if (running.$infoVersion$ === this.$infoVersion$) {
22943
22967
  this.$info$ = void 0;
@@ -22965,7 +22989,27 @@ var ComputedSignalImpl = class extends (_b = SignalImpl, _a2 = _EFFECT_BACK_REF,
22965
22989
  this.untrackedError = error;
22966
22990
  this.untrackedValue = NEEDS_COMPUTATION;
22967
22991
  }
22968
- /** 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. */
22969
23013
  async $destroy$() {
22970
23014
  clearTimeout(this.$computationTimeoutId$);
22971
23015
  const current = this.$current$;
@@ -23043,7 +23087,7 @@ var ComputedSignalImpl = class extends (_b = SignalImpl, _a2 = _EFFECT_BACK_REF,
23043
23087
  };
23044
23088
 
23045
23089
  // packages/qwik/src/core/shared/qrl/qrl-class.ts
23046
- 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";
23047
23091
 
23048
23092
  // packages/qwik/src/core/shared/qrl/qrl-class-dev.ts
23049
23093
  import { isBrowser as isBrowser2 } from "@qwik.dev/core/build";
@@ -23146,7 +23190,7 @@ var setupHmr = (LazyRefClass, setGetLazyRef) => {
23146
23190
  import { p as preload } from "@qwik.dev/core/preloader";
23147
23191
 
23148
23192
  // packages/qwik/src/core/shared/serdes/inflate.ts
23149
- import { isServer as isServer9 } from "@qwik.dev/core/build";
23193
+ import { isServer as isServer10 } from "@qwik.dev/core/build";
23150
23194
 
23151
23195
  // packages/qwik/src/core/shared/serdes/qrl-to-string.ts
23152
23196
  import { isDev as isDev10 } from "@qwik.dev/core/build";
@@ -23374,6 +23418,23 @@ var NODE_DIFF_DATA_KEY = ":nodeDiff";
23374
23418
  var ERROR_DATA_KEY = ":errorData";
23375
23419
  var HOST_SIGNAL = ":signal";
23376
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
+ }
23377
23438
  function setCursorPosition(container, cursorData, position) {
23378
23439
  cursorData.position = position;
23379
23440
  if (position && isCursor(position)) {
@@ -23401,6 +23462,12 @@ function mergeCursorData(newCursorData, oldCursorData) {
23401
23462
  newCursorData.afterFlushTasks = oldAfterFlushTasks;
23402
23463
  }
23403
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
+ }
23404
23471
  const oldExtraPromises = oldCursorData.extraPromises;
23405
23472
  if (oldExtraPromises && oldExtraPromises.length > 0) {
23406
23473
  const newExtraPromises = newCursorData.extraPromises;
@@ -23881,6 +23948,12 @@ function executeFlushPhase(cursor, container) {
23881
23948
  _flushJournal(journal);
23882
23949
  cursorData.journal = null;
23883
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
+ }
23884
23957
  executeAfterFlush(container, cursorData);
23885
23958
  }
23886
23959
  var _insertBefore = null;
@@ -24277,11 +24350,11 @@ function walkCursor(cursor, until) {
24277
24350
  );
24278
24351
  finishWalk(container, cursor, cursorData, isRunningOnServer);
24279
24352
  }
24280
- function finishWalk(container, cursor, cursorData, isServer13) {
24353
+ function finishWalk(container, cursor, cursorData, isServer14) {
24281
24354
  if (!(cursor.dirty & 1023 /* DIRTY_MASK */)) {
24282
24355
  removeCursorFromQueue(cursor, container);
24283
24356
  DEBUG4 && console.warn("walkCursor: cursor done", cursor.toString());
24284
- if (!isServer13) {
24357
+ if (!isServer14) {
24285
24358
  executeFlushPhase(cursor, container);
24286
24359
  }
24287
24360
  resolveCursorBoundaries(cursorData);
@@ -24599,7 +24672,7 @@ var runTask = (task, container, host) => {
24599
24672
  if (pendingTask) {
24600
24673
  return pendingTask;
24601
24674
  }
24602
- task.$flags$ &= ~4 /* DIRTY */;
24675
+ task.$flags$ = task.$flags$ & ~4 /* DIRTY */ | 64 /* EXECUTED */;
24603
24676
  const handleError = (reason) => {
24604
24677
  tagErrorPhase(reason, "hook" /* Hook */);
24605
24678
  container.handleError(reason, host, "hook" /* Hook */);
@@ -24622,7 +24695,7 @@ var runTask = (task, container, host) => {
24622
24695
  task.$taskPromise$ = null;
24623
24696
  }
24624
24697
  return runTask(task, container, host);
24625
- });
24698
+ }, handleError);
24626
24699
  } else {
24627
24700
  handleError(err);
24628
24701
  }
@@ -24660,11 +24733,12 @@ var isTask = (value) => {
24660
24733
  import { isDev as isDev14 } from "@qwik.dev/core/build";
24661
24734
  function _executeSsrChores(container, ssrNode) {
24662
24735
  if (!(ssrNode.flags & 1 /* Updatable */)) {
24736
+ let result = void 0;
24663
24737
  if (ssrNode.dirty & 16 /* NODE_PROPS */) {
24664
24738
  executeNodePropChore(container, ssrNode);
24665
24739
  }
24666
24740
  if (ssrNode.dirty & 32 /* COMPUTE */) {
24667
- executeCompute(ssrNode, container);
24741
+ result = executeCompute(ssrNode, container);
24668
24742
  }
24669
24743
  if (isDev14 && ssrNode.dirty & 1023 /* DIRTY_MASK */ && !(ssrNode.flags & 2 /* WarnedStreamedChore */)) {
24670
24744
  ssrNode.flags |= 2 /* WarnedStreamedChore */;
@@ -24679,7 +24753,7 @@ function _executeSsrChores(container, ssrNode) {
24679
24753
  logWarn(warningMessage);
24680
24754
  }
24681
24755
  ssrNode.dirty &= ~1023 /* DIRTY_MASK */;
24682
- return;
24756
+ return result;
24683
24757
  }
24684
24758
  let promise = null;
24685
24759
  if (ssrNode.dirty & 1 /* TASKS */) {
@@ -24734,6 +24808,9 @@ function executeNodePropChore(container, ssrNode) {
24734
24808
  }
24735
24809
  async function executeReconcileChore(container, ssrNode) {
24736
24810
  ssrNode.dirty &= ~256 /* RECONCILE */;
24811
+ if (!__EXPERIMENTAL__.each) {
24812
+ return;
24813
+ }
24737
24814
  const host = ssrNode;
24738
24815
  const props = container.getHostProp(host, ELEMENT_PROPS) || null;
24739
24816
  if (!props) {
@@ -24759,11 +24836,8 @@ async function executeReconcileChore(container, ssrNode) {
24759
24836
  });
24760
24837
  }
24761
24838
 
24762
- // packages/qwik/src/core/shared/platform/async-local-storage.ts
24763
- var getAsyncLocalStorage = () => {
24764
- const process = globalThis.process;
24765
- return process?.getBuiltinModule?.("node:async_hooks")?.AsyncLocalStorage;
24766
- };
24839
+ // packages/qwik/src/core/internal.ts
24840
+ import { getAsyncLocalStorage } from "@qwik.dev/core/async-local-storage";
24767
24841
 
24768
24842
  // packages/qwik/src/core/reactive-primitives/subscription-data.ts
24769
24843
  var SubscriptionData = class {
@@ -25162,6 +25236,9 @@ var SubscriptionPatch = class {
25162
25236
  }
25163
25237
  };
25164
25238
 
25239
+ // packages/qwik/src/core/shared/shared-container.ts
25240
+ import { isServer as isServer8 } from "@qwik.dev/core/build";
25241
+
25165
25242
  // packages/qwik/src/core/version.ts
25166
25243
  var version = globalThis.QWIK_VERSION;
25167
25244
 
@@ -26369,14 +26446,17 @@ var _SharedContainer = class {
26369
26446
  return trackSignalAndAssignHost(signal, subscriber, property, this, data);
26370
26447
  }
26371
26448
  serializationCtxFactory(NodeConstructor, DomRefConstructor, symbolToChunkResolver, writer) {
26372
- return createSerializationContext(
26373
- NodeConstructor,
26374
- DomRefConstructor,
26375
- symbolToChunkResolver,
26376
- this.setHostProp.bind(this),
26377
- this.$storeProxyMap$,
26378
- writer
26379
- );
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");
26380
26460
  }
26381
26461
  $checkPendingCount$() {
26382
26462
  if (this.$pendingCount$ === 0) {
@@ -26420,7 +26500,7 @@ function getFileLocationFromJsx(jsxDev) {
26420
26500
  }
26421
26501
 
26422
26502
  // packages/qwik/src/core/shared/component-execution.ts
26423
- 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";
26424
26504
  var executeComponent = (container, renderHost, subscriptionHost, componentQRL, props) => {
26425
26505
  const iCtx = newRenderInvokeContext(
26426
26506
  container.$locale$,
@@ -26452,7 +26532,7 @@ var executeComponent = (container, renderHost, subscriptionHost, componentQRL, p
26452
26532
  const inlineComponent = componentQRL;
26453
26533
  componentFn = () => invokeApply(iCtx, inlineComponent, [props || EMPTY_OBJ]);
26454
26534
  }
26455
- const isSsr = qTest ? isServerPlatform() : isServer8;
26535
+ const isSsr = qTest ? isServerPlatform() : isServer9;
26456
26536
  const executeComponentWithPromiseExceptionRetry = (retryCount = 0) => safeCall(
26457
26537
  () => {
26458
26538
  if (!isInlineComponent) {
@@ -26498,7 +26578,6 @@ var executeComponent = (container, renderHost, subscriptionHost, componentQRL, p
26498
26578
  function addUseOnEvents(container, jsx2, useOnEvents) {
26499
26579
  const jsxElement = findFirstElementNode(jsx2);
26500
26580
  let jsxResult = jsx2;
26501
- const qVisibleEvent = "q-e:qvisible";
26502
26581
  return maybeThen(jsxElement, (jsxElement2) => {
26503
26582
  const isHeadless = !jsxElement2;
26504
26583
  let placeholderElement = null;
@@ -26507,10 +26586,10 @@ function addUseOnEvents(container, jsx2, useOnEvents) {
26507
26586
  let targetElement = jsxElement2;
26508
26587
  let eventKey = key;
26509
26588
  if (isHeadless) {
26510
- 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 */)) {
26511
26590
  if (!placeholderElement) {
26512
26591
  placeholderElement = createPlaceholderScriptNode();
26513
- const isSsr = qTest ? isServerPlatform() : isServer8;
26592
+ const isSsr = qTest ? isServerPlatform() : isServer9;
26514
26593
  if (!(isSsr && container.$deferRootPlaceholder$(placeholderElement))) {
26515
26594
  jsxResult = injectPlaceholderElement(jsxResult, placeholderElement);
26516
26595
  }
@@ -26527,7 +26606,7 @@ function addUseOnEvents(container, jsx2, useOnEvents) {
26527
26606
  }
26528
26607
  }
26529
26608
  if (targetElement) {
26530
- if (targetElement.type === "script" && key === qVisibleEvent) {
26609
+ if (targetElement.type === "script" && key === QVisibleAttr) {
26531
26610
  eventKey = "q-d:qinit";
26532
26611
  if (isDev16) {
26533
26612
  const sourceLocation = getUseOnSourceLocation(useOnEvents[key].qrls);
@@ -26615,30 +26694,10 @@ function findFirstElementNode(jsx2) {
26615
26694
  return null;
26616
26695
  }
26617
26696
  function injectPlaceholderElement(jsx2, placeholder) {
26618
- if (isJSXNode(jsx2)) {
26619
- if (jsx2.type !== Fragment) {
26620
- return _jsxSorted(Fragment, null, null, [jsx2, placeholder], 0, null);
26621
- }
26622
- if (jsx2.children == null) {
26623
- jsx2.children = placeholder;
26624
- } else if (isArray(jsx2.children)) {
26625
- jsx2.children.push(placeholder);
26626
- } else {
26627
- jsx2.children = [jsx2.children, placeholder];
26628
- }
26629
- return jsx2;
26630
- }
26631
- if (isPrimitiveOrNullUndefined(jsx2)) {
26632
- return _jsxSorted(Fragment, null, null, [jsx2, placeholder], 0, null);
26633
- }
26634
- if (isArray(jsx2) && jsx2.length > 0) {
26635
- injectPlaceholderElement(jsx2[0], placeholder);
26636
- return jsx2;
26637
- }
26638
- return jsx2;
26697
+ return isArray(jsx2) ? [...jsx2, placeholder] : [jsx2, placeholder];
26639
26698
  }
26640
26699
  function createPlaceholderScriptNode() {
26641
- return new JSXNodeImpl("script", null, { hidden: "" }, null, 0, null);
26700
+ return new JSXNodeImpl("script", null, { hidden: "" }, null, 0, USE_ON_PLACEHOLDER_KEY);
26642
26701
  }
26643
26702
 
26644
26703
  // packages/qwik/src/core/shared/serdes/allocate.ts
@@ -27391,7 +27450,7 @@ function inflateWrappedSignalValue(signal) {
27391
27450
  }
27392
27451
  function restoreEffectBackRefForConsumer(effect) {
27393
27452
  var _a5;
27394
- const isServerSide = qTest ? isServerPlatform() : isServer9;
27453
+ const isServerSide = qTest ? isServerPlatform() : isServer10;
27395
27454
  const consumerBackRef = effect.consumer;
27396
27455
  if (isServerSide && !consumerBackRef) {
27397
27456
  return;
@@ -27494,7 +27553,7 @@ var LazyRef = class {
27494
27553
  (r) => this.$ref$ = r,
27495
27554
  (err) => {
27496
27555
  const errorMessage = `qrl ${this.$symbol$} failed to load`;
27497
- if (qTest ? isServerPlatform() : isServer10) {
27556
+ if (qTest ? isServerPlatform() : isServer11) {
27498
27557
  console.error(errorMessage, err);
27499
27558
  } else if (qTest ? !isServerPlatform() : isBrowser3) {
27500
27559
  const failureKey = this.$chunk$ === null ? `symbol:${this.$symbol$}` : `chunk:${this.$chunk$}`;
@@ -27541,7 +27600,7 @@ var LazyRef = class {
27541
27600
  return this.$ref$;
27542
27601
  }
27543
27602
  };
27544
- isBrowser3 && import.meta.hot && setupHmr(LazyRef, (fn) => {
27603
+ qDev && isBrowser3 && import.meta.hot && setupHmr(LazyRef, (fn) => {
27545
27604
  getLazyRef = fn;
27546
27605
  });
27547
27606
  var QRL_STATE = /* @__PURE__ */ Symbol("qrl-state");
@@ -29087,10 +29146,15 @@ function registerEventHandlers(key, value, element, vnode, diffContext) {
29087
29146
  value
29088
29147
  );
29089
29148
  }
29090
- if (key.charAt(2) !== "e") {
29149
+ const isQVisible = scopedKebabName === "e:qvisible" /* qvisible */;
29150
+ if (key.charAt(2) !== "e" || isQVisible) {
29091
29151
  vnode_setAttr(diffContext.$journal$, vnode, key, "");
29092
29152
  }
29093
- 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
+ }
29094
29158
  }
29095
29159
  function createElementWithNamespace(diffContext, elementName) {
29096
29160
  const domParentVNode = vnode_getDomParentVNode(diffContext.$vParent$, true);
@@ -29228,12 +29292,6 @@ var patchProperty = (diffContext, vnode, key, value, currentFile) => {
29228
29292
  originalValue
29229
29293
  );
29230
29294
  };
29231
- function registerQwikLoaderEvent(diffContext, eventName) {
29232
- const qWindow = qTest ? diffContext.$container$.document.defaultView : window;
29233
- if (qWindow) {
29234
- (qWindow._qwikEv || (qWindow._qwikEv = [])).push(eventName);
29235
- }
29236
- }
29237
29295
  function retrieveChildWithKey(diffContext, nodeName, key) {
29238
29296
  let vNodeWithKey = null;
29239
29297
  if (diffContext.$vSiblings$ === null) {
@@ -29614,6 +29672,10 @@ function handleChangedProps(src, dst, propsHandler, container, triggerEffects =
29614
29672
  }
29615
29673
  const newValue = src[key];
29616
29674
  const oldValue = dst?.[key];
29675
+ if (dst && newValue !== oldValue && areDiffValuesEqual(newValue, oldValue)) {
29676
+ src[key] = oldValue;
29677
+ continue;
29678
+ }
29617
29679
  if (!dst || !(areDiffValuesEqual(newValue, oldValue) || areSignalValuesEqual(newValue, oldValue))) {
29618
29680
  if (key === "class") {
29619
29681
  if (areClassValuesEqual(newValue, oldValue)) {
@@ -29686,18 +29748,24 @@ function cleanup(container, journal, vNode, cursorRoot = null) {
29686
29748
  const obj = seq[i2];
29687
29749
  if (isObject(obj)) {
29688
29750
  const objIsTask = isTask(obj);
29689
- if (objIsTask && obj.$flags$ & 1 /* VISIBLE_TASK */) {
29690
- obj.$flags$ |= 16 /* NEEDS_CLEANUP */;
29691
- markVNodeDirty(container, vCursor, 128 /* CLEANUP */, cursorRoot);
29692
- continue;
29751
+ if (objIsTask) {
29752
+ clearAllEffects(container, obj);
29753
+ if (obj.$flags$ & 1 /* VISIBLE_TASK */) {
29754
+ obj.$flags$ |= 16 /* NEEDS_CLEANUP */;
29755
+ markVNodeDirty(container, vCursor, 128 /* CLEANUP */, cursorRoot);
29756
+ continue;
29757
+ }
29758
+ cleanupDestroyable(obj);
29693
29759
  } else if (obj instanceof ComputedSignalImpl || obj instanceof WrappedSignalImpl) {
29694
- 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 {
29695
29766
  clearAllEffects(container, obj);
29696
29767
  }
29697
29768
  }
29698
- if (objIsTask || obj instanceof ComputedSignalImpl && (obj.$flags$ & 512 /* ASYNC_MODE */ || obj.$current$)) {
29699
- cleanupDestroyable(obj);
29700
- }
29701
29769
  }
29702
29770
  }
29703
29771
  }
@@ -30209,7 +30277,10 @@ function executeComponentChore(vNode, container, journal, cursor) {
30209
30277
  OnRenderProp
30210
30278
  );
30211
30279
  if (componentQRL && !componentQRL.resolved) {
30212
- return componentQRL.resolve();
30280
+ return componentQRL.resolve().catch((error) => {
30281
+ vNode.dirty &= ~4 /* COMPONENT */;
30282
+ throw error;
30283
+ });
30213
30284
  }
30214
30285
  vNode.dirty &= ~4 /* COMPONENT */;
30215
30286
  if (!componentQRL) {
@@ -30355,6 +30426,9 @@ function executeCompute(vNode, container) {
30355
30426
  }
30356
30427
  function executeReconcile(vNode, container, journal, cursor) {
30357
30428
  vNode.dirty &= ~256 /* RECONCILE */;
30429
+ if (!__EXPERIMENTAL__.each) {
30430
+ return;
30431
+ }
30358
30432
  const host = vNode;
30359
30433
  const props = container.getHostProp(host, ELEMENT_PROPS) || null;
30360
30434
  if (!props) {
@@ -31368,7 +31442,8 @@ var DomContainer = class extends _SharedContainer {
31368
31442
  if (!__EXPERIMENTAL__.errorBoundary) {
31369
31443
  const errorStore = host && this.resolveContext(host, ERROR_CONTEXT);
31370
31444
  if (!errorStore) {
31371
- throw err;
31445
+ logErrorAndThrowAsync(err);
31446
+ return;
31372
31447
  }
31373
31448
  errorStore.error = err;
31374
31449
  return;
@@ -31531,11 +31606,12 @@ var DomContainer = class extends _SharedContainer {
31531
31606
  };
31532
31607
 
31533
31608
  // packages/qwik/src/core/use/use-locale.ts
31534
- 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";
31535
31611
  var _locale = void 0;
31536
31612
  var localAsyncStore;
31537
- if (isServer11) {
31538
- const AsyncLocalStorage = getAsyncLocalStorage();
31613
+ if (isServer12) {
31614
+ const AsyncLocalStorage = getAsyncLocalStorage2();
31539
31615
  if (AsyncLocalStorage) {
31540
31616
  localAsyncStore = new AsyncLocalStorage();
31541
31617
  }
@@ -31586,12 +31662,11 @@ function newRenderInvokeContext(locale, hostElement, container) {
31586
31662
  return ctx;
31587
31663
  }
31588
31664
  function newInvokeContext(locale, hostElement, event) {
31589
- const $locale$ = locale || (event && isObject(event) && "locale" in event ? event.locale : void 0);
31590
31665
  const ctx = {
31591
31666
  $hostElement$: hostElement,
31592
31667
  $event$: event,
31593
31668
  $effectSubscriber$: void 0,
31594
- $locale$,
31669
+ $locale$: locale,
31595
31670
  $container$: void 0
31596
31671
  };
31597
31672
  seal(ctx);
@@ -31637,7 +31712,7 @@ var trackSignalAndAssignHost = (value, host, property, container, data) => {
31637
31712
  };
31638
31713
 
31639
31714
  // packages/qwik/src/core/reactive-primitives/impl/store.ts
31640
- 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";
31641
31716
  var DEBUG6 = false;
31642
31717
  var log4 = (...args) => console.log("STORE", ...args.map(qwikDebugToString));
31643
31718
  var getStoreHandler = (value) => {
@@ -31812,7 +31887,7 @@ function addStoreEffect(target, prop, store, effectSubscription, renderContainer
31812
31887
  effects = /* @__PURE__ */ new Set();
31813
31888
  effectsMap.set(prop, effects);
31814
31889
  }
31815
- const isOnServer = qTest ? isServerPlatform() : isServer12;
31890
+ const isOnServer = qTest ? isServerPlatform() : isServer13;
31816
31891
  const shouldRecordExternalRootEffect = __EXPERIMENTAL__.suspense && store instanceof StoreHandler2 && isOnServer;
31817
31892
  ensureContainsSubscription(effects, effectSubscription);
31818
31893
  ensureContainsBackRef(effectSubscription, target);
@@ -32481,6 +32556,12 @@ var vnode_setAttr = (journal, vNode, key, value, scopedStyleIdPrefix = null) =>
32481
32556
  );
32482
32557
  }
32483
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
+ };
32484
32565
  var vnode_ensureElementKeyInflated = (vnode) => {
32485
32566
  if (vnode.key) {
32486
32567
  return;
@@ -34354,7 +34435,13 @@ expect.extend({
34354
34435
  const { isNot } = this;
34355
34436
  const container = getContainerElement(received);
34356
34437
  const isSsr = typeof isCsr === "boolean" ? !isCsr : isSsrRenderer(container);
34357
- const diffs = diffJsxVNode(received, expected, [], container, isSsr);
34438
+ const diffs = diffJsxVNode(
34439
+ received,
34440
+ expected,
34441
+ [],
34442
+ container,
34443
+ isSsr
34444
+ );
34358
34445
  return {
34359
34446
  pass: isNot ? diffs.length !== 0 : diffs.length === 0,
34360
34447
  message: () => diffs.join("\n")