@solidjs/web 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/dev.cjs +163 -36
- package/dist/dev.js +161 -37
- package/dist/server.cjs +178 -37
- package/dist/server.js +177 -38
- package/dist/web.cjs +143 -36
- package/dist/web.js +141 -37
- package/frames/dist/client.cjs +41 -8
- package/frames/dist/client.dev.cjs +41 -8
- package/frames/dist/client.dev.js +41 -8
- package/frames/dist/client.js +41 -8
- package/frames/dist/server.cjs +497 -44
- package/frames/dist/server.js +497 -44
- package/package.json +2 -2
- package/serialization/dist/decode.cjs +4 -2
- package/serialization/dist/decode.js +4 -2
- package/serialization/dist/serialization.cjs +12 -8
- package/serialization/dist/serialization.js +12 -8
- package/serialization/types/index.d.ts +7 -0
- package/serialization/types/serializer-decode.d.ts +14 -1
- package/serialization/types/serializer.d.ts +7 -0
- package/serialization/types-cjs/index.d.cts +7 -0
- package/serialization/types-cjs/serializer-decode.d.cts +14 -1
- package/serialization/types-cjs/serializer.d.cts +7 -0
- package/server-functions/dist/client.cjs +164 -35
- package/server-functions/dist/client.js +161 -36
- package/server-functions/dist/server.cjs +899 -136
- package/server-functions/dist/server.dev.cjs +919 -136
- package/server-functions/dist/server.dev.js +915 -137
- package/server-functions/dist/server.js +895 -137
- package/types/client.d.ts +2 -1
- package/types/constants.d.ts +3 -1
- package/types/cookies.d.ts +6 -14
- package/types/frames/frame-client.d.ts +4 -0
- package/types/frames/serializer-decode.d.ts +14 -1
- package/types/frames/serializer.d.ts +7 -0
- package/types/jsx.d.ts +11 -16
- package/types/response.d.ts +11 -0
- package/types/serializer-decode.d.ts +14 -1
- package/types/serializer.d.ts +7 -0
- package/types/server-functions/client.d.ts +22 -2
- package/types/server-functions/flash.d.ts +9 -0
- package/types/server-functions/server.d.ts +131 -11
- package/types/server-functions/shared.d.ts +77 -14
- package/types/server-mock.d.ts +17 -2
- package/types/server.d.ts +16 -2
- package/types-cjs/client.d.cts +2 -1
- package/types-cjs/constants.d.cts +3 -1
- package/types-cjs/cookies.d.cts +6 -14
- package/types-cjs/frames/frame-client.d.cts +4 -0
- package/types-cjs/frames/serializer-decode.d.cts +14 -1
- package/types-cjs/frames/serializer.d.cts +7 -0
- package/types-cjs/jsx.d.cts +11 -16
- package/types-cjs/response.d.cts +11 -0
- package/types-cjs/serializer-decode.d.cts +14 -1
- package/types-cjs/serializer.d.cts +7 -0
- package/types-cjs/server-functions/client.d.cts +22 -2
- package/types-cjs/server-functions/flash.d.cts +9 -0
- package/types-cjs/server-functions/server.d.cts +131 -11
- package/types-cjs/server-functions/shared.d.cts +77 -14
- package/types-cjs/server-mock.d.cts +17 -2
- package/types-cjs/server.d.cts +16 -2
package/frames/dist/client.js
CHANGED
|
@@ -175,7 +175,18 @@ function createFrameHost(options = {}) {
|
|
|
175
175
|
store.version = version;
|
|
176
176
|
clearStreamRecords(store.records);
|
|
177
177
|
}
|
|
178
|
-
|
|
178
|
+
const assets = records["seg::assets"];
|
|
179
|
+
const previous = assets && store.records["seg::assets"];
|
|
180
|
+
if (!previous || previous === assets) {
|
|
181
|
+
Object.assign(store.records, records);
|
|
182
|
+
} else {
|
|
183
|
+
for (const name in assets) {
|
|
184
|
+
const values = assets[name];
|
|
185
|
+
if (Array.isArray(values)) {
|
|
186
|
+
previous[name] ? previous[name].push(...values) : previous[name] = values;
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
}
|
|
179
190
|
return true;
|
|
180
191
|
};
|
|
181
192
|
return {
|
|
@@ -267,7 +278,7 @@ class FrameImpl {
|
|
|
267
278
|
#slotRegions = new Map();
|
|
268
279
|
#slotResolvedRefs = new Map();
|
|
269
280
|
#slotNodes = new Map();
|
|
270
|
-
#processedAssets = new
|
|
281
|
+
#processedAssets = new WeakSet();
|
|
271
282
|
#recordRefresh = null;
|
|
272
283
|
#disposed = false;
|
|
273
284
|
#styleFlush = () => {
|
|
@@ -368,6 +379,7 @@ class FrameImpl {
|
|
|
368
379
|
this.#revealed.clear();
|
|
369
380
|
this.#fallbackShown.clear();
|
|
370
381
|
this.#appliedHoles.clear();
|
|
382
|
+
this.#processedAssets = new WeakSet();
|
|
371
383
|
this.#errorNotified = false;
|
|
372
384
|
clearStreamRecords(this.#store, root);
|
|
373
385
|
}
|
|
@@ -427,12 +439,17 @@ class FrameImpl {
|
|
|
427
439
|
}
|
|
428
440
|
}
|
|
429
441
|
for (const key in this.#store) {
|
|
430
|
-
if (this.#processedAssets.has(key) || !key.endsWith(":assets")) continue;
|
|
431
|
-
this.#processedAssets.add(key);
|
|
432
442
|
const record = this.#store[key];
|
|
433
|
-
if (record
|
|
443
|
+
if (!key.endsWith(":assets") || !record || this.#processedAssets.has(record)) {
|
|
444
|
+
continue;
|
|
445
|
+
}
|
|
446
|
+
this.#processedAssets.add(record);
|
|
447
|
+
if (record.modules) {
|
|
434
448
|
for (const href of record.modules) ensureModulePreload(href);
|
|
435
449
|
}
|
|
450
|
+
if (record.preloads) {
|
|
451
|
+
for (const entry of record.preloads) ensurePreload(entry);
|
|
452
|
+
}
|
|
436
453
|
}
|
|
437
454
|
this.#syncSlots();
|
|
438
455
|
}
|
|
@@ -900,12 +917,28 @@ function parseFragment(html) {
|
|
|
900
917
|
template.innerHTML = html;
|
|
901
918
|
return template.content;
|
|
902
919
|
}
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
920
|
+
const PRELOAD_QUALIFIERS = ["as", "crossorigin", "type", "media", "imagesrcset", "imagesizes"];
|
|
921
|
+
function findHeadElement(selector, attr, value, qualifiers) {
|
|
922
|
+
candidate: for (const node of document.head.querySelectorAll(selector)) {
|
|
923
|
+
if (node.getAttribute(attr) !== value) continue;
|
|
924
|
+
if (!qualifiers) return node;
|
|
925
|
+
for (let i = 0; i < PRELOAD_QUALIFIERS.length; i++) {
|
|
926
|
+
const name = PRELOAD_QUALIFIERS[i];
|
|
927
|
+
if (node.getAttribute(name) !== (qualifiers[name] ?? null)) continue candidate;
|
|
928
|
+
}
|
|
929
|
+
return node;
|
|
906
930
|
}
|
|
907
931
|
return null;
|
|
908
932
|
}
|
|
933
|
+
function ensurePreload(entry) {
|
|
934
|
+
const attrs = entry.attrs;
|
|
935
|
+
if (findHeadElement('link[rel="preload"]', "href", entry.href, attrs)) return;
|
|
936
|
+
const link = document.createElement("link");
|
|
937
|
+
link.rel = "preload";
|
|
938
|
+
for (const name in attrs) link.setAttribute(name, attrs[name]);
|
|
939
|
+
link.setAttribute("href", entry.href);
|
|
940
|
+
document.head.appendChild(link);
|
|
941
|
+
}
|
|
909
942
|
function ensureStylesheet(entry, onSettle) {
|
|
910
943
|
const href = typeof entry === "string" ? entry : entry.href;
|
|
911
944
|
let link = findHeadElement('link[rel="stylesheet"]', "href", href);
|