@qwik.dev/core 2.0.0-alpha.7 → 2.0.0-alpha.8

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.
@@ -1,14 +1,14 @@
1
1
  var __defProp = Object.defineProperty;
2
2
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3
3
  var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
4
- var _a, _b, _c;
4
+ var _a, _b, _c, _d, _e;
5
5
  import { sync$, component$ } from "@qwik.dev/core";
6
6
  var isBrowser = /* @__PURE__ */ (() => typeof window !== "undefined" && typeof HTMLElement !== "undefined" && !!window.document && String(HTMLElement).includes("[native code]"))();
7
7
  var isServer = !isBrowser;
8
8
  var isDev = false;
9
9
  /**
10
10
  * @license
11
- * @qwik.dev/core 2.0.0-alpha.7-dev+a26598a
11
+ * @qwik.dev/core 2.0.0-alpha.8-dev+66037b5
12
12
  * Copyright QwikDev. All Rights Reserved.
13
13
  * Use of this source code is governed by an MIT-style license that can be
14
14
  * found in the LICENSE file at https://github.com/QwikDev/qwik/blob/main/LICENSE
@@ -314,7 +314,7 @@ function isAriaAttribute(prop) {
314
314
  }
315
315
  const STORE_TARGET = Symbol("store.target");
316
316
  const STORE_HANDLER = Symbol("store.handler");
317
- const STORE_ARRAY_PROP = Symbol("store.array");
317
+ const STORE_ALL_PROPS = Symbol("store.all");
318
318
  var StoreFlags;
319
319
  !function(StoreFlags2) {
320
320
  StoreFlags2[StoreFlags2.NONE = 0] = "NONE", StoreFlags2[StoreFlags2.RECURSIVE = 1] = "RECURSIVE", StoreFlags2[StoreFlags2.IMMUTABLE = 2] = "IMMUTABLE";
@@ -359,7 +359,7 @@ class StoreHandler {
359
359
  assertTrue(!ctx.$container$ || ctx.$container$ === this.$container$);
360
360
  }
361
361
  const effectSubscriber = ctx.$effectSubscriber$;
362
- effectSubscriber && addEffect(target, Array.isArray(target) ? STORE_ARRAY_PROP : prop, this, effectSubscriber);
362
+ effectSubscriber && addStoreEffect(target, Array.isArray(target) ? STORE_ALL_PROPS : prop, this, effectSubscriber);
363
363
  }
364
364
  if ("toString" === prop && value === Object.prototype.toString) {
365
365
  return this.toString;
@@ -389,7 +389,7 @@ class StoreHandler {
389
389
  const ctx = tryGetInvokeContext();
390
390
  if (ctx) {
391
391
  const effectSubscriber = ctx.$effectSubscriber$;
392
- effectSubscriber && addEffect(target, Array.isArray(target) ? STORE_ARRAY_PROP : prop, this, effectSubscriber);
392
+ effectSubscriber && addStoreEffect(target, Array.isArray(target) ? STORE_ALL_PROPS : prop, this, effectSubscriber);
393
393
  }
394
394
  }
395
395
  return Object.prototype.hasOwnProperty.call(target, prop);
@@ -397,7 +397,7 @@ class StoreHandler {
397
397
  ownKeys(target) {
398
398
  const ctx = tryGetInvokeContext();
399
399
  const effectSubscriber = ctx?.$effectSubscriber$;
400
- return effectSubscriber && addEffect(target, STORE_ARRAY_PROP, this, effectSubscriber), Reflect.ownKeys(target);
400
+ return effectSubscriber && addStoreEffect(target, STORE_ALL_PROPS, this, effectSubscriber), Reflect.ownKeys(target);
401
401
  }
402
402
  getOwnPropertyDescriptor(target, prop) {
403
403
  const descriptor = Reflect.getOwnPropertyDescriptor(target, prop);
@@ -407,7 +407,7 @@ class StoreHandler {
407
407
  };
408
408
  }
409
409
  }
410
- function addEffect(target, prop, store, effectSubscription) {
410
+ function addStoreEffect(target, prop, store, effectSubscription) {
411
411
  const effectsMap = store.$effects$ || (store.$effects$ = /* @__PURE__ */ new Map());
412
412
  let effects = effectsMap.get(prop);
413
413
  effects || (effects = /* @__PURE__ */ new Set(), effectsMap.set(prop, effects)), ensureContainsSubscription(effects, effectSubscription), ensureContainsBackRef(effectSubscription, target), addQrlToSerializationCtx(effectSubscription, store.$container$);
@@ -429,7 +429,7 @@ function getEffects(target, prop, storeEffects) {
429
429
  effectsToTrigger = storeEffects.get(prop);
430
430
  }
431
431
  }
432
- const storeArrayValue = storeEffects?.get(STORE_ARRAY_PROP);
432
+ const storeArrayValue = storeEffects?.get(STORE_ALL_PROPS);
433
433
  if (storeArrayValue) {
434
434
  effectsToTrigger || (effectsToTrigger = /* @__PURE__ */ new Set());
435
435
  for (const effect of storeArrayValue) {
@@ -521,6 +521,9 @@ const runTask = (task, container, host) => {
521
521
  if (isSignal(obj)) {
522
522
  return obj.value;
523
523
  }
524
+ if (isStore(obj)) {
525
+ return addStoreEffect(getStoreTarget(obj), STORE_ALL_PROPS, getStoreHandler(obj), ctx.$effectSubscriber$), obj;
526
+ }
524
527
  throw qError(QError.trackObjectWithoutProp);
525
528
  });
526
529
  },
@@ -576,12 +579,12 @@ var VirtualVNodeProps;
576
579
  }(TextVNodeProps || (TextVNodeProps = {})), function(VirtualVNodeProps2) {
577
580
  VirtualVNodeProps2[VirtualVNodeProps2.firstChild = 4] = "firstChild", VirtualVNodeProps2[VirtualVNodeProps2.lastChild = 5] = "lastChild", VirtualVNodeProps2[VirtualVNodeProps2.PROPS_OFFSET = 6] = "PROPS_OFFSET";
578
581
  }(VirtualVNodeProps || (VirtualVNodeProps = {}));
