@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.
- package/dist/{PreviewApp-C3lNxUYR.cjs → PreviewApp-B1V5yAQU.cjs} +1 -1
- package/dist/{PreviewApp-CTq4OGBA.js → PreviewApp-qYBj0fnd.js} +1 -1
- package/dist/{PreviewApp.vue_vue_type_style_index_0_lang-tpv-FEao.cjs → PreviewApp.vue_vue_type_style_index_0_lang-CFqaQylr.cjs} +1 -1
- package/dist/{PreviewApp.vue_vue_type_style_index_0_lang-BWIYB9Ha.js → PreviewApp.vue_vue_type_style_index_0_lang-dv9ah2tW.js} +1 -1
- package/dist/api/index.d.ts +4 -0
- package/dist/api/index.d.ts.map +1 -1
- package/dist/content/routes.d.ts.map +1 -1
- package/dist/index.cjs +2 -2
- package/dist/index.mjs +32 -32
- package/dist/{routes-DAqHLDK2.cjs → routes-BybureCK.cjs} +39 -12
- package/dist/{routes-Bs6eosZ6.js → routes-DtTN43pK.js} +80 -53
- package/dist/ssg/createSSREntry.d.ts +3 -0
- package/dist/ssg/createSSREntry.d.ts.map +1 -1
- package/dist/ssg/index.cjs +2 -1
- package/dist/ssg/index.mjs +2 -1
- package/package.json +1 -1
|
@@ -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-
|
|
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,5 +1,5 @@
|
|
|
1
1
|
import { defineComponent, inject, ref, h, provide, onMounted, onUnmounted, openBlock, createElementBlock, createVNode, unref, nextTick } from "vue";
|
|
2
|
-
import {
|
|
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
|
}
|
package/dist/api/index.d.ts
CHANGED
|
@@ -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
|
package/dist/api/index.d.ts.map
CHANGED
|
@@ -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,MA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CAAE,CAAC,CAQ/C;AAED;;;;;;;GAOG;AACH,wBAAsB,aAAa,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC9D,UAAU,EAAE,MAAM,EAClB,IAAI,EAAE,MAAM,EACZ,MAAM,CAAC,EAAE,MAAM,GACb,OAAO,CAAC,CAAC,GAAG,IAAI,CAAC,CAMnB;AAED;;;;;GAKG;AACH,wBAAsB,WAAW,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC5D,UAAU,EAAE,MAAM,EAClB,EAAE,EAAE,MAAM,EACV,MAAM,CAAC,EAAE,MAAM,GACb,OAAO,CAAC,CAAC,GAAG,IAAI,CAAC,CAOnB"}
|
|
@@ -1 +1 @@
|
|
|
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,
|
|
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-
|
|
4
|
-
const PreviewApp_vue_vue_type_style_index_0_lang = require("./PreviewApp.vue_vue_type_style_index_0_lang-
|
|
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 {
|
|
2
|
-
import { _,
|
|
3
|
-
import { _ as _2, P as P2, s as s2, a } from "./PreviewApp.vue_vue_type_style_index_0_lang-
|
|
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,
|
|
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
|
-
|
|
371
|
-
|
|
372
|
-
|
|
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
|
-
|
|
374
|
+
A as BLOX_LAYOUT_KEY,
|
|
375
375
|
BLOX_LOCALE_STRATEGY_KEY,
|
|
376
376
|
BLOX_RUNTIME_KEY,
|
|
377
|
-
|
|
377
|
+
C as BloxInstance,
|
|
378
378
|
_sfc_main as BloxRouterView,
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
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
|
-
|
|
385
|
+
G as applyLayoutChrome,
|
|
386
386
|
buildBloxManifest,
|
|
387
|
-
|
|
387
|
+
H as classifyLink,
|
|
388
388
|
c as collectBloxData,
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
389
|
+
d as collectBloxSeo,
|
|
390
|
+
I as configureApi,
|
|
391
|
+
J as contentRoutes,
|
|
392
392
|
createBlox,
|
|
393
393
|
createBloxApp,
|
|
394
394
|
defineBlock,
|
|
395
|
-
|
|
395
|
+
K as defineContent,
|
|
396
396
|
generateContentRoutes,
|
|
397
397
|
getContentRoute,
|
|
398
|
-
|
|
398
|
+
L as getContentRouteByCollection,
|
|
399
399
|
getItemById,
|
|
400
400
|
getItemBySlug,
|
|
401
|
-
|
|
402
|
-
|
|
401
|
+
M as getWebsiteId,
|
|
402
|
+
N as getWebsiteIdSync,
|
|
403
403
|
injectPlausible,
|
|
404
404
|
installContentFallback,
|
|
405
405
|
installSmartLinks,
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
406
|
+
O as isAbsoluteExternal,
|
|
407
|
+
Q as isSoloContentPage,
|
|
408
|
+
R as isSpecialScheme,
|
|
409
|
+
S as listItems,
|
|
410
410
|
normalizeLink,
|
|
411
|
-
|
|
411
|
+
T as normalizeTo,
|
|
412
412
|
provideBloxData,
|
|
413
|
-
|
|
413
|
+
U as provideContentItem,
|
|
414
414
|
r as resolveBlockProps,
|
|
415
|
-
|
|
415
|
+
V as resolvePath,
|
|
416
416
|
s2 as sendToEditor,
|
|
417
417
|
a as sendToPreview,
|
|
418
418
|
serializeRegistry,
|
|
419
419
|
s as setApiOrigin,
|
|
420
|
-
|
|
421
|
-
|
|
420
|
+
W as toInternalPath,
|
|
421
|
+
X as useBloxEdit,
|
|
422
422
|
useBloxRuntime,
|
|
423
|
-
|
|
423
|
+
Y as useContentItem,
|
|
424
424
|
useContentSeo,
|
|
425
|
-
|
|
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-
|
|
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
|
-
|
|
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
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
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
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
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-
|
|
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
|
-
|
|
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
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
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
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
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
|
-
|
|
1216
|
+
BLOX_LAYOUT_KEY as A,
|
|
1191
1217
|
BLOX_DATA_WINDOW_KEY as B,
|
|
1192
|
-
|
|
1193
|
-
_sfc_main$
|
|
1194
|
-
_sfc_main as E,
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
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
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
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
|
-
|
|
1217
|
-
|
|
1243
|
+
setCollectionResolver as a,
|
|
1244
|
+
setActiveLocale as b,
|
|
1218
1245
|
collectBloxData as c,
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1246
|
+
collectBloxSeo as d,
|
|
1247
|
+
createBlox as e,
|
|
1248
|
+
BLOX_REGISTRY_KEY as f,
|
|
1222
1249
|
generateContentRoutes as g,
|
|
1223
|
-
|
|
1250
|
+
BLOX_RUNTIME_KEY as h,
|
|
1224
1251
|
installLocaleAwareResolve as i,
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
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
|
-
|
|
1257
|
+
getItemById as o,
|
|
1231
1258
|
provideBloxData as p,
|
|
1232
|
-
|
|
1259
|
+
getContentRoute as q,
|
|
1233
1260
|
resolveBlockProps as r,
|
|
1234
1261
|
setApiOrigin as s,
|
|
1235
|
-
|
|
1262
|
+
installContentFallback as t,
|
|
1236
1263
|
useLocale as u,
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
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;
|
|
1
|
+
{"version":3,"file":"createSSREntry.d.ts","sourceRoot":"","sources":["../../src/ssg/createSSREntry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,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AO,EAAE,CAAC,CAAC,CAAA;IAC5E;;;OAGG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAA;IAC5C,kDAAkD;IAClD,KAAK,CAAC,EAAE,CAAC,GAAG,EAAE,GAAG,KAAK,IAAI,CAAA;CAC1B;AAED,MAAM,WAAW,YAAY;IAC5B,MAAM,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,aAAa,KAAK,OAAO,CAAC,YAAY,CAAC,CAAA;IAClE,0EAA0E;IAC1E,eAAe,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC,CAAA;CACnD;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,yBAAyB,GAAG,YAAY,CAyLnF"}
|
package/dist/ssg/index.cjs
CHANGED
|
@@ -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-
|
|
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);
|
package/dist/ssg/index.mjs
CHANGED
|
@@ -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,
|
|
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