@bagelink/blox 1.15.629 → 1.15.631
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-DcD_Cjzn.js → PreviewApp-DQ5p-pJu.js} +1 -1
- package/dist/{PreviewApp-5XGQVrnd.cjs → PreviewApp-j062gN6d.cjs} +1 -1
- package/dist/{PreviewApp.vue_vue_type_style_index_0_lang-OZtgkMXq.cjs → PreviewApp.vue_vue_type_style_index_0_lang-B9_7wgnw.cjs} +1 -1
- package/dist/{PreviewApp.vue_vue_type_style_index_0_lang-m2TIr6Wk.js → PreviewApp.vue_vue_type_style_index_0_lang-DCYf0VuH.js} +1 -1
- package/dist/api/index.d.ts +2 -0
- package/dist/api/index.d.ts.map +1 -1
- package/dist/{appRuntime-BqvP0NaP.cjs → appRuntime-BWlOTcQo.cjs} +13 -210
- package/dist/{appRuntime-FphnGcV2.js → appRuntime-DEeCouh7.js} +38 -235
- package/dist/{client-XQnL-B6N.js → client-Ce9fRCGH.js} +2 -2
- package/dist/index.cjs +23 -19
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.mjs +52 -47
- package/dist/pageTitle-DyJ9r6xJ.cjs +268 -0
- package/dist/pageTitle-tOzMNilm.js +269 -0
- package/dist/{shard-runner-CinJMC5z.cjs → shard-runner-BJ7J4qF3.cjs} +2 -2
- package/dist/{shard-runner-C7_xAkA1.js → shard-runner-BSUEe9p3.js} +2 -2
- package/dist/ssg/cli.cjs +8 -2
- package/dist/ssg/cli.mjs +8 -2
- package/dist/ssg/client.mjs +2 -2
- package/dist/ssg/cms-routes.d.ts +19 -0
- package/dist/ssg/cms-routes.d.ts.map +1 -1
- package/dist/ssg/createSSREntry.d.ts.map +1 -1
- package/dist/ssg/index.cjs +7 -5
- package/dist/ssg/index.mjs +22 -20
- package/dist/{validate-output-e0E998g_.js → validate-output-CRv_cnji.js} +44 -24
- package/dist/{validate-output-DQTw64Rc.cjs → validate-output-oVFDwKIA.cjs} +24 -4
- package/package.json +1 -1
- package/dist/pageTitle-BOTMH-D8.js +0 -56
- package/dist/pageTitle-nIl1cDfD.cjs +0 -55
package/dist/ssg/cms-routes.d.ts
CHANGED
|
@@ -15,6 +15,13 @@ export interface CmsSiteData {
|
|
|
15
15
|
redirects: RedirectEntry[];
|
|
16
16
|
/** Datastore collections referenced by any page's data_bindings. */
|
|
17
17
|
collections: CollectionRef[];
|
|
18
|
+
/**
|
|
19
|
+
* Full datastore items per collection, bulk-loaded during route expansion.
|
|
20
|
+
* Lets the render resolve data-bound detail pages (and block list fetches)
|
|
21
|
+
* from memory instead of one network round-trip per page — the dominant
|
|
22
|
+
* cost on large sites. Keyed by collection name (JSON-serializable).
|
|
23
|
+
*/
|
|
24
|
+
collectionItems?: Record<string, Record<string, unknown>[]>;
|
|
18
25
|
}
|
|
19
26
|
/**
|
|
20
27
|
* Expand a list of default-locale paths into every supported locale.
|
|
@@ -26,4 +33,16 @@ export declare function expandLocalePaths(paths: string[], defaultLocale: string
|
|
|
26
33
|
* website settings, page routes, and redirects.
|
|
27
34
|
*/
|
|
28
35
|
export declare function fetchCmsSiteData(apiBase: string, websiteName: string, requestOptions?: BloxBuildRequestOptions): Promise<CmsSiteData>;
|
|
36
|
+
export type CollectionResolver = (collection: string, options: {
|
|
37
|
+
locale?: string;
|
|
38
|
+
q?: string;
|
|
39
|
+
offset?: number;
|
|
40
|
+
limit?: number;
|
|
41
|
+
}) => Promise<Record<string, unknown>[]>;
|
|
42
|
+
/**
|
|
43
|
+
* Build an in-memory resolver over the bulk-loaded collection items, so data-bound
|
|
44
|
+
* detail pages resolve from memory during SSR instead of one network round-trip
|
|
45
|
+
* per page. Supports the SCIM `q` subset the renderer emits: `field eq "value"`.
|
|
46
|
+
*/
|
|
47
|
+
export declare function buildCollectionResolver(collectionItems: Record<string, Record<string, unknown>[]>): CollectionResolver;
|
|
29
48
|
//# sourceMappingURL=cms-routes.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cms-routes.d.ts","sourceRoot":"","sources":["../../src/ssg/cms-routes.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAC/C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAA;AAC1C,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,iBAAiB,CAAA;AAoB9D,2EAA2E;AAC3E,MAAM,WAAW,aAAa;IAC7B,KAAK,EAAE,MAAM,CAAA;IACb,UAAU,EAAE,MAAM,CAAA;CAClB;AAED,MAAM,WAAW,WAAW;IAC3B,SAAS,EAAE,MAAM,CAAA;IACjB,OAAO,EAAE,WAAW,CAAA;IACpB,KAAK,EAAE,MAAM,EAAE,CAAA;IACf,8EAA8E;IAC9E,SAAS,EAAE,MAAM,EAAE,CAAA;IACnB,SAAS,EAAE,aAAa,EAAE,CAAA;IAC1B,oEAAoE;IACpE,WAAW,EAAE,aAAa,EAAE,CAAA;
|
|
1
|
+
{"version":3,"file":"cms-routes.d.ts","sourceRoot":"","sources":["../../src/ssg/cms-routes.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAC/C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAA;AAC1C,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,iBAAiB,CAAA;AAoB9D,2EAA2E;AAC3E,MAAM,WAAW,aAAa;IAC7B,KAAK,EAAE,MAAM,CAAA;IACb,UAAU,EAAE,MAAM,CAAA;CAClB;AAED,MAAM,WAAW,WAAW;IAC3B,SAAS,EAAE,MAAM,CAAA;IACjB,OAAO,EAAE,WAAW,CAAA;IACpB,KAAK,EAAE,MAAM,EAAE,CAAA;IACf,8EAA8E;IAC9E,SAAS,EAAE,MAAM,EAAE,CAAA;IACnB,SAAS,EAAE,aAAa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AAE,MAAM,EACZ,MAAM,EAAE,MAAM,EACd,QAAQ,CAAC,EAAE,yBAAyB,CAAC,oBAAoB,CAAC,GACxD,OAAO,CAAC;IACV,IAAI,EAAE,aAAa,CAAA;IACnB,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC,CAAA;IACxD,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CACnC,GAAG,IAAI,CAAC,CA4DR;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,yBAAyB,GAAG,YAAY,CAkMnF"}
|
package/dist/ssg/index.cjs
CHANGED
|
@@ -22,11 +22,12 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
22
22
|
mod
|
|
23
23
|
));
|
|
24
24
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
25
|
-
const llmArtifacts = require("../validate-output-
|
|
25
|
+
const llmArtifacts = require("../validate-output-oVFDwKIA.cjs");
|
|
26
26
|
const ssg_buildGrant = require("./build-grant.cjs");
|
|
27
27
|
const ssg_client = require("../client-AoDTJJXJ.cjs");
|
|
28
28
|
const vue = require("vue");
|
|
29
|
-
const appRuntime = require("../appRuntime-
|
|
29
|
+
const appRuntime = require("../appRuntime-BWlOTcQo.cjs");
|
|
30
|
+
const pageTitle = require("../pageTitle-DyJ9r6xJ.cjs");
|
|
30
31
|
async function renderBloxSsgPage(options) {
|
|
31
32
|
var _a, _b, _c, _d;
|
|
32
33
|
const {
|
|
@@ -253,11 +254,12 @@ function createBloxSSREntry(options) {
|
|
|
253
254
|
publishedBundleCache.set(cacheKey, pending);
|
|
254
255
|
}
|
|
255
256
|
const bundle = await pending;
|
|
257
|
+
const activeResolver = options.collectionResolver ?? pageTitle.getCollectionResolver() ?? void 0;
|
|
256
258
|
const resolved = await resolvePublishedPage(
|
|
257
259
|
bundle.pages,
|
|
258
260
|
slug,
|
|
259
261
|
pageLocale,
|
|
260
|
-
options.resolvePublishedPaths ?? !!
|
|
262
|
+
options.resolvePublishedPaths ?? !!activeResolver ? activeResolver : void 0
|
|
261
263
|
);
|
|
262
264
|
return resolved ? { ...resolved, warnings: [] } : null;
|
|
263
265
|
}
|
|
@@ -280,11 +282,11 @@ function createBloxSSREntry(options) {
|
|
|
280
282
|
render: () => vue.h(vue.Suspense, null, { default: () => vue.h(rootComponent) })
|
|
281
283
|
});
|
|
282
284
|
const dataRegistry = appRuntime.provideBloxData(app, { server: true });
|
|
283
|
-
const api =
|
|
285
|
+
const api = pageTitle.provideBloxApi(app, {
|
|
284
286
|
websiteName,
|
|
285
287
|
store,
|
|
286
288
|
origin: apiBase,
|
|
287
|
-
collectionResolver: options.collectionResolver
|
|
289
|
+
collectionResolver: options.collectionResolver ?? pageTitle.getCollectionResolver()
|
|
288
290
|
});
|
|
289
291
|
const localeState = appRuntime.provideBloxLocale(app, pageLocale);
|
|
290
292
|
app.provide(appRuntime.BLOX_SSR_ROUTE_STATE_KEY, {
|
package/dist/ssg/index.mjs
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { c as buildPageHead, d as primaryContextEntry, e as buildJsonLd, h as extractPageText, B as BloxBuildResponseError, i as bloxBuildJson } from "../validate-output-CRv_cnji.js";
|
|
2
|
+
import { j, k, f, l, m, n, o, g, q, r, s, t, w, x, p, a, y, z, u, v } from "../validate-output-CRv_cnji.js";
|
|
3
3
|
import { parseBloxBuildGrantBody, resolveBloxBuildGrant } from "./build-grant.mjs";
|
|
4
|
-
import {
|
|
4
|
+
import { a as BLOX_HYDRATION_WINDOW_KEY } from "../client-Ce9fRCGH.js";
|
|
5
5
|
import { createSSRApp, h, Suspense } from "vue";
|
|
6
|
-
import { c as collectBloxData, a as collectBloxSeo, p as provideBloxData, b as
|
|
6
|
+
import { c as collectBloxData, a as collectBloxSeo, p as provideBloxData, b as provideBloxLocale, B as BLOX_SSR_ROUTE_STATE_KEY, i as installBloxRuntime, s as setActiveLocale } from "../appRuntime-DEeCouh7.js";
|
|
7
|
+
import { p as provideBloxApi, g as getCollectionResolver } from "../pageTitle-tOzMNilm.js";
|
|
7
8
|
async function renderBloxSsgPage(options) {
|
|
8
9
|
var _a, _b, _c, _d;
|
|
9
10
|
const {
|
|
@@ -230,11 +231,12 @@ function createBloxSSREntry(options) {
|
|
|
230
231
|
publishedBundleCache.set(cacheKey, pending);
|
|
231
232
|
}
|
|
232
233
|
const bundle = await pending;
|
|
234
|
+
const activeResolver = options.collectionResolver ?? getCollectionResolver() ?? void 0;
|
|
233
235
|
const resolved = await resolvePublishedPage(
|
|
234
236
|
bundle.pages,
|
|
235
237
|
slug,
|
|
236
238
|
pageLocale,
|
|
237
|
-
options.resolvePublishedPaths ?? !!
|
|
239
|
+
options.resolvePublishedPaths ?? !!activeResolver ? activeResolver : void 0
|
|
238
240
|
);
|
|
239
241
|
return resolved ? { ...resolved, warnings: [] } : null;
|
|
240
242
|
}
|
|
@@ -261,7 +263,7 @@ function createBloxSSREntry(options) {
|
|
|
261
263
|
websiteName,
|
|
262
264
|
store,
|
|
263
265
|
origin: apiBase,
|
|
264
|
-
collectionResolver: options.collectionResolver
|
|
266
|
+
collectionResolver: options.collectionResolver ?? getCollectionResolver()
|
|
265
267
|
});
|
|
266
268
|
const localeState = provideBloxLocale(app, pageLocale);
|
|
267
269
|
app.provide(BLOX_SSR_ROUTE_STATE_KEY, {
|
|
@@ -392,34 +394,34 @@ export {
|
|
|
392
394
|
BLOX_HYDRATION_WINDOW_KEY,
|
|
393
395
|
BloxBuildResponseError,
|
|
394
396
|
bloxBuildJson,
|
|
395
|
-
|
|
397
|
+
j as bloxBuildRequest,
|
|
396
398
|
buildJsonLd,
|
|
397
399
|
buildPageHead,
|
|
398
|
-
|
|
400
|
+
k as buildSiteHead,
|
|
399
401
|
createBloxSSREntry,
|
|
400
402
|
extractPageText,
|
|
401
403
|
f as fetchCmsSiteData,
|
|
402
404
|
fetchDatastoreSnapshot,
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
405
|
+
l as generateLlmsFullTxt,
|
|
406
|
+
m as generateLlmsTxt,
|
|
407
|
+
n as generateNetlifyRedirects,
|
|
408
|
+
o as generateRobotsTxt,
|
|
407
409
|
g as generateSitemapArtifacts,
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
410
|
+
q as generateSitemapIndexXml,
|
|
411
|
+
r as generateSitemapXml,
|
|
412
|
+
s as getBloxBuildRequestOptions,
|
|
413
|
+
t as getSiteIconFlags,
|
|
414
|
+
w as localeSitemapPath,
|
|
415
|
+
x as mergeLlmParts,
|
|
414
416
|
parseBloxBuildGrantBody,
|
|
415
417
|
p as polyfillBloxSsgGlobals,
|
|
416
418
|
a as prerender,
|
|
417
419
|
querySnapshotRows,
|
|
418
420
|
renderBloxSsgPage,
|
|
419
421
|
resolveBloxBuildGrant,
|
|
420
|
-
|
|
422
|
+
y as resolveManifestProvenance,
|
|
421
423
|
snapshotRows,
|
|
422
|
-
|
|
424
|
+
z as splitSitemapPathsByLocale,
|
|
423
425
|
u as uploadBloxManifest,
|
|
424
426
|
v as validateSsgOutput
|
|
425
427
|
};
|
|
@@ -3,7 +3,7 @@ import fs, { readFile } from "node:fs/promises";
|
|
|
3
3
|
import path, { resolve } from "node:path";
|
|
4
4
|
import process$1 from "node:process";
|
|
5
5
|
import { pathToFileURL } from "node:url";
|
|
6
|
-
import { r as resolvePageTitle,
|
|
6
|
+
import { r as resolvePageTitle, a as primaryPageContext, c as contextPageTitle } from "./pageTitle-tOzMNilm.js";
|
|
7
7
|
class BloxBuildResponseError extends Error {
|
|
8
8
|
constructor(status, url, statusText) {
|
|
9
9
|
super(`Build API ${status} ${statusText}: ${url}`);
|
|
@@ -89,13 +89,14 @@ async function fetchCmsSiteData(apiBase, websiteName, requestOptions = {}) {
|
|
|
89
89
|
const website2 = baseBundle.website;
|
|
90
90
|
const defaultLocale2 = website2.default_locale || "en";
|
|
91
91
|
const supportedLocales2 = Array.isArray(website2.supported_locales) && website2.supported_locales.length > 0 ? website2.supported_locales : [defaultLocale2];
|
|
92
|
+
const collectionItems = {};
|
|
92
93
|
const localizedBundles = await Promise.all(supportedLocales2.map(async (locale) => {
|
|
93
94
|
const bundle = locale === defaultLocale2 ? baseBundle : await bloxBuildJson(
|
|
94
95
|
`${apiBase}/blox-build/websites/${websiteId}/published?locale=${encodeURIComponent(locale)}`,
|
|
95
96
|
{},
|
|
96
97
|
requestOptions
|
|
97
98
|
);
|
|
98
|
-
const localePaths = await expandRoutes(apiBase, bundle.pages, requestOptions, locale);
|
|
99
|
+
const localePaths = await expandRoutes(apiBase, bundle.pages, requestOptions, locale, collectionItems);
|
|
99
100
|
return {
|
|
100
101
|
locale,
|
|
101
102
|
bundle,
|
|
@@ -108,7 +109,8 @@ async function fetchCmsSiteData(apiBase, websiteName, requestOptions = {}) {
|
|
|
108
109
|
paths: [...new Set(localizedBundles.flatMap((result) => result.paths))],
|
|
109
110
|
pageSlugs: [...new Set(localizedBundles.flatMap((result) => result.bundle.pages.flatMap((page) => page.slug ? [localizePath(page.slug, result.locale, defaultLocale2)] : [])))],
|
|
110
111
|
redirects: baseBundle.redirects.filter((redirect) => redirect.from_path && redirect.to_path),
|
|
111
|
-
collections: extractCollectionRefs(localizedBundles.flatMap((result) => result.bundle.pages))
|
|
112
|
+
collections: extractCollectionRefs(localizedBundles.flatMap((result) => result.bundle.pages)),
|
|
113
|
+
collectionItems
|
|
112
114
|
};
|
|
113
115
|
}
|
|
114
116
|
const site = await bloxBuildJson(
|
|
@@ -167,7 +169,7 @@ async function fetchCmsSiteData(apiBase, websiteName, requestOptions = {}) {
|
|
|
167
169
|
const pageSlugs = [...new Set(localizedPages.flatMap((result) => result.pages.flatMap((page) => page.slug ? [localizePath(page.slug, result.locale, defaultLocale)] : [])))];
|
|
168
170
|
return { websiteId: site.id, website, paths, pageSlugs, redirects, collections };
|
|
169
171
|
}
|
|
170
|
-
async function expandRoutes(apiBase, pages, requestOptions, locale) {
|
|
172
|
+
async function expandRoutes(apiBase, pages, requestOptions, locale, collectItems) {
|
|
171
173
|
const routes = [];
|
|
172
174
|
const grantedWebsiteId = requestOptions.websiteId;
|
|
173
175
|
for (const page of pages) {
|
|
@@ -195,6 +197,10 @@ async function expandRoutes(apiBase, pages, requestOptions, locale) {
|
|
|
195
197
|
items.push(...pageItems);
|
|
196
198
|
if (pageItems.length < pageSize) break;
|
|
197
199
|
}
|
|
200
|
+
if (collectItems && b.collection) {
|
|
201
|
+
const existing = collectItems[b.collection] ?? [];
|
|
202
|
+
collectItems[b.collection] = [...existing, ...items];
|
|
203
|
+
}
|
|
198
204
|
for (const item of items) {
|
|
199
205
|
const bindValue = item[b.bind_by];
|
|
200
206
|
if (typeof bindValue !== "string" || bindValue === "") continue;
|
|
@@ -234,6 +240,19 @@ function extractCollectionRefs(pages) {
|
|
|
234
240
|
}
|
|
235
241
|
return refs;
|
|
236
242
|
}
|
|
243
|
+
function buildCollectionResolver(collectionItems) {
|
|
244
|
+
return async (collection, { q, offset = 0, limit = 100 } = {}) => {
|
|
245
|
+
let items = collectionItems[collection] ?? [];
|
|
246
|
+
if (q) {
|
|
247
|
+
const match = /^\s*(\w+)\s+eq\s+"([^"]*)"\s*$/.exec(q);
|
|
248
|
+
if (match) {
|
|
249
|
+
const [, field, value] = match;
|
|
250
|
+
items = items.filter((item) => String(item[field] ?? "") === value);
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
return items.slice(offset, offset + limit);
|
|
254
|
+
};
|
|
255
|
+
}
|
|
237
256
|
function environment(name) {
|
|
238
257
|
var _a;
|
|
239
258
|
return ((_a = process$1.env[name]) == null ? void 0 : _a.trim()) || void 0;
|
|
@@ -1339,31 +1358,32 @@ async function validateSitemap(outDir, content) {
|
|
|
1339
1358
|
return failures;
|
|
1340
1359
|
}
|
|
1341
1360
|
export {
|
|
1361
|
+
llmArtifacts as A,
|
|
1342
1362
|
BloxBuildResponseError as B,
|
|
1343
1363
|
prerender as a,
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1364
|
+
buildCollectionResolver as b,
|
|
1365
|
+
buildPageHead as c,
|
|
1366
|
+
primaryContextEntry as d,
|
|
1367
|
+
buildJsonLd as e,
|
|
1348
1368
|
fetchCmsSiteData as f,
|
|
1349
1369
|
generateSitemapArtifacts as g,
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1370
|
+
extractPageText as h,
|
|
1371
|
+
bloxBuildJson as i,
|
|
1372
|
+
bloxBuildRequest as j,
|
|
1373
|
+
buildSiteHead as k,
|
|
1374
|
+
generateLlmsFullTxt as l,
|
|
1375
|
+
generateLlmsTxt as m,
|
|
1376
|
+
generateNetlifyRedirects as n,
|
|
1377
|
+
generateRobotsTxt as o,
|
|
1358
1378
|
polyfillBloxSsgGlobals as p,
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1379
|
+
generateSitemapIndexXml as q,
|
|
1380
|
+
generateSitemapXml as r,
|
|
1381
|
+
getBloxBuildRequestOptions as s,
|
|
1382
|
+
getSiteIconFlags as t,
|
|
1363
1383
|
uploadBloxManifest as u,
|
|
1364
1384
|
validateSsgOutput as v,
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1385
|
+
localeSitemapPath as w,
|
|
1386
|
+
mergeLlmParts as x,
|
|
1387
|
+
resolveManifestProvenance as y,
|
|
1388
|
+
splitSitemapPathsByLocale as z
|
|
1369
1389
|
};
|
|
@@ -26,7 +26,7 @@ const fs = require("node:fs/promises");
|
|
|
26
26
|
const path = require("node:path");
|
|
27
27
|
const process$1 = require("node:process");
|
|
28
28
|
const node_url = require("node:url");
|
|
29
|
-
const pageTitle = require("./pageTitle-
|
|
29
|
+
const pageTitle = require("./pageTitle-DyJ9r6xJ.cjs");
|
|
30
30
|
class BloxBuildResponseError extends Error {
|
|
31
31
|
constructor(status, url, statusText) {
|
|
32
32
|
super(`Build API ${status} ${statusText}: ${url}`);
|
|
@@ -112,13 +112,14 @@ async function fetchCmsSiteData(apiBase, websiteName, requestOptions = {}) {
|
|
|
112
112
|
const website2 = baseBundle.website;
|
|
113
113
|
const defaultLocale2 = website2.default_locale || "en";
|
|
114
114
|
const supportedLocales2 = Array.isArray(website2.supported_locales) && website2.supported_locales.length > 0 ? website2.supported_locales : [defaultLocale2];
|
|
115
|
+
const collectionItems = {};
|
|
115
116
|
const localizedBundles = await Promise.all(supportedLocales2.map(async (locale) => {
|
|
116
117
|
const bundle = locale === defaultLocale2 ? baseBundle : await bloxBuildJson(
|
|
117
118
|
`${apiBase}/blox-build/websites/${websiteId}/published?locale=${encodeURIComponent(locale)}`,
|
|
118
119
|
{},
|
|
119
120
|
requestOptions
|
|
120
121
|
);
|
|
121
|
-
const localePaths = await expandRoutes(apiBase, bundle.pages, requestOptions, locale);
|
|
122
|
+
const localePaths = await expandRoutes(apiBase, bundle.pages, requestOptions, locale, collectionItems);
|
|
122
123
|
return {
|
|
123
124
|
locale,
|
|
124
125
|
bundle,
|
|
@@ -131,7 +132,8 @@ async function fetchCmsSiteData(apiBase, websiteName, requestOptions = {}) {
|
|
|
131
132
|
paths: [...new Set(localizedBundles.flatMap((result) => result.paths))],
|
|
132
133
|
pageSlugs: [...new Set(localizedBundles.flatMap((result) => result.bundle.pages.flatMap((page) => page.slug ? [localizePath(page.slug, result.locale, defaultLocale2)] : [])))],
|
|
133
134
|
redirects: baseBundle.redirects.filter((redirect) => redirect.from_path && redirect.to_path),
|
|
134
|
-
collections: extractCollectionRefs(localizedBundles.flatMap((result) => result.bundle.pages))
|
|
135
|
+
collections: extractCollectionRefs(localizedBundles.flatMap((result) => result.bundle.pages)),
|
|
136
|
+
collectionItems
|
|
135
137
|
};
|
|
136
138
|
}
|
|
137
139
|
const site = await bloxBuildJson(
|
|
@@ -190,7 +192,7 @@ async function fetchCmsSiteData(apiBase, websiteName, requestOptions = {}) {
|
|
|
190
192
|
const pageSlugs = [...new Set(localizedPages.flatMap((result) => result.pages.flatMap((page) => page.slug ? [localizePath(page.slug, result.locale, defaultLocale)] : [])))];
|
|
191
193
|
return { websiteId: site.id, website, paths, pageSlugs, redirects, collections };
|
|
192
194
|
}
|
|
193
|
-
async function expandRoutes(apiBase, pages, requestOptions, locale) {
|
|
195
|
+
async function expandRoutes(apiBase, pages, requestOptions, locale, collectItems) {
|
|
194
196
|
const routes = [];
|
|
195
197
|
const grantedWebsiteId = requestOptions.websiteId;
|
|
196
198
|
for (const page of pages) {
|
|
@@ -218,6 +220,10 @@ async function expandRoutes(apiBase, pages, requestOptions, locale) {
|
|
|
218
220
|
items.push(...pageItems);
|
|
219
221
|
if (pageItems.length < pageSize) break;
|
|
220
222
|
}
|
|
223
|
+
if (collectItems && b.collection) {
|
|
224
|
+
const existing = collectItems[b.collection] ?? [];
|
|
225
|
+
collectItems[b.collection] = [...existing, ...items];
|
|
226
|
+
}
|
|
221
227
|
for (const item of items) {
|
|
222
228
|
const bindValue = item[b.bind_by];
|
|
223
229
|
if (typeof bindValue !== "string" || bindValue === "") continue;
|
|
@@ -257,6 +263,19 @@ function extractCollectionRefs(pages) {
|
|
|
257
263
|
}
|
|
258
264
|
return refs;
|
|
259
265
|
}
|
|
266
|
+
function buildCollectionResolver(collectionItems) {
|
|
267
|
+
return async (collection, { q, offset = 0, limit = 100 } = {}) => {
|
|
268
|
+
let items = collectionItems[collection] ?? [];
|
|
269
|
+
if (q) {
|
|
270
|
+
const match = /^\s*(\w+)\s+eq\s+"([^"]*)"\s*$/.exec(q);
|
|
271
|
+
if (match) {
|
|
272
|
+
const [, field, value] = match;
|
|
273
|
+
items = items.filter((item) => String(item[field] ?? "") === value);
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
return items.slice(offset, offset + limit);
|
|
277
|
+
};
|
|
278
|
+
}
|
|
260
279
|
function environment(name) {
|
|
261
280
|
var _a;
|
|
262
281
|
return ((_a = process$1.env[name]) == null ? void 0 : _a.trim()) || void 0;
|
|
@@ -1364,6 +1383,7 @@ async function validateSitemap(outDir, content) {
|
|
|
1364
1383
|
exports.BloxBuildResponseError = BloxBuildResponseError;
|
|
1365
1384
|
exports.bloxBuildJson = bloxBuildJson;
|
|
1366
1385
|
exports.bloxBuildRequest = bloxBuildRequest;
|
|
1386
|
+
exports.buildCollectionResolver = buildCollectionResolver;
|
|
1367
1387
|
exports.buildJsonLd = buildJsonLd;
|
|
1368
1388
|
exports.buildPageHead = buildPageHead;
|
|
1369
1389
|
exports.buildSiteHead = buildSiteHead;
|
package/package.json
CHANGED
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
const PREFERRED_CONTEXT_KEYS = ["$page", "$post", "$item", "$article", "$product", "$event", "$author"];
|
|
2
|
-
const TITLE_FIELDS = ["meta_title", "metaTitle", "title", "name", "productName", "displayName"];
|
|
3
|
-
function primaryPageContext(contexts) {
|
|
4
|
-
if (!contexts) return null;
|
|
5
|
-
const keys = [
|
|
6
|
-
...PREFERRED_CONTEXT_KEYS.filter((key) => key in contexts),
|
|
7
|
-
...Object.keys(contexts).filter((key) => key !== "$website" && !PREFERRED_CONTEXT_KEYS.includes(key)).sort()
|
|
8
|
-
];
|
|
9
|
-
for (const key of keys) {
|
|
10
|
-
const ctx = contexts[key];
|
|
11
|
-
if (ctx != null && typeof ctx === "object") return { key, ctx };
|
|
12
|
-
}
|
|
13
|
-
return null;
|
|
14
|
-
}
|
|
15
|
-
function contextPageTitle(context) {
|
|
16
|
-
if (!context) return null;
|
|
17
|
-
for (const field of TITLE_FIELDS) {
|
|
18
|
-
const value = context[field];
|
|
19
|
-
if (typeof value === "string" && value.trim()) return value.trim();
|
|
20
|
-
}
|
|
21
|
-
return null;
|
|
22
|
-
}
|
|
23
|
-
function siteNameFromContexts(contexts) {
|
|
24
|
-
const website = contexts == null ? void 0 : contexts.$website;
|
|
25
|
-
const seo = website == null ? void 0 : website.seo;
|
|
26
|
-
const siteName = seo && typeof seo === "object" ? seo.site_name : website == null ? void 0 : website.site_name;
|
|
27
|
-
return typeof siteName === "string" && siteName.trim() ? siteName.trim() : null;
|
|
28
|
-
}
|
|
29
|
-
function withSiteName(title, siteName) {
|
|
30
|
-
if (!siteName || title.includes(siteName)) return title;
|
|
31
|
-
return `${title} · ${siteName}`;
|
|
32
|
-
}
|
|
33
|
-
function resolvePageTitle(resolved, options = {}) {
|
|
34
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
35
|
-
const hasBinding = !!((_a = resolved.page) == null ? void 0 : _a.data_bindings) && Object.keys(resolved.page.data_bindings).length > 0;
|
|
36
|
-
const contextTitle = hasBinding ? contextPageTitle((_b = primaryPageContext(resolved.contexts)) == null ? void 0 : _b.ctx) : null;
|
|
37
|
-
const dynamicTitle = ((_c = options.override) == null ? void 0 : _c.trim()) || contextTitle;
|
|
38
|
-
if (dynamicTitle) return withSiteName(dynamicTitle, options.siteName);
|
|
39
|
-
if ((_e = (_d = resolved.page) == null ? void 0 : _d.meta_title) == null ? void 0 : _e.trim()) return resolved.page.meta_title.trim();
|
|
40
|
-
if ((_g = (_f = resolved.page) == null ? void 0 : _f.title) == null ? void 0 : _g.trim()) return withSiteName(resolved.page.title.trim(), options.siteName);
|
|
41
|
-
return null;
|
|
42
|
-
}
|
|
43
|
-
function preserveCurrentSiteSuffix(title, currentTitle) {
|
|
44
|
-
const separator = " · ";
|
|
45
|
-
const suffixIndex = currentTitle.lastIndexOf(separator);
|
|
46
|
-
if (suffixIndex < 0) return title;
|
|
47
|
-
const siteName = currentTitle.slice(suffixIndex + separator.length).trim();
|
|
48
|
-
return withSiteName(title, siteName);
|
|
49
|
-
}
|
|
50
|
-
export {
|
|
51
|
-
preserveCurrentSiteSuffix as a,
|
|
52
|
-
contextPageTitle as c,
|
|
53
|
-
primaryPageContext as p,
|
|
54
|
-
resolvePageTitle as r,
|
|
55
|
-
siteNameFromContexts as s
|
|
56
|
-
};
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
const PREFERRED_CONTEXT_KEYS = ["$page", "$post", "$item", "$article", "$product", "$event", "$author"];
|
|
3
|
-
const TITLE_FIELDS = ["meta_title", "metaTitle", "title", "name", "productName", "displayName"];
|
|
4
|
-
function primaryPageContext(contexts) {
|
|
5
|
-
if (!contexts) return null;
|
|
6
|
-
const keys = [
|
|
7
|
-
...PREFERRED_CONTEXT_KEYS.filter((key) => key in contexts),
|
|
8
|
-
...Object.keys(contexts).filter((key) => key !== "$website" && !PREFERRED_CONTEXT_KEYS.includes(key)).sort()
|
|
9
|
-
];
|
|
10
|
-
for (const key of keys) {
|
|
11
|
-
const ctx = contexts[key];
|
|
12
|
-
if (ctx != null && typeof ctx === "object") return { key, ctx };
|
|
13
|
-
}
|
|
14
|
-
return null;
|
|
15
|
-
}
|
|
16
|
-
function contextPageTitle(context) {
|
|
17
|
-
if (!context) return null;
|
|
18
|
-
for (const field of TITLE_FIELDS) {
|
|
19
|
-
const value = context[field];
|
|
20
|
-
if (typeof value === "string" && value.trim()) return value.trim();
|
|
21
|
-
}
|
|
22
|
-
return null;
|
|
23
|
-
}
|
|
24
|
-
function siteNameFromContexts(contexts) {
|
|
25
|
-
const website = contexts == null ? void 0 : contexts.$website;
|
|
26
|
-
const seo = website == null ? void 0 : website.seo;
|
|
27
|
-
const siteName = seo && typeof seo === "object" ? seo.site_name : website == null ? void 0 : website.site_name;
|
|
28
|
-
return typeof siteName === "string" && siteName.trim() ? siteName.trim() : null;
|
|
29
|
-
}
|
|
30
|
-
function withSiteName(title, siteName) {
|
|
31
|
-
if (!siteName || title.includes(siteName)) return title;
|
|
32
|
-
return `${title} · ${siteName}`;
|
|
33
|
-
}
|
|
34
|
-
function resolvePageTitle(resolved, options = {}) {
|
|
35
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
36
|
-
const hasBinding = !!((_a = resolved.page) == null ? void 0 : _a.data_bindings) && Object.keys(resolved.page.data_bindings).length > 0;
|
|
37
|
-
const contextTitle = hasBinding ? contextPageTitle((_b = primaryPageContext(resolved.contexts)) == null ? void 0 : _b.ctx) : null;
|
|
38
|
-
const dynamicTitle = ((_c = options.override) == null ? void 0 : _c.trim()) || contextTitle;
|
|
39
|
-
if (dynamicTitle) return withSiteName(dynamicTitle, options.siteName);
|
|
40
|
-
if ((_e = (_d = resolved.page) == null ? void 0 : _d.meta_title) == null ? void 0 : _e.trim()) return resolved.page.meta_title.trim();
|
|
41
|
-
if ((_g = (_f = resolved.page) == null ? void 0 : _f.title) == null ? void 0 : _g.trim()) return withSiteName(resolved.page.title.trim(), options.siteName);
|
|
42
|
-
return null;
|
|
43
|
-
}
|
|
44
|
-
function preserveCurrentSiteSuffix(title, currentTitle) {
|
|
45
|
-
const separator = " · ";
|
|
46
|
-
const suffixIndex = currentTitle.lastIndexOf(separator);
|
|
47
|
-
if (suffixIndex < 0) return title;
|
|
48
|
-
const siteName = currentTitle.slice(suffixIndex + separator.length).trim();
|
|
49
|
-
return withSiteName(title, siteName);
|
|
50
|
-
}
|
|
51
|
-
exports.contextPageTitle = contextPageTitle;
|
|
52
|
-
exports.preserveCurrentSiteSuffix = preserveCurrentSiteSuffix;
|
|
53
|
-
exports.primaryPageContext = primaryPageContext;
|
|
54
|
-
exports.resolvePageTitle = resolvePageTitle;
|
|
55
|
-
exports.siteNameFromContexts = siteNameFromContexts;
|