@bagelink/blox 1.15.587 → 1.15.591
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/README.md +48 -22
- package/dist/CmsPageView.vue.d.ts.map +1 -1
- package/dist/{PreviewApp-D208UMZs.js → PreviewApp-BagepqPk.js} +1 -1
- package/dist/{PreviewApp-DNMYw1AS.cjs → PreviewApp-HVipxMQ3.cjs} +1 -1
- package/dist/{PreviewApp.vue_vue_type_style_index_0_lang-Dm0SmjEr.cjs → PreviewApp.vue_vue_type_style_index_0_lang-C6e-tDzD.cjs} +6 -6
- package/dist/{PreviewApp.vue_vue_type_style_index_0_lang-l6QisbG-.js → PreviewApp.vue_vue_type_style_index_0_lang-Dl3bKQTA.js} +1 -1
- package/dist/api/index.d.ts +24 -0
- package/dist/api/index.d.ts.map +1 -1
- package/dist/{routes-DDiQDksF.js → appRuntime-B6yWkH3M.js} +280 -82
- package/dist/{routes-DOcek9fP.cjs → appRuntime-D1Z3fX-G.cjs} +237 -39
- package/dist/appRuntime.d.ts +26 -0
- package/dist/appRuntime.d.ts.map +1 -0
- package/dist/composables/useLocale.d.ts +10 -3
- package/dist/composables/useLocale.d.ts.map +1 -1
- package/dist/content/routes.d.ts +4 -2
- package/dist/content/routes.d.ts.map +1 -1
- package/dist/content/useContentSeo.d.ts.map +1 -1
- package/dist/core.d.ts +2 -0
- package/dist/core.d.ts.map +1 -1
- package/dist/createBloxApp.d.ts +9 -19
- package/dist/createBloxApp.d.ts.map +1 -1
- package/dist/data/useData.d.ts.map +1 -1
- package/dist/index.cjs +91 -111
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.mjs +64 -84
- package/dist/{shard-runner-Bc4gTl71.js → shard-runner-DauYjwvg.js} +2 -2
- package/dist/{shard-runner-ZAwqteYY.cjs → shard-runner-xIPqGX-Q.cjs} +2 -2
- package/dist/ssg/cli.cjs +2 -4
- package/dist/ssg/cli.mjs +2 -4
- package/dist/ssg/client.cjs +0 -73
- package/dist/ssg/client.d.ts +1 -3
- package/dist/ssg/client.d.ts.map +1 -1
- package/dist/ssg/client.mjs +1 -74
- package/dist/ssg/constants.d.ts +0 -4
- package/dist/ssg/constants.d.ts.map +1 -1
- package/dist/ssg/createSSREntry.d.ts.map +1 -1
- package/dist/ssg/index.cjs +26 -47
- package/dist/ssg/index.d.ts +1 -3
- package/dist/ssg/index.d.ts.map +1 -1
- package/dist/ssg/index.mjs +24 -45
- package/dist/ssg/prerender.d.ts +1 -5
- package/dist/ssg/prerender.d.ts.map +1 -1
- package/dist/ssg/render-resolved-page.d.ts +0 -2
- package/dist/ssg/render-resolved-page.d.ts.map +1 -1
- package/dist/{validate-output-DRCseorw.js → validate-output-B56PuxEM.js} +0 -2
- package/dist/{validate-output-DlHgDBoV.cjs → validate-output-CRfMSrpx.cjs} +0 -2
- package/dist/vite-plugin.cjs +3 -64
- package/dist/vite-plugin.d.ts +0 -8
- package/dist/vite-plugin.d.ts.map +1 -1
- package/dist/vite-plugin.mjs +3 -64
- package/package.json +1 -1
- package/dist/ssg/collection-cache.d.ts +0 -53
- package/dist/ssg/collection-cache.d.ts.map +0 -1
- package/dist/ssg/state-cache.d.ts +0 -21
- package/dist/ssg/state-cache.d.ts.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createBloxApp.d.ts","sourceRoot":"","sources":["../src/createBloxApp.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,KAAK,CAAA;AACjD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,YAAY,CAAA;AACxC,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"createBloxApp.d.ts","sourceRoot":"","sources":["../src/createBloxApp.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,KAAK,CAAA;AACjD,OAAO,KAAK,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AAG,CAAC,OAAO,CAAC,CAAA;IACrB,gDAAgD;IAChD,KAAK,EAAE,GAAG,CAAC,OAAO,CAAC,CAAA;IACnB,iEAAiE;IACjE,OAAO,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAA;CAC5B;AAED,MAAM,WAAW,cAAc,CAAC,CAAC;IAChC,qFAAqF;IACrF,OAAO,EAAE,CAAC,CAAA;IACV;;;OAGG;IACH,MAAM,CAAC,EAAE,OAAO,CAAA;CAChB;AAED;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,GAAG,EAAE,IAAI,GAAE;IAAE,MAAM,CAAC,EAAE,OAAO,CAAA;CAAO,GAAG,gBAAgB,CAa3F;AAoBD,8EAA8E;AAC9E,wBAAgB,eAAe,IAAI,gBAAgB,GAAG,IAAI,CAEzD;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,QAAQ,EAAE,gBAAgB,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAEnF;AAED;;;;;;;;GAQG;AACH,wBAAgB,MAAM,CAAC,MAAM,EAAE,MAAM,WAAW,GAAG,IAAI,GAAG,SAAS,GAAG,IAAI,CAiBzE;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,QAAQ,EAAE,gBAAgB,GAAG,WAAW,CActE;AAED;;;;;;;GAOG;AACH,wBAAgB,OAAO,CAAC,CAAC,EACxB,GAAG,EAAE,gBAAgB,CAAC,MAAM,CAAC,EAC7B,OAAO,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,EACzB,OAAO,EAAE,cAAc,CAAC,CAAC,CAAC,GACxB,aAAa,CAAC,CAAC,CAAC,CAqFlB"}
|
package/dist/index.cjs
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const
|
|
4
|
-
const PreviewApp_vue_vue_type_style_index_0_lang = require("./PreviewApp.vue_vue_type_style_index_0_lang-
|
|
3
|
+
const appRuntime = require("./appRuntime-D1Z3fX-G.cjs");
|
|
4
|
+
const PreviewApp_vue_vue_type_style_index_0_lang = require("./PreviewApp.vue_vue_type_style_index_0_lang-C6e-tDzD.cjs");
|
|
5
5
|
const vue = require("vue");
|
|
6
6
|
const vueRouter = require("vue-router");
|
|
7
|
-
const pinia = require("pinia");
|
|
8
7
|
const ssg_client = require("./ssg/client.cjs");
|
|
9
8
|
const FORM_CONTROL_SELECTOR = "button, input, select, textarea, label, option";
|
|
10
9
|
function isEditorPreview() {
|
|
@@ -127,9 +126,9 @@ function useGlobalBlock(blockType) {
|
|
|
127
126
|
return { data, loading, refresh };
|
|
128
127
|
}
|
|
129
128
|
function useLocaleNav() {
|
|
130
|
-
const strategy = vue.inject(
|
|
129
|
+
const strategy = vue.inject(appRuntime.BLOX_LOCALE_STRATEGY_KEY, null);
|
|
131
130
|
const router = vueRouter.useRouter();
|
|
132
|
-
const { locale, currentAlternates } =
|
|
131
|
+
const { locale, currentAlternates } = appRuntime.useLocale();
|
|
133
132
|
const availableLocales = vue.computed(() => {
|
|
134
133
|
var _a;
|
|
135
134
|
const alts = Object.keys(currentAlternates.value ?? {});
|
|
@@ -145,13 +144,13 @@ function useLocaleNav() {
|
|
|
145
144
|
strategy.switchTo(targetLocale, alternateSlug, router);
|
|
146
145
|
}
|
|
147
146
|
function toPath(slug) {
|
|
148
|
-
const normalized =
|
|
147
|
+
const normalized = appRuntime.normalizeLink(slug) ?? slug;
|
|
149
148
|
if (!strategy) return normalized;
|
|
150
149
|
const loc = String(locale.value || "").slice(0, 2).toLowerCase();
|
|
151
150
|
return strategy.toPath(normalized, loc || void 0);
|
|
152
151
|
}
|
|
153
152
|
function localePath(targetLocale, slug = "/") {
|
|
154
|
-
const normalized =
|
|
153
|
+
const normalized = appRuntime.normalizeLink(slug) ?? slug;
|
|
155
154
|
if (!strategy) return normalized;
|
|
156
155
|
return strategy.toPath(normalized, targetLocale);
|
|
157
156
|
}
|
|
@@ -177,7 +176,7 @@ function usePageContext(key) {
|
|
|
177
176
|
});
|
|
178
177
|
}
|
|
179
178
|
function useBloxRuntime() {
|
|
180
|
-
const runtime = vue.inject(
|
|
179
|
+
const runtime = vue.inject(appRuntime.BLOX_RUNTIME_KEY, null);
|
|
181
180
|
return {
|
|
182
181
|
isPreview: (runtime == null ? void 0 : runtime.isPreview) ?? vue.computed(() => false),
|
|
183
182
|
loading: (runtime == null ? void 0 : runtime.loading) ?? vue.computed(() => false)
|
|
@@ -185,20 +184,21 @@ function useBloxRuntime() {
|
|
|
185
184
|
}
|
|
186
185
|
function useContentSeo(item, head) {
|
|
187
186
|
const route = safeRoute();
|
|
188
|
-
const { locale } =
|
|
189
|
-
const
|
|
187
|
+
const { locale } = appRuntime.useLocale();
|
|
188
|
+
const api = appRuntime.useBloxApi();
|
|
189
|
+
const strategy = vue.inject(appRuntime.BLOX_LOCALE_STRATEGY_KEY, null);
|
|
190
190
|
const registration = () => {
|
|
191
191
|
var _a;
|
|
192
192
|
const name = (_a = route == null ? void 0 : route.meta) == null ? void 0 : _a.content;
|
|
193
|
-
return name ?
|
|
193
|
+
return name ? appRuntime.getContentRoute(name) : void 0;
|
|
194
194
|
};
|
|
195
195
|
let alternates;
|
|
196
|
-
|
|
196
|
+
appRuntime.useSeo(() => {
|
|
197
197
|
const base = head();
|
|
198
198
|
if (!base) return null;
|
|
199
199
|
return alternates ? { ...base, alternates } : base;
|
|
200
200
|
});
|
|
201
|
-
const registry =
|
|
201
|
+
const registry = appRuntime.getRegistryData();
|
|
202
202
|
if (registry == null ? void 0 : registry.isServer) {
|
|
203
203
|
vue.onServerPrefetch(async () => {
|
|
204
204
|
var _a, _b;
|
|
@@ -207,7 +207,7 @@ function useContentSeo(item, head) {
|
|
|
207
207
|
const slug = String(((_a = route == null ? void 0 : route.params) == null ? void 0 : _a.slug) ?? ((_b = vue.toValue(item)) == null ? void 0 : _b.slug) ?? "");
|
|
208
208
|
const activeLoc = String(locale.value || "en").slice(0, 2).toLowerCase();
|
|
209
209
|
const activeItem = vue.toValue(item);
|
|
210
|
-
const entity = activeItem ?? (slug ? await
|
|
210
|
+
const entity = activeItem ?? (slug ? await ((api == null ? void 0 : api.getItemBySlug(reg.collection, slug, activeLoc)) ?? appRuntime.getItemBySlug(reg.collection, slug, activeLoc)).catch(() => null) : null);
|
|
211
211
|
if (!entity) return;
|
|
212
212
|
const id = String(entity.id ?? entity._id ?? "");
|
|
213
213
|
const supported = (strategy == null ? void 0 : strategy.locales) ?? [locale.value];
|
|
@@ -216,7 +216,7 @@ function useContentSeo(item, head) {
|
|
|
216
216
|
const built = {};
|
|
217
217
|
await Promise.all(locales.map(async (loc) => {
|
|
218
218
|
var _a2;
|
|
219
|
-
const locSlug = loc === activeLoc ? String(entity.slug ?? "") : String(((_a2 = await
|
|
219
|
+
const locSlug = loc === activeLoc ? String(entity.slug ?? "") : String(((_a2 = await ((api == null ? void 0 : api.getItemById(reg.collection, id, loc)) ?? appRuntime.getItemById(reg.collection, id, loc)).catch(() => null)) == null ? void 0 : _a2.slug) ?? "");
|
|
220
220
|
if (locSlug) built[loc] = reg.route.replace(/:slug(?=\/|$)/, locSlug);
|
|
221
221
|
}));
|
|
222
222
|
if (Object.keys(built).length > 1) alternates = built;
|
|
@@ -271,48 +271,39 @@ function createBloxApp(options) {
|
|
|
271
271
|
globalComponents = {},
|
|
272
272
|
setup: userSetup,
|
|
273
273
|
plausible,
|
|
274
|
-
navigation = "spa"
|
|
274
|
+
navigation = "spa",
|
|
275
|
+
adminEdit
|
|
275
276
|
} = options;
|
|
276
277
|
if (plausible) injectPlausible(plausible);
|
|
277
|
-
ssg_client.installBloxStateCache();
|
|
278
|
-
let axiosInstance;
|
|
279
278
|
if (options.createApi) {
|
|
280
|
-
|
|
281
|
-
axiosInstance = result.axios;
|
|
279
|
+
options.createApi({ baseURL: apiBaseURL });
|
|
282
280
|
}
|
|
283
|
-
const
|
|
284
|
-
if (collectionInterceptor && axiosInstance) {
|
|
285
|
-
axiosInstance.interceptors.request.use(collectionInterceptor);
|
|
286
|
-
}
|
|
287
|
-
const hasSsgState = typeof window !== "undefined" && (!!window[ssg_client.BLOX_STATE_WINDOW_KEY] || !!window[routes.BLOX_DATA_WINDOW_KEY]);
|
|
281
|
+
const hasSsgState = typeof window !== "undefined" && (!!window[ssg_client.BLOX_STATE_WINDOW_KEY] || !!window[appRuntime.BLOX_DATA_WINDOW_KEY]);
|
|
288
282
|
const createVueApp = hasSsgState ? vue.createSSRApp : vue.createApp;
|
|
289
283
|
const app = createVueApp({
|
|
290
284
|
name: "BloxRoot",
|
|
291
285
|
render: () => vue.h(vue.Suspense, null, { default: () => vue.h(rootComponent) })
|
|
292
286
|
});
|
|
293
|
-
const dataRegistry =
|
|
294
|
-
const
|
|
287
|
+
const dataRegistry = appRuntime.provideBloxData(app);
|
|
288
|
+
const api = appRuntime.provideBloxApi(app, { websiteName, store });
|
|
289
|
+
const localeState = appRuntime.provideBloxLocale(app, locale);
|
|
290
|
+
const blox = appRuntime.installBloxRuntime({
|
|
291
|
+
app,
|
|
292
|
+
router,
|
|
295
293
|
modules,
|
|
296
294
|
websiteName,
|
|
297
295
|
store,
|
|
298
|
-
|
|
296
|
+
locale,
|
|
299
297
|
supportedLocales,
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
298
|
+
plugins,
|
|
299
|
+
globalComponents,
|
|
300
|
+
setup: userSetup,
|
|
301
|
+
adminEdit,
|
|
302
|
+
contentFallback: true,
|
|
303
|
+
api,
|
|
304
|
+
localeState
|
|
306
305
|
});
|
|
307
|
-
app.use(pinia$1);
|
|
308
|
-
app.use(router);
|
|
309
|
-
blox.install(app, {});
|
|
310
|
-
for (const record of routes.generateContentRoutes(supportedLocales, locale)) {
|
|
311
|
-
if (!router.hasRoute(record.name)) router.addRoute(record);
|
|
312
|
-
}
|
|
313
|
-
routes.installContentFallback(router, supportedLocales, locale);
|
|
314
306
|
const strategy = blox.strategy;
|
|
315
|
-
routes.installLocaleAwareResolve(router, strategy);
|
|
316
307
|
const localeOf = (path) => {
|
|
317
308
|
const first = path.replace(/^\//, "").split("/")[0];
|
|
318
309
|
return first && supportedLocales.includes(first) ? first : locale;
|
|
@@ -323,37 +314,25 @@ function createBloxApp(options) {
|
|
|
323
314
|
const toPath = typeof (to == null ? void 0 : to.path) === "string" ? to.path : browserPath;
|
|
324
315
|
const toFullPath = typeof (to == null ? void 0 : to.fullPath) === "string" ? to.fullPath : toPath;
|
|
325
316
|
const fromPath = typeof (from == null ? void 0 : from.path) === "string" ? from.path : "";
|
|
326
|
-
const switched =
|
|
317
|
+
const switched = appRuntime.consumePendingLocaleSwitch();
|
|
327
318
|
if (switched != null) {
|
|
328
|
-
|
|
319
|
+
appRuntime.setActiveLocale(switched, localeState);
|
|
329
320
|
return true;
|
|
330
321
|
}
|
|
331
322
|
const intended = fromPath && ((_a2 = from == null ? void 0 : from.matched) == null ? void 0 : _a2.length) ? localeOf(fromPath) : localeOf(toPath);
|
|
332
323
|
const normalized = strategy.normalize(toFullPath, intended);
|
|
333
324
|
if (normalized && normalized !== toFullPath) {
|
|
334
|
-
|
|
325
|
+
appRuntime.setActiveLocale(localeOf(normalized), localeState);
|
|
335
326
|
return normalized;
|
|
336
327
|
}
|
|
337
|
-
|
|
328
|
+
appRuntime.setActiveLocale(localeOf(toPath), localeState);
|
|
338
329
|
return true;
|
|
339
330
|
});
|
|
340
331
|
const initialPath = typeof window !== "undefined" && ((_a = window.location) == null ? void 0 : _a.pathname) ? window.location.pathname : router.currentRoute.value.path;
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
if (Array.isArray(plugin)) {
|
|
344
|
-
const [p, ...args] = plugin;
|
|
345
|
-
app.use(p, ...args);
|
|
346
|
-
} else {
|
|
347
|
-
app.use(plugin);
|
|
348
|
-
}
|
|
349
|
-
}
|
|
350
|
-
routes.setActiveLocale(localeOf(initialPath));
|
|
351
|
-
for (const [name, comp] of Object.entries(globalComponents)) {
|
|
352
|
-
app.component(name, comp);
|
|
353
|
-
}
|
|
354
|
-
if (userSetup) userSetup(app);
|
|
332
|
+
appRuntime.setActiveLocale(localeOf(initialPath), localeState);
|
|
333
|
+
appRuntime.setActiveLocale(localeOf(initialPath), localeState);
|
|
355
334
|
router.isReady().then(() => {
|
|
356
|
-
|
|
335
|
+
appRuntime.installSmartLinks(router);
|
|
357
336
|
if (navigation === "document") installDocumentNavigation(router);
|
|
358
337
|
app.mount(mountTarget);
|
|
359
338
|
dataRegistry.hydrating = false;
|
|
@@ -382,11 +361,11 @@ function withLocaleRoutes(path, component, supportedLocales, defaultLocale = "en
|
|
|
382
361
|
const normalized = path.startsWith("/") ? path : `/${path}`;
|
|
383
362
|
const prefixed = supportedLocales.filter((l) => l !== defaultLocale);
|
|
384
363
|
const make = (p) => ({ path: p, component });
|
|
385
|
-
const
|
|
364
|
+
const routes = [make(normalized)];
|
|
386
365
|
if (prefixed.length) {
|
|
387
|
-
|
|
366
|
+
routes.push(make(`/:locale(${prefixed.join("|")})${normalized}`));
|
|
388
367
|
}
|
|
389
|
-
return
|
|
368
|
+
return routes;
|
|
390
369
|
}
|
|
391
370
|
const MANIFEST_VERSION = 1;
|
|
392
371
|
function definitionToEntry(type, def) {
|
|
@@ -423,53 +402,54 @@ function serializeRegistry(registry) {
|
|
|
423
402
|
function buildBloxManifest(blox) {
|
|
424
403
|
return serializeRegistry(blox.getRegistry());
|
|
425
404
|
}
|
|
426
|
-
exports.AdminEditBar =
|
|
427
|
-
exports.BLOX_ADMIN_CONFIG_KEY =
|
|
428
|
-
exports.BLOX_CONFIG_KEY =
|
|
429
|
-
exports.BLOX_DATA_KEY =
|
|
430
|
-
exports.BLOX_DATA_WINDOW_KEY =
|
|
431
|
-
exports.BLOX_LAYOUT_KEY =
|
|
432
|
-
exports.BLOX_LOCALE_STRATEGY_KEY =
|
|
433
|
-
exports.BLOX_RUNTIME_KEY =
|
|
434
|
-
exports.BloxInstance =
|
|
435
|
-
exports.CmsPageView =
|
|
436
|
-
exports.ContentDetailView =
|
|
437
|
-
exports.ContentHost =
|
|
438
|
-
exports.PageRenderer =
|
|
439
|
-
exports.applyLayoutChrome =
|
|
440
|
-
exports.classifyLink =
|
|
441
|
-
exports.collectBloxData =
|
|
442
|
-
exports.collectBloxSeo =
|
|
443
|
-
exports.configureApi =
|
|
444
|
-
exports.contentRoutes =
|
|
445
|
-
exports.createBlox =
|
|
446
|
-
exports.
|
|
447
|
-
exports.
|
|
448
|
-
exports.
|
|
449
|
-
exports.
|
|
450
|
-
exports.
|
|
451
|
-
exports.
|
|
452
|
-
exports.
|
|
453
|
-
exports.
|
|
454
|
-
exports.
|
|
455
|
-
exports.
|
|
456
|
-
exports.
|
|
457
|
-
exports.
|
|
458
|
-
exports.
|
|
459
|
-
exports.
|
|
460
|
-
exports.
|
|
461
|
-
exports.
|
|
462
|
-
exports.
|
|
463
|
-
exports.
|
|
464
|
-
exports.
|
|
465
|
-
exports.
|
|
466
|
-
exports.
|
|
467
|
-
exports.
|
|
468
|
-
exports.
|
|
469
|
-
exports.
|
|
470
|
-
exports.
|
|
471
|
-
exports.
|
|
472
|
-
exports.
|
|
405
|
+
exports.AdminEditBar = appRuntime._sfc_main;
|
|
406
|
+
exports.BLOX_ADMIN_CONFIG_KEY = appRuntime.BLOX_ADMIN_CONFIG_KEY;
|
|
407
|
+
exports.BLOX_CONFIG_KEY = appRuntime.BLOX_CONFIG_KEY;
|
|
408
|
+
exports.BLOX_DATA_KEY = appRuntime.BLOX_DATA_KEY;
|
|
409
|
+
exports.BLOX_DATA_WINDOW_KEY = appRuntime.BLOX_DATA_WINDOW_KEY;
|
|
410
|
+
exports.BLOX_LAYOUT_KEY = appRuntime.BLOX_LAYOUT_KEY;
|
|
411
|
+
exports.BLOX_LOCALE_STRATEGY_KEY = appRuntime.BLOX_LOCALE_STRATEGY_KEY;
|
|
412
|
+
exports.BLOX_RUNTIME_KEY = appRuntime.BLOX_RUNTIME_KEY;
|
|
413
|
+
exports.BloxInstance = appRuntime.BloxInstance;
|
|
414
|
+
exports.CmsPageView = appRuntime._sfc_main$1;
|
|
415
|
+
exports.ContentDetailView = appRuntime._sfc_main$2;
|
|
416
|
+
exports.ContentHost = appRuntime._sfc_main$3;
|
|
417
|
+
exports.PageRenderer = appRuntime.PageRenderer;
|
|
418
|
+
exports.applyLayoutChrome = appRuntime.applyLayoutChrome;
|
|
419
|
+
exports.classifyLink = appRuntime.classifyLink;
|
|
420
|
+
exports.collectBloxData = appRuntime.collectBloxData;
|
|
421
|
+
exports.collectBloxSeo = appRuntime.collectBloxSeo;
|
|
422
|
+
exports.configureApi = appRuntime.configureApi;
|
|
423
|
+
exports.contentRoutes = appRuntime.contentRoutes;
|
|
424
|
+
exports.createBlox = appRuntime.createBlox;
|
|
425
|
+
exports.createBloxApi = appRuntime.createBloxApi;
|
|
426
|
+
exports.defineContent = appRuntime.defineContent;
|
|
427
|
+
exports.generateContentRoutes = appRuntime.generateContentRoutes;
|
|
428
|
+
exports.getContentRoute = appRuntime.getContentRoute;
|
|
429
|
+
exports.getContentRouteByCollection = appRuntime.getContentRouteByCollection;
|
|
430
|
+
exports.getItemById = appRuntime.getItemById;
|
|
431
|
+
exports.getItemBySlug = appRuntime.getItemBySlug;
|
|
432
|
+
exports.getWebsiteId = appRuntime.getWebsiteId;
|
|
433
|
+
exports.getWebsiteIdSync = appRuntime.getWebsiteIdSync;
|
|
434
|
+
exports.installContentFallback = appRuntime.installContentFallback;
|
|
435
|
+
exports.installSmartLinks = appRuntime.installSmartLinks;
|
|
436
|
+
exports.isAbsoluteExternal = appRuntime.isAbsoluteExternal;
|
|
437
|
+
exports.isSoloContentPage = appRuntime.isSoloContentPage;
|
|
438
|
+
exports.isSpecialScheme = appRuntime.isSpecialScheme;
|
|
439
|
+
exports.listItems = appRuntime.listItems;
|
|
440
|
+
exports.normalizeLink = appRuntime.normalizeLink;
|
|
441
|
+
exports.normalizeTo = appRuntime.normalizeTo;
|
|
442
|
+
exports.provideBloxData = appRuntime.provideBloxData;
|
|
443
|
+
exports.provideContentItem = appRuntime.provideContentItem;
|
|
444
|
+
exports.resolveBlockProps = appRuntime.resolveBlockProps;
|
|
445
|
+
exports.resolvePath = appRuntime.resolvePath;
|
|
446
|
+
exports.setApiOrigin = appRuntime.setApiOrigin;
|
|
447
|
+
exports.toInternalPath = appRuntime.toInternalPath;
|
|
448
|
+
exports.useBloxEdit = appRuntime.useBloxEdit;
|
|
449
|
+
exports.useContentItem = appRuntime.useContentItem;
|
|
450
|
+
exports.useData = appRuntime.useData;
|
|
451
|
+
exports.useLocale = appRuntime.useLocale;
|
|
452
|
+
exports.useSeo = appRuntime.useSeo;
|
|
473
453
|
exports.PreviewApp = PreviewApp_vue_vue_type_style_index_0_lang._sfc_main;
|
|
474
454
|
exports.PreviewRenderer = PreviewApp_vue_vue_type_style_index_0_lang.PreviewRenderer;
|
|
475
455
|
exports.sendToEditor = PreviewApp_vue_vue_type_style_index_0_lang.sendToEditor;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export { configureApi, getWebsiteId, getWebsiteIdSync, listItems, resolvePath, setApiOrigin } from './api/index';
|
|
1
|
+
export { configureApi, createBloxApi, getWebsiteId, getWebsiteIdSync, listItems, resolvePath, setApiOrigin } from './api/index';
|
|
2
2
|
export { installDocumentNavigation } from './documentNavigation';
|
|
3
|
-
export type { ListItemsOptions } from './api/index';
|
|
3
|
+
export type { BloxApiClient, BloxApiOptions, ListItemsOptions } from './api/index';
|
|
4
4
|
export type { BindingWarning, Block, BloxPageApiAdapter, CollectionItem, CollectionItemsPage, ContentStatus, PageContent, PageCreateData, PageRead, PageResolveRead, PageUpdateData, WebsiteRead, } from './api/types';
|
|
5
5
|
export { sendToEditor, sendToPreview } from './bridge';
|
|
6
6
|
export type { BlockSchemaInfo, EditorMessage, PreviewMessage } from './bridge';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,gBAAgB,EAAE,SAAS,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,YAAY,EAAE,gBAAgB,EAAE,SAAS,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAC/H,OAAO,EAAE,yBAAyB,EAAE,MAAM,sBAAsB,CAAA;AAChE,YAAY,EAAE,aAAa,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAA;AAKlF,YAAY,EACX,cAAc,EACd,KAAK,EAEL,kBAAkB,EAClB,cAAc,EACd,mBAAmB,EACnB,aAAa,EACb,WAAW,EACX,cAAc,EACd,QAAQ,EACR,eAAe,EACf,cAAc,EACd,WAAW,GACX,MAAM,aAAa,CAAA;AAIpB,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AACtD,YAAY,EAAE,eAAe,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA;AAI9E,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAC1D,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,iCAAiC,CAAA;AAK3E,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,0BAA0B,CAAA;AAClE,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAA;AAKjD,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAA;AAC7D,YAAY,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAA;AAExE,OAAO,EAAE,aAAa,EAAE,oBAAoB,EAAE,eAAe,EAAE,cAAc,EAAE,eAAe,EAA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iBAAiB,GACjB,MAAM,WAAW,CAAA;AAClB,YAAY,EAAE,WAAW,EAAE,YAAY,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAA;AAEhG,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,gBAAgB,CAAA;AACxD,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,kBAAkB,CAAA;AACxD,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,mBAAmB,CAAA;AAC9D,OAAO,EAAE,iBAAiB,EAAE,KAAK,YAAY,EAAE,MAAM,qBAAqB,CAAA;AAK1E,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAA;AACjE,YAAY,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAA;AAKlE,YAAY,EAAE,cAAc,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,UAAU,CAAA;AAI5E,OAAO,EAAE,qBAAqB,EAAE,eAAe,EAAE,eAAe,EAAE,wBAAwB,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAA;AAC/H,YAAY,EAAE,eAAe,EAAE,UAAU,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAA;AAClG,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAA"}
|
package/dist/index.mjs
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { _, y, z, A, C, D, E, F, G,
|
|
3
|
-
import { _ as _2, P as P2, s as
|
|
4
|
-
import { defineComponent, resolveComponent, openBlock, createBlock, withCtx, Transition, resolveDynamicComponent, inject, ref, watch, onMounted, onUnmounted, computed, onServerPrefetch, toValue, h, Suspense,
|
|
1
|
+
import { h as BLOX_LOCALE_STRATEGY_KEY, u as useLocale, n as normalizeLink, g as BLOX_RUNTIME_KEY, j as useBloxApi, k as useSeo, l as getRegistryData, m as getItemBySlug, o as getItemById, q as getContentRoute, p as provideBloxData, b as provideBloxApi, d as provideBloxLocale, i as installBloxRuntime, s as setActiveLocale, t as installSmartLinks, v as consumePendingLocaleSwitch, B as BLOX_DATA_WINDOW_KEY } from "./appRuntime-B6yWkH3M.js";
|
|
2
|
+
import { _, w, x, y, z, A, C, D, E, P, F, G, c, a, H, I, J, K, L, M, N, O, Q, R, S, T, U, V, W, X, r, Y, Z, $, a0, a1, a2 } from "./appRuntime-B6yWkH3M.js";
|
|
3
|
+
import { _ as _2, P as P2, s, a as a3 } from "./PreviewApp.vue_vue_type_style_index_0_lang-Dl3bKQTA.js";
|
|
4
|
+
import { defineComponent, resolveComponent, openBlock, createBlock, withCtx, Transition, resolveDynamicComponent, inject, ref, watch, onMounted, onUnmounted, computed, onServerPrefetch, toValue, h, Suspense, createSSRApp, createApp } from "vue";
|
|
5
5
|
import { useRouter, useRoute } from "vue-router";
|
|
6
|
-
import {
|
|
7
|
-
import { installBloxStateCache, installCollectionCache, BLOX_STATE_WINDOW_KEY } from "./ssg/client.mjs";
|
|
6
|
+
import { BLOX_STATE_WINDOW_KEY } from "./ssg/client.mjs";
|
|
8
7
|
const FORM_CONTROL_SELECTOR = "button, input, select, textarea, label, option";
|
|
9
8
|
function isEditorPreview() {
|
|
10
9
|
try {
|
|
@@ -185,6 +184,7 @@ function useBloxRuntime() {
|
|
|
185
184
|
function useContentSeo(item, head) {
|
|
186
185
|
const route = safeRoute();
|
|
187
186
|
const { locale } = useLocale();
|
|
187
|
+
const api = useBloxApi();
|
|
188
188
|
const strategy = inject(BLOX_LOCALE_STRATEGY_KEY, null);
|
|
189
189
|
const registration = () => {
|
|
190
190
|
var _a;
|
|
@@ -206,7 +206,7 @@ function useContentSeo(item, head) {
|
|
|
206
206
|
const slug = String(((_a = route == null ? void 0 : route.params) == null ? void 0 : _a.slug) ?? ((_b = toValue(item)) == null ? void 0 : _b.slug) ?? "");
|
|
207
207
|
const activeLoc = String(locale.value || "en").slice(0, 2).toLowerCase();
|
|
208
208
|
const activeItem = toValue(item);
|
|
209
|
-
const entity = activeItem ?? (slug ? await getItemBySlug(reg.collection, slug, activeLoc).catch(() => null) : null);
|
|
209
|
+
const entity = activeItem ?? (slug ? await ((api == null ? void 0 : api.getItemBySlug(reg.collection, slug, activeLoc)) ?? getItemBySlug(reg.collection, slug, activeLoc)).catch(() => null) : null);
|
|
210
210
|
if (!entity) return;
|
|
211
211
|
const id = String(entity.id ?? entity._id ?? "");
|
|
212
212
|
const supported = (strategy == null ? void 0 : strategy.locales) ?? [locale.value];
|
|
@@ -215,7 +215,7 @@ function useContentSeo(item, head) {
|
|
|
215
215
|
const built = {};
|
|
216
216
|
await Promise.all(locales.map(async (loc) => {
|
|
217
217
|
var _a2;
|
|
218
|
-
const locSlug = loc === activeLoc ? String(entity.slug ?? "") : String(((_a2 = await getItemById(reg.collection, id, loc).catch(() => null)) == null ? void 0 : _a2.slug) ?? "");
|
|
218
|
+
const locSlug = loc === activeLoc ? String(entity.slug ?? "") : String(((_a2 = await ((api == null ? void 0 : api.getItemById(reg.collection, id, loc)) ?? getItemById(reg.collection, id, loc)).catch(() => null)) == null ? void 0 : _a2.slug) ?? "");
|
|
219
219
|
if (locSlug) built[loc] = reg.route.replace(/:slug(?=\/|$)/, locSlug);
|
|
220
220
|
}));
|
|
221
221
|
if (Object.keys(built).length > 1) alternates = built;
|
|
@@ -270,18 +270,12 @@ function createBloxApp(options) {
|
|
|
270
270
|
globalComponents = {},
|
|
271
271
|
setup: userSetup,
|
|
272
272
|
plausible,
|
|
273
|
-
navigation = "spa"
|
|
273
|
+
navigation = "spa",
|
|
274
|
+
adminEdit
|
|
274
275
|
} = options;
|
|
275
276
|
if (plausible) injectPlausible(plausible);
|
|
276
|
-
installBloxStateCache();
|
|
277
|
-
let axiosInstance;
|
|
278
277
|
if (options.createApi) {
|
|
279
|
-
|
|
280
|
-
axiosInstance = result.axios;
|
|
281
|
-
}
|
|
282
|
-
const collectionInterceptor = installCollectionCache();
|
|
283
|
-
if (collectionInterceptor && axiosInstance) {
|
|
284
|
-
axiosInstance.interceptors.request.use(collectionInterceptor);
|
|
278
|
+
options.createApi({ baseURL: apiBaseURL });
|
|
285
279
|
}
|
|
286
280
|
const hasSsgState = typeof window !== "undefined" && (!!window[BLOX_STATE_WINDOW_KEY] || !!window[BLOX_DATA_WINDOW_KEY]);
|
|
287
281
|
const createVueApp = hasSsgState ? createSSRApp : createApp;
|
|
@@ -290,28 +284,25 @@ function createBloxApp(options) {
|
|
|
290
284
|
render: () => h(Suspense, null, { default: () => h(rootComponent) })
|
|
291
285
|
});
|
|
292
286
|
const dataRegistry = provideBloxData(app);
|
|
293
|
-
const
|
|
287
|
+
const api = provideBloxApi(app, { websiteName, store });
|
|
288
|
+
const localeState = provideBloxLocale(app, locale);
|
|
289
|
+
const blox = installBloxRuntime({
|
|
290
|
+
app,
|
|
291
|
+
router,
|
|
294
292
|
modules,
|
|
295
293
|
websiteName,
|
|
296
294
|
store,
|
|
297
|
-
|
|
295
|
+
locale,
|
|
298
296
|
supportedLocales,
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
297
|
+
plugins,
|
|
298
|
+
globalComponents,
|
|
299
|
+
setup: userSetup,
|
|
300
|
+
adminEdit,
|
|
301
|
+
contentFallback: true,
|
|
302
|
+
api,
|
|
303
|
+
localeState
|
|
305
304
|
});
|
|
306
|
-
app.use(pinia);
|
|
307
|
-
app.use(router);
|
|
308
|
-
blox.install(app, {});
|
|
309
|
-
for (const record of generateContentRoutes(supportedLocales, locale)) {
|
|
310
|
-
if (!router.hasRoute(record.name)) router.addRoute(record);
|
|
311
|
-
}
|
|
312
|
-
installContentFallback(router, supportedLocales, locale);
|
|
313
305
|
const strategy = blox.strategy;
|
|
314
|
-
installLocaleAwareResolve(router, strategy);
|
|
315
306
|
const localeOf = (path) => {
|
|
316
307
|
const first = path.replace(/^\//, "").split("/")[0];
|
|
317
308
|
return first && supportedLocales.includes(first) ? first : locale;
|
|
@@ -324,33 +315,21 @@ function createBloxApp(options) {
|
|
|
324
315
|
const fromPath = typeof (from == null ? void 0 : from.path) === "string" ? from.path : "";
|
|
325
316
|
const switched = consumePendingLocaleSwitch();
|
|
326
317
|
if (switched != null) {
|
|
327
|
-
setActiveLocale(switched);
|
|
318
|
+
setActiveLocale(switched, localeState);
|
|
328
319
|
return true;
|
|
329
320
|
}
|
|
330
321
|
const intended = fromPath && ((_a2 = from == null ? void 0 : from.matched) == null ? void 0 : _a2.length) ? localeOf(fromPath) : localeOf(toPath);
|
|
331
322
|
const normalized = strategy.normalize(toFullPath, intended);
|
|
332
323
|
if (normalized && normalized !== toFullPath) {
|
|
333
|
-
setActiveLocale(localeOf(normalized));
|
|
324
|
+
setActiveLocale(localeOf(normalized), localeState);
|
|
334
325
|
return normalized;
|
|
335
326
|
}
|
|
336
|
-
setActiveLocale(localeOf(toPath));
|
|
327
|
+
setActiveLocale(localeOf(toPath), localeState);
|
|
337
328
|
return true;
|
|
338
329
|
});
|
|
339
330
|
const initialPath = typeof window !== "undefined" && ((_a = window.location) == null ? void 0 : _a.pathname) ? window.location.pathname : router.currentRoute.value.path;
|
|
340
|
-
setActiveLocale(localeOf(initialPath));
|
|
341
|
-
|
|
342
|
-
if (Array.isArray(plugin)) {
|
|
343
|
-
const [p, ...args] = plugin;
|
|
344
|
-
app.use(p, ...args);
|
|
345
|
-
} else {
|
|
346
|
-
app.use(plugin);
|
|
347
|
-
}
|
|
348
|
-
}
|
|
349
|
-
setActiveLocale(localeOf(initialPath));
|
|
350
|
-
for (const [name, comp] of Object.entries(globalComponents)) {
|
|
351
|
-
app.component(name, comp);
|
|
352
|
-
}
|
|
353
|
-
if (userSetup) userSetup(app);
|
|
331
|
+
setActiveLocale(localeOf(initialPath), localeState);
|
|
332
|
+
setActiveLocale(localeOf(initialPath), localeState);
|
|
354
333
|
router.isReady().then(() => {
|
|
355
334
|
installSmartLinks(router);
|
|
356
335
|
if (navigation === "document") installDocumentNavigation(router);
|
|
@@ -416,7 +395,7 @@ function definitionToEntry(type, def) {
|
|
|
416
395
|
};
|
|
417
396
|
}
|
|
418
397
|
function serializeRegistry(registry) {
|
|
419
|
-
const blocks = Object.entries(registry).map(([type, def]) => definitionToEntry(type, def)).sort((
|
|
398
|
+
const blocks = Object.entries(registry).map(([type, def]) => definitionToEntry(type, def)).sort((a4, b) => (a4.order ?? 100) - (b.order ?? 100) || a4.label.localeCompare(b.label));
|
|
420
399
|
return { version: MANIFEST_VERSION, blocks };
|
|
421
400
|
}
|
|
422
401
|
function buildBloxManifest(blox) {
|
|
@@ -424,63 +403,64 @@ function buildBloxManifest(blox) {
|
|
|
424
403
|
}
|
|
425
404
|
export {
|
|
426
405
|
_ as AdminEditBar,
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
406
|
+
w as BLOX_ADMIN_CONFIG_KEY,
|
|
407
|
+
x as BLOX_CONFIG_KEY,
|
|
408
|
+
y as BLOX_DATA_KEY,
|
|
430
409
|
BLOX_DATA_WINDOW_KEY,
|
|
431
|
-
|
|
410
|
+
z as BLOX_LAYOUT_KEY,
|
|
432
411
|
BLOX_LOCALE_STRATEGY_KEY,
|
|
433
412
|
BLOX_RUNTIME_KEY,
|
|
434
|
-
|
|
413
|
+
A as BloxInstance,
|
|
435
414
|
_sfc_main as BloxRouterView,
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
415
|
+
C as CmsPageView,
|
|
416
|
+
D as ContentDetailView,
|
|
417
|
+
E as ContentHost,
|
|
439
418
|
P as PageRenderer,
|
|
440
419
|
_2 as PreviewApp,
|
|
441
420
|
P2 as PreviewRenderer,
|
|
442
|
-
|
|
421
|
+
F as applyLayoutChrome,
|
|
443
422
|
buildBloxManifest,
|
|
444
|
-
|
|
423
|
+
G as classifyLink,
|
|
445
424
|
c as collectBloxData,
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
createBlox,
|
|
425
|
+
a as collectBloxSeo,
|
|
426
|
+
H as configureApi,
|
|
427
|
+
I as contentRoutes,
|
|
428
|
+
J as createBlox,
|
|
429
|
+
K as createBloxApi,
|
|
450
430
|
createBloxApp,
|
|
451
431
|
defineBlock,
|
|
452
432
|
L as defineContent,
|
|
453
|
-
generateContentRoutes,
|
|
433
|
+
M as generateContentRoutes,
|
|
454
434
|
getContentRoute,
|
|
455
|
-
|
|
435
|
+
N as getContentRouteByCollection,
|
|
456
436
|
getItemById,
|
|
457
437
|
getItemBySlug,
|
|
458
|
-
|
|
459
|
-
|
|
438
|
+
O as getWebsiteId,
|
|
439
|
+
Q as getWebsiteIdSync,
|
|
460
440
|
injectPlausible,
|
|
461
|
-
installContentFallback,
|
|
441
|
+
R as installContentFallback,
|
|
462
442
|
installDocumentNavigation,
|
|
463
443
|
installSmartLinks,
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
444
|
+
S as isAbsoluteExternal,
|
|
445
|
+
T as isSoloContentPage,
|
|
446
|
+
U as isSpecialScheme,
|
|
447
|
+
V as listItems,
|
|
468
448
|
normalizeLink,
|
|
469
|
-
|
|
449
|
+
W as normalizeTo,
|
|
470
450
|
provideBloxData,
|
|
471
|
-
|
|
451
|
+
X as provideContentItem,
|
|
472
452
|
r as resolveBlockProps,
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
453
|
+
Y as resolvePath,
|
|
454
|
+
s as sendToEditor,
|
|
455
|
+
a3 as sendToPreview,
|
|
476
456
|
serializeRegistry,
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
457
|
+
Z as setApiOrigin,
|
|
458
|
+
$ as toInternalPath,
|
|
459
|
+
a0 as useBloxEdit,
|
|
480
460
|
useBloxRuntime,
|
|
481
|
-
|
|
461
|
+
a1 as useContentItem,
|
|
482
462
|
useContentSeo,
|
|
483
|
-
|
|
463
|
+
a2 as useData,
|
|
484
464
|
useGlobalBlock,
|
|
485
465
|
useLocale,
|
|
486
466
|
useLocaleNav,
|
|
@@ -2,7 +2,7 @@ import { spawn } from "node:child_process";
|
|
|
2
2
|
import os from "node:os";
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
import process from "node:process";
|
|
5
|
-
import { f as fetchCmsSiteData, g as generateSitemapArtifacts } from "./validate-output-
|
|
5
|
+
import { f as fetchCmsSiteData, g as generateSitemapArtifacts } from "./validate-output-B56PuxEM.js";
|
|
6
6
|
const AUTO_SHARD_CAP = Number(process.env.BLOX_SSG_SHARD_CAP) || 6;
|
|
7
7
|
const PREFETCH_BUDGET = Number(process.env.BLOX_SSG_PREFETCH_BUDGET) || 24;
|
|
8
8
|
const SEQUENTIAL_SHARDS = process.env.BLOX_SSG_SEQUENTIAL === "1";
|
|
@@ -142,7 +142,7 @@ async function runSharded(opts) {
|
|
|
142
142
|
}
|
|
143
143
|
if (process.env.BLOX_SSG_LLM !== "0") {
|
|
144
144
|
try {
|
|
145
|
-
const { mergeLlmParts } = await import("./validate-output-
|
|
145
|
+
const { mergeLlmParts } = await import("./validate-output-B56PuxEM.js").then((n) => n.A);
|
|
146
146
|
const mergeWebsite = website;
|
|
147
147
|
const partFiles = Array.from({ length: total }, (_, i) => path.join(llmPartsDir, `part.${i}.json`));
|
|
148
148
|
const { pages } = await mergeLlmParts({
|