next-intl 3.23.1 → 3.23.3

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.
@@ -2,12 +2,12 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var RequestLocale = require('../../server/react-server/RequestLocale.js');
6
5
  var createSharedNavigationFns = require('../shared/createSharedNavigationFns.js');
6
+ var getServerLocale = require('./getServerLocale.js');
7
7
 
8
8
  function createNavigation(routing) {
9
9
  function getLocale() {
10
- return RequestLocale.getRequestLocale();
10
+ return getServerLocale.default();
11
11
  }
12
12
 
13
13
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
@@ -0,0 +1,16 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var getConfig = require('../../server/react-server/getConfig.js');
6
+
7
+ /**
8
+ * This is only moved to a separate module for easier mocking in
9
+ * `../createNavigatoin.test.tsx` in order to avoid suspending.
10
+ */
11
+ async function getServerLocale() {
12
+ const config = await getConfig.default();
13
+ return config.locale;
14
+ }
15
+
16
+ exports.default = getServerLocale;
@@ -63,12 +63,13 @@ function createSharedNavigationFns(getLocale, routing) {
63
63
  ref: ref
64
64
  // @ts-expect-error -- Available after the validation
65
65
  ,
66
- defaultLocale: config$1.defaultLocale,
67
- href: {
68
- ...(typeof href === 'object' && href),
69
- // @ts-expect-error -- This is ok
66
+ defaultLocale: config$1.defaultLocale
67
+ // @ts-expect-error -- This is ok
68
+ ,
69
+ href: typeof href === 'object' ? {
70
+ ...href,
70
71
  pathname: finalPathname
71
- },
72
+ } : finalPathname,
72
73
  locale: locale,
73
74
  localeCookie: config$1.localeCookie
74
75
  // Provide the minimal relevant information to the client side in order
@@ -1 +1 @@
1
- import{getRequestLocale as e}from"../../server/react-server/RequestLocale.js";import o from"../shared/createSharedNavigationFns.js";function t(t){const{config:n,...r}=o((function(){return e()}),t);function s(e){return()=>{throw new Error("`".concat(e,"` is not supported in Server Components. You can use this hook if you convert the calling component to a Client Component."))}}return{...r,usePathname:s("usePathname"),useRouter:s("useRouter")}}export{t as default};
1
+ import e from"../shared/createSharedNavigationFns.js";import o from"./getServerLocale.js";function t(t){const{config:n,...r}=e((function(){return o()}),t);function u(e){return()=>{throw new Error("`".concat(e,"` is not supported in Server Components. You can use this hook if you convert the calling component to a Client Component."))}}return{...r,usePathname:u("usePathname"),useRouter:u("useRouter")}}export{t as default};
@@ -0,0 +1 @@
1
+ import e from"../../server/react-server/getConfig.js";async function r(){return(await e()).locale}export{r as default};
@@ -1 +1 @@
1
- import{extends as e}from"../../_virtual/_rollupPluginBabelHelpers.js";import{redirect as o,permanentRedirect as a}from"next/navigation";import t,{forwardRef as n,use as r}from"react";import{receiveRoutingConfig as l}from"../../routing/config.js";import{isLocalizableHref as i}from"../../shared/utils.js";import m from"./BaseLink.js";import{validateReceivedConfig as c,serializeSearchParams as f,compileLocalizedPathname as s,applyPathnamePrefix as u,normalizeNameOrNameWithParams as p}from"./utils.js";function d(d,h){const j=l(h||{});c(j);const g=j.pathnames,v="as-needed"===j.localePrefix.mode&&j.domains||void 0;function y(o,a){let n,l,{href:c,locale:f,...s}=o;"object"==typeof c?(n=c.pathname,l=c.params):n=c;const u=i(c),p=d(),h=p instanceof Promise?r(p):p,y=u?L({locale:f||h,href:null==g?n:{pathname:n,params:l}},null!=f||v||void 0):n;return t.createElement(m,e({ref:a,defaultLocale:j.defaultLocale,href:{..."object"==typeof c&&c,pathname:y},locale:f,localeCookie:j.localeCookie,unprefixed:v&&u?{domains:j.domains.reduce(((e,o)=>(e[o.domain]=o.defaultLocale,e)),{}),pathname:L({locale:h,href:null==g?n:{pathname:n,params:l}},!1)}:void 0},s))}const x=n(y);function L(e,o){const{href:a,locale:t}=e;let n;return null==g?"object"==typeof a?(n=a.pathname,a.query&&(n+=f(a.query))):n=a:n=s({locale:t,...p(a),pathnames:j.pathnames}),u(n,t,j,e.domain,o)}function b(e){return function(o){for(var a=arguments.length,t=new Array(a>1?a-1:0),n=1;n<a;n++)t[n-1]=arguments[n];return e(L(o,o.domain?void 0:v),...t)}}const k=b(o),P=b(a);return{config:j,Link:x,redirect:k,permanentRedirect:P,getPathname:L}}export{d as default};
1
+ import{extends as e}from"../../_virtual/_rollupPluginBabelHelpers.js";import{redirect as o,permanentRedirect as a}from"next/navigation";import t,{forwardRef as n,use as r}from"react";import{receiveRoutingConfig as l}from"../../routing/config.js";import{isLocalizableHref as i}from"../../shared/utils.js";import m from"./BaseLink.js";import{validateReceivedConfig as c,serializeSearchParams as f,compileLocalizedPathname as s,applyPathnamePrefix as u,normalizeNameOrNameWithParams as p}from"./utils.js";function d(d,h){const j=l(h||{});c(j);const g=j.pathnames,v="as-needed"===j.localePrefix.mode&&j.domains||void 0;function y(o,a){let n,l,{href:c,locale:f,...s}=o;"object"==typeof c?(n=c.pathname,l=c.params):n=c;const u=i(c),p=d(),h=p instanceof Promise?r(p):p,y=u?L({locale:f||h,href:null==g?n:{pathname:n,params:l}},null!=f||v||void 0):n;return t.createElement(m,e({ref:a,defaultLocale:j.defaultLocale,href:"object"==typeof c?{...c,pathname:y}:y,locale:f,localeCookie:j.localeCookie,unprefixed:v&&u?{domains:j.domains.reduce(((e,o)=>(e[o.domain]=o.defaultLocale,e)),{}),pathname:L({locale:h,href:null==g?n:{pathname:n,params:l}},!1)}:void 0},s))}const x=n(y);function L(e,o){const{href:a,locale:t}=e;let n;return null==g?"object"==typeof a?(n=a.pathname,a.query&&(n+=f(a.query))):n=a:n=s({locale:t,...p(a),pathnames:j.pathnames}),u(n,t,j,e.domain,o)}function b(e){return function(o){for(var a=arguments.length,t=new Array(a>1?a-1:0),n=1;n<a;n++)t[n-1]=arguments[n];return e(L(o,o.domain?void 0:v),...t)}}const k=b(o),P=b(a);return{config:j,Link:x,redirect:k,permanentRedirect:P,getPathname:L}}export{d as default};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../server/react-server/RequestLocale.js"),t=require("../shared/createSharedNavigationFns.js");exports.default=function(r){const{config:o,...n}=t.default((function(){return e.getRequestLocale()}),r);function u(e){return()=>{throw new Error("`".concat(e,"` is not supported in Server Components. You can use this hook if you convert the calling component to a Client Component."))}}return{...n,usePathname:u("usePathname"),useRouter:u("useRouter")}};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../shared/createSharedNavigationFns.js"),t=require("./getServerLocale.js");exports.default=function(r){const{config:n,...o}=e.default((function(){return t.default()}),r);function u(e){return()=>{throw new Error("`".concat(e,"` is not supported in Server Components. You can use this hook if you convert the calling component to a Client Component."))}}return{...o,usePathname:u("usePathname"),useRouter:u("useRouter")}};
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../server/react-server/getConfig.js");exports.default=async function(){return(await e.default()).locale};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../_virtual/_rollupPluginBabelHelpers.js"),a=require("next/navigation"),r=require("react"),t=require("../../routing/config.js"),n=require("../../shared/utils.js"),o=require("./BaseLink.js"),i=require("./utils.js");function l(e){return e&&e.__esModule?e:{default:e}}var u=l(r);exports.default=function(l,c){const s=t.receiveRoutingConfig(c||{}),f=s.pathnames,d="as-needed"===s.localePrefix.mode&&s.domains||void 0;function m(a,t){let i,c,{href:m,locale:p,...v}=a;"object"==typeof m?(i=m.pathname,c=m.params):i=m;const P=n.isLocalizableHref(m),g=l(),j=g instanceof Promise?r.use(g):g,q=P?h({locale:p||j,href:null==f?i:{pathname:i,params:c}},null!=p||d||void 0):i;return u.default.createElement(o.default,e.extends({ref:t,defaultLocale:s.defaultLocale,href:{..."object"==typeof m&&m,pathname:q},locale:p,localeCookie:s.localeCookie,unprefixed:d&&P?{domains:s.domains.reduce(((e,a)=>(e[a.domain]=a.defaultLocale,e)),{}),pathname:h({locale:j,href:null==f?i:{pathname:i,params:c}},!1)}:void 0},v))}const p=r.forwardRef(m);function h(e,a){const{href:r,locale:t}=e;let n;return null==f?"object"==typeof r?(n=r.pathname,r.query&&(n+=i.serializeSearchParams(r.query))):n=r:n=i.compileLocalizedPathname({locale:t,...i.normalizeNameOrNameWithParams(r),pathnames:s.pathnames}),i.applyPathnamePrefix(n,t,s,e.domain,a)}function v(e){return function(a){for(var r=arguments.length,t=new Array(r>1?r-1:0),n=1;n<r;n++)t[n-1]=arguments[n];return e(h(a,a.domain?void 0:d),...t)}}const P=v(a.redirect),g=v(a.permanentRedirect);return{config:s,Link:p,redirect:P,permanentRedirect:g,getPathname:h}};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../_virtual/_rollupPluginBabelHelpers.js"),a=require("next/navigation"),r=require("react"),t=require("../../routing/config.js"),n=require("../../shared/utils.js"),o=require("./BaseLink.js"),i=require("./utils.js");function l(e){return e&&e.__esModule?e:{default:e}}var u=l(r);exports.default=function(l,c){const s=t.receiveRoutingConfig(c||{}),f=s.pathnames,d="as-needed"===s.localePrefix.mode&&s.domains||void 0;function m(a,t){let i,c,{href:m,locale:p,...v}=a;"object"==typeof m?(i=m.pathname,c=m.params):i=m;const P=n.isLocalizableHref(m),g=l(),j=g instanceof Promise?r.use(g):g,q=P?h({locale:p||j,href:null==f?i:{pathname:i,params:c}},null!=p||d||void 0):i;return u.default.createElement(o.default,e.extends({ref:t,defaultLocale:s.defaultLocale,href:"object"==typeof m?{...m,pathname:q}:q,locale:p,localeCookie:s.localeCookie,unprefixed:d&&P?{domains:s.domains.reduce(((e,a)=>(e[a.domain]=a.defaultLocale,e)),{}),pathname:h({locale:j,href:null==f?i:{pathname:i,params:c}},!1)}:void 0},v))}const p=r.forwardRef(m);function h(e,a){const{href:r,locale:t}=e;let n;return null==f?"object"==typeof r?(n=r.pathname,r.query&&(n+=i.serializeSearchParams(r.query))):n=r:n=i.compileLocalizedPathname({locale:t,...i.normalizeNameOrNameWithParams(r),pathnames:s.pathnames}),i.applyPathnamePrefix(n,t,s,e.domain,a)}function v(e){return function(a){for(var r=arguments.length,t=new Array(r>1?r-1:0),n=1;n<r;n++)t[n-1]=arguments[n];return e(h(a,a.domain?void 0:d),...t)}}const P=v(a.redirect),g=v(a.permanentRedirect);return{config:s,Link:p,redirect:P,permanentRedirect:g,getPathname:h}};
@@ -0,0 +1,5 @@
1
+ /**
2
+ * This is only moved to a separate module for easier mocking in
3
+ * `../createNavigatoin.test.tsx` in order to avoid suspending.
4
+ */
5
+ export default function getServerLocale(): Promise<string>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "next-intl",
3
- "version": "3.23.1",
3
+ "version": "3.23.3",
4
4
  "sideEffects": false,
5
5
  "author": "Jan Amann <jan@amann.work>",
6
6
  "funding": [
@@ -88,11 +88,11 @@
88
88
  "dependencies": {
89
89
  "@formatjs/intl-localematcher": "^0.5.4",
90
90
  "negotiator": "^0.6.3",
91
- "use-intl": "^3.23.1"
91
+ "use-intl": "^3.23.3"
92
92
  },
93
93
  "peerDependencies": {
94
94
  "next": "^10.0.0 || ^11.0.0 || ^12.0.0 || ^13.0.0 || ^14.0.0 || ^15.0.0",
95
95
  "react": "^16.8.0 || ^17.0.0 || ^18.0.0"
96
96
  },
97
- "gitHead": "ecf0e9e32d53287cbbe1f9a0c2411fbf9c3a4a88"
97
+ "gitHead": "5c75143081ba2b43628376d4d762a425ba9f75b6"
98
98
  }