next-intl 3.5.0 → 3.5.2
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/shared/constants.js +1 -1
- package/dist/esm/middleware/getAlternateLinksHeaderValue.js +1 -1
- package/dist/esm/shared/constants.js +1 -1
- package/dist/production/middleware/getAlternateLinksHeaderValue.js +1 -1
- package/dist/production/shared/constants.js +1 -1
- package/dist/types/src/shared/constants.d.ts +1 -1
- package/package.json +4 -4
|
@@ -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
|
}
|
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
6
6
|
// https://nextjs.org/docs/advanced-features/i18n-routing#leveraging-the-next_locale-cookie
|
|
7
7
|
const COOKIE_LOCALE_NAME = 'NEXT_LOCALE';
|
|
8
8
|
const COOKIE_MAX_AGE = 31536000; // 1 year
|
|
9
|
-
const COOKIE_SAME_SITE = '
|
|
9
|
+
const COOKIE_SAME_SITE = 'lax';
|
|
10
10
|
|
|
11
11
|
// Should take precedence over the cookie
|
|
12
12
|
const HEADER_LOCALE_NAME = 'X-NEXT-INTL-LOCALE';
|
|
@@ -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
|
-
const L="NEXT_LOCALE",
|
|
1
|
+
const L="NEXT_LOCALE",E=31536e3,e="lax",l="X-NEXT-INTL-LOCALE",o="locale";export{L as COOKIE_LOCALE_NAME,E as COOKIE_MAX_AGE,e as COOKIE_SAME_SITE,l as HEADER_LOCALE_NAME,o as LOCALE_SEGMENT_NAME};
|
|
@@ -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});exports.COOKIE_LOCALE_NAME="NEXT_LOCALE",exports.COOKIE_MAX_AGE=31536e3,exports.COOKIE_SAME_SITE="
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});exports.COOKIE_LOCALE_NAME="NEXT_LOCALE",exports.COOKIE_MAX_AGE=31536e3,exports.COOKIE_SAME_SITE="lax",exports.HEADER_LOCALE_NAME="X-NEXT-INTL-LOCALE",exports.LOCALE_SEGMENT_NAME="locale";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export declare const COOKIE_LOCALE_NAME = "NEXT_LOCALE";
|
|
2
2
|
export declare const COOKIE_MAX_AGE = 31536000;
|
|
3
|
-
export declare const COOKIE_SAME_SITE = "
|
|
3
|
+
export declare const COOKIE_SAME_SITE = "lax";
|
|
4
4
|
export declare const COOKIE_BASE_PATH_NAME = "NEXT_INTL_BASE_PATH";
|
|
5
5
|
export declare const HEADER_LOCALE_NAME = "X-NEXT-INTL-LOCALE";
|
|
6
6
|
export declare const LOCALE_SEGMENT_NAME = "locale";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "next-intl",
|
|
3
|
-
"version": "3.5.
|
|
3
|
+
"version": "3.5.2",
|
|
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.2"
|
|
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": "6aec1c0f1f944fa97730f3564831d039b4b059a8"
|
|
145
145
|
}
|