intor 1.0.39 → 2.0.0

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.
@@ -3,9 +3,9 @@
3
3
  var server = require('next/server');
4
4
  var headers = require('next/headers');
5
5
 
6
- // src/adapters/next-client/routing/utils/create-response.ts
6
+ // src/adapters/next/middleware/utils/create-response.ts
7
7
 
8
- // src/adapters/next-client/routing/utils/set-locale-cookie-edge.ts
8
+ // src/adapters/next/middleware/utils/set-locale-cookie-edge.ts
9
9
  function setLocaleCookieEdge({
10
10
  request,
11
11
  response,
@@ -14,13 +14,9 @@ function setLocaleCookieEdge({
14
14
  override = false
15
15
  // Default to not override existed cookie
16
16
  }) {
17
- if (cookie.disabled || !cookie.autoSetCookie) {
18
- return;
19
- }
17
+ if (cookie.disabled || !cookie.autoSetCookie) return;
20
18
  const isCookieExists = request.cookies.has(cookie.name);
21
- if (isCookieExists && !override) {
22
- return;
23
- }
19
+ if (isCookieExists && !override) return;
24
20
  response.cookies.set(cookie.name, locale, {
25
21
  maxAge: cookie.maxAge,
26
22
  path: cookie.path,
@@ -31,49 +27,98 @@ function setLocaleCookieEdge({
31
27
  });
32
28
  }
33
29
 
34
- // src/adapters/next-client/constants/header-key-constants.ts
35
- var DEFAULT_PATHNAME_HEADER_NAME = "x-intor-pathname";
30
+ // src/adapters/next/shared/constants/pathname-header-name.ts
31
+ var PATHNAME_HEADER_NAME = "x-intor-pathname";
36
32
 
37
- // src/adapters/next-client/routing/utils/set-pathname-header.ts
33
+ // src/adapters/next/middleware/utils/set-pathname-header.ts
38
34
  var setPathnameHeader = ({
39
35
  request,
40
36
  response,
41
- key = DEFAULT_PATHNAME_HEADER_NAME
37
+ key = PATHNAME_HEADER_NAME
42
38
  }) => {
43
39
  const pathname = request.nextUrl.pathname;
44
40
  response.headers.set(key, pathname);
45
41
  return response;
46
42
  };
47
43
 
48
- // src/adapters/next-client/utils/locale-prefix-pathname.ts
44
+ // src/shared/constants/prefix-placeholder.ts
45
+ var PREFIX_PLACEHOLDER = "{locale}";
46
+
47
+ // src/adapters/next/shared/utils/locale-prefix-pathname.ts
49
48
  var localePrefixPathname = ({
50
49
  config,
51
50
  pathname: standardizedPathname,
52
51
  locale
53
52
  }) => {
54
- const { routing, prefixPlaceHolder } = config;
53
+ const { routing } = config;
55
54
  const { prefix } = routing;
56
55
  if (prefix !== "none" && !locale) {
57
56
  throw new Error('No locale when using prefix "all", "except-default"');
58
57
  }
59
58
  if (prefix === "all") {
60
- return standardizedPathname.replace(prefixPlaceHolder, locale);
59
+ return standardizedPathname.replace(PREFIX_PLACEHOLDER, locale);
61
60
  }
62
61
  if (prefix === "except-default") {
63
62
  if (locale === config.defaultLocale) {
64
- return standardizedPathname.replace(`/${prefixPlaceHolder}`, "");
63
+ return standardizedPathname.replace(`/${PREFIX_PLACEHOLDER}`, "");
65
64
  } else {
66
- return standardizedPathname.replace(prefixPlaceHolder, locale);
65
+ return standardizedPathname.replace(PREFIX_PLACEHOLDER, locale);
66
+ }
67
+ }
68
+ return standardizedPathname.replace(`/${PREFIX_PLACEHOLDER}`, "");
69
+ };
70
+
71
+ // src/shared/utils/locale/normalize-locale.ts
72
+ var normalizeLocale = (locale = "", supportedLocales = []) => {
73
+ if (!locale || supportedLocales.length === 0) return;
74
+ const toCanonical = (input) => {
75
+ try {
76
+ return Intl.getCanonicalLocales(input)[0]?.toLowerCase();
77
+ } catch {
78
+ return;
79
+ }
80
+ };
81
+ const canonicalLocale = toCanonical(locale);
82
+ if (!canonicalLocale) return;
83
+ const supportedCanonicalMap = /* @__PURE__ */ new Map();
84
+ for (const l of supportedLocales) {
85
+ const normalized = toCanonical(l);
86
+ if (normalized) {
87
+ supportedCanonicalMap.set(normalized, l);
88
+ }
89
+ }
90
+ if (supportedCanonicalMap.has(canonicalLocale)) {
91
+ return supportedCanonicalMap.get(canonicalLocale);
92
+ }
93
+ const baseLang = canonicalLocale.split("-")[0];
94
+ for (const [key, original] of supportedCanonicalMap) {
95
+ const supportedBase = key.split("-")[0];
96
+ if (supportedBase === baseLang) {
97
+ return original;
67
98
  }
68
99
  }
69
- return standardizedPathname.replace(`/${prefixPlaceHolder}`, "");
100
+ return;
101
+ };
102
+
103
+ // src/shared/utils/locale/resolve-preferred-locale.ts
104
+ var resolvePreferredLocale = (acceptLanguageHeader, supportedLocales) => {
105
+ if (!acceptLanguageHeader || !supportedLocales || supportedLocales.length === 0) {
106
+ return;
107
+ }
108
+ const supportedLocalesSet = new Set(supportedLocales);
109
+ const preferred = acceptLanguageHeader.split(",").map((part) => {
110
+ const [lang, qValue] = part.split(";");
111
+ const q = qValue ? parseFloat(qValue.split("=")[1]) : 1;
112
+ if (isNaN(q)) {
113
+ return { lang: lang.trim(), q: 0 };
114
+ }
115
+ return { lang: lang.trim(), q };
116
+ }).sort((a, b) => b.q - a.q).find(({ lang }) => supportedLocalesSet.has(lang))?.lang;
117
+ return preferred;
70
118
  };
71
119
 
72
120
  // src/shared/utils/pathname/normalize-pathname.ts
73
121
  var normalizePathname = (rawPathname, options = {}) => {
74
- if (typeof rawPathname !== "string") {
75
- throw new TypeError("Expected rawPathname to be a string");
76
- }
77
122
  const length = rawPathname.length;
78
123
  let start = 0;
79
124
  let end = length - 1;
@@ -144,18 +189,18 @@ var standardizePathname = ({
144
189
  config,
145
190
  pathname
146
191
  }) => {
147
- const { routing, prefixPlaceHolder } = config;
192
+ const { routing } = config;
148
193
  const { basePath } = routing;
149
194
  const parts = [
150
195
  normalizePathname(basePath),
151
- normalizePathname(prefixPlaceHolder),
196
+ PREFIX_PLACEHOLDER,
152
197
  normalizePathname(pathname)
153
198
  ];
154
199
  const standardizedPathname = parts.join("/").replace(/\/{2,}/g, "/");
155
200
  return normalizePathname(standardizedPathname);
156
201
  };
157
202
 
158
- // src/adapters/next-client/utils/localize-pathname.ts
203
+ // src/adapters/next/shared/utils/localize-pathname.ts
159
204
  var localizePathname = ({
160
205
  config,
161
206
  pathname: rawPathname,
@@ -181,7 +226,7 @@ var localizePathname = ({
181
226
  };
182
227
  };
183
228
 
184
- // src/adapters/next-client/routing/utils/create-response.ts
229
+ // src/adapters/next/middleware/utils/create-response.ts
185
230
  var createResponse = ({
186
231
  request,
187
232
  config,
@@ -199,18 +244,10 @@ var createResponse = ({
199
244
  });
200
245
  url.pathname = localePrefixedPathname;
201
246
  let response;
202
- switch (responseType) {
203
- case "next": {
204
- response = server.NextResponse.next();
205
- break;
206
- }
207
- case "redirect": {
208
- response = server.NextResponse.redirect(url);
209
- break;
210
- }
211
- default: {
212
- throw new Error(`Unsupported responseType: ${responseType}`);
213
- }
247
+ if (responseType === "redirect") {
248
+ response = server.NextResponse.redirect(url);
249
+ } else {
250
+ response = server.NextResponse.next();
214
251
  }
215
252
  if (locale) {
216
253
  setLocaleCookieEdge({
@@ -224,57 +261,6 @@ var createResponse = ({
224
261
  const finalResponse = setPathnameHeader({ request, response });
225
262
  return finalResponse;
226
263
  };
227
-
228
- // src/shared/utils/locale/normalize-locale.ts
229
- var normalizeLocale = (locale = "", supportedLocales = []) => {
230
- if (!locale || supportedLocales.length === 0) return void 0;
231
- const toCanonical = (input) => {
232
- try {
233
- return Intl.getCanonicalLocales(input)[0]?.toLowerCase();
234
- } catch {
235
- return void 0;
236
- }
237
- };
238
- const canonicalLocale = toCanonical(locale);
239
- if (!canonicalLocale) return void 0;
240
- const supportedCanonicalMap = /* @__PURE__ */ new Map();
241
- for (const l of supportedLocales) {
242
- const normalized = toCanonical(l);
243
- if (normalized) {
244
- supportedCanonicalMap.set(normalized, l);
245
- }
246
- }
247
- if (supportedCanonicalMap.has(canonicalLocale)) {
248
- return supportedCanonicalMap.get(canonicalLocale);
249
- }
250
- const baseLang = canonicalLocale.split("-")[0];
251
- for (const [key, original] of supportedCanonicalMap) {
252
- const supportedBase = key.split("-")[0];
253
- if (supportedBase === baseLang) {
254
- return original;
255
- }
256
- }
257
- return void 0;
258
- };
259
-
260
- // src/shared/utils/locale/resolve-preferred-locale.ts
261
- var resolvePreferredLocale = (acceptLanguageHeader, supportedLocales) => {
262
- if (!acceptLanguageHeader || !supportedLocales || supportedLocales.length === 0) {
263
- return;
264
- }
265
- const supportedLocalesSet = new Set(supportedLocales);
266
- const preferred = acceptLanguageHeader.split(",").map((part) => {
267
- const [lang, qValue] = part.split(";");
268
- const q = qValue ? parseFloat(qValue.split("=")[1]) : 1;
269
- if (isNaN(q)) {
270
- return { lang: lang.trim(), q: 0 };
271
- }
272
- return { lang: lang.trim(), q };
273
- }).sort((a, b) => b.q - a.q).find(({ lang }) => supportedLocalesSet.has(lang))?.lang;
274
- return preferred;
275
- };
276
-
277
- // src/adapters/next-client/routing/utils/determine-initial-locale.ts
278
264
  var determineInitialLocale = async (config) => {
279
265
  const { defaultLocale, supportedLocales, routing } = config;
280
266
  let initialLocale = defaultLocale;
@@ -289,7 +275,7 @@ var determineInitialLocale = async (config) => {
289
275
  return initialLocale;
290
276
  };
291
277
 
292
- // src/adapters/next-client/routing/handle-prefix/handle-prefix-all.ts
278
+ // src/adapters/next/middleware/handle-prefix/handle-prefix-all.ts
293
279
  var handlePrefixAll = async ({
294
280
  request,
295
281
  config
@@ -330,7 +316,7 @@ var handlePrefixAll = async ({
330
316
  });
331
317
  };
332
318
 
333
- // src/adapters/next-client/routing/handle-prefix/handle-prefix-except-default.ts
319
+ // src/adapters/next/middleware/handle-prefix/handle-prefix-except-default.ts
334
320
  var handlePrefixExceptDefault = async ({
335
321
  request,
336
322
  config
@@ -383,7 +369,7 @@ var handlePrefixExceptDefault = async ({
383
369
  });
384
370
  };
385
371
 
386
- // src/adapters/next-client/routing/handle-prefix/handle-prefix-none.ts
372
+ // src/adapters/next/middleware/handle-prefix/handle-prefix-none.ts
387
373
  var handlePrefixNone = async ({
388
374
  request,
389
375
  config
@@ -395,7 +381,7 @@ var handlePrefixNone = async ({
395
381
  return createResponse({ request, config, locale });
396
382
  };
397
383
 
398
- // src/adapters/next-client/routing/intor-middleware.ts
384
+ // src/adapters/next/middleware/intor-middleware.ts
399
385
  async function intorMiddleware({
400
386
  request,
401
387
  config
@@ -410,5 +396,5 @@ async function intorMiddleware({
410
396
  return await handlePrefixAll({ request, config });
411
397
  }
412
398
 
413
- exports.PATHNAME_HEADER_NAME = DEFAULT_PATHNAME_HEADER_NAME;
399
+ exports.PATHNAME_HEADER_NAME = PATHNAME_HEADER_NAME;
414
400
  exports.intorMiddleware = intorMiddleware;
@@ -2,30 +2,51 @@ import { NextRequest } from 'next/server';
2
2
  import { Level, NormalizerConfig, FormatterConfig, LoggerPreset } from 'logry/edge';
3
3
  import { Locale, LocaleNamespaceMessages, FallbackLocalesMap } from 'intor-translator';
4
4
 
5
- type InitCookieOptions = {
5
+ type CookieRawOptions = {
6
+ /** Completely disable cookie usage (no read, no write, no lookup by name) - default: false */
6
7
  disabled?: boolean;
8
+ /** Allow the system to automatically set cookies - default: true */
7
9
  autoSetCookie?: boolean;
10
+ /** default: "intor.i18n.locale" */
8
11
  name?: string;
9
- maxAge?: number;
10
- path?: string;
12
+ /** default: null */
11
13
  domain?: string | null;
12
- secure?: boolean;
14
+ /** default: "/" */
15
+ path?: string;
16
+ /** default: 60 * 60 * 24 * 365 (365 days) */
17
+ maxAge?: number;
18
+ /** default: false */
13
19
  httpOnly?: boolean;
20
+ /** default: process.env.NODE_ENV !== "development" */
21
+ secure?: boolean;
22
+ /** default: lax */
14
23
  sameSite?: "lax" | "strict" | "none";
15
24
  };
16
- type ResolvedCookieOptions = Required<Omit<InitCookieOptions, "domain">> & {
25
+ type CookieResolvedOptions = Required<Omit<CookieRawOptions, "domain">> & {
17
26
  domain: string | null;
18
27
  };
19
28
 
20
- declare const intorAdapters: readonly ["next-client", "next-server"];
21
- type IntorAdapter = (typeof intorAdapters)[number];
22
-
29
+ /**
30
+ * ```ts
31
+ * {
32
+ * default: ["ui", "meta"],
33
+ * "/auth": ["auth", "admin"],
34
+ * }
35
+ * // When pathname is "/" => namespaces: ["ui", "meta"]
36
+ * // When pathname is "/auth" => namespaces: ["ui", "meta", "auth", "admin"]
37
+ * ```
38
+ */
23
39
  type RouteNamespaces = {
24
40
  [key: string]: string[];
25
41
  } | {
26
42
  [key: string]: string[];
27
43
  default: string[];
28
44
  };
45
+ interface ApiHeaders {
46
+ authorization?: string;
47
+ "x-api-key"?: string;
48
+ [key: string]: string | undefined;
49
+ }
29
50
  type BaseLoaderOptions = {
30
51
  basePath?: string;
31
52
  namespaces?: string[];
@@ -39,65 +60,75 @@ type ImportLoader = BaseLoaderOptions & {
39
60
  type ApiLoader = BaseLoaderOptions & {
40
61
  type: "api";
41
62
  apiUrl: string;
63
+ apiHeaders?: ApiHeaders;
42
64
  fullReload?: boolean;
43
65
  };
44
66
  type LoaderOptions = ImportLoader | ApiLoader;
45
67
 
46
- type InitLoggerOptions = {
68
+ type LoggerOptions = {
47
69
  level?: Level;
48
70
  normalizerConfig?: NormalizerConfig;
49
71
  formatterConfig?: FormatterConfig;
50
72
  preset?: LoggerPreset;
51
73
  };
52
- type ResolvedLoggerOptions = InitLoggerOptions;
53
74
 
54
75
  declare const routingPrefix: readonly ["none", "all", "except-default"];
55
76
  declare const routingFirstVisitLocaleSource: readonly ["default", "browser"];
56
- type InitRoutingOptions = {
77
+ type RoutingRawOptions = {
78
+ /** default: "none" */
57
79
  prefix?: (typeof routingPrefix)[number];
58
80
  firstVisit?: {
81
+ /** default: "browser" */
59
82
  localeSource?: (typeof routingFirstVisitLocaleSource)[number];
83
+ /** default: true */
60
84
  redirect?: boolean;
61
85
  };
86
+ /** default: "" */
62
87
  basePath?: string;
63
88
  };
64
- type ResolvedRoutingOptions = Required<InitRoutingOptions>;
89
+ type RoutingResolvedOptions = Required<RoutingRawOptions>;
65
90
 
66
- type InitTranslatorOptions = {
91
+ type CacheRawOptions = {
92
+ enabled?: boolean;
93
+ /** default: 60\*60\*1000 (1 hour) */
94
+ ttl?: number;
95
+ };
96
+ type CacheResolvedOptions = Required<CacheRawOptions>;
97
+
98
+ type TranslatorOptions = {
67
99
  loadingMessage?: string;
68
100
  placeholder?: string;
69
101
  };
70
102
 
71
- type WithStaticMessages = {
72
- loaderOptions?: undefined;
103
+ type WithoutLoader = {
104
+ loader?: undefined;
73
105
  supportedLocales?: readonly Locale[];
74
106
  };
75
- type WithDynamicMessages = {
76
- loaderOptions: LoaderOptions;
107
+ type WithLoader = {
108
+ loader: LoaderOptions;
77
109
  supportedLocales: readonly Locale[];
78
110
  };
79
- type IntorResolvedConfig = (WithDynamicMessages | WithStaticMessages) & {
111
+ type IntorResolvedConfig = (WithLoader | WithoutLoader) & {
80
112
  readonly id: string;
81
113
  readonly messages?: LocaleNamespaceMessages;
82
114
  readonly defaultLocale: Locale;
83
115
  readonly fallbackLocales: FallbackLocalesMap;
84
- readonly translator?: InitTranslatorOptions;
85
- readonly cookie: ResolvedCookieOptions;
86
- readonly routing: ResolvedRoutingOptions;
87
- readonly adapter: IntorAdapter;
88
- readonly logger?: ResolvedLoggerOptions;
89
- readonly prefixPlaceHolder: string;
116
+ readonly translator?: TranslatorOptions;
117
+ readonly cookie: CookieResolvedOptions;
118
+ readonly routing: RoutingResolvedOptions;
119
+ readonly logger?: LoggerOptions;
120
+ readonly cache: CacheResolvedOptions;
90
121
  };
91
122
 
92
- type IntorMiddlewareParams = {
123
+ interface IntorMiddlewareParams {
93
124
  request: NextRequest;
94
125
  config: IntorResolvedConfig;
95
- };
126
+ }
96
127
  /**
97
128
  * Handle locale routing based on prefix config
98
129
  */
99
130
  declare function intorMiddleware({ request, config, }: IntorMiddlewareParams): Promise<Response>;
100
131
 
101
- declare const DEFAULT_PATHNAME_HEADER_NAME = "x-intor-pathname";
132
+ declare const PATHNAME_HEADER_NAME = "x-intor-pathname";
102
133
 
103
- export { DEFAULT_PATHNAME_HEADER_NAME as PATHNAME_HEADER_NAME, intorMiddleware };
134
+ export { PATHNAME_HEADER_NAME, intorMiddleware };
@@ -2,30 +2,51 @@ import { NextRequest } from 'next/server';
2
2
  import { Level, NormalizerConfig, FormatterConfig, LoggerPreset } from 'logry/edge';
3
3
  import { Locale, LocaleNamespaceMessages, FallbackLocalesMap } from 'intor-translator';
4
4
 
5
- type InitCookieOptions = {
5
+ type CookieRawOptions = {
6
+ /** Completely disable cookie usage (no read, no write, no lookup by name) - default: false */
6
7
  disabled?: boolean;
8
+ /** Allow the system to automatically set cookies - default: true */
7
9
  autoSetCookie?: boolean;
10
+ /** default: "intor.i18n.locale" */
8
11
  name?: string;
9
- maxAge?: number;
10
- path?: string;
12
+ /** default: null */
11
13
  domain?: string | null;
12
- secure?: boolean;
14
+ /** default: "/" */
15
+ path?: string;
16
+ /** default: 60 * 60 * 24 * 365 (365 days) */
17
+ maxAge?: number;
18
+ /** default: false */
13
19
  httpOnly?: boolean;
20
+ /** default: process.env.NODE_ENV !== "development" */
21
+ secure?: boolean;
22
+ /** default: lax */
14
23
  sameSite?: "lax" | "strict" | "none";
15
24
  };
16
- type ResolvedCookieOptions = Required<Omit<InitCookieOptions, "domain">> & {
25
+ type CookieResolvedOptions = Required<Omit<CookieRawOptions, "domain">> & {
17
26
  domain: string | null;
18
27
  };
19
28
 
20
- declare const intorAdapters: readonly ["next-client", "next-server"];
21
- type IntorAdapter = (typeof intorAdapters)[number];
22
-
29
+ /**
30
+ * ```ts
31
+ * {
32
+ * default: ["ui", "meta"],
33
+ * "/auth": ["auth", "admin"],
34
+ * }
35
+ * // When pathname is "/" => namespaces: ["ui", "meta"]
36
+ * // When pathname is "/auth" => namespaces: ["ui", "meta", "auth", "admin"]
37
+ * ```
38
+ */
23
39
  type RouteNamespaces = {
24
40
  [key: string]: string[];
25
41
  } | {
26
42
  [key: string]: string[];
27
43
  default: string[];
28
44
  };
45
+ interface ApiHeaders {
46
+ authorization?: string;
47
+ "x-api-key"?: string;
48
+ [key: string]: string | undefined;
49
+ }
29
50
  type BaseLoaderOptions = {
30
51
  basePath?: string;
31
52
  namespaces?: string[];
@@ -39,65 +60,75 @@ type ImportLoader = BaseLoaderOptions & {
39
60
  type ApiLoader = BaseLoaderOptions & {
40
61
  type: "api";
41
62
  apiUrl: string;
63
+ apiHeaders?: ApiHeaders;
42
64
  fullReload?: boolean;
43
65
  };
44
66
  type LoaderOptions = ImportLoader | ApiLoader;
45
67
 
46
- type InitLoggerOptions = {
68
+ type LoggerOptions = {
47
69
  level?: Level;
48
70
  normalizerConfig?: NormalizerConfig;
49
71
  formatterConfig?: FormatterConfig;
50
72
  preset?: LoggerPreset;
51
73
  };
52
- type ResolvedLoggerOptions = InitLoggerOptions;
53
74
 
54
75
  declare const routingPrefix: readonly ["none", "all", "except-default"];
55
76
  declare const routingFirstVisitLocaleSource: readonly ["default", "browser"];
56
- type InitRoutingOptions = {
77
+ type RoutingRawOptions = {
78
+ /** default: "none" */
57
79
  prefix?: (typeof routingPrefix)[number];
58
80
  firstVisit?: {
81
+ /** default: "browser" */
59
82
  localeSource?: (typeof routingFirstVisitLocaleSource)[number];
83
+ /** default: true */
60
84
  redirect?: boolean;
61
85
  };
86
+ /** default: "" */
62
87
  basePath?: string;
63
88
  };
64
- type ResolvedRoutingOptions = Required<InitRoutingOptions>;
89
+ type RoutingResolvedOptions = Required<RoutingRawOptions>;
65
90
 
66
- type InitTranslatorOptions = {
91
+ type CacheRawOptions = {
92
+ enabled?: boolean;
93
+ /** default: 60\*60\*1000 (1 hour) */
94
+ ttl?: number;
95
+ };
96
+ type CacheResolvedOptions = Required<CacheRawOptions>;
97
+
98
+ type TranslatorOptions = {
67
99
  loadingMessage?: string;
68
100
  placeholder?: string;
69
101
  };
70
102
 
71
- type WithStaticMessages = {
72
- loaderOptions?: undefined;
103
+ type WithoutLoader = {
104
+ loader?: undefined;
73
105
  supportedLocales?: readonly Locale[];
74
106
  };
75
- type WithDynamicMessages = {
76
- loaderOptions: LoaderOptions;
107
+ type WithLoader = {
108
+ loader: LoaderOptions;
77
109
  supportedLocales: readonly Locale[];
78
110
  };
79
- type IntorResolvedConfig = (WithDynamicMessages | WithStaticMessages) & {
111
+ type IntorResolvedConfig = (WithLoader | WithoutLoader) & {
80
112
  readonly id: string;
81
113
  readonly messages?: LocaleNamespaceMessages;
82
114
  readonly defaultLocale: Locale;
83
115
  readonly fallbackLocales: FallbackLocalesMap;
84
- readonly translator?: InitTranslatorOptions;
85
- readonly cookie: ResolvedCookieOptions;
86
- readonly routing: ResolvedRoutingOptions;
87
- readonly adapter: IntorAdapter;
88
- readonly logger?: ResolvedLoggerOptions;
89
- readonly prefixPlaceHolder: string;
116
+ readonly translator?: TranslatorOptions;
117
+ readonly cookie: CookieResolvedOptions;
118
+ readonly routing: RoutingResolvedOptions;
119
+ readonly logger?: LoggerOptions;
120
+ readonly cache: CacheResolvedOptions;
90
121
  };
91
122
 
92
- type IntorMiddlewareParams = {
123
+ interface IntorMiddlewareParams {
93
124
  request: NextRequest;
94
125
  config: IntorResolvedConfig;
95
- };
126
+ }
96
127
  /**
97
128
  * Handle locale routing based on prefix config
98
129
  */
99
130
  declare function intorMiddleware({ request, config, }: IntorMiddlewareParams): Promise<Response>;
100
131
 
101
- declare const DEFAULT_PATHNAME_HEADER_NAME = "x-intor-pathname";
132
+ declare const PATHNAME_HEADER_NAME = "x-intor-pathname";
102
133
 
103
- export { DEFAULT_PATHNAME_HEADER_NAME as PATHNAME_HEADER_NAME, intorMiddleware };
134
+ export { PATHNAME_HEADER_NAME, intorMiddleware };