@uniweb/runtime 1.1.15 → 1.1.17
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/ssr.js +12 -8
- package/dist/ssr.js.map +1 -1
- package/package.json +4 -4
- package/src/foundation-loader.js +5 -3
- package/src/isolate-api.js +12 -3
- package/src/setup.js +7 -1
- package/src/ssr-renderer.js +10 -15
- package/src/ssr.js +17 -0
package/dist/ssr.js
CHANGED
|
@@ -9,10 +9,13 @@ import { DEFAULT_ICON_BASE, iconUrl } from "@uniweb/core/icon-corpus";
|
|
|
9
9
|
import { buildTheme, FONT_LINKS_MARKER, buildSectionOverrides } from "@uniweb/theming";
|
|
10
10
|
import "@uniweb/core/services";
|
|
11
11
|
import "@uniweb/core/tracker";
|
|
12
|
+
import { escapeHtml } from "@uniweb/core/page-shell";
|
|
13
|
+
import { escapeHtml as escapeHtml2, foundationCssUrl, pageShell } from "@uniweb/core/page-shell";
|
|
12
14
|
import DataStore, { deriveCacheKey as deriveCacheKey$1 } from "@uniweb/core/datastore";
|
|
13
15
|
import { RESOLUTION_STATUS, carryQuery, localeOfPath, localeUrl, resolveRoute, routeIndex } from "@uniweb/core/resolve-route";
|
|
14
16
|
import { resolveFetchConfigs } from "@uniweb/core/fetch-config";
|
|
15
17
|
import { resolveRecordsService } from "@uniweb/core/records-service";
|
|
18
|
+
import { dataScript, jsonForScript } from "@uniweb/core/data-script";
|
|
16
19
|
function guaranteeItemStructure(item) {
|
|
17
20
|
return {
|
|
18
21
|
title: item.title || "",
|
|
@@ -722,9 +725,10 @@ async function prefetchIcons(siteContent, uniweb, onProgress = () => {
|
|
|
722
725
|
})
|
|
723
726
|
);
|
|
724
727
|
const succeeded = results.filter((r) => r.status === "fulfilled").length;
|
|
725
|
-
const
|
|
726
|
-
if (
|
|
727
|
-
const
|
|
728
|
+
const failedRefs = icons.filter((_, i) => results[i].status === "rejected");
|
|
729
|
+
if (failedRefs.length > 0) {
|
|
730
|
+
const shown = failedRefs.slice(0, 10).join(", ") + (failedRefs.length > 10 ? ", …" : "");
|
|
731
|
+
const msg = `Fetched ${succeeded}/${icons.length} icons (${failedRefs.length} failed: ${shown})`;
|
|
728
732
|
console.warn(`[prerender] ${msg}`);
|
|
729
733
|
onProgress(` ${msg}`);
|
|
730
734
|
}
|
|
@@ -772,10 +776,6 @@ function renderPage(page, website) {
|
|
|
772
776
|
const sectionOverrideCSS = buildSectionOverrides(page.getAllBlocks(), appearance);
|
|
773
777
|
return { renderedContent, sectionOverrideCSS };
|
|
774
778
|
}
|
|
775
|
-
function escapeHtml(str) {
|
|
776
|
-
if (!str) return "";
|
|
777
|
-
return String(str).replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
778
|
-
}
|
|
779
779
|
function injectPageContent(html, renderedContent, page, options = {}) {
|
|
780
780
|
let result = html;
|
|
781
781
|
if (!result.includes('id="uniweb-appearance"')) {
|
|
@@ -1306,8 +1306,10 @@ export {
|
|
|
1306
1306
|
classifyRenderError,
|
|
1307
1307
|
collectSiteRecords,
|
|
1308
1308
|
createPageRenderer,
|
|
1309
|
-
|
|
1309
|
+
dataScript,
|
|
1310
|
+
escapeHtml2 as escapeHtml,
|
|
1310
1311
|
findPageForRoute,
|
|
1312
|
+
foundationCssUrl,
|
|
1311
1313
|
generate404Html,
|
|
1312
1314
|
getComponentDefaults,
|
|
1313
1315
|
getComponentMeta,
|
|
@@ -1317,9 +1319,11 @@ export {
|
|
|
1317
1319
|
initPrerender,
|
|
1318
1320
|
initPrerenderForLocale,
|
|
1319
1321
|
injectPageContent,
|
|
1322
|
+
jsonForScript,
|
|
1320
1323
|
loadPageData,
|
|
1321
1324
|
localeOfPath,
|
|
1322
1325
|
localeUrl,
|
|
1326
|
+
pageShell,
|
|
1323
1327
|
prefetchAndHydrate,
|
|
1324
1328
|
prefetchIcons,
|
|
1325
1329
|
prepareProps,
|