next-intl 3.4.5 → 3.5.1
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.
- package/dist/development/middleware/getAlternateLinksHeaderValue.js +4 -1
- package/dist/development/navigation/react-client/createSharedPathnamesNavigation.js +1 -1
- package/dist/development/navigation/react-server/createSharedPathnamesNavigation.js +1 -1
- package/dist/esm/middleware/getAlternateLinksHeaderValue.js +1 -1
- package/dist/esm/navigation/react-client/createSharedPathnamesNavigation.js +1 -1
- package/dist/esm/navigation/react-server/createSharedPathnamesNavigation.js +1 -1
- package/dist/production/middleware/getAlternateLinksHeaderValue.js +1 -1
- package/dist/production/navigation/react-client/createSharedPathnamesNavigation.js +1 -1
- package/dist/production/navigation/react-server/createSharedPathnamesNavigation.js +1 -1
- package/dist/types/src/navigation/react-client/createSharedPathnamesNavigation.d.ts +2 -2
- package/dist/types/src/navigation/react-server/createSharedPathnamesNavigation.d.ts +2 -2
- package/package.json +6 -6
|
@@ -77,7 +77,10 @@ function getAlternateLinksHeaderValue(_ref) {
|
|
|
77
77
|
});
|
|
78
78
|
|
|
79
79
|
// Add x-default entry
|
|
80
|
-
|
|
80
|
+
const shouldAddXDefault =
|
|
81
|
+
// For domain-based routing there is no reasonable x-default
|
|
82
|
+
!config.domains && (config.localePrefix !== 'always' || normalizedUrl.pathname === '/');
|
|
83
|
+
if (shouldAddXDefault) {
|
|
81
84
|
const url = new URL(getLocalizedPathname(normalizedUrl.pathname, config.defaultLocale), normalizedUrl);
|
|
82
85
|
links.push(getAlternateEntry(url, 'x-default'));
|
|
83
86
|
}
|
|
@@ -17,7 +17,7 @@ function createSharedPathnamesNavigation(opts) {
|
|
|
17
17
|
function Link(props, ref) {
|
|
18
18
|
return /*#__PURE__*/React__default.default.createElement(ClientLink.default, _rollupPluginBabelHelpers.extends({
|
|
19
19
|
ref: ref,
|
|
20
|
-
localePrefix: opts.localePrefix
|
|
20
|
+
localePrefix: opts === null || opts === void 0 ? void 0 : opts.localePrefix
|
|
21
21
|
}, props));
|
|
22
22
|
}
|
|
23
23
|
const LinkWithRef = /*#__PURE__*/React.forwardRef(Link);
|
|
@@ -19,7 +19,7 @@ function createSharedPathnamesNavigation(opts) {
|
|
|
19
19
|
}
|
|
20
20
|
function Link(props) {
|
|
21
21
|
return /*#__PURE__*/React__default.default.createElement(ServerLink.default, _rollupPluginBabelHelpers.extends({
|
|
22
|
-
localePrefix: opts.localePrefix
|
|
22
|
+
localePrefix: opts === null || opts === void 0 ? void 0 : opts.localePrefix
|
|
23
23
|
}, props));
|
|
24
24
|
}
|
|
25
25
|
function redirect(pathname) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{getHost as
|
|
1
|
+
import{getHost as a,getNormalizedPathname as e,isLocaleSupportedOnDomain as t,applyBasePath as n,formatTemplatePathname as o}from"./utils.js";function l(l){var r;let{config:c,localizedPathnames:p,request:s,resolvedLocale:f}=l;const h=s.nextUrl.clone(),i=a(s.headers);function m(a,e){return s.nextUrl.basePath&&((a=new URL(a)).pathname=n(a.pathname,s.nextUrl.basePath)),"<".concat(a.toString(),'>; rel="alternate"; hreflang="').concat(e,'"')}function u(a,e){return p&&"object"==typeof p?o(a,p[f],p[e]):a}i&&(h.port="",h.host=i),h.protocol=null!==(r=s.headers.get("x-forwarded-proto"))&&void 0!==r?r:h.protocol,h.pathname=e(h.pathname,c.locales);const d=c.locales.flatMap((a=>{function e(e){return"/"===e?"/".concat(a):"/".concat(a).concat(e)}let n;if(c.domains){return(c.domains.filter((e=>t(a,e)))||[]).map((t=>(n=new URL(h),n.port="",n.host=t.domain,n.pathname=u(h.pathname,a),a===t.defaultLocale&&"always"!==c.localePrefix||(n.pathname=e(n.pathname)),m(n,a))))}{let t;t=p&&"object"==typeof p?u(h.pathname,a):h.pathname,a===c.defaultLocale&&"always"!==c.localePrefix||(t=e(t)),n=new URL(t,h)}return m(n,a)}));if(!c.domains&&("always"!==c.localePrefix||"/"===h.pathname)){const a=new URL(u(h.pathname,c.defaultLocale),h);d.push(m(a,"x-default"))}return d.join(", ")}export{l as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{extends as e}from"../../_virtual/_rollupPluginBabelHelpers.js";import r,{forwardRef as t}from"react";import n from"./ClientLink.js";import o from"./clientRedirect.js";import i from"./useBasePathname.js";import a from"./useBaseRouter.js";function u(u){function
|
|
1
|
+
import{extends as e}from"../../_virtual/_rollupPluginBabelHelpers.js";import r,{forwardRef as t}from"react";import n from"./ClientLink.js";import o from"./clientRedirect.js";import i from"./useBasePathname.js";import a from"./useBaseRouter.js";function u(u){function l(t,o){return r.createElement(n,e({ref:o,localePrefix:null==u?void 0:u.localePrefix},t))}const m=t(l);return m.displayName="Link",{Link:m,redirect:function(e){for(var r=arguments.length,t=new Array(r>1?r-1:0),n=1;n<r;n++)t[n-1]=arguments[n];return o({...u,pathname:e},...t)},usePathname:function(){return i()},useRouter:a}}export{u as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{extends as e}from"../../_virtual/_rollupPluginBabelHelpers.js";import r from"react";import t from"./ServerLink.js";import o from"./serverRedirect.js";function n(n){function u(e){return()=>{throw new Error("`".concat(e,"` is not supported in Server Components. You can use this hook if you convert the component to a Client Component."))}}return{Link:function(o){return r.createElement(t,e({localePrefix:n.localePrefix},o))},redirect:function(e){for(var r=arguments.length,t=new Array(r>1?r-1:0),u=1;u<r;u++)t[u-1]=arguments[u];return o({...n,pathname:e},...t)},usePathname:u("usePathname"),useRouter:u("useRouter")}}export{n as default};
|
|
1
|
+
import{extends as e}from"../../_virtual/_rollupPluginBabelHelpers.js";import r from"react";import t from"./ServerLink.js";import o from"./serverRedirect.js";function n(n){function u(e){return()=>{throw new Error("`".concat(e,"` is not supported in Server Components. You can use this hook if you convert the component to a Client Component."))}}return{Link:function(o){return r.createElement(t,e({localePrefix:null==n?void 0:n.localePrefix},o))},redirect:function(e){for(var r=arguments.length,t=new Array(r>1?r-1:0),u=1;u<r;u++)t[u-1]=arguments[u];return o({...n,pathname:e},...t)},usePathname:u("usePathname"),useRouter:u("useRouter")}}export{n as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("./utils.js");exports.default=function(a){var t;let{config:o,localizedPathnames:n,request:l,resolvedLocale:r}=a;const c=l.nextUrl.clone(),s=e.getHost(l.headers);function p(a,t){return l.nextUrl.basePath&&((a=new URL(a)).pathname=e.applyBasePath(a.pathname,l.nextUrl.basePath)),"<".concat(a.toString(),'>; rel="alternate"; hreflang="').concat(t,'"')}function i(a,t){return n&&"object"==typeof n?e.formatTemplatePathname(a,n[r],n[t]):a}s&&(c.port="",c.host=s),c.protocol=null!==(t=l.headers.get("x-forwarded-proto"))&&void 0!==t?t:c.protocol,c.pathname=e.getNormalizedPathname(c.pathname,o.locales);const
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("./utils.js");exports.default=function(a){var t;let{config:o,localizedPathnames:n,request:l,resolvedLocale:r}=a;const c=l.nextUrl.clone(),s=e.getHost(l.headers);function p(a,t){return l.nextUrl.basePath&&((a=new URL(a)).pathname=e.applyBasePath(a.pathname,l.nextUrl.basePath)),"<".concat(a.toString(),'>; rel="alternate"; hreflang="').concat(t,'"')}function i(a,t){return n&&"object"==typeof n?e.formatTemplatePathname(a,n[r],n[t]):a}s&&(c.port="",c.host=s),c.protocol=null!==(t=l.headers.get("x-forwarded-proto"))&&void 0!==t?t:c.protocol,c.pathname=e.getNormalizedPathname(c.pathname,o.locales);const h=o.locales.flatMap((a=>{function t(e){return"/"===e?"/".concat(a):"/".concat(a).concat(e)}let l;if(o.domains){return(o.domains.filter((t=>e.isLocaleSupportedOnDomain(a,t)))||[]).map((e=>(l=new URL(c),l.port="",l.host=e.domain,l.pathname=i(c.pathname,a),a===e.defaultLocale&&"always"!==o.localePrefix||(l.pathname=t(l.pathname)),p(l,a))))}{let e;e=n&&"object"==typeof n?i(c.pathname,a):c.pathname,a===o.defaultLocale&&"always"!==o.localePrefix||(e=t(e)),l=new URL(e,c)}return p(l,a)}));if(!o.domains&&("always"!==o.localePrefix||"/"===c.pathname)){const e=new URL(i(c.pathname,o.defaultLocale),c);h.push(p(e,"x-default"))}return h.join(", ")};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../_virtual/_rollupPluginBabelHelpers.js"),r=require("react"),t=require("./ClientLink.js"),u=require("./clientRedirect.js"),n=require("./useBasePathname.js"),a=require("./useBaseRouter.js");function
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../_virtual/_rollupPluginBabelHelpers.js"),r=require("react"),t=require("./ClientLink.js"),u=require("./clientRedirect.js"),n=require("./useBasePathname.js"),a=require("./useBaseRouter.js");function l(e){return e&&e.__esModule?e:{default:e}}var i=l(r);exports.default=function(l){function s(r,u){return i.default.createElement(t.default,e.extends({ref:u,localePrefix:null==l?void 0:l.localePrefix},r))}const f=r.forwardRef(s);return f.displayName="Link",{Link:f,redirect:function(e){for(var r=arguments.length,t=new Array(r>1?r-1:0),n=1;n<r;n++)t[n-1]=arguments[n];return u.default({...l,pathname:e},...t)},usePathname:function(){return n.default()},useRouter:a.default}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../_virtual/_rollupPluginBabelHelpers.js"),r=require("react"),t=require("./ServerLink.js"),n=require("./serverRedirect.js");function u(e){return e&&e.__esModule?e:{default:e}}var o=u(r);exports.default=function(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 component to a Client Component."))}}return{Link:function(n){return o.default.createElement(t.default,e.extends({localePrefix:r.localePrefix},n))},redirect:function(e){for(var t=arguments.length,u=new Array(t>1?t-1:0),o=1;o<t;o++)u[o-1]=arguments[o];return n.default({...r,pathname:e},...u)},usePathname:u("usePathname"),useRouter:u("useRouter")}};
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../_virtual/_rollupPluginBabelHelpers.js"),r=require("react"),t=require("./ServerLink.js"),n=require("./serverRedirect.js");function u(e){return e&&e.__esModule?e:{default:e}}var o=u(r);exports.default=function(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 component to a Client Component."))}}return{Link:function(n){return o.default.createElement(t.default,e.extends({localePrefix:null==r?void 0:r.localePrefix},n))},redirect:function(e){for(var t=arguments.length,u=new Array(t>1?t-1:0),o=1;o<t;o++)u[o-1]=arguments[o];return n.default({...r,pathname:e},...u)},usePathname:u("usePathname"),useRouter:u("useRouter")}};
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
import React, { ReactElement } from 'react';
|
|
3
3
|
import { AllLocales, LocalePrefix } from '../../shared/types';
|
|
4
4
|
import useBaseRouter from './useBaseRouter';
|
|
5
|
-
export default function createSharedPathnamesNavigation<Locales extends AllLocales>(opts
|
|
6
|
-
locales
|
|
5
|
+
export default function createSharedPathnamesNavigation<Locales extends AllLocales>(opts?: {
|
|
6
|
+
locales?: Locales;
|
|
7
7
|
localePrefix?: LocalePrefix;
|
|
8
8
|
}): {
|
|
9
9
|
Link: (props: Omit<Omit<Omit<Omit<Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, keyof {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React, { ComponentProps } from 'react';
|
|
2
2
|
import { AllLocales, LocalePrefix } from '../../shared/types';
|
|
3
3
|
import ServerLink from './ServerLink';
|
|
4
|
-
export default function createSharedPathnamesNavigation<Locales extends AllLocales>(opts
|
|
5
|
-
locales
|
|
4
|
+
export default function createSharedPathnamesNavigation<Locales extends AllLocales>(opts?: {
|
|
5
|
+
locales?: Locales;
|
|
6
6
|
localePrefix?: LocalePrefix;
|
|
7
7
|
}): {
|
|
8
8
|
Link: (props: ComponentProps<typeof ServerLink<Locales>>) => React.JSX.Element;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "next-intl",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.5.1",
|
|
4
4
|
"sideEffects": false,
|
|
5
5
|
"author": "Jan Amann <jan@amann.work>",
|
|
6
6
|
"funding": [
|
|
@@ -82,7 +82,7 @@
|
|
|
82
82
|
"dependencies": {
|
|
83
83
|
"@formatjs/intl-localematcher": "^0.2.32",
|
|
84
84
|
"negotiator": "^0.6.3",
|
|
85
|
-
"use-intl": "^3.
|
|
85
|
+
"use-intl": "^3.5.1"
|
|
86
86
|
},
|
|
87
87
|
"peerDependencies": {
|
|
88
88
|
"next": "^10.0.0 || ^11.0.0 || ^12.0.0 || ^13.0.0 || ^14.0.0",
|
|
@@ -122,11 +122,11 @@
|
|
|
122
122
|
},
|
|
123
123
|
{
|
|
124
124
|
"path": "dist/production/navigation.react-client.js",
|
|
125
|
-
"limit": "2.
|
|
125
|
+
"limit": "2.83 KB"
|
|
126
126
|
},
|
|
127
127
|
{
|
|
128
128
|
"path": "dist/production/navigation.react-server.js",
|
|
129
|
-
"limit": "2.
|
|
129
|
+
"limit": "2.94 KB"
|
|
130
130
|
},
|
|
131
131
|
{
|
|
132
132
|
"path": "dist/production/server.react-client.js",
|
|
@@ -138,8 +138,8 @@
|
|
|
138
138
|
},
|
|
139
139
|
{
|
|
140
140
|
"path": "dist/production/middleware.js",
|
|
141
|
-
"limit": "5.
|
|
141
|
+
"limit": "5.81 KB"
|
|
142
142
|
}
|
|
143
143
|
],
|
|
144
|
-
"gitHead": "
|
|
144
|
+
"gitHead": "b768a063cf25cdcac04d159c38f4af2b72b4c06d"
|
|
145
145
|
}
|