next-intl 3.15.0-custom-prefixes.0 → 3.15.1-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 (37) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +0 -6
  3. package/dist/development/_virtual/_rollupPluginBabelHelpers.js +6 -11
  4. package/dist/development/middleware/middleware.js +17 -26
  5. package/dist/development/middleware/syncCookie.js +19 -0
  6. package/dist/development/middleware/utils.js +0 -3
  7. package/dist/development/navigation/react-client/ClientLink.js +1 -2
  8. package/dist/development/navigation/react-client/useBasePathname.js +1 -1
  9. package/dist/development/navigation/shared/BaseLink.js +2 -3
  10. package/dist/development/navigation/shared/utils.js +1 -0
  11. package/dist/development/server/react-server/createRequestConfig.js +1 -1
  12. package/dist/development/server/react-server/getConfig.js +1 -2
  13. package/dist/development/server/react-server/getLocale.js +1 -2
  14. package/dist/development/server/react-server/getTranslations.js +2 -0
  15. package/dist/development/shared/NextIntlClientProvider.js +1 -1
  16. package/dist/esm/_virtual/_rollupPluginBabelHelpers.js +1 -1
  17. package/dist/esm/middleware/middleware.js +1 -1
  18. package/dist/esm/middleware/syncCookie.js +1 -0
  19. package/dist/esm/middleware/utils.js +1 -1
  20. package/dist/esm/navigation/react-client/ClientLink.js +1 -1
  21. package/dist/esm/navigation/react-client/useBasePathname.js +1 -1
  22. package/dist/esm/navigation/shared/BaseLink.js +2 -2
  23. package/dist/esm/server/react-server/getConfig.js +1 -1
  24. package/dist/esm/server/react-server/getLocale.js +1 -1
  25. package/dist/esm/shared/NextIntlClientProvider.js +1 -1
  26. package/dist/production/_virtual/_rollupPluginBabelHelpers.js +1 -1
  27. package/dist/production/middleware/middleware.js +1 -1
  28. package/dist/production/middleware/syncCookie.js +1 -0
  29. package/dist/production/middleware/utils.js +1 -1
  30. package/dist/production/navigation/react-client/ClientLink.js +1 -1
  31. package/dist/production/navigation/react-client/useBasePathname.js +1 -1
  32. package/dist/production/navigation/shared/BaseLink.js +2 -2
  33. package/dist/production/server/react-server/getConfig.js +1 -1
  34. package/dist/production/server/react-server/getLocale.js +1 -1
  35. package/dist/production/shared/NextIntlClientProvider.js +1 -1
  36. package/dist/types/src/middleware/syncCookie.d.ts +2 -0
  37. package/package.json +16 -37
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2020 Jan Amann
3
+ Copyright (c) 2024 Jan Amann
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -13,12 +13,6 @@
13
13
 
14
14
  > Internationalization (i18n) for Next.js
15
15
 
