@koine/i18n 2.0.0-beta.50 → 2.0.0-beta.51
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/adapter-next/plugin-legacy.d.ts +1 -106
- package/next.cjs.js +46 -46
- package/next.esm.js +46 -46
- package/package.json +3 -3
|
@@ -1,11 +1,4 @@
|
|
|
1
1
|
import type { NextConfig } from "next";
|
|
2
|
-
import type { Redirect as _Redirect, Rewrite as _Rewrite } from "next/dist/lib/load-custom-routes";
|
|
3
|
-
type Redirect = Omit<_Redirect, "locale"> & {
|
|
4
|
-
locale?: boolean;
|
|
5
|
-
};
|
|
6
|
-
type Rewrite = Omit<_Rewrite, "locale"> & {
|
|
7
|
-
locale?: boolean;
|
|
8
|
-
};
|
|
9
2
|
type Route = string | {
|
|
10
3
|
[key: string]: Route | string;
|
|
11
4
|
};
|
|
@@ -24,103 +17,5 @@ export type WithI18nLegacyOptions = NextConfig & {
|
|
|
24
17
|
debug?: boolean;
|
|
25
18
|
i18n: ConfigI18nOptions;
|
|
26
19
|
};
|
|
27
|
-
export declare let withI18nLegacy: (options: WithI18nLegacyOptions) => NextConfig
|
|
28
|
-
redirects(): Promise<Redirect[]>;
|
|
29
|
-
rewrites(): Promise<{
|
|
30
|
-
beforeFiles: Rewrite[];
|
|
31
|
-
afterFiles: _Rewrite[];
|
|
32
|
-
fallback: _Rewrite[];
|
|
33
|
-
}>;
|
|
34
|
-
exportPathMap?: ((defaultMap: import("next/dist/server/config-shared").ExportPathMap, ctx: {
|
|
35
|
-
dev: boolean;
|
|
36
|
-
dir: string;
|
|
37
|
-
outDir: string | null;
|
|
38
|
-
distDir: string;
|
|
39
|
-
buildId: string;
|
|
40
|
-
}) => import("next/dist/server/config-shared").ExportPathMap | Promise<import("next/dist/server/config-shared").ExportPathMap>) | undefined;
|
|
41
|
-
i18n?: import("next/dist/server/config-shared").I18NConfig | null | undefined;
|
|
42
|
-
eslint?: import("next/dist/server/config-shared").ESLintConfig | undefined;
|
|
43
|
-
typescript?: import("next/dist/server/config-shared").TypeScriptConfig | undefined;
|
|
44
|
-
headers?: (() => Promise<import("next/dist/lib/load-custom-routes").Header[]>) | undefined;
|
|
45
|
-
excludeDefaultMomentLocales?: boolean | undefined;
|
|
46
|
-
webpack?: import("next/dist/server/config-shared").NextJsWebpackConfig | null | undefined;
|
|
47
|
-
trailingSlash?: boolean | undefined;
|
|
48
|
-
env?: Record<string, string | undefined> | undefined;
|
|
49
|
-
distDir?: string | undefined;
|
|
50
|
-
cleanDistDir?: boolean | undefined;
|
|
51
|
-
assetPrefix?: string | undefined;
|
|
52
|
-
cacheHandler?: string | undefined;
|
|
53
|
-
cacheMaxMemorySize?: number | undefined;
|
|
54
|
-
useFileSystemPublicRoutes?: boolean | undefined;
|
|
55
|
-
generateBuildId?: (() => string | Promise<string | null> | null) | undefined;
|
|
56
|
-
generateEtags?: boolean | undefined;
|
|
57
|
-
pageExtensions?: string[] | undefined;
|
|
58
|
-
compress?: boolean | undefined;
|
|
59
|
-
analyticsId?: string | undefined;
|
|
60
|
-
poweredByHeader?: boolean | undefined;
|
|
61
|
-
images?: Partial<import("next/dist/shared/lib/image-config").ImageConfigComplete> | undefined;
|
|
62
|
-
devIndicators?: {
|
|
63
|
-
buildActivity?: boolean | undefined;
|
|
64
|
-
buildActivityPosition?: "bottom-right" | "bottom-left" | "top-right" | "top-left" | undefined;
|
|
65
|
-
} | undefined;
|
|
66
|
-
onDemandEntries?: {
|
|
67
|
-
maxInactiveAge?: number | undefined;
|
|
68
|
-
pagesBufferLength?: number | undefined;
|
|
69
|
-
} | undefined;
|
|
70
|
-
amp?: {
|
|
71
|
-
canonicalBase?: string | undefined;
|
|
72
|
-
} | undefined;
|
|
73
|
-
basePath?: string | undefined;
|
|
74
|
-
sassOptions?: {
|
|
75
|
-
[key: string]: any;
|
|
76
|
-
} | undefined;
|
|
77
|
-
productionBrowserSourceMaps?: boolean | undefined;
|
|
78
|
-
optimizeFonts?: boolean | undefined;
|
|
79
|
-
reactProductionProfiling?: boolean | undefined;
|
|
80
|
-
reactStrictMode?: boolean | null | undefined;
|
|
81
|
-
publicRuntimeConfig?: {
|
|
82
|
-
[key: string]: any;
|
|
83
|
-
} | undefined;
|
|
84
|
-
serverRuntimeConfig?: {
|
|
85
|
-
[key: string]: any;
|
|
86
|
-
} | undefined;
|
|
87
|
-
httpAgentOptions?: {
|
|
88
|
-
keepAlive?: boolean | undefined;
|
|
89
|
-
} | undefined;
|
|
90
|
-
outputFileTracing?: boolean | undefined;
|
|
91
|
-
staticPageGenerationTimeout?: number | undefined;
|
|
92
|
-
crossOrigin?: false | "anonymous" | "use-credentials" | undefined;
|
|
93
|
-
swcMinify?: boolean | undefined;
|
|
94
|
-
compiler?: {
|
|
95
|
-
reactRemoveProperties?: boolean | {
|
|
96
|
-
properties?: string[] | undefined;
|
|
97
|
-
} | undefined;
|
|
98
|
-
relay?: {
|
|
99
|
-
src: string;
|
|
100
|
-
artifactDirectory?: string | undefined;
|
|
101
|
-
language?: "typescript" | "javascript" | "flow" | undefined;
|
|
102
|
-
eagerEsModules?: boolean | undefined;
|
|
103
|
-
} | undefined;
|
|
104
|
-
removeConsole?: boolean | {
|
|
105
|
-
exclude?: string[] | undefined;
|
|
106
|
-
} | undefined;
|
|
107
|
-
styledComponents?: boolean | import("next/dist/server/config-shared").StyledComponentsConfig | undefined;
|
|
108
|
-
emotion?: boolean | import("next/dist/server/config-shared").EmotionConfig | undefined;
|
|
109
|
-
} | undefined;
|
|
110
|
-
output?: "standalone" | "export" | undefined;
|
|
111
|
-
transpilePackages?: string[] | undefined;
|
|
112
|
-
skipMiddlewareUrlNormalize?: boolean | undefined;
|
|
113
|
-
skipTrailingSlashRedirect?: boolean | undefined;
|
|
114
|
-
modularizeImports?: Record<string, {
|
|
115
|
-
transform: string | Record<string, string>;
|
|
116
|
-
preventFullImport?: boolean | undefined;
|
|
117
|
-
skipDefaultConversion?: boolean | undefined;
|
|
118
|
-
}> | undefined;
|
|
119
|
-
logging?: {
|
|
120
|
-
fetches?: {
|
|
121
|
-
fullUrl?: boolean | undefined;
|
|
122
|
-
} | undefined;
|
|
123
|
-
} | undefined;
|
|
124
|
-
experimental?: import("next/dist/server/config-shared").ExperimentalConfig | undefined;
|
|
125
|
-
};
|
|
20
|
+
export declare let withI18nLegacy: (options: WithI18nLegacyOptions) => NextConfig;
|
|
126
21
|
export {};
|
package/next.cjs.js
CHANGED
|
@@ -43,53 +43,53 @@ function l$1(e, t) {
|
|
|
43
43
|
};
|
|
44
44
|
}
|
|
45
45
|
function n(e) {
|
|
46
|
-
let { pathname: t, template: l } = e, n = t.split("/").filter((e)=>!!e), i = l.split("/").filter((e)=>!!e),
|
|
46
|
+
let { pathname: t, template: l } = e, n = t.split("/").filter((e)=>!!e), i = l.split("/").filter((e)=>!!e), a = {};
|
|
47
47
|
return {
|
|
48
48
|
pathname: n.map((e)=>{
|
|
49
49
|
let t = e.endsWith("*"), l = (e = e.replace("*", "")).startsWith("{{") && e.endsWith("}}"), n = l ? e.match(/{{(.+)}}/)?.[1].trim() ?? "" : e.trim(), i = encodeURIComponent(n) + (t ? "*" : "");
|
|
50
|
-
return
|
|
50
|
+
return a[n] = {
|
|
51
51
|
isDynamic: l,
|
|
52
52
|
hasWildcard: t
|
|
53
53
|
}, l ? `:${i}` : i;
|
|
54
54
|
}).join("/"),
|
|
55
55
|
template: i.map((e)=>{
|
|
56
|
-
let t = e.startsWith("[") && e.endsWith("]"), l = t ? e.match(/\[(.+)\]/)?.[1].trim() ?? "" : e.trim(), n =
|
|
56
|
+
let t = e.startsWith("[") && e.endsWith("]"), l = t ? e.match(/\[(.+)\]/)?.[1].trim() ?? "" : e.trim(), n = a[l]?.hasWildcard, i = encodeURIComponent(l) + (n ? "*" : "");
|
|
57
57
|
return t ? `:${i}` : i;
|
|
58
58
|
}).join("/")
|
|
59
59
|
};
|
|
60
60
|
}
|
|
61
61
|
function i(e = {}, t, l = "", n = "") {
|
|
62
|
-
let
|
|
63
|
-
for(let
|
|
64
|
-
let o = t[
|
|
65
|
-
"string" == typeof o ? (!
|
|
62
|
+
let a = Object.keys(t).includes("[spa]");
|
|
63
|
+
for(let r in t){
|
|
64
|
+
let o = t[r], s = `${n}/${r}`;
|
|
65
|
+
"string" == typeof o ? (!a || a && [
|
|
66
66
|
"[spa]",
|
|
67
67
|
"index"
|
|
68
|
-
].includes(
|
|
68
|
+
].includes(r)) && (e[s] = {
|
|
69
69
|
template: s,
|
|
70
70
|
pathname: o,
|
|
71
71
|
wildcard: o.includes("*")
|
|
72
|
-
}) :
|
|
72
|
+
}) : a || i(e, o, l, s);
|
|
73
73
|
}
|
|
74
74
|
return e;
|
|
75
75
|
}
|
|
76
|
-
function
|
|
76
|
+
function a(e) {
|
|
77
77
|
return e.replace(/\/index$/, "");
|
|
78
78
|
}
|
|
79
|
-
function
|
|
80
|
-
let { localeSource: l, localeDestination: i, route:
|
|
81
|
-
if (p !==
|
|
79
|
+
function r$1(e) {
|
|
80
|
+
let { localeSource: l, localeDestination: i, route: r, usePathnameAsSource: o, permanent: s } = e, { template: c, pathname: u } = n(r), f = l ? `${l}/` : "", p = a(`/${utils.normaliseUrlPathname(f + (o ? u : c))}`), h = i ? `${i}/` : "", m = `/${utils.normaliseUrlPathname(h + u)}`;
|
|
81
|
+
if (p !== m) return {
|
|
82
82
|
source: p,
|
|
83
|
-
destination:
|
|
83
|
+
destination: m,
|
|
84
84
|
permanent: !!s
|
|
85
85
|
};
|
|
86
86
|
}
|
|
87
87
|
function o(e) {
|
|
88
|
-
let { localeSource: l, localeDestination: i, localeParam:
|
|
89
|
-
l ? u = `${l}/` :
|
|
88
|
+
let { localeSource: l, localeDestination: i, localeParam: r, route: o } = e, { pathname: s, template: c } = n(o), u = "";
|
|
89
|
+
l ? u = `${l}/` : r && (u = `:${r}/`);
|
|
90
90
|
let f = `/${utils.normaliseUrlPathname(u + s)}`, p = "";
|
|
91
|
-
i ? p = `${i}/` :
|
|
92
|
-
let h =
|
|
91
|
+
i ? p = `${i}/` : r && (p = `:${r}/`);
|
|
92
|
+
let h = a(`/${utils.normaliseUrlPathname(p + c)}`);
|
|
93
93
|
if (f !== h) return {
|
|
94
94
|
source: f,
|
|
95
95
|
destination: h
|
|
@@ -104,86 +104,85 @@ let withI18nLegacy = (t)=>{
|
|
|
104
104
|
}, h = {
|
|
105
105
|
...f
|
|
106
106
|
};
|
|
107
|
-
|
|
107
|
+
if (p.locales && p.defaultLocale && (h.i18n = {
|
|
108
108
|
locales: p.locales,
|
|
109
109
|
defaultLocale: p.defaultLocale,
|
|
110
110
|
...f.i18n || {}
|
|
111
|
-
}), n)
|
|
112
|
-
|
|
113
|
-
async
|
|
114
|
-
let
|
|
111
|
+
}), n) {
|
|
112
|
+
let { redirects: t, rewrites: c } = h;
|
|
113
|
+
h.redirects = async ()=>{
|
|
114
|
+
let o = function(t) {
|
|
115
115
|
let { routes: n, defaultLocale: o, hideDefaultLocaleInUrl: s, localeParam: c, permanent: u, debug: f } = t, p = l$1(n, o), h = [];
|
|
116
116
|
for(let e in p){
|
|
117
117
|
let t = i({}, n[e]);
|
|
118
118
|
for(let l in t){
|
|
119
119
|
let n = t[l];
|
|
120
|
-
if (n.pathname !==
|
|
120
|
+
if (n.pathname !== a(l)) {
|
|
121
121
|
let t = e === o && !s, l = e === o && s;
|
|
122
|
-
c ? t ? h.push(
|
|
122
|
+
c ? t ? h.push(r$1({
|
|
123
123
|
localeDestination: e,
|
|
124
124
|
route: n,
|
|
125
125
|
permanent: u
|
|
126
|
-
})) : l ? h.push(
|
|
126
|
+
})) : l ? h.push(r$1({
|
|
127
127
|
localeSource: e,
|
|
128
128
|
route: n,
|
|
129
129
|
permanent: u
|
|
130
|
-
})) : e !== o ? h.push(
|
|
130
|
+
})) : e !== o ? h.push(r$1({
|
|
131
131
|
localeSource: e,
|
|
132
132
|
localeDestination: e,
|
|
133
133
|
route: n,
|
|
134
134
|
permanent: u
|
|
135
|
-
})) : h.push(
|
|
135
|
+
})) : h.push(r$1({
|
|
136
136
|
route: n,
|
|
137
137
|
permanent: u
|
|
138
|
-
})) : t ? h.push(
|
|
138
|
+
})) : t ? h.push(r$1({
|
|
139
139
|
localeDestination: e,
|
|
140
140
|
route: n,
|
|
141
141
|
permanent: u
|
|
142
|
-
})) : e !== o ? h.push(
|
|
142
|
+
})) : e !== o ? h.push(r$1({
|
|
143
143
|
localeSource: e,
|
|
144
144
|
localeDestination: e,
|
|
145
145
|
route: n,
|
|
146
146
|
permanent: u
|
|
147
|
-
})) : h.push(
|
|
147
|
+
})) : h.push(r$1({
|
|
148
148
|
route: n,
|
|
149
149
|
permanent: u
|
|
150
150
|
}));
|
|
151
151
|
}
|
|
152
152
|
}
|
|
153
153
|
}
|
|
154
|
-
let
|
|
154
|
+
let m = utils.arrayUniqueByProperties(h.filter(Boolean), [
|
|
155
155
|
"source",
|
|
156
156
|
"destination"
|
|
157
157
|
]).map((e)=>c ? e : {
|
|
158
158
|
...e,
|
|
159
159
|
locale: !1
|
|
160
160
|
});
|
|
161
|
-
return f && console.info("[@koine/next/plugin-legacy:generateRedirects]",
|
|
161
|
+
return f && console.info("[@koine/next/plugin-legacy:generateRedirects]", m), m;
|
|
162
162
|
}({
|
|
163
163
|
routes: n,
|
|
164
164
|
permanent: s,
|
|
165
165
|
debug: u,
|
|
166
166
|
...p
|
|
167
167
|
});
|
|
168
|
-
return
|
|
169
|
-
...
|
|
170
|
-
...await
|
|
171
|
-
] :
|
|
172
|
-
},
|
|
173
|
-
async rewrites () {
|
|
168
|
+
return t ? [
|
|
169
|
+
...o,
|
|
170
|
+
...await t()
|
|
171
|
+
] : o;
|
|
172
|
+
}, h.rewrites = async ()=>{
|
|
174
173
|
let t = function(t) {
|
|
175
|
-
let { routes: n, defaultLocale:
|
|
174
|
+
let { routes: n, defaultLocale: r, hideDefaultLocaleInUrl: s, localeParam: c, debug: u } = t, f = l$1(n, r), p = [];
|
|
176
175
|
for(let e in f){
|
|
177
176
|
let t = i({}, n[e]);
|
|
178
177
|
for(let l in t){
|
|
179
|
-
let n = t[l], i = e ===
|
|
178
|
+
let n = t[l], i = e === r && !s, u = e === r && s;
|
|
180
179
|
c ? u ? p.push(o({
|
|
181
180
|
localeDestination: e,
|
|
182
181
|
route: n
|
|
183
182
|
})) : p.push(o({
|
|
184
183
|
localeParam: c,
|
|
185
184
|
route: n
|
|
186
|
-
})) : n.pathname !==
|
|
185
|
+
})) : n.pathname !== a(l) && (e !== r || i ? p.push(o({
|
|
187
186
|
localeSource: e,
|
|
188
187
|
route: n
|
|
189
188
|
})) : p.push(o({
|
|
@@ -201,8 +200,8 @@ let withI18nLegacy = (t)=>{
|
|
|
201
200
|
debug: u,
|
|
202
201
|
...p
|
|
203
202
|
});
|
|
204
|
-
if (
|
|
205
|
-
let e = await
|
|
203
|
+
if (c) {
|
|
204
|
+
let e = await c();
|
|
206
205
|
return Array.isArray(e) ? {
|
|
207
206
|
beforeFiles: t,
|
|
208
207
|
afterFiles: e,
|
|
@@ -220,8 +219,9 @@ let withI18nLegacy = (t)=>{
|
|
|
220
219
|
afterFiles: [],
|
|
221
220
|
fallback: []
|
|
222
221
|
};
|
|
223
|
-
}
|
|
224
|
-
}
|
|
222
|
+
};
|
|
223
|
+
}
|
|
224
|
+
return h;
|
|
225
225
|
};
|
|
226
226
|
|
|
227
227
|
function transformPathname(n, e) {
|
package/next.esm.js
CHANGED
|
@@ -21,53 +21,53 @@ function l$1(e, t) {
|
|
|
21
21
|
};
|
|
22
22
|
}
|
|
23
23
|
function n(e) {
|
|
24
|
-
let { pathname: t, template: l } = e, n = t.split("/").filter((e)=>!!e), i = l.split("/").filter((e)=>!!e),
|
|
24
|
+
let { pathname: t, template: l } = e, n = t.split("/").filter((e)=>!!e), i = l.split("/").filter((e)=>!!e), a = {};
|
|
25
25
|
return {
|
|
26
26
|
pathname: n.map((e)=>{
|
|
27
27
|
let t = e.endsWith("*"), l = (e = e.replace("*", "")).startsWith("{{") && e.endsWith("}}"), n = l ? e.match(/{{(.+)}}/)?.[1].trim() ?? "" : e.trim(), i = encodeURIComponent(n) + (t ? "*" : "");
|
|
28
|
-
return
|
|
28
|
+
return a[n] = {
|
|
29
29
|
isDynamic: l,
|
|
30
30
|
hasWildcard: t
|
|
31
31
|
}, l ? `:${i}` : i;
|
|
32
32
|
}).join("/"),
|
|
33
33
|
template: i.map((e)=>{
|
|
34
|
-
let t = e.startsWith("[") && e.endsWith("]"), l = t ? e.match(/\[(.+)\]/)?.[1].trim() ?? "" : e.trim(), n =
|
|
34
|
+
let t = e.startsWith("[") && e.endsWith("]"), l = t ? e.match(/\[(.+)\]/)?.[1].trim() ?? "" : e.trim(), n = a[l]?.hasWildcard, i = encodeURIComponent(l) + (n ? "*" : "");
|
|
35
35
|
return t ? `:${i}` : i;
|
|
36
36
|
}).join("/")
|
|
37
37
|
};
|
|
38
38
|
}
|
|
39
39
|
function i(e = {}, t, l = "", n = "") {
|
|
40
|
-
let
|
|
41
|
-
for(let
|
|
42
|
-
let o = t[
|
|
43
|
-
"string" == typeof o ? (!
|
|
40
|
+
let a = Object.keys(t).includes("[spa]");
|
|
41
|
+
for(let r in t){
|
|
42
|
+
let o = t[r], s = `${n}/${r}`;
|
|
43
|
+
"string" == typeof o ? (!a || a && [
|
|
44
44
|
"[spa]",
|
|
45
45
|
"index"
|
|
46
|
-
].includes(
|
|
46
|
+
].includes(r)) && (e[s] = {
|
|
47
47
|
template: s,
|
|
48
48
|
pathname: o,
|
|
49
49
|
wildcard: o.includes("*")
|
|
50
|
-
}) :
|
|
50
|
+
}) : a || i(e, o, l, s);
|
|
51
51
|
}
|
|
52
52
|
return e;
|
|
53
53
|
}
|
|
54
|
-
function
|
|
54
|
+
function a(e) {
|
|
55
55
|
return e.replace(/\/index$/, "");
|
|
56
56
|
}
|
|
57
|
-
function
|
|
58
|
-
let { localeSource: l, localeDestination: i, route:
|
|
59
|
-
if (p !==
|
|
57
|
+
function r$1(e) {
|
|
58
|
+
let { localeSource: l, localeDestination: i, route: r, usePathnameAsSource: o, permanent: s } = e, { template: c, pathname: u } = n(r), f = l ? `${l}/` : "", p = a(`/${normaliseUrlPathname(f + (o ? u : c))}`), h = i ? `${i}/` : "", m = `/${normaliseUrlPathname(h + u)}`;
|
|
59
|
+
if (p !== m) return {
|
|
60
60
|
source: p,
|
|
61
|
-
destination:
|
|
61
|
+
destination: m,
|
|
62
62
|
permanent: !!s
|
|
63
63
|
};
|
|
64
64
|
}
|
|
65
65
|
function o(e) {
|
|
66
|
-
let { localeSource: l, localeDestination: i, localeParam:
|
|
67
|
-
l ? u = `${l}/` :
|
|
66
|
+
let { localeSource: l, localeDestination: i, localeParam: r, route: o } = e, { pathname: s, template: c } = n(o), u = "";
|
|
67
|
+
l ? u = `${l}/` : r && (u = `:${r}/`);
|
|
68
68
|
let f = `/${normaliseUrlPathname(u + s)}`, p = "";
|
|
69
|
-
i ? p = `${i}/` :
|
|
70
|
-
let h =
|
|
69
|
+
i ? p = `${i}/` : r && (p = `:${r}/`);
|
|
70
|
+
let h = a(`/${normaliseUrlPathname(p + c)}`);
|
|
71
71
|
if (f !== h) return {
|
|
72
72
|
source: f,
|
|
73
73
|
destination: h
|
|
@@ -82,86 +82,85 @@ let withI18nLegacy = (t)=>{
|
|
|
82
82
|
}, h = {
|
|
83
83
|
...f
|
|
84
84
|
};
|
|
85
|
-
|
|
85
|
+
if (p.locales && p.defaultLocale && (h.i18n = {
|
|
86
86
|
locales: p.locales,
|
|
87
87
|
defaultLocale: p.defaultLocale,
|
|
88
88
|
...f.i18n || {}
|
|
89
|
-
}), n)
|
|
90
|
-
|
|
91
|
-
async
|
|
92
|
-
let
|
|
89
|
+
}), n) {
|
|
90
|
+
let { redirects: t, rewrites: c } = h;
|
|
91
|
+
h.redirects = async ()=>{
|
|
92
|
+
let o = function(t) {
|
|
93
93
|
let { routes: n, defaultLocale: o, hideDefaultLocaleInUrl: s, localeParam: c, permanent: u, debug: f } = t, p = l$1(n, o), h = [];
|
|
94
94
|
for(let e in p){
|
|
95
95
|
let t = i({}, n[e]);
|
|
96
96
|
for(let l in t){
|
|
97
97
|
let n = t[l];
|
|
98
|
-
if (n.pathname !==
|
|
98
|
+
if (n.pathname !== a(l)) {
|
|
99
99
|
let t = e === o && !s, l = e === o && s;
|
|
100
|
-
c ? t ? h.push(
|
|
100
|
+
c ? t ? h.push(r$1({
|
|
101
101
|
localeDestination: e,
|
|
102
102
|
route: n,
|
|
103
103
|
permanent: u
|
|
104
|
-
})) : l ? h.push(
|
|
104
|
+
})) : l ? h.push(r$1({
|
|
105
105
|
localeSource: e,
|
|
106
106
|
route: n,
|
|
107
107
|
permanent: u
|
|
108
|
-
})) : e !== o ? h.push(
|
|
108
|
+
})) : e !== o ? h.push(r$1({
|
|
109
109
|
localeSource: e,
|
|
110
110
|
localeDestination: e,
|
|
111
111
|
route: n,
|
|
112
112
|
permanent: u
|
|
113
|
-
})) : h.push(
|
|
113
|
+
})) : h.push(r$1({
|
|
114
114
|
route: n,
|
|
115
115
|
permanent: u
|
|
116
|
-
})) : t ? h.push(
|
|
116
|
+
})) : t ? h.push(r$1({
|
|
117
117
|
localeDestination: e,
|
|
118
118
|
route: n,
|
|
119
119
|
permanent: u
|
|
120
|
-
})) : e !== o ? h.push(
|
|
120
|
+
})) : e !== o ? h.push(r$1({
|
|
121
121
|
localeSource: e,
|
|
122
122
|
localeDestination: e,
|
|
123
123
|
route: n,
|
|
124
124
|
permanent: u
|
|
125
|
-
})) : h.push(
|
|
125
|
+
})) : h.push(r$1({
|
|
126
126
|
route: n,
|
|
127
127
|
permanent: u
|
|
128
128
|
}));
|
|
129
129
|
}
|
|
130
130
|
}
|
|
131
131
|
}
|
|
132
|
-
let
|
|
132
|
+
let m = arrayUniqueByProperties(h.filter(Boolean), [
|
|
133
133
|
"source",
|
|
134
134
|
"destination"
|
|
135
135
|
]).map((e)=>c ? e : {
|
|
136
136
|
...e,
|
|
137
137
|
locale: !1
|
|
138
138
|
});
|
|
139
|
-
return f && console.info("[@koine/next/plugin-legacy:generateRedirects]",
|
|
139
|
+
return f && console.info("[@koine/next/plugin-legacy:generateRedirects]", m), m;
|
|
140
140
|
}({
|
|
141
141
|
routes: n,
|
|
142
142
|
permanent: s,
|
|
143
143
|
debug: u,
|
|
144
144
|
...p
|
|
145
145
|
});
|
|
146
|
-
return
|
|
147
|
-
...
|
|
148
|
-
...await
|
|
149
|
-
] :
|
|
150
|
-
},
|
|
151
|
-
async rewrites () {
|
|
146
|
+
return t ? [
|
|
147
|
+
...o,
|
|
148
|
+
...await t()
|
|
149
|
+
] : o;
|
|
150
|
+
}, h.rewrites = async ()=>{
|
|
152
151
|
let t = function(t) {
|
|
153
|
-
let { routes: n, defaultLocale:
|
|
152
|
+
let { routes: n, defaultLocale: r, hideDefaultLocaleInUrl: s, localeParam: c, debug: u } = t, f = l$1(n, r), p = [];
|
|
154
153
|
for(let e in f){
|
|
155
154
|
let t = i({}, n[e]);
|
|
156
155
|
for(let l in t){
|
|
157
|
-
let n = t[l], i = e ===
|
|
156
|
+
let n = t[l], i = e === r && !s, u = e === r && s;
|
|
158
157
|
c ? u ? p.push(o({
|
|
159
158
|
localeDestination: e,
|
|
160
159
|
route: n
|
|
161
160
|
})) : p.push(o({
|
|
162
161
|
localeParam: c,
|
|
163
162
|
route: n
|
|
164
|
-
})) : n.pathname !==
|
|
163
|
+
})) : n.pathname !== a(l) && (e !== r || i ? p.push(o({
|
|
165
164
|
localeSource: e,
|
|
166
165
|
route: n
|
|
167
166
|
})) : p.push(o({
|
|
@@ -179,8 +178,8 @@ let withI18nLegacy = (t)=>{
|
|
|
179
178
|
debug: u,
|
|
180
179
|
...p
|
|
181
180
|
});
|
|
182
|
-
if (
|
|
183
|
-
let e = await
|
|
181
|
+
if (c) {
|
|
182
|
+
let e = await c();
|
|
184
183
|
return Array.isArray(e) ? {
|
|
185
184
|
beforeFiles: t,
|
|
186
185
|
afterFiles: e,
|
|
@@ -198,8 +197,9 @@ let withI18nLegacy = (t)=>{
|
|
|
198
197
|
afterFiles: [],
|
|
199
198
|
fallback: []
|
|
200
199
|
};
|
|
201
|
-
}
|
|
202
|
-
}
|
|
200
|
+
};
|
|
201
|
+
}
|
|
202
|
+
return h;
|
|
203
203
|
};
|
|
204
204
|
|
|
205
205
|
function transformPathname(n, e) {
|
package/package.json
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
"name": "@koine/i18n",
|
|
3
3
|
"sideEffects": false,
|
|
4
4
|
"dependencies": {
|
|
5
|
-
"@koine/node": "2.0.0-beta.
|
|
6
|
-
"@koine/utils": "2.0.0-beta.
|
|
5
|
+
"@koine/node": "2.0.0-beta.51",
|
|
6
|
+
"@koine/utils": "2.0.0-beta.51",
|
|
7
7
|
"glob": "^10.3.10",
|
|
8
8
|
"webpack": "^5.90.1",
|
|
9
9
|
"minimatch": "^9.0.3",
|
|
@@ -52,5 +52,5 @@
|
|
|
52
52
|
},
|
|
53
53
|
"module": "./index.esm.js",
|
|
54
54
|
"main": "./index.cjs.js",
|
|
55
|
-
"version": "2.0.0-beta.
|
|
55
|
+
"version": "2.0.0-beta.51"
|
|
56
56
|
}
|