@bagelink/blox 1.15.373 → 1.15.375

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.
@@ -50,6 +50,7 @@ function localizePath(slug, locale, defaultLocale) {
50
50
  return `/${locale}${s}`;
51
51
  }
52
52
  async function fetchCmsSiteData(apiBase, websiteName, requestOptions = {}) {
53
+ var _a;
53
54
  const sitesData = await bloxBuildJson(`${apiBase}/blox/websites`, {}, requestOptions);
54
55
  const sites = Array.isArray(sitesData) ? sitesData : sitesData.data ?? [];
55
56
  const site = sites.find((s) => s.name === websiteName);
@@ -72,6 +73,22 @@ async function fetchCmsSiteData(apiBase, websiteName, requestOptions = {}) {
72
73
  return { locale, pages, paths: localePaths.map((path2) => localizePath(path2, locale, defaultLocale)) };
73
74
  }));
74
75
  const paths = [...new Set(localizedPages.flatMap((result) => result.paths))];
76
+ const defaultPages = ((_a = localizedPages.find((result) => result.locale === defaultLocale)) == null ? void 0 : _a.pages) ?? [];
77
+ const canonicalSlugById = new Map(
78
+ defaultPages.flatMap((page) => page.id && page.slug && !page.slug.includes(":") ? [[page.id, page.slug]] : [])
79
+ );
80
+ const localeAliases = localizedPages.flatMap(({ locale, pages }) => {
81
+ if (locale === defaultLocale) return [];
82
+ return pages.flatMap((page) => {
83
+ const canonicalSlug = page.id ? canonicalSlugById.get(page.id) : void 0;
84
+ if (!canonicalSlug || !page.slug || page.slug.includes(":") || page.slug === canonicalSlug) return [];
85
+ return [{
86
+ from_path: localizePath(canonicalSlug, locale, defaultLocale),
87
+ to_path: localizePath(page.slug, locale, defaultLocale),
88
+ status_code: 302
89
+ }];
90
+ });
91
+ });
75
92
  const rData = await bloxBuildJson(
76
93
  `${apiBase}/blox/websites/${site.id}/redirects`,
77
94
  {},
@@ -79,6 +96,8 @@ async function fetchCmsSiteData(apiBase, websiteName, requestOptions = {}) {
79
96
  );
80
97
  const redirectItems = Array.isArray(rData) ? rData : rData.data ?? [];
81
98
  const redirects = redirectItems.filter((r) => r.from_path && r.to_path);
99
+ const explicitSources = new Set(redirects.map((redirect) => redirect.from_path));
100
+ redirects.push(...localeAliases.filter((alias) => !explicitSources.has(alias.from_path)));
82
101
  const collections = extractCollectionRefs(localizedPages.flatMap((result) => result.pages));
83
102
  return { websiteId: site.id, website, paths, redirects, collections };
84
103
  }
@@ -73,6 +73,7 @@ function localizePath(slug, locale, defaultLocale) {
73
73
  return `/${locale}${s}`;
74
74
  }
75
75
  async function fetchCmsSiteData(apiBase, websiteName, requestOptions = {}) {
76
+ var _a;
76
77
  const sitesData = await bloxBuildJson(`${apiBase}/blox/websites`, {}, requestOptions);
77
78
  const sites = Array.isArray(sitesData) ? sitesData : sitesData.data ?? [];
78
79
  const site = sites.find((s) => s.name === websiteName);
@@ -95,6 +96,22 @@ async function fetchCmsSiteData(apiBase, websiteName, requestOptions = {}) {
95
96
  return { locale, pages, paths: localePaths.map((path2) => localizePath(path2, locale, defaultLocale)) };
96
97
  }));
97
98
  const paths = [...new Set(localizedPages.flatMap((result) => result.paths))];
99
+ const defaultPages = ((_a = localizedPages.find((result) => result.locale === defaultLocale)) == null ? void 0 : _a.pages) ?? [];
100
+ const canonicalSlugById = new Map(
101
+ defaultPages.flatMap((page) => page.id && page.slug && !page.slug.includes(":") ? [[page.id, page.slug]] : [])
102
+ );
103
+ const localeAliases = localizedPages.flatMap(({ locale, pages }) => {
104
+ if (locale === defaultLocale) return [];
105
+ return pages.flatMap((page) => {
106
+ const canonicalSlug = page.id ? canonicalSlugById.get(page.id) : void 0;
107
+ if (!canonicalSlug || !page.slug || page.slug.includes(":") || page.slug === canonicalSlug) return [];
108
+ return [{
109
+ from_path: localizePath(canonicalSlug, locale, defaultLocale),
110
+ to_path: localizePath(page.slug, locale, defaultLocale),
111
+ status_code: 302
112
+ }];
113
+ });
114
+ });
98
115
  const rData = await bloxBuildJson(
99
116
  `${apiBase}/blox/websites/${site.id}/redirects`,
100
117
  {},
@@ -102,6 +119,8 @@ async function fetchCmsSiteData(apiBase, websiteName, requestOptions = {}) {
102
119
  );
103
120
  const redirectItems = Array.isArray(rData) ? rData : rData.data ?? [];
104
121
  const redirects = redirectItems.filter((r) => r.from_path && r.to_path);
122
+ const explicitSources = new Set(redirects.map((redirect) => redirect.from_path));
123
+ redirects.push(...localeAliases.filter((alias) => !explicitSources.has(alias.from_path)));
105
124
  const collections = extractCollectionRefs(localizedPages.flatMap((result) => result.pages));
106
125
  return { websiteId: site.id, website, paths, redirects, collections };
107
126
  }