16
- <hr />
17
-
18
- 📣 [Support for the App Router and Server Components has arrived →](https://next-intl-docs.vercel.app/docs/getting-started/app-router)
19
-
20
- <hr />
21
-
22
16
  ## Features
23
17
 
24
18
  Internationalization (i18n) is an essential part of the user experience, therefore `next-intl` gives you all the parts you need to get language nuances right.
@@ -3,18 +3,13 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  function _extends() {
6
- _extends = Object.assign ? Object.assign.bind() : function (target) {
7
- for (var i = 1; i < arguments.length; i++) {
8
- var source = arguments[i];
9
- for (var key in source) {
10
- if (Object.prototype.hasOwnProperty.call(source, key)) {
11
- target[key] = source[key];
12
- }
13
- }
6
+ return _extends = Object.assign ? Object.assign.bind() : function (n) {
7
+ for (var e = 1; e < arguments.length; e++) {
8
+ var t = arguments[e];
9
+ for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
14
10
  }
15
- return target;
16
- };
17
- return _extends.apply(this, arguments);
11
+ return n;
12
+ }, _extends.apply(null, arguments);
18
13
  }
19
14
 
20
15
  exports.extends = _extends;
@@ -8,48 +8,43 @@ var utils$1 = require('../shared/utils.js');
8
8
  var config = require('./config.js');
9
9
  var getAlternateLinksHeaderValue = require('./getAlternateLinksHeaderValue.js');
10
10
  var resolveLocale = require('./resolveLocale.js');
11
+ var syncCookie = require('./syncCookie.js');
11
12
  var utils = require('./utils.js');
12
13
 
13
14
  function createMiddleware(input) {
14
15
  const config$1 = config.receiveConfig(input);
15
16
  return function middleware(request) {
16
- var _request$cookies$get, _config$domains;
17
+ var _config$domains;
17
18
  // Resolve potential foreign symbols (e.g. /ja/%E7%B4%84 → /ja/約))
18
19
  const externalPathname = decodeURI(request.nextUrl.pathname);
19
20
  const {
20
21
  domain,
21
22
  locale
22
23
  } = resolveLocale.default(config$1, request.headers, request.cookies, externalPathname);
23
- const hasOutdatedCookie = config$1.localeDetection && ((_request$cookies$get = request.cookies.get(constants.COOKIE_LOCALE_NAME)) === null || _request$cookies$get === void 0 ? void 0 : _request$cookies$get.value) !== locale;
24
24
  const hasMatchedDefaultLocale = domain ? domain.defaultLocale === locale : locale === config$1.defaultLocale;
25
25
  const domainConfigs = ((_config$domains = config$1.domains) === null || _config$domains === void 0 ? void 0 : _config$domains.filter(curDomain => utils.isLocaleSupportedOnDomain(locale, curDomain))) || [];
26
26
  const hasUnknownHost = config$1.domains != null && !domain;
27
- function getResponseInit() {
28
- const headers = new Headers(request.headers);
29
- headers.set(constants.HEADER_LOCALE_NAME, locale);
30
- return {
31
- request: {
32
- headers
33
- }
34
- };
35
- }
36
27
  function rewrite(url) {
37
28
  const urlObj = new URL(url, request.url);
38
29
  if (request.nextUrl.basePath) {
39
30
  urlObj.pathname = utils.applyBasePath(urlObj.pathname, request.nextUrl.basePath);
40
31
  }
41
- return server.NextResponse.rewrite(urlObj, getResponseInit());
32
+ const headers = new Headers(request.headers);
33
+ headers.set(constants.HEADER_LOCALE_NAME, locale);
34
+ return server.NextResponse.rewrite(urlObj, {
35
+ request: {
36
+ headers
37
+ }
38
+ });
42
39
  }
43
40
  function redirect(url, redirectDomain) {
44
41
  const urlObj = new URL(utils.normalizeTrailingSlash(url), request.url);
45
- if (domainConfigs.length > 0) {
46
- if (!redirectDomain) {
47
- const bestMatchingDomain = utils.getBestMatchingDomain(domain, locale, domainConfigs);
48
- if (bestMatchingDomain) {
49
- redirectDomain = bestMatchingDomain.domain;
50
- if (bestMatchingDomain.defaultLocale === locale && config$1.localePrefix.mode === 'as-needed' && urlObj.pathname.startsWith(utils$1.getLocalePrefix(locale, config$1.localePrefix))) {
51
- urlObj.pathname = utils.getNormalizedPathname(urlObj.pathname, config$1.locales, config$1.localePrefix);
52
- }
42
+ if (domainConfigs.length > 0 && !redirectDomain) {
43
+ const bestMatchingDomain = utils.getBestMatchingDomain(domain, locale, domainConfigs);
44
+ if (bestMatchingDomain) {
45
+ redirectDomain = bestMatchingDomain.domain;
46
+ if (bestMatchingDomain.defaultLocale === locale && config$1.localePrefix.mode === 'as-needed') {
47
+ urlObj.pathname = utils.getNormalizedPathname(urlObj.pathname, config$1.locales, config$1.localePrefix);
53
48
  }
54
49
  }
55
50
  }
@@ -141,12 +136,8 @@ function createMiddleware(input) {
141
136
  }
142
137
  }
143
138
  }
144
- if (hasOutdatedCookie) {
145
- response.cookies.set(constants.COOKIE_LOCALE_NAME, locale, {
146
- path: request.nextUrl.basePath || undefined,
147
- sameSite: constants.COOKIE_SAME_SITE,
148
- maxAge: constants.COOKIE_MAX_AGE
149
- });
139
+ if (config$1.localeDetection) {
140
+ syncCookie.default(request, response, locale);
150
141
  }
151
142
  if (config$1.localePrefix.mode !== 'never' && config$1.alternateLinks && config$1.locales.length > 1) {
152
143
  var _config$pathnames;
@@ -0,0 +1,19 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var constants = require('../shared/constants.js');
6
+
7
+ function syncCookie(request, response, locale) {
8
+ var _request$cookies$get;
9
+ const hasOutdatedCookie = ((_request$cookies$get = request.cookies.get(constants.COOKIE_LOCALE_NAME)) === null || _request$cookies$get === void 0 ? void 0 : _request$cookies$get.value) !== locale;
10
+ if (hasOutdatedCookie) {
11
+ response.cookies.set(constants.COOKIE_LOCALE_NAME, locale, {
12
+ path: request.nextUrl.basePath || undefined,
13
+ sameSite: constants.COOKIE_SAME_SITE,
14
+ maxAge: constants.COOKIE_MAX_AGE
15
+ });
16
+ }
17
+ }
18
+
19
+ exports.default = syncCookie;
@@ -94,9 +94,6 @@ function getInternalTemplate(pathnames, pathname, locale) {
94
94
  function formatTemplatePathname(sourcePathname, sourceTemplate, targetTemplate, prefix) {
95
95
  const params = getRouteParams(sourceTemplate, sourcePathname);
96
96
  let targetPathname = '';
97
- if (prefix) {
98
- targetPathname = "/".concat(prefix);
99
- }
100
97
  targetPathname += formatPathnameTemplate(targetTemplate, params);
101
98
  targetPathname = normalizeTrailingSlash(targetPathname);
102
99
  return targetPathname;
@@ -51,6 +51,5 @@ function ClientLink(_ref, ref) {
51
51
  */
52
52
  const ClientLinkWithRef = /*#__PURE__*/React.forwardRef(ClientLink);
53
53
  ClientLinkWithRef.displayName = 'ClientLink';
54
- var ClientLink$1 = ClientLinkWithRef;
55
54
 
56
- exports.default = ClientLink$1;
55
+ exports.default = ClientLinkWithRef;
@@ -1,4 +1,4 @@
1
- 'use client';
1
+ "use client";
2
2
  'use strict';
3
3
 
4
4
  Object.defineProperty(exports, '__esModule', { value: true });
@@ -1,4 +1,4 @@
1
- 'use client';
1
+ "use client";
2
2
  'use strict';
3
3
 
4
4
  Object.defineProperty(exports, '__esModule', { value: true });
@@ -67,6 +67,5 @@ function BaseLink(_ref, ref) {
67
67
  }
68
68
  const BaseLinkWithRef = /*#__PURE__*/React.forwardRef(BaseLink);
69
69
  BaseLinkWithRef.displayName = 'ClientLink';
70
- var BaseLink$1 = BaseLinkWithRef;
71
70
 
72
- exports.default = BaseLink$1;
71
+ exports.default = BaseLinkWithRef;
@@ -6,6 +6,7 @@ var utils = require('../../shared/utils.js');
6
6
 
7
7
  // Minor false positive: A route that has both optional and
8
8
  // required params will allow optional params.
9
+
9
10
  function normalizeNameOrNameWithParams(href) {
10
11
  // @ts-expect-error -- `extends string` in the generic unfortunately weakens the type
11
12
  return typeof href === 'string' ? {
@@ -10,7 +10,7 @@ var getRuntimeConfig__default = /*#__PURE__*/_interopDefault(getRuntimeConfig);
10
10
 
11
11
  // eslint-disable-next-line import/no-extraneous-dependencies
12
12
 
13
- Object.defineProperty(exports, 'default', {
13
+ Object.defineProperty(exports, "default", {
14
14
  enumerable: true,
15
15
  get: function () { return getRuntimeConfig__default.default; }
16
16
  });
@@ -55,6 +55,5 @@ async function getConfigImpl(localeOverride) {
55
55
  return core.initializeConfig(runtimeConfig);
56
56
  }
57
57
  const getConfig = React.cache(getConfigImpl);
58
- var getConfig$1 = getConfig;
59
58
 
60
- exports.default = getConfig$1;
59
+ exports.default = getConfig;
@@ -10,6 +10,5 @@ async function getLocaleCachedImpl() {
10
10
  return Promise.resolve(config.locale);
11
11
  }
12
12
  const getLocaleCached = React.cache(getLocaleCachedImpl);
13
- var getLocale = getLocaleCached;
14
13
 
15
- exports.default = getLocale;
14
+ exports.default = getLocaleCached;
@@ -12,7 +12,9 @@ var getConfig = require('./getConfig.js');
12
12
  // messes up the return type.
13
13
 
14
14
  // CALL SIGNATURE 1: `getTranslations(namespace)`
15
+
15
16
  // CALL SIGNATURE 2: `getTranslations({locale, namespace})`
17
+
16
18
  // IMPLEMENTATION
17
19
  async function getTranslations(namespaceOrOpts) {
18
20
  let namespace;
@@ -1,4 +1,4 @@
1
- 'use client';
1
+ "use client";
2
2
  'use strict';
3
3
 
4
4
  Object.defineProperty(exports, '__esModule', { value: true });
@@ -1 +1 @@
1
- function t(){return t=Object.assign?Object.assign.bind():function(t){for(var n=1;n<arguments.length;n++){var r=arguments[n];for(var e in r)Object.prototype.hasOwnProperty.call(r,e)&&(t[e]=r[e])}return t},t.apply(this,arguments)}export{t as extends};
1
+ function n(){return n=Object.assign?Object.assign.bind():function(n){for(var r=1;r<arguments.length;r++){var t=arguments[r];for(var a in t)({}).hasOwnProperty.call(t,a)&&(n[a]=t[a])}return n},n.apply(null,arguments)}export{n as extends};
@@ -1 +1 @@
1
- import{NextResponse as e}from"next/server";import{COOKIE_LOCALE_NAME as o,COOKIE_SAME_SITE as t,COOKIE_MAX_AGE as a,HEADER_LOCALE_NAME as l}from"../shared/constants.js";import{matchesPathname as r,getLocalePrefix as n}from"../shared/utils.js";import{receiveConfig as s}from"./config.js";import i from"./getAlternateLinksHeaderValue.js";import c from"./resolveLocale.js";import{isLocaleSupportedOnDomain as d,getNormalizedPathname as f,getPathnameMatch as m,getInternalTemplate as h,formatTemplatePathname as x,formatPathname as u,getBestMatchingDomain as p,applyBasePath as v,normalizeTrailingSlash as P,getLocaleAsPrefix as U}from"./utils.js";function g(g){const L=s(g);return function(s){var g,w;const j=decodeURI(s.nextUrl.pathname),{domain:k,locale:b}=c(L,s.headers,s.cookies,j),R=L.localeDetection&&(null===(g=s.cookies.get(o))||void 0===g?void 0:g.value)!==b,q=k?k.defaultLocale===b:b===L.defaultLocale,y=(null===(w=L.domains)||void 0===w?void 0:w.filter((e=>d(b,e))))||[],A=null!=L.domains&&!k;function H(o){const t=new URL(o,s.url);return s.nextUrl.basePath&&(t.pathname=v(t.pathname,s.nextUrl.basePath)),e.rewrite(t,function(){const e=new Headers(s.headers);return e.set(l,b),{request:{headers:e}}}())}function S(o,t){const a=new URL(P(o),s.url);if(y.length>0&&!t){const e=p(k,b,y);e&&(t=e.domain,e.defaultLocale===b&&"as-needed"===L.localePrefix.mode&&a.pathname.startsWith(n(b,L.localePrefix))&&(a.pathname=f(a.pathname,L.locales,L.localePrefix)))}var l,r;t&&(a.host=t,s.headers.get("x-forwarded-host")&&(a.protocol=null!==(l=s.headers.get("x-forwarded-proto"))&&void 0!==l?l:s.nextUrl.protocol,a.port=null!==(r=s.headers.get("x-forwarded-port"))&&void 0!==r?r:""));return s.nextUrl.basePath&&(a.pathname=v(a.pathname,s.nextUrl.basePath)),e.redirect(a.toString())}const z=f(j,L.locales,L.localePrefix),D=m(j,L.locales,L.localePrefix),I=null!=D,V="never"===L.localePrefix.mode||q&&"as-needed"===L.localePrefix.mode;let W,B,C=z;if(L.pathnames){let e;if([e,B]=h(L.pathnames,z,b),B){const o=L.pathnames[B],t="string"==typeof o?o:o[b];if(r(t,z))C=x(z,t,B);else{let a;a=e?"string"==typeof o?o:o[e]:B;const l=V?void 0:n(b,L.localePrefix),r=x(z,a,t);W=S(u(r,l,s.nextUrl.search))}}}if(!W)if("/"!==C||I){const e=u(C,U(b),s.nextUrl.search);if(I){const o=u(z,D.prefix,s.nextUrl.search);if("never"===L.localePrefix.mode)W=S(u(z,void 0,s.nextUrl.search));else if(D.exact)if(q&&V)W=S(u(z,void 0,s.nextUrl.search));else if(L.domains){const t=p(k,D.locale,y);W=(null==k?void 0:k.domain)===(null==t?void 0:t.domain)||A?H(e):S(o,null==t?void 0:t.domain)}else W=H(e);else W=S(o)}else W=V?H(e):S(u(z,n(b,L.localePrefix),s.nextUrl.search))}else W=V?H(u(C,U(b),s.nextUrl.search)):S(u(z,n(b,L.localePrefix),s.nextUrl.search));var E;(R&&W.cookies.set(o,b,{path:s.nextUrl.basePath||void 0,sameSite:t,maxAge:a}),"never"!==L.localePrefix.mode&&L.alternateLinks&&L.locales.length>1)&&W.headers.set("Link",i({config:L,localizedPathnames:null!=B?null===(E=L.pathnames)||void 0===E?void 0:E[B]:void 0,request:s,resolvedLocale:b}));return W}}export{g as default};
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};
@@ -0,0 +1 @@
1
+ import{COOKIE_LOCALE_NAME as e,COOKIE_SAME_SITE as o,COOKIE_MAX_AGE as t}from"../shared/constants.js";function a(a,s,i){var n;(null===(n=a.cookies.get(e))||void 0===n?void 0:n.value)!==i&&s.cookies.set(e,i,{path:a.nextUrl.basePath||void 0,sameSite:o,maxAge:t})}export{a as default};
@@ -1 +1 @@
1
- import{matchesPathname as t,getLocalePrefix as n,templateToRegex as e,prefixPathname as r}from"../shared/utils.js";function o(t){return t.includes("[[...")}function c(t){return t.includes("[...")}function i(t){return t.includes("[")}function u(t,n){const e=t.split("/"),r=n.split("/"),u=Math.max(e.length,r.length);for(let t=0;t<u;t++){const n=e[t],u=r[t];if(!n&&u)return-1;if(n&&!u)return 1;if(!i(n)&&i(u))return-1;if(i(n)&&!i(u))return 1;if(!c(n)&&c(u))return-1;if(c(n)&&!c(u))return 1;if(!o(n)&&o(u))return-1;if(o(n)&&!o(u))return 1}return 0}function l(t){return t.sort(u)}function f(n,e,r){const o=l(Object.keys(n));for(const c of o){const o=n[c];if("string"==typeof o){if(t(o,e))return[void 0,c]}else{const n=Object.entries(o),i=n.findIndex((t=>{let[n]=t;return n===r}));i>0&&n.unshift(n.splice(i,1)[0]);for(const[r,o]of n)if(t(o,e))return[r,c]}}for(const r of Object.keys(n))if(t(r,e))return[void 0,r];return[void 0,void 0]}function s(t,n,e,r){const o=p(n,t);let c="";return r&&(c="/".concat(r)),c+=g(e,o),c=w(c),c}function a(t,n,e){t.endsWith("/")||(t+="/");const r=d(n,e),o=new RegExp("^(".concat(r.map((t=>{let[,n]=t;return n.replaceAll("/","\\/")})).join("|"),")/(.*)"),"i"),c=t.match(o);let i=c?"/"+c[2]:t;return"/"!==i&&(i=w(i)),i}function d(t,e){return t.map((t=>[t,n(t,e)]))}function h(t,n,e){const r=d(n,e);for(const[n,e]of r){let r,o;if(t===e||t.startsWith(e+"/"))r=o=!0;else{const n=t.toLowerCase(),c=e.toLowerCase();(n===c||n.startsWith(c+"/"))&&(r=!1,o=!0)}if(o)return{locale:n,prefix:e,matchedPrefix:t.slice(0,e.length),exact:r}}}function p(t,n){const r=e(t).exec(n);if(!r)return;const o={};for(let n=1;n<r.length;n++){var c;const e=null===(c=t.match(/\[([^\]]+)\]/g))||void 0===c?void 0:c[n-1].replace(/[[\]]/g,"");e&&(o[e]=r[n])}return o}function g(t,n){if(!n)return t;let e=t=t.replace(/\[\[/g,"[").replace(/\]\]/g,"]");return Object.entries(n).forEach((t=>{let[n,r]=t;e=e.replace("[".concat(n,"]"),r)})),e}function v(t,n,e){let o=t;return n&&(o=r(n,o)),e&&(o+=e),o}function x(t){var n,e;return null!==(n=null!==(e=t.get("x-forwarded-host"))&&void 0!==e?e:t.get("host"))&&void 0!==n?n:void 0}function m(t,n){return n.defaultLocale===t||!n.locales||n.locales.includes(t)}function j(t,n,e){let r;return t&&m(n,t)&&(r=t),r||(r=e.find((t=>t.defaultLocale===n))),r||(r=e.find((t=>null!=t.locales&&t.locales.includes(n)))),r||null!=(null==t?void 0:t.locales)||(r=t),r||(r=e.find((t=>!t.locales))),r}function b(t,n){return w(n+t)}function w(t){return"/"!==t&&t.endsWith("/")&&(t=t.slice(0,-1)),t}function L(t){return"/".concat(t)}export{b as applyBasePath,u as comparePathnamePairs,v as formatPathname,g as formatPathnameTemplate,s as formatTemplatePathname,j as getBestMatchingDomain,x as getHost,f as getInternalTemplate,L as getLocaleAsPrefix,d as getLocalePrefixes,a as getNormalizedPathname,h as getPathnameMatch,p as getRouteParams,l as getSortedPathnames,m as isLocaleSupportedOnDomain,w as normalizeTrailingSlash};
1
+ import{matchesPathname as t,getLocalePrefix as n,templateToRegex as e,prefixPathname as r}from"../shared/utils.js";function o(t){return t.includes("[[...")}function i(t){return t.includes("[...")}function c(t){return t.includes("[")}function u(t,n){const e=t.split("/"),r=n.split("/"),u=Math.max(e.length,r.length);for(let t=0;t<u;t++){const n=e[t],u=r[t];if(!n&&u)return-1;if(n&&!u)return 1;if(!c(n)&&c(u))return-1;if(c(n)&&!c(u))return 1;if(!i(n)&&i(u))return-1;if(i(n)&&!i(u))return 1;if(!o(n)&&o(u))return-1;if(o(n)&&!o(u))return 1}return 0}function l(t){return t.sort(u)}function f(n,e,r){const o=l(Object.keys(n));for(const i of o){const o=n[i];if("string"==typeof o){if(t(o,e))return[void 0,i]}else{const n=Object.entries(o),c=n.findIndex((t=>{let[n]=t;return n===r}));c>0&&n.unshift(n.splice(c,1)[0]);for(const[r,o]of n)if(t(o,e))return[r,i]}}for(const r of Object.keys(n))if(t(r,e))return[void 0,r];return[void 0,void 0]}function s(t,n,e,r){let o="";return o+=g(e,p(n,t)),o=w(o),o}function a(t,n,e){t.endsWith("/")||(t+="/");const r=d(n,e),o=new RegExp("^(".concat(r.map((t=>{let[,n]=t;return n.replaceAll("/","\\/")})).join("|"),")/(.*)"),"i"),i=t.match(o);let c=i?"/"+i[2]:t;return"/"!==c&&(c=w(c)),c}function d(t,e){return t.map((t=>[t,n(t,e)]))}function h(t,n,e){const r=d(n,e);for(const[n,e]of r){let r,o;if(t===e||t.startsWith(e+"/"))r=o=!0;else{const n=t.toLowerCase(),i=e.toLowerCase();(n===i||n.startsWith(i+"/"))&&(r=!1,o=!0)}if(o)return{locale:n,prefix:e,matchedPrefix:t.slice(0,e.length),exact:r}}}function p(t,n){const r=e(t).exec(n);if(!r)return;const o={};for(let n=1;n<r.length;n++){var i;const e=null===(i=t.match(/\[([^\]]+)\]/g))||void 0===i?void 0:i[n-1].replace(/[[\]]/g,"");e&&(o[e]=r[n])}return o}function g(t,n){if(!n)return t;let e=t=t.replace(/\[\[/g,"[").replace(/\]\]/g,"]");return Object.entries(n).forEach((t=>{let[n,r]=t;e=e.replace("[".concat(n,"]"),r)})),e}function v(t,n,e){let o=t;return n&&(o=r(n,o)),e&&(o+=e),o}function x(t){var n,e;return null!==(n=null!==(e=t.get("x-forwarded-host"))&&void 0!==e?e:t.get("host"))&&void 0!==n?n:void 0}function m(t,n){return n.defaultLocale===t||!n.locales||n.locales.includes(t)}function j(t,n,e){let r;return t&&m(n,t)&&(r=t),r||(r=e.find((t=>t.defaultLocale===n))),r||(r=e.find((t=>null!=t.locales&&t.locales.includes(n)))),r||null!=(null==t?void 0:t.locales)||(r=t),r||(r=e.find((t=>!t.locales))),r}function b(t,n){return w(n+t)}function w(t){return"/"!==t&&t.endsWith("/")&&(t=t.slice(0,-1)),t}function L(t){return"/".concat(t)}export{b as applyBasePath,u as comparePathnamePairs,v as formatPathname,g as formatPathnameTemplate,s as formatTemplatePathname,j as getBestMatchingDomain,x as getHost,f as getInternalTemplate,L as getLocaleAsPrefix,d as getLocalePrefixes,a as getNormalizedPathname,h as getPathnameMatch,p as getRouteParams,l as getSortedPathnames,m as isLocaleSupportedOnDomain,w as normalizeTrailingSlash};
@@ -1 +1 @@
1
- import{extends as e}from"../../_virtual/_rollupPluginBabelHelpers.js";import r,{forwardRef as l}from"react";import o from"../../react-client/useLocale.js";import{getLocalePrefix as t}from"../../shared/utils.js";import a from"../shared/BaseLink.js";function i(l,i){let{locale:s,localePrefix:m,...c}=l;const n=o(),f=s||n,p=t(f,m);return r.createElement(a,e({ref:i,locale:f,localePrefixMode:m.mode,prefix:p},c))}const s=l(i);s.displayName="ClientLink";var m=s;export{m as default};
1
+ import{extends as e}from"../../_virtual/_rollupPluginBabelHelpers.js";import r,{forwardRef as l}from"react";import o from"../../react-client/useLocale.js";import{getLocalePrefix as t}from"../../shared/utils.js";import a from"../shared/BaseLink.js";function i(l,i){let{locale:s,localePrefix:m,...c}=l;const n=o(),f=s||n,p=t(f,m);return r.createElement(a,e({ref:i,locale:f,localePrefixMode:m.mode,prefix:p},c))}const s=l(i);s.displayName="ClientLink";export{s as default};
@@ -1,2 +1,2 @@
1
- 'use client';
1
+ "use client";
2
2
  import{usePathname as r}from"next/navigation";import{useMemo as t}from"react";import o from"../../react-client/useLocale.js";import{hasPathnamePrefixed as e,unprefixPathname as n,getLocalePrefix as i}from"../../shared/utils.js";function a(a){const m=r(),s=o();return t((()=>{if(!m)return m;const r=i(s,a);return e(r,m)?n(m,r):m}),[s,a,m])}export{a as default};
@@ -1,2 +1,2 @@
1
- 'use client';
2
- import{extends as e}from"../../_virtual/_rollupPluginBabelHelpers.js";import r from"next/link";import{usePathname as o}from"next/navigation";import t,{forwardRef as n,useState as i,useEffect as l}from"react";import c from"../../react-client/useLocale.js";import{isLocalizableHref as a,prefixHref as p,localizeHref as s}from"../../shared/utils.js";import f from"./syncLocaleCookie.js";function m(n,m){let{href:h,locale:u,localePrefixMode:d,onClick:k,prefetch:x,prefix:v,...L}=n;const g=o(),j=c(),C=u!==j,[y,w]=i((()=>a(h)&&("never"!==d||C)?p(h,v):h));return l((()=>{g&&w(s(h,u,j,g,v))}),[j,h,u,g,v]),C&&(x&&console.error("The `prefetch` prop is currently not supported when using the `locale` prop on `Link` to switch the locale.`"),x=!1),t.createElement(r,e({ref:m,href:y,hrefLang:C?u:void 0,onClick:function(e){f(g,j,u),k&&k(e)},prefetch:x},L))}const h=n(m);h.displayName="ClientLink";var u=h;export{u as default};
1
+ "use client";
2
+ import{extends as e}from"../../_virtual/_rollupPluginBabelHelpers.js";import o from"next/link";import{usePathname as r}from"next/navigation";import t,{forwardRef as n,useState as i,useEffect as l}from"react";import c from"../../react-client/useLocale.js";import{isLocalizableHref as p,prefixHref as a,localizeHref as s}from"../../shared/utils.js";import f from"./syncLocaleCookie.js";function m(n,m){let{href:h,locale:u,localePrefixMode:d,onClick:k,prefetch:x,prefix:L,...g}=n;const j=r(),v=c(),C=u!==v,[y,w]=i((()=>p(h)&&("never"!==d||C)?a(h,L):h));return l((()=>{j&&w(s(h,u,v,j,L))}),[v,h,u,j,L]),C&&(x&&console.error("The `prefetch` prop is currently not supported when using the `locale` prop on `Link` to switch the locale.`"),x=!1),t.createElement(o,e({ref:m,href:y,hrefLang:C?u:void 0,onClick:function(e){f(j,v,u),k&&k(e)},prefetch:x},g))}const h=n(m);h.displayName="ClientLink";export{h as default};
@@ -1 +1 @@
1
- import{cache as t}from"react";import{initializeConfig as e}from"use-intl/core";import{getRequestLocale as o}from"./RequestLocale.js";import n from"next-intl/config";const r=t((function(){return new Date}));const a=t((function(){return Intl.DateTimeFormat().resolvedOptions().timeZone}));const i=t((async function(t,e){let n=!1;const i={get locale(){return n=!0,e||o()}};let s=t(i);return s instanceof Promise&&(s=await s),s.locale&&n&&console.error("\nYou've read the `locale` param that was passed to `getRequestConfig` but have also returned one from the function. This is likely an error, please ensure that you're consistently using a setup with or without i18n routing: https://next-intl-docs.vercel.app/docs/getting-started/app-router\n"),{...s,locale:s.locale||i.locale,now:s.now||r(),timeZone:s.timeZone||a()}}));var s=t((async function(t){const o=await i(n,t);return e(o)}));export{s as default};
1
+ import{cache as t}from"react";import{initializeConfig as e}from"use-intl/core";import{getRequestLocale as o}from"./RequestLocale.js";import n from"next-intl/config";const r=t((function(){return new Date}));const a=t((function(){return Intl.DateTimeFormat().resolvedOptions().timeZone}));const s=t((async function(t,e){let n=!1;const s={get locale(){return n=!0,e||o()}};let i=t(s);return i instanceof Promise&&(i=await i),i.locale&&n&&console.error("\nYou've read the `locale` param that was passed to `getRequestConfig` but have also returned one from the function. This is likely an error, please ensure that you're consistently using a setup with or without i18n routing: https://next-intl-docs.vercel.app/docs/getting-started/app-router\n"),{...i,locale:i.locale||s.locale,now:i.now||r(),timeZone:i.timeZone||a()}}));const i=t((async function(t){const o=await s(n,t);return e(o)}));export{i as default};
@@ -1 +1 @@
1
- import{cache as o}from"react";import r from"./getConfig.js";var t=o((async function(){const o=await r();return Promise.resolve(o.locale)}));export{t as default};
1
+ import{cache as o}from"react";import t from"./getConfig.js";const r=o((async function(){const o=await t();return Promise.resolve(o.locale)}));export{r as default};
@@ -1,2 +1,2 @@
1
- 'use client';
1
+ "use client";
2
2
  import{extends as e}from"../_virtual/_rollupPluginBabelHelpers.js";import l from"react";import{IntlProvider as t}from"use-intl/_IntlProvider";function r(r){let{locale:o,...i}=r;if(!o)throw new Error("Failed to determine locale in `NextIntlClientProvider`, please provide the `locale` prop explicitly.\n\nSee https://next-intl-docs.vercel.app/docs/configuration#locale");return l.createElement(t,e({locale:o},i))}export{r as default};
@@ -1 +1 @@
1
- "use strict";function e(){return e=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},e.apply(this,arguments)}Object.defineProperty(exports,"__esModule",{value:!0}),exports.extends=e;
1
+ "use strict";function e(){return e=Object.assign?Object.assign.bind():function(e){for(var r=1;r<arguments.length;r++){var n=arguments[r];for(var t in n)({}).hasOwnProperty.call(n,t)&&(e[t]=n[t])}return e},e.apply(null,arguments)}Object.defineProperty(exports,"__esModule",{value:!0}),exports.extends=e;
@@ -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("./utils.js");exports.default=function(s){const i=r.receiveConfig(s);return function(r){var s,c;const d=decodeURI(r.nextUrl.pathname),{domain:h,locale:m}=o.default(i,r.headers,r.cookies,d),f=i.localeDetection&&(null===(s=r.cookies.get(a.COOKIE_LOCALE_NAME))||void 0===s?void 0:s.value)!==m,u=h?h.defaultLocale===m:m===i.defaultLocale,x=(null===(c=i.domains)||void 0===c?void 0:c.filter((e=>n.isLocaleSupportedOnDomain(m,e))))||[],P=null!=i.domains&&!h;function p(t){const l=new URL(t,r.url);return r.nextUrl.basePath&&(l.pathname=n.applyBasePath(l.pathname,r.nextUrl.basePath)),e.NextResponse.rewrite(l,function(){const e=new Headers(r.headers);return e.set(a.HEADER_LOCALE_NAME,m),{request:{headers:e}}}())}function g(a,l){const o=new URL(n.normalizeTrailingSlash(a),r.url);if(x.length>0&&!l){const e=n.getBestMatchingDomain(h,m,x);e&&(l=e.domain,e.defaultLocale===m&&"as-needed"===i.localePrefix.mode&&o.pathname.startsWith(t.getLocalePrefix(m,i.localePrefix))&&(o.pathname=n.getNormalizedPathname(o.pathname,i.locales,i.localePrefix)))}var s,c;l&&(o.host=l,r.headers.get("x-forwarded-host")&&(o.protocol=null!==(s=r.headers.get("x-forwarded-proto"))&&void 0!==s?s:r.nextUrl.protocol,o.port=null!==(c=r.headers.get("x-forwarded-port"))&&void 0!==c?c:""));return r.nextUrl.basePath&&(o.pathname=n.applyBasePath(o.pathname,r.nextUrl.basePath)),e.NextResponse.redirect(o.toString())}const v=n.getNormalizedPathname(d,i.locales,i.localePrefix),L=n.getPathnameMatch(d,i.locales,i.localePrefix),U=null!=L,E="never"===i.localePrefix.mode||u&&"as-needed"===i.localePrefix.mode;let A,O,_=v;if(i.pathnames){let e;if([e,O]=n.getInternalTemplate(i.pathnames,v,m),O){const a=i.pathnames[O],l="string"==typeof a?a:a[m];if(t.matchesPathname(l,v))_=n.formatTemplatePathname(v,l,O);else{let o;o=e?"string"==typeof a?a:a[e]:O;const s=E?void 0:t.getLocalePrefix(m,i.localePrefix),c=n.formatTemplatePathname(v,o,l);A=g(n.formatPathname(c,s,r.nextUrl.search))}}}if(!A)if("/"!==_||U){const e=n.formatPathname(_,n.getLocaleAsPrefix(m),r.nextUrl.search);if(U){const a=n.formatPathname(v,L.prefix,r.nextUrl.search);if("never"===i.localePrefix.mode)A=g(n.formatPathname(v,void 0,r.nextUrl.search));else if(L.exact)if(u&&E)A=g(n.formatPathname(v,void 0,r.nextUrl.search));else if(i.domains){const t=n.getBestMatchingDomain(h,L.locale,x);A=(null==h?void 0:h.domain)===(null==t?void 0:t.domain)||P?p(e):g(a,null==t?void 0:t.domain)}else A=p(e);else A=g(a)}else A=E?p(e):g(n.formatPathname(v,t.getLocalePrefix(m,i.localePrefix),r.nextUrl.search))}else A=E?p(n.formatPathname(_,n.getLocaleAsPrefix(m),r.nextUrl.search)):g(n.formatPathname(v,t.getLocalePrefix(m,i.localePrefix),r.nextUrl.search));var q;(f&&A.cookies.set(a.COOKIE_LOCALE_NAME,m,{path:r.nextUrl.basePath||void 0,sameSite:a.COOKIE_SAME_SITE,maxAge:a.COOKIE_MAX_AGE}),"never"!==i.localePrefix.mode&&i.alternateLinks&&i.locales.length>1)&&A.headers.set("Link",l.default({config:i,localizedPathnames:null!=O?null===(q=i.pathnames)||void 0===q?void 0:q[O]:void 0,request:r,resolvedLocale:m}));return A}};
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}};
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../shared/constants.js");exports.default=function(t,s,o){var a;(null===(a=t.cookies.get(e.COOKIE_LOCALE_NAME))||void 0===a?void 0:a.value)!==o&&s.cookies.set(e.COOKIE_LOCALE_NAME,o,{path:t.nextUrl.basePath||void 0,sameSite:e.COOKIE_SAME_SITE,maxAge:e.COOKIE_MAX_AGE})};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../shared/utils.js");function t(e){return e.includes("[[...")}function n(e){return e.includes("[...")}function r(e){return e.includes("[")}function o(e,o){const a=e.split("/"),c=o.split("/"),i=Math.max(a.length,c.length);for(let e=0;e<i;e++){const o=a[e],i=c[e];if(!o&&i)return-1;if(o&&!i)return 1;if(!r(o)&&r(i))return-1;if(r(o)&&!r(i))return 1;if(!n(o)&&n(i))return-1;if(n(o)&&!n(i))return 1;if(!t(o)&&t(i))return-1;if(t(o)&&!t(i))return 1}return 0}function a(e){return e.sort(o)}function c(t,n){return t.map((t=>[t,e.getLocalePrefix(t,n)]))}function i(t,n){const r=e.templateToRegex(t).exec(n);if(!r)return;const o={};for(let e=1;e<r.length;e++){var a;const n=null===(a=t.match(/\[([^\]]+)\]/g))||void 0===a?void 0:a[e-1].replace(/[[\]]/g,"");n&&(o[n]=r[e])}return o}function s(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 l(e,t){return t.defaultLocale===e||!t.locales||t.locales.includes(e)}function u(e){return"/"!==e&&e.endsWith("/")&&(e=e.slice(0,-1)),e}exports.applyBasePath=function(e,t){return u(t+e)},exports.comparePathnamePairs=o,exports.formatPathname=function(t,n,r){let o=t;return n&&(o=e.prefixPathname(n,o)),r&&(o+=r),o},exports.formatPathnameTemplate=s,exports.formatTemplatePathname=function(e,t,n,r){const o=i(t,e);let a="";return r&&(a="/".concat(r)),a+=s(n,o),a=u(a),a},exports.getBestMatchingDomain=function(e,t,n){let r;return e&&l(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=a(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),c=t.findIndex((e=>{let[t]=e;return t===r}));c>0&&t.unshift(t.splice(c,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=c,exports.getNormalizedPathname=function(e,t,n){e.endsWith("/")||(e+="/");const r=c(t,n),o=new RegExp("^(".concat(r.map((e=>{let[,t]=e;return t.replaceAll("/","\\/")})).join("|"),")/(.*)"),"i"),a=e.match(o);let i=a?"/"+a[2]:e;return"/"!==i&&(i=u(i)),i},exports.getPathnameMatch=function(e,t,n){const r=c(t,n);for(const[t,n]of r){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=i,exports.getSortedPathnames=a,exports.isLocaleSupportedOnDomain=l,exports.normalizeTrailingSlash=u;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../shared/utils.js");function t(e){return e.includes("[[...")}function n(e){return e.includes("[...")}function r(e){return e.includes("[")}function o(e,o){const a=e.split("/"),i=o.split("/"),s=Math.max(a.length,i.length);for(let e=0;e<s;e++){const o=a[e],s=i[e];if(!o&&s)return-1;if(o&&!s)return 1;if(!r(o)&&r(s))return-1;if(r(o)&&!r(s))return 1;if(!n(o)&&n(s))return-1;if(n(o)&&!n(s))return 1;if(!t(o)&&t(s))return-1;if(t(o)&&!t(s))return 1}return 0}function a(e){return e.sort(o)}function i(t,n){return t.map((t=>[t,e.getLocalePrefix(t,n)]))}function s(t,n){const r=e.templateToRegex(t).exec(n);if(!r)return;const o={};for(let e=1;e<r.length;e++){var a;const n=null===(a=t.match(/\[([^\]]+)\]/g))||void 0===a?void 0:a[e-1].replace(/[[\]]/g,"");n&&(o[n]=r[e])}return o}function c(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 l(e,t){return t.defaultLocale===e||!t.locales||t.locales.includes(e)}function u(e){return"/"!==e&&e.endsWith("/")&&(e=e.slice(0,-1)),e}exports.applyBasePath=function(e,t){return u(t+e)},exports.comparePathnamePairs=o,exports.formatPathname=function(t,n,r){let o=t;return n&&(o=e.prefixPathname(n,o)),r&&(o+=r),o},exports.formatPathnameTemplate=c,exports.formatTemplatePathname=function(e,t,n,r){let o="";return o+=c(n,s(t,e)),o=u(o),o},exports.getBestMatchingDomain=function(e,t,n){let r;return e&&l(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=a(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),i=t.findIndex((e=>{let[t]=e;return t===r}));i>0&&t.unshift(t.splice(i,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=i,exports.getNormalizedPathname=function(e,t,n){e.endsWith("/")||(e+="/");const r=i(t,n),o=new RegExp("^(".concat(r.map((e=>{let[,t]=e;return t.replaceAll("/","\\/")})).join("|"),")/(.*)"),"i"),a=e.match(o);let s=a?"/"+a[2]:e;return"/"!==s&&(s=u(s)),s},exports.getPathnameMatch=function(e,t,n){const r=i(t,n);for(const[t,n]of r){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=s,exports.getSortedPathnames=a,exports.isLocaleSupportedOnDomain=l,exports.normalizeTrailingSlash=u;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../_virtual/_rollupPluginBabelHelpers.js"),r=require("react"),l=require("../../react-client/useLocale.js"),t=require("../../shared/utils.js"),a=require("../shared/BaseLink.js");function u(e){return e&&e.__esModule?e:{default:e}}var i=u(r);function s(r,u){let{locale:s,localePrefix:o,...c}=r;const n=l.default(),d=s||n,f=t.getLocalePrefix(d,o);return i.default.createElement(a.default,e.extends({ref:u,locale:d,localePrefixMode:o.mode,prefix:f},c))}const o=r.forwardRef(s);o.displayName="ClientLink";var c=o;exports.default=c;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../_virtual/_rollupPluginBabelHelpers.js"),r=require("react"),l=require("../../react-client/useLocale.js"),t=require("../../shared/utils.js"),a=require("../shared/BaseLink.js");function u(e){return e&&e.__esModule?e:{default:e}}var i=u(r);function s(r,u){let{locale:s,localePrefix:o,...c}=r;const n=l.default(),d=s||n,f=t.getLocalePrefix(d,o);return i.default.createElement(a.default,e.extends({ref:u,locale:d,localePrefixMode:o.mode,prefix:f},c))}const o=r.forwardRef(s);o.displayName="ClientLink",exports.default=o;
@@ -1,2 +1,2 @@
1
- 'use client';
1
+ "use client";
2
2
  "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("next/navigation"),r=require("react"),t=require("../../react-client/useLocale.js"),a=require("../../shared/utils.js");exports.default=function(u){const n=e.usePathname(),i=t.default();return r.useMemo((()=>{if(!n)return n;const e=a.getLocalePrefix(i,u);return a.hasPathnamePrefixed(e,n)?a.unprefixPathname(n,e):n}),[i,u,n])};
@@ -1,2 +1,2 @@
1
- 'use client';
2
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../_virtual/_rollupPluginBabelHelpers.js"),r=require("next/link"),t=require("next/navigation"),l=require("react"),a=require("../../react-client/useLocale.js"),i=require("../../shared/utils.js"),u=require("./syncLocaleCookie.js");function n(e){return e&&e.__esModule?e:{default:e}}var f=n(r),o=n(l);function c(r,n){let{href:c,locale:s,localePrefixMode:d,onClick:p,prefetch:v,prefix:x,...h}=r;const q=t.usePathname(),_=a.default(),j=s!==_,[k,L]=l.useState((()=>i.isLocalizableHref(c)&&("never"!==d||j)?i.prefixHref(c,x):c));return l.useEffect((()=>{q&&L(i.localizeHref(c,s,_,q,x))}),[_,c,s,q,x]),j&&(v=!1),o.default.createElement(f.default,e.extends({ref:n,href:k,hrefLang:j?s:void 0,onClick:function(e){u.default(q,_,s),p&&p(e)},prefetch:v},h))}const s=l.forwardRef(c);s.displayName="ClientLink";var d=s;exports.default=d;
1
+ "use client";
2
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../_virtual/_rollupPluginBabelHelpers.js"),r=require("next/link"),t=require("next/navigation"),l=require("react"),i=require("../../react-client/useLocale.js"),a=require("../../shared/utils.js"),u=require("./syncLocaleCookie.js");function n(e){return e&&e.__esModule?e:{default:e}}var f=n(r),o=n(l);function c(r,n){let{href:c,locale:s,localePrefixMode:d,onClick:p,prefetch:x,prefix:h,...q}=r;const v=t.usePathname(),_=i.default(),j=s!==_,[k,L]=l.useState((()=>a.isLocalizableHref(c)&&("never"!==d||j)?a.prefixHref(c,h):c));return l.useEffect((()=>{v&&L(a.localizeHref(c,s,_,v,h))}),[_,c,s,v,h]),j&&(x=!1),o.default.createElement(f.default,e.extends({ref:n,href:k,hrefLang:j?s:void 0,onClick:function(e){u.default(v,_,s),p&&p(e)},prefetch:x},q))}const s=l.forwardRef(c);s.displayName="ClientLink",exports.default=s;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),t=require("use-intl/core"),n=require("./RequestLocale.js");function o(e){return e&&e.__esModule?e:{default:e}}var r=o(require("next-intl/config"));const a=e.cache((function(){return new Date}));const i=e.cache((function(){return Intl.DateTimeFormat().resolvedOptions().timeZone}));const c=e.cache((async function(e,t){let o=!1;const r={get locale(){return o=!0,t||n.getRequestLocale()}};let c=e(r);return c instanceof Promise&&(c=await c),c.locale&&o&&console.error("\nYou've read the `locale` param that was passed to `getRequestConfig` but have also returned one from the function. This is likely an error, please ensure that you're consistently using a setup with or without i18n routing: https://next-intl-docs.vercel.app/docs/getting-started/app-router\n"),{...c,locale:c.locale||r.locale,now:c.now||a(),timeZone:c.timeZone||i()}}));var s=e.cache((async function(e){const n=await c(r.default,e);return t.initializeConfig(n)}));exports.default=s;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),t=require("use-intl/core"),n=require("./RequestLocale.js");function o(e){return e&&e.__esModule?e:{default:e}}var r=o(require("next-intl/config"));const a=e.cache((function(){return new Date}));const c=e.cache((function(){return Intl.DateTimeFormat().resolvedOptions().timeZone}));const i=e.cache((async function(e,t){let o=!1;const r={get locale(){return o=!0,t||n.getRequestLocale()}};let i=e(r);return i instanceof Promise&&(i=await i),i.locale&&o&&console.error("\nYou've read the `locale` param that was passed to `getRequestConfig` but have also returned one from the function. This is likely an error, please ensure that you're consistently using a setup with or without i18n routing: https://next-intl-docs.vercel.app/docs/getting-started/app-router\n"),{...i,locale:i.locale||r.locale,now:i.now||a(),timeZone:i.timeZone||c()}}));const s=e.cache((async function(e){const n=await i(r.default,e);return t.initializeConfig(n)}));exports.default=s;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),r=require("./getConfig.js");var t=e.cache((async function(){const e=await r.default();return Promise.resolve(e.locale)}));exports.default=t;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),r=require("./getConfig.js");const t=e.cache((async function(){const e=await r.default();return Promise.resolve(e.locale)}));exports.default=t;
@@ -1,2 +1,2 @@
1
- 'use client';
1
+ "use client";
2
2
  "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../_virtual/_rollupPluginBabelHelpers.js"),r=require("react"),t=require("use-intl/_IntlProvider");function l(e){return e&&e.__esModule?e:{default:e}}var u=l(r);exports.default=function(r){let{locale:l,...o}=r;if(!l)throw new Error(void 0);return u.default.createElement(t.IntlProvider,e.extends({locale:l},o))};
@@ -0,0 +1,2 @@
1
+ import { NextRequest, NextResponse } from 'next/server';
2
+ export default function syncCookie(request: NextRequest, response: NextResponse, locale: string): void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "next-intl",
3
- "version": "3.15.0-custom-prefixes.0",
3
+ "version": "3.15.1-canary.0",
4
4
  "sideEffects": false,
5
5
  "author": "Jan Amann <jan@amann.work>",
6
6
  "funding": [
@@ -9,13 +9,23 @@
9
9
  "url": "https://github.com/sponsors/amannn"
10
10
  }
11
11
  ],
12
- "description": "A minimal, but complete solution for internationalization in Next.js apps.",
12
+ "description": "Internationalization (i18n) for Next.js",
13
13
  "license": "MIT",
14
14
  "homepage": "https://next-intl-docs.vercel.app",
15
15
  "repository": {
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",
24
+ "lint:package": "publint && attw --pack",
25
+ "prepublishOnly": "turbo build && cp ../../README.md .",
26
+ "postpublish": "git checkout . && rm ./README.md",
27
+ "size": "size-limit"
28
+ },
19
29
  "main": "./dist/index.react-client.js",
20
30
  "module": "./dist/esm/index.react-client.js",
21
31
  "typings": "./dist/types/src/index.react-client.d.ts",
@@ -77,36 +87,12 @@
77
87
  "dependencies": {
78
88
  "@formatjs/intl-localematcher": "^0.2.32",
79
89
  "negotiator": "^0.6.3",
80
- "use-intl": "^3.14.1"
90
+ "use-intl": "^3.15.1-canary.0"
81
91
  },
82
92
  "peerDependencies": {
83
93
  "next": "^10.0.0 || ^11.0.0 || ^12.0.0 || ^13.0.0 || ^14.0.0",
84
94
  "react": "^16.8.0 || ^17.0.0 || ^18.0.0"
85
95
  },
86
- "devDependencies": {
87
- "@arethetypeswrong/cli": "^0.13.5",
88
- "@edge-runtime/vm": "^3.1.3",
89
- "@size-limit/preset-big-lib": "^8.2.6",
90
- "@testing-library/react": "^13.0.0",
91
- "@types/negotiator": "^0.6.1",
92
- "@types/node": "^20.1.2",
93
- "@types/react": "^18.3.0",
94
- "@types/react-dom": "^18.3.0",
95
- "eslint": "^8.54.0",
96
- "eslint-config-molindo": "^7.0.0",
97
- "eslint-plugin-deprecation": "^1.4.1",
98
- "next": "^14.2.3",
99
- "path-to-regexp": "^6.2.1",
100
- "publint": "^0.2.7",
101
- "react": "^18.3.0",
102
- "react-dom": "^18.3.0",
103
- "rollup": "^3.28.1",
104
- "rollup-plugin-preserve-directives": "0.2.0",
105
- "size-limit": "^8.2.6",
106
- "typescript": "^5.2.2",
107
- "vitest": "^1.0.1"
108
- },
109
- "prettier": "../../.prettierrc.json",
110
96
  "size-limit": [
111
97
  {
112
98
  "path": "dist/production/index.react-client.js",
@@ -122,7 +108,7 @@
122
108
  },
123
109
  {
124
110
  "path": "dist/production/navigation.react-server.js",
125
- "limit": "17.815 KB"
111
+ "limit": "17.82 KB"
126
112
  },
127
113
  {
128
114
  "path": "dist/production/server.react-client.js",
@@ -141,12 +127,5 @@
141
127
  "limit": "0 KB"
142
128
  }
143
129
  ],
144
- "scripts": {
145
- "build": "rm -rf dist && rollup -c",
146
- "test": "TZ=Europe/Berlin vitest",
147
- "lint": "pnpm run lint:source && pnpm run lint:package",
148
- "lint:source": "eslint src test && tsc --noEmit",
149
- "lint:package": "publint && attw --pack",
150
- "size": "size-limit"
151
- }
152
- }
130
+ "gitHead": "d3700acac487f0a5d9633c610ccf894535701011"
131
+ }