@bagelink/blox 1.18.6 → 1.18.8
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-D8ZBTG0j.cjs → PreviewApp-DJ-zFK64.cjs} +1 -1
- package/dist/{PreviewApp-9H9-jLVN.js → PreviewApp-Eu1N9XYe.js} +1 -1
- package/dist/{PreviewApp.vue_vue_type_style_index_0_lang-BYCayJs0.cjs → PreviewApp.vue_vue_type_style_index_0_lang-BF52PPjt.cjs} +1 -1
- package/dist/{PreviewApp.vue_vue_type_style_index_0_lang-BwiLyRBw.js → PreviewApp.vue_vue_type_style_index_0_lang-zkP_L9cF.js} +1 -1
- package/dist/{appRuntime-DZSCSsnS.js → appRuntime-Cmns1A7C.js} +60 -38
- package/dist/{appRuntime-Z0AxTPxf.cjs → appRuntime-DQRKuyja.cjs} +24 -2
- package/dist/composables/useLocale.d.ts +2 -0
- package/dist/composables/useLocale.d.ts.map +1 -1
- package/dist/content/routes.d.ts.map +1 -1
- package/dist/index.cjs +4 -2
- package/dist/index.d.ts +3 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.mjs +30 -28
- package/dist/{shard-runner-DF3K3Ze_.cjs → shard-runner-2Aga3U5Y.cjs} +4 -2
- package/dist/{shard-runner-DFrc8d4O.js → shard-runner-x08zpfHx.js} +4 -2
- package/dist/ssg/cli.cjs +3 -2
- package/dist/ssg/cli.mjs +3 -2
- package/dist/ssg/createSSREntry.d.ts.map +1 -1
- package/dist/ssg/index.cjs +5 -2
- package/dist/ssg/index.mjs +20 -17
- package/dist/ssg/prerender.d.ts +2 -0
- package/dist/ssg/prerender.d.ts.map +1 -1
- package/dist/ssg/shard-runner.d.ts.map +1 -1
- package/dist/ssg/validate-output.d.ts +9 -0
- package/dist/ssg/validate-output.d.ts.map +1 -1
- package/dist/{validate-output-yDJYYYzK.js → validate-output-C2ObdhO5.js} +83 -24
- package/dist/{validate-output-BymMbrA5.cjs → validate-output-Dtdsu9EM.cjs} +63 -4
- package/package.json +1 -1
|
@@ -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-BF52PPjt.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 {
|
|
2
|
+
import { e as BLOX_REGISTRY_KEY, r as resolveBlockProps, u as useLocale, f as BLOX_RUNTIME_KEY } from "./appRuntime-Cmns1A7C.js";
|
|
3
3
|
function sendToEditor(msg) {
|
|
4
4
|
window.parent.postMessage(cloneForPostMessage(msg), "*");
|
|
5
5
|
}
|
|
@@ -128,8 +128,16 @@ function localeState() {
|
|
|
128
128
|
}
|
|
129
129
|
return { locale, currentAlternates, currentLocaleFallbacks };
|
|
130
130
|
}
|
|
131
|
+
let _ssrPageLocale = null;
|
|
132
|
+
function setSsrPageLocale(locale2) {
|
|
133
|
+
_ssrPageLocale = locale2 ? String(locale2).slice(0, 2).toLowerCase() : null;
|
|
134
|
+
}
|
|
135
|
+
function getSsrPageLocale() {
|
|
136
|
+
return _ssrPageLocale;
|
|
137
|
+
}
|
|
131
138
|
function setActiveLocale(l, state = localeState()) {
|
|
132
139
|
state.locale.value = l;
|
|
140
|
+
locale.value = l;
|
|
133
141
|
try {
|
|
134
142
|
const i18n = getI18n();
|
|
135
143
|
if (i18n == null ? void 0 : i18n.global) i18n.global.locale.value = l;
|
|
@@ -801,7 +809,7 @@ class BloxInstance {
|
|
|
801
809
|
router.addRoute({
|
|
802
810
|
path: "/_blox_preview",
|
|
803
811
|
name: BLOX_PREVIEW_ROUTE_NAME,
|
|
804
|
-
component: () => import("./PreviewApp-
|
|
812
|
+
component: () => import("./PreviewApp-Eu1N9XYe.js"),
|
|
805
813
|
beforeEnter: () => typeof window === "undefined" || window.parent !== window ? true : "/"
|
|
806
814
|
});
|
|
807
815
|
}
|
|
@@ -1036,12 +1044,24 @@ function installLocaleAwareResolve(router, strategy, activeLocaleRef) {
|
|
|
1036
1044
|
const supported = strategy.locales;
|
|
1037
1045
|
const defaultLocale = strategy.defaultLocale;
|
|
1038
1046
|
const activeLocale = () => String(locale2.value || "").slice(0, 2).toLowerCase() || defaultLocale;
|
|
1047
|
+
const routeLocale = () => {
|
|
1048
|
+
var _a, _b, _c;
|
|
1049
|
+
const ssr = getSsrPageLocale();
|
|
1050
|
+
if (ssr) return ssr;
|
|
1051
|
+
const path = String(((_b = (_a = router.currentRoute) == null ? void 0 : _a.value) == null ? void 0 : _b.path) || "");
|
|
1052
|
+
const first = (_c = path.replace(/^\/+/, "").split("/")[0]) == null ? void 0 : _c.toLowerCase();
|
|
1053
|
+
return first && supported.includes(first) ? first : activeLocale();
|
|
1054
|
+
};
|
|
1039
1055
|
const originalResolve = router.resolve.bind(router);
|
|
1040
1056
|
router.resolve = (to, currentLocation) => {
|
|
1057
|
+
var _a;
|
|
1041
1058
|
if (typeof to === "string") {
|
|
1042
1059
|
const href = normalizeLink(to) ?? to;
|
|
1043
1060
|
if (classifyLink(href) === "internal") {
|
|
1044
|
-
|
|
1061
|
+
const firstSegment = (_a = href.replace(/^\/+/, "").split("/")[0]) == null ? void 0 : _a.toLowerCase();
|
|
1062
|
+
if (!(firstSegment && supported.includes(firstSegment))) {
|
|
1063
|
+
to = strategy.toPath(href, routeLocale());
|
|
1064
|
+
}
|
|
1045
1065
|
}
|
|
1046
1066
|
} else if (to && typeof to === "object" && typeof to.path === "string" && typeof to.locale === "string") {
|
|
1047
1067
|
const href = normalizeLink(to.path) ?? to.path;
|
|
@@ -1191,51 +1211,53 @@ function installBloxRuntime(options) {
|
|
|
1191
1211
|
return blox;
|
|
1192
1212
|
}
|
|
1193
1213
|
export {
|
|
1194
|
-
_sfc_main as A,
|
|
1214
|
+
_sfc_main$1 as A,
|
|
1195
1215
|
BLOX_SSR_ROUTE_STATE_KEY as B,
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1216
|
+
_sfc_main as C,
|
|
1217
|
+
applyLayoutChrome as D,
|
|
1218
|
+
classifyLink as E,
|
|
1219
|
+
contentRoutes as F,
|
|
1220
|
+
createBlox as G,
|
|
1221
|
+
defineContent as H,
|
|
1222
|
+
generateContentRoutes as I,
|
|
1223
|
+
getContentRouteByCollection as J,
|
|
1224
|
+
getSsrPageLocale as K,
|
|
1225
|
+
installContentFallback as L,
|
|
1226
|
+
isAbsoluteExternal as M,
|
|
1227
|
+
isSoloContentPage as N,
|
|
1228
|
+
isSpecialScheme as O,
|
|
1209
1229
|
PageRenderer as P,
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1230
|
+
normalizeTo as Q,
|
|
1231
|
+
provideContentItem as R,
|
|
1232
|
+
toInternalPath as S,
|
|
1233
|
+
useBloxEdit as T,
|
|
1234
|
+
useContentItem as U,
|
|
1235
|
+
useData as V,
|
|
1214
1236
|
_sfc_main$3 as _,
|
|
1215
1237
|
collectBloxSeo as a,
|
|
1216
1238
|
provideBloxLocale as b,
|
|
1217
1239
|
collectBloxData as c,
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1240
|
+
setActiveLocale as d,
|
|
1241
|
+
BLOX_REGISTRY_KEY as e,
|
|
1242
|
+
BLOX_RUNTIME_KEY as f,
|
|
1243
|
+
BLOX_LOCALE_STRATEGY_KEY as g,
|
|
1244
|
+
useSeo as h,
|
|
1223
1245
|
installBloxRuntime as i,
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1246
|
+
getRegistryData as j,
|
|
1247
|
+
getContentRoute as k,
|
|
1248
|
+
isMissingPageDocument as l,
|
|
1249
|
+
installSmartLinks as m,
|
|
1228
1250
|
normalizeLink as n,
|
|
1229
|
-
|
|
1251
|
+
BLOX_CMS_ROUTE_NAME as o,
|
|
1230
1252
|
provideBloxData as p,
|
|
1231
|
-
|
|
1253
|
+
BLOX_PREVIEW_ROUTE_NAME as q,
|
|
1232
1254
|
resolveBlockProps as r,
|
|
1233
|
-
|
|
1234
|
-
|
|
1255
|
+
setSsrPageLocale as s,
|
|
1256
|
+
BLOX_ADMIN_CONFIG_KEY as t,
|
|
1235
1257
|
useLocale as u,
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
_sfc_main$
|
|
1258
|
+
BLOX_CONFIG_KEY as v,
|
|
1259
|
+
BLOX_DATA_KEY as w,
|
|
1260
|
+
BLOX_LAYOUT_KEY as x,
|
|
1261
|
+
BloxInstance as y,
|
|
1262
|
+
_sfc_main$2 as z
|
|
1241
1263
|
};
|
|
@@ -129,8 +129,16 @@ function localeState() {
|
|
|
129
129
|
}
|
|
130
130
|
return { locale, currentAlternates, currentLocaleFallbacks };
|
|
131
131
|
}
|
|
132
|
+
let _ssrPageLocale = null;
|
|
133
|
+
function setSsrPageLocale(locale2) {
|
|
134
|
+
_ssrPageLocale = locale2 ? String(locale2).slice(0, 2).toLowerCase() : null;
|
|
135
|
+
}
|
|
136
|
+
function getSsrPageLocale() {
|
|
137
|
+
return _ssrPageLocale;
|
|
138
|
+
}
|
|
132
139
|
function setActiveLocale(l, state = localeState()) {
|
|
133
140
|
state.locale.value = l;
|
|
141
|
+
locale.value = l;
|
|
134
142
|
try {
|
|
135
143
|
const i18n = vue$1.getI18n();
|
|
136
144
|
if (i18n == null ? void 0 : i18n.global) i18n.global.locale.value = l;
|
|
@@ -802,7 +810,7 @@ class BloxInstance {
|
|
|
802
810
|
router.addRoute({
|
|
803
811
|
path: "/_blox_preview",
|
|
804
812
|
name: BLOX_PREVIEW_ROUTE_NAME,
|
|
805
|
-
component: () => Promise.resolve().then(() => require("./PreviewApp-
|
|
813
|
+
component: () => Promise.resolve().then(() => require("./PreviewApp-DJ-zFK64.cjs")),
|
|
806
814
|
beforeEnter: () => typeof window === "undefined" || window.parent !== window ? true : "/"
|
|
807
815
|
});
|
|
808
816
|
}
|
|
@@ -1037,12 +1045,24 @@ function installLocaleAwareResolve(router, strategy, activeLocaleRef) {
|
|
|
1037
1045
|
const supported = strategy.locales;
|
|
1038
1046
|
const defaultLocale = strategy.defaultLocale;
|
|
1039
1047
|
const activeLocale = () => String(locale2.value || "").slice(0, 2).toLowerCase() || defaultLocale;
|
|
1048
|
+
const routeLocale = () => {
|
|
1049
|
+
var _a, _b, _c;
|
|
1050
|
+
const ssr = getSsrPageLocale();
|
|
1051
|
+
if (ssr) return ssr;
|
|
1052
|
+
const path = String(((_b = (_a = router.currentRoute) == null ? void 0 : _a.value) == null ? void 0 : _b.path) || "");
|
|
1053
|
+
const first = (_c = path.replace(/^\/+/, "").split("/")[0]) == null ? void 0 : _c.toLowerCase();
|
|
1054
|
+
return first && supported.includes(first) ? first : activeLocale();
|
|
1055
|
+
};
|
|
1040
1056
|
const originalResolve = router.resolve.bind(router);
|
|
1041
1057
|
router.resolve = (to, currentLocation) => {
|
|
1058
|
+
var _a;
|
|
1042
1059
|
if (typeof to === "string") {
|
|
1043
1060
|
const href = normalizeLink(to) ?? to;
|
|
1044
1061
|
if (classifyLink(href) === "internal") {
|
|
1045
|
-
|
|
1062
|
+
const firstSegment = (_a = href.replace(/^\/+/, "").split("/")[0]) == null ? void 0 : _a.toLowerCase();
|
|
1063
|
+
if (!(firstSegment && supported.includes(firstSegment))) {
|
|
1064
|
+
to = strategy.toPath(href, routeLocale());
|
|
1065
|
+
}
|
|
1046
1066
|
}
|
|
1047
1067
|
} else if (to && typeof to === "object" && typeof to.path === "string" && typeof to.locale === "string") {
|
|
1048
1068
|
const href = normalizeLink(to.path) ?? to.path;
|
|
@@ -1218,6 +1238,7 @@ exports.generateContentRoutes = generateContentRoutes;
|
|
|
1218
1238
|
exports.getContentRoute = getContentRoute;
|
|
1219
1239
|
exports.getContentRouteByCollection = getContentRouteByCollection;
|
|
1220
1240
|
exports.getRegistryData = getRegistryData;
|
|
1241
|
+
exports.getSsrPageLocale = getSsrPageLocale;
|
|
1221
1242
|
exports.installBloxRuntime = installBloxRuntime;
|
|
1222
1243
|
exports.installContentFallback = installContentFallback;
|
|
1223
1244
|
exports.installSmartLinks = installSmartLinks;
|
|
@@ -1232,6 +1253,7 @@ exports.provideBloxLocale = provideBloxLocale;
|
|
|
1232
1253
|
exports.provideContentItem = provideContentItem;
|
|
1233
1254
|
exports.resolveBlockProps = resolveBlockProps;
|
|
1234
1255
|
exports.setActiveLocale = setActiveLocale;
|
|
1256
|
+
exports.setSsrPageLocale = setSsrPageLocale;
|
|
1235
1257
|
exports.toInternalPath = toInternalPath;
|
|
1236
1258
|
exports.useBloxEdit = useBloxEdit;
|
|
1237
1259
|
exports.useContentItem = useContentItem;
|
|
@@ -7,6 +7,8 @@ export interface BloxLocaleState {
|
|
|
7
7
|
}
|
|
8
8
|
export declare const BLOX_LOCALE_KEY: InjectionKey<BloxLocaleState>;
|
|
9
9
|
export declare function provideBloxLocale(app: App, initialLocale: Locale): BloxLocaleState;
|
|
10
|
+
export declare function setSsrPageLocale(locale: string | null): void;
|
|
11
|
+
export declare function getSsrPageLocale(): string | null;
|
|
10
12
|
/**
|
|
11
13
|
* Set the active locale ref directly, without touching `localStorage`/`document`.
|
|
12
14
|
* Used by the SSG entry to align `useLocale()` with the URL-detected render
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useLocale.d.ts","sourceRoot":"","sources":["../../src/composables/useLocale.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,GAAG,EAAE,YAAY,EAAE,GAAG,EAAE,MAAM,KAAK,CAAA;AAGjD,MAAM,MAAM,MAAM,GAAG,MAAM,CAAA;AAa3B,MAAM,WAAW,eAAe;IAC/B,MAAM,EAAE,GAAG,CAAC,MAAM,CAAC,CAAA;IACnB,iBAAiB,EAAE,GAAG,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAA;IAC9C,sBAAsB,EAAE,GAAG,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC,CAAA;CACrD;AAED,eAAO,MAAM,eAAe,EAAE,YAAY,CAAC,eAAe,CAAyB,CAAA;AAEnF,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,GAAG,EAAE,aAAa,EAAE,MAAM,GAAG,eAAe,CAQlF;
|
|
1
|
+
{"version":3,"file":"useLocale.d.ts","sourceRoot":"","sources":["../../src/composables/useLocale.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,GAAG,EAAE,YAAY,EAAE,GAAG,EAAE,MAAM,KAAK,CAAA;AAGjD,MAAM,MAAM,MAAM,GAAG,MAAM,CAAA;AAa3B,MAAM,WAAW,eAAe;IAC/B,MAAM,EAAE,GAAG,CAAC,MAAM,CAAC,CAAA;IACnB,iBAAiB,EAAE,GAAG,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAA;IAC9C,sBAAsB,EAAE,GAAG,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC,CAAA;CACrD;AAED,eAAO,MAAM,eAAe,EAAE,YAAY,CAAC,eAAe,CAAyB,CAAA;AAEnF,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,GAAG,EAAE,aAAa,EAAE,MAAM,GAAG,eAAe,CAQlF;AAoBD,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI,CAE5D;AAED,wBAAgB,gBAAgB,IAAI,MAAM,GAAG,IAAI,CAEhD;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,CAAC,EAAE,MAAM,EAAE,KAAK,GAAE,eAA+B,GAAG,IAAI,CAcvF;AAED,wBAAgB,SAAS;;;mBAIF,MAAM;;gCAgBO,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;;oCAIlB,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC;EAa/D"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"routes.d.ts","sourceRoot":"","sources":["../../src/content/routes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,KAAK,CAAA;AAC9B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,YAAY,CAAA;AACxD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAA;AACvD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAA;AAQ3C;;;;;;;;;;;GAWG;AACH,wBAAgB,qBAAqB,CACpC,gBAAgB,EAAE,MAAM,EAAE,EAC1B,aAAa,EAAE,MAAM,GACnB,cAAc,EAAE,CA4BlB;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,yBAAyB,CACxC,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,cAAc,EACxB,eAAe,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,GAC3B,IAAI,
|
|
1
|
+
{"version":3,"file":"routes.d.ts","sourceRoot":"","sources":["../../src/content/routes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,KAAK,CAAA;AAC9B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,YAAY,CAAA;AACxD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAA;AACvD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAA;AAQ3C;;;;;;;;;;;GAWG;AACH,wBAAgB,qBAAqB,CACpC,gBAAgB,EAAE,MAAM,EAAE,EAC1B,aAAa,EAAE,MAAM,GACnB,cAAc,EAAE,CA4BlB;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,yBAAyB,CACxC,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,cAAc,EACxB,eAAe,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,GAC3B,IAAI,CA4DN;AAED;;;;;;;GAOG;AACH,wBAAgB,sBAAsB,CACrC,MAAM,EAAE,MAAM,EACd,gBAAgB,EAAE,MAAM,EAAE,EAC1B,aAAa,EAAE,MAAM,EACrB,GAAG,CAAC,EAAE,aAAa,GACjB,IAAI,CAmFN"}
|
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-BF52PPjt.cjs");
|
|
5
|
+
const appRuntime = require("./appRuntime-DQRKuyja.cjs");
|
|
6
6
|
const vue = require("vue");
|
|
7
7
|
const ssg_client = require("./client-AoDTJJXJ.cjs");
|
|
8
8
|
const vueRouter = require("vue-router");
|
|
@@ -535,6 +535,7 @@ exports.defineContent = appRuntime.defineContent;
|
|
|
535
535
|
exports.generateContentRoutes = appRuntime.generateContentRoutes;
|
|
536
536
|
exports.getContentRoute = appRuntime.getContentRoute;
|
|
537
537
|
exports.getContentRouteByCollection = appRuntime.getContentRouteByCollection;
|
|
538
|
+
exports.getSsrPageLocale = appRuntime.getSsrPageLocale;
|
|
538
539
|
exports.installContentFallback = appRuntime.installContentFallback;
|
|
539
540
|
exports.installSmartLinks = appRuntime.installSmartLinks;
|
|
540
541
|
exports.isAbsoluteExternal = appRuntime.isAbsoluteExternal;
|
|
@@ -545,6 +546,7 @@ exports.normalizeTo = appRuntime.normalizeTo;
|
|
|
545
546
|
exports.provideBloxData = appRuntime.provideBloxData;
|
|
546
547
|
exports.provideContentItem = appRuntime.provideContentItem;
|
|
547
548
|
exports.resolveBlockProps = appRuntime.resolveBlockProps;
|
|
549
|
+
exports.setSsrPageLocale = appRuntime.setSsrPageLocale;
|
|
548
550
|
exports.toInternalPath = appRuntime.toInternalPath;
|
|
549
551
|
exports.useBloxEdit = appRuntime.useBloxEdit;
|
|
550
552
|
exports.useContentItem = appRuntime.useContentItem;
|
package/dist/index.d.ts
CHANGED
|
@@ -31,7 +31,9 @@ export { defineBloxSite } from './siteConfig';
|
|
|
31
31
|
export type { BloxSiteConfig } from './siteConfig';
|
|
32
32
|
export { defineBlock } from './defineBlock';
|
|
33
33
|
export type { BlockMeta, BlockModule, BlockDataSource, BlockDataSourceConfig } from './defineBlock';
|
|
34
|
-
export type { LocaleStrategy } from './localeStrategy';
|
|
34
|
+
export type { LocaleStrategy, PageSlugMap } from './localeStrategy';
|
|
35
|
+
export { getSsrPageLocale, setSsrPageLocale } from './composables/useLocale';
|
|
36
|
+
export { getPageSlugMap, localizePageSlug, setPageSlugMap } from './localeStrategy';
|
|
35
37
|
export { withLocaleRoutes } from './localeRoutes';
|
|
36
38
|
export { defineContent, contentRoutes, getContentRoute, getContentRouteByCollection, generateContentRoutes, installContentFallback, provideContentItem, useContentItem, useContentSeo, getItemBySlug, getItemById, ContentHost, ContentDetailView, } from './content';
|
|
37
39
|
export type { ContentItem, ContentRoute, ContentRouteInput, ContentViewSchema } from './content';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../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.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 {
|
|
5
|
-
import { _ as _2,
|
|
3
|
+
import { _, P, s, a } from "./PreviewApp.vue_vue_type_style_index_0_lang-zkP_L9cF.js";
|
|
4
|
+
import { g as BLOX_LOCALE_STRATEGY_KEY, u as useLocale, n as normalizeLink, f as BLOX_RUNTIME_KEY, h as useSeo, j as getRegistryData, k as getContentRoute, p as provideBloxData, b as provideBloxLocale, i as installBloxRuntime, d as setActiveLocale, l as isMissingPageDocument, m as installSmartLinks, o as BLOX_CMS_ROUTE_NAME, q as BLOX_PREVIEW_ROUTE_NAME } from "./appRuntime-Cmns1A7C.js";
|
|
5
|
+
import { _ as _2, t, v, w, x, y, z, A, C, P as P2, D, E, c, a as a2, F, G, H, I, J, K, L, M, N, O, Q, R, r, s as s2, S, T, U, V } from "./appRuntime-Cmns1A7C.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";
|
|
@@ -500,58 +500,59 @@ function buildBloxManifest(blox) {
|
|
|
500
500
|
}
|
|
501
501
|
export {
|
|
502
502
|
_2 as AdminEditBar,
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
503
|
+
t as BLOX_ADMIN_CONFIG_KEY,
|
|
504
|
+
v as BLOX_CONFIG_KEY,
|
|
505
|
+
w as BLOX_DATA_KEY,
|
|
506
|
+
x as BLOX_LAYOUT_KEY,
|
|
507
507
|
BLOX_LOCALE_STRATEGY_KEY,
|
|
508
508
|
BLOX_RUNTIME_KEY,
|
|
509
|
-
|
|
509
|
+
y as BloxInstance,
|
|
510
510
|
_sfc_main as BloxRouterView,
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
511
|
+
z as CmsPageView,
|
|
512
|
+
A as ContentDetailView,
|
|
513
|
+
C as ContentHost,
|
|
514
514
|
P2 as PageRenderer,
|
|
515
515
|
_ as PreviewApp,
|
|
516
516
|
P as PreviewRenderer,
|
|
517
|
-
|
|
517
|
+
D as applyLayoutChrome,
|
|
518
518
|
buildBloxManifest,
|
|
519
|
-
|
|
519
|
+
E as classifyLink,
|
|
520
520
|
c as collectBloxData,
|
|
521
521
|
a2 as collectBloxSeo,
|
|
522
522
|
configureApi,
|
|
523
|
-
|
|
524
|
-
|
|
523
|
+
F as contentRoutes,
|
|
524
|
+
G as createBlox,
|
|
525
525
|
createBloxApi,
|
|
526
526
|
createBloxApp,
|
|
527
527
|
defineBlock,
|
|
528
528
|
defineBloxSite,
|
|
529
|
-
|
|
530
|
-
|
|
529
|
+
H as defineContent,
|
|
530
|
+
I as generateContentRoutes,
|
|
531
531
|
getCollectionResolver,
|
|
532
532
|
getContentRoute,
|
|
533
|
-
|
|
533
|
+
J as getContentRouteByCollection,
|
|
534
534
|
getItemById,
|
|
535
535
|
getItemBySlug,
|
|
536
536
|
g as getPageSlugMap,
|
|
537
|
+
K as getSsrPageLocale,
|
|
537
538
|
getWebsiteId,
|
|
538
539
|
getWebsiteIdSync,
|
|
539
540
|
injectGtm,
|
|
540
541
|
injectPlausible,
|
|
541
|
-
|
|
542
|
+
L as installContentFallback,
|
|
542
543
|
installDocumentNavigation,
|
|
543
544
|
installGtm,
|
|
544
545
|
installSmartLinks,
|
|
545
|
-
|
|
546
|
+
M as isAbsoluteExternal,
|
|
546
547
|
isGtmInstalled,
|
|
547
|
-
|
|
548
|
-
|
|
548
|
+
N as isSoloContentPage,
|
|
549
|
+
O as isSpecialScheme,
|
|
549
550
|
listItems,
|
|
550
551
|
l as localizePageSlug,
|
|
551
552
|
normalizeLink,
|
|
552
|
-
|
|
553
|
+
Q as normalizeTo,
|
|
553
554
|
provideBloxData,
|
|
554
|
-
|
|
555
|
+
R as provideContentItem,
|
|
555
556
|
readBloxHydration,
|
|
556
557
|
r as resolveBlockProps,
|
|
557
558
|
resolvePath,
|
|
@@ -561,13 +562,14 @@ export {
|
|
|
561
562
|
setApiOrigin,
|
|
562
563
|
setCollectionResolver,
|
|
563
564
|
setPageSlugMap,
|
|
564
|
-
|
|
565
|
+
s2 as setSsrPageLocale,
|
|
566
|
+
S as toInternalPath,
|
|
565
567
|
useBloxApi,
|
|
566
|
-
|
|
568
|
+
T as useBloxEdit,
|
|
567
569
|
useBloxRuntime,
|
|
568
|
-
|
|
570
|
+
U as useContentItem,
|
|
569
571
|
useContentSeo,
|
|
570
|
-
|
|
572
|
+
V as useData,
|
|
571
573
|
useGlobalBlock,
|
|
572
574
|
useLocale,
|
|
573
575
|
useLocaleNav,
|
|
@@ -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-Dtdsu9EM.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
|
const SEQUENTIAL_SHARDS = process.env.BLOX_SSG_SEQUENTIAL === "1";
|
|
@@ -169,7 +169,7 @@ async function runSharded(opts) {
|
|
|
169
169
|
}
|
|
170
170
|
if (process.env.BLOX_SSG_LLM !== "0" && !((_a = website == null ? void 0 : website.seo) == null ? void 0 : _a.noindex)) {
|
|
171
171
|
try {
|
|
172
|
-
const { mergeLlmParts } = await Promise.resolve().then(() => require("./validate-output-
|
|
172
|
+
const { mergeLlmParts } = await Promise.resolve().then(() => require("./validate-output-Dtdsu9EM.cjs")).then((n) => n.llmArtifacts);
|
|
173
173
|
const mergeWebsite = website;
|
|
174
174
|
const partFiles = Array.from({ length: total }, (_, i) => path.join(llmPartsDir, `part.${i}.json`));
|
|
175
175
|
const { pages } = await mergeLlmParts({
|
|
@@ -215,6 +215,8 @@ async function runSharded(opts) {
|
|
|
215
215
|
await fs.rm(routePartsDir, { recursive: true, force: true });
|
|
216
216
|
await fs.rm(siteDataFile, { force: true }).catch(() => {
|
|
217
217
|
});
|
|
218
|
+
await llmArtifacts.validateNoRedirectingLinks(path.resolve("dist"));
|
|
219
|
+
console.log("[blox-ssg] validated internal links (no redirecting URLs)");
|
|
218
220
|
console.log(`[blox-ssg] sharded run done in ${((Date.now() - start) / 1e3).toFixed(1)}s`);
|
|
219
221
|
return 0;
|
|
220
222
|
}
|
|
@@ -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, g as generateSitemapArtifacts } from "./validate-output-
|
|
5
|
+
import { f as fetchCmsSiteData, g as generateSitemapArtifacts, d as validateNoRedirectingLinks } from "./validate-output-C2ObdhO5.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
|
const SEQUENTIAL_SHARDS = process.env.BLOX_SSG_SEQUENTIAL === "1";
|
|
@@ -145,7 +145,7 @@ async function runSharded(opts) {
|
|
|
145
145
|
}
|
|
146
146
|
if (process.env.BLOX_SSG_LLM !== "0" && !((_a = website == null ? void 0 : website.seo) == null ? void 0 : _a.noindex)) {
|
|
147
147
|
try {
|
|
148
|
-
const { mergeLlmParts } = await import("./validate-output-
|
|
148
|
+
const { mergeLlmParts } = await import("./validate-output-C2ObdhO5.js").then((n) => n.D);
|
|
149
149
|
const mergeWebsite = website;
|
|
150
150
|
const partFiles = Array.from({ length: total }, (_, i) => path.join(llmPartsDir, `part.${i}.json`));
|
|
151
151
|
const { pages } = await mergeLlmParts({
|
|
@@ -191,6 +191,8 @@ async function runSharded(opts) {
|
|
|
191
191
|
await fs.rm(routePartsDir, { recursive: true, force: true });
|
|
192
192
|
await fs.rm(siteDataFile, { force: true }).catch(() => {
|
|
193
193
|
});
|
|
194
|
+
await validateNoRedirectingLinks(path.resolve("dist"));
|
|
195
|
+
console.log("[blox-ssg] validated internal links (no redirecting URLs)");
|
|
194
196
|
console.log(`[blox-ssg] sharded run done in ${((Date.now() - start) / 1e3).toFixed(1)}s`);
|
|
195
197
|
return 0;
|
|
196
198
|
}
|
package/dist/ssg/cli.cjs
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
const process = require("node:process");
|
|
4
4
|
const fs = require("node:fs/promises");
|
|
5
5
|
const ssg_buildGrant = require("./build-grant.cjs");
|
|
6
|
-
const llmArtifacts = require("../validate-output-
|
|
6
|
+
const llmArtifacts = require("../validate-output-Dtdsu9EM.cjs");
|
|
7
7
|
const localeStrategy = require("../localeStrategy-OwRIn35C.cjs");
|
|
8
8
|
function installFetchTimeout() {
|
|
9
9
|
const ms = Number(process.env.BLOX_SSG_FETCH_TIMEOUT_MS) || 2e4;
|
|
@@ -148,7 +148,7 @@ Environment:
|
|
|
148
148
|
if (shardsOpt !== null || routesCmd) {
|
|
149
149
|
const { apiBase: apiBase2, websiteName: configWebsiteName2 } = await resolveApiBase(mode);
|
|
150
150
|
const websiteName2 = process.env.WEBSITE_NAME ?? configWebsiteName2 ?? "default";
|
|
151
|
-
const { runSharded } = await Promise.resolve().then(() => require("../shard-runner-
|
|
151
|
+
const { runSharded } = await Promise.resolve().then(() => require("../shard-runner-2Aga3U5Y.cjs"));
|
|
152
152
|
const code = await runSharded({
|
|
153
153
|
shards: shardsOpt ?? "auto",
|
|
154
154
|
mode,
|
|
@@ -295,6 +295,7 @@ ${"=".repeat(60)}`);
|
|
|
295
295
|
}
|
|
296
296
|
if (validateOutput && shardTotal === 1) {
|
|
297
297
|
await llmArtifacts.validateInternalLinks("dist");
|
|
298
|
+
await llmArtifacts.validateNoRedirectingLinks("dist");
|
|
298
299
|
console.log("[blox-ssg] validated internal links");
|
|
299
300
|
}
|
|
300
301
|
if (productionBuild && shardTotal === 1) {
|
package/dist/ssg/cli.mjs
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import process from "node:process";
|
|
3
3
|
import fs from "node:fs/promises";
|
|
4
4
|
import { resolveBloxBuildGrant } from "./build-grant.mjs";
|
|
5
|
-
import { v as validateSsgOutput, u as uploadBloxManifest, p as polyfillBloxSsgGlobals, f as fetchCmsSiteData, b as buildCollectionResolver, a as prerender, c as validateInternalLinks } from "../validate-output-
|
|
5
|
+
import { v as validateSsgOutput, u as uploadBloxManifest, p as polyfillBloxSsgGlobals, f as fetchCmsSiteData, b as buildCollectionResolver, a as prerender, c as validateInternalLinks, d as validateNoRedirectingLinks } from "../validate-output-C2ObdhO5.js";
|
|
6
6
|
import { s as setPageSlugMap } from "../localeStrategy-hXlNof1E.js";
|
|
7
7
|
function installFetchTimeout() {
|
|
8
8
|
const ms = Number(process.env.BLOX_SSG_FETCH_TIMEOUT_MS) || 2e4;
|
|
@@ -147,7 +147,7 @@ Environment:
|
|
|
147
147
|
if (shardsOpt !== null || routesCmd) {
|
|
148
148
|
const { apiBase: apiBase2, websiteName: configWebsiteName2 } = await resolveApiBase(mode);
|
|
149
149
|
const websiteName2 = process.env.WEBSITE_NAME ?? configWebsiteName2 ?? "default";
|
|
150
|
-
const { runSharded } = await import("../shard-runner-
|
|
150
|
+
const { runSharded } = await import("../shard-runner-x08zpfHx.js");
|
|
151
151
|
const code = await runSharded({
|
|
152
152
|
shards: shardsOpt ?? "auto",
|
|
153
153
|
mode,
|
|
@@ -294,6 +294,7 @@ ${"=".repeat(60)}`);
|
|
|
294
294
|
}
|
|
295
295
|
if (validateOutput && shardTotal === 1) {
|
|
296
296
|
await validateInternalLinks("dist");
|
|
297
|
+
await validateNoRedirectingLinks("dist");
|
|
297
298
|
console.log("[blox-ssg] validated internal links");
|
|
298
299
|
}
|
|
299
300
|
if (productionBuild && shardTotal === 1) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createSSREntry.d.ts","sourceRoot":"","sources":["../../src/ssg/createSSREntry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,KAAK,CAAA;AACzC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,YAAY,CAAA;AACxC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AACjD,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAG9D,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,iBAAiB,CAAA;
|
|
1
|
+
{"version":3,"file":"createSSREntry.d.ts","sourceRoot":"","sources":["../../src/ssg/createSSREntry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,KAAK,CAAA;AACzC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,YAAY,CAAA;AACxC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AACjD,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAG9D,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,iBAAiB,CAAA;AAM9D,OAAO,EAAyC,KAAK,gBAAgB,EAAE,MAAM,QAAQ,CAAA;AAMrF,MAAM,WAAW,yBAAyB;IACzC,oCAAoC;IACpC,aAAa,EAAE,SAAS,CAAA;IACxB;;;;OAIG;IACH,YAAY,EAAE,CAAC,IAAI,EAAE,KAAK,GAAG,QAAQ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AAC,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,CAoFR;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,yBAAyB,GAAG,YAAY,CAsNnF"}
|
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-Dtdsu9EM.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-DQRKuyja.cjs");
|
|
30
|
+
const localeStrategy = require("../localeStrategy-OwRIn35C.cjs");
|
|
30
31
|
const index = require("../index-DUjEj7ts.cjs");
|
|
31
32
|
async function renderBloxSsgPage(options) {
|
|
32
33
|
var _a, _b, _c, _d;
|
|
@@ -298,6 +299,7 @@ function createBloxSSREntry(options) {
|
|
|
298
299
|
}
|
|
299
300
|
function buildApp(url, resolvedData, stateKey) {
|
|
300
301
|
const pageLocale = detectLocale(url).locale;
|
|
302
|
+
appRuntime.setSsrPageLocale(pageLocale);
|
|
301
303
|
const router = createRouter("memory", url);
|
|
302
304
|
const app = vue.createSSRApp({
|
|
303
305
|
name: "BloxSsgRoot",
|
|
@@ -336,6 +338,7 @@ function createBloxSSREntry(options) {
|
|
|
336
338
|
async function render(url, ctx) {
|
|
337
339
|
var _a2;
|
|
338
340
|
const { locale: pageLocale, slug } = detectLocale(url);
|
|
341
|
+
if (ctx.pageSlugMap) localeStrategy.setPageSlugMap(ctx.pageSlugMap);
|
|
339
342
|
let resolvedData = null;
|
|
340
343
|
if ((_a2 = ctx.resolveCache) == null ? void 0 : _a2.has(url)) {
|
|
341
344
|
resolvedData = ctx.resolveCache.get(url) ?? null;
|
package/dist/ssg/index.mjs
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { e as buildPageHead, h as primaryContextEntry, i as buildJsonLd, j as extractPageText, B as BloxBuildResponseError, k as bloxBuildJson } from "../validate-output-C2ObdhO5.js";
|
|
2
|
+
import { l, m, f, n, o, q, r, g, s, t, w, x, y, z, p, a, A, C, u, c, v } from "../validate-output-C2ObdhO5.js";
|
|
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,
|
|
6
|
+
import { c as collectBloxData, a as collectBloxSeo, s as setSsrPageLocale, p as provideBloxData, b as provideBloxLocale, B as BLOX_SSR_ROUTE_STATE_KEY, i as installBloxRuntime, d as setActiveLocale } from "../appRuntime-Cmns1A7C.js";
|
|
7
|
+
import { s as setPageSlugMap } from "../localeStrategy-hXlNof1E.js";
|
|
7
8
|
import { provideBloxApi, getCollectionResolver } from "../index-I81QTzv-.js";
|
|
8
9
|
async function renderBloxSsgPage(options) {
|
|
9
10
|
var _a, _b, _c, _d;
|
|
@@ -275,6 +276,7 @@ function createBloxSSREntry(options) {
|
|
|
275
276
|
}
|
|
276
277
|
function buildApp(url, resolvedData, stateKey) {
|
|
277
278
|
const pageLocale = detectLocale(url).locale;
|
|
279
|
+
setSsrPageLocale(pageLocale);
|
|
278
280
|
const router = createRouter("memory", url);
|
|
279
281
|
const app = createSSRApp({
|
|
280
282
|
name: "BloxSsgRoot",
|
|
@@ -313,6 +315,7 @@ function createBloxSSREntry(options) {
|
|
|
313
315
|
async function render(url, ctx) {
|
|
314
316
|
var _a2;
|
|
315
317
|
const { locale: pageLocale, slug } = detectLocale(url);
|
|
318
|
+
if (ctx.pageSlugMap) setPageSlugMap(ctx.pageSlugMap);
|
|
316
319
|
let resolvedData = null;
|
|
317
320
|
if ((_a2 = ctx.resolveCache) == null ? void 0 : _a2.has(url)) {
|
|
318
321
|
resolvedData = ctx.resolveCache.get(url) ?? null;
|
|
@@ -416,34 +419,34 @@ export {
|
|
|
416
419
|
BLOX_HYDRATION_WINDOW_KEY,
|
|
417
420
|
BloxBuildResponseError,
|
|
418
421
|
bloxBuildJson,
|
|
419
|
-
|
|
422
|
+
l as bloxBuildRequest,
|
|
420
423
|
buildJsonLd,
|
|
421
424
|
buildPageHead,
|
|
422
|
-
|
|
425
|
+
m as buildSiteHead,
|
|
423
426
|
createBloxSSREntry,
|
|
424
427
|
extractPageText,
|
|
425
428
|
f as fetchCmsSiteData,
|
|
426
429
|
fetchDatastoreSnapshot,
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
430
|
+
n as generateLlmsFullTxt,
|
|
431
|
+
o as generateLlmsTxt,
|
|
432
|
+
q as generateNetlifyRedirects,
|
|
433
|
+
r as generateRobotsTxt,
|
|
431
434
|
g as generateSitemapArtifacts,
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
435
|
+
s as generateSitemapIndexXml,
|
|
436
|
+
t as generateSitemapXml,
|
|
437
|
+
w as getBloxBuildRequestOptions,
|
|
438
|
+
x as getSiteIconFlags,
|
|
439
|
+
y as localeSitemapPath,
|
|
440
|
+
z as mergeLlmParts,
|
|
438
441
|
parseBloxBuildGrantBody,
|
|
439
442
|
p as polyfillBloxSsgGlobals,
|
|
440
443
|
a as prerender,
|
|
441
444
|
querySnapshotRows,
|
|
442
445
|
renderBloxSsgPage,
|
|
443
446
|
resolveBloxBuildGrant,
|
|
444
|
-
|
|
447
|
+
A as resolveManifestProvenance,
|
|
445
448
|
snapshotRows,
|
|
446
|
-
|
|
449
|
+
C as splitSitemapPathsByLocale,
|
|
447
450
|
u as uploadBloxManifest,
|
|
448
451
|
c as validateInternalLinks,
|
|
449
452
|
v as validateSsgOutput
|
package/dist/ssg/prerender.d.ts
CHANGED
|
@@ -46,6 +46,8 @@ export interface RenderContext {
|
|
|
46
46
|
website?: WebsiteRead | null;
|
|
47
47
|
/** Resolved website ID for client embedding. */
|
|
48
48
|
websiteId?: string;
|
|
49
|
+
/** Canonical localized page paths, embedded in the hydration payload. */
|
|
50
|
+
pageSlugMap?: Record<string, Record<string, string>>;
|
|
49
51
|
/**
|
|
50
52
|
* Pre-resolved page data keyed by render URL. When the prerender producer has
|
|
51
53
|
* already fetched a URL's `/resolve-path` result, the SSR entry reads it from
|
|
@@ -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;AAiBvE,KAAK,WAAW,GAAG,MAAM,GAAG,MAAM,GAAG,CAAC,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,CAAA;AAEhE,MAAM,WAAW,gBAAgB;IAChC,IAAI,CAAC,EAAE,MAAM,CAA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|
-
{"version":3,"file":"shard-runner.d.ts","sourceRoot":"","sources":["../../src/ssg/shard-runner.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAQH,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,iBAAiB,CAAA;
|
|
1
|
+
{"version":3,"file":"shard-runner.d.ts","sourceRoot":"","sources":["../../src/ssg/shard-runner.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAQH,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,iBAAiB,CAAA;AAK9D,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,yEAAyE;IACzE,YAAY,CAAC,EAAE,uBAAuB,CAAA;IACtC,iFAAiF;IACjF,UAAU,EAAE,MAAM,EAAE,CAAA;IACpB,8FAA8F;IAC9F,eAAe,EAAE,MAAM,EAAE,CAAA;IACzB;;;;;OAKG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;CAClB;AAWD,wBAAgB,cAAc,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,GAAG,CAAC,MAAM,CAAC,GAAG,OAAO,CAQ/E;AAED,wBAAgB,uBAAuB,CAAC,CAAC,SAAS;IAAE,OAAO,EAAE,OAAO,CAAA;CAAE,EACrE,MAAM,EAAE,CAAC,EAAE,EACX,WAAW,EAAE,OAAO,GAAG,SAAS,GAC9B,CAAC,EAAE,CAIL;AAsED;;GAEG;AACH,wBAAsB,UAAU,CAAC,IAAI,EAAE,kBAAkB,GAAG,OAAO,CAAC,MAAM,CAAC,CAgK1E"}
|
|
@@ -26,5 +26,14 @@ export interface ValidateSsgOutputOptions {
|
|
|
26
26
|
*/
|
|
27
27
|
checkInternalLinks?: boolean;
|
|
28
28
|
}
|
|
29
|
+
/**
|
|
30
|
+
* Fail when a prerendered page links to a URL that Netlify will redirect.
|
|
31
|
+
*
|
|
32
|
+
* Links must point at canonical URLs: a link to a redirect source (e.g.
|
|
33
|
+
* `/es/get-the-best-offer` → `/es/consigue-la-mejor-oferta`) costs a hop on
|
|
34
|
+
* every click and shows up as an internal redirect chain in crawlers. Redirects
|
|
35
|
+
* remain for external/legacy URLs only.
|
|
36
|
+
*/
|
|
37
|
+
export declare function validateNoRedirectingLinks(outDir: string): Promise<void>;
|
|
29
38
|
export declare function validateSsgOutput(options: ValidateSsgOutputOptions): Promise<void>;
|
|
30
39
|
//# sourceMappingURL=validate-output.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validate-output.d.ts","sourceRoot":"","sources":["../../src/ssg/validate-output.ts"],"names":[],"mappings":"AAWA;;;;;;;GAOG;AACH,wBAAsB,qBAAqB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAiBzE;AAED,MAAM,WAAW,wBAAwB;IACxC,MAAM,EAAE,MAAM,CAAA;IACd,YAAY,CAAC,EAAE,MAAM,EAAE,CAAA;IACvB;;;;OAIG;IACH,mBAAmB,CAAC,EAAE,OAAO,CAAA;IAC7B;;;;;;;OAOG;IACH,kBAAkB,CAAC,EAAE,OAAO,CAAA;CAC5B;
|
|
1
|
+
{"version":3,"file":"validate-output.d.ts","sourceRoot":"","sources":["../../src/ssg/validate-output.ts"],"names":[],"mappings":"AAWA;;;;;;;GAOG;AACH,wBAAsB,qBAAqB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAiBzE;AAED,MAAM,WAAW,wBAAwB;IACxC,MAAM,EAAE,MAAM,CAAA;IACd,YAAY,CAAC,EAAE,MAAM,EAAE,CAAA;IACvB;;;;OAIG;IACH,mBAAmB,CAAC,EAAE,OAAO,CAAA;IAC7B;;;;;;;OAOG;IACH,kBAAkB,CAAC,EAAE,OAAO,CAAA;CAC5B;AAED;;;;;;;GAOG;AACH,wBAAsB,0BAA0B,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CA4B9E;AAqED,wBAAsB,iBAAiB,CAAC,OAAO,EAAE,wBAAwB,GAAG,OAAO,CAAC,IAAI,CAAC,CA2ExF"}
|
|
@@ -1274,7 +1274,7 @@ ${existing}`,
|
|
|
1274
1274
|
totalDiscovered: seen.size
|
|
1275
1275
|
};
|
|
1276
1276
|
}
|
|
1277
|
-
function normalizePath(p) {
|
|
1277
|
+
function normalizePath$1(p) {
|
|
1278
1278
|
if (!p) return "/";
|
|
1279
1279
|
try {
|
|
1280
1280
|
if (p.startsWith("http://") || p.startsWith("https://")) {
|
|
@@ -1291,7 +1291,7 @@ function normalizePath(p) {
|
|
|
1291
1291
|
return p || "/";
|
|
1292
1292
|
}
|
|
1293
1293
|
function enqueue(p, queue, seen, isExcluded) {
|
|
1294
|
-
const np = normalizePath(p);
|
|
1294
|
+
const np = normalizePath$1(p);
|
|
1295
1295
|
if (seen.has(np)) return;
|
|
1296
1296
|
if (isExcluded(np)) return;
|
|
1297
1297
|
seen.add(np);
|
|
@@ -1300,7 +1300,7 @@ function enqueue(p, queue, seen, isExcluded) {
|
|
|
1300
1300
|
function makeExcludeChecker(excludePaths) {
|
|
1301
1301
|
const rules = Array.isArray(excludePaths) ? excludePaths : [excludePaths];
|
|
1302
1302
|
return (p) => {
|
|
1303
|
-
const np = normalizePath(p);
|
|
1303
|
+
const np = normalizePath$1(p);
|
|
1304
1304
|
for (const r of rules) {
|
|
1305
1305
|
if (typeof r === "string" && r === "") continue;
|
|
1306
1306
|
if (typeof r === "function") {
|
|
@@ -1308,7 +1308,7 @@ function makeExcludeChecker(excludePaths) {
|
|
|
1308
1308
|
} else if (r instanceof RegExp) {
|
|
1309
1309
|
if (r.test(np)) return true;
|
|
1310
1310
|
} else if (typeof r === "string") {
|
|
1311
|
-
const prefix = normalizePath(r);
|
|
1311
|
+
const prefix = normalizePath$1(r);
|
|
1312
1312
|
if (np === prefix || np.startsWith(`${prefix}/`)) return true;
|
|
1313
1313
|
}
|
|
1314
1314
|
}
|
|
@@ -1546,6 +1546,64 @@ async function validateInternalLinks(outDir) {
|
|
|
1546
1546
|
${failures.map((item) => ` - ${item}`).join("\n")}`);
|
|
1547
1547
|
}
|
|
1548
1548
|
}
|
|
1549
|
+
async function validateNoRedirectingLinks(outDir) {
|
|
1550
|
+
if (process.env.BLOX_SSG_ASSERT_LINKS === "0") {
|
|
1551
|
+
console.warn("[blox-ssg] BLOX_SSG_ASSERT_LINKS=0 — skipping redirect-link validation");
|
|
1552
|
+
return;
|
|
1553
|
+
}
|
|
1554
|
+
const root = path.resolve(outDir);
|
|
1555
|
+
const redirectSources = await readRedirectSources(root, "301", "302", "307", "308");
|
|
1556
|
+
if (!redirectSources.size) return;
|
|
1557
|
+
const failures = [];
|
|
1558
|
+
for (const file of await collectHtmlFiles(root)) {
|
|
1559
|
+
const name = path.relative(root, file);
|
|
1560
|
+
const html = await fs.readFile(file, "utf8");
|
|
1561
|
+
for (const href of internalHrefs(html)) {
|
|
1562
|
+
const [withoutSuffix] = href.split(/[?#]/);
|
|
1563
|
+
const normalized = normalizePath(withoutSuffix || "/");
|
|
1564
|
+
if (redirectSources.has(normalized)) {
|
|
1565
|
+
failures.push(`${name}: links to redirecting URL "${href}"`);
|
|
1566
|
+
}
|
|
1567
|
+
}
|
|
1568
|
+
}
|
|
1569
|
+
if (failures.length) {
|
|
1570
|
+
throw new Error(
|
|
1571
|
+
`Invalid Blox SSG output:
|
|
1572
|
+
${failures.slice(0, 25).map((item) => ` - ${item}`).join("\n")}`
|
|
1573
|
+
);
|
|
1574
|
+
}
|
|
1575
|
+
}
|
|
1576
|
+
async function readRedirectSources(root, ...statuses) {
|
|
1577
|
+
const sources = /* @__PURE__ */ new Set();
|
|
1578
|
+
let content = "";
|
|
1579
|
+
try {
|
|
1580
|
+
content = await fs.readFile(path.join(root, "_redirects"), "utf8");
|
|
1581
|
+
} catch {
|
|
1582
|
+
return sources;
|
|
1583
|
+
}
|
|
1584
|
+
for (const line of content.split("\n")) {
|
|
1585
|
+
const trimmed = line.trim();
|
|
1586
|
+
if (!trimmed || trimmed.startsWith("#")) continue;
|
|
1587
|
+
const parts = trimmed.split(/\s+/);
|
|
1588
|
+
if (parts.length < 3) continue;
|
|
1589
|
+
const status = parts[2];
|
|
1590
|
+
if (!statuses.includes(status)) continue;
|
|
1591
|
+
sources.add(normalizePath(parts[0]));
|
|
1592
|
+
}
|
|
1593
|
+
return sources;
|
|
1594
|
+
}
|
|
1595
|
+
function normalizePath(value) {
|
|
1596
|
+
const clean = value.split(/[?#]/)[0] || "/";
|
|
1597
|
+
return clean !== "/" ? clean.replace(/\/+$/, "") : "/";
|
|
1598
|
+
}
|
|
1599
|
+
function* internalHrefs(html) {
|
|
1600
|
+
const attr = /(?:<a\b[^>]*\shref=["']([^"']+)["'])|(?:data-to=["']([^"']+)["'])/gi;
|
|
1601
|
+
let match;
|
|
1602
|
+
while (match = attr.exec(html)) {
|
|
1603
|
+
const value = match[1] ?? match[2] ?? "";
|
|
1604
|
+
if (value.startsWith("/") && !value.startsWith("//")) yield value;
|
|
1605
|
+
}
|
|
1606
|
+
}
|
|
1549
1607
|
const anchorHref = /<a\b[^>]*\shref=["']([^"']*)["']/gi;
|
|
1550
1608
|
const ABSOLUTE_OR_SPECIAL = /^(?:[a-z][a-z0-9+.-]*:|\/\/|\/|#|\?|$)/i;
|
|
1551
1609
|
async function readSiteNoindex(outDir) {
|
|
@@ -1686,33 +1744,34 @@ async function validateSitemap(outDir, content) {
|
|
|
1686
1744
|
return failures;
|
|
1687
1745
|
}
|
|
1688
1746
|
export {
|
|
1689
|
-
|
|
1747
|
+
resolveManifestProvenance as A,
|
|
1690
1748
|
BloxBuildResponseError as B,
|
|
1691
|
-
|
|
1749
|
+
splitSitemapPathsByLocale as C,
|
|
1750
|
+
llmArtifacts as D,
|
|
1692
1751
|
prerender as a,
|
|
1693
1752
|
buildCollectionResolver as b,
|
|
1694
1753
|
validateInternalLinks as c,
|
|
1695
|
-
|
|
1696
|
-
|
|
1754
|
+
validateNoRedirectingLinks as d,
|
|
1755
|
+
buildPageHead as e,
|
|
1697
1756
|
fetchCmsSiteData as f,
|
|
1698
1757
|
generateSitemapArtifacts as g,
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1758
|
+
primaryContextEntry as h,
|
|
1759
|
+
buildJsonLd as i,
|
|
1760
|
+
extractPageText as j,
|
|
1761
|
+
bloxBuildJson as k,
|
|
1762
|
+
bloxBuildRequest as l,
|
|
1763
|
+
buildSiteHead as m,
|
|
1764
|
+
generateLlmsFullTxt as n,
|
|
1765
|
+
generateLlmsTxt as o,
|
|
1707
1766
|
polyfillBloxSsgGlobals as p,
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1767
|
+
generateNetlifyRedirects as q,
|
|
1768
|
+
generateRobotsTxt as r,
|
|
1769
|
+
generateSitemapIndexXml as s,
|
|
1770
|
+
generateSitemapXml as t,
|
|
1712
1771
|
uploadBloxManifest as u,
|
|
1713
1772
|
validateSsgOutput as v,
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1773
|
+
getBloxBuildRequestOptions as w,
|
|
1774
|
+
getSiteIconFlags as x,
|
|
1775
|
+
localeSitemapPath as y,
|
|
1776
|
+
mergeLlmParts as z
|
|
1718
1777
|
};
|
|
@@ -1297,7 +1297,7 @@ ${existing}`,
|
|
|
1297
1297
|
totalDiscovered: seen.size
|
|
1298
1298
|
};
|
|
1299
1299
|
}
|
|
1300
|
-
function normalizePath(p) {
|
|
1300
|
+
function normalizePath$1(p) {
|
|
1301
1301
|
if (!p) return "/";
|
|
1302
1302
|
try {
|
|
1303
1303
|
if (p.startsWith("http://") || p.startsWith("https://")) {
|
|
@@ -1314,7 +1314,7 @@ function normalizePath(p) {
|
|
|
1314
1314
|
return p || "/";
|
|
1315
1315
|
}
|
|
1316
1316
|
function enqueue(p, queue, seen, isExcluded) {
|
|
1317
|
-
const np = normalizePath(p);
|
|
1317
|
+
const np = normalizePath$1(p);
|
|
1318
1318
|
if (seen.has(np)) return;
|
|
1319
1319
|
if (isExcluded(np)) return;
|
|
1320
1320
|
seen.add(np);
|
|
@@ -1323,7 +1323,7 @@ function enqueue(p, queue, seen, isExcluded) {
|
|
|
1323
1323
|
function makeExcludeChecker(excludePaths) {
|
|
1324
1324
|
const rules = Array.isArray(excludePaths) ? excludePaths : [excludePaths];
|
|
1325
1325
|
return (p) => {
|
|
1326
|
-
const np = normalizePath(p);
|
|
1326
|
+
const np = normalizePath$1(p);
|
|
1327
1327
|
for (const r of rules) {
|
|
1328
1328
|
if (typeof r === "string" && r === "") continue;
|
|
1329
1329
|
if (typeof r === "function") {
|
|
@@ -1331,7 +1331,7 @@ function makeExcludeChecker(excludePaths) {
|
|
|
1331
1331
|
} else if (r instanceof RegExp) {
|
|
1332
1332
|
if (r.test(np)) return true;
|
|
1333
1333
|
} else if (typeof r === "string") {
|
|
1334
|
-
const prefix = normalizePath(r);
|
|
1334
|
+
const prefix = normalizePath$1(r);
|
|
1335
1335
|
if (np === prefix || np.startsWith(`${prefix}/`)) return true;
|
|
1336
1336
|
}
|
|
1337
1337
|
}
|
|
@@ -1569,6 +1569,64 @@ async function validateInternalLinks(outDir) {
|
|
|
1569
1569
|
${failures.map((item) => ` - ${item}`).join("\n")}`);
|
|
1570
1570
|
}
|
|
1571
1571
|
}
|
|
1572
|
+
async function validateNoRedirectingLinks(outDir) {
|
|
1573
|
+
if (process.env.BLOX_SSG_ASSERT_LINKS === "0") {
|
|
1574
|
+
console.warn("[blox-ssg] BLOX_SSG_ASSERT_LINKS=0 — skipping redirect-link validation");
|
|
1575
|
+
return;
|
|
1576
|
+
}
|
|
1577
|
+
const root = path.resolve(outDir);
|
|
1578
|
+
const redirectSources = await readRedirectSources(root, "301", "302", "307", "308");
|
|
1579
|
+
if (!redirectSources.size) return;
|
|
1580
|
+
const failures = [];
|
|
1581
|
+
for (const file of await collectHtmlFiles(root)) {
|
|
1582
|
+
const name = path.relative(root, file);
|
|
1583
|
+
const html = await fs.readFile(file, "utf8");
|
|
1584
|
+
for (const href of internalHrefs(html)) {
|
|
1585
|
+
const [withoutSuffix] = href.split(/[?#]/);
|
|
1586
|
+
const normalized = normalizePath(withoutSuffix || "/");
|
|
1587
|
+
if (redirectSources.has(normalized)) {
|
|
1588
|
+
failures.push(`${name}: links to redirecting URL "${href}"`);
|
|
1589
|
+
}
|
|
1590
|
+
}
|
|
1591
|
+
}
|
|
1592
|
+
if (failures.length) {
|
|
1593
|
+
throw new Error(
|
|
1594
|
+
`Invalid Blox SSG output:
|
|
1595
|
+
${failures.slice(0, 25).map((item) => ` - ${item}`).join("\n")}`
|
|
1596
|
+
);
|
|
1597
|
+
}
|
|
1598
|
+
}
|
|
1599
|
+
async function readRedirectSources(root, ...statuses) {
|
|
1600
|
+
const sources = /* @__PURE__ */ new Set();
|
|
1601
|
+
let content = "";
|
|
1602
|
+
try {
|
|
1603
|
+
content = await fs.readFile(path.join(root, "_redirects"), "utf8");
|
|
1604
|
+
} catch {
|
|
1605
|
+
return sources;
|
|
1606
|
+
}
|
|
1607
|
+
for (const line of content.split("\n")) {
|
|
1608
|
+
const trimmed = line.trim();
|
|
1609
|
+
if (!trimmed || trimmed.startsWith("#")) continue;
|
|
1610
|
+
const parts = trimmed.split(/\s+/);
|
|
1611
|
+
if (parts.length < 3) continue;
|
|
1612
|
+
const status = parts[2];
|
|
1613
|
+
if (!statuses.includes(status)) continue;
|
|
1614
|
+
sources.add(normalizePath(parts[0]));
|
|
1615
|
+
}
|
|
1616
|
+
return sources;
|
|
1617
|
+
}
|
|
1618
|
+
function normalizePath(value) {
|
|
1619
|
+
const clean = value.split(/[?#]/)[0] || "/";
|
|
1620
|
+
return clean !== "/" ? clean.replace(/\/+$/, "") : "/";
|
|
1621
|
+
}
|
|
1622
|
+
function* internalHrefs(html) {
|
|
1623
|
+
const attr = /(?:<a\b[^>]*\shref=["']([^"']+)["'])|(?:data-to=["']([^"']+)["'])/gi;
|
|
1624
|
+
let match;
|
|
1625
|
+
while (match = attr.exec(html)) {
|
|
1626
|
+
const value = match[1] ?? match[2] ?? "";
|
|
1627
|
+
if (value.startsWith("/") && !value.startsWith("//")) yield value;
|
|
1628
|
+
}
|
|
1629
|
+
}
|
|
1572
1630
|
const anchorHref = /<a\b[^>]*\shref=["']([^"']*)["']/gi;
|
|
1573
1631
|
const ABSOLUTE_OR_SPECIAL = /^(?:[a-z][a-z0-9+.-]*:|\/\/|\/|#|\?|$)/i;
|
|
1574
1632
|
async function readSiteNoindex(outDir) {
|
|
@@ -1736,4 +1794,5 @@ exports.resolveManifestProvenance = resolveManifestProvenance;
|
|
|
1736
1794
|
exports.splitSitemapPathsByLocale = splitSitemapPathsByLocale;
|
|
1737
1795
|
exports.uploadBloxManifest = uploadBloxManifest;
|
|
1738
1796
|
exports.validateInternalLinks = validateInternalLinks;
|
|
1797
|
+
exports.validateNoRedirectingLinks = validateNoRedirectingLinks;
|
|
1739
1798
|
exports.validateSsgOutput = validateSsgOutput;
|
package/package.json
CHANGED