@solidjs/web 2.0.0-rc.3 → 2.0.0-rc.5
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 +398 -17
- package/dist/dev.js +396 -19
- package/dist/server.cjs +166 -38
- package/dist/server.js +165 -39
- package/dist/web.cjs +369 -17
- package/dist/web.js +367 -19
- 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 +432 -44
- package/frames/dist/server.js +432 -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 +271 -47
- package/server-functions/dist/client.js +264 -47
- package/server-functions/dist/server.cjs +872 -131
- package/server-functions/dist/server.dev.cjs +892 -131
- package/server-functions/dist/server.dev.js +884 -131
- package/server-functions/dist/server.js +864 -131
- package/types/client.d.ts +4 -2
- 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/index.d.ts +1 -0
- package/types/jsx.d.ts +11 -16
- package/types/patch-driver.d.ts +3 -0
- package/types/response.d.ts +20 -1
- package/types/serializer-decode.d.ts +14 -1
- package/types/serializer.d.ts +7 -0
- package/types/server-functions/client.d.ts +58 -7
- package/types/server-functions/flash.d.ts +9 -0
- package/types/server-functions/registry.d.ts +38 -1
- package/types/server-functions/server.d.ts +66 -14
- package/types/server-functions/shared.d.ts +122 -16
- package/types/server-mock.d.ts +17 -2
- package/types/server.d.ts +16 -2
- package/types-cjs/client.d.cts +4 -2
- 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/index.d.cts +1 -0
- package/types-cjs/jsx.d.cts +11 -16
- package/types-cjs/patch-driver.d.cts +3 -0
- package/types-cjs/response.d.cts +20 -1
- 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 +58 -7
- package/types-cjs/server-functions/flash.d.cts +9 -0
- package/types-cjs/server-functions/registry.d.cts +38 -1
- package/types-cjs/server-functions/server.d.cts +66 -14
- package/types-cjs/server-functions/shared.d.cts +122 -16
- package/types-cjs/server-mock.d.cts +17 -2
- package/types-cjs/server.d.cts +16 -2
|
@@ -178,7 +178,18 @@ function createFrameHost(options = {}) {
|
|
|
178
178
|
store.version = version;
|
|
179
179
|
clearStreamRecords(store.records);
|
|
180
180
|
}
|
|
181
|
-
|
|
181
|
+
const assets = records["seg::assets"];
|
|
182
|
+
const previous = assets && store.records["seg::assets"];
|
|
183
|
+
if (!previous || previous === assets) {
|
|
184
|
+
Object.assign(store.records, records);
|
|
185
|
+
} else {
|
|
186
|
+
for (const name in assets) {
|
|
187
|
+
const values = assets[name];
|
|
188
|
+
if (Array.isArray(values)) {
|
|
189
|
+
previous[name] ? previous[name].push(...values) : previous[name] = values;
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
}
|
|
182
193
|
return true;
|
|
183
194
|
};
|
|
184
195
|
return {
|
|
@@ -270,7 +281,7 @@ class FrameImpl {
|
|
|
270
281
|
#slotRegions = new Map();
|
|
271
282
|
#slotResolvedRefs = new Map();
|
|
272
283
|
#slotNodes = new Map();
|
|
273
|
-
#processedAssets = new
|
|
284
|
+
#processedAssets = new WeakSet();
|
|
274
285
|
#recordRefresh = null;
|
|
275
286
|
#disposed = false;
|
|
276
287
|
#styleFlush = () => {
|
|
@@ -371,6 +382,7 @@ class FrameImpl {
|
|
|
371
382
|
this.#revealed.clear();
|
|
372
383
|
this.#fallbackShown.clear();
|
|
373
384
|
this.#appliedHoles.clear();
|
|
385
|
+
this.#processedAssets = new WeakSet();
|
|
374
386
|
this.#errorNotified = false;
|
|
375
387
|
clearStreamRecords(this.#store, root);
|
|
376
388
|
}
|
|
@@ -431,12 +443,17 @@ class FrameImpl {
|
|
|
431
443
|
}
|
|
432
444
|
}
|
|
433
445
|
for (const key in this.#store) {
|
|
434
|
-
if (this.#processedAssets.has(key) || !key.endsWith(":assets")) continue;
|
|
435
|
-
this.#processedAssets.add(key);
|
|
436
446
|
const record = this.#store[key];
|
|
437
|
-
if (record
|
|
447
|
+
if (!key.endsWith(":assets") || !record || this.#processedAssets.has(record)) {
|
|
448
|
+
continue;
|
|
449
|
+
}
|
|
450
|
+
this.#processedAssets.add(record);
|
|
451
|
+
if (record.modules) {
|
|
438
452
|
for (const href of record.modules) ensureModulePreload(href);
|
|
439
453
|
}
|
|
454
|
+
if (record.preloads) {
|
|
455
|
+
for (const entry of record.preloads) ensurePreload(entry);
|
|
456
|
+
}
|
|
440
457
|
}
|
|
441
458
|
this.#syncSlots();
|
|
442
459
|
}
|
|
@@ -910,12 +927,28 @@ function parseFragment(html) {
|
|
|
910
927
|
template.innerHTML = html;
|
|
911
928
|
return template.content;
|
|
912
929
|
}
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
930
|
+
const PRELOAD_QUALIFIERS = ["as", "crossorigin", "type", "media", "imagesrcset", "imagesizes"];
|
|
931
|
+
function findHeadElement(selector, attr, value, qualifiers) {
|
|
932
|
+
candidate: for (const node of document.head.querySelectorAll(selector)) {
|
|
933
|
+
if (node.getAttribute(attr) !== value) continue;
|
|
934
|
+
if (!qualifiers) return node;
|
|
935
|
+
for (let i = 0; i < PRELOAD_QUALIFIERS.length; i++) {
|
|
936
|
+
const name = PRELOAD_QUALIFIERS[i];
|
|
937
|
+
if (node.getAttribute(name) !== (qualifiers[name] ?? null)) continue candidate;
|
|
938
|
+
}
|
|
939
|
+
return node;
|
|
916
940
|
}
|
|
917
941
|
return null;
|
|
918
942
|
}
|
|
943
|
+
function ensurePreload(entry) {
|
|
944
|
+
const attrs = entry.attrs;
|
|
945
|
+
if (findHeadElement('link[rel="preload"]', "href", entry.href, attrs)) return;
|
|
946
|
+
const link = document.createElement("link");
|
|
947
|
+
link.rel = "preload";
|
|
948
|
+
for (const name in attrs) link.setAttribute(name, attrs[name]);
|
|
949
|
+
link.setAttribute("href", entry.href);
|
|
950
|
+
document.head.appendChild(link);
|
|
951
|
+
}
|
|
919
952
|
function ensureStylesheet(entry, onSettle) {
|
|
920
953
|
const href = typeof entry === "string" ? entry : entry.href;
|
|
921
954
|
let link = findHeadElement('link[rel="stylesheet"]', "href", href);
|
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);
|