next-intl 3.15.4 → 3.15.6-canary.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 (48) hide show
  1. package/dist/development/middleware/getAlternateLinksHeaderValue.js +2 -0
  2. package/dist/development/middleware/middleware.js +1 -1
  3. package/dist/development/middleware/utils.js +13 -14
  4. package/dist/development/navigation/shared/redirects.js +1 -1
  5. package/dist/development/plugin.js +29 -25
  6. package/dist/development/shared/utils.js +26 -4
  7. package/dist/esm/middleware/getAlternateLinksHeaderValue.js +1 -1
  8. package/dist/esm/middleware/middleware.js +1 -1
  9. package/dist/esm/middleware/utils.js +1 -1
  10. package/dist/esm/navigation/shared/redirects.js +1 -1
  11. package/dist/esm/plugin.js +1 -1
  12. package/dist/esm/shared/utils.js +1 -1
  13. package/dist/production/middleware/getAlternateLinksHeaderValue.js +1 -1
  14. package/dist/production/middleware/middleware.js +1 -1
  15. package/dist/production/middleware/utils.js +1 -1
  16. package/dist/production/navigation/shared/redirects.js +1 -1
  17. package/dist/production/plugin.js +1 -1
  18. package/dist/production/shared/utils.js +1 -1
  19. package/dist/types/src/middleware/utils.d.ts +0 -1
  20. package/dist/types/src/shared/utils.d.ts +1 -2
  21. package/package.json +6 -6
  22. /package/dist/types/{test → src}/middleware/getAlternateLinksHeaderValue.test.d.ts +0 -0
  23. /package/dist/types/{test → src}/middleware/middleware.test.d.ts +0 -0
  24. /package/dist/types/{test → src}/middleware/resolveLocale.test.d.ts +0 -0
  25. /package/dist/types/{test → src}/middleware/utils.test.d.ts +0 -0
  26. /package/dist/types/{test → src}/navigation/createLocalizedPathnamesNavigation.test.d.ts +0 -0
  27. /package/dist/types/{test → src}/navigation/createSharedPathnamesNavigation.test.d.ts +0 -0
  28. /package/dist/types/{test → src}/navigation/react-client/ClientLink.test.d.ts +0 -0
  29. /package/dist/types/{test → src}/navigation/react-client/createLocalizedPathnamesNavigation.test.d.ts +0 -0
  30. /package/dist/types/{test → src}/navigation/react-client/createSharedPathnamesNavigation.test.d.ts +0 -0
  31. /package/dist/types/{test → src}/navigation/react-client/useBasePathname.test.d.ts +0 -0
  32. /package/dist/types/{test → src}/navigation/react-client/useBaseRouter.test.d.ts +0 -0
  33. /package/dist/types/{test → src}/navigation/shared/redirects.test.d.ts +0 -0
  34. /package/dist/types/{test → src}/navigation/shared/utils.test.d.ts +0 -0
  35. /package/dist/types/{test → src}/react-client/useFormatter.test.d.ts +0 -0
  36. /package/dist/types/{test → src}/react-client/useLocale.test.d.ts +0 -0
  37. /package/dist/types/{test → src}/react-client/useNow.test.d.ts +0 -0
  38. /package/dist/types/{test → src}/react-client/useTimeZone.test.d.ts +0 -0
  39. /package/dist/types/{test → src}/react-client/useTranslations.test.d.ts +0 -0
  40. /package/dist/types/{test → src}/react-server/NextIntlClientProviderServer.test.d.ts +0 -0
  41. /package/dist/types/{test → src}/react-server/index.test.d.ts +0 -0
  42. /package/dist/types/{test → src}/react-server/useTranslations.test.d.ts +0 -0
  43. /package/dist/types/{test → src}/react-server/utils.d.ts +0 -0
  44. /package/dist/types/{test → src}/routing/types.test.d.ts +0 -0
  45. /package/dist/types/{test → src}/server/react-client/index.test.d.ts +0 -0
  46. /package/dist/types/{test → src}/server/react-server/index.test.d.ts +0 -0
  47. /package/dist/types/{test → src}/shared/NextIntlClientProvider.test.d.ts +0 -0
  48. /package/dist/types/{test → src}/shared/utils.test.d.ts +0 -0
@@ -2,6 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
+ var utils$1 = require('../shared/utils.js');
5
6
  var utils = require('./utils.js');
6
7
 
