next-intl 3.15.0 → 3.16.0-0b5af1a.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 (30) 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/utils.js +0 -3
  5. package/dist/development/navigation/react-client/ClientLink.js +1 -2
  6. package/dist/development/navigation/react-client/useBasePathname.js +1 -1
  7. package/dist/development/navigation/shared/BaseLink.js +2 -3
  8. package/dist/development/navigation/shared/utils.js +1 -0
  9. package/dist/development/server/react-server/createRequestConfig.js +1 -1
  10. package/dist/development/server/react-server/getConfig.js +1 -2
  11. package/dist/development/server/react-server/getLocale.js +1 -2
  12. package/dist/development/server/react-server/getTranslations.js +2 -0
  13. package/dist/development/shared/NextIntlClientProvider.js +1 -1
  14. package/dist/esm/_virtual/_rollupPluginBabelHelpers.js +1 -1
  15. package/dist/esm/middleware/utils.js +1 -1
  16. package/dist/esm/navigation/react-client/ClientLink.js +1 -1
  17. package/dist/esm/navigation/react-client/useBasePathname.js +1 -1
  18. package/dist/esm/navigation/shared/BaseLink.js +2 -2
  19. package/dist/esm/server/react-server/getConfig.js +1 -1
  20. package/dist/esm/server/react-server/getLocale.js +1 -1
  21. package/dist/esm/shared/NextIntlClientProvider.js +1 -1
  22. package/dist/production/_virtual/_rollupPluginBabelHelpers.js +1 -1
  23. package/dist/production/middleware/utils.js +1 -1
  24. package/dist/production/navigation/react-client/ClientLink.js +1 -1
  25. package/dist/production/navigation/react-client/useBasePathname.js +1 -1
  26. package/dist/production/navigation/shared/BaseLink.js +2 -2
  27. package/dist/production/server/react-server/getConfig.js +1 -1
  28. package/dist/production/server/react-server/getLocale.js +1 -1
  29. package/dist/production/shared/NextIntlClientProvider.js +1 -1
  30. package/package.json +6 -30
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;
@@ -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{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("../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))};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "next-intl",
3
- "version": "3.15.0",
3
+ "version": "3.16.0-0b5af1a.0+0b5af1a",
4
4
  "sideEffects": false,
5
5
  "author": "Jan Amann <jan@amann.work>",
6
6
  "funding": [
@@ -9,7 +9,7 @@
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": {
@@ -22,7 +22,7 @@
22
22
  "lint": "pnpm run lint:source && pnpm run lint:package",
23
23
  "lint:source": "eslint src test && tsc --noEmit",
24
24
  "lint:package": "publint && attw --pack",
25
- "prepublishOnly": "CI=true turbo test && turbo lint && turbo build && cp ../../README.md .",
25
+ "prepublishOnly": "turbo build && cp ../../README.md .",
26
26
  "postpublish": "git checkout . && rm ./README.md",
27
27
  "size": "size-limit"
28
28
  },
@@ -87,36 +87,12 @@
87
87
  "dependencies": {
88
88
  "@formatjs/intl-localematcher": "^0.2.32",
89
89
  "negotiator": "^0.6.3",
90
- "use-intl": "^3.15.0"
90
+ "use-intl": "^3.16.0-0b5af1a.0+0b5af1a"
91
91
  },
92
92
  "peerDependencies": {
93
93
  "next": "^10.0.0 || ^11.0.0 || ^12.0.0 || ^13.0.0 || ^14.0.0",
94
94
  "react": "^16.8.0 || ^17.0.0 || ^18.0.0"
95
95
  },
96
- "devDependencies": {
97
- "@arethetypeswrong/cli": "^0.13.5",
98
- "@edge-runtime/vm": "^3.1.3",
99
- "@size-limit/preset-big-lib": "^8.2.6",
100
- "@testing-library/react": "^13.0.0",
101
- "@types/negotiator": "^0.6.1",
102
- "@types/node": "^20.1.2",
103
- "@types/react": "^18.3.0",
104
- "@types/react-dom": "^18.3.0",
105
- "eslint": "^8.54.0",
106
- "eslint-config-molindo": "^7.0.0",
107
- "eslint-plugin-deprecation": "^1.4.1",
108
- "next": "^14.2.3",
109
- "path-to-regexp": "^6.2.1",
110
- "publint": "^0.2.7",
111
- "react": "^18.3.0",
112
- "react-dom": "^18.3.0",
113
- "rollup": "^3.28.1",
114
- "rollup-plugin-preserve-directives": "0.2.0",
115
- "size-limit": "^8.2.6",
116
- "typescript": "^5.2.2",
117
- "vitest": "^1.0.1"
118
- },
119
- "prettier": "../../.prettierrc.json",
120
96
  "size-limit": [
121
97
  {
122
98
  "path": "dist/production/index.react-client.js",
@@ -132,7 +108,7 @@
132
108
  },
133
109
  {
134
110
  "path": "dist/production/navigation.react-server.js",
135
- "limit": "17.815 KB"
111
+ "limit": "17.82 KB"
136
112
  },
137
113
  {
138
114
  "path": "dist/production/server.react-client.js",
@@ -151,5 +127,5 @@
151
127
  "limit": "0 KB"
152
128
  }
153
129
  ],
154
- "gitHead": "734bc73a2f43501fd97f21aa8e274a35d02b78f0"
130
+ "gitHead": "0b5af1a6c5d53317456cd856c56a2a3084958717"
155
131
  }