@@ -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("./prerender-QNS1N9cI.cjs");
29
+ const llmArtifacts = require("./prerender-CaqnL5Fj.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) {
@@ -107,7 +107,7 @@ async function runSharded(opts) {
107
107
  }
108
108
  if (process.env.BLOX_SSG_LLM !== "0") {
109
109
  try {
110
- const { mergeLlmParts } = await Promise.resolve().then(() => require("./prerender-QNS1N9cI.cjs")).then((n) => n.llmArtifacts);
110
+ const { mergeLlmParts } = await Promise.resolve().then(() => require("./prerender-CaqnL5Fj.cjs")).then((n) => n.llmArtifacts);
111
111
  const website = siteData.website;
112
112
  const partFiles = Array.from({ length: total }, (_, i) => path.join(llmPartsDir, `part.${i}.json`));
113
113
  const { pages } = await mergeLlmParts({
@@ -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 } from "./prerender-CoKgvqMb.js";
5
+ import { f as fetchCmsSiteData } from "./prerender-B-nE1VpK.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) {
@@ -83,7 +83,7 @@ async function runSharded(opts) {
83
83
  }
84
84
  if (process.env.BLOX_SSG_LLM !== "0") {
85
85
  try {
86
- const { mergeLlmParts } = await import("./prerender-CoKgvqMb.js").then((n) => n.t);
86
+ const { mergeLlmParts } = await import("./prerender-B-nE1VpK.js").then((n) => n.t);
87
87
  const website = siteData.website;
88
88
  const partFiles = Array.from({ length: total }, (_, i) => path.join(llmPartsDir, `part.${i}.json`));
89
89
  const { pages } = await mergeLlmParts({
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("../prerender-QNS1N9cI.cjs");
5
+ const llmArtifacts = require("../prerender-CaqnL5Fj.cjs");
6
6
  function installFetchTimeout() {
7
7
  const ms = Number(process.env.BLOX_SSG_FETCH_TIMEOUT_MS) || 2e4;
8
8
  const original = globalThis.fetch;
@@ -113,7 +113,7 @@ Environment:
113
113
  if (shardsOpt !== null || routesCmd) {
114
114
  const { apiBase: apiBase2, websiteName: configWebsiteName2 } = await resolveApiBase(mode);
115
115
  const websiteName2 = process.env.WEBSITE_NAME ?? configWebsiteName2 ?? "default";
116
- const { runSharded } = await Promise.resolve().then(() => require("../shard-runner-1OH9DGoU.cjs"));
116
+ const { runSharded } = await Promise.resolve().then(() => require("../shard-runner-C4LI5gGz.cjs"));
117
117
  const code = await runSharded({
118
118
  shards: shardsOpt ?? "auto",
119
119
  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 { p as polyfillBloxSsgGlobals, f as fetchCmsSiteData, a as prerender } from "../prerender-CoKgvqMb.js";
4
+ import { p as polyfillBloxSsgGlobals, f as fetchCmsSiteData, a as prerender } from "../prerender-B-nE1VpK.js";
5
5
  function installFetchTimeout() {
6
6
  const ms = Number(process.env.BLOX_SSG_FETCH_TIMEOUT_MS) || 2e4;
7
7
  const original = globalThis.fetch;
@@ -112,7 +112,7 @@ Environment:
112
112
  if (shardsOpt !== null || routesCmd) {
113
113
  const { apiBase: apiBase2, websiteName: configWebsiteName2 } = await resolveApiBase(mode);
114
114
  const websiteName2 = process.env.WEBSITE_NAME ?? configWebsiteName2 ?? "default";
115
- const { runSharded } = await import("../shard-runner-DePSo8nU.js");
115
+ const { runSharded } = await import("../shard-runner-CDu9ntxJ.js");
116
116
  const code = await runSharded({
117
117
  shards: shardsOpt ?? "auto",
118
118
  mode,
@@ -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;AAa9D,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,SAAS,EAAE,aAAa,EAAE,CAAA;IAC1B,oEAAoE;IACpE,WAAW,EAAE,aAAa,EAAE,CAAA;CAC5B;AAYD;;;GAGG;AACH,wBAAgB,iBAAiB,CAChC,KAAK,EAAE,MAAM,EAAE,EACf,aAAa,EAAE,MAAM,EACrB,gBAAgB,EAAE,MAAM,EAAE,GACxB,MAAM,EAAE,CASV;AAMD;;;GAGG;AACH,wBAAsB,gBAAgB,CACrC,OAAO,EAAE,MAAM,EACf,WAAW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OAAO,CAAC,MAAM,EAAE,CAAC,CAGnB"}
@@ -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("../prerender-QNS1N9cI.cjs");
25
+ const llmArtifacts = require("../prerender-CaqnL5Fj.cjs");
26
26
  const ssg_client = require("./client.cjs");
27
27
  const pinia = require("pinia");
28
28
  const vue = require("vue");
@@ -1,5 +1,5 @@
1
- import { b as buildPageHead, c as primaryContextEntry, d as buildJsonLd, e as extractPageText, B as BloxBuildResponseError, g as bloxBuildJson } from "../prerender-CoKgvqMb.js";
2
- import { h, i, j, f, k, l, m, n, o, q, r, s, p, a } from "../prerender-CoKgvqMb.js";
1
+ import { b as buildPageHead, c as primaryContextEntry, d as buildJsonLd, e as extractPageText, B as BloxBuildResponseError, g as bloxBuildJson } from "../prerender-B-nE1VpK.js";
2
+ import { h, i, j, f, k, l, m, n, o, q, r, s, p, a } from "../prerender-B-nE1VpK.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";
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@bagelink/blox",
3
3
  "type": "module",
4
- "version": "1.15.373",
4
+ "version": "1.15.375",
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",