@i18n-micro/vitepress 1.1.14 → 2.0.1

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.
Files changed (45) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +13 -91
  3. package/dist/adapter-BbqZKi2F.cjs +2 -0
  4. package/dist/adapter-BbqZKi2F.cjs.map +1 -0
  5. package/dist/adapter-DTS0CTC7.js +131 -0
  6. package/dist/adapter-DTS0CTC7.js.map +1 -0
  7. package/dist/config.cjs +6 -6
  8. package/dist/config.cjs.map +1 -1
  9. package/dist/config.d.cts +7 -0
  10. package/dist/config.d.ts +7 -0
  11. package/dist/config.mjs +129 -220
  12. package/dist/config.mjs.map +1 -1
  13. package/dist/create-Bo6VND8l.js +87 -0
  14. package/dist/create-Bo6VND8l.js.map +1 -0
  15. package/dist/create-Dn1m6fyc.cjs +2 -0
  16. package/dist/create-Dn1m6fyc.cjs.map +1 -0
  17. package/dist/index.cjs +1 -1
  18. package/dist/index.cjs.map +1 -1
  19. package/dist/index.d.cts +8 -0
  20. package/dist/index.d.ts +8 -0
  21. package/dist/index.mjs +6 -7
  22. package/dist/index.mjs.map +1 -1
  23. package/dist/node.cjs +1 -1
  24. package/dist/node.cjs.map +1 -1
  25. package/dist/node.mjs +3 -4
  26. package/dist/theme.cjs +1 -1
  27. package/dist/theme.cjs.map +1 -1
  28. package/dist/theme.d.cts +42 -1
  29. package/dist/theme.d.ts +42 -1
  30. package/dist/theme.mjs +9 -7
  31. package/dist/theme.mjs.map +1 -1
  32. package/dist/vitepress-locales-CwOlvAa0.cjs.map +1 -1
  33. package/dist/{vitepress-locales-DOhKs3q5.js → vitepress-locales-DYuP6i_x.js} +2 -3
  34. package/dist/{vitepress-locales-DOhKs3q5.js.map → vitepress-locales-DYuP6i_x.js.map} +1 -1
  35. package/package.json +24 -13
  36. package/dist/adapter-CAJNI6Sw.js +0 -127
  37. package/dist/adapter-CAJNI6Sw.js.map +0 -1
  38. package/dist/adapter-eYZZOC9d.cjs +0 -2
  39. package/dist/adapter-eYZZOC9d.cjs.map +0 -1
  40. package/dist/create-C_dXg23X.js +0 -81
  41. package/dist/create-C_dXg23X.js.map +0 -1
  42. package/dist/create-Cwu2djcO.cjs +0 -2
  43. package/dist/create-Cwu2djcO.cjs.map +0 -1
  44. package/dist/plugin/virtual-stubs/config.d.cts +0 -14
  45. package/dist/runtime/define-theme.d.cts +0 -39
