@bagelink/blox 1.15.474 → 1.15.478

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.
@@ -1,4 +1,4 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const PreviewApp_vue_vue_type_style_index_0_lang = require("./PreviewApp.vue_vue_type_style_index_0_lang-tpv-FEao.cjs");
3
+ const PreviewApp_vue_vue_type_style_index_0_lang = require("./PreviewApp.vue_vue_type_style_index_0_lang-CFqaQylr.cjs");
4
4
  exports.default = PreviewApp_vue_vue_type_style_index_0_lang._sfc_main;
@@ -1,4 +1,4 @@
1
- import { _ as _sfc_main } from "./PreviewApp.vue_vue_type_style_index_0_lang-BWIYB9Ha.js";
1
+ import { _ as _sfc_main } from "./PreviewApp.vue_vue_type_style_index_0_lang-dv9ah2tW.js";
2
2
  export {
3
3
  _sfc_main as default
4
4
  };
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  const vue = require("vue");
3
- const routes = require("./routes-DAqHLDK2.cjs");
3
+ const routes = require("./routes-BybureCK.cjs");
4
4
  function sendToEditor(msg) {
5
5
  window.parent.postMessage(cloneForPostMessage(msg), "*");
6
6
  }
@@ -1,5 +1,5 @@
1
1
  import { defineComponent, inject, ref, h, provide, onMounted, onUnmounted, openBlock, createElementBlock, createVNode, unref, nextTick } from "vue";
2
- import { e as BLOX_REGISTRY_KEY, r as resolveBlockProps, u as useLocale, f as BLOX_RUNTIME_KEY } from "./routes-Bs6eosZ6.js";
2
+ import { f as BLOX_REGISTRY_KEY, r as resolveBlockProps, u as useLocale, h as BLOX_RUNTIME_KEY } from "./routes-DtTN43pK.js";
3
3
  function sendToEditor(msg) {
4
4
  window.parent.postMessage(cloneForPostMessage(msg), "*");
5
5
  }
@@ -1,4 +1,5 @@
1
1
  import { CollectionItemsPage, PageResolveRead } from './types';
2
+ type CollectionResolver = (collection: string, options: ListItemsOptions) => Promise<Array<Record<string, unknown>>>;
2
3
  export declare function configureApi(websiteName: string, store: string): void;
3
4
  /**
4
5
  * Point blox's datastore client at an absolute API base (SSG/Node, where
@@ -6,6 +7,8 @@ export declare function configureApi(websiteName: string, store: string): void;
6
7
  * path prefix (e.g. `https://host` or `https://host/api`).
7
8
  */
8
9
  export declare function setApiOrigin(base: string): void;
10
+ /** Use an immutable build-time collection source instead of HTTP during SSR. */
11
+ export declare function setCollectionResolver(resolver: CollectionResolver | null): void;
9
12
  /** Synchronously read the resolved website id if already known (SSG-embedded or cached). */
10
13
  export declare function getWebsiteIdSync(): string | null;
11
14
  export declare function getWebsiteId(): Promise<string>;
