@bagelink/blox 1.15.659 → 1.15.663
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/CmsPageView.vue.d.ts.map +1 -1
- package/dist/{PreviewApp-HmKWAJlr.js → PreviewApp-6imffI4L.js} +1 -1
- package/dist/{PreviewApp-6SFipygX.cjs → PreviewApp-_sBftiOk.cjs} +1 -1
- package/dist/{PreviewApp.vue_vue_type_style_index_0_lang-BunY96Db.cjs → PreviewApp.vue_vue_type_style_index_0_lang-BP6sRzCv.cjs} +1 -1
- package/dist/{PreviewApp.vue_vue_type_style_index_0_lang-DNNMZc3y.js → PreviewApp.vue_vue_type_style_index_0_lang-D3nz9VR7.js} +1 -1
- package/dist/{appRuntime-wuyiLmzO.cjs → appRuntime-KrtrOgvG.cjs} +10 -3
- package/dist/{appRuntime-GZNiXRKQ.js → appRuntime-wD8N8dxg.js} +10 -3
- package/dist/composables/useLocaleNav.d.ts +1 -0
- package/dist/composables/useLocaleNav.d.ts.map +1 -1
- package/dist/createBloxApp.d.ts.map +1 -1
- package/dist/index.cjs +26 -7
- package/dist/index.mjs +27 -8
- package/dist/notFoundDocument.d.ts +29 -0
- package/dist/notFoundDocument.d.ts.map +1 -0
- package/dist/ssg/createSSREntry.d.ts.map +1 -1
- package/dist/ssg/index.cjs +4 -5
- package/dist/ssg/index.mjs +4 -5
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CmsPageView.vue.d.ts","sourceRoot":"","sources":["../src/CmsPageView.vue"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"CmsPageView.vue.d.ts","sourceRoot":"","sources":["../src/CmsPageView.vue"],"names":[],"mappings":";AA2pBA,wBAMG"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const PreviewApp_vue_vue_type_style_index_0_lang = require("./PreviewApp.vue_vue_type_style_index_0_lang-
|
|
3
|
+
const PreviewApp_vue_vue_type_style_index_0_lang = require("./PreviewApp.vue_vue_type_style_index_0_lang-BP6sRzCv.cjs");
|
|
4
4
|
exports.default = PreviewApp_vue_vue_type_style_index_0_lang._sfc_main;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { defineComponent, inject, ref, h, provide, onMounted, onUnmounted, openBlock, createElementBlock, createVNode, unref, nextTick } from "vue";
|
|
2
|
-
import { d as BLOX_REGISTRY_KEY, r as resolveBlockProps, u as useLocale, e as BLOX_RUNTIME_KEY } from "./appRuntime-
|
|
2
|
+
import { d as BLOX_REGISTRY_KEY, r as resolveBlockProps, u as useLocale, e as BLOX_RUNTIME_KEY } from "./appRuntime-wD8N8dxg.js";
|
|
3
3
|
function sendToEditor(msg) {
|
|
4
4
|
window.parent.postMessage(cloneForPostMessage(msg), "*");
|
|
5
5
|
}
|
|
@@ -320,6 +320,13 @@ const _sfc_main$2 = /* @__PURE__ */ vue.defineComponent({
|
|
|
320
320
|
if (strategy) return strategy.toPath("/", localeCode);
|
|
321
321
|
return localeCode === "en" ? "/" : `/${localeCode}`;
|
|
322
322
|
}
|
|
323
|
+
function usableAlternates(alternates) {
|
|
324
|
+
const out = {};
|
|
325
|
+
for (const [localeKey, path] of Object.entries(alternates ?? {})) {
|
|
326
|
+
if (typeof path === "string" && path && !path.includes(":")) out[localeKey] = path;
|
|
327
|
+
}
|
|
328
|
+
return out;
|
|
329
|
+
}
|
|
323
330
|
function hasUnresolvedBinding(resolved) {
|
|
324
331
|
var _a2;
|
|
325
332
|
const bindings = (_a2 = resolved.page) == null ? void 0 : _a2.data_bindings;
|
|
@@ -349,7 +356,7 @@ const _sfc_main$2 = /* @__PURE__ */ vue.defineComponent({
|
|
|
349
356
|
blocks.value = ((_b = (_a2 = entry.page) == null ? void 0 : _a2.content) == null ? void 0 : _b.blocks) ?? [];
|
|
350
357
|
contexts.value = entry.contexts ?? {};
|
|
351
358
|
currentPageId.value = ((_c = entry.page) == null ? void 0 : _c.id) ?? null;
|
|
352
|
-
setAlternates(
|
|
359
|
+
setAlternates(usableAlternates(entry.alternates));
|
|
353
360
|
updateDocumentTitle(entry);
|
|
354
361
|
}
|
|
355
362
|
function updateDocumentTitle(resolved) {
|
|
@@ -397,7 +404,7 @@ const _sfc_main$2 = /* @__PURE__ */ vue.defineComponent({
|
|
|
397
404
|
blocks.value = ((_a2 = resolved.page.content) == null ? void 0 : _a2.blocks) ?? [];
|
|
398
405
|
contexts.value = resolved.contexts ?? {};
|
|
399
406
|
currentPageId.value = resolved.page.id ?? null;
|
|
400
|
-
setAlternates(resolved.alternates
|
|
407
|
+
setAlternates(usableAlternates(resolved.alternates));
|
|
401
408
|
updateDocumentTitle(resolved);
|
|
402
409
|
} catch (e) {
|
|
403
410
|
const msg = e instanceof Error ? e.message : String(e);
|
|
@@ -892,7 +899,7 @@ class BloxInstance {
|
|
|
892
899
|
router.addRoute({
|
|
893
900
|
path: "/_blox_preview",
|
|
894
901
|
name: BLOX_PREVIEW_ROUTE_NAME,
|
|
895
|
-
component: () => Promise.resolve().then(() => require("./PreviewApp-
|
|
902
|
+
component: () => Promise.resolve().then(() => require("./PreviewApp-_sBftiOk.cjs")),
|
|
896
903
|
beforeEnter: () => typeof window === "undefined" || window.parent !== window ? true : "/"
|
|
897
904
|
});
|
|
898
905
|
}
|
|
@@ -319,6 +319,13 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
319
319
|
if (strategy) return strategy.toPath("/", localeCode);
|
|
320
320
|
return localeCode === "en" ? "/" : `/${localeCode}`;
|
|
321
321
|
}
|
|
322
|
+
function usableAlternates(alternates) {
|
|
323
|
+
const out = {};
|
|
324
|
+
for (const [localeKey, path] of Object.entries(alternates ?? {})) {
|
|
325
|
+
if (typeof path === "string" && path && !path.includes(":")) out[localeKey] = path;
|
|
326
|
+
}
|
|
327
|
+
return out;
|
|
328
|
+
}
|
|
322
329
|
function hasUnresolvedBinding(resolved) {
|
|
323
330
|
var _a2;
|
|
324
331
|
const bindings = (_a2 = resolved.page) == null ? void 0 : _a2.data_bindings;
|
|
@@ -348,7 +355,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
348
355
|
blocks.value = ((_b = (_a2 = entry.page) == null ? void 0 : _a2.content) == null ? void 0 : _b.blocks) ?? [];
|
|
349
356
|
contexts.value = entry.contexts ?? {};
|
|
350
357
|
currentPageId.value = ((_c = entry.page) == null ? void 0 : _c.id) ?? null;
|
|
351
|
-
setAlternates(
|
|
358
|
+
setAlternates(usableAlternates(entry.alternates));
|
|
352
359
|
updateDocumentTitle(entry);
|
|
353
360
|
}
|
|
354
361
|
function updateDocumentTitle(resolved) {
|
|
@@ -396,7 +403,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
396
403
|
blocks.value = ((_a2 = resolved.page.content) == null ? void 0 : _a2.blocks) ?? [];
|
|
397
404
|
contexts.value = resolved.contexts ?? {};
|
|
398
405
|
currentPageId.value = resolved.page.id ?? null;
|
|
399
|
-
setAlternates(resolved.alternates
|
|
406
|
+
setAlternates(usableAlternates(resolved.alternates));
|
|
400
407
|
updateDocumentTitle(resolved);
|
|
401
408
|
} catch (e) {
|
|
402
409
|
const msg = e instanceof Error ? e.message : String(e);
|
|
@@ -891,7 +898,7 @@ class BloxInstance {
|
|
|
891
898
|
router.addRoute({
|
|
892
899
|
path: "/_blox_preview",
|
|
893
900
|
name: BLOX_PREVIEW_ROUTE_NAME,
|
|
894
|
-
component: () => import("./PreviewApp-
|
|
901
|
+
component: () => import("./PreviewApp-6imffI4L.js"),
|
|
895
902
|
beforeEnter: () => typeof window === "undefined" || window.parent !== window ? true : "/"
|
|
896
903
|
});
|
|
897
904
|
}
|
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
*/
|
|
13
13
|
export declare function useLocaleNav(): {
|
|
14
14
|
switchLocale: (targetLocale: string) => void;
|
|
15
|
+
alternatePath: (targetLocale: string) => string;
|
|
15
16
|
toPath: (slug: string) => string;
|
|
16
17
|
localePath: (targetLocale: string, slug?: string) => string;
|
|
17
18
|
detect: (path: string) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useLocaleNav.d.ts","sourceRoot":"","sources":["../../src/composables/useLocaleNav.ts"],"names":[],"mappings":"AAMA;;;;;;;;;;;GAWG;AACH,wBAAgB,YAAY;iCAYS,MAAM;
|
|
1
|
+
{"version":3,"file":"useLocaleNav.d.ts","sourceRoot":"","sources":["../../src/composables/useLocaleNav.ts"],"names":[],"mappings":"AAMA;;;;;;;;;;;GAWG;AACH,wBAAgB,YAAY;iCAYS,MAAM;kCAeL,MAAM,KAAG,MAAM;mBAI9B,MAAM,KAAG,MAAM;+BAOH,MAAM,oBAAe,MAAM;mBAYvC,MAAM,KAAG;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE;;;EAa/D"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createBloxApp.d.ts","sourceRoot":"","sources":["../src/createBloxApp.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,KAAK,CAAA;AACjD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,YAAY,CAAA;AACxC,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAA;AACvD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;
|
|
1
|
+
{"version":3,"file":"createBloxApp.d.ts","sourceRoot":"","sources":["../src/createBloxApp.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,KAAK,CAAA;AACjD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,YAAY,CAAA;AACxC,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,QAA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OAAO,CAAA;CAC3B;AAED,6CAA6C;AAC7C,MAAM,WAAW,gBAAgB;IAChC,gGAAgG;IAChG,MAAM,EAAE,MAAM,CAAA;IACd;;;OAGG;IACH,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,wEAAwE;IACxE,OAAO,CAAC,EAAE,MAAM,CAAA;CAChB;AAID;;;GAGG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,gBAAgB,GAAG,IAAI,CAoCvE;AAED,MAAM,WAAW,aAAa;IAC7B,GAAG,EAAE,GAAG,CAAA;IACR,MAAM,EAAE,MAAM,CAAA;IACd,IAAI,EAAE,YAAY,CAAA;CAClB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,oBAAoB,GAAG,aAAa,CAiK1E"}
|
package/dist/index.cjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const index = require("./index-DUjEj7ts.cjs");
|
|
4
|
-
const PreviewApp_vue_vue_type_style_index_0_lang = require("./PreviewApp.vue_vue_type_style_index_0_lang-
|
|
5
|
-
const appRuntime = require("./appRuntime-
|
|
4
|
+
const PreviewApp_vue_vue_type_style_index_0_lang = require("./PreviewApp.vue_vue_type_style_index_0_lang-BP6sRzCv.cjs");
|
|
5
|
+
const appRuntime = require("./appRuntime-KrtrOgvG.cjs");
|
|
6
6
|
const vue = require("vue");
|
|
7
7
|
const ssg_client = require("./client-AoDTJJXJ.cjs");
|
|
8
8
|
const vueRouter = require("vue-router");
|
|
@@ -138,9 +138,11 @@ function useLocaleNav() {
|
|
|
138
138
|
});
|
|
139
139
|
function switchLocale(targetLocale) {
|
|
140
140
|
if (!strategy) return;
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
141
|
+
strategy.switchTo(targetLocale, alternatePath(targetLocale), router);
|
|
142
|
+
}
|
|
143
|
+
function alternatePath(targetLocale) {
|
|
144
|
+
var _a;
|
|
145
|
+
return ((_a = currentAlternates.value) == null ? void 0 : _a[targetLocale]) ?? "/";
|
|
144
146
|
}
|
|
145
147
|
function toPath(slug) {
|
|
146
148
|
const normalized = appRuntime.normalizeLink(slug) ?? slug;
|
|
@@ -164,7 +166,7 @@ function useLocaleNav() {
|
|
|
164
166
|
}
|
|
165
167
|
return { locale: def, slug: path || "/" };
|
|
166
168
|
}
|
|
167
|
-
return { switchLocale, toPath, localePath, detect, availableLocales, locale };
|
|
169
|
+
return { switchLocale, alternatePath, toPath, localePath, detect, availableLocales, locale };
|
|
168
170
|
}
|
|
169
171
|
function usePageContext(key = "$page") {
|
|
170
172
|
const contexts = vue.inject("contexts");
|
|
@@ -229,6 +231,12 @@ function safeRoute() {
|
|
|
229
231
|
return null;
|
|
230
232
|
}
|
|
231
233
|
}
|
|
234
|
+
const NOT_FOUND_SLUG = "/404";
|
|
235
|
+
function isMissingPageDocument({ hydratedSlug, requestedSlug }) {
|
|
236
|
+
if (!hydratedSlug) return false;
|
|
237
|
+
if (hydratedSlug !== NOT_FOUND_SLUG) return false;
|
|
238
|
+
return requestedSlug !== NOT_FOUND_SLUG;
|
|
239
|
+
}
|
|
232
240
|
const DEFAULT_PLAUSIBLE_HOST = "https://analytics.bagel.to";
|
|
233
241
|
function injectPlausible(config) {
|
|
234
242
|
var _a, _b;
|
|
@@ -255,7 +263,7 @@ function injectPlausible(config) {
|
|
|
255
263
|
document.head.appendChild(el);
|
|
256
264
|
}
|
|
257
265
|
function createBloxApp(options) {
|
|
258
|
-
var _a;
|
|
266
|
+
var _a, _b, _c;
|
|
259
267
|
const {
|
|
260
268
|
rootComponent,
|
|
261
269
|
router,
|
|
@@ -337,6 +345,17 @@ function createBloxApp(options) {
|
|
|
337
345
|
const initialPath = typeof window !== "undefined" && ((_a = window.location) == null ? void 0 : _a.pathname) ? window.location.pathname : router.currentRoute.value.path;
|
|
338
346
|
appRuntime.setActiveLocale(localeOf(initialPath), localeState);
|
|
339
347
|
appRuntime.setActiveLocale(localeOf(initialPath), localeState);
|
|
348
|
+
if (hasSsgState && strategy && typeof window !== "undefined") {
|
|
349
|
+
const hostname = window.location.hostname;
|
|
350
|
+
const hydratedPath = (_c = (_b = ssg_client.readBloxHydration()) == null ? void 0 : _b.route) == null ? void 0 : _c.path;
|
|
351
|
+
if (isMissingPageDocument({
|
|
352
|
+
hydratedSlug: hydratedPath ? strategy.detect(hostname, hydratedPath).slug : "",
|
|
353
|
+
requestedSlug: strategy.detect(hostname, initialPath).slug
|
|
354
|
+
})) {
|
|
355
|
+
window.location.replace(strategy.toPath("/", localeOf(initialPath)));
|
|
356
|
+
return { app, router, blox };
|
|
357
|
+
}
|
|
358
|
+
}
|
|
340
359
|
router.isReady().then(() => {
|
|
341
360
|
appRuntime.installSmartLinks(router);
|
|
342
361
|
if (navigation === "document") installDocumentNavigation(router);
|
package/dist/index.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { useBloxApi, getItemBySlug, getItemById, provideBloxApi } from "./index-I81QTzv-.js";
|
|
2
2
|
import { configureApi, createBloxApi, getCollectionResolver, getWebsiteId, getWebsiteIdSync, listItems, resolvePath, setApiOrigin, setCollectionResolver } from "./index-I81QTzv-.js";
|
|
3
|
-
import { _, P, s, a } from "./PreviewApp.vue_vue_type_style_index_0_lang-
|
|
4
|
-
import { f as BLOX_LOCALE_STRATEGY_KEY, u as useLocale, n as normalizeLink, e as BLOX_RUNTIME_KEY, g as useSeo, h as getRegistryData, j as getContentRoute, p as provideBloxData, b as provideBloxLocale, i as installBloxRuntime, s as setActiveLocale, k as installSmartLinks, l as consumePendingLocaleSwitch } from "./appRuntime-
|
|
5
|
-
import { _ as _2, m, o, q, t, v, w, x, y, P as P2, z, A, c, a as a2, C, D, E, F, G, H, I, J, K, L, M, r, N, O, Q, R } from "./appRuntime-
|
|
3
|
+
import { _, P, s, a } from "./PreviewApp.vue_vue_type_style_index_0_lang-D3nz9VR7.js";
|
|
4
|
+
import { f as BLOX_LOCALE_STRATEGY_KEY, u as useLocale, n as normalizeLink, e as BLOX_RUNTIME_KEY, g as useSeo, h as getRegistryData, j as getContentRoute, p as provideBloxData, b as provideBloxLocale, i as installBloxRuntime, s as setActiveLocale, k as installSmartLinks, l as consumePendingLocaleSwitch } from "./appRuntime-wD8N8dxg.js";
|
|
5
|
+
import { _ as _2, m, o, q, t, v, w, x, y, P as P2, z, A, c, a as a2, C, D, E, F, G, H, I, J, K, L, M, r, N, O, Q, R } from "./appRuntime-wD8N8dxg.js";
|
|
6
6
|
import { defineComponent, resolveComponent, openBlock, createBlock, withCtx, Transition, resolveDynamicComponent, inject, ref, watch, onMounted, onUnmounted, computed, onServerPrefetch, toValue, h, Suspense, createSSRApp, createApp } from "vue";
|
|
7
7
|
import { r as readBloxHydration } from "./client-Ce9fRCGH.js";
|
|
8
8
|
import { useRouter, useRoute } from "vue-router";
|
|
@@ -138,9 +138,11 @@ function useLocaleNav() {
|
|
|
138
138
|
});
|
|
139
139
|
function switchLocale(targetLocale) {
|
|
140
140
|
if (!strategy) return;
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
141
|
+
strategy.switchTo(targetLocale, alternatePath(targetLocale), router);
|
|
142
|
+
}
|
|
143
|
+
function alternatePath(targetLocale) {
|
|
144
|
+
var _a;
|
|
145
|
+
return ((_a = currentAlternates.value) == null ? void 0 : _a[targetLocale]) ?? "/";
|
|
144
146
|
}
|
|
145
147
|
function toPath(slug) {
|
|
146
148
|
const normalized = normalizeLink(slug) ?? slug;
|
|
@@ -164,7 +166,7 @@ function useLocaleNav() {
|
|
|
164
166
|
}
|
|
165
167
|
return { locale: def, slug: path || "/" };
|
|
166
168
|
}
|
|
167
|
-
return { switchLocale, toPath, localePath, detect, availableLocales, locale };
|
|
169
|
+
return { switchLocale, alternatePath, toPath, localePath, detect, availableLocales, locale };
|
|
168
170
|
}
|
|
169
171
|
function usePageContext(key = "$page") {
|
|
170
172
|
const contexts = inject("contexts");
|
|
@@ -229,6 +231,12 @@ function safeRoute() {
|
|
|
229
231
|
return null;
|
|
230
232
|
}
|
|
231
233
|
}
|
|
234
|
+
const NOT_FOUND_SLUG = "/404";
|
|
235
|
+
function isMissingPageDocument({ hydratedSlug, requestedSlug }) {
|
|
236
|
+
if (!hydratedSlug) return false;
|
|
237
|
+
if (hydratedSlug !== NOT_FOUND_SLUG) return false;
|
|
238
|
+
return requestedSlug !== NOT_FOUND_SLUG;
|
|
239
|
+
}
|
|
232
240
|
const DEFAULT_PLAUSIBLE_HOST = "https://analytics.bagel.to";
|
|
233
241
|
function injectPlausible(config) {
|
|
234
242
|
var _a, _b;
|
|
@@ -255,7 +263,7 @@ function injectPlausible(config) {
|
|
|
255
263
|
document.head.appendChild(el);
|
|
256
264
|
}
|
|
257
265
|
function createBloxApp(options) {
|
|
258
|
-
var _a;
|
|
266
|
+
var _a, _b, _c;
|
|
259
267
|
const {
|
|
260
268
|
rootComponent,
|
|
261
269
|
router,
|
|
@@ -337,6 +345,17 @@ function createBloxApp(options) {
|
|
|
337
345
|
const initialPath = typeof window !== "undefined" && ((_a = window.location) == null ? void 0 : _a.pathname) ? window.location.pathname : router.currentRoute.value.path;
|
|
338
346
|
setActiveLocale(localeOf(initialPath), localeState);
|
|
339
347
|
setActiveLocale(localeOf(initialPath), localeState);
|
|
348
|
+
if (hasSsgState && strategy && typeof window !== "undefined") {
|
|
349
|
+
const hostname = window.location.hostname;
|
|
350
|
+
const hydratedPath = (_c = (_b = readBloxHydration()) == null ? void 0 : _b.route) == null ? void 0 : _c.path;
|
|
351
|
+
if (isMissingPageDocument({
|
|
352
|
+
hydratedSlug: hydratedPath ? strategy.detect(hostname, hydratedPath).slug : "",
|
|
353
|
+
requestedSlug: strategy.detect(hostname, initialPath).slug
|
|
354
|
+
})) {
|
|
355
|
+
window.location.replace(strategy.toPath("/", localeOf(initialPath)));
|
|
356
|
+
return { app, router, blox };
|
|
357
|
+
}
|
|
358
|
+
}
|
|
340
359
|
router.isReady().then(() => {
|
|
341
360
|
installSmartLinks(router);
|
|
342
361
|
if (navigation === "document") installDocumentNavigation(router);
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A host (Netlify) serves the site's not-found document for any path that has no
|
|
3
|
+
* prerendered page, with an HTTP 404 status. JavaScript cannot read that status,
|
|
4
|
+
* but the document's embedded hydration payload describes the not-found page, so
|
|
5
|
+
* comparing it with the current URL is the only client-visible signal that the
|
|
6
|
+
* requested page does not exist.
|
|
7
|
+
*
|
|
8
|
+
* Used at boot: if we are NOT on the not-found page itself, the URL is missing
|
|
9
|
+
* and the visitor should go to the homepage of the requested language. Acting
|
|
10
|
+
* before mount also prevents hydrating a 404 document against a different view
|
|
11
|
+
* (which produces hydration mismatches and a broken nav/page).
|
|
12
|
+
*/
|
|
13
|
+
/** Route slug of the site's not-found page. */
|
|
14
|
+
export declare const NOT_FOUND_SLUG = "/404";
|
|
15
|
+
export interface NotFoundDetection {
|
|
16
|
+
/** Hydrated page's route path (from the SSG payload), if any. */
|
|
17
|
+
hydratedPath?: string | null;
|
|
18
|
+
/** Locale-stripped slug of the URL actually requested. */
|
|
19
|
+
requestedSlug: string;
|
|
20
|
+
/** Locale-stripped slug of the hydrated page. */
|
|
21
|
+
hydratedSlug: string;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* True when the loaded document is the not-found page but the requested URL is
|
|
25
|
+
* something else — i.e. the URL does not exist and the visitor must be sent
|
|
26
|
+
* elsewhere.
|
|
27
|
+
*/
|
|
28
|
+
export declare function isMissingPageDocument({ hydratedSlug, requestedSlug }: NotFoundDetection): boolean;
|
|
29
|
+
//# sourceMappingURL=notFoundDocument.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"notFoundDocument.d.ts","sourceRoot":"","sources":["../src/notFoundDocument.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH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C5B,2EAA2E;IAC3E,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IAC7B,aAAa,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAA;IACvD,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAC1B,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;CACtB;AAED,wBAAgB,kBAAkB,CACjC,KAAK,EAAE,aAAa,EAAE,EACtB,IAAI,EAAE,MAAM,EACZ,cAAc,UAAQ,GACpB,aAAa,GAAG,IAAI,CAUtB;AAuBD,wBAAsB,oBAAoB,CACzC,KAAK,EAAE,aAAa,EAAE,EACtB,IAAI,EAAE,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,CAmER;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,yBAAyB,GAAG,YAAY,CAgNnF"}
|
package/dist/ssg/index.cjs
CHANGED
|
@@ -26,7 +26,7 @@ const llmArtifacts = require("../validate-output-BdzD7fIN.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-KrtrOgvG.cjs");
|
|
30
30
|
const index = require("../index-DUjEj7ts.cjs");
|
|
31
31
|
async function renderBloxSsgPage(options) {
|
|
32
32
|
var _a, _b, _c, _d;
|
|
@@ -181,10 +181,9 @@ async function resolvePublishedPage(pages, slug, locale, resolver) {
|
|
|
181
181
|
const localizedValue = localizedItem == null ? void 0 : localizedItem[binding.bind_by];
|
|
182
182
|
if (typeof localizedValue !== "string" || !localizedValue) return null;
|
|
183
183
|
const template = ((_a2 = page.alternate_patterns) == null ? void 0 : _a2[targetLocale]) ?? page.slug;
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
];
|
|
184
|
+
const path = template.replace(`:${param.name}`, localizedValue);
|
|
185
|
+
if (path.includes(":")) return null;
|
|
186
|
+
return [targetLocale, path];
|
|
188
187
|
}));
|
|
189
188
|
alternates = Object.fromEntries(localized.filter((value2) => value2 != null));
|
|
190
189
|
}
|
package/dist/ssg/index.mjs
CHANGED
|
@@ -3,7 +3,7 @@ import { k, l, f, m, n, o, q, g, r, s, t, w, x, y, p, a, z, A, u, c, v } from ".
|
|
|
3
3
|
import { parseBloxBuildGrantBody, resolveBloxBuildGrant } from "./build-grant.mjs";
|
|
4
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 provideBloxLocale, B as BLOX_SSR_ROUTE_STATE_KEY, i as installBloxRuntime, s as setActiveLocale } from "../appRuntime-
|
|
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-wD8N8dxg.js";
|
|
7
7
|
import { provideBloxApi, getCollectionResolver } from "../index-I81QTzv-.js";
|
|
8
8
|
async function renderBloxSsgPage(options) {
|
|
9
9
|
var _a, _b, _c, _d;
|
|
@@ -158,10 +158,9 @@ async function resolvePublishedPage(pages, slug, locale, resolver) {
|
|
|
158
158
|
const localizedValue = localizedItem == null ? void 0 : localizedItem[binding.bind_by];
|
|
159
159
|
if (typeof localizedValue !== "string" || !localizedValue) return null;
|
|
160
160
|
const template = ((_a2 = page.alternate_patterns) == null ? void 0 : _a2[targetLocale]) ?? page.slug;
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
];
|
|
161
|
+
const path = template.replace(`:${param.name}`, localizedValue);
|
|
162
|
+
if (path.includes(":")) return null;
|
|
163
|
+
return [targetLocale, path];
|
|
165
164
|
}));
|
|
166
165
|
alternates = Object.fromEntries(localized.filter((value2) => value2 != null));
|
|
167
166
|
}
|
package/package.json
CHANGED