7
8
  /**
@@ -24,6 +25,7 @@ function getAlternateLinksHeaderValue(_ref) {
24
25
  normalizedUrl.protocol = (_request$headers$get = request.headers.get('x-forwarded-proto')) !== null && _request$headers$get !== void 0 ? _request$headers$get : normalizedUrl.protocol;
25
26
  normalizedUrl.pathname = utils.getNormalizedPathname(normalizedUrl.pathname, config.locales, config.localePrefix);
26
27
  function getAlternateEntry(url, locale) {
28
+ url.pathname = utils$1.normalizeTrailingSlash(url.pathname);
27
29
  if (request.nextUrl.basePath) {
28
30
  url = new URL(url);
29
31
  url.pathname = utils.applyBasePath(url.pathname, request.nextUrl.basePath);
@@ -38,7 +38,7 @@ function createMiddleware(input) {
38
38
  });
39
39
  }
40
40
  function redirect(url, redirectDomain) {
41
- const urlObj = new URL(utils.normalizeTrailingSlash(url), request.url);
41
+ const urlObj = new URL(utils$1.normalizeTrailingSlash(url), request.url);
42
42
  if (domainsConfig.length > 0 && !redirectDomain) {
43
43
  const bestMatchingDomain = utils.getBestMatchingDomain(domain, locale, domainsConfig);
44
44
  if (bestMatchingDomain) {
@@ -49,7 +49,11 @@ function formatTemplatePathname(sourcePathname, sourceTemplate, targetTemplate,
49
49
  const params = getRouteParams(sourceTemplate, sourcePathname);
50
50
  let targetPathname = '';
51
51
  targetPathname += formatPathnameTemplate(targetTemplate, params);
52
- targetPathname = normalizeTrailingSlash(targetPathname);
52
+
53
+ // A pathname with an optional catchall like `/categories/[[...slug]]`
54
+ // should be normalized to `/categories` if the catchall is not present
55
+ // and no trailing slash is configured
56
+ targetPathname = utils.normalizeTrailingSlash(targetPathname);
53
57
  return targetPathname;
54
58
  }
55
59
 
@@ -70,7 +74,7 @@ function getNormalizedPathname(pathname, locales, localePrefix) {
70
74
  const match = pathname.match(regex);
71
75
  let result = match ? '/' + match[2] : pathname;
72
76
  if (result !== '/') {
73
- result = normalizeTrailingSlash(result);
77
+ result = utils.normalizeTrailingSlash(result);
74
78
  }
75
79
  return result;
76
80
  }
@@ -102,13 +106,15 @@ function getPathnameMatch(pathname, locales, localePrefix) {
102
106
  }
103
107
  }
104
108
  function getRouteParams(template, pathname) {
105
- const regex = utils.templateToRegex(template);
106
- const match = regex.exec(pathname);
109
+ const normalizedPathname = utils.normalizeTrailingSlash(pathname);
110
+ const normalizedTemplate = utils.normalizeTrailingSlash(template);
111
+ const regex = utils.templateToRegex(normalizedTemplate);
112
+ const match = regex.exec(normalizedPathname);
107
113
  if (!match) return undefined;
108
114
  const params = {};
109
115
  for (let i = 1; i < match.length; i++) {
110
- var _template$match;
111
- const key = (_template$match = template.match(/\[([^\]]+)\]/g)) === null || _template$match === void 0 ? void 0 : _template$match[i - 1].replace(/[[\]]/g, '');
116
+ var _normalizedTemplate$m;
117
+ const key = (_normalizedTemplate$m = normalizedTemplate.match(/\[([^\]]+)\]/g)) === null || _normalizedTemplate$m === void 0 ? void 0 : _normalizedTemplate$m[i - 1].replace(/[[\]]/g, '');
112
118
  if (key) params[key] = match[i];
113
119
  }
114
120
  return params;
@@ -173,13 +179,7 @@ function getBestMatchingDomain(curHostDomain, locale, domainsConfig) {
173
179
  return domainConfig;
174
180
  }
175
181
  function applyBasePath(pathname, basePath) {
176
- return normalizeTrailingSlash(basePath + pathname);
177
- }
178
- function normalizeTrailingSlash(pathname) {
179
- if (pathname !== '/' && pathname.endsWith('/')) {
180
- pathname = pathname.slice(0, -1);
181
- }
182
- return pathname;
182
+ return utils.normalizeTrailingSlash(basePath + pathname);
183
183
  }
184
184
  function getLocaleAsPrefix(locale) {
185
185
  return "/".concat(locale);
@@ -198,4 +198,3 @@ exports.getNormalizedPathname = getNormalizedPathname;
198
198
  exports.getPathnameMatch = getPathnameMatch;
199
199
  exports.getRouteParams = getRouteParams;
200
200
  exports.isLocaleSupportedOnDomain = isLocaleSupportedOnDomain;
201
- exports.normalizeTrailingSlash = normalizeTrailingSlash;
@@ -8,7 +8,7 @@ var utils = require('../../shared/utils.js');
8
8
  function createRedirectFn(redirectFn) {
9
9
  return function baseRedirect(params) {
10
10
  const prefix = utils.getLocalePrefix(params.locale, params.localePrefix);
11
- const localizedPathname = params.localePrefix.mode === 'never' || !utils.isLocalHref(params.pathname) ? params.pathname : utils.prefixPathname(prefix, params.pathname);
11
+ const localizedPathname = params.localePrefix.mode === 'never' || !utils.isLocalizableHref(params.pathname) ? params.pathname : utils.prefixPathname(prefix, params.pathname);
12
12
  for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
13
13
  args[_key - 1] = arguments[_key];
14
14
  }
@@ -36,45 +36,49 @@ function resolveI18nPath(providedPath, cwd) {
36
36
  }
37
37
  function initPlugin(i18nPath, nextConfig) {
38
38
  if ((nextConfig === null || nextConfig === void 0 ? void 0 : nextConfig.i18n) != null) {
39
- 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://github.com/amannn/next-intl/tree/main/examples/example-app-router-migration\n");
39
+ 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");
40
40
  }
41
41
  const useTurbo = process.env.TURBOPACK != null;
42
- let nextIntlConfig;
42
+ const nextIntlConfig = {};
43
+
44
+ // Assign alias for `next-intl/config`
43
45
  if (useTurbo) {
44
46
  var _nextConfig$experimen, _nextConfig$experimen2;
45
47
  if (i18nPath && i18nPath.startsWith('/')) {
46
48
  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');
47
49
  }
48
- nextIntlConfig = {
49
- experimental: {
50
- ...(nextConfig === null || nextConfig === void 0 ? void 0 : nextConfig.experimental),
51
- turbo: {
52
- ...(nextConfig === null || nextConfig === void 0 || (_nextConfig$experimen = nextConfig.experimental) === null || _nextConfig$experimen === void 0 ? void 0 : _nextConfig$experimen.turbo),
53
- resolveAlias: {
54
- ...(nextConfig === null || nextConfig === void 0 || (_nextConfig$experimen2 = nextConfig.experimental) === null || _nextConfig$experimen2 === void 0 || (_nextConfig$experimen2 = _nextConfig$experimen2.turbo) === null || _nextConfig$experimen2 === void 0 ? void 0 : _nextConfig$experimen2.resolveAlias),
55
- // Turbo aliases don't work with absolute
56
- // paths (see error handling above)
57
- 'next-intl/config': resolveI18nPath(i18nPath)
58
- }
50
+ nextIntlConfig.experimental = {
51
+ ...(nextConfig === null || nextConfig === void 0 ? void 0 : nextConfig.experimental),
52
+ turbo: {
53
+ ...(nextConfig === null || nextConfig === void 0 || (_nextConfig$experimen = nextConfig.experimental) === null || _nextConfig$experimen === void 0 ? void 0 : _nextConfig$experimen.turbo),
54
+ resolveAlias: {
55
+ ...(nextConfig === null || nextConfig === void 0 || (_nextConfig$experimen2 = nextConfig.experimental) === null || _nextConfig$experimen2 === void 0 || (_nextConfig$experimen2 = _nextConfig$experimen2.turbo) === null || _nextConfig$experimen2 === void 0 ? void 0 : _nextConfig$experimen2.resolveAlias),
56
+ // Turbo aliases don't work with absolute
57
+ // paths (see error handling above)
58
+ 'next-intl/config': resolveI18nPath(i18nPath)
59
59
  }
60
60
  }
61
61
  };
62
62
  } else {
63
- nextIntlConfig = {
64
- webpack() {
65
- for (var _len = arguments.length, _ref = new Array(_len), _key = 0; _key < _len; _key++) {
66
- _ref[_key] = arguments[_key];
67
- }
68
- let [config, options] = _ref;
69
- // Webpack requires absolute paths
70
- config.resolve.alias['next-intl/config'] = path__default.default.resolve(config.context, resolveI18nPath(i18nPath, config.context));
71
- if (typeof (nextConfig === null || nextConfig === void 0 ? void 0 : nextConfig.webpack) === 'function') {
72
- return nextConfig.webpack(config, options);
73
- }
74
- return config;
63
+ nextIntlConfig.webpack = function webpack() {
64
+ for (var _len = arguments.length, _ref = new Array(_len), _key = 0; _key < _len; _key++) {
65
+ _ref[_key] = arguments[_key];
75
66
  }
67
+ let [config, options] = _ref;
68
+ // Webpack requires absolute paths
69
+ config.resolve.alias['next-intl/config'] = path__default.default.resolve(config.context, resolveI18nPath(i18nPath, config.context));
70
+ if (typeof (nextConfig === null || nextConfig === void 0 ? void 0 : nextConfig.webpack) === 'function') {
71
+ return nextConfig.webpack(config, options);
72
+ }
73
+ return config;
76
74
  };
77
75
  }
76
+
77
+ // Forward config
78
+ nextIntlConfig.env = {
79
+ ...(nextConfig === null || nextConfig === void 0 ? void 0 : nextConfig.env),
80
+ _next_intl_trailing_slash: nextConfig !== null && nextConfig !== void 0 && nextConfig.trailingSlash ? 'true' : undefined
81
+ };
78
82
  return Object.assign({}, nextConfig, nextIntlConfig);
79
83
  }
80
84
  module.exports = function createNextIntlPlugin(i18nPath) {
@@ -62,11 +62,33 @@ function prefixPathname(prefix, pathname) {
62
62
  function hasPathnamePrefixed(prefix, pathname) {
63
63
  return pathname === prefix || pathname.startsWith("".concat(prefix, "/"));
64
64
  }
65
+ function hasTrailingSlash() {
66
+ try {
67
+ // Provided via `env` setting in `next.config.js` via the plugin
68
+ return process.env._next_intl_trailing_slash === 'true';
69
+ } catch (e) {
70
+ return false;
71
+ }
72
+ }
73
+ function normalizeTrailingSlash(pathname) {
74
+ const trailingSlash = hasTrailingSlash();
75
+ if (pathname !== '/') {
76
+ const pathnameEndsWithSlash = pathname.endsWith('/');
77
+ if (trailingSlash && !pathnameEndsWithSlash) {
78
+ pathname += '/';
79
+ } else if (!trailingSlash && pathnameEndsWithSlash) {
80
+ pathname = pathname.slice(0, -1);
81
+ }
82
+ }
83
+ return pathname;
84
+ }
65
85
  function matchesPathname( /** E.g. `/users/[userId]-[userName]` */
66
86
  template, /** E.g. `/users/23-jane` */
67
87
  pathname) {
68
- const regex = templateToRegex(template);
69
- return regex.test(pathname);
88
+ const normalizedTemplate = normalizeTrailingSlash(template);
89
+ const normalizedPathname = normalizeTrailingSlash(pathname);
90
+ const regex = templateToRegex(normalizedTemplate);
91
+ return regex.test(normalizedPathname);
70
92
  }