@@ -35,4 +38,5 @@ export declare function getItemBySlug<T = Record<string, unknown>>(collection: s
35
38
  * Returns null if the item isn't available in that locale (datastore 406/404).
36
39
  */
37
40
  export declare function getItemById<T = Record<string, unknown>>(collection: string, id: string, locale?: string): Promise<T | null>;
41
+ export {};
38
42
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/api/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,eAAe,EAAe,MAAM,SAAS,CAAA;AAahF,wBAAgB,YAAY,CAAC,WAAW,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAIrE;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAU/C;AAuBD,4FAA4F;AAC5F,wBAAgB,gBAAgB,IAAI,MAAM,GAAG,IAAI,CAOhD;AAED,wBAAsB,YAAY,IAAI,OAAO,CAAC,MAAM,CAAC,CAiBpD;AAED,wBAAsB,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC,CAMxF;AAED,MAAM,WAAW,gBAAgB;IAChC,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,CAAC,CAAC,EAAE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@
1
- {"version":3,"file":"routes.d.ts","sourceRoot":"","sources":["../../src/content/routes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,YAAY,CAAA;AACxD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAA;AAOvD;;;;;;;;;;;GAWG;AACH,wBAAgB,qBAAqB,CACpC,gBAAgB,EAAE,MAAM,EAAE,EAC1B,aAAa,EAAE,MAAM,GACnB,cAAc,EAAE,CA4BlB;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,yBAAyB,CACxC,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,cAAc,GACtB,IAAI,CA4BN;AAED;;;;;;;GAOG;AACH,wBAAgB,sBAAsB,CACrC,MAAM,EAAE,MAAM,EACd,gBAAgB,EAAE,MAAM,EAAE,EAC1B,aAAa,EAAE,MAAM,GACnB,IAAI,CA8CN"}
1
+ {"version":3,"file":"routes.d.ts","sourceRoot":"","sources":["../../src/content/routes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,YAAY,CAAA;AACxD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAA;AAOvD;;;;;;;;;;;GAWG;AACH,wBAAgB,qBAAqB,CACpC,gBAAgB,EAAE,MAAM,EAAE,EAC1B,aAAa,EAAE,MAAM,GACnB,cAAc,EAAE,CA4BlB;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,yBAAyB,CACxC,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,cAAc,GACtB,IAAI,CA4BN;AAED;;;;;;;GAOG;AACH,wBAAgB,sBAAsB,CACrC,MAAM,EAAE,MAAM,EACd,gBAAgB,EAAE,MAAM,EAAE,EAC1B,aAAa,EAAE,MAAM,GACnB,IAAI,CAoEN"}
package/dist/index.cjs CHANGED
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const routes = require("./routes-DAqHLDK2.cjs");
4
- const PreviewApp_vue_vue_type_style_index_0_lang = require("./PreviewApp.vue_vue_type_style_index_0_lang-tpv-FEao.cjs");
3
+ const routes = require("./routes-BybureCK.cjs");
4
+ const PreviewApp_vue_vue_type_style_index_0_lang = require("./PreviewApp.vue_vue_type_style_index_0_lang-CFqaQylr.cjs");
5
5
  const vue = require("vue");
6
6
  const vueRouter = require("vue-router");
7
7
  const pinia = require("pinia");
package/dist/index.mjs CHANGED
@@ -1,6 +1,6 @@
1
- import { h as BLOX_LOCALE_STRATEGY_KEY, u as useLocale, n as normalizeLink, f as BLOX_RUNTIME_KEY, j as useSeo, k as getRegistryData, l as getItemBySlug, m as getItemById, o as getContentRoute, p as provideBloxData, d as createBlox, g as generateContentRoutes, q as installContentFallback, i as installLocaleAwareResolve, a as setActiveLocale, t as installSmartLinks, v as consumePendingLocaleSwitch } from "./routes-Bs6eosZ6.js";
2
- import { _, w, x, y, B, z, A, C, D, E, P, F, G, c, b, H, I, J, K, L, M, N, O, Q, R, S, T, r, U, s, V, W, X, Y } from "./routes-Bs6eosZ6.js";
3
- import { _ as _2, P as P2, s as s2, a } from "./PreviewApp.vue_vue_type_style_index_0_lang-BWIYB9Ha.js";
1
+ import { j as BLOX_LOCALE_STRATEGY_KEY, u as useLocale, n as normalizeLink, h as BLOX_RUNTIME_KEY, k as useSeo, l as getRegistryData, m as getItemBySlug, o as getItemById, q as getContentRoute, p as provideBloxData, e as createBlox, g as generateContentRoutes, t as installContentFallback, i as installLocaleAwareResolve, b as setActiveLocale, v as installSmartLinks, w as consumePendingLocaleSwitch } from "./routes-DtTN43pK.js";
2
+ import { _, x, y, z, B, A, C, D, E, F, P, G, H, c, d, I, J, K, L, M, N, O, Q, R, S, T, U, r, V, s, W, X, Y, Z } from "./routes-DtTN43pK.js";
3
+ import { _ as _2, P as P2, s as s2, a } from "./PreviewApp.vue_vue_type_style_index_0_lang-dv9ah2tW.js";
4
4
  import { defineComponent, resolveComponent, openBlock, createBlock, withCtx, Transition, resolveDynamicComponent, inject, ref, watch, onMounted, onUnmounted, computed, onServerPrefetch, toValue, createApp, h, Suspense, markRaw } from "vue";
5
5
  import { useRouter, useRoute } from "vue-router";
6
6
  import { createPinia } from "pinia";
@@ -359,7 +359,7 @@ function definitionToEntry(type, def) {
359
359
  };
360
360
  }
361
361
  function serializeRegistry(registry) {
362
- const blocks = Object.entries(registry).map(([type, def]) => definitionToEntry(type, def)).sort((a2, b2) => (a2.order ?? 100) - (b2.order ?? 100) || a2.label.localeCompare(b2.label));
362
+ const blocks = Object.entries(registry).map(([type, def]) => definitionToEntry(type, def)).sort((a2, b) => (a2.order ?? 100) - (b.order ?? 100) || a2.label.localeCompare(b.label));
363
363
  return { version: MANIFEST_VERSION, blocks };
364
364
  }
365
365
  function buildBloxManifest(blox) {
@@ -367,62 +367,62 @@ function buildBloxManifest(blox) {
367
367
  }
368
368
  export {
369
369
  _ as AdminEditBar,
370
- w as BLOX_ADMIN_CONFIG_KEY,
371
- x as BLOX_CONFIG_KEY,
372
- y as BLOX_DATA_KEY,
370
+ x as BLOX_ADMIN_CONFIG_KEY,
371
+ y as BLOX_CONFIG_KEY,
372
+ z as BLOX_DATA_KEY,
373
373
  B as BLOX_DATA_WINDOW_KEY,
374
- z as BLOX_LAYOUT_KEY,
374
+ A as BLOX_LAYOUT_KEY,
375
375
  BLOX_LOCALE_STRATEGY_KEY,
376
376
  BLOX_RUNTIME_KEY,
377
- A as BloxInstance,
377
+ C as BloxInstance,
378
378
  _sfc_main as BloxRouterView,
379
- C as CmsPageView,
380
- D as ContentDetailView,
381
- E as ContentHost,
379
+ D as CmsPageView,
380
+ E as ContentDetailView,
381
+ F as ContentHost,
382
382
  P as PageRenderer,
383
383
  _2 as PreviewApp,
384
384
  P2 as PreviewRenderer,
385
- F as applyLayoutChrome,
385
+ G as applyLayoutChrome,
386
386
  buildBloxManifest,
387
- G as classifyLink,
387
+ H as classifyLink,
388
388
  c as collectBloxData,
389
- b as collectBloxSeo,
390
- H as configureApi,
391
- I as contentRoutes,
389
+ d as collectBloxSeo,
390
+ I as configureApi,
391
+ J as contentRoutes,
392
392
  createBlox,
393
393
  createBloxApp,
394
394
  defineBlock,
395
- J as defineContent,
395
+ K as defineContent,
396
396
  generateContentRoutes,
397
397
  getContentRoute,
398
- K as getContentRouteByCollection,
398
+ L as getContentRouteByCollection,
399
399
  getItemById,
400
400
  getItemBySlug,
401
- L as getWebsiteId,
402
- M as getWebsiteIdSync,
401
+ M as getWebsiteId,
402
+ N as getWebsiteIdSync,
403
403
  injectPlausible,
404
404
  installContentFallback,
405
405
  installSmartLinks,
406
- N as isAbsoluteExternal,
407
- O as isSoloContentPage,
408
- Q as isSpecialScheme,
409
- R as listItems,
406
+ O as isAbsoluteExternal,
407
+ Q as isSoloContentPage,
408
+ R as isSpecialScheme,
409
+ S as listItems,
410
410
  normalizeLink,
411
- S as normalizeTo,
411
+ T as normalizeTo,
412
412
  provideBloxData,
413
- T as provideContentItem,
413
+ U as provideContentItem,
414
414
  r as resolveBlockProps,
415
- U as resolvePath,
415
+ V as resolvePath,
416
416
  s2 as sendToEditor,
417
417
  a as sendToPreview,
418
418
  serializeRegistry,
419
419
  s as setApiOrigin,
420
- V as toInternalPath,
421
- W as useBloxEdit,
420
+ W as toInternalPath,
421
+ X as useBloxEdit,
422
422
  useBloxRuntime,
423
- X as useContentItem,
423
+ Y as useContentItem,
424
424
  useContentSeo,
425
- Y as useData,
425
+ Z as useData,
426
426
  useGlobalBlock,
427
427
  useLocale,
428
428
  useLocaleNav,
@@ -12,6 +12,7 @@ let _websiteName = "";
12
12
  let _store = "";
13
13
  let _websiteId = null;
14
14
  let _origin = "";
15
+ let _collectionResolver = null;
15
16
  function configureApi(websiteName, store) {
16
17
  _websiteName = websiteName;
17
18
  _store = store;
@@ -26,6 +27,9 @@ function setApiOrigin(base) {
26
27
  } catch {
27
28
  }
28
29
  }
30
+ function setCollectionResolver(resolver) {
31
+ _collectionResolver = resolver;
32
+ }
29
33
  async function request(path, { locale: locale2, params, ...opts } = {}) {
30
34
  const origin = _origin || (typeof window !== "undefined" ? window.location.origin : "");
31
35
  const url = new URL(`${BASE}${path}`, origin || void 0);
@@ -69,6 +73,9 @@ async function resolvePath(path, locale2) {
69
73
  });
70
74
  }
71
75
  async function listItems(collection, { locale: locale2, q, offset = 0, limit = 100 } = {}) {
76
+ if (_collectionResolver) {
77
+ return await _collectionResolver(collection, { locale: locale2, q, offset, limit });
78
+ }
72
79
  return request(`/datastore/${_store}/collections/${collection}`, {
73
80
  locale: locale2,
74
81
  params: { ...q ? { q } : {}, offset, limit }
@@ -905,7 +912,7 @@ class BloxInstance {
905
912
  }
906
913
  router.addRoute({
907
914
  path: "/_blox_preview",
908
- component: () => Promise.resolve().then(() => require("./PreviewApp-C3lNxUYR.cjs")),
915
+ component: () => Promise.resolve().then(() => require("./PreviewApp-B1V5yAQU.cjs")),
909
916
  beforeEnter: () => window.parent !== window ? true : "/"
910
917
  });
911
918
  router.addRoute({ path: "/:pathMatch(.*)*", component: _sfc_main$2 });
@@ -1163,22 +1170,41 @@ function installContentFallback(router, supportedLocales, defaultLocale) {
1163
1170
  const slug = String(to.params.slug ?? "");
1164
1171
  if (!slug) return true;
1165
1172
  const urlLocale = localeOf(to.path);
1166
- const here = await getItemBySlug(registration.collection, slug, urlLocale).catch(() => null);
1173
+ let here;
1174
+ try {
1175
+ here = await getItemBySlug(
1176
+ registration.collection,
1177
+ slug,
1178
+ urlLocale
1179
+ );
1180
+ } catch {
1181
+ return true;
1182
+ }
1167
1183
  if (here) return true;
1168
1184
  for (const sourceLocale of [defaultLocale, ...supportedLocales]) {
1169
1185
  if (sourceLocale === urlLocale) continue;
1170
- const source = await getItemBySlug(
1171
- registration.collection,
1172
- slug,
1173
- sourceLocale
1174
- ).catch(() => null);
1186
+ let source;
1187
+ try {
1188
+ source = await getItemBySlug(
1189
+ registration.collection,
1190
+ slug,
1191
+ sourceLocale
1192
+ );
1193
+ } catch {
1194
+ return true;
1195
+ }
1175
1196
  const id = String((source == null ? void 0 : source.id) ?? (source == null ? void 0 : source._id) ?? "");
1176
1197
  if (!id) continue;
1177
- const target = await getItemById(
1178
- registration.collection,
1179
- id,
1180
- urlLocale
1181
- ).catch(() => null);
1198
+ let target;
1199
+ try {
1200
+ target = await getItemById(
1201
+ registration.collection,
1202
+ id,
1203
+ urlLocale
1204
+ );
1205
+ } catch {
1206
+ return true;
1207
+ }
1182
1208
  const targetSlug = String((target == null ? void 0 : target.slug) ?? "");
1183
1209
  if (!targetSlug) break;
1184
1210
  const barePath = registration.route.replace(/:slug(?=\/|$)/, targetSlug);
@@ -1233,6 +1259,7 @@ exports.resolveBlockProps = resolveBlockProps;
1233
1259
  exports.resolvePath = resolvePath;
1234
1260
  exports.setActiveLocale = setActiveLocale;
1235
1261
  exports.setApiOrigin = setApiOrigin;
1262
+ exports.setCollectionResolver = setCollectionResolver;
1236
1263
  exports.toInternalPath = toInternalPath;
1237
1264
  exports.useBloxEdit = useBloxEdit;
1238
1265
  exports.useContentItem = useContentItem;
@@ -11,6 +11,7 @@ let _websiteName = "";
11
11
  let _store = "";
12
12
  let _websiteId = null;
13
13
  let _origin = "";
14
+ let _collectionResolver = null;
14
15
  function configureApi(websiteName, store) {
15
16
  _websiteName = websiteName;
16
17
  _store = store;
@@ -25,6 +26,9 @@ function setApiOrigin(base) {
25
26
  } catch {
26
27
  }
27
28
  }
29
+ function setCollectionResolver(resolver) {
30
+ _collectionResolver = resolver;
31
+ }
28
32
  async function request(path, { locale: locale2, params, ...opts } = {}) {
29
33
  const origin = _origin || (typeof window !== "undefined" ? window.location.origin : "");
30
34
  const url = new URL(`${BASE}${path}`, origin || void 0);
@@ -68,6 +72,9 @@ async function resolvePath(path, locale2) {
68
72
  });
69
73
  }
70
74
  async function listItems(collection, { locale: locale2, q, offset = 0, limit = 100 } = {}) {
75
+ if (_collectionResolver) {
76
+ return await _collectionResolver(collection, { locale: locale2, q, offset, limit });
77
+ }
71
78
  return request(`/datastore/${_store}/collections/${collection}`, {
72
79
  locale: locale2,
73
80
  params: { ...q ? { q } : {}, offset, limit }
@@ -904,7 +911,7 @@ class BloxInstance {
904
911
  }
905
912
  router.addRoute({
906
913
  path: "/_blox_preview",
907
- component: () => import("./PreviewApp-CTq4OGBA.js"),
914
+ component: () => import("./PreviewApp-qYBj0fnd.js"),
908
915
  beforeEnter: () => window.parent !== window ? true : "/"
909
916
  });
910
917
  router.addRoute({ path: "/:pathMatch(.*)*", component: _sfc_main$2 });
@@ -1162,22 +1169,41 @@ function installContentFallback(router, supportedLocales, defaultLocale) {
1162
1169
  const slug = String(to.params.slug ?? "");
1163
1170
  if (!slug) return true;
1164
1171
  const urlLocale = localeOf(to.path);
1165
- const here = await getItemBySlug(registration.collection, slug, urlLocale).catch(() => null);
1172
+ let here;
1173
+ try {
1174
+ here = await getItemBySlug(
1175
+ registration.collection,
1176
+ slug,
1177
+ urlLocale
1178
+ );
1179
+ } catch {
1180
+ return true;
1181
+ }
1166
1182
  if (here) return true;
1167
1183
  for (const sourceLocale of [defaultLocale, ...supportedLocales]) {
1168
1184
  if (sourceLocale === urlLocale) continue;
1169
- const source = await getItemBySlug(
1170
- registration.collection,
1171
- slug,
1172
- sourceLocale
1173
- ).catch(() => null);
1185
+ let source;
1186
+ try {
1187
+ source = await getItemBySlug(
1188
+ registration.collection,
1189
+ slug,
1190
+ sourceLocale
1191
+ );
1192
+ } catch {
1193
+ return true;
1194
+ }
1174
1195
  const id = String((source == null ? void 0 : source.id) ?? (source == null ? void 0 : source._id) ?? "");
1175
1196
  if (!id) continue;
1176
- const target = await getItemById(
1177
- registration.collection,
1178
- id,
1179
- urlLocale
1180
- ).catch(() => null);
1197
+ let target;
1198
+ try {
1199
+ target = await getItemById(
1200
+ registration.collection,
1201
+ id,
1202
+ urlLocale
1203
+ );
1204
+ } catch {
1205
+ return true;
1206
+ }
1181
1207
  const targetSlug = String((target == null ? void 0 : target.slug) ?? "");
1182
1208
  if (!targetSlug) break;
1183
1209
  const barePath = registration.route.replace(/:slug(?=\/|$)/, targetSlug);
@@ -1187,56 +1213,57 @@ function installContentFallback(router, supportedLocales, defaultLocale) {
1187
1213
  });
1188
1214
  }
1189
1215
  export {
1190
- BloxInstance as A,
1216
+ BLOX_LAYOUT_KEY as A,
1191
1217
  BLOX_DATA_WINDOW_KEY as B,
1192
- _sfc_main$2 as C,
1193
- _sfc_main$1 as D,
1194
- _sfc_main as E,
1195
- applyLayoutChrome as F,
1196
- classifyLink as G,
1197
- configureApi as H,
1198
- contentRoutes as I,
1199
- defineContent as J,
1200
- getContentRouteByCollection as K,
1201
- getWebsiteId as L,
1202
- getWebsiteIdSync as M,
1203
- isAbsoluteExternal as N,
1204
- isSoloContentPage as O,
1218
+ BloxInstance as C,
1219
+ _sfc_main$2 as D,
1220
+ _sfc_main$1 as E,
1221
+ _sfc_main as F,
1222
+ applyLayoutChrome as G,
1223
+ classifyLink as H,
1224
+ configureApi as I,
1225
+ contentRoutes as J,
1226
+ defineContent as K,
1227
+ getContentRouteByCollection as L,
1228
+ getWebsiteId as M,
1229
+ getWebsiteIdSync as N,
1230
+ isAbsoluteExternal as O,
1205
1231
  PageRenderer as P,
1206
- isSpecialScheme as Q,
1207
- listItems as R,
1208
- normalizeTo as S,
1209
- provideContentItem as T,
1210
- resolvePath as U,
1211
- toInternalPath as V,
1212
- useBloxEdit as W,
1213
- useContentItem as X,
1214
- useData as Y,
1232
+ isSoloContentPage as Q,
1233
+ isSpecialScheme as R,
1234
+ listItems as S,
1235
+ normalizeTo as T,
1236
+ provideContentItem as U,
1237
+ resolvePath as V,
1238
+ toInternalPath as W,
1239
+ useBloxEdit as X,
1240
+ useContentItem as Y,
1241
+ useData as Z,
1215
1242
  _sfc_main$3 as _,
1216
- setActiveLocale as a,
1217
- collectBloxSeo as b,
1243
+ setCollectionResolver as a,
1244
+ setActiveLocale as b,
1218
1245
  collectBloxData as c,
1219
- createBlox as d,
1220
- BLOX_REGISTRY_KEY as e,
1221
- BLOX_RUNTIME_KEY as f,
1246
+ collectBloxSeo as d,
1247
+ createBlox as e,
1248
+ BLOX_REGISTRY_KEY as f,
1222
1249
  generateContentRoutes as g,
1223
- BLOX_LOCALE_STRATEGY_KEY as h,
1250
+ BLOX_RUNTIME_KEY as h,
1224
1251
  installLocaleAwareResolve as i,
1225
- useSeo as j,
1226
- getRegistryData as k,
1227
- getItemBySlug as l,
1228
- getItemById as m,
1252
+ BLOX_LOCALE_STRATEGY_KEY as j,
1253
+ useSeo as k,
1254
+ getRegistryData as l,
1255
+ getItemBySlug as m,
1229
1256
  normalizeLink as n,
1230
- getContentRoute as o,
1257
+ getItemById as o,
1231
1258
  provideBloxData as p,
1232
- installContentFallback as q,
1259
+ getContentRoute as q,
1233
1260
  resolveBlockProps as r,
1234
1261
  setApiOrigin as s,
1235
- installSmartLinks as t,
1262
+ installContentFallback as t,
1236
1263
  useLocale as u,
1237
- consumePendingLocaleSwitch as v,
1238
- BLOX_ADMIN_CONFIG_KEY as w,
1239
- BLOX_CONFIG_KEY as x,
1240
- BLOX_DATA_KEY as y,
1241
- BLOX_LAYOUT_KEY as z
1264
+ installSmartLinks as v,
1265
+ consumePendingLocaleSwitch as w,
1266
+ BLOX_ADMIN_CONFIG_KEY as x,
1267
+ BLOX_CONFIG_KEY as y,
1268
+ BLOX_DATA_KEY as z
1242
1269
  };
@@ -3,6 +3,7 @@ import { Router } from 'vue-router';
3
3
  import { BlockModule } from '../defineBlock';
4
4
  import { RenderContext, RenderResult } from './prerender';
5
5
  import { BloxBuildRequestOptions } from './build-request';
6
+ import { ListItemsOptions } from '../api';
6
7
  export interface CreateBloxSSREntryOptions {
7
8
  /** Root Vue component (App.vue). */
8
9
  rootComponent: Component;
@@ -25,6 +26,8 @@ export interface CreateBloxSSREntryOptions {
25
26
  apiBase?: string;
26
27
  /** Build-only authentication/headers. Defaults to BLOX_BUILD_TOKEN env. */
27
28
  buildRequest?: BloxBuildRequestOptions;
29
+ /** Immutable build-time datastore resolver used by content routes and SEO. */
30
+ collectionResolver?: (collection: string, options: ListItemsOptions) => Promise<Array<Record<string, unknown>>>;
28
31
  /** Default locale. @default 'en' */
29
32
  locale?: string;
30
33
  /** Supported locales. @default [locale] */
@@ -1 +1 @@
1
- {"version":3,"file":"createSSREntry.d.ts","sourceRoot":"","sources":["../../src/ssg/createSSREntry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,KAAK,CAAA;AACzC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,YAAY,CAAA;AACxC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AACjD,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAG9D,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,iBAAiB,CAAA;AAW9D,MAAM,WAAW,yBAAyB;IACzC,oCAAoC;IACpC,aAAa,EAAE,SAAS,CAAA;IACxB;;;;OAIG;IACH,YAAY,EAAE,CAAC,IAAI,EAAE,KAAK,GAAG,QAAQ,EAAE,GAAG,CAAC,EAAE,MAAM,KAAK,MAAM,CAAA;IAC9D;;;OAGG;IACH,OAAO,EAAE,WAAW,EAAE,GAAG,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CAAA;IACpD,wBAAwB;IACxB,WAAW,EAAE,MAAM,CAAA;IACnB,kCAAkC;IAClC,KAAK,EAAE,MAAM,CAAA;IACb,oGAAoG;IACpG,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,2EAA2E;IAC3E,YAAY,CAAC,EAAE,uBAAuB,CAAA;IACtC,oCAAoC;IACpC,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,2CAA2C;IAC3C,gBAAgB,CAAC,EAAE,MAAM,EAAE,CAAA;IAC3B;;;OAGG;IACH,OAAO,CAAC,EAAE,KAAK,CAAC,OAAO,KAAK,EAAE,MA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,YAAY,CAyLnF"}
@@ -26,7 +26,7 @@ const llmArtifacts = require("../prerender-JdRKimQ5.cjs");
26
26
  const ssg_client = require("./client.cjs");
27
27
  const pinia = require("pinia");
28
28
  const vue = require("vue");
29
- const routes = require("../routes-DAqHLDK2.cjs");
29
+ const routes = require("../routes-BybureCK.cjs");
30
30
  async function renderBloxSsgPage(options) {
31
31
  var _a, _b, _c;
32
32
  const {
@@ -128,6 +128,7 @@ function createBloxSSREntry(options) {
128
128
  const apiBase = options.apiBase ?? (typeof process !== "undefined" ? (_a = process.env) == null ? void 0 : _a.BAGELINK_API_URL : void 0) ?? "https://api.bagel.to";
129
129
  let websiteIdCache = null;
130
130
  routes.setApiOrigin(apiBase);
131
+ routes.setCollectionResolver(options.collectionResolver ?? null);
131
132
  async function getWebsiteId() {
132
133
  if (websiteIdCache) return websiteIdCache;
133
134
  const data = await llmArtifacts.bloxBuildJson(`${apiBase}/blox/websites`, {}, options.buildRequest);
@@ -4,7 +4,7 @@ import { BLOX_STATE_WINDOW_KEY, BLOX_WEBSITE_ID_WINDOW_KEY } from "./client.mjs"
4
4
  import { BLOX_COLLECTIONS_WINDOW_KEY, BLOX_DATA_WINDOW_KEY, BLOX_PAGE_SEO_WINDOW_KEY, getCollectionCache, getEmbeddedWebsiteId, installBloxStateCache, installCollectionCache } from "./client.mjs";
5
5
  import { createPinia } from "pinia";
6
6
  import { createSSRApp, h, Suspense, markRaw } from "vue";
7
- import { B as BLOX_DATA_WINDOW_KEY2, s as setApiOrigin, a as setActiveLocale, c as collectBloxData, b as collectBloxSeo, p as provideBloxData, d as createBlox, g as generateContentRoutes, i as installLocaleAwareResolve } from "../routes-Bs6eosZ6.js";
7
+ 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-DtTN43pK.js";
8
8
  async function renderBloxSsgPage(options) {
9
9
  var _a, _b, _c;
10
10
  const {
@@ -106,6 +106,7 @@ function createBloxSSREntry(options) {
106
106
  const apiBase = options.apiBase ?? (typeof process !== "undefined" ? (_a = process.env) == null ? void 0 : _a.BAGELINK_API_URL : void 0) ?? "https://api.bagel.to";
107
107
  let websiteIdCache = null;
108
108
  setApiOrigin(apiBase);
109
+ setCollectionResolver(options.collectionResolver ?? null);
109
110
  async function getWebsiteId() {
110
111
  if (websiteIdCache) return websiteIdCache;
111
112
  const data = await bloxBuildJson(`${apiBase}/blox/websites`, {}, options.buildRequest);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@bagelink/blox",
3
3
  "type": "module",
4
- "version": "1.15.474",
4
+ "version": "1.15.478",
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",