next-intl 3.22.0-canary.1 → 3.22.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.
Files changed (63) hide show
  1. package/dist/development/middleware/getAlternateLinksHeaderValue.js +1 -1
  2. package/dist/development/middleware/middleware.js +4 -8
  3. package/dist/development/middleware/resolveLocale.js +6 -6
  4. package/dist/development/middleware/utils.js +4 -1
  5. package/dist/development/navigation/react-client/createLocalizedPathnamesNavigation.js +2 -2
  6. package/dist/development/navigation/react-client/createSharedPathnamesNavigation.js +1 -1
  7. package/dist/development/plugin.js +16 -6
  8. package/dist/development/react-client/index.js +3 -1
  9. package/dist/development/routing/config.js +1 -1
  10. package/dist/development/server/react-client/index.js +2 -0
  11. package/dist/development/server/react-server/RequestLocale.js +1 -1
  12. package/dist/development/server/react-server/RequestLocaleLegacy.js +1 -1
  13. package/dist/development/server/react-server/createRequestConfig.js +1 -1
  14. package/dist/development/server.react-client.js +1 -0
  15. package/dist/development/server.react-server.js +1 -0
  16. package/dist/development/shared/utils.js +2 -2
  17. package/dist/esm/middleware/getAlternateLinksHeaderValue.js +1 -1
  18. package/dist/esm/middleware/middleware.js +1 -1
  19. package/dist/esm/middleware/resolveLocale.js +1 -1
  20. package/dist/esm/middleware/utils.js +1 -1
  21. package/dist/esm/navigation/react-client/createLocalizedPathnamesNavigation.js +1 -1
  22. package/dist/esm/plugin.js +1 -1
  23. package/dist/esm/routing/config.js +1 -1
  24. package/dist/esm/server/react-client/index.js +1 -1
  25. package/dist/esm/server/react-server/RequestLocale.js +1 -1
  26. package/dist/esm/server/react-server/RequestLocaleLegacy.js +1 -1
  27. package/dist/esm/server.react-client.js +1 -1
  28. package/dist/esm/server.react-server.js +1 -1
  29. package/dist/production/middleware/getAlternateLinksHeaderValue.js +1 -1
  30. package/dist/production/middleware/middleware.js +1 -1
  31. package/dist/production/middleware/resolveLocale.js +1 -1
  32. package/dist/production/middleware/utils.js +1 -1
  33. package/dist/production/navigation/react-client/createLocalizedPathnamesNavigation.js +1 -1
  34. package/dist/production/plugin.js +1 -1
  35. package/dist/production/routing/config.js +1 -1
  36. package/dist/production/server/react-client/index.js +1 -1
  37. package/dist/production/server/react-server/RequestLocale.js +1 -1
  38. package/dist/production/server/react-server/RequestLocaleLegacy.js +1 -1
  39. package/dist/production/server.react-client.js +1 -1
  40. package/dist/production/server.react-server.js +1 -1
  41. package/dist/types/src/middleware/resolveLocale.d.ts +1 -1
  42. package/dist/types/src/middleware/utils.d.ts +1 -1
  43. package/dist/types/src/navigation/react-client/ClientLink.d.ts +1 -1
  44. package/dist/types/src/navigation/react-client/createLocalizedPathnamesNavigation.d.ts +3 -3
  45. package/dist/types/src/navigation/react-client/createNavigation.d.ts +14 -13
  46. package/dist/types/src/navigation/react-client/createSharedPathnamesNavigation.d.ts +3 -3
  47. package/dist/types/src/navigation/react-client/index.d.ts +1 -1
  48. package/dist/types/src/navigation/react-client/useBasePathname.d.ts +1 -1
  49. package/dist/types/src/navigation/react-client/useBaseRouter.d.ts +1 -1
  50. package/dist/types/src/navigation/react-server/ServerLink.d.ts +1 -1
  51. package/dist/types/src/navigation/react-server/createLocalizedPathnamesNavigation.d.ts +2 -2
  52. package/dist/types/src/navigation/react-server/createNavigation.d.ts +14 -13
  53. package/dist/types/src/navigation/shared/createSharedNavigationFns.d.ts +14 -13
  54. package/dist/types/src/navigation/shared/redirects.d.ts +1 -1
  55. package/dist/types/src/react-client/index.d.ts +1 -1
  56. package/dist/types/src/react-server/getTranslator.d.ts +1 -1
  57. package/dist/types/src/routing/config.d.ts +1 -1
  58. package/dist/types/src/server/react-client/index.d.ts +2 -1
  59. package/dist/types/src/server/react-server/getRequestConfig.d.ts +1 -1
  60. package/dist/types/src/server/react-server/getTranslations.d.ts +1 -1
  61. package/dist/types/src/server/react-server/index.d.ts +4 -1
  62. package/dist/types/src/shared/utils.d.ts +4 -4
  63. package/package.json +15 -36
@@ -50,7 +50,7 @@ function getAlternateLinksHeaderValue(_ref) {
50
50
  }
51
51
  let url;
