@qwik.dev/core 2.0.0-alpha.1 → 2.0.0-alpha.3

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.
Files changed (39) hide show
  1. package/bindings/qwik.darwin-arm64.node +0 -0
  2. package/bindings/qwik.darwin-x64.node +0 -0
  3. package/bindings/qwik.linux-x64-gnu.node +0 -0
  4. package/bindings/qwik.wasm.cjs +259 -272
  5. package/bindings/qwik.wasm.mjs +259 -272
  6. package/bindings/qwik.win32-x64-msvc.node +0 -0
  7. package/bindings/qwik_wasm_bg.wasm +0 -0
  8. package/dist/build/package.json +1 -1
  9. package/dist/cli.cjs +1384 -761
  10. package/dist/core-internal.d.ts +14 -4
  11. package/dist/core.cjs +121 -106
  12. package/dist/core.cjs.map +1 -1
  13. package/dist/core.min.mjs +1 -1
  14. package/dist/core.mjs +121 -106
  15. package/dist/core.mjs.map +1 -1
  16. package/dist/core.prod.cjs +80 -63
  17. package/dist/core.prod.mjs +82 -65
  18. package/dist/insights/index.qwik.cjs +1 -1
  19. package/dist/insights/index.qwik.mjs +1 -1
  20. package/dist/loader/index.cjs +2 -2
  21. package/dist/loader/index.mjs +2 -2
  22. package/dist/loader/package.json +1 -1
  23. package/dist/optimizer.cjs +94 -80
  24. package/dist/optimizer.mjs +96 -82
  25. package/dist/prefetch/package.json +1 -1
  26. package/dist/qwikloader.debug.js +1 -0
  27. package/dist/qwikloader.js +2 -2
  28. package/dist/server.cjs +125 -96
  29. package/dist/server.mjs +125 -96
  30. package/dist/starters/features/auth/package.json +3 -1
  31. package/dist/starters/features/drizzle/package.json +2 -1
  32. package/dist/starters/features/postcss/package.json +3 -0
  33. package/dist/starters/features/prisma/package.json +2 -1
  34. package/dist/starters/features/tailwind/package.json +3 -0
  35. package/dist/starters/features/turso/package.json +4 -1
  36. package/dist/testing/index.cjs +121 -92
  37. package/dist/testing/index.mjs +121 -92
  38. package/dist/testing/package.json +1 -1
  39. package/package.json +6 -4
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * @qwik.dev/core 2.0.0-alpha.1-dev+10f5414
3
+ * @qwik.dev/core 2.0.0-alpha.3-dev+418fd6d
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
@@ -824,7 +824,17 @@
824
824
  !0);
825
825
  }
826
826
  has(target, prop) {
827
- return prop === STORE_TARGET || Object.prototype.hasOwnProperty.call(target, prop);
827
+ if (prop === STORE_TARGET) {
828
+ return !0;
829
+ }
830
+ if ("string" == typeof prop) {
831
+ const ctx = tryGetInvokeContext();
832
+ if (ctx) {
833
+ const effectSubscriber = ctx.$effectSubscriber$;
834
+ effectSubscriber && addEffect(target, Array.isArray(target) ? STORE_ARRAY_PROP : prop, this, effectSubscriber);
835
+ }
836
+ }
837
+ return Object.prototype.hasOwnProperty.call(target, prop);
828
838
  }
829
839
  ownKeys(target) {
830
840
  const ctx = tryGetInvokeContext();
@@ -1550,21 +1560,22 @@
1550
1560
  }(jsxProps, vNodeProps), shouldRender && (host[VNodeProps.flags] &= ~VNodeFlags.Deleted,
1551
1561
  container.$scheduler$(ChoreType.COMPONENT, host, componentQRL, jsxProps));
1552
1562
  }
