@bagelink/blox 1.15.533 → 1.15.535
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/{shard-runner-DFZAHrwJ.js → shard-runner-Aw77Pe6C.js} +15 -30
- package/dist/{shard-runner-DTkniXr1.cjs → shard-runner-C-OeWaVM.cjs} +15 -30
- package/dist/ssg/cli.cjs +2 -2
- package/dist/ssg/cli.mjs +2 -2
- package/dist/ssg/datastore-snapshot.d.ts +28 -0
- package/dist/ssg/datastore-snapshot.d.ts.map +1 -0
- package/dist/ssg/index.cjs +75 -1
- package/dist/ssg/index.d.ts +4 -2
- package/dist/ssg/index.d.ts.map +1 -1
- package/dist/ssg/index.mjs +89 -15
- package/dist/ssg/prerender.d.ts.map +1 -1
- package/dist/ssg/seo.d.ts +17 -0
- package/dist/ssg/seo.d.ts.map +1 -1
- package/dist/ssg/shard-runner.d.ts.map +1 -1
- package/dist/{validate-output-C3NhyFsU.cjs → validate-output-2iH8f9ql.cjs} +54 -27
- package/dist/{validate-output-C-RpYkvf.js → validate-output-CfHo6w9k.js} +73 -46
- package/package.json +2 -2
|
@@ -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,
|
|
5
|
+
import { f as fetchCmsSiteData, g as generateSitemapArtifacts } from "./validate-output-CfHo6w9k.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
|
function resolveShardCount(shards) {
|
|
@@ -109,7 +109,7 @@ async function runSharded(opts) {
|
|
|
109
109
|
}
|
|
110
110
|
if (process.env.BLOX_SSG_LLM !== "0") {
|
|
111
111
|
try {
|
|
112
|
-
const { mergeLlmParts } = await import("./validate-output-
|
|
112
|
+
const { mergeLlmParts } = await import("./validate-output-CfHo6w9k.js").then((n) => n.A);
|
|
113
113
|
const mergeWebsite = website;
|
|
114
114
|
const partFiles = Array.from({ length: total }, (_, i) => path.join(llmPartsDir, `part.${i}.json`));
|
|
115
115
|
const { pages } = await mergeLlmParts({
|
|
@@ -131,37 +131,22 @@ async function runSharded(opts) {
|
|
|
131
131
|
const canonicalBase = (((_a = website.seo) == null ? void 0 : _a.canonical_base_url) || website.domain || "").replace(/\/$/, "");
|
|
132
132
|
const indexableRoutes = [...byUrl.values()].filter((route) => !route.noindex);
|
|
133
133
|
if (canonicalBase && indexableRoutes.length > 0) {
|
|
134
|
-
const
|
|
135
|
-
indexableRoutes.
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
for (const [locale, localePaths] of pathsByLocale) {
|
|
146
|
-
const sitemapPath = localeSitemapPath(locale);
|
|
147
|
-
await fs.writeFile(path.resolve("dist", sitemapPath.slice(1)), generateSitemapXml({
|
|
148
|
-
renderedPaths: localePaths,
|
|
149
|
-
canonicalBase,
|
|
150
|
-
lastmod
|
|
151
|
-
}), "utf8");
|
|
152
|
-
sitemapPaths.push(sitemapPath);
|
|
153
|
-
}
|
|
134
|
+
const artifacts = generateSitemapArtifacts({
|
|
135
|
+
routes: indexableRoutes.map((route) => ({
|
|
136
|
+
path: route.url,
|
|
137
|
+
lastmod: route.lastmod
|
|
138
|
+
})),
|
|
139
|
+
canonicalBase,
|
|
140
|
+
defaultLocale: website.default_locale,
|
|
141
|
+
supportedLocales: website.supported_locales,
|
|
142
|
+
splitByLocale: (_b = website.seo) == null ? void 0 : _b.sitemap_split_by_locale
|
|
143
|
+
});
|
|
144
|
+
for (const artifact of artifacts) {
|
|
154
145
|
await fs.writeFile(
|
|
155
|
-
path.resolve("dist",
|
|
156
|
-
|
|
146
|
+
path.resolve("dist", artifact.path.slice(1)),
|
|
147
|
+
artifact.content,
|
|
157
148
|
"utf8"
|
|
158
149
|
);
|
|
159
|
-
} else {
|
|
160
|
-
await fs.writeFile(path.resolve("dist", "sitemap.xml"), generateSitemapXml({
|
|
161
|
-
renderedPaths,
|
|
162
|
-
canonicalBase,
|
|
163
|
-
lastmod
|
|
164
|
-
}), "utf8");
|
|
165
150
|
}
|
|
166
151
|
}
|
|
167
152
|
await fs.rm(routePartsDir, { recursive: true, force: true });
|
|
@@ -26,7 +26,7 @@ const node_child_process = require("node:child_process");
|
|
|
26
26
|
const os = require("node:os");
|
|
27
27
|
const path = require("node:path");
|
|
28
28
|
const process = require("node:process");
|
|
29
|
-
const llmArtifacts = require("./validate-output-
|
|
29
|
+
const llmArtifacts = require("./validate-output-2iH8f9ql.cjs");
|
|
30
30
|
const AUTO_SHARD_CAP = Number(process.env.BLOX_SSG_SHARD_CAP) || 6;
|
|
31
31
|
const PREFETCH_BUDGET = Number(process.env.BLOX_SSG_PREFETCH_BUDGET) || 24;
|
|
32
32
|
function resolveShardCount(shards) {
|
|
@@ -133,7 +133,7 @@ async function runSharded(opts) {
|
|
|
133
133
|
}
|
|
134
134
|
if (process.env.BLOX_SSG_LLM !== "0") {
|
|
135
135
|
try {
|
|
136
|
-
const { mergeLlmParts } = await Promise.resolve().then(() => require("./validate-output-
|
|
136
|
+
const { mergeLlmParts } = await Promise.resolve().then(() => require("./validate-output-2iH8f9ql.cjs")).then((n) => n.llmArtifacts);
|
|
137
137
|
const mergeWebsite = website;
|
|
138
138
|
const partFiles = Array.from({ length: total }, (_, i) => path.join(llmPartsDir, `part.${i}.json`));
|
|
139
139
|
const { pages } = await mergeLlmParts({
|
|
@@ -155,37 +155,22 @@ async function runSharded(opts) {
|
|
|
155
155
|
const canonicalBase = (((_a = website.seo) == null ? void 0 : _a.canonical_base_url) || website.domain || "").replace(/\/$/, "");
|
|
156
156
|
const indexableRoutes = [...byUrl.values()].filter((route) => !route.noindex);
|
|
157
157
|
if (canonicalBase && indexableRoutes.length > 0) {
|
|
158
|
-
const
|
|
159
|
-
indexableRoutes.
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
for (const [locale, localePaths] of pathsByLocale) {
|
|
170
|
-
const sitemapPath = llmArtifacts.localeSitemapPath(locale);
|
|
171
|
-
await fs.writeFile(path.resolve("dist", sitemapPath.slice(1)), llmArtifacts.generateSitemapXml({
|
|
172
|
-
renderedPaths: localePaths,
|
|
173
|
-
canonicalBase,
|
|
174
|
-
lastmod
|
|
175
|
-
}), "utf8");
|
|
176
|
-
sitemapPaths.push(sitemapPath);
|
|
177
|
-
}
|
|
158
|
+
const artifacts = llmArtifacts.generateSitemapArtifacts({
|
|
159
|
+
routes: indexableRoutes.map((route) => ({
|
|
160
|
+
path: route.url,
|
|
161
|
+
lastmod: route.lastmod
|
|
162
|
+
})),
|
|
163
|
+
canonicalBase,
|
|
164
|
+
defaultLocale: website.default_locale,
|
|
165
|
+
supportedLocales: website.supported_locales,
|
|
166
|
+
splitByLocale: (_b = website.seo) == null ? void 0 : _b.sitemap_split_by_locale
|
|
167
|
+
});
|
|
168
|
+
for (const artifact of artifacts) {
|
|
178
169
|
await fs.writeFile(
|
|
179
|
-
path.resolve("dist",
|
|
180
|
-
|
|
170
|
+
path.resolve("dist", artifact.path.slice(1)),
|
|
171
|
+
artifact.content,
|
|
181
172
|
"utf8"
|
|
182
173
|
);
|
|
183
|
-
} else {
|
|
184
|
-
await fs.writeFile(path.resolve("dist", "sitemap.xml"), llmArtifacts.generateSitemapXml({
|
|
185
|
-
renderedPaths,
|
|
186
|
-
canonicalBase,
|
|
187
|
-
lastmod
|
|
188
|
-
}), "utf8");
|
|
189
174
|
}
|
|
190
175
|
}
|
|
191
176
|
await fs.rm(routePartsDir, { recursive: true, force: true });
|
package/dist/ssg/cli.cjs
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"use strict";
|
|
3
3
|
const process = require("node:process");
|
|
4
4
|
const fs = require("node:fs/promises");
|
|
5
|
-
const llmArtifacts = require("../validate-output-
|
|
5
|
+
const llmArtifacts = require("../validate-output-2iH8f9ql.cjs");
|
|
6
6
|
function installFetchTimeout() {
|
|
7
7
|
const ms = Number(process.env.BLOX_SSG_FETCH_TIMEOUT_MS) || 2e4;
|
|
8
8
|
const original = globalThis.fetch;
|
|
@@ -134,7 +134,7 @@ Environment:
|
|
|
134
134
|
if (shardsOpt !== null || routesCmd) {
|
|
135
135
|
const { apiBase: apiBase2, websiteName: configWebsiteName2 } = await resolveApiBase(mode);
|
|
136
136
|
const websiteName2 = process.env.WEBSITE_NAME ?? configWebsiteName2 ?? "default";
|
|
137
|
-
const { runSharded } = await Promise.resolve().then(() => require("../shard-runner-
|
|
137
|
+
const { runSharded } = await Promise.resolve().then(() => require("../shard-runner-C-OeWaVM.cjs"));
|
|
138
138
|
const code = await runSharded({
|
|
139
139
|
shards: shardsOpt ?? "auto",
|
|
140
140
|
mode,
|
package/dist/ssg/cli.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env bun
|
|
2
2
|
import process from "node:process";
|
|
3
3
|
import fs from "node:fs/promises";
|
|
4
|
-
import { v as validateSsgOutput, u as uploadBloxManifest, p as polyfillBloxSsgGlobals, f as fetchCmsSiteData, a as prerender } from "../validate-output-
|
|
4
|
+
import { v as validateSsgOutput, u as uploadBloxManifest, p as polyfillBloxSsgGlobals, f as fetchCmsSiteData, a as prerender } from "../validate-output-CfHo6w9k.js";
|
|
5
5
|
function installFetchTimeout() {
|
|
6
6
|
const ms = Number(process.env.BLOX_SSG_FETCH_TIMEOUT_MS) || 2e4;
|
|
7
7
|
const original = globalThis.fetch;
|
|
@@ -133,7 +133,7 @@ Environment:
|
|
|
133
133
|
if (shardsOpt !== null || routesCmd) {
|
|
134
134
|
const { apiBase: apiBase2, websiteName: configWebsiteName2 } = await resolveApiBase(mode);
|
|
135
135
|
const websiteName2 = process.env.WEBSITE_NAME ?? configWebsiteName2 ?? "default";
|
|
136
|
-
const { runSharded } = await import("../shard-runner-
|
|
136
|
+
const { runSharded } = await import("../shard-runner-Aw77Pe6C.js");
|
|
137
137
|
const code = await runSharded({
|
|
138
138
|
shards: shardsOpt ?? "auto",
|
|
139
139
|
mode,
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { BloxBuildRequestOptions } from './build-request';
|
|
2
|
+
export interface DatastoreSnapshot {
|
|
3
|
+
version: 1;
|
|
4
|
+
generatedAt: string;
|
|
5
|
+
apiBase: string;
|
|
6
|
+
store: string;
|
|
7
|
+
collections: Record<string, Record<string, Array<Record<string, unknown>>>>;
|
|
8
|
+
}
|
|
9
|
+
export declare function fetchDatastoreSnapshot(options: {
|
|
10
|
+
apiBase: string;
|
|
11
|
+
store: string;
|
|
12
|
+
collections: readonly string[];
|
|
13
|
+
locales: readonly string[];
|
|
14
|
+
endpointPrefix?: string;
|
|
15
|
+
limit?: number;
|
|
16
|
+
requestOptions?: BloxBuildRequestOptions;
|
|
17
|
+
onCollection?: (collection: string, counts: Record<string, number>) => void;
|
|
18
|
+
}): Promise<DatastoreSnapshot>;
|
|
19
|
+
export declare function snapshotRows(snapshot: DatastoreSnapshot, collection: string, locale: string): Array<Record<string, unknown>>;
|
|
20
|
+
export declare function querySnapshotRows(snapshot: DatastoreSnapshot, options: {
|
|
21
|
+
collection: string;
|
|
22
|
+
locale: string;
|
|
23
|
+
q?: string;
|
|
24
|
+
select?: string[];
|
|
25
|
+
offset?: number;
|
|
26
|
+
limit?: number;
|
|
27
|
+
}): Array<Record<string, unknown>>;
|
|
28
|
+
//# sourceMappingURL=datastore-snapshot.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"datastore-snapshot.d.ts","sourceRoot":"","sources":["../../src/ssg/datastore-snapshot.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK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;CACd,GACC,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAiBhC"}
|
package/dist/ssg/index.cjs
CHANGED
|
@@ -22,7 +22,7 @@ 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-2iH8f9ql.cjs");
|
|
26
26
|
const ssg_client = require("./client.cjs");
|
|
27
27
|
const pinia = require("pinia");
|
|
28
28
|
const vue = require("vue");
|
|
@@ -255,6 +255,76 @@ function createBloxSSREntry(options) {
|
|
|
255
255
|
}
|
|
256
256
|
return { render, prefetchResolve };
|
|
257
257
|
}
|
|
258
|
+
async function fetchDatastoreSnapshot(options) {
|
|
259
|
+
var _a;
|
|
260
|
+
const endpointPrefix = options.endpointPrefix ?? "/datastore";
|
|
261
|
+
const limit = options.limit ?? 2e3;
|
|
262
|
+
const collections = {};
|
|
263
|
+
for (const collection of options.collections) {
|
|
264
|
+
collections[collection] = {};
|
|
265
|
+
const localized = await Promise.all(options.locales.map(async (locale) => {
|
|
266
|
+
const rows = [];
|
|
267
|
+
for (let offset = 0; ; offset += limit) {
|
|
268
|
+
const url = new URL(
|
|
269
|
+
`${endpointPrefix}/${encodeURIComponent(options.store)}/collections/${encodeURIComponent(collection)}`,
|
|
270
|
+
options.apiBase
|
|
271
|
+
);
|
|
272
|
+
url.searchParams.set("locale", locale);
|
|
273
|
+
url.searchParams.set("limit", String(limit));
|
|
274
|
+
url.searchParams.set("offset", String(offset));
|
|
275
|
+
const page = await llmArtifacts.bloxBuildJson(
|
|
276
|
+
url,
|
|
277
|
+
{},
|
|
278
|
+
options.requestOptions
|
|
279
|
+
);
|
|
280
|
+
if (!Array.isArray(page)) {
|
|
281
|
+
throw new TypeError(`Datastore snapshot response is not an array: ${collection}/${locale}`);
|
|
282
|
+
}
|
|
283
|
+
rows.push(...page);
|
|
284
|
+
if (page.length < limit) break;
|
|
285
|
+
}
|
|
286
|
+
return [locale, rows];
|
|
287
|
+
}));
|
|
288
|
+
for (const [locale, rows] of localized) collections[collection][locale] = rows;
|
|
289
|
+
(_a = options.onCollection) == null ? void 0 : _a.call(
|
|
290
|
+
options,
|
|
291
|
+
collection,
|
|
292
|
+
Object.fromEntries(localized.map(([locale, rows]) => [locale, rows.length]))
|
|
293
|
+
);
|
|
294
|
+
}
|
|
295
|
+
return {
|
|
296
|
+
version: 1,
|
|
297
|
+
generatedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
298
|
+
apiBase: options.apiBase,
|
|
299
|
+
store: options.store,
|
|
300
|
+
collections
|
|
301
|
+
};
|
|
302
|
+
}
|
|
303
|
+
function snapshotRows(snapshot, collection, locale) {
|
|
304
|
+
var _a;
|
|
305
|
+
const rows = (_a = snapshot.collections[collection]) == null ? void 0 : _a[locale];
|
|
306
|
+
if (!rows) throw new Error(`Datastore snapshot miss: ${collection}/${locale}`);
|
|
307
|
+
return rows;
|
|
308
|
+
}
|
|
309
|
+
function querySnapshotRows(snapshot, options) {
|
|
310
|
+
var _a;
|
|
311
|
+
let rows = snapshotRows(snapshot, options.collection, options.locale);
|
|
312
|
+
if (options.q) {
|
|
313
|
+
const match = options.q.match(/^\s*([A-Za-z0-9_.-]+)\s+eq\s+"((?:\\.|[^"])*)"\s*$/);
|
|
314
|
+
if (!match) throw new Error(`Unsupported snapshot SCIM query: ${options.q}`);
|
|
315
|
+
const [, field, raw] = match;
|
|
316
|
+
const expected = raw.replace(/\\"/g, '"').replace(/\\\\/g, "\\");
|
|
317
|
+
rows = rows.filter((row) => String(row[field]) === expected);
|
|
318
|
+
}
|
|
319
|
+
const offset = options.offset ?? 0;
|
|
320
|
+
rows = rows.slice(offset, offset + (options.limit ?? 100));
|
|
321
|
+
if ((_a = options.select) == null ? void 0 : _a.length) {
|
|
322
|
+
return rows.map((row) => Object.fromEntries(
|
|
323
|
+
options.select.filter((key) => key in row).map((key) => [key, row[key]])
|
|
324
|
+
));
|
|
325
|
+
}
|
|
326
|
+
return rows;
|
|
327
|
+
}
|
|
258
328
|
exports.BloxBuildResponseError = llmArtifacts.BloxBuildResponseError;
|
|
259
329
|
exports.bloxBuildJson = llmArtifacts.bloxBuildJson;
|
|
260
330
|
exports.bloxBuildRequest = llmArtifacts.bloxBuildRequest;
|
|
@@ -268,6 +338,7 @@ exports.generateLlmsFullTxt = llmArtifacts.generateLlmsFullTxt;
|
|
|
268
338
|
exports.generateLlmsTxt = llmArtifacts.generateLlmsTxt;
|
|
269
339
|
exports.generateNetlifyRedirects = llmArtifacts.generateNetlifyRedirects;
|
|
270
340
|
exports.generateRobotsTxt = llmArtifacts.generateRobotsTxt;
|
|
341
|
+
exports.generateSitemapArtifacts = llmArtifacts.generateSitemapArtifacts;
|
|
271
342
|
exports.generateSitemapIndexXml = llmArtifacts.generateSitemapIndexXml;
|
|
272
343
|
exports.generateSitemapXml = llmArtifacts.generateSitemapXml;
|
|
273
344
|
exports.getBloxBuildRequestOptions = llmArtifacts.getBloxBuildRequestOptions;
|
|
@@ -290,4 +361,7 @@ exports.getEmbeddedWebsiteId = ssg_client.getEmbeddedWebsiteId;
|
|
|
290
361
|
exports.installBloxStateCache = ssg_client.installBloxStateCache;
|
|
291
362
|
exports.installCollectionCache = ssg_client.installCollectionCache;
|
|
292
363
|
exports.createBloxSSREntry = createBloxSSREntry;
|
|
364
|
+
exports.fetchDatastoreSnapshot = fetchDatastoreSnapshot;
|
|
365
|
+
exports.querySnapshotRows = querySnapshotRows;
|
|
293
366
|
exports.renderBloxSsgPage = renderBloxSsgPage;
|
|
367
|
+
exports.snapshotRows = snapshotRows;
|
package/dist/ssg/index.d.ts
CHANGED
|
@@ -17,13 +17,15 @@ export { getCollectionCache, getEmbeddedWebsiteId, installCollectionCache } from
|
|
|
17
17
|
export { BLOX_COLLECTIONS_WINDOW_KEY, BLOX_DATA_WINDOW_KEY, BLOX_PAGE_SEO_WINDOW_KEY, BLOX_STATE_WINDOW_KEY, BLOX_WEBSITE_ID_WINDOW_KEY } from './constants';
|
|
18
18
|
export { createBloxSSREntry } from './createSSREntry';
|
|
19
19
|
export type { BloxSSREntry, CreateBloxSSREntryOptions } from './createSSREntry';
|
|
20
|
+
export { fetchDatastoreSnapshot, querySnapshotRows, snapshotRows } from './datastore-snapshot';
|
|
21
|
+
export type { DatastoreSnapshot } from './datastore-snapshot';
|
|
20
22
|
export { polyfillBloxSsgGlobals } from './polyfill-node';
|
|
21
23
|
export { prerender } from './prerender';
|
|
22
24
|
export type { PrerenderOptions, PrerenderResult, RenderContext, RenderResult } from './prerender';
|
|
23
25
|
export { renderBloxSsgPage } from './render-resolved-page';
|
|
24
26
|
export type { BloxSsgRouterLike } from './render-resolved-page';
|
|
25
|
-
export { buildPageHead, buildSiteHead, generateNetlifyRedirects, generateRobotsTxt, generateSitemapIndexXml, generateSitemapXml, getSiteIconFlags, localeSitemapPath, splitSitemapPathsByLocale } from './seo';
|
|
26
|
-
export type { RedirectEntry, SeoPageData } from './seo';
|
|
27
|
+
export { buildPageHead, buildSiteHead, generateNetlifyRedirects, generateRobotsTxt, generateSitemapArtifacts, generateSitemapIndexXml, generateSitemapXml, getSiteIconFlags, localeSitemapPath, splitSitemapPathsByLocale } from './seo';
|
|
28
|
+
export type { RedirectEntry, SeoPageData, SitemapArtifact, SitemapRoute } from './seo';
|
|
27
29
|
export { buildJsonLd, extractPageText, generateLlmsFullTxt, generateLlmsTxt, mergeLlmParts } from './llm-artifacts';
|
|
28
30
|
export type { LlmArtifactsConfig, LlmPageEntry } from './llm-artifacts';
|
|
29
31
|
export { installBloxStateCache } from './state-cache';
|
package/dist/ssg/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/ssg/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EA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AE,eAAe,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AACnH,YAAY,EAAE,kBAAkB,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AACvE,OAAO,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAA;AACrD,OAAO,EAAE,yBAAyB,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAA;AACjF,YAAY,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAA;AAC3E,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAA;AACrD,YAAY,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAA"}
|
package/dist/ssg/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { j, k,
|
|
1
|
+
import { b as buildPageHead, c as primaryContextEntry, d as buildJsonLd, e as extractPageText, B as BloxBuildResponseError, h as bloxBuildJson } from "../validate-output-CfHo6w9k.js";
|
|
2
|
+
import { i, j, k, f, l, m, n, o, g, q, r, s, t, w, x, p, a, y, z, u, v } from "../validate-output-CfHo6w9k.js";
|
|
3
3
|
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";
|
|
@@ -233,6 +233,76 @@ function createBloxSSREntry(options) {
|
|
|
233
233
|
}
|
|
234
234
|
return { render, prefetchResolve };
|
|
235
235
|
}
|
|
236
|
+
async function fetchDatastoreSnapshot(options) {
|
|
237
|
+
var _a;
|
|
238
|
+
const endpointPrefix = options.endpointPrefix ?? "/datastore";
|
|
239
|
+
const limit = options.limit ?? 2e3;
|
|
240
|
+
const collections = {};
|
|
241
|
+
for (const collection of options.collections) {
|
|
242
|
+
collections[collection] = {};
|
|
243
|
+
const localized = await Promise.all(options.locales.map(async (locale) => {
|
|
244
|
+
const rows = [];
|
|
245
|
+
for (let offset = 0; ; offset += limit) {
|
|
246
|
+
const url = new URL(
|
|
247
|
+
`${endpointPrefix}/${encodeURIComponent(options.store)}/collections/${encodeURIComponent(collection)}`,
|
|
248
|
+
options.apiBase
|
|
249
|
+
);
|
|
250
|
+
url.searchParams.set("locale", locale);
|
|
251
|
+
url.searchParams.set("limit", String(limit));
|
|
252
|
+
url.searchParams.set("offset", String(offset));
|
|
253
|
+
const page = await bloxBuildJson(
|
|
254
|
+
url,
|
|
255
|
+
{},
|
|
256
|
+
options.requestOptions
|
|
257
|
+
);
|
|
258
|
+
if (!Array.isArray(page)) {
|
|
259
|
+
throw new TypeError(`Datastore snapshot response is not an array: ${collection}/${locale}`);
|
|
260
|
+
}
|
|
261
|
+
rows.push(...page);
|
|
262
|
+
if (page.length < limit) break;
|
|
263
|
+
}
|
|
264
|
+
return [locale, rows];
|
|
265
|
+
}));
|
|
266
|
+
for (const [locale, rows] of localized) collections[collection][locale] = rows;
|
|
267
|
+
(_a = options.onCollection) == null ? void 0 : _a.call(
|
|
268
|
+
options,
|
|
269
|
+
collection,
|
|
270
|
+
Object.fromEntries(localized.map(([locale, rows]) => [locale, rows.length]))
|
|
271
|
+
);
|
|
272
|
+
}
|
|
273
|
+
return {
|
|
274
|
+
version: 1,
|
|
275
|
+
generatedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
276
|
+
apiBase: options.apiBase,
|
|
277
|
+
store: options.store,
|
|
278
|
+
collections
|
|
279
|
+
};
|
|
280
|
+
}
|
|
281
|
+
function snapshotRows(snapshot, collection, locale) {
|
|
282
|
+
var _a;
|
|
283
|
+
const rows = (_a = snapshot.collections[collection]) == null ? void 0 : _a[locale];
|
|
284
|
+
if (!rows) throw new Error(`Datastore snapshot miss: ${collection}/${locale}`);
|
|
285
|
+
return rows;
|
|
286
|
+
}
|
|
287
|
+
function querySnapshotRows(snapshot, options) {
|
|
288
|
+
var _a;
|
|
289
|
+
let rows = snapshotRows(snapshot, options.collection, options.locale);
|
|
290
|
+
if (options.q) {
|
|
291
|
+
const match = options.q.match(/^\s*([A-Za-z0-9_.-]+)\s+eq\s+"((?:\\.|[^"])*)"\s*$/);
|
|
292
|
+
if (!match) throw new Error(`Unsupported snapshot SCIM query: ${options.q}`);
|
|
293
|
+
const [, field, raw] = match;
|
|
294
|
+
const expected = raw.replace(/\\"/g, '"').replace(/\\\\/g, "\\");
|
|
295
|
+
rows = rows.filter((row) => String(row[field]) === expected);
|
|
296
|
+
}
|
|
297
|
+
const offset = options.offset ?? 0;
|
|
298
|
+
rows = rows.slice(offset, offset + (options.limit ?? 100));
|
|
299
|
+
if ((_a = options.select) == null ? void 0 : _a.length) {
|
|
300
|
+
return rows.map((row) => Object.fromEntries(
|
|
301
|
+
options.select.filter((key) => key in row).map((key) => [key, row[key]])
|
|
302
|
+
));
|
|
303
|
+
}
|
|
304
|
+
return rows;
|
|
305
|
+
}
|
|
236
306
|
export {
|
|
237
307
|
BLOX_COLLECTIONS_WINDOW_KEY,
|
|
238
308
|
BLOX_DATA_WINDOW_KEY,
|
|
@@ -241,33 +311,37 @@ export {
|
|
|
241
311
|
BLOX_WEBSITE_ID_WINDOW_KEY,
|
|
242
312
|
BloxBuildResponseError,
|
|
243
313
|
bloxBuildJson,
|
|
244
|
-
|
|
314
|
+
i as bloxBuildRequest,
|
|
245
315
|
buildJsonLd,
|
|
246
316
|
buildPageHead,
|
|
247
|
-
|
|
317
|
+
j as buildSiteHead,
|
|
248
318
|
createBloxSSREntry,
|
|
249
319
|
extractPageText,
|
|
250
|
-
|
|
320
|
+
k as fetchCmsPrerenderPaths,
|
|
251
321
|
f as fetchCmsSiteData,
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
g as
|
|
258
|
-
|
|
322
|
+
fetchDatastoreSnapshot,
|
|
323
|
+
l as generateLlmsFullTxt,
|
|
324
|
+
m as generateLlmsTxt,
|
|
325
|
+
n as generateNetlifyRedirects,
|
|
326
|
+
o as generateRobotsTxt,
|
|
327
|
+
g as generateSitemapArtifacts,
|
|
328
|
+
q as generateSitemapIndexXml,
|
|
329
|
+
r as generateSitemapXml,
|
|
330
|
+
s as getBloxBuildRequestOptions,
|
|
259
331
|
getCollectionCache,
|
|
260
332
|
getEmbeddedWebsiteId,
|
|
261
|
-
|
|
333
|
+
t as getSiteIconFlags,
|
|
262
334
|
installBloxStateCache,
|
|
263
335
|
installCollectionCache,
|
|
264
|
-
|
|
336
|
+
w as localeSitemapPath,
|
|
265
337
|
x as mergeLlmParts,
|
|
266
338
|
p as polyfillBloxSsgGlobals,
|
|
267
339
|
a as prerender,
|
|
340
|
+
querySnapshotRows,
|
|
268
341
|
renderBloxSsgPage,
|
|
269
342
|
y as resolveManifestProvenance,
|
|
270
|
-
|
|
343
|
+
snapshotRows,
|
|
344
|
+
z as splitSitemapPathsByLocale,
|
|
271
345
|
u as uploadBloxManifest,
|
|
272
346
|
v as validateSsgOutput
|
|
273
347
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prerender.d.ts","sourceRoot":"","sources":["../../src/ssg/prerender.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAC/C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAA;AAC1C,OAAO,KAAK,EAAE,kBAAkB,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;
|
|
1
|
+
{"version":3,"file":"prerender.d.ts","sourceRoot":"","sources":["../../src/ssg/prerender.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAC/C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAA;AAC1C,OAAO,KAAK,EAAE,kBAAkB,EAAE,YAAY,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AChB,GAAQ,GACR,GAAE,gBAAqB,GAAG,OAAO,CAAC,eAAe,CAAC,CAmTlD;AA4FD,wBAAgB,kBAAkB,CACjC,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,MAAM,EACf,YAAY,EAAE,MAAM,EACpB,SAAS,SAAK,GACZ,MAAM,CA8CR"}
|
package/dist/ssg/seo.d.ts
CHANGED
|
@@ -77,6 +77,23 @@ export declare function splitSitemapPathsByLocale(options: {
|
|
|
77
77
|
supportedLocales: string[];
|
|
78
78
|
}): Map<string, string[]>;
|
|
79
79
|
export declare function localeSitemapPath(locale: string): string;
|
|
80
|
+
export interface SitemapRoute {
|
|
81
|
+
path: string;
|
|
82
|
+
noindex?: boolean;
|
|
83
|
+
lastmod?: string;
|
|
84
|
+
}
|
|
85
|
+
export interface SitemapArtifact {
|
|
86
|
+
path: string;
|
|
87
|
+
content: string;
|
|
88
|
+
}
|
|
89
|
+
export declare function generateSitemapArtifacts(options: {
|
|
90
|
+
routes: SitemapRoute[];
|
|
91
|
+
canonicalBase: string;
|
|
92
|
+
defaultLocale: string;
|
|
93
|
+
supportedLocales: string[];
|
|
94
|
+
splitByLocale?: boolean;
|
|
95
|
+
additionalSitemapPaths?: string[];
|
|
96
|
+
}): SitemapArtifact[];
|
|
80
97
|
export declare function generateRobotsTxt(options: {
|
|
81
98
|
robotsTxt?: string | null;
|
|
82
99
|
canonicalBase?: string;
|
package/dist/ssg/seo.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"seo.d.ts","sourceRoot":"","sources":["../../src/ssg/seo.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAOzE,4DAA4D;AAC5D,MAAM,WAAW,WAAW;IAC3B,IAAI,EAAE,QAAQ,CAAA;IACd,UAAU,CAAC,EAAE,MAAM,CAAC,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E,CAAA;IACzB;;;;;OAKG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;CAClB;AA4ED;;GAEG;AACH,wBAAsB,UAAU,CAAC,IAAI,EAAE,kBAAkB,GAAG,OAAO,CAAC,MAAM,CAAC,
|
|
1
|
+
{"version":3,"file":"shard-runner.d.ts","sourceRoot":"","sources":["../../src/ssg/shard-runner.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAWH,MAAM,WAAW,kBAAkB;IAClC,qDAAqD;IACrD,MAAM,EAAE,MAAM,GAAG,MAAM,CAAA;IACvB,0DAA0D;IAC1D,IAAI,EAAE,MAAM,CAAA;IACZ,uDAAuD;IACvD,OAAO,EAAE,MAAM,CAAA;IACf,sDAAsD;IACtD,WAAW,EAAE,MAAM,CAAA;IACnB,iFAAiF;IACjF,UAAU,EAAE,MAAM,EAAE,CAAA;IACpB,8FAA8F;IAC9F,eAAe,EAAE,MAAM,EAAE,CAAA;IACzB;;;;;OAKG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;CAClB;AA4ED;;GAEG;AACH,wBAAsB,UAAU,CAAC,IAAI,EAAE,kBAAkB,GAAG,OAAO,CAAC,MAAM,CAAC,CAgI1E"}
|
|
@@ -500,6 +500,45 @@ function localeSitemapPath(locale) {
|
|
|
500
500
|
}
|
|
501
501
|
return `/sitemap-${locale}.xml`;
|
|
502
502
|
}
|
|
503
|
+
function generateSitemapArtifacts(options) {
|
|
504
|
+
const indexableRoutes = options.routes.filter((route) => !route.noindex);
|
|
505
|
+
const renderedPaths = indexableRoutes.map((route) => route.path);
|
|
506
|
+
const lastmod = Object.fromEntries(
|
|
507
|
+
indexableRoutes.flatMap((route) => route.lastmod ? [[route.path, route.lastmod]] : [])
|
|
508
|
+
);
|
|
509
|
+
if (options.splitByLocale === false) {
|
|
510
|
+
return [{
|
|
511
|
+
path: "/sitemap.xml",
|
|
512
|
+
content: generateSitemapXml({ renderedPaths, canonicalBase: options.canonicalBase, lastmod })
|
|
513
|
+
}];
|
|
514
|
+
}
|
|
515
|
+
const pathsByLocale = splitSitemapPathsByLocale({
|
|
516
|
+
renderedPaths,
|
|
517
|
+
defaultLocale: options.defaultLocale,
|
|
518
|
+
supportedLocales: options.supportedLocales
|
|
519
|
+
});
|
|
520
|
+
const localeArtifacts = [...pathsByLocale].map(([locale, paths]) => ({
|
|
521
|
+
path: localeSitemapPath(locale),
|
|
522
|
+
content: generateSitemapXml({
|
|
523
|
+
renderedPaths: paths,
|
|
524
|
+
canonicalBase: options.canonicalBase,
|
|
525
|
+
lastmod
|
|
526
|
+
})
|
|
527
|
+
}));
|
|
528
|
+
return [
|
|
529
|
+
{
|
|
530
|
+
path: "/sitemap.xml",
|
|
531
|
+
content: generateSitemapIndexXml({
|
|
532
|
+
canonicalBase: options.canonicalBase,
|
|
533
|
+
sitemapPaths: [
|
|
534
|
+
...localeArtifacts.map((artifact) => artifact.path),
|
|
535
|
+
...options.additionalSitemapPaths ?? []
|
|
536
|
+
]
|
|
537
|
+
})
|
|
538
|
+
},
|
|
539
|
+
...localeArtifacts
|
|
540
|
+
];
|
|
541
|
+
}
|
|
503
542
|
function generateRobotsTxt(options) {
|
|
504
543
|
const { robotsTxt, canonicalBase, noindex } = options;
|
|
505
544
|
if (noindex) {
|
|
@@ -978,38 +1017,25 @@ async function prerender({
|
|
|
978
1017
|
if (writeSharedAssets) {
|
|
979
1018
|
const sitemapPaths = rendered.filter((p) => !noindexPaths.has(p));
|
|
980
1019
|
if (canonicalBase && sitemapPaths.length > 0) {
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
generateSitemapXml({ renderedPaths: localePaths, canonicalBase, lastmod }),
|
|
993
|
-
"utf8"
|
|
994
|
-
);
|
|
995
|
-
sitemapFiles.push(sitemapPath);
|
|
996
|
-
}
|
|
997
|
-
await fs.writeFile(
|
|
998
|
-
path.join(absClient, "sitemap.xml"),
|
|
999
|
-
generateSitemapIndexXml({ canonicalBase, sitemapPaths: sitemapFiles }),
|
|
1000
|
-
"utf8"
|
|
1001
|
-
);
|
|
1002
|
-
console.log(` Generated sitemap.xml (${sitemapFiles.length} locales, ${sitemapPaths.length} URLs)`);
|
|
1003
|
-
} else {
|
|
1020
|
+
const artifacts = generateSitemapArtifacts({
|
|
1021
|
+
routes: sitemapPaths.map((routePath) => ({
|
|
1022
|
+
path: routePath,
|
|
1023
|
+
lastmod: lastmod[routePath]
|
|
1024
|
+
})),
|
|
1025
|
+
canonicalBase,
|
|
1026
|
+
defaultLocale: (website == null ? void 0 : website.default_locale) ?? "en",
|
|
1027
|
+
supportedLocales: (website == null ? void 0 : website.supported_locales) ?? [(website == null ? void 0 : website.default_locale) ?? "en"],
|
|
1028
|
+
splitByLocale: (_b = website == null ? void 0 : website.seo) == null ? void 0 : _b.sitemap_split_by_locale
|
|
1029
|
+
});
|
|
1030
|
+
for (const artifact of artifacts) {
|
|
1004
1031
|
await fs.writeFile(
|
|
1005
|
-
path.join(absClient,
|
|
1006
|
-
|
|
1032
|
+
path.join(absClient, artifact.path.slice(1)),
|
|
1033
|
+
artifact.content,
|
|
1007
1034
|
"utf8"
|
|
1008
1035
|
);
|
|
1009
|
-
console.log(` Generated sitemap.xml (${sitemapPaths.length} URLs)`);
|
|
1010
1036
|
}
|
|
1011
1037
|
const skipped = noindexPaths.size > 0 ? ` (${noindexPaths.size} noindex excluded)` : "";
|
|
1012
|
-
|
|
1038
|
+
console.log(` Generated sitemap.xml (${artifacts.length} files, ${sitemapPaths.length} URLs)${skipped}`);
|
|
1013
1039
|
}
|
|
1014
1040
|
const robotsTxt = generateRobotsTxt({
|
|
1015
1041
|
robotsTxt: website == null ? void 0 : website.robots_txt,
|
|
@@ -1296,6 +1322,7 @@ exports.generateLlmsFullTxt = generateLlmsFullTxt;
|
|
|
1296
1322
|
exports.generateLlmsTxt = generateLlmsTxt;
|
|
1297
1323
|
exports.generateNetlifyRedirects = generateNetlifyRedirects;
|
|
1298
1324
|
exports.generateRobotsTxt = generateRobotsTxt;
|
|
1325
|
+
exports.generateSitemapArtifacts = generateSitemapArtifacts;
|
|
1299
1326
|
exports.generateSitemapIndexXml = generateSitemapIndexXml;
|
|
1300
1327
|
exports.generateSitemapXml = generateSitemapXml;
|
|
1301
1328
|
exports.getBloxBuildRequestOptions = getBloxBuildRequestOptions;
|
|
@@ -477,6 +477,45 @@ function localeSitemapPath(locale) {
|
|
|
477
477
|
}
|
|
478
478
|
return `/sitemap-${locale}.xml`;
|
|
479
479
|
}
|
|
480
|
+
function generateSitemapArtifacts(options) {
|
|
481
|
+
const indexableRoutes = options.routes.filter((route) => !route.noindex);
|
|
482
|
+
const renderedPaths = indexableRoutes.map((route) => route.path);
|
|
483
|
+
const lastmod = Object.fromEntries(
|
|
484
|
+
indexableRoutes.flatMap((route) => route.lastmod ? [[route.path, route.lastmod]] : [])
|
|
485
|
+
);
|
|
486
|
+
if (options.splitByLocale === false) {
|
|
487
|
+
return [{
|
|
488
|
+
path: "/sitemap.xml",
|
|
489
|
+
content: generateSitemapXml({ renderedPaths, canonicalBase: options.canonicalBase, lastmod })
|
|
490
|
+
}];
|
|
491
|
+
}
|
|
492
|
+
const pathsByLocale = splitSitemapPathsByLocale({
|
|
493
|
+
renderedPaths,
|
|
494
|
+
defaultLocale: options.defaultLocale,
|
|
495
|
+
supportedLocales: options.supportedLocales
|
|
496
|
+
});
|
|
497
|
+
const localeArtifacts = [...pathsByLocale].map(([locale, paths]) => ({
|
|
498
|
+
path: localeSitemapPath(locale),
|
|
499
|
+
content: generateSitemapXml({
|
|
500
|
+
renderedPaths: paths,
|
|
501
|
+
canonicalBase: options.canonicalBase,
|
|
502
|
+
lastmod
|
|
503
|
+
})
|
|
504
|
+
}));
|
|
505
|
+
return [
|
|
506
|
+
{
|
|
507
|
+
path: "/sitemap.xml",
|
|
508
|
+
content: generateSitemapIndexXml({
|
|
509
|
+
canonicalBase: options.canonicalBase,
|
|
510
|
+
sitemapPaths: [
|
|
511
|
+
...localeArtifacts.map((artifact) => artifact.path),
|
|
512
|
+
...options.additionalSitemapPaths ?? []
|
|
513
|
+
]
|
|
514
|
+
})
|
|
515
|
+
},
|
|
516
|
+
...localeArtifacts
|
|
517
|
+
];
|
|
518
|
+
}
|
|
480
519
|
function generateRobotsTxt(options) {
|
|
481
520
|
const { robotsTxt, canonicalBase, noindex } = options;
|
|
482
521
|
if (noindex) {
|
|
@@ -955,38 +994,25 @@ async function prerender({
|
|
|
955
994
|
if (writeSharedAssets) {
|
|
956
995
|
const sitemapPaths = rendered.filter((p) => !noindexPaths.has(p));
|
|
957
996
|
if (canonicalBase && sitemapPaths.length > 0) {
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
generateSitemapXml({ renderedPaths: localePaths, canonicalBase, lastmod }),
|
|
970
|
-
"utf8"
|
|
971
|
-
);
|
|
972
|
-
sitemapFiles.push(sitemapPath);
|
|
973
|
-
}
|
|
974
|
-
await fs.writeFile(
|
|
975
|
-
path.join(absClient, "sitemap.xml"),
|
|
976
|
-
generateSitemapIndexXml({ canonicalBase, sitemapPaths: sitemapFiles }),
|
|
977
|
-
"utf8"
|
|
978
|
-
);
|
|
979
|
-
console.log(` Generated sitemap.xml (${sitemapFiles.length} locales, ${sitemapPaths.length} URLs)`);
|
|
980
|
-
} else {
|
|
997
|
+
const artifacts = generateSitemapArtifacts({
|
|
998
|
+
routes: sitemapPaths.map((routePath) => ({
|
|
999
|
+
path: routePath,
|
|
1000
|
+
lastmod: lastmod[routePath]
|
|
1001
|
+
})),
|
|
1002
|
+
canonicalBase,
|
|
1003
|
+
defaultLocale: (website == null ? void 0 : website.default_locale) ?? "en",
|
|
1004
|
+
supportedLocales: (website == null ? void 0 : website.supported_locales) ?? [(website == null ? void 0 : website.default_locale) ?? "en"],
|
|
1005
|
+
splitByLocale: (_b = website == null ? void 0 : website.seo) == null ? void 0 : _b.sitemap_split_by_locale
|
|
1006
|
+
});
|
|
1007
|
+
for (const artifact of artifacts) {
|
|
981
1008
|
await fs.writeFile(
|
|
982
|
-
path.join(absClient,
|
|
983
|
-
|
|
1009
|
+
path.join(absClient, artifact.path.slice(1)),
|
|
1010
|
+
artifact.content,
|
|
984
1011
|
"utf8"
|
|
985
1012
|
);
|
|
986
|
-
console.log(` Generated sitemap.xml (${sitemapPaths.length} URLs)`);
|
|
987
1013
|
}
|
|
988
1014
|
const skipped = noindexPaths.size > 0 ? ` (${noindexPaths.size} noindex excluded)` : "";
|
|
989
|
-
|
|
1015
|
+
console.log(` Generated sitemap.xml (${artifacts.length} files, ${sitemapPaths.length} URLs)${skipped}`);
|
|
990
1016
|
}
|
|
991
1017
|
const robotsTxt = generateRobotsTxt({
|
|
992
1018
|
robotsTxt: website == null ? void 0 : website.robots_txt,
|
|
@@ -1261,31 +1287,32 @@ async function validateSitemap(outDir, content) {
|
|
|
1261
1287
|
return failures;
|
|
1262
1288
|
}
|
|
1263
1289
|
export {
|
|
1290
|
+
llmArtifacts as A,
|
|
1264
1291
|
BloxBuildResponseError as B,
|
|
1265
1292
|
prerender as a,
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1293
|
+
buildPageHead as b,
|
|
1294
|
+
primaryContextEntry as c,
|
|
1295
|
+
buildJsonLd as d,
|
|
1296
|
+
extractPageText as e,
|
|
1270
1297
|
fetchCmsSiteData as f,
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1298
|
+
generateSitemapArtifacts as g,
|
|
1299
|
+
bloxBuildJson as h,
|
|
1300
|
+
bloxBuildRequest as i,
|
|
1301
|
+
buildSiteHead as j,
|
|
1302
|
+
fetchCmsPrerenderPaths as k,
|
|
1303
|
+
generateLlmsFullTxt as l,
|
|
1304
|
+
generateLlmsTxt as m,
|
|
1305
|
+
generateNetlifyRedirects as n,
|
|
1306
|
+
generateRobotsTxt as o,
|
|
1280
1307
|
polyfillBloxSsgGlobals as p,
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1308
|
+
generateSitemapIndexXml as q,
|
|
1309
|
+
generateSitemapXml as r,
|
|
1310
|
+
getBloxBuildRequestOptions as s,
|
|
1311
|
+
getSiteIconFlags as t,
|
|
1285
1312
|
uploadBloxManifest as u,
|
|
1286
1313
|
validateSsgOutput as v,
|
|
1287
|
-
|
|
1314
|
+
localeSitemapPath as w,
|
|
1288
1315
|
mergeLlmParts as x,
|
|
1289
1316
|
resolveManifestProvenance as y,
|
|
1290
|
-
|
|
1317
|
+
splitSitemapPathsByLocale as z
|
|
1291
1318
|
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bagelink/blox",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.15.
|
|
4
|
+
"version": "1.15.535",
|
|
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",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"static-pages"
|
|
29
29
|
],
|
|
30
30
|
"bin": {
|
|
31
|
-
"blox-ssg": "
|
|
31
|
+
"blox-ssg": "dist/ssg/cli.mjs"
|
|
32
32
|
},
|
|
33
33
|
"sideEffects": [
|
|
34
34
|
"**/*.css",
|