52
52
  if (routing.domains) {
53
- const domainConfigs = routing.domains.filter(cur => utils.isLocaleSupportedOnDomain(locale, cur)) || [];
53
+ const domainConfigs = routing.domains.filter(cur => utils.isLocaleSupportedOnDomain(locale, cur));
54
54
  return domainConfigs.map(domainConfig => {
55
55
  url = new URL(normalizedUrl);
56
56
  url.port = '';
@@ -26,7 +26,7 @@ options) {
26
26
  try {
27
27
  // Resolve potential foreign symbols (e.g. /ja/%E7%B4%84 → /ja/約))
28
28
  unsafeExternalPathname = decodeURI(request.nextUrl.pathname);
29
- } catch (e) {
29
+ } catch (_unused) {
30
30
  // In case an invalid pathname is encountered, forward
31
31
  // it to Next.js which in turn responds with a 400
32
32
  return server.NextResponse.next();
@@ -92,18 +92,14 @@ options) {
92
92
  [resolvedTemplateLocale, internalTemplateName] = utils.getInternalTemplate(pathnames, unprefixedExternalPathname, locale);
93
93
  if (internalTemplateName) {
94
94
  const pathnameConfig = pathnames[internalTemplateName];
95
- const localeTemplate = typeof pathnameConfig === 'string' ? pathnameConfig :
96
- // @ts-expect-error -- This is fine
97
- pathnameConfig[locale];
95
+ const localeTemplate = typeof pathnameConfig === 'string' ? pathnameConfig : pathnameConfig[locale];
98
96
  if (utils$1.matchesPathname(localeTemplate, unprefixedExternalPathname)) {
99
97
  unprefixedInternalPathname = utils.formatTemplatePathname(unprefixedExternalPathname, localeTemplate, internalTemplateName);
100
98
  } else {
101
99
  let sourceTemplate;
102
100
  if (resolvedTemplateLocale) {
103
101
  // A localized pathname from another locale has matched
104
- sourceTemplate = typeof pathnameConfig === 'string' ? pathnameConfig :
105
- // @ts-expect-error -- This is fine
106
- pathnameConfig[resolvedTemplateLocale];
102
+ sourceTemplate = typeof pathnameConfig === 'string' ? pathnameConfig : pathnameConfig[resolvedTemplateLocale];
107
103
  } else {
108
104
  // An internal pathname has matched that
109
105
  // doesn't have a localized pathname
@@ -161,7 +157,7 @@ options) {
161
157
  if (resolvedRouting.localePrefix.mode !== 'never' && resolvedRouting.alternateLinks && resolvedRouting.locales.length > 1) {
162
158
  response.headers.set('Link', getAlternateLinksHeaderValue.default({
163
159
  routing: resolvedRouting,
164
- localizedPathnames: internalTemplateName != null && pathnames ? pathnames === null || pathnames === void 0 ? void 0 : pathnames[internalTemplateName] : undefined,
160
+ localizedPathnames: internalTemplateName != null && pathnames ? pathnames[internalTemplateName] : undefined,
165
161
  request,
166
162
  resolvedLocale: locale
167
163
  }));
@@ -12,7 +12,7 @@ var Negotiator__default = /*#__PURE__*/_interopDefault(Negotiator);
12
12
 
13
13
  function findDomainFromHost(requestHeaders, domains) {
14
14
  const host = utils.getHost(requestHeaders);
15
- if (host && domains) {
15
+ if (host) {
16
16
  return domains.find(cur => cur.domain === host);
17
17
  }
18
18
  return undefined;
@@ -31,7 +31,7 @@ function getAcceptLanguageLocale(requestHeaders, locales, defaultLocale) {
31
31
  try {
32
32
  const orderedLocales = orderLocales(locales);
33
33
  locale = intlLocalematcher.match(languages, orderedLocales, defaultLocale);
34
- } catch (e) {
34
+ } catch (_unused) {
35
35
  // Invalid language
36
36
  }
37
37
  return locale;
@@ -55,12 +55,12 @@ function resolveLocaleFromPrefix(routing, requestHeaders, requestCookies, pathna
55
55
  }
56
56
 
57
57
  // Prio 2: Use existing cookie
58
- if (!locale && routing.localeDetection && requestCookies) {
58
+ if (!locale && routing.localeDetection) {
59
59
  locale = getLocaleFromCookie(routing, requestCookies);
60
60
  }
61
61
 
62
62
  // Prio 3: Use the `accept-language` header
63
- if (!locale && routing.localeDetection && requestHeaders) {
63
+ if (!locale && routing.localeDetection) {
64
64
  locale = getAcceptLanguageLocale(requestHeaders, routing.locales, routing.defaultLocale);
65
65
  }
66
66
 
@@ -98,7 +98,7 @@ function resolveLocaleFromDomain(routing, requestHeaders, requestCookies, pathna
98
98
  }
99
99
 
100
100
  // Prio 2: Use existing cookie
101
- if (!locale && routing.localeDetection && requestCookies) {
101
+ if (!locale && routing.localeDetection) {
102
102
  const cookieLocale = getLocaleFromCookie(routing, requestCookies);
103
103
  if (cookieLocale) {
104
104
  if (utils.isLocaleSupportedOnDomain(cookieLocale, domain)) {
@@ -108,7 +108,7 @@ function resolveLocaleFromDomain(routing, requestHeaders, requestCookies, pathna
108
108
  }
109
109
 
110
110
  // Prio 3: Use the `accept-language` header
111
- if (!locale && routing.localeDetection && requestHeaders) {
111
+ if (!locale && routing.localeDetection) {
112
112
  const headerLocale = getAcceptLanguageLocale(requestHeaders, domain.locales || routing.locales, domain.defaultLocale);
113
113
  if (headerLocale) {
114
114
  locale = headerLocale;
@@ -170,7 +170,10 @@ function getBestMatchingDomain(curHostDomain, locale, domainsConfig) {
170
170
 
171
171
  // Prio 3: Use alternative domain with restricted matching locale
172
172
  if (!domainConfig) {
173
- domainConfig = domainsConfig.find(cur => cur.locales != null && cur.locales.includes(locale));
173
+ domainConfig = domainsConfig.find(cur => {
174
+ var _cur$locales;
175
+ return (_cur$locales = cur.locales) === null || _cur$locales === void 0 ? void 0 : _cur$locales.includes(locale);
176
+ });
174
177
  }
175
178
 
176
179
  // Prio 4: Stay on the current domain if it supports all locales
@@ -17,11 +17,11 @@ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
17
17
  var React__default = /*#__PURE__*/_interopDefault(React);
18
18
 
19
19
  /**
20
- * @deprecated Consider switching to `createNavigation` (see https://github.com/amannn/next-intl/pull/1316)
20
+ * @deprecated Consider switching to `createNavigation` (see https://next-intl-docs.vercel.app/blog/next-intl-3-22#create-navigation)
21
21
  **/
22
22
  function createLocalizedPathnamesNavigation(routing) {
23
23
  const config$1 = config.receiveRoutingConfig(routing);
24
- const localeCookie = config.receiveLocaleCookie(routing === null || routing === void 0 ? void 0 : routing.localeCookie);
24
+ const localeCookie = config.receiveLocaleCookie(routing.localeCookie);
25
25
  function useTypedLocale() {
26
26
  const locale = useLocale.default();
27
27
  const isValid = config$1.locales.includes(locale);
@@ -15,7 +15,7 @@ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
15
15
  var React__default = /*#__PURE__*/_interopDefault(React);
16
16
 
17
17
  /**
18
- * @deprecated Consider switching to `createNavigation` (see https://github.com/amannn/next-intl/pull/1316)
18
+ * @deprecated Consider switching to `createNavigation` (see https://next-intl-docs.vercel.app/blog/next-intl-3-22#create-navigation)
19
19
  **/
20
20
  function createSharedPathnamesNavigation(routing) {
21
21
  const localePrefix = config.receiveLocalePrefixConfig(routing === null || routing === void 0 ? void 0 : routing.localePrefix);
@@ -13,6 +13,7 @@ var path__default = /*#__PURE__*/_interopDefault(path);
13
13
  function withExtensions(localPath) {
14
14
  return ["".concat(localPath, ".ts"), "".concat(localPath, ".tsx"), "".concat(localPath, ".js"), "".concat(localPath, ".jsx")];
15
15
  }
16
+ let hasWarnedForDeprecatedI18nConfig = false;
16
17
  function resolveI18nPath(providedPath, cwd) {
17
18
  function resolvePath(pathname) {
18
19
  const parts = [];
@@ -25,21 +26,30 @@ function resolveI18nPath(providedPath, cwd) {
25
26
  }
26
27
  if (providedPath) {
27
28
  if (!pathExists(providedPath)) {
28
- throw new Error("Could not find i18n config at ".concat(providedPath, ", please provide a valid path."));
29
+ throw new Error("[next-intl] Could not find i18n config at ".concat(providedPath, ", please provide a valid path."));
29
30
  }
30
31
  return providedPath;
31
32
  } else {
32
- for (const candidate of [...withExtensions('./i18n'), ...withExtensions('./src/i18n'), ...withExtensions('./i18n/request'), ...withExtensions('./src/i18n/request')]) {
33
+ for (const candidate of [...withExtensions('./i18n/request'), ...withExtensions('./src/i18n/request')]) {
33
34
  if (pathExists(candidate)) {
34
35
  return candidate;
35
36
  }
36
37
  }
37
- throw new Error("\n\nCould not locate i18n request config for next-intl.\n\nThese paths are supported by default:\n- ./(src/)i18n/request.{js,jsx,ts,tsx}\n- ./(src/)i18n.{js,jsx,ts,tsx}\n\nAlternatively, you can specify a custom location in your Next.js config:\n\nconst withNextIntl = createNextIntlPlugin(\n './path/to/i18n/request.tsx'\n);\n");
38
+ for (const candidate of [...withExtensions('./i18n'), ...withExtensions('./src/i18n')]) {
39
+ if (pathExists(candidate)) {
40
+ if (!hasWarnedForDeprecatedI18nConfig) {
41
+ console.warn("\n[next-intl] Reading request configuration from ".concat(candidate, " is deprecated, please see https://next-intl-docs.vercel.app/blog/next-intl-3-22#i18n-request \u2014 you can either move your configuration to ./i18n/request.ts or provide a custom path in your Next.js config:\n\nconst withNextIntl = createNextIntlPlugin(\n './path/to/i18n/request.tsx'\n);\n"));
42
+ hasWarnedForDeprecatedI18nConfig = true;
43
+ }
44
+ return candidate;
45
+ }
46
+ }
47
+ throw new Error("\n[next-intl] Could not locate request configuration module.\n\nThis path is supported by default: ./(src/)i18n/request.{js,jsx,ts,tsx}\n\nAlternatively, you can specify a custom location in your Next.js config:\n\nconst withNextIntl = createNextIntlPlugin(\n './path/to/i18n/request.tsx'\n);\n");
38
48
  }
39
49
  }
40
50
  function initPlugin(i18nPath, nextConfig) {
41
51
  if ((nextConfig === null || nextConfig === void 0 ? void 0 : nextConfig.i18n) != null) {
42
- console.warn("\nnext-intl has found an `i18n` config in your next.config.js. This likely causes conflicts and should therefore be removed if you use the App Router.\n\nIf you're in progress of migrating from the `pages` folder, you can refer to this example: https://next-intl-docs.vercel.app/examples#app-router-migration\n");
52
+ console.warn("\n[next-intl] An `i18n` property was found in your Next.js config. This likely causes conflicts and should therefore be removed if you use the App Router.\n\nIf you're in progress of migrating from the Pages Router, you can refer to this example: https://next-intl-docs.vercel.app/examples#app-router-migration\n");
43
53
  }
44
54
  const useTurbo = process.env.TURBOPACK != null;
45
55
  const nextIntlConfig = {};
@@ -47,8 +57,8 @@ function initPlugin(i18nPath, nextConfig) {
47
57
  // Assign alias for `next-intl/config`
48
58
  if (useTurbo) {
49
59
  var _nextConfig$experimen, _nextConfig$experimen2;
50
- if (i18nPath && i18nPath.startsWith('/')) {
51
- throw new Error("Turbopack support for next-intl currently does not support absolute paths, please provide a relative one (e.g. './src/i18n/config.ts').\n\nFound: " + i18nPath + '\n');
60
+ if (i18nPath !== null && i18nPath !== void 0 && i18nPath.startsWith('/')) {
61
+ throw new Error("[next-intl] Turbopack support for next-intl currently does not support absolute paths, please provide a relative one (e.g. './src/i18n/config.ts').\n\nFound: " + i18nPath + '\n');
52
62
  }
53
63
  nextIntlConfig.experimental = {
54
64
  ...(nextConfig === null || nextConfig === void 0 ? void 0 : nextConfig.experimental),
@@ -14,11 +14,13 @@ var useIntl = require('use-intl');
14
14
  * supported in all Next.js versions that are supported.
15
15
  */
16
16
 
17
+
18
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
17
19
  function callHook(name, hook) {
18
20
  return function () {
19
21
  try {
20
22
  return hook(...arguments);
21
- } catch (e) {
23
+ } catch (_unused) {
22
24
  throw new Error("Failed to call `".concat(name, "` because the context from `NextIntlClientProvider` was not found.\n\nThis can happen because:\n1) You intended to render this component as a Server Component, the render\n failed, and therefore React attempted to render the component on the client\n instead. If this is the case, check the console for server errors.\n2) You intended to render this component on the client side, but no context was found.\n Learn more about this error here: https://next-intl-docs.vercel.app/docs/environments/server-client-components#missing-context") );
23
25
  }
24
26
  };
@@ -6,7 +6,7 @@ function receiveRoutingConfig(input) {
6
6
  var _input$localeDetectio, _input$alternateLinks;
7
7
  return {
8
8
  ...input,
9
- localePrefix: receiveLocalePrefixConfig(input === null || input === void 0 ? void 0 : input.localePrefix),
9
+ localePrefix: receiveLocalePrefixConfig(input.localePrefix),
10
10
  localeCookie: receiveLocaleCookie(input.localeCookie),
11
11
  localeDetection: (_input$localeDetectio = input.localeDetection) !== null && _input$localeDetectio !== void 0 ? _input$localeDetectio : true,
12
12
  alternateLinks: (_input$alternateLinks = input.alternateLinks) !== null && _input$alternateLinks !== void 0 ? _input$alternateLinks : true
@@ -29,6 +29,7 @@ const getLocale = notSupported('getLocale');
29
29
  // anyway, therefore this is irrelevant.
30
30
  const getTranslations = notSupported('getTranslations');
31
31
  const unstable_setRequestLocale = notSupported('unstable_setRequestLocale');
32
+ const setRequestLocale = notSupported('setRequestLocale');
32
33
 
33
34
  exports.getFormatter = getFormatter;
34
35
  exports.getLocale = getLocale;
@@ -37,4 +38,5 @@ exports.getNow = getNow;
37
38
  exports.getRequestConfig = getRequestConfig;
38
39
  exports.getTimeZone = getTimeZone;
39
40
  exports.getTranslations = getTranslations;
41
+ exports.setRequestLocale = setRequestLocale;
40
42
  exports.unstable_setRequestLocale = unstable_setRequestLocale;
@@ -20,7 +20,7 @@ async function getLocaleFromHeaderImpl() {
20
20
  locale = (await getHeaders()).get(constants.HEADER_LOCALE_NAME) || undefined;
21
21
  } catch (error) {
22
22
  if (error instanceof Error && error.digest === 'DYNAMIC_SERVER_USAGE') {
23
- const wrappedError = new Error('Usage of next-intl APIs in Server Components currently opts into dynamic rendering. This limitation will eventually be lifted, but as a stopgap solution, you can use the `unstable_setRequestLocale` API to enable static rendering, see https://next-intl-docs.vercel.app/docs/getting-started/app-router/with-i18n-routing#static-rendering', {
23
+ const wrappedError = new Error('Usage of next-intl APIs in Server Components currently opts into dynamic rendering. This limitation will eventually be lifted, but as a stopgap solution, you can use the `setRequestLocale` API to enable static rendering, see https://next-intl-docs.vercel.app/docs/getting-started/app-router/with-i18n-routing#static-rendering', {
24
24
  cause: error
25
25
  });
26
26
  wrappedError.digest = error.digest;
@@ -20,7 +20,7 @@ function getLocaleFromHeaderImpl() {
20
20
  locale = getHeaders().get(constants.HEADER_LOCALE_NAME);
21
21
  } catch (error) {
22
22
  if (error instanceof Error && error.digest === 'DYNAMIC_SERVER_USAGE') {
23
- throw new Error('Usage of next-intl APIs in Server Components currently opts into dynamic rendering. This limitation will eventually be lifted, but as a stopgap solution, you can use the `unstable_setRequestLocale` API to enable static rendering, see https://next-intl-docs.vercel.app/docs/getting-started/app-router/with-i18n-routing#static-rendering', {
23
+ throw new Error('Usage of next-intl APIs in Server Components currently opts into dynamic rendering. This limitation will eventually be lifted, but as a stopgap solution, you can use the `setRequestLocale` API to enable static rendering, see https://next-intl-docs.vercel.app/docs/getting-started/app-router/with-i18n-routing#static-rendering', {
24
24
  cause: error
25
25
  });
26
26
  } else {
@@ -8,7 +8,7 @@ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
8
8
 
9
9
  var getRuntimeConfig__default = /*#__PURE__*/_interopDefault(getRuntimeConfig);
10
10
 
11
- // eslint-disable-next-line import/no-extraneous-dependencies
11
+
12
12
 
13
13
  Object.defineProperty(exports, "default", {
14
14
  enumerable: true,
@@ -13,4 +13,5 @@ exports.getNow = index.getNow;
13
13
  exports.getRequestConfig = index.getRequestConfig;
14
14
  exports.getTimeZone = index.getTimeZone;
15
15
  exports.getTranslations = index.getTranslations;
16
+ exports.setRequestLocale = index.setRequestLocale;
16
17
  exports.unstable_setRequestLocale = index.unstable_setRequestLocale;
@@ -20,4 +20,5 @@ exports.getNow = getNow.default;
20
20
  exports.getTimeZone = getTimeZone.default;
21
21
  exports.getTranslations = getTranslations.default;
22
22
  exports.getLocale = getLocale.default;
23
+ exports.setRequestLocale = RequestLocaleCache.setCachedRequestLocale;
23
24
  exports.unstable_setRequestLocale = RequestLocaleCache.setCachedRequestLocale;
@@ -66,7 +66,7 @@ function hasTrailingSlash() {
66
66
  try {
67
67
  // Provided via `env` setting in `next.config.js` via the plugin
68
68
  return process.env._next_intl_trailing_slash === 'true';
69
- } catch (e) {
69
+ } catch (_unused) {
70
70
  return false;
71
71
  }
72
72
  }
@@ -82,7 +82,7 @@ function normalizeTrailingSlash(pathname) {
82
82
  }
83
83
  return pathname;
84
84
  }
85
- function matchesPathname( /** E.g. `/users/[userId]-[userName]` */
85
+ function matchesPathname(/** E.g. `/users/[userId]-[userName]` */
86
86
  template, /** E.g. `/users/23-jane` */
87
87
  pathname) {
88
88
  const normalizedTemplate = normalizeTrailingSlash(template);
@@ -1 +1 @@
1
- import{normalizeTrailingSlash as e}from"../shared/utils.js";import{getHost as a,getNormalizedPathname as t,getLocalePrefixes as o,isLocaleSupportedOnDomain as n,applyBasePath as l,formatTemplatePathname as r}from"./utils.js";function c(c){var m;let{localizedPathnames:p,request:s,resolvedLocale:i,routing:f}=c;const h=s.nextUrl.clone(),u=a(s.headers);function d(a,t){return a.pathname=e(a.pathname),s.nextUrl.basePath&&((a=new URL(a)).pathname=l(a.pathname,s.nextUrl.basePath)),"<".concat(a.toString(),'>; rel="alternate"; hreflang="').concat(t,'"')}function x(e,a){return p&&"object"==typeof p?r(e,p[i],p[a]):e}u&&(h.port="",h.host=u),h.protocol=null!==(m=s.headers.get("x-forwarded-proto"))&&void 0!==m?m:h.protocol,h.pathname=t(h.pathname,f.locales,f.localePrefix);const w=o(f.locales,f.localePrefix,!1).flatMap((e=>{let a,[t,o]=e;function l(e){return"/"===e?o:o+e}if(f.domains){return(f.domains.filter((e=>n(t,e)))||[]).map((e=>(a=new URL(h),a.port="",a.host=e.domain,a.pathname=x(h.pathname,t),t===e.defaultLocale&&"always"!==f.localePrefix.mode||(a.pathname=l(a.pathname)),d(a,t))))}{let e;e=p&&"object"==typeof p?x(h.pathname,t):h.pathname,t===f.defaultLocale&&"always"!==f.localePrefix.mode||(e=l(e)),a=new URL(e,h)}return d(a,t)}));if(!f.domains&&("always"!==f.localePrefix.mode||"/"===h.pathname)){const e=new URL(x(h.pathname,f.defaultLocale),h);w.push(d(e,"x-default"))}return w.join(", ")}export{c as default};
1
+ import{normalizeTrailingSlash as e}from"../shared/utils.js";import{getHost as a,getNormalizedPathname as t,getLocalePrefixes as o,isLocaleSupportedOnDomain as n,applyBasePath as l,formatTemplatePathname as r}from"./utils.js";function c(c){var m;let{localizedPathnames:p,request:s,resolvedLocale:i,routing:f}=c;const h=s.nextUrl.clone(),u=a(s.headers);function d(a,t){return a.pathname=e(a.pathname),s.nextUrl.basePath&&((a=new URL(a)).pathname=l(a.pathname,s.nextUrl.basePath)),"<".concat(a.toString(),'>; rel="alternate"; hreflang="').concat(t,'"')}function x(e,a){return p&&"object"==typeof p?r(e,p[i],p[a]):e}u&&(h.port="",h.host=u),h.protocol=null!==(m=s.headers.get("x-forwarded-proto"))&&void 0!==m?m:h.protocol,h.pathname=t(h.pathname,f.locales,f.localePrefix);const w=o(f.locales,f.localePrefix,!1).flatMap((e=>{let a,[t,o]=e;function l(e){return"/"===e?o:o+e}if(f.domains){return f.domains.filter((e=>n(t,e))).map((e=>(a=new URL(h),a.port="",a.host=e.domain,a.pathname=x(h.pathname,t),t===e.defaultLocale&&"always"!==f.localePrefix.mode||(a.pathname=l(a.pathname)),d(a,t))))}{let e;e=p&&"object"==typeof p?x(h.pathname,t):h.pathname,t===f.defaultLocale&&"always"!==f.localePrefix.mode||(e=l(e)),a=new URL(e,h)}return d(a,t)}));if(!f.domains&&("always"!==f.localePrefix.mode||"/"===h.pathname)){const e=new URL(x(h.pathname,f.defaultLocale),h);w.push(d(e,"x-default"))}return w.join(", ")}export{c as default};
@@ -1 +1 @@
1
- import{NextResponse as e}from"next/server";import{receiveRoutingConfig as o}from"../routing/config.js";import{HEADER_LOCALE_NAME as l}from"../shared/constants.js";import{matchesPathname as t,normalizeTrailingSlash as r,getLocalePrefix as a}from"../shared/utils.js";import n from"./getAlternateLinksHeaderValue.js";import i from"./resolveLocale.js";import s from"./syncCookie.js";import{sanitizePathname as c,isLocaleSupportedOnDomain as d,getNormalizedPathname as f,getPathnameMatch as m,getInternalTemplate as u,formatTemplatePathname as h,formatPathname as x,getBestMatchingDomain as v,applyBasePath as p,getLocaleAsPrefix as U}from"./utils.js";function P(P,k){var L,g,j;const w=o({...P,alternateLinks:null!==(L=null==k?void 0:k.alternateLinks)&&void 0!==L?L:P.alternateLinks,localeDetection:null!==(g=null==k?void 0:k.localeDetection)&&void 0!==g?g:P.localeDetection,localeCookie:null!==(j=null==k?void 0:k.localeCookie)&&void 0!==j?j:P.localeCookie});return function(o){var P;let k;try{k=decodeURI(o.nextUrl.pathname)}catch(o){return e.next()}const L=c(k),{domain:g,locale:j}=i(w,o.headers,o.cookies,L),C=g?g.defaultLocale===j:j===w.defaultLocale,b=(null===(P=w.domains)||void 0===P?void 0:P.filter((e=>d(j,e))))||[],y=null!=w.domains&&!g;function D(t){const r=new URL(t,o.url);o.nextUrl.basePath&&(r.pathname=p(r.pathname,o.nextUrl.basePath));const a=new Headers(o.headers);return a.set(l,j),e.rewrite(r,{request:{headers:a}})}function R(l,t){const a=new URL(r(l),o.url);if(b.length>0&&!t&&g){const e=v(g,j,b);e&&(t=e.domain,e.defaultLocale===j&&"as-needed"===w.localePrefix.mode&&(a.pathname=f(a.pathname,w.locales,w.localePrefix)))}var n,i;t&&(a.host=t,o.headers.get("x-forwarded-host")&&(a.protocol=null!==(n=o.headers.get("x-forwarded-proto"))&&void 0!==n?n:o.nextUrl.protocol,a.port=null!==(i=o.headers.get("x-forwarded-port"))&&void 0!==i?i:""));return o.nextUrl.basePath&&(a.pathname=p(a.pathname,o.nextUrl.basePath)),e.redirect(a.toString())}const q=f(L,w.locales,w.localePrefix),H=m(L,w.locales,w.localePrefix),z=null!=H,A="never"===w.localePrefix.mode||C&&"as-needed"===w.localePrefix.mode;let I,S,V=q;const B=w.pathnames;if(B){let e;if([e,S]=u(B,q,j),S){const l=B[S],r="string"==typeof l?l:l[j];if(t(r,q))V=h(q,r,S);else{let t;t=e?"string"==typeof l?l:l[e]:S;const n=A?void 0:a(j,w.localePrefix),i=h(q,t,r);I=R(x(i,n,o.nextUrl.search))}}}if(!I)if("/"!==V||z){const e=x(V,U(j),o.nextUrl.search);if(z){const l=x(q,H.prefix,o.nextUrl.search);if("never"===w.localePrefix.mode)I=R(x(q,void 0,o.nextUrl.search));else if(H.exact)if(C&&A)I=R(x(q,void 0,o.nextUrl.search));else if(w.domains){const o=v(g,H.locale,b);I=(null==g?void 0:g.domain)===(null==o?void 0:o.domain)||y?D(e):R(l,null==o?void 0:o.domain)}else I=D(e);else I=R(l)}else I=A?D(e):R(x(q,a(j,w.localePrefix),o.nextUrl.search))}else I=A?D(x(V,U(j),o.nextUrl.search)):R(x(q,a(j,w.localePrefix),o.nextUrl.search));return w.localeDetection&&w.localeCookie&&s(o,I,j,w.localeCookie),"never"!==w.localePrefix.mode&&w.alternateLinks&&w.locales.length>1&&I.headers.set("Link",n({routing:w,localizedPathnames:null!=S&&B?null==B?void 0:B[S]:void 0,request:o,resolvedLocale:j})),I}}export{P as default};
1
+ import{NextResponse as e}from"next/server";import{receiveRoutingConfig as o}from"../routing/config.js";import{HEADER_LOCALE_NAME as l}from"../shared/constants.js";import{matchesPathname as t,normalizeTrailingSlash as r,getLocalePrefix as a}from"../shared/utils.js";import n from"./getAlternateLinksHeaderValue.js";import i from"./resolveLocale.js";import s from"./syncCookie.js";import{sanitizePathname as c,isLocaleSupportedOnDomain as d,getNormalizedPathname as f,getPathnameMatch as m,getInternalTemplate as u,formatTemplatePathname as h,formatPathname as x,getBestMatchingDomain as v,applyBasePath as p,getLocaleAsPrefix as U}from"./utils.js";function P(P,k){var L,g,j;const w=o({...P,alternateLinks:null!==(L=null==k?void 0:k.alternateLinks)&&void 0!==L?L:P.alternateLinks,localeDetection:null!==(g=null==k?void 0:k.localeDetection)&&void 0!==g?g:P.localeDetection,localeCookie:null!==(j=null==k?void 0:k.localeCookie)&&void 0!==j?j:P.localeCookie});return function(o){var P;let k;try{k=decodeURI(o.nextUrl.pathname)}catch(o){return e.next()}const L=c(k),{domain:g,locale:j}=i(w,o.headers,o.cookies,L),C=g?g.defaultLocale===j:j===w.defaultLocale,b=(null===(P=w.domains)||void 0===P?void 0:P.filter((e=>d(j,e))))||[],y=null!=w.domains&&!g;function D(t){const r=new URL(t,o.url);o.nextUrl.basePath&&(r.pathname=p(r.pathname,o.nextUrl.basePath));const a=new Headers(o.headers);return a.set(l,j),e.rewrite(r,{request:{headers:a}})}function R(l,t){const a=new URL(r(l),o.url);if(b.length>0&&!t&&g){const e=v(g,j,b);e&&(t=e.domain,e.defaultLocale===j&&"as-needed"===w.localePrefix.mode&&(a.pathname=f(a.pathname,w.locales,w.localePrefix)))}var n,i;t&&(a.host=t,o.headers.get("x-forwarded-host")&&(a.protocol=null!==(n=o.headers.get("x-forwarded-proto"))&&void 0!==n?n:o.nextUrl.protocol,a.port=null!==(i=o.headers.get("x-forwarded-port"))&&void 0!==i?i:""));return o.nextUrl.basePath&&(a.pathname=p(a.pathname,o.nextUrl.basePath)),e.redirect(a.toString())}const q=f(L,w.locales,w.localePrefix),H=m(L,w.locales,w.localePrefix),z=null!=H,A="never"===w.localePrefix.mode||C&&"as-needed"===w.localePrefix.mode;let I,S,V=q;const B=w.pathnames;if(B){let e;if([e,S]=u(B,q,j),S){const l=B[S],r="string"==typeof l?l:l[j];if(t(r,q))V=h(q,r,S);else{let t;t=e?"string"==typeof l?l:l[e]:S;const n=A?void 0:a(j,w.localePrefix),i=h(q,t,r);I=R(x(i,n,o.nextUrl.search))}}}if(!I)if("/"!==V||z){const e=x(V,U(j),o.nextUrl.search);if(z){const l=x(q,H.prefix,o.nextUrl.search);if("never"===w.localePrefix.mode)I=R(x(q,void 0,o.nextUrl.search));else if(H.exact)if(C&&A)I=R(x(q,void 0,o.nextUrl.search));else if(w.domains){const o=v(g,H.locale,b);I=(null==g?void 0:g.domain)===(null==o?void 0:o.domain)||y?D(e):R(l,null==o?void 0:o.domain)}else I=D(e);else I=R(l)}else I=A?D(e):R(x(q,a(j,w.localePrefix),o.nextUrl.search))}else I=A?D(x(V,U(j),o.nextUrl.search)):R(x(q,a(j,w.localePrefix),o.nextUrl.search));return w.localeDetection&&w.localeCookie&&s(o,I,j,w.localeCookie),"never"!==w.localePrefix.mode&&w.alternateLinks&&w.locales.length>1&&I.headers.set("Link",n({routing:w,localizedPathnames:null!=S&&B?B[S]:void 0,request:o,resolvedLocale:j})),I}}export{P as default};
@@ -1 +1 @@
1
- import{match as e}from"@formatjs/intl-localematcher";import o from"negotiator";import{getPathnameMatch as l,isLocaleSupportedOnDomain as t,getHost as a}from"./utils.js";function n(l,t,a){let n;const c=new o({headers:{"accept-language":l.get("accept-language")||void 0}}).languages();try{const o=function(e){return e.slice().sort(((e,o)=>o.length-e.length))}(t);n=e(c,o,a)}catch(e){}return n}function c(e,o){if(e.localeCookie&&o.has(e.localeCookie.name)){var l;const t=null===(l=o.get(e.localeCookie.name))||void 0===l?void 0:l.value;if(t&&e.locales.includes(t))return t}}function i(e,o,t,a){let i;var r;a&&(i=null===(r=l(a,e.locales,e.localePrefix))||void 0===r?void 0:r.locale);return!i&&e.localeDetection&&t&&(i=c(e,t)),!i&&e.localeDetection&&o&&(i=n(o,e.locales,e.defaultLocale)),i||(i=e.defaultLocale),i}function r(e,o,r,u){const f=function(e,o){const l=a(e);if(l&&o)return o.find((e=>e.domain===l))}(o,e.domains);if(!f)return{locale:i(e,o,r,u)};let s;if(u){var d;const o=null===(d=l(u,e.locales,e.localePrefix))||void 0===d?void 0:d.locale;if(o){if(!t(o,f))return{locale:o,domain:f};s=o}}if(!s&&e.localeDetection&&r){const o=c(e,r);o&&t(o,f)&&(s=o)}if(!s&&e.localeDetection&&o){const l=n(o,f.locales||e.locales,f.defaultLocale);l&&(s=l)}return s||(s=f.defaultLocale),{locale:s,domain:f}}function u(e,o,l,t){return e.domains?r(e,o,l,t):{locale:i(e,o,l,t)}}export{u as default,n as getAcceptLanguageLocale};
1
+ import{match as e}from"@formatjs/intl-localematcher";import o from"negotiator";import{getPathnameMatch as l,isLocaleSupportedOnDomain as t,getHost as a}from"./utils.js";function n(l,t,a){let n;const c=new o({headers:{"accept-language":l.get("accept-language")||void 0}}).languages();try{const o=function(e){return e.slice().sort(((e,o)=>o.length-e.length))}(t);n=e(c,o,a)}catch(e){}return n}function c(e,o){if(e.localeCookie&&o.has(e.localeCookie.name)){var l;const t=null===(l=o.get(e.localeCookie.name))||void 0===l?void 0:l.value;if(t&&e.locales.includes(t))return t}}function i(e,o,t,a){let i;var r;a&&(i=null===(r=l(a,e.locales,e.localePrefix))||void 0===r?void 0:r.locale);return!i&&e.localeDetection&&(i=c(e,t)),!i&&e.localeDetection&&(i=n(o,e.locales,e.defaultLocale)),i||(i=e.defaultLocale),i}function r(e,o,r,u){const f=function(e,o){const l=a(e);if(l)return o.find((e=>e.domain===l))}(o,e.domains);if(!f)return{locale:i(e,o,r,u)};let s;if(u){var d;const o=null===(d=l(u,e.locales,e.localePrefix))||void 0===d?void 0:d.locale;if(o){if(!t(o,f))return{locale:o,domain:f};s=o}}if(!s&&e.localeDetection){const o=c(e,r);o&&t(o,f)&&(s=o)}if(!s&&e.localeDetection){const l=n(o,f.locales||e.locales,f.defaultLocale);l&&(s=l)}return s||(s=f.defaultLocale),{locale:s,domain:f}}function u(e,o,l,t){return e.domains?r(e,o,l,t):{locale:i(e,o,l,t)}}export{u as default,n as getAcceptLanguageLocale};
@@ -1 +1 @@
1
- import{getSortedPathnames as e,matchesPathname as t,normalizeTrailingSlash as n,getLocalePrefix as o,templateToRegex as r,prefixPathname as c}from"../shared/utils.js";function l(n,o,r){const c=e(Object.keys(n));for(const e of c){const c=n[e];if("string"==typeof c){if(t(c,o))return[void 0,e]}else{const n=Object.entries(c),l=n.findIndex((e=>{let[t]=e;return t===r}));l>0&&n.unshift(n.splice(l,1)[0]);for(const[r,c]of n)if(t(c,o))return[r,e]}}for(const e of Object.keys(n))if(t(e,o))return[void 0,e];return[void 0,void 0]}function i(e,t,o,r){let c="";return c+=d(o,a(t,e)),c=n(c),c}function u(e,t,o){e.endsWith("/")||(e+="/");const r=s(t,o),c=new RegExp("^(".concat(r.map((e=>{let[,t]=e;return t.replaceAll("/","\\/")})).join("|"),")/(.*)"),"i"),l=e.match(c);let i=l?"/"+l[2]:e;return"/"!==i&&(i=n(i)),i}function s(e,t){let n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];const r=e.map((e=>[e,o(e,t)]));return n&&r.sort(((e,t)=>t[1].length-e[1].length)),r}function f(e,t,n){const o=s(t,n);for(const[t,n]of o){let o,r;if(e===n||e.startsWith(n+"/"))o=r=!0;else{const t=e.toLowerCase(),c=n.toLowerCase();(t===c||t.startsWith(c+"/"))&&(o=!1,r=!0)}if(r)return{locale:t,prefix:n,matchedPrefix:e.slice(0,n.length),exact:o}}}function a(e,t){const o=n(t),c=n(e),l=r(c).exec(o);if(!l)return;const i={};for(let e=1;e<l.length;e++){var u;const t=null===(u=c.match(/\[([^\]]+)\]/g))||void 0===u?void 0:u[e-1].replace(/[[\]]/g,"");t&&(i[t]=l[e])}return i}function d(e,t){if(!t)return e;let n=e=e.replace(/\[\[/g,"[").replace(/\]\]/g,"]");return Object.entries(t).forEach((e=>{let[t,o]=e;n=n.replace("[".concat(t,"]"),o)})),n}function h(e,t,n){let o=e;return t&&(o=c(t,o)),n&&(o+=n),o}function g(e){var t,n;return null!==(t=null!==(n=e.get("x-forwarded-host"))&&void 0!==n?n:e.get("host"))&&void 0!==t?t:void 0}function p(e,t){return t.defaultLocale===e||!t.locales||t.locales.includes(e)}function v(e,t,n){let o;return e&&p(t,e)&&(o=e),o||(o=n.find((e=>e.defaultLocale===t))),o||(o=n.find((e=>null!=e.locales&&e.locales.includes(t)))),o||null!=(null==e?void 0:e.locales)||(o=e),o||(o=n.find((e=>!e.locales))),o}function x(e,t){return n(t+e)}function m(e){return"/".concat(e)}function j(e){return e.replace(/\\/g,"%5C").replace(/\/+/g,"/")}export{x as applyBasePath,h as formatPathname,d as formatPathnameTemplate,i as formatTemplatePathname,v as getBestMatchingDomain,g as getHost,l as getInternalTemplate,m as getLocaleAsPrefix,s as getLocalePrefixes,u as getNormalizedPathname,f as getPathnameMatch,a as getRouteParams,p as isLocaleSupportedOnDomain,j as sanitizePathname};
1
+ import{getSortedPathnames as t,matchesPathname as e,normalizeTrailingSlash as n,getLocalePrefix as r,templateToRegex as o,prefixPathname as c}from"../shared/utils.js";function l(n,r,o){const c=t(Object.keys(n));for(const t of c){const c=n[t];if("string"==typeof c){if(e(c,r))return[void 0,t]}else{const n=Object.entries(c),l=n.findIndex((t=>{let[e]=t;return e===o}));l>0&&n.unshift(n.splice(l,1)[0]);for(const[o,c]of n)if(e(c,r))return[o,t]}}for(const t of Object.keys(n))if(e(t,r))return[void 0,t];return[void 0,void 0]}function i(t,e,r,o){let c="";return c+=d(r,a(e,t)),c=n(c),c}function u(t,e,r){t.endsWith("/")||(t+="/");const o=f(e,r),c=new RegExp("^(".concat(o.map((t=>{let[,e]=t;return e.replaceAll("/","\\/")})).join("|"),")/(.*)"),"i"),l=t.match(c);let i=l?"/"+l[2]:t;return"/"!==i&&(i=n(i)),i}function f(t,e){let n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];const o=t.map((t=>[t,r(t,e)]));return n&&o.sort(((t,e)=>e[1].length-t[1].length)),o}function s(t,e,n){const r=f(e,n);for(const[e,n]of r){let r,o;if(t===n||t.startsWith(n+"/"))r=o=!0;else{const e=t.toLowerCase(),c=n.toLowerCase();(e===c||e.startsWith(c+"/"))&&(r=!1,o=!0)}if(o)return{locale:e,prefix:n,matchedPrefix:t.slice(0,n.length),exact:r}}}function a(t,e){const r=n(e),c=n(t),l=o(c).exec(r);if(!l)return;const i={};for(let t=1;t<l.length;t++){var u;const e=null===(u=c.match(/\[([^\]]+)\]/g))||void 0===u?void 0:u[t-1].replace(/[[\]]/g,"");e&&(i[e]=l[t])}return i}function d(t,e){if(!e)return t;let n=t=t.replace(/\[\[/g,"[").replace(/\]\]/g,"]");return Object.entries(e).forEach((t=>{let[e,r]=t;n=n.replace("[".concat(e,"]"),r)})),n}function h(t,e,n){let r=t;return e&&(r=c(e,r)),n&&(r+=n),r}function v(t){var e,n;return null!==(e=null!==(n=t.get("x-forwarded-host"))&&void 0!==n?n:t.get("host"))&&void 0!==e?e:void 0}function g(t,e){return e.defaultLocale===t||!e.locales||e.locales.includes(t)}function p(t,e,n){let r;return t&&g(e,t)&&(r=t),r||(r=n.find((t=>t.defaultLocale===e))),r||(r=n.find((t=>{var n;return null===(n=t.locales)||void 0===n?void 0:n.includes(e)}))),r||null!=(null==t?void 0:t.locales)||(r=t),r||(r=n.find((t=>!t.locales))),r}function x(t,e){return n(e+t)}function m(t){return"/".concat(t)}function j(t){return t.replace(/\\/g,"%5C").replace(/\/+/g,"/")}export{x as applyBasePath,h as formatPathname,d as formatPathnameTemplate,i as formatTemplatePathname,p as getBestMatchingDomain,v as getHost,l as getInternalTemplate,m as getLocaleAsPrefix,f as getLocalePrefixes,u as getNormalizedPathname,s as getPathnameMatch,a as getRouteParams,g as isLocaleSupportedOnDomain,j as sanitizePathname};
@@ -1 +1 @@
1
- import{extends as e}from"../../_virtual/_rollupPluginBabelHelpers.js";import r,{forwardRef as o,useMemo as t}from"react";import n from"../../react-client/useLocale.js";import{receiveRoutingConfig as l,receiveLocaleCookie as a}from"../../routing/config.js";import{getRoute as c,compileLocalizedPathname as i,normalizeNameOrNameWithParams as s}from"../shared/utils.js";import f from"./ClientLink.js";import{clientRedirect as u,clientPermanentRedirect as m}from"./redirects.js";import h from"./useBasePathname.js";import p from"./useBaseRouter.js";function d(d){const v=l(d),P=a(null==d?void 0:d.localeCookie);function x(){const e=n();if(!v.locales.includes(e))throw new Error('Unknown locale encountered: "'.concat(e,'". Make sure to validate the locale in `i18n.ts`.'));return e}function g(o,t){let{href:n,locale:l,...a}=o;const c=x(),s=l||c;return r.createElement(f,e({ref:t,href:i({locale:s,pathname:n,params:"object"==typeof n?n.params:void 0,pathnames:v.pathnames}),locale:l,localeCookie:P,localePrefix:v.localePrefix},a))}const j=o(g);function w(e){let{href:r,locale:o}=e;return i({...s(r),locale:o,pathnames:v.pathnames})}return j.displayName="Link",{Link:j,redirect:function(e){const r=w({href:e,locale:x()});for(var o=arguments.length,t=new Array(o>1?o-1:0),n=1;n<o;n++)t[n-1]=arguments[n];return u({pathname:r,localePrefix:v.localePrefix},...t)},permanentRedirect:function(e){const r=w({href:e,locale:x()});for(var o=arguments.length,t=new Array(o>1?o-1:0),n=1;n<o;n++)t[n-1]=arguments[n];return m({pathname:r,localePrefix:v.localePrefix},...t)},usePathname:function(){const e=h(v.localePrefix),r=x();return t((()=>e?c(r,e,v.pathnames):e),[r,e])},useRouter:function(){const e=p(v.localePrefix,P),r=x();return t((()=>({...e,push(o){for(var t,n=arguments.length,l=new Array(n>1?n-1:0),a=1;a<n;a++)l[a-1]=arguments[a];const c=w({href:o,locale:(null===(t=l[0])||void 0===t?void 0:t.locale)||r});return e.push(c,...l)},replace(o){for(var t,n=arguments.length,l=new Array(n>1?n-1:0),a=1;a<n;a++)l[a-1]=arguments[a];const c=w({href:o,locale:(null===(t=l[0])||void 0===t?void 0:t.locale)||r});return e.replace(c,...l)},prefetch(o){for(var t,n=arguments.length,l=new Array(n>1?n-1:0),a=1;a<n;a++)l[a-1]=arguments[a];const c=w({href:o,locale:(null===(t=l[0])||void 0===t?void 0:t.locale)||r});return e.prefetch(c,...l)}})),[e,r])},getPathname:w}}export{d as default};
1
+ import{extends as e}from"../../_virtual/_rollupPluginBabelHelpers.js";import r,{forwardRef as o,useMemo as t}from"react";import n from"../../react-client/useLocale.js";import{receiveRoutingConfig as a,receiveLocaleCookie as l}from"../../routing/config.js";import{getRoute as c,compileLocalizedPathname as i,normalizeNameOrNameWithParams as s}from"../shared/utils.js";import f from"./ClientLink.js";import{clientRedirect as u,clientPermanentRedirect as m}from"./redirects.js";import h from"./useBasePathname.js";import p from"./useBaseRouter.js";function d(d){const v=a(d),P=l(d.localeCookie);function x(){const e=n();if(!v.locales.includes(e))throw new Error('Unknown locale encountered: "'.concat(e,'". Make sure to validate the locale in `i18n.ts`.'));return e}function g(o,t){let{href:n,locale:a,...l}=o;const c=x(),s=a||c;return r.createElement(f,e({ref:t,href:i({locale:s,pathname:n,params:"object"==typeof n?n.params:void 0,pathnames:v.pathnames}),locale:a,localeCookie:P,localePrefix:v.localePrefix},l))}const j=o(g);function w(e){let{href:r,locale:o}=e;return i({...s(r),locale:o,pathnames:v.pathnames})}return j.displayName="Link",{Link:j,redirect:function(e){const r=w({href:e,locale:x()});for(var o=arguments.length,t=new Array(o>1?o-1:0),n=1;n<o;n++)t[n-1]=arguments[n];return u({pathname:r,localePrefix:v.localePrefix},...t)},permanentRedirect:function(e){const r=w({href:e,locale:x()});for(var o=arguments.length,t=new Array(o>1?o-1:0),n=1;n<o;n++)t[n-1]=arguments[n];return m({pathname:r,localePrefix:v.localePrefix},...t)},usePathname:function(){const e=h(v.localePrefix),r=x();return t((()=>e?c(r,e,v.pathnames):e),[r,e])},useRouter:function(){const e=p(v.localePrefix,P),r=x();return t((()=>({...e,push(o){for(var t,n=arguments.length,a=new Array(n>1?n-1:0),l=1;l<n;l++)a[l-1]=arguments[l];const c=w({href:o,locale:(null===(t=a[0])||void 0===t?void 0:t.locale)||r});return e.push(c,...a)},replace(o){for(var t,n=arguments.length,a=new Array(n>1?n-1:0),l=1;l<n;l++)a[l-1]=arguments[l];const c=w({href:o,locale:(null===(t=a[0])||void 0===t?void 0:t.locale)||r});return e.replace(c,...a)},prefetch(o){for(var t,n=arguments.length,a=new Array(n>1?n-1:0),l=1;l<n;l++)a[l-1]=arguments[l];const c=w({href:o,locale:(null===(t=a[0])||void 0===t?void 0:t.locale)||r});return e.prefetch(c,...a)}})),[e,r])},getPathname:w}}export{d as default};
@@ -1 +1 @@
1
- import n from"fs";import e from"path";function t(n){return["".concat(n,".ts"),"".concat(n,".tsx"),"".concat(n,".js"),"".concat(n,".jsx")]}function o(o,r){function i(t){return n.existsSync(function(n){const t=[];return r&&t.push(r),t.push(n),e.resolve(...t)}(t))}if(o){if(!i(o))throw new Error("Could not find i18n config at ".concat(o,", please provide a valid path."));return o}for(const n of[...t("./i18n"),...t("./src/i18n"),...t("./i18n/request"),...t("./src/i18n/request")])if(i(n))return n;throw new Error("\n\nCould not locate i18n request config for next-intl.\n\nThese paths are supported by default:\n- ./(src/)i18n/request.{js,jsx,ts,tsx}\n- ./(src/)i18n.{js,jsx,ts,tsx}\n\nAlternatively, you can specify a custom location in your Next.js config:\n\nconst withNextIntl = createNextIntlPlugin(\n './path/to/i18n/request.tsx'\n);\n")}module.exports=function(n){return function(t){return function(n,t){null!=(null==t?void 0:t.i18n)&&console.warn("\nnext-intl has found an `i18n` config in your next.config.js. This likely causes conflicts and should therefore be removed if you use the App Router.\n\nIf you're in progress of migrating from the `pages` folder, you can refer to this example: https://next-intl-docs.vercel.app/examples#app-router-migration\n");const r={};if(null!=process.env.TURBOPACK){var i,s;if(n&&n.startsWith("/"))throw new Error("Turbopack support for next-intl currently does not support absolute paths, please provide a relative one (e.g. './src/i18n/config.ts').\n\nFound: "+n+"\n");r.experimental={...null==t?void 0:t.experimental,turbo:{...null==t||null===(i=t.experimental)||void 0===i?void 0:i.turbo,resolveAlias:{...null==t||null===(s=t.experimental)||void 0===s||null===(s=s.turbo)||void 0===s?void 0:s.resolveAlias,"next-intl/config":o(n)}}}}else r.webpack=function(){for(var r=arguments.length,i=new Array(r),s=0;s<r;s++)i[s]=arguments[s];let[l,u]=i;return l.resolve.alias["next-intl/config"]=e.resolve(l.context,o(n,l.context)),"function"==typeof(null==t?void 0:t.webpack)?t.webpack(l,u):l};return r.env={...null==t?void 0:t.env,_next_intl_trailing_slash:null!=t&&t.trailingSlash?"true":void 0},Object.assign({},t,r)}(n,t)}};
1
+ import n from"fs";import t from"path";function e(n){return["".concat(n,".ts"),"".concat(n,".tsx"),"".concat(n,".js"),"".concat(n,".jsx")]}let o=!1;function r(r,i){function s(e){return n.existsSync(function(n){const e=[];return i&&e.push(i),e.push(n),t.resolve(...e)}(e))}if(r){if(!s(r))throw new Error("[next-intl] Could not find i18n config at ".concat(r,", please provide a valid path."));return r}for(const n of[...e("./i18n/request"),...e("./src/i18n/request")])if(s(n))return n;for(const n of[...e("./i18n"),...e("./src/i18n")])if(s(n))return o||(console.warn("\n[next-intl] Reading request configuration from ".concat(n," is deprecated, please see https://next-intl-docs.vercel.app/blog/next-intl-3-22#i18n-request you can either move your configuration to ./i18n/request.ts or provide a custom path in your Next.js config:\n\nconst withNextIntl = createNextIntlPlugin(\n './path/to/i18n/request.tsx'\n);\n")),o=!0),n;throw new Error("\n[next-intl] Could not locate request configuration module.\n\nThis path is supported by default: ./(src/)i18n/request.{js,jsx,ts,tsx}\n\nAlternatively, you can specify a custom location in your Next.js config:\n\nconst withNextIntl = createNextIntlPlugin(\n './path/to/i18n/request.tsx'\n);\n")}module.exports=function(n){return function(e){return function(n,e){null!=(null==e?void 0:e.i18n)&&console.warn("\n[next-intl] An `i18n` property was found in your Next.js config. This likely causes conflicts and should therefore be removed if you use the App Router.\n\nIf you're in progress of migrating from the Pages Router, you can refer to this example: https://next-intl-docs.vercel.app/examples#app-router-migration\n");const o={};if(null!=process.env.TURBOPACK){var i,s;if(null!=n&&n.startsWith("/"))throw new Error("[next-intl] Turbopack support for next-intl currently does not support absolute paths, please provide a relative one (e.g. './src/i18n/config.ts').\n\nFound: "+n+"\n");o.experimental={...null==e?void 0:e.experimental,turbo:{...null==e||null===(i=e.experimental)||void 0===i?void 0:i.turbo,resolveAlias:{...null==e||null===(s=e.experimental)||void 0===s||null===(s=s.turbo)||void 0===s?void 0:s.resolveAlias,"next-intl/config":r(n)}}}}else o.webpack=function(){for(var o=arguments.length,i=new Array(o),s=0;s<o;s++)i[s]=arguments[s];let[l,u]=i;return l.resolve.alias["next-intl/config"]=t.resolve(l.context,r(n,l.context)),"function"==typeof(null==e?void 0:e.webpack)?e.webpack(l,u):l};return o.env={...null==e?void 0:e.env,_next_intl_trailing_slash:null!=e&&e.trailingSlash?"true":void 0},Object.assign({},e,o)}(n,e)}};
@@ -1 +1 @@
1
- function e(e){var n,t;return{...e,localePrefix:o(null==e?void 0:e.localePrefix),localeCookie:l(e.localeCookie),localeDetection:null===(n=e.localeDetection)||void 0===n||n,alternateLinks:null===(t=e.alternateLinks)||void 0===t||t}}function l(e){return!(null!=e&&!e)&&{name:"NEXT_LOCALE",maxAge:31536e3,sameSite:"lax",..."object"==typeof e&&e}}function o(e){return"object"==typeof e?e:{mode:e||"always"}}export{l as receiveLocaleCookie,o as receiveLocalePrefixConfig,e as receiveRoutingConfig};
1
+ function e(e){var t,n;return{...e,localePrefix:l(e.localePrefix),localeCookie:o(e.localeCookie),localeDetection:null===(t=e.localeDetection)||void 0===t||t,alternateLinks:null===(n=e.alternateLinks)||void 0===n||n}}function o(e){return!(null!=e&&!e)&&{name:"NEXT_LOCALE",maxAge:31536e3,sameSite:"lax",..."object"==typeof e&&e}}function l(e){return"object"==typeof e?e:{mode:e||"always"}}export{o as receiveLocaleCookie,l as receiveLocalePrefixConfig,e as receiveRoutingConfig};
@@ -1 +1 @@
1
- function e(e){return()=>{throw new Error("`".concat(e,"` is not supported in Client Components."))}}function t(){return e("getRequestConfig")}const n=e("getFormatter"),o=e("getNow"),r=e("getTimeZone"),s=e("getMessages"),g=e("getLocale"),a=e("getTranslations"),i=e("unstable_setRequestLocale");export{n as getFormatter,g as getLocale,s as getMessages,o as getNow,t as getRequestConfig,r as getTimeZone,a as getTranslations,i as unstable_setRequestLocale};
1
+ function e(e){return()=>{throw new Error("`".concat(e,"` is not supported in Client Components."))}}function t(){return e("getRequestConfig")}const n=e("getFormatter"),o=e("getNow"),s=e("getTimeZone"),r=e("getMessages"),a=e("getLocale"),g=e("getTranslations"),u=e("unstable_setRequestLocale"),c=e("setRequestLocale");export{n as getFormatter,a as getLocale,r as getMessages,o as getNow,t as getRequestConfig,s as getTimeZone,g as getTranslations,c as setRequestLocale,u as unstable_setRequestLocale};
@@ -1 +1 @@
1
- import{headers as t}from"next/headers";import{cache as e}from"react";import{HEADER_LOCALE_NAME as n}from"../../shared/constants.js";import{getCachedRequestLocale as r}from"./RequestLocaleCache.js";const o=e((async function(){const e=t();return e instanceof Promise?await e:e}));const s=e((async function(){let t;try{t=(await o()).get(n)||void 0}catch(t){if(t instanceof Error&&"DYNAMIC_SERVER_USAGE"===t.digest){const e=new Error("Usage of next-intl APIs in Server Components currently opts into dynamic rendering. This limitation will eventually be lifted, but as a stopgap solution, you can use the `unstable_setRequestLocale` API to enable static rendering, see https://next-intl-docs.vercel.app/docs/getting-started/app-router/with-i18n-routing#static-rendering",{cause:t});throw e.digest=t.digest,e}throw t}return t}));async function i(){return r()||await s()}export{i as getRequestLocale};
1
+ import{headers as t}from"next/headers";import{cache as e}from"react";import{HEADER_LOCALE_NAME as n}from"../../shared/constants.js";import{getCachedRequestLocale as r}from"./RequestLocaleCache.js";const o=e((async function(){const e=t();return e instanceof Promise?await e:e}));const i=e((async function(){let t;try{t=(await o()).get(n)||void 0}catch(t){if(t instanceof Error&&"DYNAMIC_SERVER_USAGE"===t.digest){const e=new Error("Usage of next-intl APIs in Server Components currently opts into dynamic rendering. This limitation will eventually be lifted, but as a stopgap solution, you can use the `setRequestLocale` API to enable static rendering, see https://next-intl-docs.vercel.app/docs/getting-started/app-router/with-i18n-routing#static-rendering",{cause:t});throw e.digest=t.digest,e}throw t}return t}));async function s(){return r()||await i()}export{s as getRequestLocale};
@@ -1 +1 @@
1
- import{headers as e}from"next/headers";import{notFound as t}from"next/navigation";import{cache as n}from"react";import{HEADER_LOCALE_NAME as o}from"../../shared/constants.js";import{getCachedRequestLocale as r}from"./RequestLocaleCache.js";const i=n((function(){let n;try{n=e().get(o)}catch(e){throw e instanceof Error&&"DYNAMIC_SERVER_USAGE"===e.digest?new Error("Usage of next-intl APIs in Server Components currently opts into dynamic rendering. This limitation will eventually be lifted, but as a stopgap solution, you can use the `unstable_setRequestLocale` API to enable static rendering, see https://next-intl-docs.vercel.app/docs/getting-started/app-router/with-i18n-routing#static-rendering",{cause:e}):e}return n||(console.error("\nUnable to find `next-intl` locale because the middleware didn't run on this request. See https://next-intl-docs.vercel.app/docs/routing/middleware#unable-to-find-locale. The `notFound()` function will be called as a result.\n"),t()),n}));function s(){return r()||i()}export{s as getRequestLocale};
1
+ import{headers as e}from"next/headers";import{notFound as t}from"next/navigation";import{cache as n}from"react";import{HEADER_LOCALE_NAME as o}from"../../shared/constants.js";import{getCachedRequestLocale as r}from"./RequestLocaleCache.js";const i=n((function(){let n;try{n=e().get(o)}catch(e){throw e instanceof Error&&"DYNAMIC_SERVER_USAGE"===e.digest?new Error("Usage of next-intl APIs in Server Components currently opts into dynamic rendering. This limitation will eventually be lifted, but as a stopgap solution, you can use the `setRequestLocale` API to enable static rendering, see https://next-intl-docs.vercel.app/docs/getting-started/app-router/with-i18n-routing#static-rendering",{cause:e}):e}return n||(console.error("\nUnable to find `next-intl` locale because the middleware didn't run on this request. See https://next-intl-docs.vercel.app/docs/routing/middleware#unable-to-find-locale. The `notFound()` function will be called as a result.\n"),t()),n}));function s(){return r()||i()}export{s as getRequestLocale};
@@ -1 +1 @@
1
- export{getFormatter,getLocale,getMessages,getNow,getRequestConfig,getTimeZone,getTranslations,unstable_setRequestLocale}from"./server/react-client/index.js";
1
+ export{getFormatter,getLocale,getMessages,getNow,getRequestConfig,getTimeZone,getTranslations,setRequestLocale,unstable_setRequestLocale}from"./server/react-client/index.js";
@@ -1 +1 @@
1
- export{default as getRequestConfig}from"./server/react-server/getRequestConfig.js";export{default as getFormatter}from"./server/react-server/getFormatter.js";export{default as getMessages}from"./server/react-server/getMessages.js";export{default as getNow}from"./server/react-server/getNow.js";export{default as getTimeZone}from"./server/react-server/getTimeZone.js";export{default as getTranslations}from"./server/react-server/getTranslations.js";export{default as getLocale}from"./server/react-server/getLocale.js";export{setCachedRequestLocale as unstable_setRequestLocale}from"./server/react-server/RequestLocaleCache.js";
1
+ export{default as getRequestConfig}from"./server/react-server/getRequestConfig.js";export{default as getFormatter}from"./server/react-server/getFormatter.js";export{default as getMessages}from"./server/react-server/getMessages.js";export{default as getNow}from"./server/react-server/getNow.js";export{default as getTimeZone}from"./server/react-server/getTimeZone.js";export{default as getTranslations}from"./server/react-server/getTranslations.js";export{default as getLocale}from"./server/react-server/getLocale.js";export{setCachedRequestLocale as setRequestLocale,setCachedRequestLocale as unstable_setRequestLocale}from"./server/react-server/RequestLocaleCache.js";
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../shared/utils.js"),a=require("./utils.js");exports.default=function(t){var o;let{localizedPathnames:n,request:l,resolvedLocale:r,routing:s}=t;const i=l.nextUrl.clone(),c=a.getHost(l.headers);function p(t,o){return t.pathname=e.normalizeTrailingSlash(t.pathname),l.nextUrl.basePath&&((t=new URL(t)).pathname=a.applyBasePath(t.pathname,l.nextUrl.basePath)),"<".concat(t.toString(),'>; rel="alternate"; hreflang="').concat(o,'"')}function m(e,t){return n&&"object"==typeof n?a.formatTemplatePathname(e,n[r],n[t]):e}c&&(i.port="",i.host=c),i.protocol=null!==(o=l.headers.get("x-forwarded-proto"))&&void 0!==o?o:i.protocol,i.pathname=a.getNormalizedPathname(i.pathname,s.locales,s.localePrefix);const h=a.getLocalePrefixes(s.locales,s.localePrefix,!1).flatMap((e=>{let t,[o,l]=e;function r(e){return"/"===e?l:l+e}if(s.domains){return(s.domains.filter((e=>a.isLocaleSupportedOnDomain(o,e)))||[]).map((e=>(t=new URL(i),t.port="",t.host=e.domain,t.pathname=m(i.pathname,o),o===e.defaultLocale&&"always"!==s.localePrefix.mode||(t.pathname=r(t.pathname)),p(t,o))))}{let e;e=n&&"object"==typeof n?m(i.pathname,o):i.pathname,o===s.defaultLocale&&"always"!==s.localePrefix.mode||(e=r(e)),t=new URL(e,i)}return p(t,o)}));if(!s.domains&&("always"!==s.localePrefix.mode||"/"===i.pathname)){const e=new URL(m(i.pathname,s.defaultLocale),i);h.push(p(e,"x-default"))}return h.join(", ")};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../shared/utils.js"),a=require("./utils.js");exports.default=function(t){var o;let{localizedPathnames:n,request:l,resolvedLocale:r,routing:s}=t;const i=l.nextUrl.clone(),c=a.getHost(l.headers);function p(t,o){return t.pathname=e.normalizeTrailingSlash(t.pathname),l.nextUrl.basePath&&((t=new URL(t)).pathname=a.applyBasePath(t.pathname,l.nextUrl.basePath)),"<".concat(t.toString(),'>; rel="alternate"; hreflang="').concat(o,'"')}function m(e,t){return n&&"object"==typeof n?a.formatTemplatePathname(e,n[r],n[t]):e}c&&(i.port="",i.host=c),i.protocol=null!==(o=l.headers.get("x-forwarded-proto"))&&void 0!==o?o:i.protocol,i.pathname=a.getNormalizedPathname(i.pathname,s.locales,s.localePrefix);const h=a.getLocalePrefixes(s.locales,s.localePrefix,!1).flatMap((e=>{let t,[o,l]=e;function r(e){return"/"===e?l:l+e}if(s.domains){return s.domains.filter((e=>a.isLocaleSupportedOnDomain(o,e))).map((e=>(t=new URL(i),t.port="",t.host=e.domain,t.pathname=m(i.pathname,o),o===e.defaultLocale&&"always"!==s.localePrefix.mode||(t.pathname=r(t.pathname)),p(t,o))))}{let e;e=n&&"object"==typeof n?m(i.pathname,o):i.pathname,o===s.defaultLocale&&"always"!==s.localePrefix.mode||(e=r(e)),t=new URL(e,i)}return p(t,o)}));if(!s.domains&&("always"!==s.localePrefix.mode||"/"===i.pathname)){const e=new URL(m(i.pathname,s.defaultLocale),i);h.push(p(e,"x-default"))}return h.join(", ")};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("next/server"),a=require("../routing/config.js"),t=require("../shared/constants.js"),l=require("../shared/utils.js"),o=require("./getAlternateLinksHeaderValue.js"),n=require("./resolveLocale.js"),r=require("./syncCookie.js"),i=require("./utils.js");exports.default=function(s,c){var d,f,h;const m=a.receiveRoutingConfig({...s,alternateLinks:null!==(d=null==c?void 0:c.alternateLinks)&&void 0!==d?d:s.alternateLinks,localeDetection:null!==(f=null==c?void 0:c.localeDetection)&&void 0!==f?f:s.localeDetection,localeCookie:null!==(h=null==c?void 0:c.localeCookie)&&void 0!==h?h:s.localeCookie});return function(a){var s;let c;try{c=decodeURI(a.nextUrl.pathname)}catch(a){return e.NextResponse.next()}const d=i.sanitizePathname(c),{domain:f,locale:h}=n.default(m,a.headers,a.cookies,d),u=f?f.defaultLocale===h:h===m.defaultLocale,x=(null===(s=m.domains)||void 0===s?void 0:s.filter((e=>i.isLocaleSupportedOnDomain(h,e))))||[],P=null!=m.domains&&!f;function p(l){const o=new URL(l,a.url);a.nextUrl.basePath&&(o.pathname=i.applyBasePath(o.pathname,a.nextUrl.basePath));const n=new Headers(a.headers);return n.set(t.HEADER_LOCALE_NAME,h),e.NextResponse.rewrite(o,{request:{headers:n}})}function v(t,o){const n=new URL(l.normalizeTrailingSlash(t),a.url);if(x.length>0&&!o&&f){const e=i.getBestMatchingDomain(f,h,x);e&&(o=e.domain,e.defaultLocale===h&&"as-needed"===m.localePrefix.mode&&(n.pathname=i.getNormalizedPathname(n.pathname,m.locales,m.localePrefix)))}var r,s;o&&(n.host=o,a.headers.get("x-forwarded-host")&&(n.protocol=null!==(r=a.headers.get("x-forwarded-proto"))&&void 0!==r?r:a.nextUrl.protocol,n.port=null!==(s=a.headers.get("x-forwarded-port"))&&void 0!==s?s:""));return a.nextUrl.basePath&&(n.pathname=i.applyBasePath(n.pathname,a.nextUrl.basePath)),e.NextResponse.redirect(n.toString())}const g=i.getNormalizedPathname(d,m.locales,m.localePrefix),L=i.getPathnameMatch(d,m.locales,m.localePrefix),U=null!=L,k="never"===m.localePrefix.mode||u&&"as-needed"===m.localePrefix.mode;let q,j,C=g;const D=m.pathnames;if(D){let e;if([e,j]=i.getInternalTemplate(D,g,h),j){const t=D[j],o="string"==typeof t?t:t[h];if(l.matchesPathname(o,g))C=i.formatTemplatePathname(g,o,j);else{let n;n=e?"string"==typeof t?t:t[e]:j;const r=k?void 0:l.getLocalePrefix(h,m.localePrefix),s=i.formatTemplatePathname(g,n,o);q=v(i.formatPathname(s,r,a.nextUrl.search))}}}if(!q)if("/"!==C||U){const e=i.formatPathname(C,i.getLocaleAsPrefix(h),a.nextUrl.search);if(U){const t=i.formatPathname(g,L.prefix,a.nextUrl.search);if("never"===m.localePrefix.mode)q=v(i.formatPathname(g,void 0,a.nextUrl.search));else if(L.exact)if(u&&k)q=v(i.formatPathname(g,void 0,a.nextUrl.search));else if(m.domains){const a=i.getBestMatchingDomain(f,L.locale,x);q=(null==f?void 0:f.domain)===(null==a?void 0:a.domain)||P?p(e):v(t,null==a?void 0:a.domain)}else q=p(e);else q=v(t)}else q=k?p(e):v(i.formatPathname(g,l.getLocalePrefix(h,m.localePrefix),a.nextUrl.search))}else q=k?p(i.formatPathname(C,i.getLocaleAsPrefix(h),a.nextUrl.search)):v(i.formatPathname(g,l.getLocalePrefix(h,m.localePrefix),a.nextUrl.search));return m.localeDetection&&m.localeCookie&&r.default(a,q,h,m.localeCookie),"never"!==m.localePrefix.mode&&m.alternateLinks&&m.locales.length>1&&q.headers.set("Link",o.default({routing:m,localizedPathnames:null!=j&&D?null==D?void 0:D[j]:void 0,request:a,resolvedLocale:h})),q}};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("next/server"),a=require("../routing/config.js"),t=require("../shared/constants.js"),l=require("../shared/utils.js"),o=require("./getAlternateLinksHeaderValue.js"),n=require("./resolveLocale.js"),r=require("./syncCookie.js"),i=require("./utils.js");exports.default=function(s,c){var d,f,h;const m=a.receiveRoutingConfig({...s,alternateLinks:null!==(d=null==c?void 0:c.alternateLinks)&&void 0!==d?d:s.alternateLinks,localeDetection:null!==(f=null==c?void 0:c.localeDetection)&&void 0!==f?f:s.localeDetection,localeCookie:null!==(h=null==c?void 0:c.localeCookie)&&void 0!==h?h:s.localeCookie});return function(a){var s;let c;try{c=decodeURI(a.nextUrl.pathname)}catch(a){return e.NextResponse.next()}const d=i.sanitizePathname(c),{domain:f,locale:h}=n.default(m,a.headers,a.cookies,d),u=f?f.defaultLocale===h:h===m.defaultLocale,x=(null===(s=m.domains)||void 0===s?void 0:s.filter((e=>i.isLocaleSupportedOnDomain(h,e))))||[],P=null!=m.domains&&!f;function p(l){const o=new URL(l,a.url);a.nextUrl.basePath&&(o.pathname=i.applyBasePath(o.pathname,a.nextUrl.basePath));const n=new Headers(a.headers);return n.set(t.HEADER_LOCALE_NAME,h),e.NextResponse.rewrite(o,{request:{headers:n}})}function v(t,o){const n=new URL(l.normalizeTrailingSlash(t),a.url);if(x.length>0&&!o&&f){const e=i.getBestMatchingDomain(f,h,x);e&&(o=e.domain,e.defaultLocale===h&&"as-needed"===m.localePrefix.mode&&(n.pathname=i.getNormalizedPathname(n.pathname,m.locales,m.localePrefix)))}var r,s;o&&(n.host=o,a.headers.get("x-forwarded-host")&&(n.protocol=null!==(r=a.headers.get("x-forwarded-proto"))&&void 0!==r?r:a.nextUrl.protocol,n.port=null!==(s=a.headers.get("x-forwarded-port"))&&void 0!==s?s:""));return a.nextUrl.basePath&&(n.pathname=i.applyBasePath(n.pathname,a.nextUrl.basePath)),e.NextResponse.redirect(n.toString())}const g=i.getNormalizedPathname(d,m.locales,m.localePrefix),L=i.getPathnameMatch(d,m.locales,m.localePrefix),U=null!=L,k="never"===m.localePrefix.mode||u&&"as-needed"===m.localePrefix.mode;let q,j,C=g;const D=m.pathnames;if(D){let e;if([e,j]=i.getInternalTemplate(D,g,h),j){const t=D[j],o="string"==typeof t?t:t[h];if(l.matchesPathname(o,g))C=i.formatTemplatePathname(g,o,j);else{let n;n=e?"string"==typeof t?t:t[e]:j;const r=k?void 0:l.getLocalePrefix(h,m.localePrefix),s=i.formatTemplatePathname(g,n,o);q=v(i.formatPathname(s,r,a.nextUrl.search))}}}if(!q)if("/"!==C||U){const e=i.formatPathname(C,i.getLocaleAsPrefix(h),a.nextUrl.search);if(U){const t=i.formatPathname(g,L.prefix,a.nextUrl.search);if("never"===m.localePrefix.mode)q=v(i.formatPathname(g,void 0,a.nextUrl.search));else if(L.exact)if(u&&k)q=v(i.formatPathname(g,void 0,a.nextUrl.search));else if(m.domains){const a=i.getBestMatchingDomain(f,L.locale,x);q=(null==f?void 0:f.domain)===(null==a?void 0:a.domain)||P?p(e):v(t,null==a?void 0:a.domain)}else q=p(e);else q=v(t)}else q=k?p(e):v(i.formatPathname(g,l.getLocalePrefix(h,m.localePrefix),a.nextUrl.search))}else q=k?p(i.formatPathname(C,i.getLocaleAsPrefix(h),a.nextUrl.search)):v(i.formatPathname(g,l.getLocalePrefix(h,m.localePrefix),a.nextUrl.search));return m.localeDetection&&m.localeCookie&&r.default(a,q,h,m.localeCookie),"never"!==m.localePrefix.mode&&m.alternateLinks&&m.locales.length>1&&q.headers.set("Link",o.default({routing:m,localizedPathnames:null!=j&&D?D[j]:void 0,request:a,resolvedLocale:h})),q}};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@formatjs/intl-localematcher"),o=require("negotiator"),l=require("./utils.js");function t(e){return e&&e.__esModule?e:{default:e}}var a=t(o);function n(o,l,t){let n;const c=new a.default({headers:{"accept-language":o.get("accept-language")||void 0}}).languages();try{const o=function(e){return e.slice().sort(((e,o)=>o.length-e.length))}(l);n=e.match(c,o,t)}catch(e){}return n}function c(e,o){if(e.localeCookie&&o.has(e.localeCookie.name)){var l;const t=null===(l=o.get(e.localeCookie.name))||void 0===l?void 0:l.value;if(t&&e.locales.includes(t))return t}}function i(e,o,t,a){let i;var r;a&&(i=null===(r=l.getPathnameMatch(a,e.locales,e.localePrefix))||void 0===r?void 0:r.locale);return!i&&e.localeDetection&&t&&(i=c(e,t)),!i&&e.localeDetection&&o&&(i=n(o,e.locales,e.defaultLocale)),i||(i=e.defaultLocale),i}function r(e,o,t,a){const r=function(e,o){const t=l.getHost(e);if(t&&o)return o.find((e=>e.domain===t))}(o,e.domains);if(!r)return{locale:i(e,o,t,a)};let u;if(a){var s;const o=null===(s=l.getPathnameMatch(a,e.locales,e.localePrefix))||void 0===s?void 0:s.locale;if(o){if(!l.isLocaleSupportedOnDomain(o,r))return{locale:o,domain:r};u=o}}if(!u&&e.localeDetection&&t){const o=c(e,t);o&&l.isLocaleSupportedOnDomain(o,r)&&(u=o)}if(!u&&e.localeDetection&&o){const l=n(o,r.locales||e.locales,r.defaultLocale);l&&(u=l)}return u||(u=r.defaultLocale),{locale:u,domain:r}}exports.default=function(e,o,l,t){return e.domains?r(e,o,l,t):{locale:i(e,o,l,t)}},exports.getAcceptLanguageLocale=n;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@formatjs/intl-localematcher"),o=require("negotiator"),l=require("./utils.js");function t(e){return e&&e.__esModule?e:{default:e}}var a=t(o);function n(o,l,t){let n;const c=new a.default({headers:{"accept-language":o.get("accept-language")||void 0}}).languages();try{const o=function(e){return e.slice().sort(((e,o)=>o.length-e.length))}(l);n=e.match(c,o,t)}catch(e){}return n}function c(e,o){if(e.localeCookie&&o.has(e.localeCookie.name)){var l;const t=null===(l=o.get(e.localeCookie.name))||void 0===l?void 0:l.value;if(t&&e.locales.includes(t))return t}}function i(e,o,t,a){let i;var r;a&&(i=null===(r=l.getPathnameMatch(a,e.locales,e.localePrefix))||void 0===r?void 0:r.locale);return!i&&e.localeDetection&&(i=c(e,t)),!i&&e.localeDetection&&(i=n(o,e.locales,e.defaultLocale)),i||(i=e.defaultLocale),i}function r(e,o,t,a){const r=function(e,o){const t=l.getHost(e);if(t)return o.find((e=>e.domain===t))}(o,e.domains);if(!r)return{locale:i(e,o,t,a)};let u;if(a){var s;const o=null===(s=l.getPathnameMatch(a,e.locales,e.localePrefix))||void 0===s?void 0:s.locale;if(o){if(!l.isLocaleSupportedOnDomain(o,r))return{locale:o,domain:r};u=o}}if(!u&&e.localeDetection){const o=c(e,t);o&&l.isLocaleSupportedOnDomain(o,r)&&(u=o)}if(!u&&e.localeDetection){const l=n(o,r.locales||e.locales,r.defaultLocale);l&&(u=l)}return u||(u=r.defaultLocale),{locale:u,domain:r}}exports.default=function(e,o,l,t){return e.domains?r(e,o,l,t):{locale:i(e,o,l,t)}},exports.getAcceptLanguageLocale=n;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../shared/utils.js");function t(t,n){let r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];const o=t.map((t=>[t,e.getLocalePrefix(t,n)]));return r&&o.sort(((e,t)=>t[1].length-e[1].length)),o}function n(t,n){const r=e.normalizeTrailingSlash(n),o=e.normalizeTrailingSlash(t),a=e.templateToRegex(o).exec(r);if(!a)return;const l={};for(let e=1;e<a.length;e++){var i;const t=null===(i=o.match(/\[([^\]]+)\]/g))||void 0===i?void 0:i[e-1].replace(/[[\]]/g,"");t&&(l[t]=a[e])}return l}function r(e,t){if(!t)return e;let n=e=e.replace(/\[\[/g,"[").replace(/\]\]/g,"]");return Object.entries(t).forEach((e=>{let[t,r]=e;n=n.replace("[".concat(t,"]"),r)})),n}function o(e,t){return t.defaultLocale===e||!t.locales||t.locales.includes(e)}exports.applyBasePath=function(t,n){return e.normalizeTrailingSlash(n+t)},exports.formatPathname=function(t,n,r){let o=t;return n&&(o=e.prefixPathname(n,o)),r&&(o+=r),o},exports.formatPathnameTemplate=r,exports.formatTemplatePathname=function(t,o,a,l){let i="";return i+=r(a,n(o,t)),i=e.normalizeTrailingSlash(i),i},exports.getBestMatchingDomain=function(e,t,n){let r;return e&&o(t,e)&&(r=e),r||(r=n.find((e=>e.defaultLocale===t))),r||(r=n.find((e=>null!=e.locales&&e.locales.includes(t)))),r||null!=(null==e?void 0:e.locales)||(r=e),r||(r=n.find((e=>!e.locales))),r},exports.getHost=function(e){var t,n;return null!==(t=null!==(n=e.get("x-forwarded-host"))&&void 0!==n?n:e.get("host"))&&void 0!==t?t:void 0},exports.getInternalTemplate=function(t,n,r){const o=e.getSortedPathnames(Object.keys(t));for(const a of o){const o=t[a];if("string"==typeof o){const t=o;if(e.matchesPathname(t,n))return[void 0,a]}else{const t=Object.entries(o),l=t.findIndex((e=>{let[t]=e;return t===r}));l>0&&t.unshift(t.splice(l,1)[0]);for(const[r,o]of t)if(e.matchesPathname(o,n))return[r,a]}}for(const r of Object.keys(t))if(e.matchesPathname(r,n))return[void 0,r];return[void 0,void 0]},exports.getLocaleAsPrefix=function(e){return"/".concat(e)},exports.getLocalePrefixes=t,exports.getNormalizedPathname=function(n,r,o){n.endsWith("/")||(n+="/");const a=t(r,o),l=new RegExp("^(".concat(a.map((e=>{let[,t]=e;return t.replaceAll("/","\\/")})).join("|"),")/(.*)"),"i"),i=n.match(l);let s=i?"/"+i[2]:n;return"/"!==s&&(s=e.normalizeTrailingSlash(s)),s},exports.getPathnameMatch=function(e,n,r){const o=t(n,r);for(const[t,n]of o){let r,o;if(e===n||e.startsWith(n+"/"))r=o=!0;else{const t=e.toLowerCase(),a=n.toLowerCase();(t===a||t.startsWith(a+"/"))&&(r=!1,o=!0)}if(o)return{locale:t,prefix:n,matchedPrefix:e.slice(0,n.length),exact:r}}},exports.getRouteParams=n,exports.isLocaleSupportedOnDomain=o,exports.sanitizePathname=function(e){return e.replace(/\\/g,"%5C").replace(/\/+/g,"/")};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../shared/utils.js");function t(t,n){let r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];const o=t.map((t=>[t,e.getLocalePrefix(t,n)]));return r&&o.sort(((e,t)=>t[1].length-e[1].length)),o}function n(t,n){const r=e.normalizeTrailingSlash(n),o=e.normalizeTrailingSlash(t),a=e.templateToRegex(o).exec(r);if(!a)return;const l={};for(let e=1;e<a.length;e++){var i;const t=null===(i=o.match(/\[([^\]]+)\]/g))||void 0===i?void 0:i[e-1].replace(/[[\]]/g,"");t&&(l[t]=a[e])}return l}function r(e,t){if(!t)return e;let n=e=e.replace(/\[\[/g,"[").replace(/\]\]/g,"]");return Object.entries(t).forEach((e=>{let[t,r]=e;n=n.replace("[".concat(t,"]"),r)})),n}function o(e,t){return t.defaultLocale===e||!t.locales||t.locales.includes(e)}exports.applyBasePath=function(t,n){return e.normalizeTrailingSlash(n+t)},exports.formatPathname=function(t,n,r){let o=t;return n&&(o=e.prefixPathname(n,o)),r&&(o+=r),o},exports.formatPathnameTemplate=r,exports.formatTemplatePathname=function(t,o,a,l){let i="";return i+=r(a,n(o,t)),i=e.normalizeTrailingSlash(i),i},exports.getBestMatchingDomain=function(e,t,n){let r;return e&&o(t,e)&&(r=e),r||(r=n.find((e=>e.defaultLocale===t))),r||(r=n.find((e=>{var n;return null===(n=e.locales)||void 0===n?void 0:n.includes(t)}))),r||null!=(null==e?void 0:e.locales)||(r=e),r||(r=n.find((e=>!e.locales))),r},exports.getHost=function(e){var t,n;return null!==(t=null!==(n=e.get("x-forwarded-host"))&&void 0!==n?n:e.get("host"))&&void 0!==t?t:void 0},exports.getInternalTemplate=function(t,n,r){const o=e.getSortedPathnames(Object.keys(t));for(const a of o){const o=t[a];if("string"==typeof o){const t=o;if(e.matchesPathname(t,n))return[void 0,a]}else{const t=Object.entries(o),l=t.findIndex((e=>{let[t]=e;return t===r}));l>0&&t.unshift(t.splice(l,1)[0]);for(const[r,o]of t)if(e.matchesPathname(o,n))return[r,a]}}for(const r of Object.keys(t))if(e.matchesPathname(r,n))return[void 0,r];return[void 0,void 0]},exports.getLocaleAsPrefix=function(e){return"/".concat(e)},exports.getLocalePrefixes=t,exports.getNormalizedPathname=function(n,r,o){n.endsWith("/")||(n+="/");const a=t(r,o),l=new RegExp("^(".concat(a.map((e=>{let[,t]=e;return t.replaceAll("/","\\/")})).join("|"),")/(.*)"),"i"),i=n.match(l);let s=i?"/"+i[2]:n;return"/"!==s&&(s=e.normalizeTrailingSlash(s)),s},exports.getPathnameMatch=function(e,n,r){const o=t(n,r);for(const[t,n]of o){let r,o;if(e===n||e.startsWith(n+"/"))r=o=!0;else{const t=e.toLowerCase(),a=n.toLowerCase();(t===a||t.startsWith(a+"/"))&&(r=!1,o=!0)}if(o)return{locale:t,prefix:n,matchedPrefix:e.slice(0,n.length),exact:r}}},exports.getRouteParams=n,exports.isLocaleSupportedOnDomain=o,exports.sanitizePathname=function(e){return e.replace(/\\/g,"%5C").replace(/\/+/g,"/")};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../_virtual/_rollupPluginBabelHelpers.js"),r=require("react"),a=require("../../react-client/useLocale.js"),l=require("../../routing/config.js"),t=require("../shared/utils.js"),o=require("./ClientLink.js"),n=require("./redirects.js"),c=require("./useBasePathname.js"),i=require("./useBaseRouter.js");function u(e){return e&&e.__esModule?e:{default:e}}var s=u(r);exports.default=function(u){const f=l.receiveRoutingConfig(u),h=l.receiveLocaleCookie(null==u?void 0:u.localeCookie);function d(){const e=a.default();if(!f.locales.includes(e))throw new Error(void 0);return e}function m(r,a){let{href:l,locale:n,...c}=r;const i=d(),u=n||i;return s.default.createElement(o.default,e.extends({ref:a,href:t.compileLocalizedPathname({locale:u,pathname:l,params:"object"==typeof l?l.params:void 0,pathnames:f.pathnames}),locale:n,localeCookie:h,localePrefix:f.localePrefix},c))}const p=r.forwardRef(m);function v(e){let{href:r,locale:a}=e;return t.compileLocalizedPathname({...t.normalizeNameOrNameWithParams(r),locale:a,pathnames:f.pathnames})}return p.displayName="Link",{Link:p,redirect:function(e){const r=v({href:e,locale:d()});for(var a=arguments.length,l=new Array(a>1?a-1:0),t=1;t<a;t++)l[t-1]=arguments[t];return n.clientRedirect({pathname:r,localePrefix:f.localePrefix},...l)},permanentRedirect:function(e){const r=v({href:e,locale:d()});for(var a=arguments.length,l=new Array(a>1?a-1:0),t=1;t<a;t++)l[t-1]=arguments[t];return n.clientPermanentRedirect({pathname:r,localePrefix:f.localePrefix},...l)},usePathname:function(){const e=c.default(f.localePrefix),a=d();return r.useMemo((()=>e?t.getRoute(a,e,f.pathnames):e),[a,e])},useRouter:function(){const e=i.default(f.localePrefix,h),a=d();return r.useMemo((()=>({...e,push(r){for(var l,t=arguments.length,o=new Array(t>1?t-1:0),n=1;n<t;n++)o[n-1]=arguments[n];const c=v({href:r,locale:(null===(l=o[0])||void 0===l?void 0:l.locale)||a});return e.push(c,...o)},replace(r){for(var l,t=arguments.length,o=new Array(t>1?t-1:0),n=1;n<t;n++)o[n-1]=arguments[n];const c=v({href:r,locale:(null===(l=o[0])||void 0===l?void 0:l.locale)||a});return e.replace(c,...o)},prefetch(r){for(var l,t=arguments.length,o=new Array(t>1?t-1:0),n=1;n<t;n++)o[n-1]=arguments[n];const c=v({href:r,locale:(null===(l=o[0])||void 0===l?void 0:l.locale)||a});return e.prefetch(c,...o)}})),[e,a])},getPathname:v}};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../_virtual/_rollupPluginBabelHelpers.js"),r=require("react"),a=require("../../react-client/useLocale.js"),t=require("../../routing/config.js"),l=require("../shared/utils.js"),o=require("./ClientLink.js"),n=require("./redirects.js"),c=require("./useBasePathname.js"),i=require("./useBaseRouter.js");function u(e){return e&&e.__esModule?e:{default:e}}var s=u(r);exports.default=function(u){const f=t.receiveRoutingConfig(u),h=t.receiveLocaleCookie(u.localeCookie);function d(){const e=a.default();if(!f.locales.includes(e))throw new Error(void 0);return e}function m(r,a){let{href:t,locale:n,...c}=r;const i=d(),u=n||i;return s.default.createElement(o.default,e.extends({ref:a,href:l.compileLocalizedPathname({locale:u,pathname:t,params:"object"==typeof t?t.params:void 0,pathnames:f.pathnames}),locale:n,localeCookie:h,localePrefix:f.localePrefix},c))}const p=r.forwardRef(m);function v(e){let{href:r,locale:a}=e;return l.compileLocalizedPathname({...l.normalizeNameOrNameWithParams(r),locale:a,pathnames:f.pathnames})}return p.displayName="Link",{Link:p,redirect:function(e){const r=v({href:e,locale:d()});for(var a=arguments.length,t=new Array(a>1?a-1:0),l=1;l<a;l++)t[l-1]=arguments[l];return n.clientRedirect({pathname:r,localePrefix:f.localePrefix},...t)},permanentRedirect:function(e){const r=v({href:e,locale:d()});for(var a=arguments.length,t=new Array(a>1?a-1:0),l=1;l<a;l++)t[l-1]=arguments[l];return n.clientPermanentRedirect({pathname:r,localePrefix:f.localePrefix},...t)},usePathname:function(){const e=c.default(f.localePrefix),a=d();return r.useMemo((()=>e?l.getRoute(a,e,f.pathnames):e),[a,e])},useRouter:function(){const e=i.default(f.localePrefix,h),a=d();return r.useMemo((()=>({...e,push(r){for(var t,l=arguments.length,o=new Array(l>1?l-1:0),n=1;n<l;n++)o[n-1]=arguments[n];const c=v({href:r,locale:(null===(t=o[0])||void 0===t?void 0:t.locale)||a});return e.push(c,...o)},replace(r){for(var t,l=arguments.length,o=new Array(l>1?l-1:0),n=1;n<l;n++)o[n-1]=arguments[n];const c=v({href:r,locale:(null===(t=o[0])||void 0===t?void 0:t.locale)||a});return e.replace(c,...o)},prefetch(r){for(var t,l=arguments.length,o=new Array(l>1?l-1:0),n=1;n<l;n++)o[n-1]=arguments[n];const c=v({href:r,locale:(null===(t=o[0])||void 0===t?void 0:t.locale)||a});return e.prefetch(c,...o)}})),[e,a])},getPathname:v}};
@@ -1 +1 @@
1
- "use strict";var n=require("fs"),e=require("path");function t(n){return n&&n.__esModule?n:{default:n}}var r=t(n),o=t(e);function i(n){return["".concat(n,".ts"),"".concat(n,".tsx"),"".concat(n,".js"),"".concat(n,".jsx")]}function s(n,e){function t(n){return r.default.existsSync(function(n){const t=[];return e&&t.push(e),t.push(n),o.default.resolve(...t)}(n))}if(n){if(!t(n))throw new Error("Could not find i18n config at ".concat(n,", please provide a valid path."));return n}for(const n of[...i("./i18n"),...i("./src/i18n"),...i("./i18n/request"),...i("./src/i18n/request")])if(t(n))return n;throw new Error("\n\nCould not locate i18n request config for next-intl.\n\nThese paths are supported by default:\n- ./(src/)i18n/request.{js,jsx,ts,tsx}\n- ./(src/)i18n.{js,jsx,ts,tsx}\n\nAlternatively, you can specify a custom location in your Next.js config:\n\nconst withNextIntl = createNextIntlPlugin(\n './path/to/i18n/request.tsx'\n);\n")}module.exports=function(n){return function(e){return function(n,e){null!=(null==e?void 0:e.i18n)&&console.warn("\nnext-intl has found an `i18n` config in your next.config.js. This likely causes conflicts and should therefore be removed if you use the App Router.\n\nIf you're in progress of migrating from the `pages` folder, you can refer to this example: https://next-intl-docs.vercel.app/examples#app-router-migration\n");const t={};if(null!=process.env.TURBOPACK){var r,i;if(n&&n.startsWith("/"))throw new Error("Turbopack support for next-intl currently does not support absolute paths, please provide a relative one (e.g. './src/i18n/config.ts').\n\nFound: "+n+"\n");t.experimental={...null==e?void 0:e.experimental,turbo:{...null==e||null===(r=e.experimental)||void 0===r?void 0:r.turbo,resolveAlias:{...null==e||null===(i=e.experimental)||void 0===i||null===(i=i.turbo)||void 0===i?void 0:i.resolveAlias,"next-intl/config":s(n)}}}}else t.webpack=function(){for(var t=arguments.length,r=new Array(t),i=0;i<t;i++)r[i]=arguments[i];let[l,u]=r;return l.resolve.alias["next-intl/config"]=o.default.resolve(l.context,s(n,l.context)),"function"==typeof(null==e?void 0:e.webpack)?e.webpack(l,u):l};return t.env={...null==e?void 0:e.env,_next_intl_trailing_slash:null!=e&&e.trailingSlash?"true":void 0},Object.assign({},e,t)}(n,e)}};
1
+ "use strict";var n=require("fs"),e=require("path");function t(n){return n&&n.__esModule?n:{default:n}}var o=t(n),r=t(e);function i(n){return["".concat(n,".ts"),"".concat(n,".tsx"),"".concat(n,".js"),"".concat(n,".jsx")]}let l=!1;function s(n,e){function t(n){return o.default.existsSync(function(n){const t=[];return e&&t.push(e),t.push(n),r.default.resolve(...t)}(n))}if(n){if(!t(n))throw new Error("[next-intl] Could not find i18n config at ".concat(n,", please provide a valid path."));return n}for(const n of[...i("./i18n/request"),...i("./src/i18n/request")])if(t(n))return n;for(const n of[...i("./i18n"),...i("./src/i18n")])if(t(n))return l||(console.warn("\n[next-intl] Reading request configuration from ".concat(n," is deprecated, please see https://next-intl-docs.vercel.app/blog/next-intl-3-22#i18n-request you can either move your configuration to ./i18n/request.ts or provide a custom path in your Next.js config:\n\nconst withNextIntl = createNextIntlPlugin(\n './path/to/i18n/request.tsx'\n);\n")),l=!0),n;throw new Error("\n[next-intl] Could not locate request configuration module.\n\nThis path is supported by default: ./(src/)i18n/request.{js,jsx,ts,tsx}\n\nAlternatively, you can specify a custom location in your Next.js config:\n\nconst withNextIntl = createNextIntlPlugin(\n './path/to/i18n/request.tsx'\n);\n")}module.exports=function(n){return function(e){return function(n,e){null!=(null==e?void 0:e.i18n)&&console.warn("\n[next-intl] An `i18n` property was found in your Next.js config. This likely causes conflicts and should therefore be removed if you use the App Router.\n\nIf you're in progress of migrating from the Pages Router, you can refer to this example: https://next-intl-docs.vercel.app/examples#app-router-migration\n");const t={};if(null!=process.env.TURBOPACK){var o,i;if(null!=n&&n.startsWith("/"))throw new Error("[next-intl] Turbopack support for next-intl currently does not support absolute paths, please provide a relative one (e.g. './src/i18n/config.ts').\n\nFound: "+n+"\n");t.experimental={...null==e?void 0:e.experimental,turbo:{...null==e||null===(o=e.experimental)||void 0===o?void 0:o.turbo,resolveAlias:{...null==e||null===(i=e.experimental)||void 0===i||null===(i=i.turbo)||void 0===i?void 0:i.resolveAlias,"next-intl/config":s(n)}}}}else t.webpack=function(){for(var t=arguments.length,o=new Array(t),i=0;i<t;i++)o[i]=arguments[i];let[l,u]=o;return l.resolve.alias["next-intl/config"]=r.default.resolve(l.context,s(n,l.context)),"function"==typeof(null==e?void 0:e.webpack)?e.webpack(l,u):l};return t.env={...null==e?void 0:e.env,_next_intl_trailing_slash:null!=e&&e.trailingSlash?"true":void 0},Object.assign({},e,t)}(n,e)}};
@@ -1 +1 @@
1
- "use strict";function e(e){return!(null!=e&&!e)&&{name:"NEXT_LOCALE",maxAge:31536e3,sameSite:"lax",..."object"==typeof e&&e}}function o(e){return"object"==typeof e?e:{mode:e||"always"}}Object.defineProperty(exports,"__esModule",{value:!0}),exports.receiveLocaleCookie=e,exports.receiveLocalePrefixConfig=o,exports.receiveRoutingConfig=function(l){var t,i;return{...l,localePrefix:o(null==l?void 0:l.localePrefix),localeCookie:e(l.localeCookie),localeDetection:null===(t=l.localeDetection)||void 0===t||t,alternateLinks:null===(i=l.alternateLinks)||void 0===i||i}};
1
+ "use strict";function e(e){return!(null!=e&&!e)&&{name:"NEXT_LOCALE",maxAge:31536e3,sameSite:"lax",..."object"==typeof e&&e}}function o(e){return"object"==typeof e?e:{mode:e||"always"}}Object.defineProperty(exports,"__esModule",{value:!0}),exports.receiveLocaleCookie=e,exports.receiveLocalePrefixConfig=o,exports.receiveRoutingConfig=function(t){var l,i;return{...t,localePrefix:o(t.localePrefix),localeCookie:e(t.localeCookie),localeDetection:null===(l=t.localeDetection)||void 0===l||l,alternateLinks:null===(i=t.alternateLinks)||void 0===i||i}};
@@ -1 +1 @@
1
- "use strict";function e(e){return()=>{throw new Error("`".concat(e,"` is not supported in Client Components."))}}Object.defineProperty(exports,"__esModule",{value:!0});const t=e("getFormatter"),o=e("getNow"),s=e("getTimeZone"),r=e("getMessages"),n=e("getLocale"),g=e("getTranslations"),a=e("unstable_setRequestLocale");exports.getFormatter=t,exports.getLocale=n,exports.getMessages=r,exports.getNow=o,exports.getRequestConfig=function(){return e("getRequestConfig")},exports.getTimeZone=s,exports.getTranslations=g,exports.unstable_setRequestLocale=a;
1
+ "use strict";function e(e){return()=>{throw new Error("`".concat(e,"` is not supported in Client Components."))}}Object.defineProperty(exports,"__esModule",{value:!0});const t=e("getFormatter"),s=e("getNow"),o=e("getTimeZone"),r=e("getMessages"),n=e("getLocale"),a=e("getTranslations"),g=e("unstable_setRequestLocale"),u=e("setRequestLocale");exports.getFormatter=t,exports.getLocale=n,exports.getMessages=r,exports.getNow=s,exports.getRequestConfig=function(){return e("getRequestConfig")},exports.getTimeZone=o,exports.getTranslations=a,exports.setRequestLocale=u,exports.unstable_setRequestLocale=g;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("next/headers"),t=require("react"),n=require("../../shared/constants.js"),r=require("./RequestLocaleCache.js");const s=t.cache((async function(){const t=e.headers();return t instanceof Promise?await t:t}));const a=t.cache((async function(){let e;try{e=(await s()).get(n.HEADER_LOCALE_NAME)||void 0}catch(e){if(e instanceof Error&&"DYNAMIC_SERVER_USAGE"===e.digest){const t=new Error("Usage of next-intl APIs in Server Components currently opts into dynamic rendering. This limitation will eventually be lifted, but as a stopgap solution, you can use the `unstable_setRequestLocale` API to enable static rendering, see https://next-intl-docs.vercel.app/docs/getting-started/app-router/with-i18n-routing#static-rendering",{cause:e});throw t.digest=e.digest,t}throw e}return e}));exports.getRequestLocale=async function(){return r.getCachedRequestLocale()||await a()};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("next/headers"),t=require("react"),n=require("../../shared/constants.js"),r=require("./RequestLocaleCache.js");const s=t.cache((async function(){const t=e.headers();return t instanceof Promise?await t:t}));const a=t.cache((async function(){let e;try{e=(await s()).get(n.HEADER_LOCALE_NAME)||void 0}catch(e){if(e instanceof Error&&"DYNAMIC_SERVER_USAGE"===e.digest){const t=new Error("Usage of next-intl APIs in Server Components currently opts into dynamic rendering. This limitation will eventually be lifted, but as a stopgap solution, you can use the `setRequestLocale` API to enable static rendering, see https://next-intl-docs.vercel.app/docs/getting-started/app-router/with-i18n-routing#static-rendering",{cause:e});throw t.digest=e.digest,t}throw e}return e}));exports.getRequestLocale=async function(){return r.getCachedRequestLocale()||await a()};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("next/headers"),t=require("next/navigation"),r=require("react"),n=require("../../shared/constants.js"),s=require("./RequestLocaleCache.js");const a=r.cache((function(){let r;try{r=e.headers().get(n.HEADER_LOCALE_NAME)}catch(e){throw e instanceof Error&&"DYNAMIC_SERVER_USAGE"===e.digest?new Error("Usage of next-intl APIs in Server Components currently opts into dynamic rendering. This limitation will eventually be lifted, but as a stopgap solution, you can use the `unstable_setRequestLocale` API to enable static rendering, see https://next-intl-docs.vercel.app/docs/getting-started/app-router/with-i18n-routing#static-rendering",{cause:e}):e}return r||t.notFound(),r}));exports.getRequestLocale=function(){return s.getCachedRequestLocale()||a()};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("next/headers"),t=require("next/navigation"),r=require("react"),n=require("../../shared/constants.js"),s=require("./RequestLocaleCache.js");const i=r.cache((function(){let r;try{r=e.headers().get(n.HEADER_LOCALE_NAME)}catch(e){throw e instanceof Error&&"DYNAMIC_SERVER_USAGE"===e.digest?new Error("Usage of next-intl APIs in Server Components currently opts into dynamic rendering. This limitation will eventually be lifted, but as a stopgap solution, you can use the `setRequestLocale` API to enable static rendering, see https://next-intl-docs.vercel.app/docs/getting-started/app-router/with-i18n-routing#static-rendering",{cause:e}):e}return r||t.notFound(),r}));exports.getRequestLocale=function(){return s.getCachedRequestLocale()||i()};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("./server/react-client/index.js");exports.getFormatter=e.getFormatter,exports.getLocale=e.getLocale,exports.getMessages=e.getMessages,exports.getNow=e.getNow,exports.getRequestConfig=e.getRequestConfig,exports.getTimeZone=e.getTimeZone,exports.getTranslations=e.getTranslations,exports.unstable_setRequestLocale=e.unstable_setRequestLocale;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("./server/react-client/index.js");exports.getFormatter=e.getFormatter,exports.getLocale=e.getLocale,exports.getMessages=e.getMessages,exports.getNow=e.getNow,exports.getRequestConfig=e.getRequestConfig,exports.getTimeZone=e.getTimeZone,exports.getTranslations=e.getTranslations,exports.setRequestLocale=e.setRequestLocale,exports.unstable_setRequestLocale=e.unstable_setRequestLocale;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("./server/react-server/getRequestConfig.js"),r=require("./server/react-server/getFormatter.js"),t=require("./server/react-server/getMessages.js"),s=require("./server/react-server/getNow.js"),a=require("./server/react-server/getTimeZone.js"),o=require("./server/react-server/getTranslations.js"),u=require("./server/react-server/getLocale.js"),g=require("./server/react-server/RequestLocaleCache.js");exports.getRequestConfig=e.default,exports.getFormatter=r.default,exports.getMessages=t.default,exports.getNow=s.default,exports.getTimeZone=a.default,exports.getTranslations=o.default,exports.getLocale=u.default,exports.unstable_setRequestLocale=g.setCachedRequestLocale;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("./server/react-server/getRequestConfig.js"),r=require("./server/react-server/getFormatter.js"),t=require("./server/react-server/getMessages.js"),s=require("./server/react-server/getNow.js"),a=require("./server/react-server/getTimeZone.js"),o=require("./server/react-server/getTranslations.js"),u=require("./server/react-server/getLocale.js"),c=require("./server/react-server/RequestLocaleCache.js");exports.getRequestConfig=e.default,exports.getFormatter=r.default,exports.getMessages=t.default,exports.getNow=s.default,exports.getTimeZone=a.default,exports.getTranslations=o.default,exports.getLocale=u.default,exports.setRequestLocale=c.setCachedRequestLocale,exports.unstable_setRequestLocale=c.setCachedRequestLocale;
@@ -1,6 +1,6 @@
1
1
  import { RequestCookies } from 'next/dist/server/web/spec-extension/cookies';
2
2
  import { ResolvedRoutingConfig } from '../routing/config';
3
- import { Locales, Pathnames, DomainsConfig, DomainConfig, LocalePrefixMode } from '../routing/types';
3
+ import { DomainConfig, DomainsConfig, LocalePrefixMode, Locales, Pathnames } from '../routing/types';
4
4
  export declare function getAcceptLanguageLocale<AppLocales extends Locales>(requestHeaders: Headers, locales: AppLocales, defaultLocale: string): string | undefined;
5
5
  export default function resolveLocale<AppLocales extends Locales, AppLocalePrefixMode extends LocalePrefixMode, AppPathnames extends Pathnames<AppLocales> | undefined, AppDomains extends DomainsConfig<AppLocales> | undefined>(routing: Omit<ResolvedRoutingConfig<AppLocales, AppLocalePrefixMode, AppPathnames, AppDomains>, 'pathnames'>, requestHeaders: Headers, requestCookies: RequestCookies, pathname: string): {
6
6
  locale: AppLocales[number];
@@ -1,4 +1,4 @@
1
- import { Locales, LocalePrefixConfigVerbose, DomainConfig, Pathnames, DomainsConfig, LocalePrefixMode } from '../routing/types';
1
+ import { DomainConfig, DomainsConfig, LocalePrefixConfigVerbose, LocalePrefixMode, Locales, Pathnames } from '../routing/types';
2
2
  export declare function getFirstPathnameSegment(pathname: string): string;
3
3
  export declare function getInternalTemplate<AppLocales extends Locales, AppPathnames extends Pathnames<AppLocales>>(pathnames: AppPathnames, pathname: string, locale: AppLocales[number]): [AppLocales[number] | undefined, keyof AppPathnames | undefined];
4
4
  export declare function formatTemplatePathname(sourcePathname: string, sourceTemplate: string, targetTemplate: string, prefix?: string): string;
@@ -1,5 +1,5 @@
1
1
  import { ComponentProps, ReactElement } from 'react';
2
- import { Locales, LocalePrefixConfigVerbose, LocalePrefixMode } from '../../routing/types';
2
+ import { LocalePrefixConfigVerbose, LocalePrefixMode, Locales } from '../../routing/types';
3
3
  import LegacyBaseLink from '../shared/LegacyBaseLink';
4
4
  type Props<AppLocales extends Locales, AppLocalePrefixMode extends LocalePrefixMode> = Omit<ComponentProps<typeof LegacyBaseLink>, 'locale' | 'prefix' | 'localePrefixMode'> & {
5
5
  locale?: AppLocales[number];
@@ -4,7 +4,7 @@ import { DomainsConfig, LocalePrefixMode, Locales, Pathnames } from '../../routi
4
4
  import { HrefOrHrefWithParams } from '../shared/utils';
5
5
  import ClientLink from './ClientLink';
6
6
  /**
7
- * @deprecated Consider switching to `createNavigation` (see https://github.com/amannn/next-intl/pull/1316)
7
+ * @deprecated Consider switching to `createNavigation` (see https://next-intl-docs.vercel.app/blog/next-intl-3-22#create-navigation)
8
8
  **/
9
9
  export default function createLocalizedPathnamesNavigation<AppLocales extends Locales, AppLocalePrefixMode extends LocalePrefixMode = 'always', AppPathnames extends Pathnames<AppLocales> = never, AppDomains extends DomainsConfig<AppLocales> = never>(routing: RoutingConfigLocalizedNavigation<AppLocales, AppLocalePrefixMode, AppPathnames, AppDomains>): {
10
10
  Link: <Pathname extends keyof AppPathnames>(props: (Omit<Omit<Omit<Omit<Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, keyof {
@@ -14,7 +14,7 @@ export default function createLocalizedPathnamesNavigation<AppLocales extends Lo
14
14
  scroll?: boolean;
15
15
  shallow?: boolean;
16
16
  passHref?: boolean;
17
- prefetch?: boolean;
17
+ prefetch?: boolean | null;
18
18
  locale?: string | false;
19
19
  legacyBehavior?: boolean;
20
20
  onMouseEnter?: React.MouseEventHandler<HTMLAnchorElement>;
@@ -27,7 +27,7 @@ export default function createLocalizedPathnamesNavigation<AppLocales extends Lo
27
27
  scroll?: boolean;
28
28
  shallow?: boolean;
29
29
  passHref?: boolean;
30
- prefetch?: boolean;
30
+ prefetch?: boolean | null;
31
31
  locale?: string | false;
32
32
  legacyBehavior?: boolean;
33
33
  onMouseEnter?: React.MouseEventHandler<HTMLAnchorElement>;
@@ -2,23 +2,23 @@ import { RoutingConfigLocalizedNavigation, RoutingConfigSharedNavigation } from
2
2
  import { DomainsConfig, LocalePrefixMode, Locales, Pathnames } from '../../routing/types';
3
3
  export default function createNavigation<const AppLocales extends Locales, const AppLocalePrefixMode extends LocalePrefixMode = 'always', const AppPathnames extends Pathnames<AppLocales> = never, const AppDomains extends DomainsConfig<AppLocales> = never>(routing?: [AppPathnames] extends [never] ? RoutingConfigSharedNavigation<AppLocales, AppLocalePrefixMode, AppDomains> | undefined : RoutingConfigLocalizedNavigation<AppLocales, AppLocalePrefixMode, AppPathnames, AppDomains>): {
4
4
  Link: import("react").ForwardRefExoticComponent<Omit<{
5
- locale?: string;
5
+ locale?: string | undefined;
6
6
  slot?: string | undefined;
7
7
  style?: import("react").CSSProperties | undefined;
8
8
  title?: string | undefined;
9
9
  onError?: import("react").ReactEventHandler<HTMLAnchorElement> | undefined;
10
10
  children?: import("react").ReactNode | undefined;
11
11
  ref?: import("react").LegacyRef<HTMLAnchorElement> | undefined;
12
- replace?: boolean;
13
- as?: string | import("url").UrlObject;
14
- scroll?: boolean;
15
- shallow?: boolean;
16
- passHref?: boolean;
17
- prefetch?: boolean;
18
- legacyBehavior?: boolean;
19
- onMouseEnter?: import("react").MouseEventHandler<HTMLAnchorElement>;
20
- onTouchStart?: import("react").TouchEventHandler<HTMLAnchorElement>;
21
- onClick?: import("react").MouseEventHandler<HTMLAnchorElement>;
12
+ replace?: boolean | undefined;
13
+ as?: (string | import("url").UrlObject) | undefined;
14
+ scroll?: boolean | undefined;
15
+ shallow?: boolean | undefined;
16
+ passHref?: boolean | undefined;
17
+ prefetch?: (boolean | null) | undefined;
18
+ legacyBehavior?: boolean | undefined;
19
+ onMouseEnter?: React.MouseEventHandler<HTMLAnchorElement> | undefined;
20
+ onTouchStart?: React.TouchEventHandler<HTMLAnchorElement> | undefined;
21
+ onClick?: React.MouseEventHandler<HTMLAnchorElement> | undefined;
22
22
  download?: any;
23
23
  hrefLang?: string | undefined;
24
24
  media?: string | undefined;
@@ -31,12 +31,14 @@ export default function createNavigation<const AppLocales extends Locales, const
31
31
  suppressContentEditableWarning?: boolean | undefined;
32
32
  suppressHydrationWarning?: boolean | undefined;
33
33
  accessKey?: string | undefined;
34
+ autoCapitalize?: "off" | "none" | "on" | "sentences" | "words" | "characters" | undefined | (string & {});
34
35
  autoFocus?: boolean | undefined;
35
36
  className?: string | undefined;
36
37
  contentEditable?: (boolean | "true" | "false") | "inherit" | "plaintext-only" | undefined;
37
38
  contextMenu?: string | undefined;
38
39
  dir?: string | undefined;
39
40
  draggable?: (boolean | "true" | "false") | undefined;
41
+ enterKeyHint?: "enter" | "done" | "go" | "next" | "previous" | "search" | "send" | undefined;
40
42
  hidden?: boolean | undefined;
41
43
  id?: string | undefined;
42
44
  lang?: string | undefined;
@@ -57,7 +59,6 @@ export default function createNavigation<const AppLocales extends Locales, const
57
59
  rev?: string | undefined;
58
60
  typeof?: string | undefined;
59
61
  vocab?: string | undefined;
60
- autoCapitalize?: string | undefined;
61
62
  autoCorrect?: string | undefined;
62
63
  autoSave?: string | undefined;
63
64
  color?: string | undefined;
@@ -77,7 +78,7 @@ export default function createNavigation<const AppLocales extends Locales, const
77
78
  onToggle?: import("react").ToggleEventHandler<HTMLAnchorElement> | undefined;
78
79
  onBeforeToggle?: import("react").ToggleEventHandler<HTMLAnchorElement> | undefined;
79
80
  inert?: boolean | undefined;
80
- tw?: string;
81
+ tw?: string | undefined;
81
82
  "aria-activedescendant"?: string | undefined;
82
83
  "aria-atomic"?: (boolean | "true" | "false") | undefined;
83
84
  "aria-autocomplete"?: "none" | "inline" | "list" | "both" | undefined;
@@ -2,7 +2,7 @@ import React, { ReactElement } from 'react';
2
2
  import { RoutingConfigSharedNavigation } from '../../routing/config';
3
3
  import { DomainsConfig, LocalePrefixMode, Locales } from '../../routing/types';
4
4
  /**
5
- * @deprecated Consider switching to `createNavigation` (see https://github.com/amannn/next-intl/pull/1316)
5
+ * @deprecated Consider switching to `createNavigation` (see https://next-intl-docs.vercel.app/blog/next-intl-3-22#create-navigation)
6
6
  **/
7
7
  export default function createSharedPathnamesNavigation<AppLocales extends Locales, AppLocalePrefixMode extends LocalePrefixMode, AppDomains extends DomainsConfig<AppLocales> = never>(routing?: RoutingConfigSharedNavigation<AppLocales, AppLocalePrefixMode, AppDomains>): {
8
8
  Link: (props: Omit<Omit<Omit<Omit<Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, keyof {
@@ -12,7 +12,7 @@ export default function createSharedPathnamesNavigation<AppLocales extends Local
12
12
  scroll?: boolean;
13
13
  shallow?: boolean;
14
14
  passHref?: boolean;
15
- prefetch?: boolean;
15
+ prefetch?: boolean | null;
16
16
  locale?: string | false;
17
17
  legacyBehavior?: boolean;
18
18
  onMouseEnter?: React.MouseEventHandler<HTMLAnchorElement>;
@@ -25,7 +25,7 @@ export default function createSharedPathnamesNavigation<AppLocales extends Local
25
25
  scroll?: boolean;
26
26
  shallow?: boolean;
27
27
  passHref?: boolean;
28
- prefetch?: boolean;
28
+ prefetch?: boolean | null;
29
29
  locale?: string | false;
30
30
  legacyBehavior?: boolean;
31
31
  onMouseEnter?: React.MouseEventHandler<HTMLAnchorElement>;
@@ -1,6 +1,6 @@
1
1
  export { default as createSharedPathnamesNavigation } from './createSharedPathnamesNavigation';
2
2
  export { default as createLocalizedPathnamesNavigation } from './createLocalizedPathnamesNavigation';
3
3
  export { default as createNavigation } from './createNavigation';
4
- import type { Pathnames as PathnamesDeprecatedExport, Locales } from '../../routing/types';
4
+ import type { Locales, Pathnames as PathnamesDeprecatedExport } from '../../routing/types';
5
5
  /** @deprecated Please import from `next-intl/routing` instead. */
6
6
  export type Pathnames<AppLocales extends Locales> = PathnamesDeprecatedExport<AppLocales>;
@@ -1,2 +1,2 @@
1
- import { Locales, LocalePrefixConfigVerbose, LocalePrefixMode } from '../../routing/types';
1
+ import { LocalePrefixConfigVerbose, LocalePrefixMode, Locales } from '../../routing/types';
2
2
  export default function useBasePathname<AppLocales extends Locales, AppLocalePrefixMode extends LocalePrefixMode>(localePrefix: LocalePrefixConfigVerbose<AppLocales, AppLocalePrefixMode>): string | null;
@@ -1,5 +1,5 @@
1
1
  import { InitializedLocaleCookieConfig } from '../../routing/config';
2
- import { Locales, LocalePrefixConfigVerbose, LocalePrefixMode } from '../../routing/types';
2
+ import { LocalePrefixConfigVerbose, LocalePrefixMode, Locales } from '../../routing/types';
3
3
  type IntlNavigateOptions<AppLocales extends Locales> = {
4
4
  locale?: AppLocales[number];
5
5
  };
@@ -1,5 +1,5 @@
1
1
  import React, { ComponentProps } from 'react';
2
- import { Locales, LocalePrefixConfigVerbose, LocalePrefixMode } from '../../routing/types';
2
+ import { LocalePrefixConfigVerbose, LocalePrefixMode, Locales } from '../../routing/types';
3
3
  import LegacyBaseLink from '../shared/LegacyBaseLink';
4
4
  type Props<AppLocales extends Locales, AppLocalePrefixMode extends LocalePrefixMode> = Omit<ComponentProps<typeof LegacyBaseLink>, 'locale' | 'prefix' | 'localePrefixMode'> & {
5
5
  locale?: AppLocales[number];
@@ -10,7 +10,7 @@ export default function createLocalizedPathnamesNavigation<AppLocales extends Lo
10
10
  scroll?: boolean;
11
11
  shallow?: boolean;
12
12
  passHref?: boolean;
13
- prefetch?: boolean;
13
+ prefetch?: boolean | null;
14
14
  locale?: string | false;
15
15
  legacyBehavior?: boolean;
16
16
  onMouseEnter?: React.MouseEventHandler<HTMLAnchorElement>;
@@ -23,7 +23,7 @@ export default function createLocalizedPathnamesNavigation<AppLocales extends Lo
23
23
  scroll?: boolean;
24
24
  shallow?: boolean;
25
25
  passHref?: boolean;
26
- prefetch?: boolean;
26
+ prefetch?: boolean | null;
27
27
  locale?: string | false;
28
28
  legacyBehavior?: boolean;
29
29
  onMouseEnter?: React.MouseEventHandler<HTMLAnchorElement>;
@@ -4,23 +4,23 @@ export default function createNavigation<const AppLocales extends Locales, const
4
4
  usePathname: () => never;
5
5
  useRouter: () => never;
6
6
  Link: import("react").ForwardRefExoticComponent<Omit<{
7
- locale?: string;
7
+ locale?: string | undefined;
8
8
  slot?: string | undefined;
9
9
  style?: import("react").CSSProperties | undefined;
10
10
  title?: string | undefined;
11
11
  onError?: import("react").ReactEventHandler<HTMLAnchorElement> | undefined;
12
12
  children?: import("react").ReactNode | undefined;
13
13
  ref?: import("react").LegacyRef<HTMLAnchorElement> | undefined;
14
- replace?: boolean;
15
- as?: string | import("url").UrlObject;
16
- scroll?: boolean;
17
- shallow?: boolean;
18
- passHref?: boolean;
19
- prefetch?: boolean;
20
- legacyBehavior?: boolean;
21
- onMouseEnter?: import("react").MouseEventHandler<HTMLAnchorElement>;
22
- onTouchStart?: import("react").TouchEventHandler<HTMLAnchorElement>;
23
- onClick?: import("react").MouseEventHandler<HTMLAnchorElement>;
14
+ replace?: boolean | undefined;
15
+ as?: (string | import("url").UrlObject) | undefined;
16
+ scroll?: boolean | undefined;
17
+ shallow?: boolean | undefined;
18
+ passHref?: boolean | undefined;
19
+ prefetch?: (boolean | null) | undefined;
20
+ legacyBehavior?: boolean | undefined;
21
+ onMouseEnter?: React.MouseEventHandler<HTMLAnchorElement> | undefined;
22
+ onTouchStart?: React.TouchEventHandler<HTMLAnchorElement> | undefined;
23
+ onClick?: React.MouseEventHandler<HTMLAnchorElement> | undefined;
24
24
  download?: any;
25
25
  hrefLang?: string | undefined;
26
26
  media?: string | undefined;
@@ -33,12 +33,14 @@ export default function createNavigation<const AppLocales extends Locales, const
33
33
  suppressContentEditableWarning?: boolean | undefined;
34
34
  suppressHydrationWarning?: boolean | undefined;
35
35
  accessKey?: string | undefined;
36
+ autoCapitalize?: "off" | "none" | "on" | "sentences" | "words" | "characters" | undefined | (string & {});
36
37
  autoFocus?: boolean | undefined;
37
38
  className?: string | undefined;
38
39
  contentEditable?: (boolean | "true" | "false") | "inherit" | "plaintext-only" | undefined;
39
40
  contextMenu?: string | undefined;
40
41
  dir?: string | undefined;
41
42
  draggable?: (boolean | "true" | "false") | undefined;
43
+ enterKeyHint?: "enter" | "done" | "go" | "next" | "previous" | "search" | "send" | undefined;
42
44
  hidden?: boolean | undefined;
43
45
  id?: string | undefined;
44
46
  lang?: string | undefined;
@@ -59,7 +61,6 @@ export default function createNavigation<const AppLocales extends Locales, const
59
61
  rev?: string | undefined;
60
62
  typeof?: string | undefined;
61
63
  vocab?: string | undefined;
62
- autoCapitalize?: string | undefined;
63
64
  autoCorrect?: string | undefined;
64
65
  autoSave?: string | undefined;
65
66
  color?: string | undefined;
@@ -79,7 +80,7 @@ export default function createNavigation<const AppLocales extends Locales, const
79
80
  onToggle?: import("react").ToggleEventHandler<HTMLAnchorElement> | undefined;
80
81
  onBeforeToggle?: import("react").ToggleEventHandler<HTMLAnchorElement> | undefined;
81
82
  inert?: boolean | undefined;
82
- tw?: string;
83
+ tw?: string | undefined;
83
84
  "aria-activedescendant"?: string | undefined;
84
85
  "aria-atomic"?: (boolean | "true" | "false") | undefined;
85
86
  "aria-autocomplete"?: "none" | "inline" | "list" | "both" | undefined;
@@ -22,23 +22,23 @@ export default function createSharedNavigationFns<const AppLocales extends Local
22
22
  alternateLinks: NonNullable<boolean | undefined>;
23
23
  };
24
24
  Link: React.ForwardRefExoticComponent<Omit<{
25
- locale?: string;
25
+ locale?: string | undefined;
26
26
  slot?: string | undefined;
27
27
  style?: React.CSSProperties | undefined;
28
28
  title?: string | undefined;
29
29
  onError?: React.ReactEventHandler<HTMLAnchorElement> | undefined;
30
30
  children?: React.ReactNode | undefined;
31
31
  ref?: React.LegacyRef<HTMLAnchorElement> | undefined;
32
- replace?: boolean;
33
- as?: string | import("url").UrlObject;
34
- scroll?: boolean;
35
- shallow?: boolean;
36
- passHref?: boolean;
37
- prefetch?: boolean;
38
- legacyBehavior?: boolean;
39
- onMouseEnter?: React.MouseEventHandler<HTMLAnchorElement>;
40
- onTouchStart?: React.TouchEventHandler<HTMLAnchorElement>;
41
- onClick?: React.MouseEventHandler<HTMLAnchorElement>;
32
+ replace?: boolean | undefined;
33
+ as?: (string | import("url").UrlObject) | undefined;
34
+ scroll?: boolean | undefined;
35
+ shallow?: boolean | undefined;
36
+ passHref?: boolean | undefined;
37
+ prefetch?: (boolean | null) | undefined;
38
+ legacyBehavior?: boolean | undefined;
39
+ onMouseEnter?: React.MouseEventHandler<HTMLAnchorElement> | undefined;
40
+ onTouchStart?: React.TouchEventHandler<HTMLAnchorElement> | undefined;
41
+ onClick?: React.MouseEventHandler<HTMLAnchorElement> | undefined;
42
42
  download?: any;
43
43
  hrefLang?: string | undefined;
44
44
  media?: string | undefined;
@@ -51,12 +51,14 @@ export default function createSharedNavigationFns<const AppLocales extends Local
51
51
  suppressContentEditableWarning?: boolean | undefined;
52
52
  suppressHydrationWarning?: boolean | undefined;
53
53
  accessKey?: string | undefined;
54
+ autoCapitalize?: "off" | "none" | "on" | "sentences" | "words" | "characters" | undefined | (string & {});
54
55
  autoFocus?: boolean | undefined;
55
56
  className?: string | undefined;
56
57
  contentEditable?: (boolean | "true" | "false") | "inherit" | "plaintext-only" | undefined;
57
58
  contextMenu?: string | undefined;
58
59
  dir?: string | undefined;
59
60
  draggable?: (boolean | "true" | "false") | undefined;
61
+ enterKeyHint?: "enter" | "done" | "go" | "next" | "previous" | "search" | "send" | undefined;
60
62
  hidden?: boolean | undefined;
61
63
  id?: string | undefined;
62
64
  lang?: string | undefined;
@@ -77,7 +79,6 @@ export default function createSharedNavigationFns<const AppLocales extends Local
77
79
  rev?: string | undefined;
78
80
  typeof?: string | undefined;
79
81
  vocab?: string | undefined;
80
- autoCapitalize?: string | undefined;
81
82
  autoCorrect?: string | undefined;
82
83
  autoSave?: string | undefined;
83
84
  color?: string | undefined;
@@ -97,7 +98,7 @@ export default function createSharedNavigationFns<const AppLocales extends Local
97
98
  onToggle?: React.ToggleEventHandler<HTMLAnchorElement> | undefined;
98
99
  onBeforeToggle?: React.ToggleEventHandler<HTMLAnchorElement> | undefined;
99
100
  inert?: boolean | undefined;
100
- tw?: string;
101
+ tw?: string | undefined;
101
102
  "aria-activedescendant"?: string | undefined;
102
103
  "aria-atomic"?: (boolean | "true" | "false") | undefined;
103
104
  "aria-autocomplete"?: "none" | "inline" | "list" | "both" | undefined;
@@ -1,4 +1,4 @@
1
- import { Locales, LocalePrefixConfigVerbose, LocalePrefixMode } from '../../routing/types';
1
+ import { LocalePrefixConfigVerbose, LocalePrefixMode, Locales } from '../../routing/types';
2
2
  export declare const baseRedirect: <AppLocales extends Locales, AppLocalePrefixMode extends LocalePrefixMode>(params: {
3
3
  pathname: string;
4
4
  locale: Locales[number];
@@ -7,7 +7,7 @@
7
7
  * - Make sure everything exported from this module is
8
8
  * supported in all Next.js versions that are supported.
9
9
  */
10
- import { useTranslations as base_useTranslations, useFormatter as base_useFormatter } from 'use-intl';
10
+ import { useFormatter as base_useFormatter, useTranslations as base_useTranslations } from 'use-intl';
11
11
  export * from 'use-intl';
12
12
  export declare const useTranslations: typeof base_useTranslations;
13
13
  export declare const useFormatter: typeof base_useFormatter;
@@ -1,5 +1,5 @@
1
1
  import { ReactElement, ReactNodeArray } from 'react';
2
- import { Formats, TranslationValues, RichTranslationValues, MessageKeys, NamespaceKeys, NestedKeyOf, NestedValueOf, createTranslator, MarkupTranslationValues } from 'use-intl/core';
2
+ import { Formats, MarkupTranslationValues, MessageKeys, NamespaceKeys, NestedKeyOf, NestedValueOf, RichTranslationValues, TranslationValues, createTranslator } from 'use-intl/core';
3
3
  declare function getTranslatorImpl<NestedKey extends NamespaceKeys<IntlMessages, NestedKeyOf<IntlMessages>> = never>(config: Parameters<typeof createTranslator>[0], namespace?: NestedKey): {
4
4
  <TargetKey extends MessageKeys<NestedValueOf<{
5
5
  '!': IntlMessages;
@@ -1,5 +1,5 @@
1
1
  import type { NextResponse } from 'next/server';
2
- import { Locales, LocalePrefix, LocalePrefixConfigVerbose, DomainsConfig, Pathnames, LocalePrefixMode } from './types';
2
+ import { DomainsConfig, LocalePrefix, LocalePrefixConfigVerbose, LocalePrefixMode, Locales, Pathnames } from './types';
3
3
  type CookieAttributes = Pick<NonNullable<Parameters<typeof NextResponse.prototype.cookies.set>['2']>, 'maxAge' | 'domain' | 'partitioned' | 'path' | 'priority' | 'sameSite' | 'secure' | 'name'>;
4
4
  export type RoutingConfig<AppLocales extends Locales, AppLocalePrefixMode extends LocalePrefixMode, AppPathnames extends Pathnames<AppLocales> | undefined, AppDomains extends DomainsConfig<AppLocales> | undefined> = {
5
5
  /**
@@ -1,4 +1,4 @@
1
- import type { getRequestConfig as getRequestConfig_type, getFormatter as getFormatter_type, getNow as getNow_type, getTimeZone as getTimeZone_type, getMessages as getMessages_type, getLocale as getLocale_type, unstable_setRequestLocale as unstable_setRequestLocale_type } from '../react-server';
1
+ import type { getFormatter as getFormatter_type, getLocale as getLocale_type, getMessages as getMessages_type, getNow as getNow_type, getRequestConfig as getRequestConfig_type, getTimeZone as getTimeZone_type, setRequestLocale as setRequestLocale_type, unstable_setRequestLocale as unstable_setRequestLocale_type } from '../react-server';
2
2
  export declare function getRequestConfig(...args: Parameters<typeof getRequestConfig_type>): ReturnType<typeof getRequestConfig_type>;
3
3
  export declare const getFormatter: typeof getFormatter_type;
4
4
  export declare const getNow: typeof getNow_type;
@@ -7,3 +7,4 @@ export declare const getMessages: typeof getMessages_type;
7
7
  export declare const getLocale: typeof getLocale_type;
8
8
  export declare const getTranslations: () => never;
9
9
  export declare const unstable_setRequestLocale: typeof unstable_setRequestLocale_type;
10
+ export declare const setRequestLocale: typeof setRequestLocale_type;
@@ -14,7 +14,7 @@ export type RequestConfig = Omit<IntlConfig, 'locale'> & {
14
14
  };
15
15
  export type GetRequestConfigParams = {
16
16
  /**
17
- * Deprecated in favor of `requestLocale` (see https://github.com/amannn/next-intl/pull/1383).
17
+ * Deprecated in favor of `requestLocale` (see https://next-intl-docs.vercel.app/blog/next-intl-3-22#await-request-locale).
18
18
  *
19
19
  * The locale that was matched by the `[locale]` path segment. Note however
20
20
  * that this can be overridden in async APIs when the `locale` is explicitly
@@ -1,5 +1,5 @@
1
1
  import { ReactElement, ReactNodeArray } from 'react';
2
- import { Formats, TranslationValues, MessageKeys, NamespaceKeys, NestedKeyOf, NestedValueOf, RichTranslationValues, MarkupTranslationValues } from 'use-intl/core';
2
+ import { Formats, MarkupTranslationValues, MessageKeys, NamespaceKeys, NestedKeyOf, NestedValueOf, RichTranslationValues, TranslationValues } from 'use-intl/core';
3
3
  declare function getTranslations<NestedKey extends NamespaceKeys<IntlMessages, NestedKeyOf<IntlMessages>> = never>(namespace?: NestedKey): Promise<{
4
4
  <TargetKey extends MessageKeys<NestedValueOf<{
5
5
  '!': IntlMessages;
@@ -8,4 +8,7 @@ export { default as getTimeZone } from './getTimeZone';
8
8
  export { default as getTranslations } from './getTranslations';
9
9
  export { default as getMessages } from './getMessages';
10
10
  export { default as getLocale } from './getLocale';
11
- export { setCachedRequestLocale as unstable_setRequestLocale } from './RequestLocaleCache';
11
+ export { setCachedRequestLocale as setRequestLocale } from './RequestLocaleCache';
12
+ export {
13
+ /** @deprecated Deprecated in favor of `setRequestLocale`. */
14
+ setCachedRequestLocale as unstable_setRequestLocale } from './RequestLocaleCache';
@@ -1,16 +1,16 @@
1
1
  import { UrlObject } from 'url';
2
2
  import NextLink from 'next/link';
3
3
  import { ComponentProps } from 'react';
4
- import { Locales, LocalePrefixConfigVerbose, LocalePrefixMode } from '../routing/types';
4
+ import { LocalePrefixConfigVerbose, LocalePrefixMode, Locales } from '../routing/types';
5
5
  type Href = ComponentProps<typeof NextLink>['href'];
6
6
  export declare function isLocalizableHref(href: Href): boolean;
7
- export declare function localizeHref(href: string, locale: string, curLocale: string, curPathname: string, prefix: string): string;
8
- export declare function localizeHref(href: UrlObject | string, locale: string, curLocale: string, curPathname: string, prefix: string): UrlObject | string;
7
+ export declare function localizeHref(href: string, locale: string, curLocale: string, curPathname: string, prefix?: string): string;
8
+ export declare function localizeHref(href: UrlObject | string, locale: string, curLocale: string, curPathname: string, prefix?: string): UrlObject | string;
9
9
  export declare function prefixHref(href: string, prefix: string): string;
10
10
  export declare function prefixHref(href: UrlObject | string, prefix: string): UrlObject | string;
11
11
  export declare function unprefixPathname(pathname: string, prefix: string): string;
12
12
  export declare function prefixPathname(prefix: string, pathname: string): string;
13
- export declare function hasPathnamePrefixed(prefix: string, pathname: string): boolean;
13
+ export declare function hasPathnamePrefixed(prefix: string | undefined, pathname: string): boolean;
14
14
  export declare function normalizeTrailingSlash(pathname: string): string;
15
15
  export declare function matchesPathname(
16
16
  /** E.g. `/users/[userId]-[userName]` */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "next-intl",
3
- "version": "3.22.0-canary.1",
3
+ "version": "3.22.0",
4
4
  "sideEffects": false,
5
5
  "author": "Jan Amann <jan@amann.work>",
6
6
  "funding": [
@@ -16,6 +16,17 @@
16
16
  "type": "git",
17
17
  "url": "https://github.com/amannn/next-intl"
18
18
  },
19
+ "scripts": {
20
+ "build": "rm -rf dist && rollup -c",
21
+ "test": "TZ=Europe/Berlin vitest",
22
+ "lint": "pnpm run lint:source && pnpm run lint:package",
23
+ "lint:source": "eslint src test && tsc --noEmit && pnpm run lint:prettier",
24
+ "lint:package": "publint && attw --pack",
25
+ "lint:prettier": "prettier src --check",
26
+ "prepublishOnly": "turbo build && cp ../../README.md .",
27
+ "postpublish": "git checkout . && rm ./README.md",
28
+ "size": "size-limit"
29
+ },
19
30
  "main": "./dist/index.react-client.js",
20
31
  "module": "./dist/esm/index.react-client.js",
21
32
  "typings": "./dist/types/src/index.react-client.d.ts",
@@ -77,43 +88,11 @@
77
88
  "dependencies": {
78
89
  "@formatjs/intl-localematcher": "^0.5.4",
79
90
  "negotiator": "^0.6.3",
80
- "use-intl": "3.21.2-canary.0"
91
+ "use-intl": "^3.22.0"
81
92
  },
82
93
  "peerDependencies": {
83
94
  "next": "^10.0.0 || ^11.0.0 || ^12.0.0 || ^13.0.0 || ^14.0.0",
84
95
  "react": "^16.8.0 || ^17.0.0 || ^18.0.0"
85
96
  },
86
- "devDependencies": {
87
- "@arethetypeswrong/cli": "^0.15.3",
88
- "@edge-runtime/vm": "^3.2.0",
89
- "@size-limit/preset-big-lib": "^11.1.4",
90
- "@testing-library/react": "^16.0.0",
91
- "@types/negotiator": "^0.6.3",
92
- "@types/node": "^20.14.5",
93
- "@types/react": "^18.3.3",
94
- "@types/react-dom": "^18.3.0",
95
- "eslint": "^8.56.0",
96
- "eslint-config-molindo": "^7.0.0",
97
- "eslint-plugin-deprecation": "^3.0.0",
98
- "eslint-plugin-react-compiler": "0.0.0-experimental-8e3b87c-20240822",
99
- "next": "^14.2.4",
100
- "path-to-regexp": "^6.2.2",
101
- "publint": "^0.2.8",
102
- "react": "^18.3.1",
103
- "react-dom": "^18.3.1",
104
- "rollup": "^4.18.0",
105
- "rollup-plugin-preserve-directives": "0.4.0",
106
- "size-limit": "^11.1.4",
107
- "typescript": "^5.5.3",
108
- "vitest": "^2.0.2"
109
- },
110
- "prettier": "../../.prettierrc.json",
111
- "scripts": {
112
- "build": "rm -rf dist && rollup -c",
113
- "test": "TZ=Europe/Berlin vitest",
114
- "lint": "pnpm run lint:source && pnpm run lint:package",
115
- "lint:source": "eslint src test && tsc --noEmit",
116
- "lint:package": "publint && attw --pack",
117
- "size": "size-limit"
118
- }
119
- }
97
+ "gitHead": "02bc1190dc993b202e50e52de75ee36d0172e3db"
98
+ }