1553
- null != jsxNode.children && function(children, host) {
1554
- if (Array.isArray(children) || (children = [ children ]), children.length) {
1555
- const createProjectionJSXNode = slotName => new JSXNodeImpl(Projection, EMPTY_OBJ, null, [], 0, slotName);
1556
- const projections = [];
1557
- if (host) {
1558
- for (let i = vnode_getPropStartIndex(host); i < host.length; i += 2) {
1559
- const prop = host[i];
1560
- if (isSlotProp(prop)) {
1561
- const slotName = prop;
1562
- projections.push(slotName), projections.push(createProjectionJSXNode(slotName));
1563
- }
1563
+ !function(children, host) {
1564
+ const projectionChildren = Array.isArray(children) ? children : [ children ];
1565
+ const createProjectionJSXNode = slotName => new JSXNodeImpl(Projection, EMPTY_OBJ, null, [], 0, slotName);
1566
+ const projections = [];
1567
+ if (host) {
1568
+ for (let i = vnode_getPropStartIndex(host); i < host.length; i += 2) {
1569
+ const prop = host[i];
1570
+ if (isSlotProp(prop)) {
1571
+ const slotName = prop;
1572
+ projections.push(slotName), projections.push(createProjectionJSXNode(slotName));
1564
1573
  }
1565
1574
  }
1566
- for (let i = 0; i < children.length; i++) {
1567
- const child = children[i];
1575
+ }
1576
+ if (0 !== projections.length || null != children) {
1577
+ for (let i = 0; i < projectionChildren.length; i++) {
1578
+ const child = projectionChildren[i];
1568
1579
  const slotName = String(isJSXNode(child) && directGetPropsProxyProp(child, QSlot) || "");
1569
1580
  const idx = mapApp_findIndx(projections, slotName, 0);
1570
1581
  let jsxBucket;
@@ -1814,7 +1825,13 @@
1814
1825
 
1815
1826
  case ChoreType.COMPONENT:
1816
1827
  case ChoreType.COMPONENT_SSR:
1817
- returnValue = safeCall((() => executeComponent(container, host, host, chore.$target$, chore.$payload$)), (jsx => chore.$type$ === ChoreType.COMPONENT ? maybeThen(container.processJsx(host, jsx), (() => jsx)) : jsx), (err => container.handleError(err, host)));
1828
+ returnValue = safeCall((() => executeComponent(container, host, host, chore.$target$, chore.$payload$)), (jsx => {
1829
+ if (chore.$type$ === ChoreType.COMPONENT) {
1830
+ const styleScopedId = container.getHostProp(host, "q:sstyle");
1831
+ return vnode_diff(container, jsx, host, addComponentStylePrefix(styleScopedId));
1832
+ }
1833
+ return jsx;
1834
+ }), (err => container.handleError(err, host)));
1818
1835
  break;
1819
1836
 
1820
1837
  case ChoreType.RESOURCE:
@@ -1879,7 +1896,7 @@
1879
1896
  const bHost = b.$host$;
1880
1897
  if (aHost !== bHost && null !== aHost && null !== bHost) {
1881
1898
  if (!vnode_isVNode(aHost) || !vnode_isVNode(bHost)) {
1882
- const errorMessage = "SERVER: during HTML streaming, it is not possible to cause a re-run of tasks on a different host";
1899
+ const errorMessage = `SERVER: during HTML streaming, re-running tasks on a different host is not allowed.\n You are attempting to change a state that has already been streamed to the client.\n This can lead to inconsistencies between Server-Side Rendering (SSR) and Client-Side Rendering (CSR).\n Problematic Node: ${aHost.toString()}`;
1883
1900
  return shouldThrowOnHostMismatch && throwErrorAndStop(errorMessage), logWarn(errorMessage),
1884
1901
  null;
1885
1902
  }
@@ -1904,7 +1921,7 @@
1904
1921
  }
1905
1922
  return 0;
1906
1923
  }
1907
- const version = "2.0.0-alpha.1-dev+10f5414";
1924
+ const version = "2.0.0-alpha.3-dev+418fd6d";
1908
1925
  class _SharedContainer {
1909
1926
  $version$;
1910
1927
  $scheduler$;
@@ -1923,8 +1940,8 @@
1923
1940
  trackSignalValue(signal, subscriber, property, data) {
1924
1941
  return trackSignal((() => signal.value), subscriber, property, this, data);
1925
1942
  }
1926
- serializationCtxFactory(NodeConstructor, symbolToChunkResolver, writer, prepVNodeData) {
1927
- return createSerializationContext(NodeConstructor, symbolToChunkResolver, this.getHostProp.bind(this), this.setHostProp.bind(this), this.$storeProxyMap$, writer, prepVNodeData);
1943
+ serializationCtxFactory(NodeConstructor, DomRefConstructor, symbolToChunkResolver, writer, prepVNodeData) {
1944
+ return createSerializationContext(NodeConstructor, DomRefConstructor, symbolToChunkResolver, this.getHostProp.bind(this), this.setHostProp.bind(this), this.$storeProxyMap$, writer, prepVNodeData);
1928
1945
  }
1929
1946
  }
1930
1947
  const VNodeDataSeparator_REFERENCE = 126, VNodeDataSeparator_ADVANCE_1 = 33, VNodeDataSeparator_ADVANCE_8192 = 46;
@@ -2153,10 +2170,6 @@
2153
2170
  parseQRL(qrl) {
2154
2171
  return inflateQRL(this, parseQRL(qrl));
2155
2172
  }
2156
- processJsx(host, jsx) {
2157
- const styleScopedId = this.getHostProp(host, "q:sstyle");
2158
- return vnode_diff(this, jsx, host, addComponentStylePrefix(styleScopedId));
2159
- }
2160
2173
  handleError(err, host) {
2161
2174
  const errorStore = this.resolveContext(host, ERROR_CONTEXT);
2162
2175
  if (!errorStore) {
@@ -3753,7 +3766,10 @@
3753
3766
  const valType = data[i + 2];
3754
3767
  const valData = data[i + 3];
3755
3768
  valType === TypeIds.RootRef || valType >= TypeIds.Error ? Object.defineProperty(target, key, {
3756
- get: () => deserializeData(container, valType, valData),
3769
+ get() {
3770
+ const value = deserializeData(container, valType, valData);
3771
+ return target[key] = value, value;
3772
+ },
3757
3773
  set(value) {
3758
3774
  Object.defineProperty(target, key, {
3759
3775
  value,
@@ -4053,13 +4069,8 @@
4053
4069
  return qrl.$captureRef$ = captureIds ? captureIds.map((id => container.$getObjectById$(id))) : null,
4054
4070
  container.element && qrl.$setContainer$(container.element), qrl;
4055
4071
  }
4056
- class DomVRef {
4057
- id;
4058
- constructor(id) {
4059
- this.id = id;
4060
- }
4061
- }
4062
- const createSerializationContext = (NodeConstructor, symbolToChunkResolver, getProp, setProp, storeProxyMap, writer, prepVNodeData) => {
4072
+ let isDomRef = () => !1;
4073
+ const createSerializationContext = (NodeConstructor, DomRefConstructor, symbolToChunkResolver, getProp, setProp, storeProxyMap, writer, prepVNodeData) => {
4063
4074
  if (!writer) {
4064
4075
  const buffer = [];
4065
4076
  writer = {
@@ -4079,10 +4090,11 @@
4079
4090
  roots.push(obj)), id;
4080
4091
  };
4081
4092
  const isSsrNode = NodeConstructor ? obj => obj instanceof NodeConstructor : () => !1;
4082
- return {
4093
+ return isDomRef = DomRefConstructor ? obj => obj instanceof DomRefConstructor : () => !1,
4094
+ {
4083
4095
  $serialize$() {
4084
4096
  !function(serializationContext) {
4085
- const {$writer$, $isSsrNode$, $setProp$, $storeProxyMap$} = serializationContext;
4097
+ const {$writer$, $isSsrNode$, $isDomRef$, $setProp$, $storeProxyMap$} = serializationContext;
4086
4098
  let depth = -1;
4087
4099
  let writeType = !1;
4088
4100
  const output = (type, value) => {
@@ -4200,12 +4212,11 @@
4200
4212
  }
4201
4213
  output(TypeIds.Object, out);
4202
4214
  }
4203
- } else if (value instanceof DomVRef) {
4204
- output(TypeIds.RefVNode, value.id);
4215
+ } else if ($isDomRef$(value)) {
4216
+ value.$ssrNode$.vnodeData[0] |= VNodeDataFlag.SERIALIZE, output(TypeIds.RefVNode, value.$ssrNode$.id);
4205
4217
  } else if (value instanceof Signal) {
4206
- let v = value instanceof ComputedSignal && (value.$invalid$ || fastSkipSerialize(value.$untrackedValue$)) ? NEEDS_COMPUTATION : value.$untrackedValue$;
4207
- if ($isSsrNode$(v) && (serializationContext.$addRoot$(v), v = new DomVRef(v.id)),
4208
- value instanceof WrappedSignal) {
4218
+ const v = value instanceof ComputedSignal && (value.$invalid$ || fastSkipSerialize(value.$untrackedValue$)) ? NEEDS_COMPUTATION : value.$untrackedValue$;
4219
+ if (value instanceof WrappedSignal) {
4209
4220
  output(TypeIds.WrappedSignal, [ ...serializeWrappingFn(serializationContext, value), value.$effectDependencies$, v, ...value.$effects$ || [] ]);
4210
4221
  } else if (value instanceof ComputedSignal) {
4211
4222
  const out = [ value.$computeQrl$, value.$effects$ ];
@@ -4283,6 +4294,7 @@
4283
4294
  }(this);
4284
4295
  },
4285
4296
  $isSsrNode$: isSsrNode,
4297
+ $isDomRef$: isDomRef,
4286
4298
  $symbolToChunkResolver$: symbolToChunkResolver,
4287
4299
  $wasSeen$,
4288
4300
  $roots$: roots,
@@ -4351,6 +4363,8 @@
4351
4363
  discoveredValues.push(obj.$el$, obj.$qrl$, obj.$state$, obj.$effectDependencies$);
4352
4364
  } else if (isSsrNode(obj)) {
4353
4365
  discoveredValues.push(obj.vnodeData);
4366
+ } else if (isDomRef(obj)) {
4367
+ discoveredValues.push(obj.$ssrNode$.id);
4354
4368
  } else if (isJSXNode(obj)) {
4355
4369
  discoveredValues.push(obj.type, obj.props, obj.constProps, obj.children);
4356
4370
  } else if (Array.isArray(obj)) {
@@ -4528,6 +4542,9 @@
4528
4542
  if (value instanceof Uint8Array) {
4529
4543
  return !0;
4530
4544
  }
4545
+ if (isDomRef?.(value)) {
4546
+ return !0;
4547
+ }
4531
4548
  } else if ("function" == typeof value && (isQrl(value) || isQwikComponent(value))) {
4532
4549
  return !0;
4533
4550
  }
@@ -4633,10 +4650,30 @@
4633
4650
  const createQRL = (chunk, symbol, symbolRef, symbolFn, capture, captureRef, refSymbol) => {
4634
4651
  let _containerEl;
4635
4652
  const qrl = async function(...args) {
4636
- const fn = invokeFn.call(this, tryGetInvokeContext());
4637
- return await fn(...args);
4653
+ const boundedFn = bindFnToContext.call(this, tryGetInvokeContext());
4654
+ return await boundedFn(...args);
4638
4655
  };
4639
4656
  const setContainer = el => (_containerEl || (_containerEl = el), _containerEl);
4657
+ function bindFnToContext(currentCtx, beforeFn) {
4658
+ return (...args) => maybeThen(resolveLazy(), (fn => {
4659
+ if (!isFunction(fn)) {
4660
+ throw qError(10);
4661
+ }
4662
+ if (beforeFn && !1 === beforeFn()) {
4663
+ return;
4664
+ }
4665
+ const context = createOrReuseInvocationContext(currentCtx);
4666
+ const prevQrl = context.$qrl$;
4667
+ const prevEvent = context.$event$;
4668
+ context.$qrl$ = qrl, context.$event$ ||= this;
4669
+ try {
4670
+ return invoke.call(this, context, fn, ...args);
4671
+ } finally {
4672
+ context.$qrl$ = prevQrl, context.$event$ = prevEvent;
4673
+ }
4674
+ }));
4675
+ }
4676
+ const resolveLazy = containerEl => null !== symbolRef ? symbolRef : resolve(containerEl);
4640
4677
  const wrapFn = fn => "function" != typeof fn || !capture?.length && !captureRef?.length ? fn : function(...args) {
4641
4678
  let context = tryGetInvokeContext();
4642
4679
  return context ? fn.apply(this, args) : (context = newInvokeContext(), context.$qrl$ = qrl,
@@ -4664,26 +4701,6 @@
4664
4701
  throw console.error(`qrl ${symbol} failed to load`, err), symbolRef = null, err;
4665
4702
  })), symbolRef;
4666
4703
  };
4667
- const resolveLazy = containerEl => null !== symbolRef ? symbolRef : resolve(containerEl);
4668
- function invokeFn(currentCtx, beforeFn) {
4669
- return (...args) => maybeThen(resolveLazy(), (f => {
4670
- if (!isFunction(f)) {
4671
- throw qError(10);
4672
- }
4673
- if (beforeFn && !1 === beforeFn()) {
4674
- return;
4675
- }
4676
- const context = createOrReuseInvocationContext(currentCtx);
4677
- const prevQrl = context.$qrl$;
4678
- const prevEvent = context.$event$;
4679
- context.$qrl$ = qrl, context.$event$ ||= this;
4680
- try {
4681
- return invoke.call(this, context, f, ...args);
4682
- } finally {
4683
- context.$qrl$ = prevQrl, context.$event$ = prevEvent;
4684
- }
4685
- }));
4686
- }
4687
4704
  const createOrReuseInvocationContext = invoke => null == invoke ? newInvokeContext() : isArray(invoke) ? newInvokeContextFromTuple(invoke) : invoke;
4688
4705
  const resolvedSymbol = refSymbol ?? symbol;
4689
4706
  const hash = getSymbolHash(resolvedSymbol);
@@ -4698,7 +4715,7 @@
4698
4715
  $symbol$: symbol,
4699
4716
  $refSymbol$: refSymbol,
4700
4717
  $hash$: hash,
4701
- getFn: invokeFn,
4718
+ getFn: bindFnToContext,
4702
4719
  $capture$: capture,
4703
4720
  $captureRef$: captureRef,
4704
4721
  dev: null,
@@ -5059,7 +5076,7 @@
5059
5076
  }
5060
5077
  return target;
5061
5078
  }, exports._serialize = async function(data) {
5062
- const serializationContext = createSerializationContext(null, (() => ""), (() => ""), (() => {}), new WeakMap);
5079
+ const serializationContext = createSerializationContext(null, null, (() => ""), (() => ""), (() => {}), new WeakMap);
5063
5080
  for (const root of data) {
5064
5081
  serializationContext.$addRoot$(root);
5065
5082
  }
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * @qwik.dev/core 2.0.0-alpha.1-dev+10f5414
3
+ * @qwik.dev/core 2.0.0-alpha.3-dev+418fd6d
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
@@ -736,10 +736,10 @@ function clearEffects(subscriber, value) {
736
736
  return subscriptionRemoved;
737
737
  }
738
738
 
739
- const DEBUG = !1;
740
-
741
739
  const NEEDS_COMPUTATION = Symbol("invalid");
742
740
 
741
+ const DEBUG = !1;
742
+
743
743
  const log = (...args) => console.log("SIGNAL", ...args.map(qwikDebugToString));
744
744
 
745
745
  const throwIfQRLNotResolved = qrl => {
@@ -1232,7 +1232,17 @@ class StoreHandler {
1232
1232
  !0);
1233
1233
  }
1234
1234
  has(target, prop) {
1235
- return prop === STORE_TARGET || Object.prototype.hasOwnProperty.call(target, prop);
1235
+ if (prop === STORE_TARGET) {
1236
+ return !0;
1237
+ }
1238
+ if ("string" == typeof prop) {
1239
+ const ctx = tryGetInvokeContext();
1240
+ if (ctx) {
1241
+ const effectSubscriber = ctx.$effectSubscriber$;
1242
+ effectSubscriber && addEffect(target, Array.isArray(target) ? STORE_ARRAY_PROP : prop, this, effectSubscriber);
1243
+ }
1244
+ }
1245
+ return Object.prototype.hasOwnProperty.call(target, prop);
1236
1246
  }
1237
1247
  ownKeys(target) {
1238
1248
  const ctx = tryGetInvokeContext();
@@ -2015,21 +2025,22 @@ const vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
2015
2025
  shouldRender = shouldRender || propsDiffer(jsxProps, vNodeProps), shouldRender && (host[VNodeProps.flags] &= ~VNodeFlags.Deleted,
2016
2026
  container.$scheduler$(ChoreType.COMPONENT, host, componentQRL, jsxProps));
2017
2027
  }
2018
- null != jsxNode.children && function(children, host) {
2019
- if (Array.isArray(children) || (children = [ children ]), children.length) {
2020
- const createProjectionJSXNode = slotName => new JSXNodeImpl(Projection, EMPTY_OBJ, null, [], 0, slotName);
2021
- const projections = [];
2022
- if (host) {
2023
- for (let i = vnode_getPropStartIndex(host); i < host.length; i += 2) {
2024
- const prop = host[i];
2025
- if (isSlotProp(prop)) {
2026
- const slotName = prop;
2027
- projections.push(slotName), projections.push(createProjectionJSXNode(slotName));
2028
- }
2028
+ !function(children, host) {
2029
+ const projectionChildren = Array.isArray(children) ? children : [ children ];
2030
+ const createProjectionJSXNode = slotName => new JSXNodeImpl(Projection, EMPTY_OBJ, null, [], 0, slotName);
2031
+ const projections = [];
2032
+ if (host) {
2033
+ for (let i = vnode_getPropStartIndex(host); i < host.length; i += 2) {
2034
+ const prop = host[i];
2035
+ if (isSlotProp(prop)) {
2036
+ const slotName = prop;
2037
+ projections.push(slotName), projections.push(createProjectionJSXNode(slotName));
2029
2038
  }
2030
2039
  }
2031
- for (let i = 0; i < children.length; i++) {
2032
- const child = children[i];
2040
+ }
2041
+ if (0 !== projections.length || null != children) {
2042
+ for (let i = 0; i < projectionChildren.length; i++) {
2043
+ const child = projectionChildren[i];
2033
2044
  const slotName = String(isJSXNode(child) && directGetPropsProxyProp(child, QSlot) || "");
2034
2045
  const idx = mapApp_findIndx(projections, slotName, 0);
2035
2046
  let jsxBucket;
@@ -2289,7 +2300,13 @@ const createScheduler = (container, scheduleDrain, journalFlush) => {
2289
2300
 
2290
2301
  case ChoreType.COMPONENT:
2291
2302
  case ChoreType.COMPONENT_SSR:
2292
- returnValue = safeCall((() => executeComponent(container, host, host, chore.$target$, chore.$payload$)), (jsx => chore.$type$ === ChoreType.COMPONENT ? maybeThen(container.processJsx(host, jsx), (() => jsx)) : jsx), (err => container.handleError(err, host)));
2303
+ returnValue = safeCall((() => executeComponent(container, host, host, chore.$target$, chore.$payload$)), (jsx => {
2304
+ if (chore.$type$ === ChoreType.COMPONENT) {
2305
+ const styleScopedId = container.getHostProp(host, "q:sstyle");
2306
+ return vnode_diff(container, jsx, host, addComponentStylePrefix(styleScopedId));
2307
+ }
2308
+ return jsx;
2309
+ }), (err => container.handleError(err, host)));
2293
2310
  break;
2294
2311
 
2295
2312
  case ChoreType.RESOURCE:
@@ -2360,7 +2377,7 @@ function choreComparator(a, b, shouldThrowOnHostMismatch) {
2360
2377
  const bHost = b.$host$;
2361
2378
  if (aHost !== bHost && null !== aHost && null !== bHost) {
2362
2379
  if (!vnode_isVNode(aHost) || !vnode_isVNode(bHost)) {
2363
- const errorMessage = "SERVER: during HTML streaming, it is not possible to cause a re-run of tasks on a different host";
2380
+ const errorMessage = `SERVER: during HTML streaming, re-running tasks on a different host is not allowed.\n You are attempting to change a state that has already been streamed to the client.\n This can lead to inconsistencies between Server-Side Rendering (SSR) and Client-Side Rendering (CSR).\n Problematic Node: ${aHost.toString()}`;
2364
2381
  return shouldThrowOnHostMismatch && throwErrorAndStop(errorMessage), logWarn(errorMessage),
2365
2382
  null;
2366
2383
  }
@@ -2413,7 +2430,7 @@ function sortedInsert(sortedArray, value) {
2413
2430
  return choreUpdate(existing, value), existing;
2414
2431
  }
2415
2432
 
2416
- const version = "2.0.0-alpha.1-dev+10f5414";
2433
+ const version = "2.0.0-alpha.3-dev+418fd6d";
2417
2434
 
2418
2435
  class _SharedContainer {
2419
2436
  $version$;
@@ -2433,8 +2450,8 @@ class _SharedContainer {
2433
2450
  trackSignalValue(signal, subscriber, property, data) {
2434
2451
  return trackSignal((() => signal.value), subscriber, property, this, data);
2435
2452
  }
2436
- serializationCtxFactory(NodeConstructor, symbolToChunkResolver, writer, prepVNodeData) {
2437
- return createSerializationContext(NodeConstructor, symbolToChunkResolver, this.getHostProp.bind(this), this.setHostProp.bind(this), this.$storeProxyMap$, writer, prepVNodeData);
2453
+ serializationCtxFactory(NodeConstructor, DomRefConstructor, symbolToChunkResolver, writer, prepVNodeData) {
2454
+ return createSerializationContext(NodeConstructor, DomRefConstructor, symbolToChunkResolver, this.getHostProp.bind(this), this.setHostProp.bind(this), this.$storeProxyMap$, writer, prepVNodeData);
2438
2455
  }
2439
2456
  }
2440
2457
 
@@ -2744,10 +2761,6 @@ class DomContainer extends _SharedContainer {
2744
2761
  parseQRL(qrl) {
2745
2762
  return inflateQRL(this, parseQRL(qrl));
2746
2763
  }
2747
- processJsx(host, jsx) {
2748
- const styleScopedId = this.getHostProp(host, "q:sstyle");
2749
- return vnode_diff(this, jsx, host, addComponentStylePrefix(styleScopedId));
2750
- }
2751
2764
  handleError(err, host) {
2752
2765
  const errorStore = this.resolveContext(host, ERROR_CONTEXT);
2753
2766
  if (!errorStore) {
@@ -4554,7 +4567,10 @@ const inflate = (container, target, typeId, data) => {
4554
4567
  const valType = data[i + 2];
4555
4568
  const valData = data[i + 3];
4556
4569
  valType === TypeIds.RootRef || valType >= TypeIds.Error ? Object.defineProperty(target, key, {
4557
- get: () => deserializeData(container, valType, valData),
4570
+ get() {
4571
+ const value = deserializeData(container, valType, valData);
4572
+ return target[key] = value, value;
4573
+ },
4558
4574
  set(value) {
4559
4575
  Object.defineProperty(target, key, {
4560
4576
  value,
@@ -4860,14 +4876,9 @@ function inflateQRL(container, qrl) {
4860
4876
  container.element && qrl.$setContainer$(container.element), qrl;
4861
4877
  }
4862
4878
 
4863
- class DomVRef {
4864
- id;
4865
- constructor(id) {
4866
- this.id = id;
4867
- }
4868
- }
4879
+ let isDomRef = () => !1;
4869
4880
 
4870
- const createSerializationContext = (NodeConstructor, symbolToChunkResolver, getProp, setProp, storeProxyMap, writer, prepVNodeData) => {
4881
+ const createSerializationContext = (NodeConstructor, DomRefConstructor, symbolToChunkResolver, getProp, setProp, storeProxyMap, writer, prepVNodeData) => {
4871
4882
  if (!writer) {
4872
4883
  const buffer = [];
4873
4884
  writer = {
@@ -4887,11 +4898,13 @@ const createSerializationContext = (NodeConstructor, symbolToChunkResolver, getP
4887
4898
  roots.push(obj)), id;
4888
4899
  };
4889
4900
  const isSsrNode = NodeConstructor ? obj => obj instanceof NodeConstructor : () => !1;
4890
- return {
4901
+ return isDomRef = DomRefConstructor ? obj => obj instanceof DomRefConstructor : () => !1,
4902
+ {
4891
4903
  $serialize$() {
4892
4904
  serialize(this);
4893
4905
  },
4894
4906
  $isSsrNode$: isSsrNode,
4907
+ $isDomRef$: isDomRef,
4895
4908
  $symbolToChunkResolver$: symbolToChunkResolver,
4896
4909
  $wasSeen$,
4897
4910
  $roots$: roots,
@@ -4960,6 +4973,8 @@ const createSerializationContext = (NodeConstructor, symbolToChunkResolver, getP
4960
4973
  discoveredValues.push(obj.$el$, obj.$qrl$, obj.$state$, obj.$effectDependencies$);
4961
4974
  } else if (isSsrNode(obj)) {
4962
4975
  discoveredValues.push(obj.vnodeData);
4976
+ } else if (isDomRef(obj)) {
4977
+ discoveredValues.push(obj.$ssrNode$.id);
4963
4978
  } else if (isJSXNode(obj)) {
4964
4979
  discoveredValues.push(obj.type, obj.props, obj.constProps, obj.children);
4965
4980
  } else if (Array.isArray(obj)) {
@@ -5014,7 +5029,7 @@ const createSerializationContext = (NodeConstructor, symbolToChunkResolver, getP
5014
5029
  const promiseResults = new WeakMap;
5015
5030
 
5016
5031
  function serialize(serializationContext) {
5017
- const {$writer$, $isSsrNode$, $setProp$, $storeProxyMap$} = serializationContext;
5032
+ const {$writer$, $isSsrNode$, $isDomRef$, $setProp$, $storeProxyMap$} = serializationContext;
5018
5033
  let depth = -1;
5019
5034
  let writeType = !1;
5020
5035
  const output = (type, value) => {
@@ -5130,12 +5145,11 @@ function serialize(serializationContext) {
5130
5145
  }
5131
5146
  output(TypeIds.Object, out);
5132
5147
  }
5133
- } else if (value instanceof DomVRef) {
5134
- output(TypeIds.RefVNode, value.id);
5148
+ } else if ($isDomRef$(value)) {
5149
+ value.$ssrNode$.vnodeData[0] |= VNodeDataFlag.SERIALIZE, output(TypeIds.RefVNode, value.$ssrNode$.id);
5135
5150
  } else if (value instanceof Signal) {
5136
- let v = value instanceof ComputedSignal && (value.$invalid$ || fastSkipSerialize(value.$untrackedValue$)) ? NEEDS_COMPUTATION : value.$untrackedValue$;
5137
- if ($isSsrNode$(v) && (serializationContext.$addRoot$(v), v = new DomVRef(v.id)),
5138
- value instanceof WrappedSignal) {
5151
+ const v = value instanceof ComputedSignal && (value.$invalid$ || fastSkipSerialize(value.$untrackedValue$)) ? NEEDS_COMPUTATION : value.$untrackedValue$;
5152
+ if (value instanceof WrappedSignal) {
5139
5153
  output(TypeIds.WrappedSignal, [ ...serializeWrappingFn(serializationContext, value), value.$effectDependencies$, v, ...value.$effects$ || [] ]);
5140
5154
  } else if (value instanceof ComputedSignal) {
5141
5155
  const out = [ value.$computeQrl$, value.$effects$ ];
@@ -5251,7 +5265,7 @@ function qrlToString(serializationContext, value) {
5251
5265
  }
5252
5266
 
5253
5267
  async function _serialize(data) {
5254
- const serializationContext = createSerializationContext(null, (() => ""), (() => ""), (() => {}), new WeakMap);
5268
+ const serializationContext = createSerializationContext(null, null, (() => ""), (() => ""), (() => {}), new WeakMap);
5255
5269
  for (const root of data) {
5256
5270
  serializationContext.$addRoot$(root);
5257
5271
  }
@@ -5378,6 +5392,9 @@ const canSerialize = value => {
5378
5392
  if (value instanceof Uint8Array) {
5379
5393
  return !0;
5380
5394
  }
5395
+ if (isDomRef?.(value)) {
5396
+ return !0;
5397
+ }
5381
5398
  } else if ("function" == typeof value && (isQrl(value) || isQwikComponent(value))) {
5382
5399
  return !0;
5383
5400
  }
@@ -5501,10 +5518,30 @@ const isSyncQrl = value => isQrl(value) && "<sync>" == value.$symbol$;
5501
5518
  const createQRL = (chunk, symbol, symbolRef, symbolFn, capture, captureRef, refSymbol) => {
5502
5519
  let _containerEl;
5503
5520
  const qrl = async function(...args) {
5504
- const fn = invokeFn.call(this, tryGetInvokeContext());
5505
- return await fn(...args);
5521
+ const boundedFn = bindFnToContext.call(this, tryGetInvokeContext());
5522
+ return await boundedFn(...args);
5506
5523
  };
5507
5524
  const setContainer = el => (_containerEl || (_containerEl = el), _containerEl);
5525
+ function bindFnToContext(currentCtx, beforeFn) {
5526
+ return (...args) => maybeThen(resolveLazy(), (fn => {
5527
+ if (!isFunction(fn)) {
5528
+ throw qError(10);
5529
+ }
5530
+ if (beforeFn && !1 === beforeFn()) {
5531
+ return;
5532
+ }
5533
+ const context = createOrReuseInvocationContext(currentCtx);
5534
+ const prevQrl = context.$qrl$;
5535
+ const prevEvent = context.$event$;
5536
+ context.$qrl$ = qrl, context.$event$ ||= this;
5537
+ try {
5538
+ return invoke.call(this, context, fn, ...args);
5539
+ } finally {
5540
+ context.$qrl$ = prevQrl, context.$event$ = prevEvent;
5541
+ }
5542
+ }));
5543
+ }
5544
+ const resolveLazy = containerEl => null !== symbolRef ? symbolRef : resolve(containerEl);
5508
5545
  const wrapFn = fn => "function" != typeof fn || !capture?.length && !captureRef?.length ? fn : function(...args) {
5509
5546
  let context = tryGetInvokeContext();
5510
5547
  return context ? fn.apply(this, args) : (context = newInvokeContext(), context.$qrl$ = qrl,
@@ -5532,26 +5569,6 @@ const createQRL = (chunk, symbol, symbolRef, symbolFn, capture, captureRef, refS
5532
5569
  throw console.error(`qrl ${symbol} failed to load`, err), symbolRef = null, err;
5533
5570
  })), symbolRef;
5534
5571
  };
5535
- const resolveLazy = containerEl => null !== symbolRef ? symbolRef : resolve(containerEl);
5536
- function invokeFn(currentCtx, beforeFn) {
5537
- return (...args) => maybeThen(resolveLazy(), (f => {
5538
- if (!isFunction(f)) {
5539
- throw qError(10);
5540
- }
5541
- if (beforeFn && !1 === beforeFn()) {
5542
- return;
5543
- }
5544
- const context = createOrReuseInvocationContext(currentCtx);
5545
- const prevQrl = context.$qrl$;
5546
- const prevEvent = context.$event$;
5547
- context.$qrl$ = qrl, context.$event$ ||= this;
5548
- try {
5549
- return invoke.call(this, context, f, ...args);
5550
- } finally {
5551
- context.$qrl$ = prevQrl, context.$event$ = prevEvent;
5552
- }
5553
- }));
5554
- }
5555
5572
  const createOrReuseInvocationContext = invoke => null == invoke ? newInvokeContext() : isArray(invoke) ? newInvokeContextFromTuple(invoke) : invoke;
5556
5573
  const resolvedSymbol = refSymbol ?? symbol;
5557
5574
  const hash = getSymbolHash(resolvedSymbol);
@@ -5566,7 +5583,7 @@ const createQRL = (chunk, symbol, symbolRef, symbolFn, capture, captureRef, refS
5566
5583
  $symbol$: symbol,
5567
5584
  $refSymbol$: refSymbol,
5568
5585
  $hash$: hash,
5569
- getFn: invokeFn,
5586
+ getFn: bindFnToContext,
5570
5587
  $capture$: capture,
5571
5588
  $captureRef$: captureRef,
5572
5589
  dev: null,
@@ -6,7 +6,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
6
6
  const core = require("@qwik.dev/core");
7
7
  /**
8
8
  * @license
9
- * @qwik.dev/core 2.0.0-alpha.1-dev+10f5414
9
+ * @qwik.dev/core 2.0.0-alpha.3-dev+418fd6d
10
10
  * Copyright QwikDev. All Rights Reserved.
11
11
  * Use of this source code is governed by an MIT-style license that can be
12
12
  * found in the LICENSE file at https://github.com/QwikDev/qwik/blob/main/LICENSE
@@ -4,7 +4,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
4
4
  import { sync$, component$ } from "@qwik.dev/core";
5
5
  /**
6
6
  * @license
7
- * @qwik.dev/core 2.0.0-alpha.1-dev+10f5414
7
+ * @qwik.dev/core 2.0.0-alpha.3-dev+418fd6d
8
8
  * Copyright QwikDev. All Rights Reserved.
9
9
  * Use of this source code is governed by an MIT-style license that can be
10
10
  * found in the LICENSE file at https://github.com/QwikDev/qwik/blob/main/LICENSE