@qwik.dev/mcp 2.0.0-rc.4 → 2.0.0-rc.6
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.
- package/dist/browser.js +10 -2
- package/dist/cli.js +1 -1
- package/dist/docs.json +1 -1
- package/package.json +7 -7
package/dist/browser.js
CHANGED
|
@@ -152,12 +152,20 @@ function readSerializedState(doc) {
|
|
|
152
152
|
if (!root && !scripts.some((script) => script.hasAttribute("q:patch"))) {
|
|
153
153
|
return null;
|
|
154
154
|
}
|
|
155
|
+
const patches = scripts.filter((script) => script.hasAttribute("q:patch"));
|
|
156
|
+
const state = qwikInternal._isBinaryState(root?.textContent ?? patches[0]?.textContent ?? "") ? qwikInternal._binaryStateToJson(
|
|
157
|
+
root?.textContent,
|
|
158
|
+
patches.map((patch) => patch.textContent || "")
|
|
159
|
+
) : readJsonState(root, patches);
|
|
160
|
+
return qwikInternal._dumpState(state, false, "", null).replace(/^\n/, "");
|
|
161
|
+
}
|
|
162
|
+
function readJsonState(root, patches) {
|
|
155
163
|
const state = JSON.parse(root?.textContent || "[]");
|
|
156
164
|
if (!Array.isArray(state)) {
|
|
157
165
|
throw new Error("Invalid serialized Qwik state.");
|
|
158
166
|
}
|
|
159
167
|
const patchForwardRefs = [];
|
|
160
|
-
for (const patch of
|
|
168
|
+
for (const patch of patches) {
|
|
161
169
|
const [start, entries, forwardRefs] = JSON.parse(patch.textContent || "[]");
|
|
162
170
|
if (!Number.isInteger(start) || !Array.isArray(entries)) {
|
|
163
171
|
throw new Error("Invalid serialized Qwik state patch.");
|
|
@@ -181,7 +189,7 @@ function readSerializedState(doc) {
|
|
|
181
189
|
}
|
|
182
190
|
}
|
|
183
191
|
qwikInternal._preprocessState(state, { $forwardRefs$: null });
|
|
184
|
-
return
|
|
192
|
+
return state;
|
|
185
193
|
}
|
|
186
194
|
async function readSerializedVNodeTree(doc) {
|
|
187
195
|
const clone = new DOMParser().parseFromString(doc.documentElement.outerHTML, "text/html");
|