@qwik.dev/core 2.0.0-beta.36 → 2.0.0-beta.37

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.
@@ -226,6 +226,7 @@ declare const _EFFECT_BACK_REF: unique symbol;
226
226
 
227
227
  declare type EffectBackRef = SignalImpl | StoreTarget | PropsProxy;
228
228
 
229
+ /** @internal */
229
230
  declare const enum EffectProperty {
230
231
  COMPONENT = ":",
231
232
  VNODE = "."
@@ -324,6 +325,7 @@ declare type FunctionComponent<P = unknown> = {
324
325
  /** @public */
325
326
  export declare function getTestPlatform(): TestPlatform;
326
327
 
328
+ /** @internal */
327
329
  declare type HostElement = VNode | ISsrNode;
328
330
 
329
331
  /** @public */
@@ -911,6 +913,7 @@ declare class SubscriptionData {
911
913
 
912
914
  declare type SymbolToChunkResolver = (symbol: string) => string;
913
915
 
916
+ /** @internal */
914
917
  declare class Task<T = unknown, B = T> extends BackRef implements DescriptorBase<unknown, Signal<B>> {
915
918
  $flags$: number;
916
919
  $index$: number;
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * @qwik.dev/core/testing 2.0.0-beta.36-dev+3268fab
3
+ * @qwik.dev/core/testing 2.0.0-beta.37-dev+82dc74d
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
@@ -21739,6 +21739,7 @@ var QScopedStyle = "q:sstyle";
21739
21739
  var QCtxAttr = "q:ctx";
21740
21740
  var QBackRefs = "q:brefs";
21741
21741
  var QFuncsPrefix = "qFuncs_";
21742
+ var QwikEvContainerReady = 0;
21742
21743
  var getQFuncs = (document2, hash) => {
21743
21744
  return document2[QFuncsPrefix + hash] || [];
21744
21745
  };
@@ -22084,7 +22085,7 @@ var setupHmr = (LazyRefClass, setGetLazyRef) => {
22084
22085
  params.push(`t=${t}`);
22085
22086
  return `${path}?${params.join("&")}`;
22086
22087
  };
22087
- document.addEventListener("qHmr", (ev) => {
22088
+ const hmrHandler = (ev) => {
22088
22089
  const files = ev.detail.files;
22089
22090
  const t = ev.detail.t || document.__hmrT || Date.now();
22090
22091
  let didReload = false;
@@ -22120,7 +22121,6 @@ var setupHmr = (LazyRefClass, setGetLazyRef) => {
22120
22121
  }
22121
22122
  if (didReload) {
22122
22123
  lazy.$ref$ = void 0;
22123
- document.__hmrDone = document.__hmrT;
22124
22124
  if (lazy.qrls) {
22125
22125
  for (const qrlRef of lazy.qrls) {
22126
22126
  const qrl = qrlRef.deref();
@@ -22135,7 +22135,8 @@ var setupHmr = (LazyRefClass, setGetLazyRef) => {
22135
22135
  }
22136
22136
  }
22137
22137
  }
22138
- });
22138
+ };
22139
+ document.addEventListener("qHmr", hmrHandler, true);
22139
22140
  };
22140
22141
 
22141
22142
  // packages/qwik/src/core/shared/qrl/qrl-class.ts
@@ -26525,12 +26526,15 @@ function executeNodeDiff(vNode, container, journal, cursor) {
26525
26526
  return vnode_diff(container, journal, jsx2, domVNode, cursor, null);
26526
26527
  }
26527
26528
  function executeComponentChore(vNode, container, journal, cursor) {
26528
- vNode.dirty &= ~4 /* COMPONENT */;
26529
26529
  const host = vNode;
26530
26530
  const componentQRL = container.getHostProp(
26531
26531
  host,
26532
26532
  OnRenderProp
26533
26533
  );
26534
+ if (componentQRL && !componentQRL.resolved) {
26535
+ return componentQRL.resolve();
26536
+ }
26537
+ vNode.dirty &= ~4 /* COMPONENT */;
26534
26538
  if (!componentQRL) {
26535
26539
  return;
26536
26540
  }
@@ -27930,6 +27934,8 @@ var Serializer = class {
27930
27934
  this.output(3 /* Constant */, 9 /* UNINITIALIZED */);
27931
27935
  } else if (value === explicitUndefined) {
27932
27936
  this.output(3 /* Constant */, 0 /* Undefined */);
27937
+ } else {
27938
+ throw qError(20 /* serializeErrorUnknownType */, [typeof value]);
27933
27939
  }
27934
27940
  break;
27935
27941
  case "function":
@@ -35996,7 +36002,6 @@ var SSRContainer = class extends _SharedContainer2 {
35996
36002
  this.emitPatchDataIfNeeded();
35997
36003
  this.emitExecutorIfNeeded();
35998
36004
  this.emitQwikLoaderAtBottomIfNeeded();
35999
- this.emitContainerReadyEventIfNeeded();
36000
36005
  }
36001
36006
  emitDelayedOutOfOrderSegmentVNodeData() {
36002
36007
  if (!__EXPERIMENTAL__.suspense || !this.outOfOrderStreaming || !this.outOfOrderUsed) {
@@ -36321,14 +36326,6 @@ var SSRContainer = class extends _SharedContainer2 {
36321
36326
  }
36322
36327
  this.writeScript(scriptAttrs, script);
36323
36328
  }
36324
- emitContainerReadyEventIfNeeded() {
36325
- if (!__EXPERIMENTAL__.suspense || !this.outOfOrderStreaming || !this.outOfOrderUsed) {
36326
- return;
36327
- }
36328
- this.emitInlineScript(
36329
- `document.qready||(document.qready={});document.qready["${this.$instanceHash$}"]=1;try{document.dispatchEvent(new CustomEvent("qready",{detail:"${this.$instanceHash$}"}))}catch(e){}`
36330
- );
36331
- }
36332
36329
  writeScript(attrs, body) {
36333
36330
  this.openScript(attrs);
36334
36331
  if (body) {
@@ -36392,21 +36389,24 @@ var SSRContainer = class extends _SharedContainer2 {
36392
36389
  if (this.qlInclude !== 2 /* Done */) {
36393
36390
  this.emitQwikLoaderInline();
36394
36391
  }
36395
- this.emitNewQwikEvents();
36392
+ this.emitNewQwikEvents(true);
36396
36393
  }
36397
36394
  }
36398
- emitNewQwikEvents() {
36399
- const eventNames = [];
36395
+ emitNewQwikEvents(includeContainerReady = false) {
36396
+ const qwikEventItems = [];
36400
36397
  for (const eventName of this.serializationCtx.$eventNames$) {
36401
36398
  if (!this.emittedQwikEventNames.has(eventName)) {
36402
36399
  this.emittedQwikEventNames.add(eventName);
36403
- eventNames.push(JSON.stringify(eventName));
36400
+ qwikEventItems.push(JSON.stringify(eventName));
36404
36401
  }
36405
36402
  }
36406
- this.emitQwikEvents(eventNames);
36403
+ if (includeContainerReady) {
36404
+ qwikEventItems.push(`${QwikEvContainerReady}`, JSON.stringify(this.$instanceHash$));
36405
+ }
36406
+ this.emitQwikEvents(qwikEventItems);
36407
36407
  }
36408
- emitQwikEvents(eventNames) {
36409
- if (eventNames.length > 0) {
36408
+ emitQwikEvents(qwikEventItems) {
36409
+ if (qwikEventItems.length > 0) {
36410
36410
  const scriptAttrs = {};
36411
36411
  const nonce = this.renderOptions.serverData?.nonce;
36412
36412
  if (nonce) {
@@ -36414,7 +36414,7 @@ var SSRContainer = class extends _SharedContainer2 {
36414
36414
  }
36415
36415
  this.openScript(scriptAttrs);
36416
36416
  this.write(`(window._qwikEv||(window._qwikEv=[])).push(`);
36417
- this.writeArray(eventNames, COMMA);
36417
+ this.writeArray(qwikEventItems, COMMA);
36418
36418
  this.write(PAREN_CLOSE);
36419
36419
  this.closeScript();
36420
36420
  }
@@ -37315,11 +37315,8 @@ async function ssrRenderToDom(jsx2, opts = {}) {
37315
37315
  console.log("--------------------------------------------------------");
37316
37316
  console.log(_vnode_toString.call(container.rootVNode, Number.MAX_SAFE_INTEGER, "", true));
37317
37317
  console.log("------------------- SERIALIZED STATE -------------------");
37318
- const origState = JSON.parse(
37319
- container.element.querySelector('script[type="qwik/state"]')?.textContent || "[]"
37320
- );
37321
- preprocessState2(origState, container);
37322
- console.log(origState ? _dumpState(origState, true, "", null) : "No state found", "\n");
37318
+ const debugState = getDebugSerializedState(container);
37319
+ console.log(debugState ? _dumpState(debugState, true, "", null) : "No state found", "\n");
37323
37320
  const funcs = container.$qFuncs$;
37324
37321
  console.log("------------------- SERIALIZED QFUNCS -------------------");
37325
37322
  for (let i2 = 0; i2 < funcs.length; i2++) {
@@ -37364,6 +37361,46 @@ async function ssrRenderToDom(jsx2, opts = {}) {
37364
37361
  }
37365
37362
  return { container, document: document2, vNode, getStyles };
37366
37363
  }
37364
+ function getDebugSerializedState(container) {
37365
+ const stateScriptSelector2 = `script[type="qwik/state"][q\\:instance="${container.$instanceHash$}"]`;
37366
+ const rootStateScript = container.element.querySelector(
37367
+ `${stateScriptSelector2}:not(${QStatePatchAttrSelector})`
37368
+ );
37369
+ const patchStateScripts = container.element.querySelectorAll(
37370
+ `${stateScriptSelector2}${QStatePatchAttrSelector}`
37371
+ );
37372
+ if (!rootStateScript && patchStateScripts.length === 0) {
37373
+ return null;
37374
+ }
37375
+ const state = JSON.parse(rootStateScript?.textContent || "[]");
37376
+ const patchForwardRefs = [];
37377
+ for (let i2 = 0; i2 < patchStateScripts.length; i2++) {
37378
+ const patchStateText = patchStateScripts[i2].textContent;
37379
+ if (!patchStateText) {
37380
+ continue;
37381
+ }
37382
+ const [rootStart, rawStateData, forwardRefs] = JSON.parse(patchStateText);
37383
+ for (let j = 0; j < rawStateData.length; j++) {
37384
+ state[rootStart * 2 + j] = rawStateData[j];
37385
+ }
37386
+ if (forwardRefs) {
37387
+ patchForwardRefs.push(forwardRefs);
37388
+ }
37389
+ }
37390
+ const debugContainer = { $forwardRefs$: null };
37391
+ preprocessState2(state, debugContainer);
37392
+ for (let i2 = 0; i2 < patchForwardRefs.length; i2++) {
37393
+ const rootForwardRefs = debugContainer.$forwardRefs$ || (debugContainer.$forwardRefs$ = []);
37394
+ const forwardRefs = patchForwardRefs[i2];
37395
+ for (let j = 0; j < forwardRefs.length; j++) {
37396
+ const ref = forwardRefs[j];
37397
+ if (ref !== void 0) {
37398
+ rootForwardRefs.push(ref);
37399
+ }
37400
+ }
37401
+ }
37402
+ return state;
37403
+ }
37367
37404
  function isQwikScript(node) {
37368
37405
  const element = node.node;
37369
37406
  return _vnode_getElementName(node) === "script" && (_vnode_getProp(node, "type", null) === "qwik/state" || _vnode_getProp(node, "type", null) === ELEMENT_BACKPATCH_DATA || _vnode_getProp(node, "id", null) === "qwikloader" || element.getAttribute("type") === "qwik/state" || element.getAttribute("type") === ELEMENT_BACKPATCH_DATA || element.getAttribute("id") === "qwikloader" || element.innerHTML.includes("window._qwikEv"));
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@qwik.dev/core/testing",
3
- "version": "2.0.0-beta.36-dev+3268fab",
3
+ "version": "2.0.0-beta.37-dev+82dc74d",
4
4
  "main": "index.mjs",
5
5
  "types": "index.d.ts",
6
6
  "private": true,
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@qwik.dev/core/worker",
3
- "version": "2.0.0-beta.36-dev+3268fab",
3
+ "version": "2.0.0-beta.37-dev+82dc74d",
4
4
  "main": "index.mjs",
5
5
  "types": "index.d.mts",
6
6
  "private": true,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@qwik.dev/core",
3
3
  "description": "An open source framework for building instant loading web apps at any scale, without the extra effort.",
4
- "version": "2.0.0-beta.36",
4
+ "version": "2.0.0-beta.37",
5
5
  "author": "Qwik Team",
6
6
  "bin": {
7
7
  "qwik": "./qwik-cli.mjs"
@@ -22,8 +22,8 @@
22
22
  "kleur": "4.1.5",
23
23
  "prettier": "3.7.4",
24
24
  "vitest": "4.1.0",
25
- "@qwik.dev/dom": "2.1.19",
26
- "@qwik.dev/core": "2.0.0-beta.36"
25
+ "@qwik.dev/core": "2.0.0-beta.37",
26
+ "@qwik.dev/dom": "2.1.19"
27
27
  },
28
28
  "engines": {
29
29
  "node": "^20.3.0 || >=21.0.0"