@bagelink/blox 1.15.373 → 1.15.377

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.
@@ -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,24 @@ 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 pathSet = new Set(paths);
100
+ const defaultPages = ((_a = localizedPages.find((result) => result.locale === defaultLocale)) == null ? void 0 : _a.pages) ?? [];
101
+ const canonicalSlugById = new Map(
102
+ defaultPages.flatMap((page) => page.id && page.slug && !page.slug.includes(":") ? [[page.id, page.slug]] : [])
103
+ );
104
+ const localeAliases = localizedPages.flatMap(({ locale, pages }) => {
105
+ if (locale === defaultLocale) return [];
106
+ return pages.flatMap((page) => {
107
+ const canonicalSlug = page.id ? canonicalSlugById.get(page.id) : void 0;
108
+ const fromPath = canonicalSlug ? localizePath(canonicalSlug, locale, defaultLocale) : "";
109
+ if (page.status && page.status !== "published" || !canonicalSlug || !page.slug || page.slug.includes(":") || page.slug === canonicalSlug || pathSet.has(fromPath)) return [];
110
+ return [{
111
+ from_path: fromPath,
112
+ to_path: localizePath(page.slug, locale, defaultLocale),
113
+ status_code: 302
114
+ }];
115
+ });
116
+ });
98
117
  const rData = await bloxBuildJson(
99
118
  `${apiBase}/blox/websites/${site.id}/redirects`,
100
119
  {},
@@ -102,6 +121,8 @@ async function fetchCmsSiteData(apiBase, websiteName, requestOptions = {}) {
102
121
  );
103
122
  const redirectItems = Array.isArray(rData) ? rData : rData.data ?? [];
104
123
  const redirects = redirectItems.filter((r) => r.from_path && r.to_path);
124
+ const explicitSources = new Set(redirects.map((redirect) => redirect.from_path.trim()));
125
+ redirects.push(...localeAliases.filter((alias) => !explicitSources.has(alias.from_path)));
105
126
  const collections = extractCollectionRefs(localizedPages.flatMap((result) => result.pages));
106
127
  return { websiteId: site.id, website, paths, redirects, collections };
107
128
  }
@@ -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,24 @@ 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 pathSet = new Set(paths);
77
+ const defaultPages = ((_a = localizedPages.find((result) => result.locale === defaultLocale)) == null ? void 0 : _a.pages) ?? [];
78
+ const canonicalSlugById = new Map(
79
+ defaultPages.flatMap((page) => page.id && page.slug && !page.slug.includes(":") ? [[page.id, page.slug]] : [])
80
+ );
81
+ const localeAliases = localizedPages.flatMap(({ locale, pages }) => {
82
+ if (locale === defaultLocale) return [];
83
+ return pages.flatMap((page) => {
84
+ const canonicalSlug = page.id ? canonicalSlugById.get(page.id) : void 0;
85
+ const fromPath = canonicalSlug ? localizePath(canonicalSlug, locale, defaultLocale) : "";
86
+ if (page.status && page.status !== "published" || !canonicalSlug || !page.slug || page.slug.includes(":") || page.slug === canonicalSlug || pathSet.has(fromPath)) return [];
87
+ return [{
88
+ from_path: fromPath,
89
+ to_path: localizePath(page.slug, locale, defaultLocale),
90
+ status_code: 302
91
+ }];
92
+ });
93
+ });
75
94
  const rData = await bloxBuildJson(
76
95
  `${apiBase}/blox/websites/${site.id}/redirects`,
77
96
  {},
@@ -79,6 +98,8 @@ async function fetchCmsSiteData(apiBase, websiteName, requestOptions = {}) {
79
98
  );
80
99
  const redirectItems = Array.isArray(rData) ? rData : rData.data ?? [];
81
100
  const redirects = redirectItems.filter((r) => r.from_path && r.to_path);
101
+ const explicitSources = new Set(redirects.map((redirect) => redirect.from_path.trim()));
102
+ redirects.push(...localeAliases.filter((alias) => !explicitSources.has(alias.from_path)));
82
103
  const collections = extractCollectionRefs(localizedPages.flatMap((result) => result.pages));
83
104
  return { websiteId: site.id, website, paths, redirects, collections };
84
105
  }
@@ -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-DfIkpbr8.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-DfIkpbr8.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({
@@ -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-CI54eV74.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-CI54eV74.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({
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-CI54eV74.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-DB37MOsu.cjs"));
117
117
  const code = await runSharded({
118
118
  shards: shardsOpt ?? "auto",
119
119
  mode,
@@ -129,7 +129,7 @@ Environment:
129
129
  const { apiBase, websiteName: configWebsiteName } = await resolveApiBase(mode);
130
130
  await llmArtifacts.polyfillBloxSsgGlobals({ pageUrl: apiBase });
131
131
  const websiteName = process.env.WEBSITE_NAME ?? configWebsiteName ?? "default";
132
- console.log(`Fetching routes from ${apiBase} (mode: ${mode}, site: ${websiteName})…`);
132
+ console.log(siteDataFile ? `Loading cached site routes (mode: ${mode}, site: ${websiteName})…` : `Fetching routes from ${apiBase} (mode: ${mode}, site: ${websiteName})…`);
133
133
  let paths = [];
134
134
  let website = null;
135
135
  let websiteId = "";
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-DfIkpbr8.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-D4TGQ2FM.js");
116
116
  const code = await runSharded({
117
117
  shards: shardsOpt ?? "auto",
118
118
  mode,
@@ -128,7 +128,7 @@ Environment:
128
128
  const { apiBase, websiteName: configWebsiteName } = await resolveApiBase(mode);
129
129
  await polyfillBloxSsgGlobals({ pageUrl: apiBase });
130
130
  const websiteName = process.env.WEBSITE_NAME ?? configWebsiteName ?? "default";
131
- console.log(`Fetching routes from ${apiBase} (mode: ${mode}, site: ${websiteName})…`);
131
+ console.log(siteDataFile ? `Loading cached site routes (mode: ${mode}, site: ${websiteName})…` : `Fetching routes from ${apiBase} (mode: ${mode}, site: ${websiteName})…`);
132
132
  let paths = [];
133
133
  let website = null;
134
134
  let websiteId = "";
@@ -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,EAAE,MAAM,EACnB,cAAc,GAAE,uBAA4B,GAC1C,OAAO,CAAC,WAAW,CAAC,CA+CtB;AAED;;GAEG;AACH,wBAAsB,sBAAsB,CAC3C,OAAO,EAAE,MAAM,EACf,WAAW,EAAE,MAAM,EACnB,cAAc,GAAE,uBAA4B,GAC1C,OAAO,CAAC,MAAM,EAAE,CAAC,CAGnB"}
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;AAc9D,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,EAAE,MAAM,EACnB,cAAc,GAAE,uBAA4B,GAC1C,OAAO,CAAC,WAAW,CAAC,CAgFtB;AAED;;GAEG;AACH,wBAAsB,sBAAsB,CAC3C,OAAO,EAAE,MAAM,EACf,WAAW,EAAE,MAAM,EACnB,cAAc,GAAE,uBAA4B,GAC1C,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-CI54eV74.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-DfIkpbr8.js";
2
+ import { h, i, j, f, k, l, m, n, o, q, r, s, p, a } from "../prerender-DfIkpbr8.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.377",
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",