579
- const mapApp_findIndx = (elementVNode, key, start) => {
582
+ const mapApp_findIndx = (array, key, start) => {
580
583
  let bottom = start >> 1;
581
- let top = elementVNode.length - 2 >> 1;
584
+ let top = array.length - 2 >> 1;
582
585
  for (; bottom <= top; ) {
583
586
  const mid = bottom + (top - bottom >> 1);
584
- const midKey = elementVNode[mid << 1];
587
+ const midKey = array[mid << 1];
585
588
  if (midKey === key) {
586
589
  return mid << 1;
587
590
  }
@@ -589,13 +592,13 @@ const mapApp_findIndx = (elementVNode, key, start) => {
589
592
  }
590
593
  return ~(bottom << 1);
591
594
  };
592
- const mapArray_set = (elementVNode, key, value, start) => {
593
- const indx = mapApp_findIndx(elementVNode, key, start);
594
- indx >= 0 ? null == value ? elementVNode.splice(indx, 2) : elementVNode[indx + 1] = value : null != value && elementVNode.splice(~indx, 0, key, value);
595
+ const mapArray_set = (array, key, value, start) => {
596
+ const indx = mapApp_findIndx(array, key, start);
597
+ indx >= 0 ? null == value ? array.splice(indx, 2) : array[indx + 1] = value : null != value && array.splice(~indx, 0, key, value);
595
598
  };
596
- const mapArray_get = (elementVNode, key, start) => {
597
- const indx = mapApp_findIndx(elementVNode, key, start);
598
- return indx >= 0 ? elementVNode[indx + 1] : null;
599
+ const mapArray_get = (array, key, start) => {
600
+ const indx = mapApp_findIndx(array, key, start);
601
+ return indx >= 0 ? array[indx + 1] : null;
599
602
  };
600
603
  const isForeignObjectElement = (elementName) => "foreignObject" === elementName;
601
604
  const isSvgElement = (elementName) => "svg" === elementName || isForeignObjectElement(elementName);
@@ -823,9 +826,6 @@ const _VAR_PROPS = Symbol("VAR");
823
826
  function isSlotProp(prop) {
824
827
  return !prop.startsWith("q:") && !prop.startsWith(":");
825
828
  }
826
- function isParentSlotProp(prop) {
827
- return prop.startsWith(":");
828
- }
829
829
  function escapeHTML(html) {
830
830
  let escapedHTML = "";
831
831
  const length = html.length;
@@ -953,7 +953,7 @@ const vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
953
953
  }
954
954
  function expectProjection() {
955
955
  const slotName = jsxValue.key;
956
- vCurrent = vnode_getProp(vParent, slotName, (id) => vnode_locate(container.rootVNode, id)), null == vCurrent && (vNewNode = vnode_newVirtual(), vnode_setProp(vNewNode, QSlot, slotName), vnode_setProp(vNewNode, ":", vParent), vnode_setProp(vParent, slotName, vNewNode));
956
+ vCurrent = vnode_getProp(vParent, slotName, (id) => vnode_locate(container.rootVNode, id)), vCurrent = vCurrent && vCurrent[VNodeProps.flags] & VNodeFlags.Deleted ? null : vCurrent, null == vCurrent && (vNewNode = vnode_newVirtual(), vnode_setProp(vNewNode, QSlot, slotName), vnode_setProp(vNewNode, "q:sparent", vParent), vnode_setProp(vParent, slotName, vNewNode));
957
957
  }
958
958
  function expectSlot() {
959
959
  const vHost = vnode_getProjectionParentComponent(vParent, container.rootVNode);
@@ -969,13 +969,21 @@ const vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
969
969
  return directGetPropsProxyProp(jsxNode2, "name") || "";
970
970
  }(vHost);
971
971
  const vProjectedNode = vHost ? vnode_getProp(vHost, slotNameKey, null) : null;
972
- return null == vProjectedNode ? (vnode_insertBefore(journal, vParent, vNewNode = vnode_newVirtual(), vCurrent && getInsertBefore()), vnode_setProp(vNewNode, QSlot, slotNameKey), vHost && vnode_setProp(vHost, slotNameKey, vNewNode), false) : (vProjectedNode === vCurrent || (vnode_insertBefore(journal, vParent, vNewNode = vProjectedNode, vCurrent && getInsertBefore()), vnode_setProp(vNewNode, QSlot, slotNameKey), vHost && vnode_setProp(vHost, slotNameKey, vNewNode), isDev), true);
972
+ if (null == vProjectedNode) {
973
+ return vnode_insertBefore(journal, vParent, vNewNode = vnode_newVirtual(), vCurrent && getInsertBefore()), vnode_setProp(vNewNode, QSlot, slotNameKey), vHost && vnode_setProp(vHost, slotNameKey, vNewNode), false;
974
+ }
975
+ if (vProjectedNode === vCurrent) ;
976
+ else {
977
+ const parent = vnode_getParent(vProjectedNode);
978
+ !(!parent || vnode_isElementVNode(parent) && vnode_getElementName(parent) === QTemplate) && vParent !== parent && vnode_remove(journal, parent, vProjectedNode, false), vnode_insertBefore(journal, vParent, vNewNode = vProjectedNode, vCurrent && getInsertBefore()), vnode_setProp(vNewNode, QSlot, slotNameKey), vHost && vnode_setProp(vHost, slotNameKey, vNewNode);
979
+ }
980
+ return true;
973
981
  }
974
982
  function expectNoMore() {
975
983
  if (null !== vCurrent) {
976
984
  for (; vCurrent; ) {
977
985
  const toRemove = vCurrent;
978
- advanceToNextSibling(), cleanup(container, toRemove), vParent === vnode_getParent(toRemove) && vnode_remove(journal, vParent, toRemove, true);
986
+ advanceToNextSibling(), vParent === vnode_getParent(toRemove) && (cleanup(container, toRemove), vnode_remove(journal, vParent, toRemove, true));
979
987
  }
980
988
  }
981
989
  }
@@ -1175,7 +1183,7 @@ const vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
1175
1183
  const componentHash = componentQRL.$hash$;
1176
1184
  const vNodeComponentHash = getComponentHash(host, container.$getObjectById$);
1177
1185
  const lookupKey = jsxNode2.key || componentHash;
1178
- if (lookupKey === (getKey(host) || vNodeComponentHash) ? componentHash === vNodeComponentHash || (insertNewComponent(host, componentQRL, jsxProps), vNewNode && (host = vNewNode, shouldRender = true)) : (vNewNode = retrieveChildWithKey(null, lookupKey), vNewNode ? vnode_insertBefore(journal, vParent, vNewNode, vCurrent) : insertNewComponent(host, componentQRL, jsxProps), host = vNewNode, shouldRender = true), host) {
1186
+ if (lookupKey === (getKey(host) || vNodeComponentHash) ? componentHash === vNodeComponentHash || (insertNewComponent(host, componentQRL, jsxProps), host = vNewNode, shouldRender = true) : (vNewNode = retrieveChildWithKey(null, lookupKey), vNewNode ? vnode_insertBefore(journal, vParent, vNewNode, vCurrent) : insertNewComponent(host, componentQRL, jsxProps), host = vNewNode, shouldRender = true), host) {
1179
1187
  const vNodeProps = vnode_getProp(host, "q:props", container.$getObjectById$);
1180
1188
  shouldRender = shouldRender || propsDiffer(jsxProps, vNodeProps), shouldRender && (host[VNodeProps.flags] &= ~VNodeFlags.Deleted, container.$scheduler$(ChoreType.COMPONENT, host, componentQRL, jsxProps));
1181
1189
  }
@@ -1209,11 +1217,9 @@ const vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
1209
1217
  }(jsxNode2.children, host);
1210
1218
  } else {
1211
1219
  const lookupKey = jsxNode2.key;
1212
- if (lookupKey === getKey(host) || (vNewNode = retrieveChildWithKey(null, lookupKey), vNewNode ? vnode_insertBefore(journal, vParent, vNewNode, vCurrent) : function() {
1213
- vnode_insertBefore(journal, vParent, vNewNode = vnode_newVirtual(), vCurrent && getInsertBefore());
1214
- const jsxNode3 = jsxValue;
1215
- vnode_setProp(vNewNode, "q:props", jsxNode3.props), jsxNode3.key && vnode_setProp(vNewNode, "q:key", jsxNode3.key);
1216
- }(), host = vNewNode), host) {
1220
+ const lookupKeysAreEqual = lookupKey === getKey(host);
1221
+ const vNodeComponentHash = getComponentHash(host, container.$getObjectById$);
1222
+ if (lookupKeysAreEqual ? null != vNodeComponentHash && (insertNewInlineComponent(), host = vNewNode) : (vNewNode = retrieveChildWithKey(null, lookupKey), vNewNode ? vnode_insertBefore(journal, vParent, vNewNode, vCurrent) : insertNewInlineComponent(), host = vNewNode), host) {
1217
1223
  let componentHost = host;
1218
1224
  for (; componentHost && (!vnode_isVirtualVNode(componentHost) || null === vnode_getProp(componentHost, "q:renderFn", null)); ) {
1219
1225
  componentHost = vnode_getParent(componentHost);
@@ -1228,6 +1234,11 @@ const vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
1228
1234
  const jsxNode2 = jsxValue;
1229
1235
  container.setHostProp(vNewNode, "q:renderFn", componentQRL), container.setHostProp(vNewNode, "q:props", jsxProps), container.setHostProp(vNewNode, "q:key", jsxNode2.key);
1230
1236
  }
1237
+ function insertNewInlineComponent() {
1238
+ vnode_insertBefore(journal, vParent, vNewNode = vnode_newVirtual(), vCurrent && getInsertBefore());
1239
+ const jsxNode2 = jsxValue;
1240
+ vnode_setProp(vNewNode, "q:props", jsxNode2.props), jsxNode2.key && vnode_setProp(vNewNode, "q:key", jsxNode2.key);
1241
+ }
1231
1242
  function expectText(text) {
1232
1243
  if (null !== vCurrent) {
1233
1244
  if (3 === vnode_getType(vCurrent)) {
@@ -1278,7 +1289,7 @@ function removePropsKeys(keys, propKeys) {
1278
1289
  function cleanup(container, vNode) {
1279
1290
  let vCursor = vNode;
1280
1291
  if (vnode_isTextVNode(vNode)) {
1281
- return;
1292
+ return void markVNodeAsDeleted(vCursor);
1282
1293
  }
1283
1294
  let vParent = null;
1284
1295
  for (; ; ) {
@@ -1299,8 +1310,7 @@ function cleanup(container, vNode) {
1299
1310
  if (type & VNodeFlags.Virtual && null !== vnode_getProp(vCursor, "q:renderFn", null)) {
1300
1311
  const attrs = vnode_getProps(vCursor);
1301
1312
  for (let i = 0; i < attrs.length; i += 2) {
1302
- const key = attrs[i];
1303
- if (!isParentSlotProp(key) && isSlotProp(key)) {
1313
+ if (isSlotProp(attrs[i])) {
1304
1314
  const value = attrs[i + 1];
1305
1315
  if (value) {
1306
1316
  attrs[i + 1] = null;
@@ -1314,7 +1324,7 @@ function cleanup(container, vNode) {
1314
1324
  }
1315
1325
  }
1316
1326
  }
1317
- if (type & VNodeFlags.Virtual && null !== vnode_getProp(vCursor, QSlot, null)) {
1327
+ if (vnode_isProjection(vCursor)) {
1318
1328
  if (vCursor === vNode) {
1319
1329
  const vFirstChild = vnode_getFirstChild(vCursor);
1320
1330
  if (vFirstChild) {
@@ -1328,6 +1338,8 @@ function cleanup(container, vNode) {
1328
1338
  continue;
1329
1339
  }
1330
1340
  }
1341
+ } else {
1342
+ type & VNodeFlags.Text && markVNodeAsDeleted(vCursor);
1331
1343
  }
1332
1344
  if (vCursor === vNode) {
1333
1345
  return;
@@ -1451,10 +1463,10 @@ const vnode_documentPosition = (a2, b, rootVNode) => {
1451
1463
  let aDepth = -1;
1452
1464
  let bDepth = -1;
1453
1465
  for (; a2; ) {
1454
- a2 = (aVNodePath[++aDepth] = a2)[VNodeProps.parent] || rootVNode && vnode_getProp(a2, ":", (id) => vnode_locate(rootVNode, id));
1466
+ a2 = (aVNodePath[++aDepth] = a2)[VNodeProps.parent] || rootVNode && vnode_getProp(a2, "q:sparent", (id) => vnode_locate(rootVNode, id));
1455
1467
  }
1456
1468
  for (; b; ) {
1457
- b = (bVNodePath[++bDepth] = b)[VNodeProps.parent] || rootVNode && vnode_getProp(b, ":", (id) => vnode_locate(rootVNode, id));
1469
+ b = (bVNodePath[++bDepth] = b)[VNodeProps.parent] || rootVNode && vnode_getProp(b, "q:sparent", (id) => vnode_locate(rootVNode, id));
1458
1470
  }
1459
1471
  for (; aDepth >= 0 && bDepth >= 0; ) {
1460
1472
  if ((a2 = aVNodePath[aDepth]) !== (b = bVNodePath[bDepth])) {
@@ -1470,7 +1482,7 @@ const vnode_documentPosition = (a2, b, rootVNode) => {
1470
1482
  return -1;
1471
1483
  }
1472
1484
  } while (cursor);
1473
- return rootVNode && vnode_getProp(b, ":", (id) => vnode_locate(rootVNode, id)) ? -1 : 1;
1485
+ return rootVNode && vnode_getProp(b, "q:sparent", (id) => vnode_locate(rootVNode, id)) ? -1 : 1;
1474
1486
  }
1475
1487
  aDepth--, bDepth--;
1476
1488
  }
@@ -1716,6 +1728,13 @@ const toNumber = (value) => "number" == typeof value ? value : -1;
1716
1728
  function vNodeAlreadyDeleted(chore) {
1717
1729
  return !!(chore.$host$ && vnode_isVNode(chore.$host$) && chore.$host$[VNodeProps.flags] & VNodeFlags.Deleted);
1718
1730
  }
1731
+ var SignalFlags;
1732
+ var WrappedSignalFlags;
1733
+ !function(SignalFlags2) {
1734
+ SignalFlags2[SignalFlags2.INVALID = 1] = "INVALID";
1735
+ }(SignalFlags || (SignalFlags = {})), function(WrappedSignalFlags2) {
1736
+ WrappedSignalFlags2[WrappedSignalFlags2.UNWRAP = 2] = "UNWRAP";
1737
+ }(WrappedSignalFlags || (WrappedSignalFlags = {}));
1719
1738
  const throwIfQRLNotResolved = (qrl2) => {
1720
1739
  if (!qrl2.resolved) {
1721
1740
  throw qrl2.resolve();
@@ -1773,7 +1792,7 @@ class Signal {
1773
1792
  valueOf() {
1774
1793
  }
1775
1794
  toString() {
1776
- return `[${this.constructor.name}${this.$invalid$ ? " INVALID" : ""} ${String(this.$untrackedValue$)}]` + (Array.from(this.$effects$ || []).map((e) => "\n -> " + pad(qwikDebugToString(e[0]), " ")).join("\n") || "");
1795
+ return `[${this.constructor.name}${this.$flags$ & SignalFlags.INVALID ? " INVALID" : ""} ${String(this.$untrackedValue$)}]` + (Array.from(this.$effects$ || []).map((e) => "\n -> " + pad(qwikDebugToString(e[0]), " ")).join("\n") || "");
1777
1796
  }
1778
1797
  toJSON() {
1779
1798
  return {
@@ -1833,26 +1852,27 @@ const triggerEffects = (container, signal, effects) => {
1833
1852
  }
1834
1853
  }
1835
1854
  };
1836
- class ComputedSignal extends Signal {
1837
- constructor(container, fn) {
1855
+ class ComputedSignal extends (_c = Signal, _b = _EFFECT_BACK_REF, _c) {
1856
+ constructor(container, fn, flags = SignalFlags.INVALID) {
1838
1857
  super(container, NEEDS_COMPUTATION);
1839
1858
  __publicField(this, "$computeQrl$");
1840
- __publicField(this, "$invalid$", true);
1859
+ __publicField(this, "$flags$");
1841
1860
  __publicField(this, "$forceRunEffects$", false);
1842
- this.$computeQrl$ = fn;
1861
+ __publicField(this, _b, null);
1862
+ this.$computeQrl$ = fn, this.$flags$ = flags;
1843
1863
  }
1844
1864
  $invalidate$() {
1845
- this.$invalid$ = true, this.$forceRunEffects$ = false, this.$container$?.$scheduler$(ChoreType.RECOMPUTE_AND_SCHEDULE_EFFECTS, null, this);
1865
+ this.$flags$ |= SignalFlags.INVALID, this.$forceRunEffects$ = false, this.$container$?.$scheduler$(ChoreType.RECOMPUTE_AND_SCHEDULE_EFFECTS, null, this);
1846
1866
  }
1847
1867
  force() {
1848
- this.$invalid$ = true, this.$forceRunEffects$ = false, triggerEffects(this.$container$, this, this.$effects$);
1868
+ this.$flags$ |= SignalFlags.INVALID, this.$forceRunEffects$ = false, triggerEffects(this.$container$, this, this.$effects$);
1849
1869
  }
1850
1870
  get untrackedValue() {
1851
1871
  const didChange = this.$computeIfNeeded$();
1852
1872
  return didChange && (this.$forceRunEffects$ = didChange), assertFalse(this.$untrackedValue$ === NEEDS_COMPUTATION), this.$untrackedValue$;
1853
1873
  }
1854
1874
  $computeIfNeeded$() {
1855
- if (!this.$invalid$) {
1875
+ if (!(this.$flags$ & SignalFlags.INVALID)) {
1856
1876
  return false;
1857
1877
  }
1858
1878
  const computeQrl = this.$computeQrl$;
@@ -1865,7 +1885,7 @@ class ComputedSignal extends Signal {
1865
1885
  if (isPromise(untrackedValue)) {
1866
1886
  throw qError(QError.computedNotSync, [computeQrl.dev ? computeQrl.dev.file : "", computeQrl.$hash$]);
1867
1887
  }
1868
- this.$invalid$ = false;
1888
+ this.$flags$ &= ~SignalFlags.INVALID;
1869
1889
  const didChange = untrackedValue !== this.$untrackedValue$;
1870
1890
  return didChange && (this.$untrackedValue$ = untrackedValue), didChange;
1871
1891
  } finally {
@@ -1879,30 +1899,30 @@ class ComputedSignal extends Signal {
1879
1899
  throw qError(QError.computedReadOnly);
1880
1900
  }
1881
1901
  }
1882
- class WrappedSignal extends (_c = Signal, _b = _EFFECT_BACK_REF, _c) {
1883
- constructor(container, fn, args, fnStr) {
1902
+ class WrappedSignal extends (_e = Signal, _d = _EFFECT_BACK_REF, _e) {
1903
+ constructor(container, fn, args, fnStr, flags = SignalFlags.INVALID | WrappedSignalFlags.UNWRAP) {
1884
1904
  super(container, NEEDS_COMPUTATION);
1885
1905
  __publicField(this, "$args$");
1886
1906
  __publicField(this, "$func$");
1887
1907
  __publicField(this, "$funcStr$");
1888
- __publicField(this, "$invalid$", true);
1908
+ __publicField(this, "$flags$");
1889
1909
  __publicField(this, "$hostElement$", null);
1890
1910
  __publicField(this, "$forceRunEffects$", false);
1891
- __publicField(this, _b, null);
1892
- this.$args$ = args, this.$func$ = fn, this.$funcStr$ = fnStr;
1911
+ __publicField(this, _d, null);
1912
+ this.$args$ = args, this.$func$ = fn, this.$funcStr$ = fnStr, this.$flags$ = flags;
1893
1913
  }
1894
1914
  $invalidate$() {
1895
- this.$invalid$ = true, this.$forceRunEffects$ = false, this.$container$?.$scheduler$(ChoreType.RECOMPUTE_AND_SCHEDULE_EFFECTS, this.$hostElement$, this);
1915
+ this.$flags$ |= SignalFlags.INVALID, this.$forceRunEffects$ = false, this.$container$?.$scheduler$(ChoreType.RECOMPUTE_AND_SCHEDULE_EFFECTS, this.$hostElement$, this);
1896
1916
  }
1897
1917
  force() {
1898
- this.$invalid$ = true, this.$forceRunEffects$ = false, triggerEffects(this.$container$, this, this.$effects$);
1918
+ this.$flags$ |= SignalFlags.INVALID, this.$forceRunEffects$ = false, triggerEffects(this.$container$, this, this.$effects$);
1899
1919
  }
1900
1920
  get untrackedValue() {
1901
1921
  const didChange = this.$computeIfNeeded$();
1902
1922
  return didChange && (this.$forceRunEffects$ = didChange), assertFalse(this.$untrackedValue$ === NEEDS_COMPUTATION), this.$untrackedValue$;
1903
1923
  }
1904
1924
  $computeIfNeeded$() {
1905
- if (!this.$invalid$) {
1925
+ if (!(this.$flags$ & SignalFlags.INVALID)) {
1906
1926
  return false;
1907
1927
  }
1908
1928
  const untrackedValue = trackSignal(() => this.$func$(...this.$args$), this, EffectProperty.VNODE, this.$container$);
@@ -1916,7 +1936,7 @@ class WrappedSignal extends (_c = Signal, _b = _EFFECT_BACK_REF, _c) {
1916
1936
  throw qError(QError.wrappedReadOnly);
1917
1937
  }
1918
1938
  }
1919
- const version = "2.0.0-alpha.7-dev+a26598a";
1939
+ const version = "2.0.0-alpha.8-dev+66037b5";
1920
1940
  class _SharedContainer {
1921
1941
  constructor(scheduleDrain, journalFlush, serverData, locale) {
1922
1942
  __publicField(this, "$version$");
@@ -1992,7 +2012,7 @@ class PropsProxyHandler {
1992
2012
  return this.$children$;
1993
2013
  }
1994
2014
  const value = this.$constProps$ && prop in this.$constProps$ ? this.$constProps$[prop] : this.$varProps$[prop];
1995
- return value instanceof WrappedSignal ? value.value : value;
2015
+ return value instanceof WrappedSignal && value.$flags$ & WrappedSignalFlags.UNWRAP ? value.value : value;
1996
2016
  }
1997
2017
  set(_, prop, value) {
1998
2018
  return prop === _CONST_PROPS ? (this.$constProps$ = value, true) : prop === _VAR_PROPS ? (this.$varProps$ = value, true) : (this.$constProps$ && prop in this.$constProps$ ? this.$constProps$[prop] = value : this.$varProps$[prop] = value, true);
@@ -2132,8 +2152,8 @@ const VNodeDataChar = {
2132
2152
  ID_CHAR: "=",
2133
2153
  PROPS: 62,
2134
2154
  PROPS_CHAR: ">",
2135
- SLOT_REF: 63,
2136
- SLOT_REF_CHAR: "?",
2155
+ SLOT_PARENT: 63,
2156
+ SLOT_PARENT_CHAR: "?",
2137
2157
  KEY: 64,
2138
2158
  KEY_CHAR: "@",
2139
2159
  SEQ: 91,
@@ -2197,6 +2217,9 @@ const vnode_isTextVNode = (vNode) => {
2197
2217
  const vnode_isVirtualVNode = (vNode) => {
2198
2218
  return (vNode[VNodeProps.flags] & VNodeFlags.Virtual) === VNodeFlags.Virtual;
2199
2219
  };
2220
+ const vnode_isProjection = (vNode) => {
2221
+ return (vNode[VNodeProps.flags] & VNodeFlags.Virtual) === VNodeFlags.Virtual && null !== vnode_getProp(vNode, QSlot, null);
2222
+ };
2200
2223
  const ensureTextVNode = (vNode) => (assertTrue(vnode_isTextVNode(vNode), "Expecting TextVNode was: " + vnode_getNodeTypeName(vNode)), vNode);
2201
2224
  const ensureElementOrVirtualVNode = (vNode) => {
2202
2225
  assertTrue(!!(vNode[VNodeProps.flags] & VNodeFlags.ELEMENT_OR_VIRTUAL_MASK), "Expecting ElementVNode or VirtualVNode was: " + vnode_getNodeTypeName(vNode));
@@ -2445,7 +2468,7 @@ const vnode_applyJournal = (journal) => {
2445
2468
  let key = journal[idx++];
2446
2469
  "className" === key && (key = "class");
2447
2470
  const value = journal[idx++];
2448
- isBooleanAttr(element, key) ? element[key] = parseBoolean(value) : "value" === key && key in element ? element.value = escapeHTML(String(value)) : key === dangerouslySetInnerHTML ? element.innerHTML = value : null == value || false === value ? element.removeAttribute(key) : element.setAttribute(key, String(value));
2471
+ isBooleanAttr(element, key) ? element[key] = parseBoolean(value) : "value" === key && key in element ? element.value = String(value) : key === dangerouslySetInnerHTML ? element.innerHTML = value : null == value || false === value ? element.removeAttribute(key) : element.setAttribute(key, String(value));
2449
2472
  break;
2450
2473
  case VNodeJournalOpCode.HoistStyles:
2451
2474
  const document2 = journal[idx++];
@@ -2798,8 +2821,6 @@ function materializeFromVNodeData(vParent, vData, element, child) {
2798
2821
  container.$setRawState$(parseInt(id), vParent);
2799
2822
  } else if (peek() === VNodeDataChar.PROPS) {
2800
2823
  vnode_setAttr(null, vParent, "q:props", consumeValue());
2801
- } else if (peek() === VNodeDataChar.SLOT_REF) {
2802
- vnode_setAttr(null, vParent, "q:sref", consumeValue());
2803
2824
  } else if (peek() === VNodeDataChar.KEY) {
2804
2825
  vnode_setAttr(null, vParent, "q:key", consumeValue());
2805
2826
  } else if (peek() === VNodeDataChar.SEQ) {
@@ -2808,6 +2829,8 @@ function materializeFromVNodeData(vParent, vData, element, child) {
2808
2829
  vnode_setAttr(null, vParent, "q:seqIdx", consumeValue());
2809
2830
  } else if (peek() === VNodeDataChar.BACK_REFS) {
2810
2831
  container || (container = getDomContainer(element)), setEffectBackRefFromVNodeData(vParent, consumeValue(), container);
2832
+ } else if (peek() === VNodeDataChar.SLOT_PARENT) {
2833
+ vnode_setProp(vParent, "q:sparent", consumeValue());
2811
2834
  } else if (peek() === VNodeDataChar.CONTEXT) {
2812
2835
  vnode_setAttr(null, vParent, "q:ctx", consumeValue());
2813
2836
  } else if (peek() === VNodeDataChar.OPEN) {
@@ -2851,7 +2874,7 @@ const vnode_getProjectionParentComponent = (vHost, rootVNode) => {
2851
2874
  let projectionDepth = 1;
2852
2875
  for (; projectionDepth--; ) {
2853
2876
  for (; vHost && (!vnode_isVirtualVNode(vHost) || null === vnode_getProp(vHost, "q:renderFn", null)); ) {
2854
- const qSlotParent = vnode_getProp(vHost, ":", (id) => vnode_locate(rootVNode, id));
2877
+ const qSlotParent = vnode_getProp(vHost, "q:sparent", (id) => vnode_locate(rootVNode, id));
2855
2878
  const vProjectionParent = vnode_isVirtualVNode(vHost) && qSlotParent;
2856
2879
  vProjectionParent && projectionDepth++, vHost = vProjectionParent || vnode_getParent(vHost);
2857
2880
  }
@@ -3197,7 +3220,7 @@ class DomContainer extends _SharedContainer {
3197
3220
  if (null !== vnode_getProp(vNode, "q:renderFn", null)) {
3198
3221
  return vNode;
3199
3222
  }
3200
- vNode = vnode_getParent(vNode) || vnode_getProp(vNode, ":", this.vNodeLocate);
3223
+ vNode = vnode_getParent(vNode) || vnode_getProp(vNode, "q:sparent", this.vNodeLocate);
3201
3224
  } else {
3202
3225
  vNode = vnode_getParent(vNode);
3203
3226
  }
@@ -3397,13 +3420,13 @@ const inflate = (container, target, typeId, data) => {
3397
3420
  case TypeIds.WrappedSignal: {
3398
3421
  const signal = target;
3399
3422
  const d = data;
3400
- signal.$func$ = container.getSyncFn(d[0]), signal.$args$ = d[1], signal[_EFFECT_BACK_REF] = d[2], signal.$untrackedValue$ = d[3], signal.$hostElement$ = d[4], signal.$effects$ = new Set(d.slice(5));
3423
+ signal.$func$ = container.getSyncFn(d[0]), signal.$args$ = d[1], signal[_EFFECT_BACK_REF] = d[2], signal.$untrackedValue$ = d[3], signal.$flags$ = d[4], signal.$hostElement$ = d[5], signal.$effects$ = new Set(d.slice(6));
3401
3424
  break;
3402
3425
  }
3403
3426
  case TypeIds.ComputedSignal: {
3404
3427
  const computed = target;
3405
3428
  const d = data;
3406
- computed.$computeQrl$ = d[0], computed.$effects$ = d[1], 3 === d.length ? computed.$untrackedValue$ = d[2] : (computed.$invalid$ = true, computed.$computeQrl$.resolve(), container.$scheduler$?.(ChoreType.QRL_RESOLVE, null, computed.$computeQrl$));
3429
+ computed.$computeQrl$ = d[0], computed.$effects$ = d[1], 3 === d.length ? computed.$untrackedValue$ = d[2] : (computed.$flags$ |= SignalFlags.INVALID, computed.$computeQrl$.resolve(), container.$scheduler$?.(ChoreType.QRL_RESOLVE, null, computed.$computeQrl$));
3407
3430
  break;
3408
3431
  }
3409
3432
  case TypeIds.Error: {
@@ -3479,7 +3502,7 @@ const inflate = (container, target, typeId, data) => {
3479
3502
  }
3480
3503
  return target;
3481
3504
  };
3482
- const _constants = [void 0, null, true, false, "", EMPTY_ARRAY, EMPTY_OBJ, NEEDS_COMPUTATION, STORE_ARRAY_PROP, Slot, Fragment, NaN, 1 / 0, -1 / 0, Number.MAX_SAFE_INTEGER, Number.MAX_SAFE_INTEGER - 1, Number.MIN_SAFE_INTEGER];
3505
+ const _constants = [void 0, null, true, false, "", EMPTY_ARRAY, EMPTY_OBJ, NEEDS_COMPUTATION, STORE_ALL_PROPS, Slot, Fragment, NaN, 1 / 0, -1 / 0, Number.MAX_SAFE_INTEGER, Number.MAX_SAFE_INTEGER - 1, Number.MIN_SAFE_INTEGER];
3483
3506
  const allocate = (container, typeId, value) => {
3484
3507
  if (void 0 === value) {
3485
3508
  return typeId;
@@ -3676,8 +3699,8 @@ const createSerializationContext = (NodeConstructor, DomRefConstructor, symbolTo
3676
3699
  discoveredValues.push(k, v);
3677
3700
  });
3678
3701
  } else if (obj instanceof Signal) {
3679
- const v = obj instanceof WrappedSignal ? obj.untrackedValue : obj instanceof ComputedSignal && (obj.$invalid$ || fastSkipSerialize(obj)) ? NEEDS_COMPUTATION : obj.$untrackedValue$;
3680
- v !== NEEDS_COMPUTATION && discoveredValues.push(v), obj.$effects$ && discoveredValues.push(...obj.$effects$), obj instanceof WrappedSignal ? (discoverEffectBackRefs(obj[_EFFECT_BACK_REF], discoveredValues), obj.$args$ && discoveredValues.push(...obj.$args$), obj.$hostElement$ && discoveredValues.push(obj.$hostElement$)) : obj instanceof ComputedSignal && discoveredValues.push(obj.$computeQrl$);
3702
+ const v = obj instanceof WrappedSignal ? obj.untrackedValue : obj instanceof ComputedSignal && (obj.$flags$ & SignalFlags.INVALID || fastSkipSerialize(obj)) ? NEEDS_COMPUTATION : obj.$untrackedValue$;
3703
+ v !== NEEDS_COMPUTATION && discoveredValues.push(v), obj.$effects$ && discoveredValues.push(obj.$effects$), obj instanceof WrappedSignal ? (discoverEffectBackRefs(obj[_EFFECT_BACK_REF], discoveredValues), obj.$args$ && discoveredValues.push(...obj.$args$), obj.$hostElement$ && discoveredValues.push(obj.$hostElement$)) : obj instanceof ComputedSignal && (discoverEffectBackRefs(obj[_EFFECT_BACK_REF], discoveredValues), discoveredValues.push(obj.$computeQrl$));
3681
3704
  } else if (obj instanceof Task) {
3682
3705
  discoveredValues.push(obj.$el$, obj.$qrl$, obj.$state$), discoverEffectBackRefs(obj[_EFFECT_BACK_REF], discoveredValues);
3683
3706
  } else if (isSsrNode2(obj)) {
@@ -3750,16 +3773,7 @@ const discoverValuesForVNodeData = (vnodeData, discoveredValues) => {
3750
3773
  }
3751
3774
  };
3752
3775
  const discoverEffectBackRefs = (effectsBackRefs, discoveredValues) => {
3753
- if (effectsBackRefs) {
3754
- let hasBackRefs = false;
3755
- for (const [, effect] of effectsBackRefs) {
3756
- if (effect[EffectSubscriptionProp.BACK_REF]) {
3757
- hasBackRefs = true;
3758
- break;
3759
- }
3760
- }
3761
- hasBackRefs && discoveredValues.push(effectsBackRefs);
3762
- }
3776
+ effectsBackRefs && discoveredValues.push(effectsBackRefs);
3763
3777
  };
3764
3778
  const promiseResults = /* @__PURE__ */ new WeakMap();
3765
3779
  function serialize(serializationContext) {
@@ -3824,10 +3838,10 @@ function serialize(serializationContext) {
3824
3838
  } else if (value === NEEDS_COMPUTATION) {
3825
3839
  output(TypeIds.Constant, Constants.NEEDS_COMPUTATION);
3826
3840
  } else {
3827
- if (value !== STORE_ARRAY_PROP) {
3841
+ if (value !== STORE_ALL_PROPS) {
3828
3842
  throw qError(QError.serializeErrorUnknownType, [typeof value]);
3829
3843
  }
3830
- output(TypeIds.Constant, Constants.STORE_ARRAY_PROP);
3844
+ output(TypeIds.Constant, Constants.STORE_ALL_PROPS);
3831
3845
  }
3832
3846
  };
3833
3847
  const writeObjectValue = (value, idx) => {
@@ -3885,9 +3899,9 @@ function serialize(serializationContext) {
3885
3899
  } else if ($isDomRef$(value)) {
3886
3900
  value.$ssrNode$.vnodeData[0] |= VNodeDataFlag.SERIALIZE, output(TypeIds.RefVNode, value.$ssrNode$.id);
3887
3901
  } else if (value instanceof Signal) {
3888
- const v = value instanceof ComputedSignal && (value.$invalid$ || fastSkipSerialize(value.$untrackedValue$)) ? NEEDS_COMPUTATION : value.$untrackedValue$;
3902
+ const v = value instanceof ComputedSignal && (value.$flags$ & SignalFlags.INVALID || fastSkipSerialize(value.$untrackedValue$)) ? NEEDS_COMPUTATION : value.$untrackedValue$;
3889
3903
  if (value instanceof WrappedSignal) {
3890
- output(TypeIds.WrappedSignal, [...serializeWrappingFn(serializationContext, value), filterEffectBackRefs(value[_EFFECT_BACK_REF]), v, value.$hostElement$, ...value.$effects$ || []]);
3904
+ output(TypeIds.WrappedSignal, [...serializeWrappingFn(serializationContext, value), filterEffectBackRefs(value[_EFFECT_BACK_REF]), v, value.$flags$, value.$hostElement$, ...value.$effects$ || []]);
3891
3905
  } else if (value instanceof ComputedSignal) {
3892
3906
  const out = [value.$computeQrl$, value.$effects$];
3893
3907
  v !== NEEDS_COMPUTATION && out.push(v), output(TypeIds.ComputedSignal, out);
@@ -4031,7 +4045,7 @@ var Constants;
4031
4045
  !function(TypeIds2) {
4032
4046
  TypeIds2[TypeIds2.RootRef = 0] = "RootRef", TypeIds2[TypeIds2.Constant = 1] = "Constant", TypeIds2[TypeIds2.Number = 2] = "Number", TypeIds2[TypeIds2.String = 3] = "String", TypeIds2[TypeIds2.Array = 4] = "Array", TypeIds2[TypeIds2.URL = 5] = "URL", TypeIds2[TypeIds2.Date = 6] = "Date", TypeIds2[TypeIds2.Regex = 7] = "Regex", TypeIds2[TypeIds2.VNode = 8] = "VNode", TypeIds2[TypeIds2.RefVNode = 9] = "RefVNode", TypeIds2[TypeIds2.BigInt = 10] = "BigInt", TypeIds2[TypeIds2.URLSearchParams = 11] = "URLSearchParams", TypeIds2[TypeIds2.Error = 12] = "Error", TypeIds2[TypeIds2.Object = 13] = "Object", TypeIds2[TypeIds2.Promise = 14] = "Promise", TypeIds2[TypeIds2.Set = 15] = "Set", TypeIds2[TypeIds2.Map = 16] = "Map", TypeIds2[TypeIds2.Uint8Array = 17] = "Uint8Array", TypeIds2[TypeIds2.QRL = 18] = "QRL", TypeIds2[TypeIds2.Task = 19] = "Task", TypeIds2[TypeIds2.Resource = 20] = "Resource", TypeIds2[TypeIds2.Component = 21] = "Component", TypeIds2[TypeIds2.Signal = 22] = "Signal", TypeIds2[TypeIds2.WrappedSignal = 23] = "WrappedSignal", TypeIds2[TypeIds2.ComputedSignal = 24] = "ComputedSignal", TypeIds2[TypeIds2.Store = 25] = "Store", TypeIds2[TypeIds2.StoreArray = 26] = "StoreArray", TypeIds2[TypeIds2.FormData = 27] = "FormData", TypeIds2[TypeIds2.JSXNode = 28] = "JSXNode", TypeIds2[TypeIds2.PropsProxy = 29] = "PropsProxy", TypeIds2[TypeIds2.EffectData = 30] = "EffectData";
4033
4047
  }(TypeIds || (TypeIds = {})), function(Constants2) {
4034
- Constants2[Constants2.Undefined = 0] = "Undefined", Constants2[Constants2.Null = 1] = "Null", Constants2[Constants2.True = 2] = "True", Constants2[Constants2.False = 3] = "False", Constants2[Constants2.EmptyString = 4] = "EmptyString", Constants2[Constants2.EMPTY_ARRAY = 5] = "EMPTY_ARRAY", Constants2[Constants2.EMPTY_OBJ = 6] = "EMPTY_OBJ", Constants2[Constants2.NEEDS_COMPUTATION = 7] = "NEEDS_COMPUTATION", Constants2[Constants2.STORE_ARRAY_PROP = 8] = "STORE_ARRAY_PROP", Constants2[Constants2.Slot = 9] = "Slot", Constants2[Constants2.Fragment = 10] = "Fragment", Constants2[Constants2.NaN = 11] = "NaN", Constants2[Constants2.PositiveInfinity = 12] = "PositiveInfinity", Constants2[Constants2.NegativeInfinity = 13] = "NegativeInfinity", Constants2[Constants2.MaxSafeInt = 14] = "MaxSafeInt", Constants2[Constants2.AlmostMaxSafeInt = 15] = "AlmostMaxSafeInt", Constants2[Constants2.MinSafeInt = 16] = "MinSafeInt";
4048
+ Constants2[Constants2.Undefined = 0] = "Undefined", Constants2[Constants2.Null = 1] = "Null", Constants2[Constants2.True = 2] = "True", Constants2[Constants2.False = 3] = "False", Constants2[Constants2.EmptyString = 4] = "EmptyString", Constants2[Constants2.EMPTY_ARRAY = 5] = "EMPTY_ARRAY", Constants2[Constants2.EMPTY_OBJ = 6] = "EMPTY_OBJ", Constants2[Constants2.NEEDS_COMPUTATION = 7] = "NEEDS_COMPUTATION", Constants2[Constants2.STORE_ALL_PROPS = 8] = "STORE_ALL_PROPS", Constants2[Constants2.Slot = 9] = "Slot", Constants2[Constants2.Fragment = 10] = "Fragment", Constants2[Constants2.NaN = 11] = "NaN", Constants2[Constants2.PositiveInfinity = 12] = "PositiveInfinity", Constants2[Constants2.NegativeInfinity = 13] = "NegativeInfinity", Constants2[Constants2.MaxSafeInt = 14] = "MaxSafeInt", Constants2[Constants2.AlmostMaxSafeInt = 15] = "AlmostMaxSafeInt", Constants2[Constants2.MinSafeInt = 16] = "MinSafeInt";
4035
4049
  }(Constants || (Constants = {}));
4036
4050
  const noSerializeSet = /* @__PURE__ */ new WeakSet();
4037
4051
  const fastSkipSerialize = (obj) => noSerializeSet.has(obj);
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@qwik.dev/core/loader",
3
- "version": "2.0.0-alpha.7-dev+a26598a",
3
+ "version": "2.0.0-alpha.8-dev+66037b5",
4
4
  "main": "index.mjs",
5
5
  "types": "index.d.ts",
6
6
  "private": true,
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * @qwik.dev/core/optimizer 2.0.0-alpha.7-dev+a26598a
3
+ * @qwik.dev/core/optimizer 2.0.0-alpha.8-dev+66037b5
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
@@ -1235,7 +1235,7 @@ globalThis.qwikOptimizer = function(module) {
1235
1235
  }
1236
1236
  };
1237
1237
  var versions = {
1238
- qwik: "2.0.0-alpha.7-dev+a26598a"
1238
+ qwik: "2.0.0-alpha.8-dev+66037b5"
1239
1239
  };
1240
1240
  async function getSystem() {
1241
1241
  const sysEnv = getEnv();
@@ -1820,6 +1820,7 @@ globalThis.qwikOptimizer = function(module) {
1820
1820
  const clientTransformedOutputs = new Map;
1821
1821
  const serverTransformedOutputs = new Map;
1822
1822
  const parentIds = new Map;
1823
+ const npmChunks = new Map;
1823
1824
  let internalOptimizer = null;
1824
1825
  let linter;
1825
1826
  let diagnosticsCallback = () => {};
@@ -2020,6 +2021,7 @@ globalThis.qwikOptimizer = function(module) {
2020
2021
  debug("transformedOutputs.clear()");
2021
2022
  clientTransformedOutputs.clear();
2022
2023
  serverTransformedOutputs.clear();
2024
+ npmChunks.clear();
2023
2025
  };
2024
2026
  const getIsServer = viteOpts => devServer ? !!(null == viteOpts ? void 0 : viteOpts.ssr) : "ssr" === opts.target || "test" === opts.target;
2025
2027
  let resolveIdCount = 0;
@@ -2359,9 +2361,24 @@ globalThis.qwikOptimizer = function(module) {
2359
2361
  }
2360
2362
  }
2361
2363
  function manualChunks(id2, {getModuleInfo: getModuleInfo}) {
2364
+ var _a;
2362
2365
  const module2 = getModuleInfo(id2);
2363
2366
  const segment = module2.meta.segment;
2364
- return null == segment ? void 0 : segment.entry;
2367
+ if (segment) {
2368
+ return segment.entry;
2369
+ }
2370
+ const moduleIndex = id2.indexOf("node_modules");
2371
+ if (-1 === moduleIndex) {
2372
+ return;
2373
+ }
2374
+ const modulePath = id2.slice(moduleIndex + 12);
2375
+ const moduleName = id2.startsWith("@") ? modulePath.split("/").slice(0, 2).join("_") : modulePath.slice(0, modulePath.indexOf("/"));
2376
+ let size = (null == (_a = module2.code) ? void 0 : _a.length) || 0;
2377
+ size += npmChunks.get(moduleName) || 0;
2378
+ npmChunks.set(moduleName, size);
2379
+ if (size > 1e4) {
2380
+ return moduleName;
2381
+ }
2365
2382
  }
2366
2383
  return {
2367
2384
  buildStart: buildStart,
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * @qwik.dev/core/optimizer 2.0.0-alpha.7-dev+a26598a
3
+ * @qwik.dev/core/optimizer 2.0.0-alpha.8-dev+66037b5
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
@@ -1260,7 +1260,7 @@ var QWIK_BINDING_MAP = {
1260
1260
  };
1261
1261
 
1262
1262
  var versions = {
1263
- qwik: "2.0.0-alpha.7-dev+a26598a"
1263
+ qwik: "2.0.0-alpha.8-dev+66037b5"
1264
1264
  };
1265
1265
 
1266
1266
  async function getSystem() {
@@ -1836,6 +1836,7 @@ function createPlugin(optimizerOptions = {}) {
1836
1836
  const clientTransformedOutputs = new Map;
1837
1837
  const serverTransformedOutputs = new Map;
1838
1838
  const parentIds = new Map;
1839
+ const npmChunks = new Map;
1839
1840
  let internalOptimizer = null;
1840
1841
  let linter;
1841
1842
  let diagnosticsCallback = () => {};
@@ -2036,6 +2037,7 @@ function createPlugin(optimizerOptions = {}) {
2036
2037
  debug("transformedOutputs.clear()");
2037
2038
  clientTransformedOutputs.clear();
2038
2039
  serverTransformedOutputs.clear();
2040
+ npmChunks.clear();
2039
2041
  };
2040
2042
  const getIsServer = viteOpts => devServer ? !!viteOpts?.ssr : "ssr" === opts.target || "test" === opts.target;
2041
2043
  let resolveIdCount = 0;
@@ -2374,7 +2376,21 @@ function createPlugin(optimizerOptions = {}) {
2374
2376
  function manualChunks(id2, {getModuleInfo: getModuleInfo}) {
2375
2377
  const module = getModuleInfo(id2);
2376
2378
  const segment = module.meta.segment;
2377
- return segment?.entry;
2379
+ if (segment) {
2380
+ return segment.entry;
2381
+ }
2382
+ const moduleIndex = id2.indexOf("node_modules");
2383
+ if (-1 === moduleIndex) {
2384
+ return;
2385
+ }
2386
+ const modulePath = id2.slice(moduleIndex + 12);
2387
+ const moduleName = id2.startsWith("@") ? modulePath.split("/").slice(0, 2).join("_") : modulePath.slice(0, modulePath.indexOf("/"));
2388
+ let size = module.code?.length || 0;
2389
+ size += npmChunks.get(moduleName) || 0;
2390
+ npmChunks.set(moduleName, size);
2391
+ if (size > 1e4) {
2392
+ return moduleName;
2393
+ }
2378
2394
  }
2379
2395
  return {
2380
2396
  buildStart: buildStart,