@i18n-micro/route-strategy 1.1.18 → 1.1.23
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/index.cjs +1 -1
- package/dist/index.mjs +552 -850
- package/dist/utils/common.d.ts +1 -1
- package/package.json +9 -8
package/dist/index.mjs
CHANGED
|
@@ -1,871 +1,573 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
for (const t of Q)
|
|
19
|
-
if (t.test(l))
|
|
20
|
-
return !0;
|
|
21
|
-
if (e) {
|
|
22
|
-
for (const t of e)
|
|
23
|
-
if (typeof t == "string") {
|
|
24
|
-
if (t.includes("*") || t.includes("?")) {
|
|
25
|
-
if (new RegExp(t.replace(/\*/g, ".*").replace(/\?/g, ".")).test(l)) return !0;
|
|
26
|
-
} else if (l === t || l.startsWith(t))
|
|
27
|
-
return !0;
|
|
28
|
-
} else if (t instanceof RegExp && t.test(l))
|
|
29
|
-
return !0;
|
|
30
|
-
}
|
|
31
|
-
return !1;
|
|
1
|
+
import { isInternalPath as e } from "@i18n-micro/utils/app-path";
|
|
2
|
+
import t from "node:path";
|
|
3
|
+
import { existsSync as n, mkdirSync as r, writeFileSync as i } from "node:fs";
|
|
4
|
+
import { isPrefixAndDefaultStrategy as a, isPrefixStrategy as o } from "@i18n-micro/core";
|
|
5
|
+
//#region src/utils/common.ts
|
|
6
|
+
var s = (e) => e.map((e) => ({ ...e })), c = (e) => !(!e.redirect || e.file), l = (e, t, n, r = "localized-") => n ? `${r}${e}-${t}` : `${r}${e}`, u = (e, t) => e ?? (t ?? "").replace(/[^a-z0-9]/gi, "-").replace(/^-+|-+$/g, ""), d = (e, t, n) => n && e !== t.code, f = (e, t) => (typeof e == "string" ? e : e.code) === t.code;
|
|
7
|
+
//#endregion
|
|
8
|
+
//#region src/utils/locales.ts
|
|
9
|
+
function p(e, t) {
|
|
10
|
+
let n = e.reduce((e, t) => {
|
|
11
|
+
let n = e.find((e) => e.code === t.code);
|
|
12
|
+
return n ? Object.assign(n, t) : e.push(t), e;
|
|
13
|
+
}, []).filter((e) => !e.disabled);
|
|
14
|
+
return {
|
|
15
|
+
locales: n,
|
|
16
|
+
defaultLocale: n.find((e) => e.code === t) ?? { code: t }
|
|
17
|
+
};
|
|
32
18
|
}
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
}, []).filter((o) => !o.disabled), a = t.find((o) => o.code === e) ?? { code: e };
|
|
38
|
-
return { locales: t, defaultLocale: a };
|
|
19
|
+
//#endregion
|
|
20
|
+
//#region src/utils/path.ts
|
|
21
|
+
function m(e) {
|
|
22
|
+
return e.split("/").map((e) => e.startsWith("[...") && e.endsWith("]") ? `:${e.substring(4, e.length - 1)}(.*)*` : e.startsWith("[") && e.endsWith("]") ? `:${e.substring(1, e.length - 1)}` : e.replace(/:([^()/]+)\(\)/g, ":$1")).join("/");
|
|
39
23
|
}
|
|
40
|
-
|
|
41
|
-
|
|
24
|
+
var h = (e) => {
|
|
25
|
+
if (!e) return "";
|
|
26
|
+
let n = t.posix.normalize(e).replace(/\/+$/, "");
|
|
27
|
+
return n === "." ? "" : n;
|
|
28
|
+
}, g = (e) => e.startsWith("/") ? e.slice(1) : e;
|
|
29
|
+
function _(...e) {
|
|
30
|
+
return t.posix.join(...e);
|
|
42
31
|
}
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
return "";
|
|
46
|
-
const e = w.posix.normalize(l).replace(/\/+$/, "");
|
|
47
|
-
return e === "." ? "" : e;
|
|
48
|
-
}, z = (l) => l.startsWith("/") ? l.slice(1) : l;
|
|
49
|
-
function G(...l) {
|
|
50
|
-
return w.posix.join(...l);
|
|
32
|
+
function v(e) {
|
|
33
|
+
if (e !== void 0) return e.startsWith("/") && e.endsWith("/") ? e?.slice(1, -1) : e;
|
|
51
34
|
}
|
|
52
|
-
function
|
|
53
|
-
|
|
54
|
-
return l.startsWith("/") && l.endsWith("/") ? l?.slice(1, -1) : l;
|
|
35
|
+
function y(e) {
|
|
36
|
+
return e;
|
|
55
37
|
}
|
|
56
|
-
function
|
|
57
|
-
|
|
38
|
+
function b(e) {
|
|
39
|
+
return !e || !/[\u0080-\uFFFF]/.test(e) ? e : e.split("/").map((e) => !e || e.startsWith(":") || !/[\u0080-\uFFFF]/.test(e) ? e : encodeURI(e)).join("/");
|
|
58
40
|
}
|
|
59
|
-
function
|
|
60
|
-
|
|
61
|
-
|
|
41
|
+
function x(e) {
|
|
42
|
+
let t = b(e);
|
|
43
|
+
return t === e ? [] : [t];
|
|
62
44
|
}
|
|
63
|
-
function
|
|
64
|
-
|
|
65
|
-
|
|
45
|
+
function S(e, n, r) {
|
|
46
|
+
let i = v(r?.toString()) || (Array.isArray(e) ? e.join("|") : e), a = y(n);
|
|
47
|
+
return h(t.posix.join("/", `:locale(${i})`, a));
|
|
66
48
|
}
|
|
67
|
-
function
|
|
68
|
-
|
|
69
|
-
return R(e);
|
|
49
|
+
function C(e) {
|
|
50
|
+
return h(y(e));
|
|
70
51
|
}
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
52
|
+
//#endregion
|
|
53
|
+
//#region src/core/localized-paths.ts
|
|
54
|
+
var w = (e, t) => e ?? (t ?? "").replace(/[^a-z0-9]/gi, "-").replace(/^-+|-+$/g, "");
|
|
55
|
+
function T(e) {
|
|
56
|
+
return g(e) || "/";
|
|
74
57
|
}
|
|
75
|
-
function
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
}), o;
|
|
58
|
+
function E(e, t, n, r = "") {
|
|
59
|
+
let i = {};
|
|
60
|
+
return e.forEach((e) => {
|
|
61
|
+
let a = w(e.name, e.path), o = h(_(r, e.path ?? "")), s = T(o), c = m(o), l = g(c) || "/", u = t[s] || t[c] || t[l] || t[a];
|
|
62
|
+
if (u) typeof u == "object" && (i[s] = u);
|
|
63
|
+
else {
|
|
64
|
+
let e = n[a];
|
|
65
|
+
e && typeof e == "object" && !Array.isArray(e) && (i[s] = e);
|
|
66
|
+
}
|
|
67
|
+
if (e.children?.length) {
|
|
68
|
+
let a = h(_(r, e.path ?? ""));
|
|
69
|
+
Object.assign(i, E(e.children, t, n, a));
|
|
70
|
+
}
|
|
71
|
+
}), i;
|
|
90
72
|
}
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
73
|
+
//#endregion
|
|
74
|
+
//#region src/core/localization-disabled.ts
|
|
75
|
+
function D(e, t, n) {
|
|
76
|
+
let r = m(t), i = T(t);
|
|
77
|
+
return e[n] === !1 || e[r] === !1 || e[i] === !1 || e[g(r)] === !1;
|
|
94
78
|
}
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
79
|
+
//#endregion
|
|
80
|
+
//#region src/locale-route-access.ts
|
|
81
|
+
function O(e, t, n, r) {
|
|
82
|
+
if (!e || Object.keys(e).length === 0) return !0;
|
|
83
|
+
let i = m(n), a = g(i) || "/", o = a === "/" ? "/" : a, s = e[i] ?? e[n] ?? e[a] ?? e[o] ?? (a === "/" ? void 0 : e[`/${a}`]);
|
|
84
|
+
if (!Array.isArray(s) || s.length === 0) return !0;
|
|
85
|
+
let c = t.map((e) => e.code), l = s.filter((e) => c.includes(e));
|
|
86
|
+
return l.length === 0 || l.includes(r);
|
|
103
87
|
}
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
88
|
+
//#endregion
|
|
89
|
+
//#region src/core/context.ts
|
|
90
|
+
function k(e) {
|
|
91
|
+
let t = {};
|
|
92
|
+
if (!e) return t;
|
|
93
|
+
for (let n in e) {
|
|
94
|
+
let r = m(n), i = e[n];
|
|
95
|
+
if (typeof i == "object") {
|
|
96
|
+
let e = {};
|
|
97
|
+
for (let t in i) {
|
|
98
|
+
let n = i[t];
|
|
99
|
+
n && (e[t] = m(n));
|
|
100
|
+
}
|
|
101
|
+
t[r] = e;
|
|
102
|
+
} else t[r] = i;
|
|
103
|
+
}
|
|
104
|
+
return t;
|
|
120
105
|
}
|
|
121
|
-
class
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
const t = F(e);
|
|
154
|
-
return this.activeLocaleCodes.filter((a) => !this.localizedPaths[t]?.[a]);
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
function y(l, e) {
|
|
158
|
-
const t = (e ?? "").trim();
|
|
159
|
-
return t.startsWith("/") ? R(t) : R(w.posix.join(l || "", t));
|
|
160
|
-
}
|
|
161
|
-
function g(l, e) {
|
|
162
|
-
const { path: t, name: a, children: o, meta: s, alias: r } = e, i = {
|
|
163
|
-
...l,
|
|
164
|
-
path: t
|
|
165
|
-
};
|
|
166
|
-
return a !== void 0 && (i.name = a), o !== void 0 && (i.children = o), s !== void 0 && (i.meta = { ...l.meta, ...s }), r !== void 0 ? (i.alias = r, i.meta = { ...i.meta, alias: r }) : "alias" in e && (i.alias = void 0, i.meta = { ...i.meta, alias: void 0 }), i;
|
|
167
|
-
}
|
|
168
|
-
function le(l) {
|
|
169
|
-
const e = l.alias, t = l.meta?.alias, a = e ?? t;
|
|
170
|
-
return Array.isArray(a) ? a : [];
|
|
171
|
-
}
|
|
172
|
-
function W(l, e, t, a = "localized-") {
|
|
173
|
-
const o = le(l);
|
|
174
|
-
if (!o.length) return [];
|
|
175
|
-
const s = [];
|
|
176
|
-
for (const r of o) {
|
|
177
|
-
const i = x(e, r, t);
|
|
178
|
-
s.push(
|
|
179
|
-
g(l, {
|
|
180
|
-
path: i,
|
|
181
|
-
name: `${a}${l.name ?? ""}`,
|
|
182
|
-
alias: void 0,
|
|
183
|
-
meta: { alias: void 0 },
|
|
184
|
-
// Important: if the source page has children, the alias route
|
|
185
|
-
// must keep the same children tree so that /alias/child does not 404.
|
|
186
|
-
// createRoute takes care of cloning/adjusting children correctly.
|
|
187
|
-
children: l.children
|
|
188
|
-
})
|
|
189
|
-
);
|
|
190
|
-
}
|
|
191
|
-
return s;
|
|
192
|
-
}
|
|
193
|
-
class k {
|
|
194
|
-
processPage(e, t) {
|
|
195
|
-
if (e.path === void 0)
|
|
196
|
-
throw new Error("page.path is required");
|
|
197
|
-
if (q(e))
|
|
198
|
-
return [e];
|
|
199
|
-
if (e.path && M(e.path, t.excludePatterns))
|
|
200
|
-
return [e];
|
|
201
|
-
const a = e.path ?? "", o = b(e.name, e.path);
|
|
202
|
-
return S(t.globalLocaleRoutes, a, o) ? [e] : this.generateVariants(e, t);
|
|
203
|
-
}
|
|
204
|
-
postProcess(e, t) {
|
|
205
|
-
return e;
|
|
206
|
-
}
|
|
207
|
-
/**
|
|
208
|
-
* Recursive localization for children: for a given locale, builds:
|
|
209
|
-
* - parentOriginalPath used for Context lookups,
|
|
210
|
-
* - parentLocalizedPath used for the final path,
|
|
211
|
-
* and returns an array of localized child routes.
|
|
212
|
-
*/
|
|
213
|
-
localizeChildren(e, t, a, o, s, r) {
|
|
214
|
-
return e.flatMap((i) => this.localizeChild(i, t, a, o, s, r));
|
|
215
|
-
}
|
|
216
|
-
/**
|
|
217
|
-
* Variant for a single route with :locale(locale1|locale2) — without custom paths.
|
|
218
|
-
* Returns a single child route with a relative path and recursively localized children.
|
|
219
|
-
*/
|
|
220
|
-
localizeChildrenAllLocales(e, t, a, o, s) {
|
|
221
|
-
return e.flatMap((r) => this.localizeChildAllLocales(r, t, a, o, s));
|
|
222
|
-
}
|
|
223
|
-
localizeChildAllLocales(e, t, a, o, s) {
|
|
224
|
-
const r = y(a, e.path ?? ""), i = b(e.name, e.path);
|
|
225
|
-
if (S(s.globalLocaleRoutes, r, i))
|
|
226
|
-
return [e];
|
|
227
|
-
const n = y(t, e.path ?? ""), f = F(n), u = s.localizedPaths[f];
|
|
228
|
-
if (u)
|
|
229
|
-
return o.flatMap((P) => {
|
|
230
|
-
const p = u[P] ?? y(t, e.path ?? "");
|
|
231
|
-
return this.localizeChild(e, p, a, P, s, !0);
|
|
232
|
-
});
|
|
233
|
-
const h = R(e.path ?? ""), c = z(h), m = this.localizeChildrenAllLocales($(e.children ?? []), n, r, o, s), d = `${s.localizedRouteNamePrefix}${e.name ?? ""}`;
|
|
234
|
-
return [
|
|
235
|
-
g(e, {
|
|
236
|
-
path: c,
|
|
237
|
-
name: d,
|
|
238
|
-
children: m
|
|
239
|
-
})
|
|
240
|
-
];
|
|
241
|
-
}
|
|
242
|
-
localizeChild(e, t, a, o, s, r) {
|
|
243
|
-
const i = y(a, e.path ?? ""), n = b(e.name, e.path);
|
|
244
|
-
if (S(s.globalLocaleRoutes, i, n))
|
|
245
|
-
return [e];
|
|
246
|
-
const f = s.getCustomPath(i, o), u = z(R(f || (e.path ?? ""))), h = f ?? y(t, e.path ?? ""), c = this.localizeChildren($(e.children ?? []), h, i, o, s, r), m = b(e.name, e.path), d = `${s.localizedRouteNamePrefix}${m}-${o}`;
|
|
247
|
-
return [
|
|
248
|
-
g(e, {
|
|
249
|
-
path: u,
|
|
250
|
-
name: d,
|
|
251
|
-
children: c
|
|
252
|
-
})
|
|
253
|
-
];
|
|
254
|
-
}
|
|
255
|
-
/**
|
|
256
|
-
* Shared helper for strategies that build prefix-based paths (:locale(...)):
|
|
257
|
-
* - for custom paths, decides whether a prefix is required,
|
|
258
|
-
* - for regular paths, always uses buildFullPath.
|
|
259
|
-
*
|
|
260
|
-
* The logic matches what used to be duplicated in each strategy's buildRoutePath.
|
|
261
|
-
*/
|
|
262
|
-
buildRoutePathForLocales(e, t, a, o, s, r, i) {
|
|
263
|
-
if (o) {
|
|
264
|
-
const n = e.includes(i);
|
|
265
|
-
return r || !n ? x(e, a, s) : R(a);
|
|
266
|
-
}
|
|
267
|
-
return x(e, t, s);
|
|
268
|
-
}
|
|
269
|
-
}
|
|
270
|
-
class ie extends k {
|
|
271
|
-
generateVariants(e, t) {
|
|
272
|
-
const a = e.path ?? "", o = b(e.name, e.path), s = t.getAllowedLocales(a, o), r = t.getCustomPathsForPage(a, o), i = $(e.children ?? []), n = [];
|
|
273
|
-
if (n.push(e), r)
|
|
274
|
-
for (const f of s) {
|
|
275
|
-
const u = r[f];
|
|
276
|
-
if (!u) continue;
|
|
277
|
-
const h = R(u), c = R(a);
|
|
278
|
-
if (h === c)
|
|
279
|
-
continue;
|
|
280
|
-
const m = te(u), d = j(o, f, !0), P = this.localizeChildrenForNoPrefix(i, h, a, a, f, t, 1);
|
|
281
|
-
n.push(
|
|
282
|
-
g(e, {
|
|
283
|
-
path: m,
|
|
284
|
-
name: d,
|
|
285
|
-
children: P,
|
|
286
|
-
alias: [],
|
|
287
|
-
meta: { alias: [] }
|
|
288
|
-
})
|
|
289
|
-
), t.noPrefixRedirect && f === t.defaultLocale.code && h !== c && (e.redirect = h);
|
|
290
|
-
}
|
|
291
|
-
return n.push(...W(e, s, t.customRegex, t.localizedRouteNamePrefix)), n;
|
|
292
|
-
}
|
|
293
|
-
/**
|
|
294
|
-
* Localizes the children tree for the no_prefix strategy.
|
|
295
|
-
* Mirrors the behavior of the legacy RouteGenerator:
|
|
296
|
-
* - on the first level, custom paths (globalLocaleRoutes/filesLocaleRoutes) are applied;
|
|
297
|
-
* - on deeper levels, path stays as a segment (item, detail, etc.).
|
|
298
|
-
*/
|
|
299
|
-
localizeChildrenForNoPrefix(e, t, a, o, s, r, i) {
|
|
300
|
-
return e.map((n) => {
|
|
301
|
-
const f = y(a, n.path ?? "");
|
|
302
|
-
let u, h;
|
|
303
|
-
if (i === 1) {
|
|
304
|
-
const P = r.getCustomPath(f, s);
|
|
305
|
-
if (P) {
|
|
306
|
-
const p = R(P);
|
|
307
|
-
u = z(p), h = p;
|
|
308
|
-
} else {
|
|
309
|
-
const p = R(n.path ?? "");
|
|
310
|
-
u = z(p), h = y(t, n.path ?? "");
|
|
311
|
-
}
|
|
312
|
-
} else {
|
|
313
|
-
const P = R(n.path ?? "");
|
|
314
|
-
u = z(P), h = y(t, n.path ?? "");
|
|
315
|
-
}
|
|
316
|
-
const c = this.localizeChildrenForNoPrefix(
|
|
317
|
-
$(n.children ?? []),
|
|
318
|
-
h,
|
|
319
|
-
f,
|
|
320
|
-
o,
|
|
321
|
-
s,
|
|
322
|
-
r,
|
|
323
|
-
i + 1
|
|
324
|
-
), m = b(n.name, n.path), d = j(m, s, !0);
|
|
325
|
-
return g(n, {
|
|
326
|
-
path: u,
|
|
327
|
-
name: d,
|
|
328
|
-
children: c
|
|
329
|
-
});
|
|
330
|
-
});
|
|
331
|
-
}
|
|
332
|
-
}
|
|
333
|
-
function re(l) {
|
|
334
|
-
const e = l.alias ?? l.meta?.alias;
|
|
335
|
-
return Array.isArray(e) ? e : [];
|
|
106
|
+
var A = class {
|
|
107
|
+
constructor(e) {
|
|
108
|
+
this.locales = e.locales, this.defaultLocale = this.findLocaleByCode(e.locales, e.defaultLocaleCode) ?? { code: e.defaultLocaleCode }, this.strategy = e.strategy, this.globalLocaleRoutes = k(e.globalLocaleRoutes ?? {}), this.filesLocaleRoutes = e.filesLocaleRoutes ?? {}, this.routeLocales = e.routeLocales ?? {}, this.localizedPaths = E(e.pages, this.globalLocaleRoutes, this.filesLocaleRoutes), this.activeLocaleCodes = this.locales.filter((e) => e.code !== this.defaultLocale.code || a(this.strategy) || o(this.strategy)).map((e) => e.code), this.excludePatterns = e.excludePatterns, this.customRegex = e.customRegex, this.noPrefixRedirect = e.noPrefixRedirect ?? !1, this.localizedRouteNamePrefix = e.localizedRouteNamePrefix ?? "localized-", this.fallbackRedirectComponentPath = e.fallbackRedirectComponentPath, this.rawGlobalLocaleRoutes = e.rawGlobalLocaleRoutes;
|
|
109
|
+
}
|
|
110
|
+
findLocaleByCode(e, t) {
|
|
111
|
+
return e.find((e) => e.code === t);
|
|
112
|
+
}
|
|
113
|
+
getAllowedLocales(e, t) {
|
|
114
|
+
let n = this.routeLocales[e] ?? this.routeLocales[t];
|
|
115
|
+
return n?.length ? n.filter((e) => this.locales.some((t) => t.code === e)) : this.locales.map((e) => e.code);
|
|
116
|
+
}
|
|
117
|
+
getCustomPath(e, t) {
|
|
118
|
+
let n = T(e);
|
|
119
|
+
return this.localizedPaths[n]?.[t];
|
|
120
|
+
}
|
|
121
|
+
getCustomPathsForPage(e, t) {
|
|
122
|
+
let n = T(e);
|
|
123
|
+
return this.localizedPaths[n] ?? this.localizedPaths[t];
|
|
124
|
+
}
|
|
125
|
+
hasLocaleRestrictions(e, t) {
|
|
126
|
+
return !!(this.routeLocales[e] ?? this.routeLocales[t]);
|
|
127
|
+
}
|
|
128
|
+
filterLocaleCodesWithoutCustomPaths(e) {
|
|
129
|
+
let t = T(e);
|
|
130
|
+
return this.activeLocaleCodes.filter((e) => !this.localizedPaths[t]?.[e]);
|
|
131
|
+
}
|
|
132
|
+
};
|
|
133
|
+
//#endregion
|
|
134
|
+
//#region src/core/builder.ts
|
|
135
|
+
function j(e, n) {
|
|
136
|
+
let r = (n ?? "").trim();
|
|
137
|
+
return r.startsWith("/") ? h(r) : h(t.posix.join(e || "", r));
|
|
336
138
|
}
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
}
|
|
353
|
-
else {
|
|
354
|
-
const u = x(s, a, t.customRegex), h = j(o, s[0], !1, t.localizedRouteNamePrefix), c = this.localizeChildrenAllLocales(i, a, a, s, t);
|
|
355
|
-
n.push(
|
|
356
|
-
g(e, {
|
|
357
|
-
path: u,
|
|
358
|
-
name: h,
|
|
359
|
-
children: c,
|
|
360
|
-
alias: [],
|
|
361
|
-
meta: { alias: [] }
|
|
362
|
-
})
|
|
363
|
-
);
|
|
364
|
-
}
|
|
365
|
-
const f = re(e);
|
|
366
|
-
if (f.length)
|
|
367
|
-
for (const u of f) {
|
|
368
|
-
const h = x(s, u, t.customRegex);
|
|
369
|
-
n.push(
|
|
370
|
-
g(e, {
|
|
371
|
-
path: h,
|
|
372
|
-
name: `${t.localizedRouteNamePrefix}${e.name ?? ""}`,
|
|
373
|
-
alias: void 0,
|
|
374
|
-
meta: { alias: void 0 }
|
|
375
|
-
})
|
|
376
|
-
);
|
|
377
|
-
}
|
|
378
|
-
return n;
|
|
379
|
-
}
|
|
380
|
-
postProcess(e, t) {
|
|
381
|
-
const a = e.filter((s) => {
|
|
382
|
-
if (s.name === "index" && s.path === "/") return !1;
|
|
383
|
-
const r = s.path ?? "";
|
|
384
|
-
return !!(r && M(r, t.excludePatterns) || S(t.globalLocaleRoutes, r, s.name ?? "") || /^\/:locale/.test(r) || r === "/");
|
|
385
|
-
}), o = t.defaultLocale.code;
|
|
386
|
-
for (const [s, r] of Object.entries(t.globalLocaleRoutes)) {
|
|
387
|
-
if (r === !1 || typeof r != "object") continue;
|
|
388
|
-
const i = r[o];
|
|
389
|
-
if (!i) continue;
|
|
390
|
-
const n = s.startsWith("/") ? s : `/${s}`, f = `/${o}${i.startsWith("/") ? i : `/${i}`}`;
|
|
391
|
-
n !== f && a.push({
|
|
392
|
-
path: n,
|
|
393
|
-
name: `redirect-${s.replace(/\//g, "-")}`,
|
|
394
|
-
redirect: f
|
|
395
|
-
});
|
|
396
|
-
}
|
|
397
|
-
return t.fallbackRedirectComponentPath && a.push({
|
|
398
|
-
path: "/:pathMatch(.*)*",
|
|
399
|
-
name: "custom-fallback-route",
|
|
400
|
-
file: t.fallbackRedirectComponentPath,
|
|
401
|
-
meta: {
|
|
402
|
-
globalLocaleRoutes: t.rawGlobalLocaleRoutes ?? t.globalLocaleRoutes
|
|
403
|
-
}
|
|
404
|
-
}), a;
|
|
405
|
-
}
|
|
139
|
+
function M(e, t) {
|
|
140
|
+
let { path: n, name: r, children: i, meta: a, alias: o } = t, s = {
|
|
141
|
+
...e,
|
|
142
|
+
path: n
|
|
143
|
+
};
|
|
144
|
+
return r !== void 0 && (s.name = r), i !== void 0 && (s.children = i), a !== void 0 && (s.meta = {
|
|
145
|
+
...e.meta,
|
|
146
|
+
...a
|
|
147
|
+
}), o === void 0 ? "alias" in t && (s.alias = void 0, s.meta = {
|
|
148
|
+
...s.meta,
|
|
149
|
+
alias: void 0
|
|
150
|
+
}) : (s.alias = o, s.meta = {
|
|
151
|
+
...s.meta,
|
|
152
|
+
alias: o
|
|
153
|
+
}), s;
|
|
406
154
|
}
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
if (u.length > 0)
|
|
413
|
-
if (r)
|
|
414
|
-
for (const c of u) {
|
|
415
|
-
const m = r[c.code];
|
|
416
|
-
if (m)
|
|
417
|
-
if (c.code === f) {
|
|
418
|
-
const d = this.createLocalizedRoute(
|
|
419
|
-
e,
|
|
420
|
-
[c.code],
|
|
421
|
-
i,
|
|
422
|
-
!0,
|
|
423
|
-
m,
|
|
424
|
-
t.customRegex,
|
|
425
|
-
!1,
|
|
426
|
-
c.code,
|
|
427
|
-
a,
|
|
428
|
-
t
|
|
429
|
-
);
|
|
430
|
-
d && n.push(d);
|
|
431
|
-
const P = this.createLocalizedRoute(
|
|
432
|
-
e,
|
|
433
|
-
[c.code],
|
|
434
|
-
i,
|
|
435
|
-
!0,
|
|
436
|
-
m,
|
|
437
|
-
t.customRegex,
|
|
438
|
-
!0,
|
|
439
|
-
c.code,
|
|
440
|
-
a,
|
|
441
|
-
t
|
|
442
|
-
);
|
|
443
|
-
P && n.push(P);
|
|
444
|
-
} else {
|
|
445
|
-
const d = this.createLocalizedRoute(
|
|
446
|
-
e,
|
|
447
|
-
[c.code],
|
|
448
|
-
i,
|
|
449
|
-
!0,
|
|
450
|
-
m,
|
|
451
|
-
t.customRegex,
|
|
452
|
-
!1,
|
|
453
|
-
c.code,
|
|
454
|
-
a,
|
|
455
|
-
t
|
|
456
|
-
);
|
|
457
|
-
d && n.push(d);
|
|
458
|
-
}
|
|
459
|
-
else {
|
|
460
|
-
const d = this.createLocalizedRoute(
|
|
461
|
-
e,
|
|
462
|
-
[c.code],
|
|
463
|
-
i,
|
|
464
|
-
!1,
|
|
465
|
-
"",
|
|
466
|
-
t.customRegex,
|
|
467
|
-
!1,
|
|
468
|
-
c.code,
|
|
469
|
-
a,
|
|
470
|
-
t
|
|
471
|
-
);
|
|
472
|
-
d && n.push(d);
|
|
473
|
-
}
|
|
474
|
-
}
|
|
475
|
-
else {
|
|
476
|
-
const c = u.map((d) => d.code), m = this.createLocalizedRoute(
|
|
477
|
-
e,
|
|
478
|
-
c,
|
|
479
|
-
i,
|
|
480
|
-
!1,
|
|
481
|
-
"",
|
|
482
|
-
t.customRegex,
|
|
483
|
-
!1,
|
|
484
|
-
!0,
|
|
485
|
-
a,
|
|
486
|
-
t
|
|
487
|
-
);
|
|
488
|
-
m && n.push(m);
|
|
489
|
-
}
|
|
490
|
-
const h = W(e, s, t.customRegex, t.localizedRouteNamePrefix);
|
|
491
|
-
return h.length && n.push(...h), n;
|
|
492
|
-
}
|
|
493
|
-
postProcess(e, t) {
|
|
494
|
-
const a = [], o = [];
|
|
495
|
-
for (const s of e) {
|
|
496
|
-
const r = s.name ?? "";
|
|
497
|
-
typeof r == "string" && r.startsWith(t.localizedRouteNamePrefix) ? o.push(s) : a.push(s);
|
|
498
|
-
}
|
|
499
|
-
return [...a, ...o];
|
|
500
|
-
}
|
|
501
|
-
createLocalizedRoute(e, t, a, o, s = "", r, i = !1, n = !1, f, u) {
|
|
502
|
-
const h = this.buildRoutePathForLocales(
|
|
503
|
-
t,
|
|
504
|
-
e.path ?? "",
|
|
505
|
-
s,
|
|
506
|
-
o,
|
|
507
|
-
r,
|
|
508
|
-
i,
|
|
509
|
-
u.defaultLocale.code
|
|
510
|
-
);
|
|
511
|
-
if (!h || !(o && s) && h === e.path || t.length === 0) return null;
|
|
512
|
-
const m = t[0];
|
|
513
|
-
if (!m) return null;
|
|
514
|
-
const d = f ?? e.path ?? "", P = j(
|
|
515
|
-
b(e.name ?? "", d),
|
|
516
|
-
m,
|
|
517
|
-
o,
|
|
518
|
-
u.localizedRouteNamePrefix
|
|
519
|
-
), p = i || m !== u.defaultLocale.code, L = t.length === 1 ? this.localizeChildren(a, h, d, m, u, p) : this.localizeChildrenAllLocales(a, h, d, t, u);
|
|
520
|
-
return g(e, {
|
|
521
|
-
path: h,
|
|
522
|
-
name: P,
|
|
523
|
-
children: L,
|
|
524
|
-
alias: [],
|
|
525
|
-
meta: { alias: [] }
|
|
526
|
-
});
|
|
527
|
-
}
|
|
155
|
+
//#endregion
|
|
156
|
+
//#region src/core/alias.ts
|
|
157
|
+
function N(e) {
|
|
158
|
+
let t = e.alias, n = e.meta?.alias, r = t ?? n;
|
|
159
|
+
return Array.isArray(r) ? r : [];
|
|
528
160
|
}
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
g(e, {
|
|
545
|
-
path: m,
|
|
546
|
-
name: e.name,
|
|
547
|
-
children: P
|
|
548
|
-
})
|
|
549
|
-
);
|
|
550
|
-
}
|
|
551
|
-
const u = t.locales.filter((c) => s.includes(c.code) && c.code !== f);
|
|
552
|
-
if (u.length)
|
|
553
|
-
if (r)
|
|
554
|
-
for (const c of u) {
|
|
555
|
-
const m = r[c.code];
|
|
556
|
-
if (m) {
|
|
557
|
-
const d = this.createLocalizedRoute(
|
|
558
|
-
e,
|
|
559
|
-
[c.code],
|
|
560
|
-
i,
|
|
561
|
-
!0,
|
|
562
|
-
m,
|
|
563
|
-
t.customRegex,
|
|
564
|
-
!1,
|
|
565
|
-
c.code,
|
|
566
|
-
a,
|
|
567
|
-
t
|
|
568
|
-
);
|
|
569
|
-
d && n.push(d);
|
|
570
|
-
} else {
|
|
571
|
-
const d = this.createLocalizedRoute(
|
|
572
|
-
e,
|
|
573
|
-
[c.code],
|
|
574
|
-
i,
|
|
575
|
-
!1,
|
|
576
|
-
"",
|
|
577
|
-
t.customRegex,
|
|
578
|
-
!1,
|
|
579
|
-
c.code,
|
|
580
|
-
a,
|
|
581
|
-
t
|
|
582
|
-
);
|
|
583
|
-
d && n.push(d);
|
|
584
|
-
}
|
|
585
|
-
}
|
|
586
|
-
else {
|
|
587
|
-
const c = u.map((d) => d.code), m = this.createLocalizedRoute(
|
|
588
|
-
e,
|
|
589
|
-
c,
|
|
590
|
-
i,
|
|
591
|
-
!1,
|
|
592
|
-
"",
|
|
593
|
-
t.customRegex,
|
|
594
|
-
!1,
|
|
595
|
-
!0,
|
|
596
|
-
a,
|
|
597
|
-
t
|
|
598
|
-
);
|
|
599
|
-
m && n.push(m);
|
|
600
|
-
}
|
|
601
|
-
const h = W(e, s, t.customRegex, t.localizedRouteNamePrefix);
|
|
602
|
-
return h.length && n.push(...h), n;
|
|
603
|
-
}
|
|
604
|
-
postProcess(e, t) {
|
|
605
|
-
const a = [], o = [];
|
|
606
|
-
for (const r of e) {
|
|
607
|
-
const i = r.name ?? "";
|
|
608
|
-
typeof i == "string" && i.startsWith(t.localizedRouteNamePrefix) ? o.push(r) : a.push(r);
|
|
609
|
-
}
|
|
610
|
-
const s = [...a, ...o];
|
|
611
|
-
return t.fallbackRedirectComponentPath && s.push({
|
|
612
|
-
path: "/:pathMatch(.*)*",
|
|
613
|
-
name: "custom-fallback-route",
|
|
614
|
-
file: t.fallbackRedirectComponentPath,
|
|
615
|
-
meta: {
|
|
616
|
-
globalLocaleRoutes: t.rawGlobalLocaleRoutes ?? t.globalLocaleRoutes
|
|
617
|
-
}
|
|
618
|
-
}), s;
|
|
619
|
-
}
|
|
620
|
-
createLocalizedChildren(e, t, a, o = !0, s = !1, r = !1, i = {}, n) {
|
|
621
|
-
return e.flatMap(
|
|
622
|
-
(f) => this.createLocalizedVariants(f, t, a, o, s, r, i, n)
|
|
623
|
-
);
|
|
624
|
-
}
|
|
625
|
-
createLocalizedVariants(e, t, a, o, s, r = !1, i, n) {
|
|
626
|
-
const f = R(e.path ?? ""), u = y(t, e.path ?? ""), h = F(u), c = n.localizedPaths[h], m = !!c, d = [];
|
|
627
|
-
if (!m) {
|
|
628
|
-
const P = z(f), p = this.createLocalizedChildren(
|
|
629
|
-
$(e.children ?? []),
|
|
630
|
-
y(t, e.path ?? ""),
|
|
631
|
-
a,
|
|
632
|
-
o,
|
|
633
|
-
s,
|
|
634
|
-
r,
|
|
635
|
-
i,
|
|
636
|
-
n
|
|
637
|
-
), L = this.buildChildRouteName(e.name, r, n);
|
|
638
|
-
return d.push(
|
|
639
|
-
g(e, {
|
|
640
|
-
path: P,
|
|
641
|
-
name: L,
|
|
642
|
-
children: p
|
|
643
|
-
})
|
|
644
|
-
), d;
|
|
645
|
-
}
|
|
646
|
-
for (const P of a) {
|
|
647
|
-
const p = i?.[P], L = !!p, C = c?.[P];
|
|
648
|
-
let A = R(C || (e.path ?? ""));
|
|
649
|
-
L && p && (C ? A = R(C) : A = y(p, e.path ?? ""));
|
|
650
|
-
const v = H(P, n.defaultLocale, s) ? x(P, A, n.customRegex) : A, T = z(v), E = C ? R(C) : L ? p : y(t, e.path ?? ""), V = this.createLocalizedChildren(
|
|
651
|
-
$(e.children ?? []),
|
|
652
|
-
E,
|
|
653
|
-
[P],
|
|
654
|
-
o,
|
|
655
|
-
s,
|
|
656
|
-
P,
|
|
657
|
-
{
|
|
658
|
-
...i,
|
|
659
|
-
[P]: E
|
|
660
|
-
},
|
|
661
|
-
n
|
|
662
|
-
), B = this.buildLocalizedRouteName(
|
|
663
|
-
b(e.name, e.path),
|
|
664
|
-
P,
|
|
665
|
-
o,
|
|
666
|
-
!!c,
|
|
667
|
-
n
|
|
668
|
-
);
|
|
669
|
-
d.push(
|
|
670
|
-
g(e, {
|
|
671
|
-
path: T,
|
|
672
|
-
name: B,
|
|
673
|
-
children: V
|
|
674
|
-
})
|
|
675
|
-
);
|
|
676
|
-
}
|
|
677
|
-
return d;
|
|
678
|
-
}
|
|
679
|
-
buildChildRouteName(e, t, a) {
|
|
680
|
-
return t === !0 ? `${a.localizedRouteNamePrefix}${e}` : typeof t == "string" ? `${a.localizedRouteNamePrefix}${e}-${t}` : e;
|
|
681
|
-
}
|
|
682
|
-
createLocalizedRoute(e, t, a, o, s = "", r, i = !1, n = !1, f, u) {
|
|
683
|
-
const h = this.buildRoutePathForLocales(
|
|
684
|
-
t,
|
|
685
|
-
e.path ?? "",
|
|
686
|
-
s,
|
|
687
|
-
o,
|
|
688
|
-
r,
|
|
689
|
-
i,
|
|
690
|
-
u.defaultLocale.code
|
|
691
|
-
);
|
|
692
|
-
if (!h || h === e.path || t.length === 0) return null;
|
|
693
|
-
const c = t[0];
|
|
694
|
-
if (!c) return null;
|
|
695
|
-
const m = f ?? e.path ?? "", d = j(
|
|
696
|
-
b(e.name ?? "", m),
|
|
697
|
-
c,
|
|
698
|
-
o,
|
|
699
|
-
u.localizedRouteNamePrefix
|
|
700
|
-
);
|
|
701
|
-
return g(e, {
|
|
702
|
-
path: h,
|
|
703
|
-
name: d,
|
|
704
|
-
children: this.createLocalizedChildren(
|
|
705
|
-
a,
|
|
706
|
-
m,
|
|
707
|
-
t,
|
|
708
|
-
!0,
|
|
709
|
-
!1,
|
|
710
|
-
n,
|
|
711
|
-
{ [c]: s },
|
|
712
|
-
u
|
|
713
|
-
),
|
|
714
|
-
alias: [],
|
|
715
|
-
meta: { alias: [] }
|
|
716
|
-
});
|
|
717
|
-
}
|
|
718
|
-
buildLocalizedRouteName(e, t, a, o = !1, s) {
|
|
719
|
-
return a ? o ? `${s.localizedRouteNamePrefix}${e}-${t}` : t && !J(t, s.defaultLocale) ? `${s.localizedRouteNamePrefix}${e}-${t}` : `${s.localizedRouteNamePrefix}${e}` : e;
|
|
720
|
-
}
|
|
161
|
+
function P(e, t, n, r = "localized-") {
|
|
162
|
+
let i = N(e);
|
|
163
|
+
if (!i.length) return [];
|
|
164
|
+
let a = [];
|
|
165
|
+
for (let o of i) {
|
|
166
|
+
let i = S(t, o, n);
|
|
167
|
+
a.push(M(e, {
|
|
168
|
+
path: i,
|
|
169
|
+
name: `${r}${e.name ?? ""}`,
|
|
170
|
+
alias: void 0,
|
|
171
|
+
meta: { alias: void 0 },
|
|
172
|
+
children: e.children
|
|
173
|
+
}));
|
|
174
|
+
}
|
|
175
|
+
return a;
|
|
721
176
|
}
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
177
|
+
//#endregion
|
|
178
|
+
//#region src/strategies/abstract.ts
|
|
179
|
+
var F = class {
|
|
180
|
+
processPage(t, n) {
|
|
181
|
+
if (t.path === void 0) throw Error("page.path is required");
|
|
182
|
+
if (c(t) || t.path && e(t.path, n.excludePatterns)) return [t];
|
|
183
|
+
let r = t.path ?? "", i = u(t.name, t.path);
|
|
184
|
+
return D(n.globalLocaleRoutes, r, i) ? [t] : this.generateVariants(t, n);
|
|
185
|
+
}
|
|
186
|
+
postProcess(e, t) {
|
|
187
|
+
return e;
|
|
188
|
+
}
|
|
189
|
+
localizeChildren(e, t, n, r, i, a) {
|
|
190
|
+
return e.flatMap((e) => this.localizeChild(e, t, n, r, i, a));
|
|
191
|
+
}
|
|
192
|
+
localizeChildrenAllLocales(e, t, n, r, i) {
|
|
193
|
+
return e.flatMap((e) => this.localizeChildAllLocales(e, t, n, r, i));
|
|
194
|
+
}
|
|
195
|
+
localizeChildAllLocales(e, t, n, r, i) {
|
|
196
|
+
let a = j(n, e.path ?? ""), o = u(e.name, e.path);
|
|
197
|
+
if (D(i.globalLocaleRoutes, a, o)) return [e];
|
|
198
|
+
let c = j(t, e.path ?? ""), l = T(c), d = i.localizedPaths[l];
|
|
199
|
+
if (d) return r.flatMap((r) => {
|
|
200
|
+
let a = d[r] ?? j(t, e.path ?? "");
|
|
201
|
+
return this.localizeChild(e, a, n, r, i, !0);
|
|
202
|
+
});
|
|
203
|
+
let f = g(h(e.path ?? "")), p = this.localizeChildrenAllLocales(s(e.children ?? []), c, a, r, i);
|
|
204
|
+
return [M(e, {
|
|
205
|
+
path: f,
|
|
206
|
+
name: `${i.localizedRouteNamePrefix}${e.name ?? ""}`,
|
|
207
|
+
children: p
|
|
208
|
+
})];
|
|
209
|
+
}
|
|
210
|
+
localizeChild(e, t, n, r, i, a) {
|
|
211
|
+
let o = j(n, e.path ?? ""), c = u(e.name, e.path);
|
|
212
|
+
if (D(i.globalLocaleRoutes, o, c)) return [e];
|
|
213
|
+
let l = i.getCustomPath(o, r), d = g(h(l || (e.path ?? ""))), f = l ?? j(t, e.path ?? ""), p = this.localizeChildren(s(e.children ?? []), f, o, r, i, a), m = u(e.name, e.path);
|
|
214
|
+
return [M(e, {
|
|
215
|
+
path: d,
|
|
216
|
+
name: `${i.localizedRouteNamePrefix}${m}-${r}`,
|
|
217
|
+
children: p
|
|
218
|
+
})];
|
|
219
|
+
}
|
|
220
|
+
buildRoutePathForLocales(e, t, n, r, i, a, o) {
|
|
221
|
+
if (r) {
|
|
222
|
+
let t = e.includes(o);
|
|
223
|
+
return a || !t ? S(e, n, i) : h(n);
|
|
224
|
+
}
|
|
225
|
+
return S(e, t, i);
|
|
226
|
+
}
|
|
227
|
+
}, I = class extends F {
|
|
228
|
+
generateVariants(e, t) {
|
|
229
|
+
let n = e.path ?? "", r = u(e.name, e.path), i = t.getAllowedLocales(n, r), a = t.getCustomPathsForPage(n, r), o = s(e.children ?? []), c = [];
|
|
230
|
+
if (c.push(e), a) for (let s of i) {
|
|
231
|
+
let i = a[s];
|
|
232
|
+
if (!i) continue;
|
|
233
|
+
let u = h(i), d = h(n);
|
|
234
|
+
if (u === d) continue;
|
|
235
|
+
let f = C(i), p = l(r, s, !0), m = this.localizeChildrenForNoPrefix(o, u, n, n, s, t, 1);
|
|
236
|
+
c.push(M(e, {
|
|
237
|
+
path: f,
|
|
238
|
+
name: p,
|
|
239
|
+
children: m,
|
|
240
|
+
alias: [],
|
|
241
|
+
meta: { alias: [] }
|
|
242
|
+
})), t.noPrefixRedirect && s === t.defaultLocale.code && u !== d && (e.redirect = u);
|
|
243
|
+
}
|
|
244
|
+
return c.push(...P(e, i, t.customRegex, t.localizedRouteNamePrefix)), c;
|
|
245
|
+
}
|
|
246
|
+
localizeChildrenForNoPrefix(e, t, n, r, i, a, o) {
|
|
247
|
+
return e.map((e) => {
|
|
248
|
+
let c = j(n, e.path ?? ""), d, f;
|
|
249
|
+
if (o === 1) {
|
|
250
|
+
let n = a.getCustomPath(c, i);
|
|
251
|
+
if (n) {
|
|
252
|
+
let e = h(n);
|
|
253
|
+
d = g(e), f = e;
|
|
254
|
+
} else d = g(h(e.path ?? "")), f = j(t, e.path ?? "");
|
|
255
|
+
} else d = g(h(e.path ?? "")), f = j(t, e.path ?? "");
|
|
256
|
+
let p = this.localizeChildrenForNoPrefix(s(e.children ?? []), f, c, r, i, a, o + 1), m = l(u(e.name, e.path), i, !0);
|
|
257
|
+
return M(e, {
|
|
258
|
+
path: d,
|
|
259
|
+
name: m,
|
|
260
|
+
children: p
|
|
261
|
+
});
|
|
262
|
+
});
|
|
263
|
+
}
|
|
264
|
+
};
|
|
265
|
+
//#endregion
|
|
266
|
+
//#region src/strategies/prefix.ts
|
|
267
|
+
function L(e) {
|
|
268
|
+
let t = e.alias ?? e.meta?.alias;
|
|
269
|
+
return Array.isArray(t) ? t : [];
|
|
735
270
|
}
|
|
736
|
-
class
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
271
|
+
var R = class extends F {
|
|
272
|
+
generateVariants(e, t) {
|
|
273
|
+
let n = e.path ?? "", r = u(e.name, e.path), i = t.getAllowedLocales(n, r), a = t.getCustomPathsForPage(n, r), o = s(e.children ?? []), c = [];
|
|
274
|
+
if (a) for (let s of i) {
|
|
275
|
+
let i = a[s], u = S(s, i ? h(i) : n, t.customRegex), d = l(r, s, !!i, t.localizedRouteNamePrefix), f = i ?? n, p = this.localizeChildren(o, f, n, s, t, !0), m = x(u);
|
|
276
|
+
c.push(M(e, {
|
|
277
|
+
path: u,
|
|
278
|
+
name: d,
|
|
279
|
+
children: p,
|
|
280
|
+
alias: m.length ? m : void 0,
|
|
281
|
+
meta: { alias: m.length ? m : [] }
|
|
282
|
+
}));
|
|
283
|
+
}
|
|
284
|
+
else {
|
|
285
|
+
let a = S(i, n, t.customRegex), s = l(r, i[0], !1, t.localizedRouteNamePrefix), u = this.localizeChildrenAllLocales(o, n, n, i, t);
|
|
286
|
+
c.push(M(e, {
|
|
287
|
+
path: a,
|
|
288
|
+
name: s,
|
|
289
|
+
children: u,
|
|
290
|
+
alias: [],
|
|
291
|
+
meta: { alias: [] }
|
|
292
|
+
}));
|
|
293
|
+
}
|
|
294
|
+
let d = L(e);
|
|
295
|
+
if (d.length) for (let n of d) {
|
|
296
|
+
let r = S(i, n, t.customRegex);
|
|
297
|
+
c.push(M(e, {
|
|
298
|
+
path: r,
|
|
299
|
+
name: `${t.localizedRouteNamePrefix}${e.name ?? ""}`,
|
|
300
|
+
alias: void 0,
|
|
301
|
+
meta: { alias: void 0 }
|
|
302
|
+
}));
|
|
303
|
+
}
|
|
304
|
+
return c;
|
|
305
|
+
}
|
|
306
|
+
postProcess(t, n) {
|
|
307
|
+
let r = t.filter((t) => {
|
|
308
|
+
if (t.name === "index" && t.path === "/") return !1;
|
|
309
|
+
let r = t.path ?? "";
|
|
310
|
+
return !!(r && e(r, n.excludePatterns) || D(n.globalLocaleRoutes, r, t.name ?? "") || /^\/:locale/.test(r) || r === "/");
|
|
311
|
+
}), i = n.defaultLocale.code;
|
|
312
|
+
for (let [e, t] of Object.entries(n.globalLocaleRoutes)) {
|
|
313
|
+
if (t === !1 || typeof t != "object") continue;
|
|
314
|
+
let n = t[i];
|
|
315
|
+
if (!n) continue;
|
|
316
|
+
let a = e.startsWith("/") ? e : `/${e}`, o = `/${i}${n.startsWith("/") ? n : `/${n}`}`;
|
|
317
|
+
a !== o && r.push({
|
|
318
|
+
path: a,
|
|
319
|
+
name: `redirect-${e.replace(/\//g, "-")}`,
|
|
320
|
+
redirect: o
|
|
321
|
+
});
|
|
322
|
+
}
|
|
323
|
+
return n.fallbackRedirectComponentPath && r.push({
|
|
324
|
+
path: "/:pathMatch(.*)*",
|
|
325
|
+
name: "custom-fallback-route",
|
|
326
|
+
file: n.fallbackRedirectComponentPath,
|
|
327
|
+
meta: { globalLocaleRoutes: n.rawGlobalLocaleRoutes ?? n.globalLocaleRoutes }
|
|
328
|
+
}), r;
|
|
329
|
+
}
|
|
330
|
+
}, z = class extends F {
|
|
331
|
+
generateVariants(e, t) {
|
|
332
|
+
let n = e.path ?? "", r = u(e.name, e.path), i = t.getAllowedLocales(n, r), a = t.getCustomPathsForPage(n, r), o = s(e.children ?? []), c = [], l = t.defaultLocale.code;
|
|
333
|
+
c.push(e);
|
|
334
|
+
let d = t.locales.filter((e) => i.includes(e.code));
|
|
335
|
+
if (d.length > 0) {
|
|
336
|
+
if (a) for (let r of d) {
|
|
337
|
+
let i = a[r.code];
|
|
338
|
+
if (i) {
|
|
339
|
+
if (r.code === l) {
|
|
340
|
+
let a = this.createLocalizedRoute(e, [r.code], o, !0, i, t.customRegex, !1, r.code, n, t);
|
|
341
|
+
a && c.push(a);
|
|
342
|
+
let s = this.createLocalizedRoute(e, [r.code], o, !0, i, t.customRegex, !0, r.code, n, t);
|
|
343
|
+
s && c.push(s);
|
|
344
|
+
} else {
|
|
345
|
+
let a = this.createLocalizedRoute(e, [r.code], o, !0, i, t.customRegex, !1, r.code, n, t);
|
|
346
|
+
a && c.push(a);
|
|
347
|
+
}
|
|
348
|
+
} else {
|
|
349
|
+
let i = this.createLocalizedRoute(e, [r.code], o, !1, "", t.customRegex, !1, r.code, n, t);
|
|
350
|
+
i && c.push(i);
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
else {
|
|
354
|
+
let r = d.map((e) => e.code), i = this.createLocalizedRoute(e, r, o, !1, "", t.customRegex, !1, !0, n, t);
|
|
355
|
+
i && c.push(i);
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
let f = P(e, i, t.customRegex, t.localizedRouteNamePrefix);
|
|
359
|
+
return f.length && c.push(...f), c;
|
|
360
|
+
}
|
|
361
|
+
postProcess(e, t) {
|
|
362
|
+
let n = [], r = [];
|
|
363
|
+
for (let i of e) {
|
|
364
|
+
let e = i.name ?? "";
|
|
365
|
+
typeof e == "string" && e.startsWith(t.localizedRouteNamePrefix) ? r.push(i) : n.push(i);
|
|
366
|
+
}
|
|
367
|
+
return [...n, ...r];
|
|
368
|
+
}
|
|
369
|
+
createLocalizedRoute(e, t, n, r, i = "", a, o = !1, s = !1, c, d) {
|
|
370
|
+
let f = this.buildRoutePathForLocales(t, e.path ?? "", i, r, a, o, d.defaultLocale.code);
|
|
371
|
+
if (!f || !(r && i) && f === e.path || t.length === 0) return null;
|
|
372
|
+
let p = t[0];
|
|
373
|
+
if (!p) return null;
|
|
374
|
+
let m = c ?? e.path ?? "", h = l(u(e.name ?? "", m), p, r, d.localizedRouteNamePrefix), g = o || p !== d.defaultLocale.code;
|
|
375
|
+
return M(e, {
|
|
376
|
+
path: f,
|
|
377
|
+
name: h,
|
|
378
|
+
children: t.length === 1 ? this.localizeChildren(n, f, m, p, d, g) : this.localizeChildrenAllLocales(n, f, m, t, d),
|
|
379
|
+
alias: [],
|
|
380
|
+
meta: { alias: [] }
|
|
381
|
+
});
|
|
382
|
+
}
|
|
383
|
+
}, B = class extends F {
|
|
384
|
+
generateVariants(e, t) {
|
|
385
|
+
let n = e.path ?? "", r = u(e.name, e.path), i = t.getAllowedLocales(n, r), a = t.getCustomPathsForPage(n, r), o = s(e.children ?? []), c = [], l = t.defaultLocale.code;
|
|
386
|
+
if (i.includes(l)) {
|
|
387
|
+
let r = a?.[l], i = r ? h(r) : n, s = r ? { [l]: r } : {}, u = this.createLocalizedChildren(o, n, [l], !1, !1, !1, s, t);
|
|
388
|
+
c.push(M(e, {
|
|
389
|
+
path: i,
|
|
390
|
+
name: e.name,
|
|
391
|
+
children: u
|
|
392
|
+
}));
|
|
393
|
+
}
|
|
394
|
+
let d = t.locales.filter((e) => i.includes(e.code) && e.code !== l);
|
|
395
|
+
if (d.length) {
|
|
396
|
+
if (a) for (let r of d) {
|
|
397
|
+
let i = a[r.code];
|
|
398
|
+
if (i) {
|
|
399
|
+
let a = this.createLocalizedRoute(e, [r.code], o, !0, i, t.customRegex, !1, r.code, n, t);
|
|
400
|
+
a && c.push(a);
|
|
401
|
+
} else {
|
|
402
|
+
let i = this.createLocalizedRoute(e, [r.code], o, !1, "", t.customRegex, !1, r.code, n, t);
|
|
403
|
+
i && c.push(i);
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
else {
|
|
407
|
+
let r = d.map((e) => e.code), i = this.createLocalizedRoute(e, r, o, !1, "", t.customRegex, !1, !0, n, t);
|
|
408
|
+
i && c.push(i);
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
let f = P(e, i, t.customRegex, t.localizedRouteNamePrefix);
|
|
412
|
+
return f.length && c.push(...f), c;
|
|
413
|
+
}
|
|
414
|
+
postProcess(e, t) {
|
|
415
|
+
let n = [], r = [];
|
|
416
|
+
for (let i of e) {
|
|
417
|
+
let e = i.name ?? "";
|
|
418
|
+
typeof e == "string" && e.startsWith(t.localizedRouteNamePrefix) ? r.push(i) : n.push(i);
|
|
419
|
+
}
|
|
420
|
+
let i = [...n, ...r];
|
|
421
|
+
return t.fallbackRedirectComponentPath && i.push({
|
|
422
|
+
path: "/:pathMatch(.*)*",
|
|
423
|
+
name: "custom-fallback-route",
|
|
424
|
+
file: t.fallbackRedirectComponentPath,
|
|
425
|
+
meta: { globalLocaleRoutes: t.rawGlobalLocaleRoutes ?? t.globalLocaleRoutes }
|
|
426
|
+
}), i;
|
|
427
|
+
}
|
|
428
|
+
createLocalizedChildren(e, t, n, r = !0, i = !1, a = !1, o = {}, s) {
|
|
429
|
+
return e.flatMap((e) => this.createLocalizedVariants(e, t, n, r, i, a, o, s));
|
|
430
|
+
}
|
|
431
|
+
createLocalizedVariants(e, t, n, r, i, a = !1, o, c) {
|
|
432
|
+
let l = h(e.path ?? ""), f = T(j(t, e.path ?? "")), p = c.localizedPaths[f], m = !!p, _ = [];
|
|
433
|
+
if (!m) {
|
|
434
|
+
let u = g(l), d = this.createLocalizedChildren(s(e.children ?? []), j(t, e.path ?? ""), n, r, i, a, o, c), f = this.buildChildRouteName(e.name, a, c);
|
|
435
|
+
return _.push(M(e, {
|
|
436
|
+
path: u,
|
|
437
|
+
name: f,
|
|
438
|
+
children: d
|
|
439
|
+
})), _;
|
|
440
|
+
}
|
|
441
|
+
for (let a of n) {
|
|
442
|
+
let n = o?.[a], l = !!n, f = p?.[a], m = h(f || (e.path ?? ""));
|
|
443
|
+
l && n && (m = f ? h(f) : j(n, e.path ?? ""));
|
|
444
|
+
let v = g(d(a, c.defaultLocale, i) ? S(a, m, c.customRegex) : m), y = f ? h(f) : l ? n : j(t, e.path ?? ""), b = this.createLocalizedChildren(s(e.children ?? []), y, [a], r, i, a, {
|
|
445
|
+
...o,
|
|
446
|
+
[a]: y
|
|
447
|
+
}, c), x = this.buildLocalizedRouteName(u(e.name, e.path), a, r, !!p, c);
|
|
448
|
+
_.push(M(e, {
|
|
449
|
+
path: v,
|
|
450
|
+
name: x,
|
|
451
|
+
children: b
|
|
452
|
+
}));
|
|
453
|
+
}
|
|
454
|
+
return _;
|
|
455
|
+
}
|
|
456
|
+
buildChildRouteName(e, t, n) {
|
|
457
|
+
return t === !0 ? `${n.localizedRouteNamePrefix}${e}` : typeof t == "string" ? `${n.localizedRouteNamePrefix}${e}-${t}` : e;
|
|
458
|
+
}
|
|
459
|
+
createLocalizedRoute(e, t, n, r, i = "", a, o = !1, s = !1, c, d) {
|
|
460
|
+
let f = this.buildRoutePathForLocales(t, e.path ?? "", i, r, a, o, d.defaultLocale.code);
|
|
461
|
+
if (!f || f === e.path || t.length === 0) return null;
|
|
462
|
+
let p = t[0];
|
|
463
|
+
if (!p) return null;
|
|
464
|
+
let m = c ?? e.path ?? "";
|
|
465
|
+
return M(e, {
|
|
466
|
+
path: f,
|
|
467
|
+
name: l(u(e.name ?? "", m), p, r, d.localizedRouteNamePrefix),
|
|
468
|
+
children: this.createLocalizedChildren(n, m, t, !0, !1, s, { [p]: i }, d),
|
|
469
|
+
alias: [],
|
|
470
|
+
meta: { alias: [] }
|
|
471
|
+
});
|
|
472
|
+
}
|
|
473
|
+
buildLocalizedRouteName(e, t, n, r = !1, i) {
|
|
474
|
+
return n ? r || t && !f(t, i.defaultLocale) ? `${i.localizedRouteNamePrefix}${e}-${t}` : `${i.localizedRouteNamePrefix}${e}` : e;
|
|
475
|
+
}
|
|
476
|
+
};
|
|
477
|
+
//#endregion
|
|
478
|
+
//#region src/strategies/factory.ts
|
|
479
|
+
function V(e) {
|
|
480
|
+
switch (e) {
|
|
481
|
+
case "no_prefix": return new I();
|
|
482
|
+
case "prefix": return new R();
|
|
483
|
+
case "prefix_and_default": return new z();
|
|
484
|
+
case "prefix_except_default": return new B();
|
|
485
|
+
default: throw Error(`Unknown route strategy: ${e}`);
|
|
486
|
+
}
|
|
853
487
|
}
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
488
|
+
//#endregion
|
|
489
|
+
//#region src/route-generator.ts
|
|
490
|
+
var H = class {
|
|
491
|
+
constructor(e) {
|
|
492
|
+
this.localizedPaths = {};
|
|
493
|
+
let { locales: t, defaultLocaleCode: n, strategy: r, globalLocaleRoutes: i, filesLocaleRoutes: a = {}, routeLocales: o = {}, noPrefixRedirect: s, excludePatterns: c, localizedRouteNamePrefix: l = "localized-", customRegexMatcher: u, fallbackRedirectComponentPath: d } = e, f = p(t, n);
|
|
494
|
+
this.locales = f.locales, this.defaultLocale = f.defaultLocale, this.strategy = r, this.noPrefixRedirect = s, this.excludePatterns = c, this.localizedRouteNamePrefix = l, this.customRegex = u, this.fallbackRedirectComponentPath = d, this.activeLocaleCodes = this.computeActiveLocaleCodes();
|
|
495
|
+
let h = {};
|
|
496
|
+
for (let e in i) {
|
|
497
|
+
let t = m(e), n = i[e];
|
|
498
|
+
if (typeof n == "object") {
|
|
499
|
+
let e = {};
|
|
500
|
+
for (let t in n) {
|
|
501
|
+
let r = n[t];
|
|
502
|
+
r && (e[t] = m(r));
|
|
503
|
+
}
|
|
504
|
+
h[t] = e;
|
|
505
|
+
} else h[t] = n;
|
|
506
|
+
}
|
|
507
|
+
this.globalLocaleRoutes = h, this.rawGlobalLocaleRoutes = i ?? {}, this.filesLocaleRoutes = a ?? {}, this.routeLocales = o ?? {};
|
|
508
|
+
}
|
|
509
|
+
computeActiveLocaleCodes() {
|
|
510
|
+
return this.locales.filter((e) => e.code !== this.defaultLocale.code || a(this.strategy) || o(this.strategy)).map((e) => e.code);
|
|
511
|
+
}
|
|
512
|
+
extendPages(e) {
|
|
513
|
+
let t = new A({
|
|
514
|
+
locales: this.locales,
|
|
515
|
+
defaultLocaleCode: this.defaultLocale.code,
|
|
516
|
+
strategy: this.strategy,
|
|
517
|
+
globalLocaleRoutes: this.globalLocaleRoutes,
|
|
518
|
+
filesLocaleRoutes: this.filesLocaleRoutes,
|
|
519
|
+
routeLocales: this.routeLocales,
|
|
520
|
+
pages: e,
|
|
521
|
+
excludePatterns: this.excludePatterns,
|
|
522
|
+
customRegex: this.customRegex,
|
|
523
|
+
noPrefixRedirect: this.noPrefixRedirect,
|
|
524
|
+
localizedRouteNamePrefix: this.localizedRouteNamePrefix,
|
|
525
|
+
fallbackRedirectComponentPath: this.fallbackRedirectComponentPath,
|
|
526
|
+
rawGlobalLocaleRoutes: this.rawGlobalLocaleRoutes
|
|
527
|
+
});
|
|
528
|
+
this.localizedPaths = t.localizedPaths;
|
|
529
|
+
let n = V(this.strategy), r = [...e], i = [];
|
|
530
|
+
for (let e of r) i.push(...n.processPage(e, t));
|
|
531
|
+
let a = n.postProcess(i, t);
|
|
532
|
+
e.length = 0, e.push(...a);
|
|
533
|
+
}
|
|
534
|
+
extractLocalizedPaths(e, t = "") {
|
|
535
|
+
return E(e, this.globalLocaleRoutes, this.filesLocaleRoutes, t);
|
|
536
|
+
}
|
|
537
|
+
ensureTranslationFilesExist(e, n, r, i) {
|
|
538
|
+
this.locales.forEach((a) => {
|
|
539
|
+
let o = t.join(r, n, `${a.code}.json`);
|
|
540
|
+
this.ensureFileExists(o), i || e.forEach((e) => {
|
|
541
|
+
let i = t.join(r, n, "pages", `${e}/${a.code}.json`);
|
|
542
|
+
this.ensureFileExists(i);
|
|
543
|
+
});
|
|
544
|
+
});
|
|
545
|
+
}
|
|
546
|
+
ensureFileExists(e) {
|
|
547
|
+
try {
|
|
548
|
+
let a = t.dirname(e);
|
|
549
|
+
n(a) || r(a, { recursive: !0 }), n(e) || i(e, JSON.stringify({}), "utf-8");
|
|
550
|
+
} catch {}
|
|
551
|
+
}
|
|
552
|
+
resolveLocalizedPath(e, t) {
|
|
553
|
+
let n = m(e), r = g(n) || "/", i, a = this.globalLocaleRoutes[r], o = this.globalLocaleRoutes[n];
|
|
554
|
+
a && typeof a == "object" && !Array.isArray(a) ? i = a[t] : o && typeof o == "object" && !Array.isArray(o) && (i = o[t]);
|
|
555
|
+
let s = !!i, c = i ? h(i) : h(n) || "", l = !1;
|
|
556
|
+
if (this.strategy === "no_prefix" ? l = !1 : this.strategy === "prefix" || this.strategy === "prefix_and_default" ? l = !0 : this.strategy === "prefix_except_default" && (l = t !== this.defaultLocale.code), t === this.defaultLocale.code && !s && (this.strategy === "prefix_except_default" || this.strategy === "no_prefix") && (l = !1), !l) return h(c) || "/";
|
|
557
|
+
let u = g(c);
|
|
558
|
+
return u ? h(`/${t}/${u}`) : `/${t}`;
|
|
559
|
+
}
|
|
560
|
+
generateDataRoutes(e, t, n) {
|
|
561
|
+
let r = [], i = this.collectPageNames(e);
|
|
562
|
+
for (let e of this.locales) if (r.push(`/${t}/index/${e.code}/data.json`), !n) for (let n of i) r.push(`/${t}/${n}/${e.code}/data.json`);
|
|
563
|
+
return r;
|
|
564
|
+
}
|
|
565
|
+
collectPageNames(e) {
|
|
566
|
+
let t = /* @__PURE__ */ new Set(), n = (e) => {
|
|
567
|
+
for (let r of e) typeof r.name == "string" && r.name.length > 0 && t.add(r.name), r.children && r.children.length > 0 && n(r.children);
|
|
568
|
+
};
|
|
569
|
+
return n(e), [...t];
|
|
570
|
+
}
|
|
871
571
|
};
|
|
572
|
+
//#endregion
|
|
573
|
+
export { H as RouteGenerator, x as buildEncodedPathAliases, S as buildFullPath, C as buildFullPathNoPrefix, l as buildRouteName, s as cloneArray, E as extractLocalizedPaths, e as isInternalPath, O as isLocaleAllowedForUnlocalizedRoute, f as isLocaleDefault, D as isLocalizationDisabledForPage, c as isPageRedirectOnly, h as normalizePath, m as normalizeRouteKey, g as removeLeadingSlash, d as shouldAddLocalePrefix };
|