71
93
  function getLocalePrefix(locale, localePrefix) {
72
94
  var _localePrefix$prefixe;
@@ -105,6 +127,7 @@ function comparePathnamePairs(a, b) {
105
127
  // If one of the paths ends, prioritize the shorter path
106
128
  if (!segmentA && segmentB) return -1;
107
129
  if (segmentA && !segmentB) return 1;
130
+ if (!segmentA && !segmentB) continue;
108
131
 
109
132
  // Prioritize static segments over dynamic segments
110
133
  if (!isDynamicSegment(segmentA) && isDynamicSegment(segmentB)) return -1;
@@ -134,11 +157,10 @@ function getSortedPathnames(pathnames) {
134
157
  exports.getLocalePrefix = getLocalePrefix;
135
158
  exports.getSortedPathnames = getSortedPathnames;
136
159
  exports.hasPathnamePrefixed = hasPathnamePrefixed;
137
- exports.isLocalHref = isLocalHref;
138
160
  exports.isLocalizableHref = isLocalizableHref;
139
- exports.isRelativeHref = isRelativeHref;
140
161
  exports.localizeHref = localizeHref;
141
162
  exports.matchesPathname = matchesPathname;
163
+ exports.normalizeTrailingSlash = normalizeTrailingSlash;
142
164
  exports.prefixHref = prefixHref;
143
165
  exports.prefixPathname = prefixPathname;
144
166
  exports.templateToRegex = templateToRegex;
@@ -1 +1 @@
1
- import{getHost as e,getNormalizedPathname as a,getLocalePrefixes as t,isLocaleSupportedOnDomain as o,applyBasePath as n,formatTemplatePathname as l}from"./utils.js";function r(r){var c;let{config:f,localizedPathnames:p,request:s,resolvedLocale:i}=r;const m=s.nextUrl.clone(),h=e(s.headers);function d(e,a){return s.nextUrl.basePath&&((e=new URL(e)).pathname=n(e.pathname,s.nextUrl.basePath)),"<".concat(e.toString(),'>; rel="alternate"; hreflang="').concat(a,'"')}function u(e,a){return p&&"object"==typeof p?l(e,p[i],p[a]):e}h&&(m.port="",m.host=h),m.protocol=null!==(c=s.headers.get("x-forwarded-proto"))&&void 0!==c?c:m.protocol,m.pathname=a(m.pathname,f.locales,f.localePrefix);const x=t(f.locales,f.localePrefix).flatMap((e=>{let a,[t,n]=e;function l(e){return"/"===e?n:n+e}if(f.domains){return(f.domains.filter((e=>o(t,e)))||[]).map((e=>(a=new URL(m),a.port="",a.host=e.domain,a.pathname=u(m.pathname,t),t===e.defaultLocale&&"always"!==f.localePrefix.mode||(a.pathname=l(a.pathname)),d(a,t))))}{let e;e=p&&"object"==typeof p?u(m.pathname,t):m.pathname,t===f.defaultLocale&&"always"!==f.localePrefix.mode||(e=l(e)),a=new URL(e,m)}return d(a,t)}));if(!f.domains&&("always"!==f.localePrefix.mode||"/"===m.pathname)){const e=new URL(u(m.pathname,f.defaultLocale),m);x.push(d(e,"x-default"))}return x.join(", ")}export{r 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{config:p,localizedPathnames:s,request:f,resolvedLocale:i}=c;const h=f.nextUrl.clone(),d=a(f.headers);function u(a,t){return a.pathname=e(a.pathname),f.nextUrl.basePath&&((a=new URL(a)).pathname=l(a.pathname,f.nextUrl.basePath)),"<".concat(a.toString(),'>; rel="alternate"; hreflang="').concat(t,'"')}function x(e,a){return s&&"object"==typeof s?r(e,s[i],s[a]):e}d&&(h.port="",h.host=d),h.protocol=null!==(m=f.headers.get("x-forwarded-proto"))&&void 0!==m?m:h.protocol,h.pathname=t(h.pathname,p.locales,p.localePrefix);const w=o(p.locales,p.localePrefix).flatMap((e=>{let a,[t,o]=e;function l(e){return"/"===e?o:o+e}if(p.domains){return(p.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"!==p.localePrefix.mode||(a.pathname=l(a.pathname)),u(a,t))))}{let e;e=s&&"object"==typeof s?x(h.pathname,t):h.pathname,t===p.defaultLocale&&"always"!==p.localePrefix.mode||(e=l(e)),a=new URL(e,h)}return u(a,t)}));if(!p.domains&&("always"!==p.localePrefix.mode||"/"===h.pathname)){const e=new URL(x(h.pathname,p.defaultLocale),h);w.push(u(e,"x-default"))}return w.join(", ")}export{c as default};
@@ -1 +1 @@
1
- import{NextResponse as e}from"next/server";import{HEADER_LOCALE_NAME as o}from"../shared/constants.js";import{matchesPathname as l,getLocalePrefix as r}from"../shared/utils.js";import{receiveConfig as t}from"./config.js";import a from"./getAlternateLinksHeaderValue.js";import n from"./resolveLocale.js";import s from"./syncCookie.js";import{isLocaleSupportedOnDomain as i,getNormalizedPathname as c,getPathnameMatch as d,getInternalTemplate as f,formatTemplatePathname as m,formatPathname as h,getBestMatchingDomain as x,applyBasePath as u,normalizeTrailingSlash as p,getLocaleAsPrefix as v}from"./utils.js";function U(U){const P=t(U);return function(t){var U;const g=decodeURI(t.nextUrl.pathname),{domain:L,locale:j}=n(P,t.headers,t.cookies,g),w=L?L.defaultLocale===j:j===P.defaultLocale,k=(null===(U=P.domains)||void 0===U?void 0:U.filter((e=>i(j,e))))||[],b=null!=P.domains&&!L;function y(l){const r=new URL(l,t.url);t.nextUrl.basePath&&(r.pathname=u(r.pathname,t.nextUrl.basePath));const a=new Headers(t.headers);return a.set(o,j),e.rewrite(r,{request:{headers:a}})}function R(o,l){const r=new URL(p(o),t.url);if(k.length>0&&!l){const e=x(L,j,k);e&&(l=e.domain,e.defaultLocale===j&&"as-needed"===P.localePrefix.mode&&(r.pathname=c(r.pathname,P.locales,P.localePrefix)))}var a,n;l&&(r.host=l,t.headers.get("x-forwarded-host")&&(r.protocol=null!==(a=t.headers.get("x-forwarded-proto"))&&void 0!==a?a:t.nextUrl.protocol,r.port=null!==(n=t.headers.get("x-forwarded-port"))&&void 0!==n?n:""));return t.nextUrl.basePath&&(r.pathname=u(r.pathname,t.nextUrl.basePath)),e.redirect(r.toString())}const q=c(g,P.locales,P.localePrefix),H=d(g,P.locales,P.localePrefix),z=null!=H,A="never"===P.localePrefix.mode||w&&"as-needed"===P.localePrefix.mode;let C,D,I=q;if(P.pathnames){let e;if([e,D]=f(P.pathnames,q,j),D){const o=P.pathnames[D],a="string"==typeof o?o:o[j];if(l(a,q))I=m(q,a,D);else{let l;l=e?"string"==typeof o?o:o[e]:D;const n=A?void 0:r(j,P.localePrefix),s=m(q,l,a);C=R(h(s,n,t.nextUrl.search))}}}if(!C)if("/"!==I||z){const e=h(I,v(j),t.nextUrl.search);if(z){const o=h(q,H.prefix,t.nextUrl.search);if("never"===P.localePrefix.mode)C=R(h(q,void 0,t.nextUrl.search));else if(H.exact)if(w&&A)C=R(h(q,void 0,t.nextUrl.search));else if(P.domains){const l=x(L,H.locale,k);C=(null==L?void 0:L.domain)===(null==l?void 0:l.domain)||b?y(e):R(o,null==l?void 0:l.domain)}else C=y(e);else C=R(o)}else C=A?y(e):R(h(q,r(j,P.localePrefix),t.nextUrl.search))}else C=A?y(h(I,v(j),t.nextUrl.search)):R(h(q,r(j,P.localePrefix),t.nextUrl.search));var S;(P.localeDetection&&s(t,C,j),"never"!==P.localePrefix.mode&&P.alternateLinks&&P.locales.length>1)&&C.headers.set("Link",a({config:P,localizedPathnames:null!=D?null===(S=P.pathnames)||void 0===S?void 0:S[D]:void 0,request:t,resolvedLocale:j}));return C}}export{U as default};
1
+ import{NextResponse as e}from"next/server";import{HEADER_LOCALE_NAME as o}from"../shared/constants.js";import{matchesPathname as l,normalizeTrailingSlash as r,getLocalePrefix as t}from"../shared/utils.js";import{receiveConfig as a}from"./config.js";import n from"./getAlternateLinksHeaderValue.js";import s from"./resolveLocale.js";import i from"./syncCookie.js";import{isLocaleSupportedOnDomain as c,getNormalizedPathname as d,getPathnameMatch as f,getInternalTemplate as m,formatTemplatePathname as h,formatPathname as x,getBestMatchingDomain as u,applyBasePath as p,getLocaleAsPrefix as v}from"./utils.js";function U(U){const P=a(U);return function(a){var U;const g=decodeURI(a.nextUrl.pathname),{domain:L,locale:j}=s(P,a.headers,a.cookies,g),w=L?L.defaultLocale===j:j===P.defaultLocale,k=(null===(U=P.domains)||void 0===U?void 0:U.filter((e=>c(j,e))))||[],b=null!=P.domains&&!L;function y(l){const r=new URL(l,a.url);a.nextUrl.basePath&&(r.pathname=p(r.pathname,a.nextUrl.basePath));const t=new Headers(a.headers);return t.set(o,j),e.rewrite(r,{request:{headers:t}})}function R(o,l){const t=new URL(r(o),a.url);if(k.length>0&&!l){const e=u(L,j,k);e&&(l=e.domain,e.defaultLocale===j&&"as-needed"===P.localePrefix.mode&&(t.pathname=d(t.pathname,P.locales,P.localePrefix)))}var n,s;l&&(t.host=l,a.headers.get("x-forwarded-host")&&(t.protocol=null!==(n=a.headers.get("x-forwarded-proto"))&&void 0!==n?n:a.nextUrl.protocol,t.port=null!==(s=a.headers.get("x-forwarded-port"))&&void 0!==s?s:""));return a.nextUrl.basePath&&(t.pathname=p(t.pathname,a.nextUrl.basePath)),e.redirect(t.toString())}const q=d(g,P.locales,P.localePrefix),H=f(g,P.locales,P.localePrefix),z=null!=H,A="never"===P.localePrefix.mode||w&&"as-needed"===P.localePrefix.mode;let C,D,I=q;if(P.pathnames){let e;if([e,D]=m(P.pathnames,q,j),D){const o=P.pathnames[D],r="string"==typeof o?o:o[j];if(l(r,q))I=h(q,r,D);else{let l;l=e?"string"==typeof o?o:o[e]:D;const n=A?void 0:t(j,P.localePrefix),s=h(q,l,r);C=R(x(s,n,a.nextUrl.search))}}}if(!C)if("/"!==I||z){const e=x(I,v(j),a.nextUrl.search);if(z){const o=x(q,H.prefix,a.nextUrl.search);if("never"===P.localePrefix.mode)C=R(x(q,void 0,a.nextUrl.search));else if(H.exact)if(w&&A)C=R(x(q,void 0,a.nextUrl.search));else if(P.domains){const l=u(L,H.locale,k);C=(null==L?void 0:L.domain)===(null==l?void 0:l.domain)||b?y(e):R(o,null==l?void 0:l.domain)}else C=y(e);else C=R(o)}else C=A?y(e):R(x(q,t(j,P.localePrefix),a.nextUrl.search))}else C=A?y(x(I,v(j),a.nextUrl.search)):R(x(q,t(j,P.localePrefix),a.nextUrl.search));var S;(P.localeDetection&&i(a,C,j),"never"!==P.localePrefix.mode&&P.alternateLinks&&P.locales.length>1)&&C.headers.set("Link",n({config:P,localizedPathnames:null!=D?null===(S=P.pathnames)||void 0===S?void 0:S[D]:void 0,request:a,resolvedLocale:j}));return C}}export{U as default};
@@ -1 +1 @@
1
- import{getSortedPathnames as t,matchesPathname as e,getLocalePrefix as n,templateToRegex as o,prefixPathname as r}from"../shared/utils.js";function c(n,o,r){const c=t(Object.keys(n));for(const t of c){const c=n[t];if("string"==typeof c){if(e(c,o))return[void 0,t]}else{const n=Object.entries(c),l=n.findIndex((t=>{let[e]=t;return e===r}));l>0&&n.unshift(n.splice(l,1)[0]);for(const[r,c]of n)if(e(c,o))return[r,t]}}for(const t of Object.keys(n))if(e(t,o))return[void 0,t];return[void 0,void 0]}function l(t,e,n,o){let r="";return r+=a(n,f(e,t)),r=x(r),r}function i(t,e,n){t.endsWith("/")||(t+="/");const o=u(e,n),r=new RegExp("^(".concat(o.map((t=>{let[,e]=t;return e.replaceAll("/","\\/")})).join("|"),")/(.*)"),"i"),c=t.match(r);let l=c?"/"+c[2]:t;return"/"!==l&&(l=x(l)),l}function u(t,e){return t.map((t=>[t,n(t,e)]))}function s(t,e,n){const o=u(e,n);for(const[e,n]of o){let o,r;if(t===n||t.startsWith(n+"/"))o=r=!0;else{const e=t.toLowerCase(),c=n.toLowerCase();(e===c||e.startsWith(c+"/"))&&(o=!1,r=!0)}if(r)return{locale:e,prefix:n,matchedPrefix:t.slice(0,n.length),exact:o}}}function f(t,e){const n=o(t).exec(e);if(!n)return;const r={};for(let e=1;e<n.length;e++){var c;const o=null===(c=t.match(/\[([^\]]+)\]/g))||void 0===c?void 0:c[e-1].replace(/[[\]]/g,"");o&&(r[o]=n[e])}return r}function a(t,e){if(!e)return t;let n=t=t.replace(/\[\[/g,"[").replace(/\]\]/g,"]");return Object.entries(e).forEach((t=>{let[e,o]=t;n=n.replace("[".concat(e,"]"),o)})),n}function d(t,e,n){let o=t;return e&&(o=r(e,o)),n&&(o+=n),o}function h(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 p(t,e){return e.defaultLocale===t||!e.locales||e.locales.includes(t)}function v(t,e,n){let o;return t&&p(e,t)&&(o=t),o||(o=n.find((t=>t.defaultLocale===e))),o||(o=n.find((t=>null!=t.locales&&t.locales.includes(e)))),o||null!=(null==t?void 0:t.locales)||(o=t),o||(o=n.find((t=>!t.locales))),o}function g(t,e){return x(e+t)}function x(t){return"/"!==t&&t.endsWith("/")&&(t=t.slice(0,-1)),t}function m(t){return"/".concat(t)}export{g as applyBasePath,d as formatPathname,a as formatPathnameTemplate,l as formatTemplatePathname,v as getBestMatchingDomain,h as getHost,c as getInternalTemplate,m as getLocaleAsPrefix,u as getLocalePrefixes,i as getNormalizedPathname,s as getPathnameMatch,f as getRouteParams,p as isLocaleSupportedOnDomain,x as normalizeTrailingSlash};
1
+ import{getSortedPathnames as t,matchesPathname as e,normalizeTrailingSlash as n,getLocalePrefix as o,templateToRegex as r,prefixPathname as c}from"../shared/utils.js";function l(n,o,r){const c=t(Object.keys(n));for(const t of c){const c=n[t];if("string"==typeof c){if(e(c,o))return[void 0,t]}else{const n=Object.entries(c),l=n.findIndex((t=>{let[e]=t;return e===r}));l>0&&n.unshift(n.splice(l,1)[0]);for(const[r,c]of n)if(e(c,o))return[r,t]}}for(const t of Object.keys(n))if(e(t,o))return[void 0,t];return[void 0,void 0]}function i(t,e,o,r){let c="";return c+=d(o,a(e,t)),c=n(c),c}function u(t,e,o){t.endsWith("/")||(t+="/");const r=f(e,o),c=new RegExp("^(".concat(r.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){return t.map((t=>[t,o(t,e)]))}function s(t,e,n){const o=f(e,n);for(const[e,n]of o){let o,r;if(t===n||t.startsWith(n+"/"))o=r=!0;else{const e=t.toLowerCase(),c=n.toLowerCase();(e===c||e.startsWith(c+"/"))&&(o=!1,r=!0)}if(r)return{locale:e,prefix:n,matchedPrefix:t.slice(0,n.length),exact:o}}}function a(t,e){const o=n(e),c=n(t),l=r(c).exec(o);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,o]=t;n=n.replace("[".concat(e,"]"),o)})),n}function h(t,e,n){let o=t;return e&&(o=c(e,o)),n&&(o+=n),o}function p(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 v(t,e){return e.defaultLocale===t||!e.locales||e.locales.includes(t)}function g(t,e,n){let o;return t&&v(e,t)&&(o=t),o||(o=n.find((t=>t.defaultLocale===e))),o||(o=n.find((t=>null!=t.locales&&t.locales.includes(e)))),o||null!=(null==t?void 0:t.locales)||(o=t),o||(o=n.find((t=>!t.locales))),o}function x(t,e){return n(e+t)}function m(t){return"/".concat(t)}export{x as applyBasePath,h as formatPathname,d as formatPathnameTemplate,i as formatTemplatePathname,g as getBestMatchingDomain,p as getHost,l as getInternalTemplate,m as getLocaleAsPrefix,f as getLocalePrefixes,u as getNormalizedPathname,s as getPathnameMatch,a as getRouteParams,v as isLocaleSupportedOnDomain};
@@ -1 +1 @@
1
- import{redirect as e,permanentRedirect as n}from"next/navigation";import{getLocalePrefix as r,isLocalHref as t,prefixPathname as o}from"../../shared/utils.js";function a(e){return function(n){const a=r(n.locale,n.localePrefix),i="never"!==n.localePrefix.mode&&t(n.pathname)?o(a,n.pathname):n.pathname;for(var l=arguments.length,m=new Array(l>1?l-1:0),c=1;c<l;c++)m[c-1]=arguments[c];return e(i,...m)}}const i=a(e),l=a(n);export{l as basePermanentRedirect,i as baseRedirect};
1
+ import{redirect as e,permanentRedirect as n}from"next/navigation";import{getLocalePrefix as r,isLocalizableHref as t,prefixPathname as o}from"../../shared/utils.js";function a(e){return function(n){const a=r(n.locale,n.localePrefix),i="never"!==n.localePrefix.mode&&t(n.pathname)?o(a,n.pathname):n.pathname;for(var l=arguments.length,m=new Array(l>1?l-1:0),c=1;c<l;c++)m[c-1]=arguments[c];return e(i,...m)}}const i=a(e),l=a(n);export{l as basePermanentRedirect,i as baseRedirect};
@@ -1 +1 @@
1
- import n from"fs";import e from"path";function t(t,o){function r(t){return n.existsSync(function(n){const t=[];return o&&t.push(o),t.push(n),e.resolve(...t)}(t))}if(t){if(!r(t))throw new Error("Could not find i18n config at ".concat(t,", please provide a valid path."));return t}for(const n of["./i18n.tsx","./i18n.ts","./i18n.js","./i18n.jsx","./src/i18n.tsx","./src/i18n.ts","./src/i18n.js","./src/i18n.jsx"])if(r(n))return n;throw new Error("\n\nCould not locate i18n config. Create one at `./(src/)i18n.{js,jsx,ts,tsx}` or specify a custom location:\n\nconst withNextIntl = require('next-intl/plugin')(\n './path/to/i18n.tsx'\n);\n\nmodule.exports = withNextIntl({\n // Other Next.js configuration ...\n});\n")}module.exports=function(n){return function(o){return function(n,o){let r;if(null!=(null==o?void 0:o.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://github.com/amannn/next-intl/tree/main/examples/example-app-router-migration\n"),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==o?void 0:o.experimental,turbo:{...null==o||null===(i=o.experimental)||void 0===i?void 0:i.turbo,resolveAlias:{...null==o||null===(s=o.experimental)||void 0===s||null===(s=s.turbo)||void 0===s?void 0:s.resolveAlias,"next-intl/config":t(n)}}}}}else r={webpack(){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,t(n,l.context)),"function"==typeof(null==o?void 0:o.webpack)?o.webpack(l,u):l}};return Object.assign({},o,r)}(n,o)}};
1
+ import n from"fs";import e from"path";function t(t,o){function r(t){return n.existsSync(function(n){const t=[];return o&&t.push(o),t.push(n),e.resolve(...t)}(t))}if(t){if(!r(t))throw new Error("Could not find i18n config at ".concat(t,", please provide a valid path."));return t}for(const n of["./i18n.tsx","./i18n.ts","./i18n.js","./i18n.jsx","./src/i18n.tsx","./src/i18n.ts","./src/i18n.js","./src/i18n.jsx"])if(r(n))return n;throw new Error("\n\nCould not locate i18n config. Create one at `./(src/)i18n.{js,jsx,ts,tsx}` or specify a custom location:\n\nconst withNextIntl = require('next-intl/plugin')(\n './path/to/i18n.tsx'\n);\n\nmodule.exports = withNextIntl({\n // Other Next.js configuration ...\n});\n")}module.exports=function(n){return function(o){return function(n,o){null!=(null==o?void 0:o.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==o?void 0:o.experimental,turbo:{...null==o||null===(i=o.experimental)||void 0===i?void 0:i.turbo,resolveAlias:{...null==o||null===(s=o.experimental)||void 0===s||null===(s=s.turbo)||void 0===s?void 0:s.resolveAlias,"next-intl/config":t(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,t(n,l.context)),"function"==typeof(null==o?void 0:o.webpack)?o.webpack(l,u):l};return r.env={...null==o?void 0:o.env,_next_intl_trailing_slash:null!=o&&o.trailingSlash?"true":void 0},Object.assign({},o,r)}(n,o)}};
@@ -1 +1 @@
1
- function n(n){const t="object"==typeof n?n.pathname:n;return null!=t&&!t.startsWith("/")}function t(n){if("object"==typeof n)return null==n.host&&null==n.hostname;return!/^[a-z]+:/i.test(n)}function e(e){return t(e)&&!n(e)}function r(n,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:t,i=arguments.length>3?arguments[3]:void 0,o=arguments.length>4?arguments[4]:void 0;if(!e(n))return n;const f=t!==r,l=c(o,i);return(f||l)&&null!=o?u(n,o):n}function u(n,t){let e;return"string"==typeof n?e=o(t,n):(e={...n},n.pathname&&(e.pathname=o(t,n.pathname))),e}function i(n,t){return n.replace(new RegExp("^".concat(t)),"")||"/"}function o(n,t){let e=n;return/^\/(\?.*)?$/.test(t)&&(t=t.slice(1)),e+=t,e}function c(n,t){return t===n||t.startsWith("".concat(n,"/"))}function f(n,t){return s(n).test(t)}function l(n,t){var e;return"never"!==t.mode&&(null===(e=t.prefixes)||void 0===e?void 0:e[n])||"/"+n}function s(n){const t=n.replace(/\[\[(\.\.\.[^\]]+)\]\]/g,"?(.*)").replace(/\[(\.\.\.[^\]]+)\]/g,"(.+)").replace(/\[([^\]]+)\]/g,"([^/]+)");return new RegExp("^".concat(t,"$"))}function a(n){return n.includes("[[...")}function p(n){return n.includes("[...")}function h(n){return n.includes("[")}function g(n,t){const e=n.split("/"),r=t.split("/"),u=Math.max(e.length,r.length);for(let n=0;n<u;n++){const t=e[n],u=r[n];if(!t&&u)return-1;if(t&&!u)return 1;if(!h(t)&&h(u))return-1;if(h(t)&&!h(u))return 1;if(!p(t)&&p(u))return-1;if(p(t)&&!p(u))return 1;if(!a(t)&&a(u))return-1;if(a(t)&&!a(u))return 1}return 0}function d(n){return n.sort(g)}export{l as getLocalePrefix,d as getSortedPathnames,c as hasPathnamePrefixed,t as isLocalHref,e as isLocalizableHref,n as isRelativeHref,r as localizeHref,f as matchesPathname,u as prefixHref,o as prefixPathname,s as templateToRegex,i as unprefixPathname};
1
+ function n(n){return function(n){return"object"==typeof n?null==n.host&&null==n.hostname:!/^[a-z]+:/i.test(n)}(n)&&!function(n){const t="object"==typeof n?n.pathname:n;return null!=t&&!t.startsWith("/")}(n)}function t(t,r){let u=arguments.length>2&&void 0!==arguments[2]?arguments[2]:r,c=arguments.length>3?arguments[3]:void 0,o=arguments.length>4?arguments[4]:void 0;if(!n(t))return t;const f=r!==u,l=i(o,c);return(f||l)&&null!=o?e(t,o):t}function e(n,t){let e;return"string"==typeof n?e=u(t,n):(e={...n},n.pathname&&(e.pathname=u(t,n.pathname))),e}function r(n,t){return n.replace(new RegExp("^".concat(t)),"")||"/"}function u(n,t){let e=n;return/^\/(\?.*)?$/.test(t)&&(t=t.slice(1)),e+=t,e}function i(n,t){return t===n||t.startsWith("".concat(n,"/"))}function c(n){const t=function(){try{return"true"===process.env._next_intl_trailing_slash}catch(n){return!1}}();if("/"!==n){const e=n.endsWith("/");t&&!e?n+="/":!t&&e&&(n=n.slice(0,-1))}return n}function o(n,t){const e=c(n),r=c(t);return l(e).test(r)}function f(n,t){var e;return"never"!==t.mode&&(null===(e=t.prefixes)||void 0===e?void 0:e[n])||"/"+n}function l(n){const t=n.replace(/\[\[(\.\.\.[^\]]+)\]\]/g,"?(.*)").replace(/\[(\.\.\.[^\]]+)\]/g,"(.+)").replace(/\[([^\]]+)\]/g,"([^/]+)");return new RegExp("^".concat(t,"$"))}function s(n){return n.includes("[[...")}function a(n){return n.includes("[...")}function p(n){return n.includes("[")}function h(n,t){const e=n.split("/"),r=t.split("/"),u=Math.max(e.length,r.length);for(let n=0;n<u;n++){const t=e[n],u=r[n];if(!t&&u)return-1;if(t&&!u)return 1;if(t||u){if(!p(t)&&p(u))return-1;if(p(t)&&!p(u))return 1;if(!a(t)&&a(u))return-1;if(a(t)&&!a(u))return 1;if(!s(t)&&s(u))return-1;if(s(t)&&!s(u))return 1}}return 0}function g(n){return n.sort(h)}export{f as getLocalePrefix,g as getSortedPathnames,i as hasPathnamePrefixed,n as isLocalizableHref,t as localizeHref,o as matchesPathname,c as normalizeTrailingSlash,e as prefixHref,u as prefixPathname,l as templateToRegex,r as unprefixPathname};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("./utils.js");exports.default=function(a){var t;let{config:o,localizedPathnames:n,request:l,resolvedLocale:r}=a;const c=l.nextUrl.clone(),s=e.getHost(l.headers);function p(a,t){return l.nextUrl.basePath&&((a=new URL(a)).pathname=e.applyBasePath(a.pathname,l.nextUrl.basePath)),"<".concat(a.toString(),'>; rel="alternate"; hreflang="').concat(t,'"')}function i(a,t){return n&&"object"==typeof n?e.formatTemplatePathname(a,n[r],n[t]):a}s&&(c.port="",c.host=s),c.protocol=null!==(t=l.headers.get("x-forwarded-proto"))&&void 0!==t?t:c.protocol,c.pathname=e.getNormalizedPathname(c.pathname,o.locales,o.localePrefix);const m=e.getLocalePrefixes(o.locales,o.localePrefix).flatMap((a=>{let t,[l,r]=a;function s(e){return"/"===e?r:r+e}if(o.domains){return(o.domains.filter((a=>e.isLocaleSupportedOnDomain(l,a)))||[]).map((e=>(t=new URL(c),t.port="",t.host=e.domain,t.pathname=i(c.pathname,l),l===e.defaultLocale&&"always"!==o.localePrefix.mode||(t.pathname=s(t.pathname)),p(t,l))))}{let e;e=n&&"object"==typeof n?i(c.pathname,l):c.pathname,l===o.defaultLocale&&"always"!==o.localePrefix.mode||(e=s(e)),t=new URL(e,c)}return p(t,l)}));if(!o.domains&&("always"!==o.localePrefix.mode||"/"===c.pathname)){const e=new URL(i(c.pathname,o.defaultLocale),c);m.push(p(e,"x-default"))}return m.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{config:n,localizedPathnames:l,request:r,resolvedLocale:s}=t;const i=r.nextUrl.clone(),c=a.getHost(r.headers);function p(t,o){return t.pathname=e.normalizeTrailingSlash(t.pathname),r.nextUrl.basePath&&((t=new URL(t)).pathname=a.applyBasePath(t.pathname,r.nextUrl.basePath)),"<".concat(t.toString(),'>; rel="alternate"; hreflang="').concat(o,'"')}function m(e,t){return l&&"object"==typeof l?a.formatTemplatePathname(e,l[s],l[t]):e}c&&(i.port="",i.host=c),i.protocol=null!==(o=r.headers.get("x-forwarded-proto"))&&void 0!==o?o:i.protocol,i.pathname=a.getNormalizedPathname(i.pathname,n.locales,n.localePrefix);const h=a.getLocalePrefixes(n.locales,n.localePrefix).flatMap((e=>{let t,[o,r]=e;function s(e){return"/"===e?r:r+e}if(n.domains){return(n.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"!==n.localePrefix.mode||(t.pathname=s(t.pathname)),p(t,o))))}{let e;e=l&&"object"==typeof l?m(i.pathname,o):i.pathname,o===n.defaultLocale&&"always"!==n.localePrefix.mode||(e=s(e)),t=new URL(e,i)}return p(t,o)}));if(!n.domains&&("always"!==n.localePrefix.mode||"/"===i.pathname)){const e=new URL(m(i.pathname,n.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("../shared/constants.js"),t=require("../shared/utils.js"),r=require("./config.js"),l=require("./getAlternateLinksHeaderValue.js"),o=require("./resolveLocale.js"),n=require("./syncCookie.js"),s=require("./utils.js");exports.default=function(i){const c=r.receiveConfig(i);return function(r){var i;const d=decodeURI(r.nextUrl.pathname),{domain:f,locale:m}=o.default(c,r.headers,r.cookies,d),h=f?f.defaultLocale===m:m===c.defaultLocale,u=(null===(i=c.domains)||void 0===i?void 0:i.filter((e=>s.isLocaleSupportedOnDomain(m,e))))||[],x=null!=c.domains&&!f;function P(t){const l=new URL(t,r.url);r.nextUrl.basePath&&(l.pathname=s.applyBasePath(l.pathname,r.nextUrl.basePath));const o=new Headers(r.headers);return o.set(a.HEADER_LOCALE_NAME,m),e.NextResponse.rewrite(l,{request:{headers:o}})}function p(a,t){const l=new URL(s.normalizeTrailingSlash(a),r.url);if(u.length>0&&!t){const e=s.getBestMatchingDomain(f,m,u);e&&(t=e.domain,e.defaultLocale===m&&"as-needed"===c.localePrefix.mode&&(l.pathname=s.getNormalizedPathname(l.pathname,c.locales,c.localePrefix)))}var o,n;t&&(l.host=t,r.headers.get("x-forwarded-host")&&(l.protocol=null!==(o=r.headers.get("x-forwarded-proto"))&&void 0!==o?o:r.nextUrl.protocol,l.port=null!==(n=r.headers.get("x-forwarded-port"))&&void 0!==n?n:""));return r.nextUrl.basePath&&(l.pathname=s.applyBasePath(l.pathname,r.nextUrl.basePath)),e.NextResponse.redirect(l.toString())}const g=s.getNormalizedPathname(d,c.locales,c.localePrefix),v=s.getPathnameMatch(d,c.locales,c.localePrefix),L=null!=v,U="never"===c.localePrefix.mode||h&&"as-needed"===c.localePrefix.mode;let q,j,w=g;if(c.pathnames){let e;if([e,j]=s.getInternalTemplate(c.pathnames,g,m),j){const a=c.pathnames[j],l="string"==typeof a?a:a[m];if(t.matchesPathname(l,g))w=s.formatTemplatePathname(g,l,j);else{let o;o=e?"string"==typeof a?a:a[e]:j;const n=U?void 0:t.getLocalePrefix(m,c.localePrefix),i=s.formatTemplatePathname(g,o,l);q=p(s.formatPathname(i,n,r.nextUrl.search))}}}if(!q)if("/"!==w||L){const e=s.formatPathname(w,s.getLocaleAsPrefix(m),r.nextUrl.search);if(L){const a=s.formatPathname(g,v.prefix,r.nextUrl.search);if("never"===c.localePrefix.mode)q=p(s.formatPathname(g,void 0,r.nextUrl.search));else if(v.exact)if(h&&U)q=p(s.formatPathname(g,void 0,r.nextUrl.search));else if(c.domains){const t=s.getBestMatchingDomain(f,v.locale,u);q=(null==f?void 0:f.domain)===(null==t?void 0:t.domain)||x?P(e):p(a,null==t?void 0:t.domain)}else q=P(e);else q=p(a)}else q=U?P(e):p(s.formatPathname(g,t.getLocalePrefix(m,c.localePrefix),r.nextUrl.search))}else q=U?P(s.formatPathname(w,s.getLocaleAsPrefix(m),r.nextUrl.search)):p(s.formatPathname(g,t.getLocalePrefix(m,c.localePrefix),r.nextUrl.search));var y;(c.localeDetection&&n.default(r,q,m),"never"!==c.localePrefix.mode&&c.alternateLinks&&c.locales.length>1)&&q.headers.set("Link",l.default({config:c,localizedPathnames:null!=j?null===(y=c.pathnames)||void 0===y?void 0:y[j]:void 0,request:r,resolvedLocale:m}));return q}};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("next/server"),a=require("../shared/constants.js"),t=require("../shared/utils.js"),r=require("./config.js"),l=require("./getAlternateLinksHeaderValue.js"),o=require("./resolveLocale.js"),n=require("./syncCookie.js"),s=require("./utils.js");exports.default=function(i){const c=r.receiveConfig(i);return function(r){var i;const d=decodeURI(r.nextUrl.pathname),{domain:f,locale:m}=o.default(c,r.headers,r.cookies,d),h=f?f.defaultLocale===m:m===c.defaultLocale,u=(null===(i=c.domains)||void 0===i?void 0:i.filter((e=>s.isLocaleSupportedOnDomain(m,e))))||[],x=null!=c.domains&&!f;function P(t){const l=new URL(t,r.url);r.nextUrl.basePath&&(l.pathname=s.applyBasePath(l.pathname,r.nextUrl.basePath));const o=new Headers(r.headers);return o.set(a.HEADER_LOCALE_NAME,m),e.NextResponse.rewrite(l,{request:{headers:o}})}function p(a,l){const o=new URL(t.normalizeTrailingSlash(a),r.url);if(u.length>0&&!l){const e=s.getBestMatchingDomain(f,m,u);e&&(l=e.domain,e.defaultLocale===m&&"as-needed"===c.localePrefix.mode&&(o.pathname=s.getNormalizedPathname(o.pathname,c.locales,c.localePrefix)))}var n,i;l&&(o.host=l,r.headers.get("x-forwarded-host")&&(o.protocol=null!==(n=r.headers.get("x-forwarded-proto"))&&void 0!==n?n:r.nextUrl.protocol,o.port=null!==(i=r.headers.get("x-forwarded-port"))&&void 0!==i?i:""));return r.nextUrl.basePath&&(o.pathname=s.applyBasePath(o.pathname,r.nextUrl.basePath)),e.NextResponse.redirect(o.toString())}const g=s.getNormalizedPathname(d,c.locales,c.localePrefix),v=s.getPathnameMatch(d,c.locales,c.localePrefix),L=null!=v,U="never"===c.localePrefix.mode||h&&"as-needed"===c.localePrefix.mode;let q,j,w=g;if(c.pathnames){let e;if([e,j]=s.getInternalTemplate(c.pathnames,g,m),j){const a=c.pathnames[j],l="string"==typeof a?a:a[m];if(t.matchesPathname(l,g))w=s.formatTemplatePathname(g,l,j);else{let o;o=e?"string"==typeof a?a:a[e]:j;const n=U?void 0:t.getLocalePrefix(m,c.localePrefix),i=s.formatTemplatePathname(g,o,l);q=p(s.formatPathname(i,n,r.nextUrl.search))}}}if(!q)if("/"!==w||L){const e=s.formatPathname(w,s.getLocaleAsPrefix(m),r.nextUrl.search);if(L){const a=s.formatPathname(g,v.prefix,r.nextUrl.search);if("never"===c.localePrefix.mode)q=p(s.formatPathname(g,void 0,r.nextUrl.search));else if(v.exact)if(h&&U)q=p(s.formatPathname(g,void 0,r.nextUrl.search));else if(c.domains){const t=s.getBestMatchingDomain(f,v.locale,u);q=(null==f?void 0:f.domain)===(null==t?void 0:t.domain)||x?P(e):p(a,null==t?void 0:t.domain)}else q=P(e);else q=p(a)}else q=U?P(e):p(s.formatPathname(g,t.getLocalePrefix(m,c.localePrefix),r.nextUrl.search))}else q=U?P(s.formatPathname(w,s.getLocaleAsPrefix(m),r.nextUrl.search)):p(s.formatPathname(g,t.getLocalePrefix(m,c.localePrefix),r.nextUrl.search));var y;(c.localeDetection&&n.default(r,q,m),"never"!==c.localePrefix.mode&&c.alternateLinks&&c.locales.length>1)&&q.headers.set("Link",l.default({config:c,localizedPathnames:null!=j?null===(y=c.pathnames)||void 0===y?void 0:y[j]:void 0,request:r,resolvedLocale:m}));return q}};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../shared/utils.js");function t(t,n){return t.map((t=>[t,e.getLocalePrefix(t,n)]))}function n(t,n){const o=e.templateToRegex(t).exec(n);if(!o)return;const r={};for(let e=1;e<o.length;e++){var a;const n=null===(a=t.match(/\[([^\]]+)\]/g))||void 0===a?void 0:a[e-1].replace(/[[\]]/g,"");n&&(r[n]=o[e])}return r}function o(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 r(e,t){return t.defaultLocale===e||!t.locales||t.locales.includes(e)}function a(e){return"/"!==e&&e.endsWith("/")&&(e=e.slice(0,-1)),e}exports.applyBasePath=function(e,t){return a(t+e)},exports.formatPathname=function(t,n,o){let r=t;return n&&(r=e.prefixPathname(n,r)),o&&(r+=o),r},exports.formatPathnameTemplate=o,exports.formatTemplatePathname=function(e,t,r,s){let c="";return c+=o(r,n(t,e)),c=a(c),c},exports.getBestMatchingDomain=function(e,t,n){let o;return e&&r(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},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,o){const r=e.getSortedPathnames(Object.keys(t));for(const a of r){const r=t[a];if("string"==typeof r){const t=r;if(e.matchesPathname(t,n))return[void 0,a]}else{const t=Object.entries(r),s=t.findIndex((e=>{let[t]=e;return t===o}));s>0&&t.unshift(t.splice(s,1)[0]);for(const[o,r]of t)if(e.matchesPathname(r,n))return[o,a]}}for(const o of Object.keys(t))if(e.matchesPathname(o,n))return[void 0,o];return[void 0,void 0]},exports.getLocaleAsPrefix=function(e){return"/".concat(e)},exports.getLocalePrefixes=t,exports.getNormalizedPathname=function(e,n,o){e.endsWith("/")||(e+="/");const r=t(n,o),s=new RegExp("^(".concat(r.map((e=>{let[,t]=e;return t.replaceAll("/","\\/")})).join("|"),")/(.*)"),"i"),c=e.match(s);let l=c?"/"+c[2]:e;return"/"!==l&&(l=a(l)),l},exports.getPathnameMatch=function(e,n,o){const r=t(n,o);for(const[t,n]of r){let o,r;if(e===n||e.startsWith(n+"/"))o=r=!0;else{const t=e.toLowerCase(),a=n.toLowerCase();(t===a||t.startsWith(a+"/"))&&(o=!1,r=!0)}if(r)return{locale:t,prefix:n,matchedPrefix:e.slice(0,n.length),exact:o}}},exports.getRouteParams=n,exports.isLocaleSupportedOnDomain=r,exports.normalizeTrailingSlash=a;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../shared/utils.js");function t(t,n){return t.map((t=>[t,e.getLocalePrefix(t,n)]))}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;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("next/navigation"),r=require("../../shared/utils.js");function t(e){return function(t){const a=r.getLocalePrefix(t.locale,t.localePrefix),n="never"!==t.localePrefix.mode&&r.isLocalHref(t.pathname)?r.prefixPathname(a,t.pathname):t.pathname;for(var i=arguments.length,o=new Array(i>1?i-1:0),c=1;c<i;c++)o[c-1]=arguments[c];return e(n,...o)}}const a=t(e.redirect),n=t(e.permanentRedirect);exports.basePermanentRedirect=n,exports.baseRedirect=a;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("next/navigation"),r=require("../../shared/utils.js");function t(e){return function(t){const a=r.getLocalePrefix(t.locale,t.localePrefix),n="never"!==t.localePrefix.mode&&r.isLocalizableHref(t.pathname)?r.prefixPathname(a,t.pathname):t.pathname;for(var i=arguments.length,o=new Array(i>1?i-1:0),c=1;c<i;c++)o[c-1]=arguments[c];return e(n,...o)}}const a=t(e.redirect),n=t(e.permanentRedirect);exports.basePermanentRedirect=n,exports.baseRedirect=a;
@@ -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,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["./i18n.tsx","./i18n.ts","./i18n.js","./i18n.jsx","./src/i18n.tsx","./src/i18n.ts","./src/i18n.js","./src/i18n.jsx"])if(t(n))return n;throw new Error("\n\nCould not locate i18n config. Create one at `./(src/)i18n.{js,jsx,ts,tsx}` or specify a custom location:\n\nconst withNextIntl = require('next-intl/plugin')(\n './path/to/i18n.tsx'\n);\n\nmodule.exports = withNextIntl({\n // Other Next.js configuration ...\n});\n")}module.exports=function(n){return function(e){return function(n,e){let t;if(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://github.com/amannn/next-intl/tree/main/examples/example-app-router-migration\n"),null!=process.env.TURBOPACK){var r,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");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===(s=e.experimental)||void 0===s||null===(s=s.turbo)||void 0===s?void 0:s.resolveAlias,"next-intl/config":i(n)}}}}}else t={webpack(){for(var t=arguments.length,r=new Array(t),s=0;s<t;s++)r[s]=arguments[s];let[l,u]=r;return l.resolve.alias["next-intl/config"]=o.default.resolve(l.context,i(n,l.context)),"function"==typeof(null==e?void 0:e.webpack)?e.webpack(l,u):l}};return 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,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("Could not find i18n config at ".concat(n,", please provide a valid path."));return n}for(const n of["./i18n.tsx","./i18n.ts","./i18n.js","./i18n.jsx","./src/i18n.tsx","./src/i18n.ts","./src/i18n.js","./src/i18n.jsx"])if(t(n))return n;throw new Error("\n\nCould not locate i18n config. Create one at `./(src/)i18n.{js,jsx,ts,tsx}` or specify a custom location:\n\nconst withNextIntl = require('next-intl/plugin')(\n './path/to/i18n.tsx'\n);\n\nmodule.exports = withNextIntl({\n // Other Next.js configuration ...\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 o,l;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===(o=e.experimental)||void 0===o?void 0:o.turbo,resolveAlias:{...null==e||null===(l=e.experimental)||void 0===l||null===(l=l.turbo)||void 0===l?void 0:l.resolveAlias,"next-intl/config":i(n)}}}}else t.webpack=function(){for(var t=arguments.length,o=new Array(t),l=0;l<t;l++)o[l]=arguments[l];let[s,u]=o;return s.resolve.alias["next-intl/config"]=r.default.resolve(s.context,i(n,s.context)),"function"==typeof(null==e?void 0:e.webpack)?e.webpack(s,u):s};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){const t="object"==typeof e?e.pathname:e;return null!=t&&!t.startsWith("/")}function t(e){if("object"==typeof e)return null==e.host&&null==e.hostname;return!/^[a-z]+:/i.test(e)}function n(n){return t(n)&&!e(n)}function r(e,t){let n;return"string"==typeof e?n=o(t,e):(n={...e},e.pathname&&(n.pathname=o(t,e.pathname))),n}function o(e,t){let n=e;return/^\/(\?.*)?$/.test(t)&&(t=t.slice(1)),n+=t,n}function i(e,t){return t===e||t.startsWith("".concat(e,"/"))}function u(e){const t=e.replace(/\[\[(\.\.\.[^\]]+)\]\]/g,"?(.*)").replace(/\[(\.\.\.[^\]]+)\]/g,"(.+)").replace(/\[([^\]]+)\]/g,"([^/]+)");return new RegExp("^".concat(t,"$"))}function s(e){return e.includes("[[...")}function c(e){return e.includes("[...")}function a(e){return e.includes("[")}function f(e,t){const n=e.split("/"),r=t.split("/"),o=Math.max(n.length,r.length);for(let e=0;e<o;e++){const t=n[e],o=r[e];if(!t&&o)return-1;if(t&&!o)return 1;if(!a(t)&&a(o))return-1;if(a(t)&&!a(o))return 1;if(!c(t)&&c(o))return-1;if(c(t)&&!c(o))return 1;if(!s(t)&&s(o))return-1;if(s(t)&&!s(o))return 1}return 0}Object.defineProperty(exports,"__esModule",{value:!0}),exports.getLocalePrefix=function(e,t){var n;return"never"!==t.mode&&(null===(n=t.prefixes)||void 0===n?void 0:n[e])||"/"+e},exports.getSortedPathnames=function(e){return e.sort(f)},exports.hasPathnamePrefixed=i,exports.isLocalHref=t,exports.isLocalizableHref=n,exports.isRelativeHref=e,exports.localizeHref=function(e,t){let o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:t,u=arguments.length>3?arguments[3]:void 0,s=arguments.length>4?arguments[4]:void 0;if(!n(e))return e;const c=t!==o,a=i(s,u);return(c||a)&&null!=s?r(e,s):e},exports.matchesPathname=function(e,t){return u(e).test(t)},exports.prefixHref=r,exports.prefixPathname=o,exports.templateToRegex=u,exports.unprefixPathname=function(e,t){return e.replace(new RegExp("^".concat(t)),"")||"/"};
1
+ "use strict";function t(t){return function(t){return"object"==typeof t?null==t.host&&null==t.hostname:!/^[a-z]+:/i.test(t)}(t)&&!function(t){const e="object"==typeof t?t.pathname:t;return null!=e&&!e.startsWith("/")}(t)}function e(t,e){let r;return"string"==typeof t?r=n(e,t):(r={...t},t.pathname&&(r.pathname=n(e,t.pathname))),r}function n(t,e){let n=t;return/^\/(\?.*)?$/.test(e)&&(e=e.slice(1)),n+=e,n}function r(t,e){return e===t||e.startsWith("".concat(t,"/"))}function o(t){const e=function(){try{return"true"===process.env._next_intl_trailing_slash}catch(t){return!1}}();if("/"!==t){const n=t.endsWith("/");e&&!n?t+="/":!e&&n&&(t=t.slice(0,-1))}return t}function i(t){const e=t.replace(/\[\[(\.\.\.[^\]]+)\]\]/g,"?(.*)").replace(/\[(\.\.\.[^\]]+)\]/g,"(.+)").replace(/\[([^\]]+)\]/g,"([^/]+)");return new RegExp("^".concat(e,"$"))}function u(t){return t.includes("[[...")}function c(t){return t.includes("[...")}function s(t){return t.includes("[")}function a(t,e){const n=t.split("/"),r=e.split("/"),o=Math.max(n.length,r.length);for(let t=0;t<o;t++){const e=n[t],o=r[t];if(!e&&o)return-1;if(e&&!o)return 1;if(e||o){if(!s(e)&&s(o))return-1;if(s(e)&&!s(o))return 1;if(!c(e)&&c(o))return-1;if(c(e)&&!c(o))return 1;if(!u(e)&&u(o))return-1;if(u(e)&&!u(o))return 1}}return 0}Object.defineProperty(exports,"__esModule",{value:!0}),exports.getLocalePrefix=function(t,e){var n;return"never"!==e.mode&&(null===(n=e.prefixes)||void 0===n?void 0:n[t])||"/"+t},exports.getSortedPathnames=function(t){return t.sort(a)},exports.hasPathnamePrefixed=r,exports.isLocalizableHref=t,exports.localizeHref=function(n,o){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:o,u=arguments.length>3?arguments[3]:void 0,c=arguments.length>4?arguments[4]:void 0;if(!t(n))return n;const s=o!==i,a=r(c,u);return(s||a)&&null!=c?e(n,c):n},exports.matchesPathname=function(t,e){const n=o(t),r=o(e);return i(n).test(r)},exports.normalizeTrailingSlash=o,exports.prefixHref=e,exports.prefixPathname=n,exports.templateToRegex=i,exports.unprefixPathname=function(t,e){return t.replace(new RegExp("^".concat(e)),"")||"/"};
@@ -21,5 +21,4 @@ export declare function getHost(requestHeaders: Headers): string | undefined;
21
21
  export declare function isLocaleSupportedOnDomain<AppLocales extends Locales>(locale: string, domain: DomainConfig<AppLocales>): boolean;
22
22
  export declare function getBestMatchingDomain<AppLocales extends Locales>(curHostDomain: DomainConfig<AppLocales> | undefined, locale: string, domainsConfig: DomainsConfig<AppLocales>): DomainConfig<AppLocales> | undefined;
23
23
  export declare function applyBasePath(pathname: string, basePath: string): string;
24
- export declare function normalizeTrailingSlash(pathname: string): string;
25
24
  export declare function getLocaleAsPrefix<AppLocales extends Locales>(locale: AppLocales[number]): string;
@@ -4,8 +4,6 @@ import NextLink from 'next/link';
4
4
  import { ComponentProps } from 'react';
5
5
  import { Locales, LocalePrefixConfigVerbose } from '../routing/types';
6
6
  type Href = ComponentProps<typeof NextLink>['href'];
7
- export declare function isRelativeHref(href: Href): boolean;
8
- export declare function isLocalHref(href: Href): boolean;
9
7
  export declare function isLocalizableHref(href: Href): boolean;
10
8
  export declare function localizeHref(href: string, locale: string, curLocale: string, curPathname: string, prefix: string): string;
11
9
  export declare function localizeHref(href: UrlObject | string, locale: string, curLocale: string, curPathname: string, prefix: string): UrlObject | string;
@@ -14,6 +12,7 @@ export declare function prefixHref(href: UrlObject | string, prefix: string): Ur
14
12
  export declare function unprefixPathname(pathname: string, prefix: string): string;
15
13
  export declare function prefixPathname(prefix: string, pathname: string): string;
16
14
  export declare function hasPathnamePrefixed(prefix: string, pathname: string): boolean;
15
+ export declare function normalizeTrailingSlash(pathname: string): string;
17
16
  export declare function matchesPathname(
18
17
  /** E.g. `/users/[userId]-[userName]` */
19
18
  template: string,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "next-intl",
3
- "version": "3.15.4",
3
+ "version": "3.15.6-canary.0",
4
4
  "sideEffects": false,
5
5
  "author": "Jan Amann <jan@amann.work>",
6
6
  "funding": [
@@ -87,7 +87,7 @@
87
87
  "dependencies": {
88
88
  "@formatjs/intl-localematcher": "^0.2.32",
89
89
  "negotiator": "^0.6.3",
90
- "use-intl": "^3.15.4"
90
+ "use-intl": "^3.15.6-canary.0"
91
91
  },
92
92
  "peerDependencies": {
93
93
  "next": "^10.0.0 || ^11.0.0 || ^12.0.0 || ^13.0.0 || ^14.0.0",
@@ -104,11 +104,11 @@
104
104
  },
105
105
  {
106
106
  "path": "dist/production/navigation.react-client.js",
107
- "limit": "3.355 KB"
107
+ "limit": "3.465 KB"
108
108
  },
109
109
  {
110
110
  "path": "dist/production/navigation.react-server.js",
111
- "limit": "17.975 KB"
111
+ "limit": "18.075 KB"
112
112
  },
113
113
  {
114
114
  "path": "dist/production/server.react-client.js",
@@ -120,12 +120,12 @@
120
120
  },
121
121
  {
122
122
  "path": "dist/production/middleware.js",
123
- "limit": "6.42 KB"
123
+ "limit": "6.485 KB"
124
124
  },
125
125
  {
126
126
  "path": "dist/production/routing.js",
127
127
  "limit": "0 KB"
128
128
  }
129
129
  ],
130
- "gitHead": "cb005a5680d06a6d78cef974b9b9e4deec3d2488"
130
+ "gitHead": "cfa1da34b64be5aedbb818f486b622e19b086fe5"
131
131
  }
File without changes