package/dist/config.mjs CHANGED
@@ -1,16 +1,18 @@
1
- import { i as e, n as t } from "./adapter-CAJNI6Sw.js";
2
- import { t as n } from "./vitepress-locales-DOhKs3q5.js";
3
- import { classifyTranslationRelativePath as r, storeLoadedTranslationFile as i } from "@i18n-micro/utils/parse-path";
4
- import { existsSync as a, readFileSync as o, readdirSync as s, statSync as c } from "node:fs";
5
- import { join as l, relative as u, resolve as d, sep as f } from "node:path";
6
- import { resolveHreflangAlternates as p } from "@i18n-micro/utils/resolve-hreflang";
7
- import { resolveOgLocale as m, warnUnresolvedOgLocale as h } from "@i18n-micro/utils/resolve-og-locale";
8
- //#region src/router/i18n-routing.ts
9
- function g(e) {
1
+ import { i as e, n as t } from "./adapter-DTS0CTC7.js";
2
+ import { t as n } from "./vitepress-locales-DYuP6i_x.js";
3
+ import { buildLocaleHead as r, filterQuery as i } from "@i18n-micro/utils/locale-head";
4
+ import { existsSync as a } from "node:fs";
5
+ import { resolve as o } from "node:path";
6
+ import { classifyTranslationRelativePath as s } from "@i18n-micro/utils/parse-path";
7
+ import { listTranslationFiles as c, loadTranslationDir as l } from "@i18n-micro/utils/load-dir";
8
+ new Set("xml txt ico json js css png jpg jpeg gif svg webp avif pdf wasm map mp4 webm mp3 zip gz woff woff2 ttf eot".split(" "));
9
+ var u = (e) => e.includes("\\") ? e.split("\\").join("/") : e;
10
+ // src/router/i18n-routing.ts
11
+ function d(e) {
10
12
  return "switchLocalePath" in e && typeof e.switchLocalePath == "function";
11
13
  }
12
- function _(e) {
13
- let t = g(e) ? {
14
+ function f(e) {
15
+ let t = d(e) ? {
14
16
  defaultLocale: e.defaultLocale,
15
17
  localeCodes: e.localeCodes,
16
18
  localeKeyToCode: e.localeKeyToCode ?? {},
@@ -68,199 +70,108 @@ function _(e) {
68
70
  return localized + extras + q + h;
69
71
  `);
70
72
  }
71
- //#endregion
72
- //#region src/seo/locale-head.ts
73
- function v(e, t) {
74
- let n = e.indexOf("#"), r = e.indexOf("?"), i = e.length;
75
- n >= 0 && (i = Math.min(i, n)), r >= 0 && (i = Math.min(i, r));
76
- let a = e.slice(0, i) || "/";
77
- if (r < 0 || t.length === 0) return a;
78
- let o = new URLSearchParams(e.slice(r, n >= 0 ? n : void 0)), s = new URLSearchParams();
79
- for (let e of t) o.has(e) && s.set(e, o.get(e));
80
- let c = s.toString();
81
- return c ? `${a}?${c}` : a;
73
+ // src/seo/locale-head.ts
74
+ var p = (e) => e.endsWith("/") ? e.slice(0, -1) : e;
75
+ function m(e, t, n) {
76
+ return `${p(e)}${!t || t === "/" ? "" : p(t)}${n.startsWith("/") ? n : `/${n}`}`;
82
77
  }
83
- function y(e, t, n) {
84
- return `${e.replace(/\/$/, "")}${!t || t === "/" ? "" : t.replace(/\/$/, "")}${n.startsWith("/") ? n : `/${n}`}`;
78
+ function h(e) {
79
+ let t = u(e);
80
+ return t === "index.md" || t.endsWith("/index.md") ? t = t.slice(0, -8) : t.endsWith(".md") && (t = t.slice(0, -3)), t.startsWith("/") || (t = `/${t}`), t.length > 1 && t.endsWith("/") && (t = t.slice(0, -1)), t || "/";
85
81
  }
86
- function b(e) {
87
- let t = e.replace(/\\/g, "/");
88
- return t = t.replace(/(^|\/)index\.md$/, "$1").replace(/\.md$/, ""), t.startsWith("/") || (t = `/${t}`), t.length > 1 && t.endsWith("/") && (t = t.slice(0, -1)), t || "/";
89
- }
90
- function x(n) {
91
- let { locales: r, defaultLocale: i, localeKeyToCode: a = {}, base: o, metaBaseUrl: s, hreflangBaseLanguage: c = !1, canonicalQueryWhitelist: l = [], addDirAttribute: u = !0, addSeoAttributes: d = !0, identifierAttribute: f = "id", missingWarn: g = !0 } = n, b = e(n.path, o), x = t(b, r.map((e) => e.code), i, a, void 0), S = r.find((e) => e.code === x);
92
- if (!S) return {
82
+ function g(n) {
83
+ let { locales: a, defaultLocale: o, localeKeyToCode: s = {}, base: c, metaBaseUrl: l, hreflangBaseLanguage: u = !1, canonicalQueryWhitelist: d = [], addDirAttribute: p = !0, addSeoAttributes: h = !0, identifierAttribute: g = "id", missingWarn: _ = !0 } = n, v = e(n.path, c), y = t(v, a.map((e) => e.code), o, s, void 0), b = a.find((e) => e.code === y);
84
+ if (!b) return {
93
85
  htmlAttrs: {},
94
86
  head: []
95
87
  };
96
- let C = S.iso || x, w = S.dir || "auto", T = {
97
- lang: C,
98
- ...u ? { dir: w } : {}
99
- };
100
- if (!d || !s) return {
101
- htmlAttrs: T,
88
+ let x = f({
89
+ defaultLocale: o,
90
+ localeCodes: a.map((e) => e.code),
91
+ localeKeyToCode: s,
92
+ base: c
93
+ }), S = i(v, d), C = (e) => m(l ?? "", c, x({}, { path: S }, e)), w = (e, t) => {
94
+ if (e === o) return "root";
95
+ let n = Object.entries(s).find(([, t]) => t === e);
96
+ return n ? n[0] === "root" ? t : n[0] : e;
97
+ }, T = a.filter((e) => !e.disabled && e.seo !== !1), { htmlAttrs: E, link: D, meta: O } = r({
98
+ locale: b,
99
+ seoLocales: T,
100
+ hrefOf: (e) => C(w(e, e)),
101
+ canonical: C(w(y, "root")),
102
+ xDefault: T.some((e) => e.code === o) ? C("root") : void 0,
103
+ addDirAttribute: p,
104
+ addSeoAttributes: h && !!l,
105
+ identifierAttribute: g,
106
+ hreflangBaseLanguage: u,
107
+ missingWarn: _
108
+ });
109
+ if (D.length === 0) return {
110
+ htmlAttrs: E,
102
111
  head: []
103
112
  };
104
- let E = _({
105
- defaultLocale: i,
106
- localeCodes: r.map((e) => e.code),
107
- localeKeyToCode: a,
108
- base: o
109
- }), D = v(b, l), O = x === i ? "root" : (() => {
110
- for (let [e, t] of Object.entries(a)) if (t === x) return e === "root" ? "root" : e;
111
- return x;
112
- })(), k = y(s, o, E({}, { path: D }, O)), A = r.filter((e) => !e.disabled && e.seo !== !1), j = m(S);
113
- j || h(S, {
114
- missingWarn: g,
115
- tag: "og:locale"
116
- });
117
- let M = [];
118
- M.push(["link", {
119
- [f]: "i18n-can",
120
- rel: "canonical",
121
- href: k
122
- }]), j && M.push(["meta", {
123
- [f]: "i18n-og",
124
- property: "og:locale",
125
- content: j
126
- }]), M.push(["meta", {
127
- [f]: "i18n-og-url",
128
- property: "og:url",
129
- content: k
130
- }]);
131
- for (let e of A) {
132
- if (e.code === x) continue;
133
- let t = m(e);
134
- if (!t) {
135
- h(e, {
136
- missingWarn: g,
137
- tag: "og:locale:alternate"
138
- });
139
- continue;
140
- }
141
- M.push(["meta", {
142
- [f]: `i18n-og-alt-${t}`,
143
- property: "og:locale:alternate",
144
- content: t
145
- }]);
146
- }
147
- let N = /* @__PURE__ */ new Map();
148
- for (let e of A) {
149
- let t = e.code === i ? "root" : (() => {
150
- for (let [t, n] of Object.entries(a)) if (n === e.code) return t === "root" ? e.code : t;
151
- return e.code;
152
- })(), n = E({}, { path: D }, t);
153
- n && N.set(String(e.code), y(s, o, n));
154
- }
155
- for (let { hreflang: e, localeCode: t } of p(A, { hreflangBaseLanguage: c })) {
156
- let n = N.get(t);
157
- n && M.push(["link", {
158
- [f]: `i18n-alternate-${e}`,
159
- rel: "alternate",
160
- href: n,
161
- hreflang: e
162
- }]);
163
- }
164
- let P = r.find((e) => e.code === i);
165
- if (P && P.seo !== !1) {
166
- let e = N.get(i);
167
- e && M.push(["link", {
168
- [f]: "i18n-xd",
169
- rel: "alternate",
170
- href: e,
171
- hreflang: "x-default"
172
- }]);
173
- }
113
+ let [k, ...A] = D, j = (e, t) => t.map((t) => [e, t]);
174
114
  return {
175
- htmlAttrs: T,
176
- head: M
115
+ htmlAttrs: E,
116
+ head: [
117
+ ...j("link", [k]),
118
+ ...j("meta", O),
119
+ ...j("link", A)
120
+ ]
177
121
  };
178
122
  }
179
- //#endregion
180
- //#region src/plugin/load-messages.ts
181
- function S(e, t) {
182
- if (a(e)) for (let n of s(e)) {
183
- let r = l(e, n);
184
- if (c(r).isDirectory()) {
185
- S(r, t);
186
- continue;
187
- }
188
- n.endsWith(".json") && t(r);
189
- }
123
+ // src/plugin/load-messages.ts
124
+ var _ = (e) => o(e.rootDir ?? process.cwd(), e.translationDir);
125
+ function v(e) {
126
+ return c(_(e));
190
127
  }
191
- function C(e) {
192
- let t = e.rootDir ?? process.cwd(), n = d(t, e.translationDir), r = [];
193
- return S(n, (e) => {
194
- r.push({
195
- absolutePath: e,
196
- relativePath: u(n, e).split(f).join("/")
197
- });
198
- }), r.sort((e, t) => e.relativePath.localeCompare(t.relativePath));
128
+ function y(e) {
129
+ return l(_(e), e.disablePageLocales === !0);
199
130
  }
131
+ // src/plugin/with-i18n.ts
132
+ var b = "virtual:i18n-micro/config", x = `\0${b}`, S = "virtual:i18n-micro/messages", C = `\0${S}`;
200
133
  function w(e) {
201
- let t = e.rootDir ?? process.cwd(), n = d(t, e.translationDir), r = {
202
- root: {},
203
- routes: {}
204
- }, s = e.disablePageLocales === !0;
205
- return a(n) && S(n, (e) => {
206
- let t = u(n, e).split(f).join("/");
207
- try {
208
- let n = JSON.parse(o(e, "utf-8"));
209
- if (typeof n != "object" || !n || Array.isArray(n)) {
210
- console.error(`[i18n-micro/vitepress] Skipping ${t}: expected a JSON object, got ${Array.isArray(n) ? "array" : typeof n}`);
211
- return;
212
- }
213
- i(r, t, n, s);
214
- } catch (e) {
215
- console.error(`[i18n-micro/vitepress] Failed to load ${t}:`, e);
216
- }
217
- }), r;
134
+ return u(e);
218
135
  }
219
- //#endregion
220
- //#region src/plugin/with-i18n.ts
221
- var T = "virtual:i18n-micro/config", E = `\0${T}`, D = "virtual:i18n-micro/messages", O = `\0${D}`;
222
- function k(e) {
223
- return e.replace(/\\/g, "/");
224
- }
225
- function A(e, t, n) {
226
- let i = C({
136
+ function T(e, t, n) {
137
+ let r = v({
227
138
  rootDir: e,
228
139
  translationDir: t
229
140
  });
230
- if (i.length === 0) return "export const messages = {}\nexport const routeMessages = {}\n";
231
- let a = [], o = [], s = /* @__PURE__ */ new Map(), c = 0;
232
- for (let e of i) {
233
- let t = r(e.relativePath, n);
141
+ if (r.length === 0) return "export const messages = {}\nexport const routeMessages = {}\n";
142
+ let i = [], a = [], o = /* @__PURE__ */ new Map(), c = 0;
143
+ for (let e of r) {
144
+ let t = s(e.relativePath, n);
234
145
  if (t.type === "ignore") continue;
235
- let i = `__i18n_${c++}`;
236
- if (a.push(`import ${i} from ${JSON.stringify(k(e.absolutePath))}`), t.type === "root") {
237
- o.push(` ${JSON.stringify(t.locale)}: ${i}`);
146
+ let r = `__i18n_${c++}`;
147
+ if (i.push(`import ${r} from ${JSON.stringify(w(e.absolutePath))}`), t.type === "root") {
148
+ a.push(` ${JSON.stringify(t.locale)}: ${r}`);
238
149
  continue;
239
150
  }
240
- let l = s.get(t.pageName);
241
- l || (l = /* @__PURE__ */ new Map(), s.set(t.pageName, l)), l.set(t.locale, i);
151
+ let l = o.get(t.pageName);
152
+ l || (l = /* @__PURE__ */ new Map(), o.set(t.pageName, l)), l.set(t.locale, r);
242
153
  }
243
154
  let l = [];
244
- for (let [e, t] of s) {
155
+ for (let [e, t] of o) {
245
156
  let n = [...t.entries()].map(([e, t]) => ` ${JSON.stringify(e)}: ${t}`).join(",\n");
246
157
  l.push(` ${JSON.stringify(e)}: {\n${n}\n }`);
247
158
  }
248
159
  return [
249
- ...a,
250
- `export const messages = {\n${o.join(",\n")}\n}`,
160
+ ...i,
161
+ `export const messages = {\n${a.join(",\n")}\n}`,
251
162
  `export const routeMessages = {\n${l.join(",\n")}\n}`,
252
163
  ""
253
164
  ].join("\n");
254
165
  }
255
- function j(e, t) {
166
+ function E(e, t) {
256
167
  return [
257
168
  `export const messages = ${JSON.stringify(e)}`,
258
169
  `export const routeMessages = ${JSON.stringify(t)}`,
259
170
  ""
260
171
  ].join("\n");
261
172
  }
262
- function M(e, t) {
263
- let n = e.defaultLocale || e.locale, r = e.translationDir ?? "locales", i = e.disablePageLocales === !0, o = {
173
+ function D(e, t) {
174
+ let n = e.defaultLocale || e.locale, r = e.translationDir ?? "locales", i = e.disablePageLocales === !0, s = {
264
175
  defaultLocale: n,
265
176
  fallbackLocale: e.fallbackLocale || n,
266
177
  locales: e.locales || [],
@@ -270,30 +181,33 @@ function M(e, t) {
270
181
  translationDir: r,
271
182
  disablePageLocales: i,
272
183
  localeKeyToCode: e.localeKeyToCode ?? {},
273
- base: t && t !== "/" ? t : void 0
274
- }, s = process.cwd(), c = !!(e.messages || e.routeMessages), l = e.messages ?? {}, u = e.routeMessages ?? {}, f, p = () => !e.messages || !e.routeMessages, m = () => {
184
+ base: t && t !== "/" ? t : void 0,
185
+ numberFormats: e.numberFormats,
186
+ datetimeFormats: e.datetimeFormats,
187
+ timeZone: e.timeZone
188
+ }, c = process.cwd(), l = !!(e.messages || e.routeMessages), u = e.messages ?? {}, d = e.routeMessages ?? {}, f, p = () => !e.messages || !e.routeMessages, m = () => {
275
189
  if (!p()) return;
276
- let t = w({
277
- rootDir: s,
190
+ let t = y({
191
+ rootDir: c,
278
192
  translationDir: r,
279
193
  disablePageLocales: i
280
194
  });
281
- e.messages || (l = t.root), e.routeMessages || (u = t.routes);
195
+ e.messages || (u = t.root), e.routeMessages || (d = t.routes);
282
196
  };
283
197
  return {
284
198
  name: "vite-plugin-i18n-vitepress",
285
- configResolved(t) {
286
- s = t.root, c = !!(e.messages || e.routeMessages), c && (e.messages && (l = e.messages), e.routeMessages && (u = e.routeMessages), p() && m(), e.messages && (l = e.messages), e.routeMessages && (u = e.routeMessages));
199
+ configResolved(e) {
200
+ c = e.root, l && m();
287
201
  },
288
202
  configureServer(e) {
289
- if (c && !p()) return;
290
- let t = d(s, r);
203
+ if (l && !p()) return;
204
+ let t = o(c, r);
291
205
  if (!a(t)) return;
292
206
  e.watcher.add(t);
293
207
  let n = () => {
294
208
  f && clearTimeout(f), f = setTimeout(() => {
295
- c && m();
296
- let t = e.moduleGraph.getModuleById(O);
209
+ l && m();
210
+ let t = e.moduleGraph.getModuleById(C);
297
211
  t && (e.moduleGraph.invalidateModule(t), e.ws.send({ type: "full-reload" }));
298
212
  }, 50);
299
213
  };
@@ -301,21 +215,21 @@ function M(e, t) {
301
215
  e.startsWith(t) && e.endsWith(".json") && n();
302
216
  }), e.watcher.on("unlink", (e) => {
303
217
  e.startsWith(t) && e.endsWith(".json") && n();
304
- }), c && p() && e.watcher.on("change", (e) => {
218
+ }), l && p() && e.watcher.on("change", (e) => {
305
219
  e.startsWith(t) && e.endsWith(".json") && n();
306
220
  });
307
221
  },
308
222
  resolveId(e) {
309
- if (e === T) return E;
310
- if (e === D) return O;
223
+ if (e === b) return x;
224
+ if (e === S) return C;
311
225
  },
312
226
  load(e) {
313
- if (e === E) return `export const config = ${JSON.stringify(o)}`;
314
- if (e === O) return c ? j(l, u) : A(s, r, i);
227
+ if (e === x) return `export const config = ${JSON.stringify(s)}`;
228
+ if (e === C) return l ? E(u, d) : T(c, r, i);
315
229
  }
316
230
  };
317
231
  }
318
- function N(e, t) {
232
+ function O(e, t) {
319
233
  if (t.warnOnLocaleMismatch === !1) return;
320
234
  let n = e.locales;
321
235
  if (!n || !t.locales?.length) return;
@@ -325,53 +239,49 @@ function N(e, t) {
325
239
  a.has(n) || console.warn(`[i18n-micro/vitepress] VitePress locale key "${e}" maps to "${n}", which is not in i18n locales (${[...a].join(", ")}).`);
326
240
  }
327
241
  }
328
- function P(e, t) {
329
- N(e, t);
330
- let n = typeof e.base == "string" ? e.base : void 0, r = e.vite?.plugins, i = [...Array.isArray(r) ? r.flat() : [], M(t, n)], a = e.vite?.ssr, o = a?.noExternal, s = ["@i18n-micro/vitepress", ...Array.isArray(o) ? o : o && o !== !0 ? [o] : []], c = t.defaultLocale || t.locale, l = (t.locales || []).map((e) => e.code), u = e.themeConfig && typeof e.themeConfig == "object" ? e.themeConfig : {}, d = t.i18nRouting !== !1 && u.i18nRouting === void 0 && l.length > 0, f = t.meta ?? !!t.metaBaseUrl, p = t.locales || [], m = e.transformHead, h = e.transformPageData, g = f ? async (n) => {
331
- let r = typeof m == "function" ? await m(n) : [], i = Array.isArray(r) ? r : [];
332
- if (n.pageData?.frontmatter?.i18n?.disableMeta === !0) return i;
333
- let a = n.pageData?.relativePath || "index.md", o = (typeof e.base == "string" ? e.base : void 0) ?? n.siteData?.base ?? n.siteConfig?.site?.base, s = x({
334
- path: b(a),
335
- locales: p,
336
- defaultLocale: c,
337
- localeKeyToCode: t.localeKeyToCode,
338
- base: o,
339
- metaBaseUrl: t.metaBaseUrl,
340
- hreflangBaseLanguage: t.hreflangBaseLanguage,
341
- canonicalQueryWhitelist: t.canonicalQueryWhitelist,
342
- missingWarn: t.missingWarn
242
+ function k(e, t) {
243
+ O(e, t);
244
+ let n = typeof e.base == "string" ? e.base : void 0, r = e.vite?.plugins, i = [...Array.isArray(r) ? r.flat() : [], D(t, n)], a = e.vite?.ssr, o = a?.noExternal, s = ["@i18n-micro/vitepress", ...Array.isArray(o) ? o : o && o !== !0 ? [o] : []], c = t.defaultLocale || t.locale, l = (t.locales || []).map((e) => e.code), u = e.themeConfig && typeof e.themeConfig == "object" ? e.themeConfig : {}, d = t.i18nRouting !== !1 && u.i18nRouting === void 0 && l.length > 0, p = t.meta ?? !!t.metaBaseUrl, m = t.locales || [], _ = e.transformHead, v = e.transformPageData, y = {
245
+ locales: m,
246
+ defaultLocale: c,
247
+ localeKeyToCode: t.localeKeyToCode,
248
+ metaBaseUrl: t.metaBaseUrl,
249
+ hreflangBaseLanguage: t.hreflangBaseLanguage,
250
+ canonicalQueryWhitelist: t.canonicalQueryWhitelist,
251
+ missingWarn: t.missingWarn
252
+ }, b = p ? async (t) => {
253
+ let n = typeof _ == "function" ? await _(t) : [], r = Array.isArray(n) ? n : [];
254
+ if (t.pageData?.frontmatter?.i18n?.disableMeta === !0) return r;
255
+ let i = t.pageData?.relativePath || "index.md", a = (typeof e.base == "string" ? e.base : void 0) ?? t.siteData?.base ?? t.siteConfig?.site?.base, o = g({
256
+ ...y,
257
+ path: h(i),
258
+ base: a
343
259
  });
344
- return [...i, ...s.head];
345
- } : m, v = f ? async (n, r) => {
346
- if (typeof h == "function" && await h(n, r), n.frontmatter?.i18n?.disableMeta === !0) return;
347
- let i = x({
348
- path: b(n.relativePath || "index.md"),
349
- locales: p,
350
- defaultLocale: c,
351
- localeKeyToCode: t.localeKeyToCode,
260
+ return [...r, ...o.head];
261
+ } : _, x = p ? async (t, n) => {
262
+ if (typeof v == "function" && await v(t, n), t.frontmatter?.i18n?.disableMeta === !0) return;
263
+ let r = g({
264
+ ...y,
265
+ path: h(t.relativePath || "index.md"),
352
266
  base: typeof e.base == "string" ? e.base : void 0,
353
- metaBaseUrl: t.metaBaseUrl,
354
- hreflangBaseLanguage: t.hreflangBaseLanguage,
355
- canonicalQueryWhitelist: t.canonicalQueryWhitelist,
356
- missingWarn: t.missingWarn,
357
267
  addSeoAttributes: !1
358
268
  });
359
- i.htmlAttrs.lang && (n.frontmatter ??= {}, n.frontmatter.lang || (n.frontmatter.lang = i.htmlAttrs.lang));
360
- } : h;
269
+ r.htmlAttrs.lang && (t.frontmatter ??= {}, t.frontmatter.lang || (t.frontmatter.lang = r.htmlAttrs.lang));
270
+ } : v;
361
271
  return {
362
272
  ...e,
363
273
  ...d ? { themeConfig: {
364
274
  ...u,
365
- i18nRouting: _({
275
+ i18nRouting: f({
366
276
  defaultLocale: c,
367
277
  localeCodes: l,
368
278
  localeKeyToCode: t.localeKeyToCode,
369
279
  base: n
370
280
  })
371
281
  } } : {},
372
- ...f ? {
373
- transformHead: g,
374
- transformPageData: v
282
+ ...p ? {
283
+ transformHead: b,
284
+ transformPageData: x
375
285
  } : {},
376
286
  vite: {
377
287
  ...e.vite,
@@ -383,7 +293,6 @@ function P(e, t) {
383
293
  }
384
294
  };
385
295
  }
386
- //#endregion
387
- export { x as buildVitePressLocaleHead, n as buildVitePressLocales, b as relativePathToRoutePath, N as warnLocaleMismatch, P as withI18n };
296
+ export { g as buildVitePressLocaleHead, n as buildVitePressLocales, h as relativePathToRoutePath, O as warnLocaleMismatch, k as withI18n };
388
297
 
389
298
  //# sourceMappingURL=config.mjs.map