next-intl 3.5.0 → 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.
|
@@ -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
|
}
|
|
@@ -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
|
-
"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(", ")};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "next-intl",
|
|
3
|
-
"version": "3.5.
|
|
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.5.
|
|
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",
|
|
@@ -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
|
}
|