@bagelink/blox 1.15.552 → 1.15.553

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.
@@ -29,7 +29,7 @@ const pinia = require("pinia");
29
29
  const vue = require("vue");
30
30
  const routes = require("../routes-Dm9cxSGf.cjs");
31
31
  async function renderBloxSsgPage(options) {
32
- var _a, _b, _c;
32
+ var _a, _b, _c, _d;
33
33
  const {
34
34
  url,
35
35
  resolvedData,
@@ -63,7 +63,21 @@ async function renderBloxSsgPage(options) {
63
63
  const seoHead = dataRegistry && collectSeo ? collectSeo(dataRegistry) : void 0;
64
64
  const seoOverride = seoHead && Object.keys(seoHead).length > 0 ? seoHead : void 0;
65
65
  const bloxData = dataRegistry && collectData ? collectData(dataRegistry) : {};
66
- const dataScript = Object.keys(bloxData).length > 0 ? `<script>window[${JSON.stringify(routes.BLOX_DATA_WINDOW_KEY)}]=${safeJson(bloxData)};${"<"}/script>` : "";
66
+ const serializedData = safeJson(bloxData);
67
+ const maxDataBytes = Number(
68
+ typeof process !== "undefined" ? (_a = process.env) == null ? void 0 : _a.BLOX_SSG_MAX_DATA_BYTES : void 0
69
+ ) || 1024 * 1024;
70
+ const dataBytes = new TextEncoder().encode(serializedData).byteLength;
71
+ if (dataBytes > maxDataBytes) {
72
+ const largest = Object.entries(bloxData).map(([key, value]) => ({
73
+ key,
74
+ bytes: new TextEncoder().encode(safeJson(value)).byteLength
75
+ })).sort((a, b) => b.bytes - a.bytes).slice(0, 5).map(({ key, bytes }) => `${key}=${bytes}`).join(", ");
76
+ throw new Error(
77
+ `Blox hydration payload for "${url}" is ${dataBytes} bytes (limit ${maxDataBytes}); largest keys: ${largest}`
78
+ );
79
+ }
80
+ const dataScript = Object.keys(bloxData).length > 0 ? `<script>window[${JSON.stringify(routes.BLOX_DATA_WINDOW_KEY)}]=${serializedData};${"<"}/script>` : "";
67
81
  let head = llmArtifacts.buildPageHead({
68
82
  url,
69
83
  resolvedData,
@@ -89,8 +103,8 @@ ${jsonLd}`;
89
103
  }
90
104
  let llmEntry;
91
105
  if ((llm == null ? void 0 : llm.enabled) !== false) {
92
- const title = (seoOverride == null ? void 0 : seoOverride.title) || ((_a = seoData == null ? void 0 : seoData.page) == null ? void 0 : _a.meta_title) || ((_b = seoData == null ? void 0 : seoData.page) == null ? void 0 : _b.title) || "";
93
- const description = (seoOverride == null ? void 0 : seoOverride.description) || ((_c = seoData == null ? void 0 : seoData.page) == null ? void 0 : _c.meta_description) || void 0;
106
+ const title = (seoOverride == null ? void 0 : seoOverride.title) || ((_b = seoData == null ? void 0 : seoData.page) == null ? void 0 : _b.meta_title) || ((_c = seoData == null ? void 0 : seoData.page) == null ? void 0 : _c.title) || "";
107
+ const description = (seoOverride == null ? void 0 : seoOverride.description) || ((_d = seoData == null ? void 0 : seoData.page) == null ? void 0 : _d.meta_description) || void 0;
94
108
  llmEntry = {
95
109
  url,
96
110
  title,
@@ -7,7 +7,7 @@ import { createPinia } from "pinia";
7
7
  import { createSSRApp, h, Suspense, markRaw } from "vue";
8
8
  import { B as BLOX_DATA_WINDOW_KEY2, s as setApiOrigin, a as setCollectionResolver, b as setActiveLocale, c as collectBloxData, d as collectBloxSeo, p as provideBloxData, e as createBlox, g as generateContentRoutes, i as installLocaleAwareResolve } from "../routes-v4IuPpFg.js";
9
9
  async function renderBloxSsgPage(options) {
10
- var _a, _b, _c;
10
+ var _a, _b, _c, _d;
11
11
  const {
12
12
  url,
13
13
  resolvedData,
@@ -41,7 +41,21 @@ async function renderBloxSsgPage(options) {
41
41
  const seoHead = dataRegistry && collectSeo ? collectSeo(dataRegistry) : void 0;
42
42
  const seoOverride = seoHead && Object.keys(seoHead).length > 0 ? seoHead : void 0;
43
43
  const bloxData = dataRegistry && collectData ? collectData(dataRegistry) : {};
44
- const dataScript = Object.keys(bloxData).length > 0 ? `<script>window[${JSON.stringify(BLOX_DATA_WINDOW_KEY2)}]=${safeJson(bloxData)};${"<"}/script>` : "";
44
+ const serializedData = safeJson(bloxData);
45
+ const maxDataBytes = Number(
46
+ typeof process !== "undefined" ? (_a = process.env) == null ? void 0 : _a.BLOX_SSG_MAX_DATA_BYTES : void 0
47
+ ) || 1024 * 1024;
48
+ const dataBytes = new TextEncoder().encode(serializedData).byteLength;
49
+ if (dataBytes > maxDataBytes) {
50
+ const largest = Object.entries(bloxData).map(([key, value]) => ({
51
+ key,
52
+ bytes: new TextEncoder().encode(safeJson(value)).byteLength
53
+ })).sort((a2, b) => b.bytes - a2.bytes).slice(0, 5).map(({ key, bytes }) => `${key}=${bytes}`).join(", ");
54
+ throw new Error(
55
+ `Blox hydration payload for "${url}" is ${dataBytes} bytes (limit ${maxDataBytes}); largest keys: ${largest}`
56
+ );
57
+ }
58
+ const dataScript = Object.keys(bloxData).length > 0 ? `<script>window[${JSON.stringify(BLOX_DATA_WINDOW_KEY2)}]=${serializedData};${"<"}/script>` : "";
45
59
  let head = buildPageHead({
46
60
  url,
47
61
  resolvedData,
@@ -67,8 +81,8 @@ ${jsonLd}`;
67
81
  }
68
82
  let llmEntry;
69
83
  if ((llm == null ? void 0 : llm.enabled) !== false) {
70
- const title = (seoOverride == null ? void 0 : seoOverride.title) || ((_a = seoData == null ? void 0 : seoData.page) == null ? void 0 : _a.meta_title) || ((_b = seoData == null ? void 0 : seoData.page) == null ? void 0 : _b.title) || "";
71
- const description = (seoOverride == null ? void 0 : seoOverride.description) || ((_c = seoData == null ? void 0 : seoData.page) == null ? void 0 : _c.meta_description) || void 0;
84
+ const title = (seoOverride == null ? void 0 : seoOverride.title) || ((_b = seoData == null ? void 0 : seoData.page) == null ? void 0 : _b.meta_title) || ((_c = seoData == null ? void 0 : seoData.page) == null ? void 0 : _c.title) || "";
85
+ const description = (seoOverride == null ? void 0 : seoOverride.description) || ((_d = seoData == null ? void 0 : seoData.page) == null ? void 0 : _d.meta_description) || void 0;
72
86
  llmEntry = {
73
87
  url,
74
88
  title,
@@ -1 +1 @@
1
- {"version":3,"file":"render-resolved-page.d.ts","sour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,CAAC,QAAQ,EAAE,gBAAgB,KAAK,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IACrE,sEAAsE;IACtE,UAAU,CAAC,EAAE,CAAC,QAAQ,EAAE,gBAAgB,KAAK,WAAW,CAAA;IACxD,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB;;;;OAIG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,8EAA8E;IAC9E,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,+EAA+E;IAC/E,OAAO,CAAC,EAAE,WAAW,GAAG,IAAI,CAAA;IAC5B,yEAAyE;IACzE,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,6EAA6E;IAC7E,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,EAAE,CAAC,CAAA;IACvC,8EAA8E;IAC9E,GAAG,CAAC,EAAE,kBAAkB,CAAA;CACxB,GAAG,OAAO,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAAC,GAAG,CAAC,EAAE,YAAY,CAAA;CAAE,CAAC,CAsInF"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@bagelink/blox",
3
3
  "type": "module",
4
- "version": "1.15.552",
4
+ "version": "1.15.553",
5
5
  "description": "Blox page builder library for drag-and-drop page building and static data management",
6
6
  "author": {
7
7
  "name": "Bagel Studio",