next-intl 3.21.0-canary.0 → 3.21.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/middleware.js +6 -6
- package/dist/development/middleware/resolveLocale.js +7 -2
- package/dist/development/navigation/react-client/ClientLink.js +2 -2
- package/dist/development/navigation/react-client/useBasePathname.js +14 -0
- package/dist/development/navigation/react-server/ServerLink.js +2 -4
- package/dist/development/navigation/react-server/createLocalizedPathnamesNavigation.js +4 -4
- package/dist/development/navigation/react-server/redirects.js +2 -2
- package/dist/development/navigation/shared/BaseLink.js +25 -28
- package/dist/development/navigation/shared/redirects.js +0 -3
- package/dist/development/navigation/shared/utils.js +1 -40
- package/dist/development/navigation.react-client.js +0 -2
- package/dist/development/navigation.react-server.js +0 -2
- package/dist/development/react-client/index.js +2 -0
- package/dist/development/routing/config.js +1 -1
- package/dist/development/server/react-server/RequestLocale.js +25 -15
- package/dist/development/server/react-server/getConfig.js +17 -15
- package/dist/development/server/react-server/getRequestConfig.js +1 -1
- package/dist/development/server.react-server.js +2 -2
- package/dist/esm/middleware/middleware.js +1 -1
- package/dist/esm/middleware/resolveLocale.js +1 -1
- package/dist/esm/navigation/react-client/ClientLink.js +1 -1
- package/dist/esm/navigation/react-client/useBasePathname.js +1 -0
- package/dist/esm/navigation/react-server/ServerLink.js +1 -1
- package/dist/esm/navigation/react-server/createLocalizedPathnamesNavigation.js +1 -1
- package/dist/esm/navigation/react-server/redirects.js +1 -1
- package/dist/esm/navigation/shared/BaseLink.js +1 -1
- package/dist/esm/navigation/shared/utils.js +1 -1
- package/dist/esm/navigation.react-client.js +1 -1
- package/dist/esm/navigation.react-server.js +1 -1
- package/dist/esm/routing/config.js +1 -1
- package/dist/esm/server/react-server/RequestLocale.js +1 -1
- package/dist/esm/server/react-server/getConfig.js +1 -1
- package/dist/esm/server.react-server.js +1 -1
- package/dist/production/middleware/middleware.js +1 -1
- package/dist/production/middleware/resolveLocale.js +1 -1
- package/dist/production/navigation/react-client/ClientLink.js +1 -1
- package/dist/production/navigation/react-client/useBasePathname.js +1 -0
- package/dist/production/navigation/react-server/ServerLink.js +1 -1
- package/dist/production/navigation/react-server/createLocalizedPathnamesNavigation.js +1 -1
- package/dist/production/navigation/react-server/redirects.js +1 -1
- package/dist/production/navigation/shared/BaseLink.js +1 -1
- package/dist/production/navigation/shared/utils.js +1 -1
- package/dist/production/navigation.react-client.js +1 -1
- package/dist/production/navigation.react-server.js +1 -1
- package/dist/production/routing/config.js +1 -1
- package/dist/production/server/react-server/RequestLocale.js +1 -1
- package/dist/production/server/react-server/getConfig.js +1 -1
- package/dist/production/server.react-server.js +1 -1
- package/dist/types/src/middleware/getAlternateLinksHeaderValue.d.ts +3 -3
- package/dist/types/src/middleware/middleware.d.ts +2 -2
- package/dist/types/src/middleware/resolveLocale.d.ts +2 -2
- package/dist/types/src/middleware/utils.d.ts +4 -4
- package/dist/types/src/navigation/react-client/ClientLink.d.ts +6 -6
- package/dist/types/src/navigation/react-client/createLocalizedPathnamesNavigation.d.ts +4 -12
- package/dist/types/src/navigation/react-client/createSharedPathnamesNavigation.d.ts +4 -4
- package/dist/types/src/navigation/react-client/index.d.ts +0 -1
- package/dist/types/src/navigation/react-client/redirects.d.ts +4 -4
- package/dist/types/src/navigation/react-client/useBasePathname.d.ts +15 -2
- package/dist/types/src/navigation/react-client/useBaseRouter.d.ts +2 -2
- package/dist/types/src/navigation/react-server/ServerLink.d.ts +5 -5
- package/dist/types/src/navigation/react-server/createLocalizedPathnamesNavigation.d.ts +4 -12
- package/dist/types/src/navigation/react-server/createSharedPathnamesNavigation.d.ts +3 -3
- package/dist/types/src/navigation/react-server/index.d.ts +0 -1
- package/dist/types/src/navigation/react-server/redirects.d.ts +4 -4
- package/dist/types/src/navigation/shared/BaseLink.d.ts +6 -11
- package/dist/types/src/navigation/shared/redirects.d.ts +5 -5
- package/dist/types/src/navigation/shared/utils.d.ts +3 -10
- package/dist/types/src/react-server/getTranslator.d.ts +9 -0
- package/dist/types/src/routing/config.d.ts +11 -19
- package/dist/types/src/routing/defineRouting.d.ts +2 -2
- package/dist/types/src/routing/types.d.ts +4 -4
- package/dist/types/src/server/react-server/RequestLocale.d.ts +2 -1
- package/dist/types/src/server/react-server/createRequestConfig.d.ts +3 -2
- package/dist/types/src/server/react-server/getRequestConfig.d.ts +6 -32
- package/dist/types/src/server/react-server/getTranslations.d.ts +9 -0
- package/dist/types/src/server/react-server/index.d.ts +1 -1
- package/dist/types/src/shared/types.d.ts +0 -3
- package/dist/types/src/shared/utils.d.ts +2 -2
- package/package.json +3 -3
- package/dist/development/navigation/react-client/createNavigation.js +0 -83
- package/dist/development/navigation/react-server/createNavigation.js +0 -30
- package/dist/development/navigation/shared/LegacyBaseLink.js +0 -55
- package/dist/development/navigation/shared/createSharedNavigationFns.js +0 -147
- package/dist/development/server/react-server/RequestLocaleCache.js +0 -23
- package/dist/development/server/react-server/RequestLocaleLegacy.js +0 -43
- package/dist/esm/navigation/react-client/createNavigation.js +0 -1
- package/dist/esm/navigation/react-server/createNavigation.js +0 -1
- package/dist/esm/navigation/shared/LegacyBaseLink.js +0 -2
- package/dist/esm/navigation/shared/createSharedNavigationFns.js +0 -1
- package/dist/esm/server/react-server/RequestLocaleCache.js +0 -1
- package/dist/esm/server/react-server/RequestLocaleLegacy.js +0 -1
- package/dist/production/navigation/react-client/createNavigation.js +0 -1
- package/dist/production/navigation/react-server/createNavigation.js +0 -1
- package/dist/production/navigation/shared/LegacyBaseLink.js +0 -2
- package/dist/production/navigation/shared/createSharedNavigationFns.js +0 -1
- package/dist/production/server/react-server/RequestLocaleCache.js +0 -1
- package/dist/production/server/react-server/RequestLocaleLegacy.js +0 -1
- package/dist/types/src/navigation/createNavigation.test.d.ts +0 -1
- package/dist/types/src/navigation/react-client/createNavigation.d.ts +0 -467
- package/dist/types/src/navigation/react-client/createNavigation.test.d.ts +0 -1
- package/dist/types/src/navigation/react-server/createNavigation.d.ts +0 -385
- package/dist/types/src/navigation/react-server/createNavigation.test.d.ts +0 -1
- package/dist/types/src/navigation/shared/LegacyBaseLink.d.ts +0 -10
- package/dist/types/src/navigation/shared/createSharedNavigationFns.d.ts +0 -382
- package/dist/types/src/server/react-server/RequestLocaleCache.d.ts +0 -2
- package/dist/types/src/server/react-server/RequestLocaleLegacy.d.ts +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{getSortedPathnames as
|
|
1
|
+
import{getSortedPathnames as t,matchesPathname as n,normalizeTrailingSlash as r}from"../../shared/utils.js";function e(t){return"string"==typeof t?{pathname:t}:t}function o(t){function n(t){return String(t)}const r=new URLSearchParams;for(const[e,o]of Object.entries(t))Array.isArray(o)?o.forEach((t=>{r.append(e,n(t))})):r.set(e,n(o));return"?"+r.toString()}function a(t){let{pathname:n,locale:e,params:a,pathnames:c,query:i}=t;function s(t){let n=c[t];return n||(n=t),n}function f(t){const n="string"==typeof t?t:t[e];let c=n;if(a&&Object.entries(a).forEach((t=>{let n,r,[e,o]=t;Array.isArray(o)?(n="(\\[)?\\[...".concat(e,"\\](\\])?"),r=o.map((t=>String(t))).join("/")):(n="\\[".concat(e,"\\]"),r=String(o)),c=c.replace(new RegExp(n,"g"),r)})),c=c.replace(/\[\[\.\.\..+\]\]/g,""),c=r(c),c.includes("["))throw new Error("Insufficient params provided for localized pathname.\nTemplate: ".concat(n,"\nParams: ").concat(JSON.stringify(a)));return i&&(c+=o(i)),c}if("string"==typeof n){return f(s(n))}{const{pathname:t,...r}=n;return{...r,pathname:f(s(t))}}}function c(r,e,o){const a=t(Object.keys(o)),c=decodeURI(e);for(const t of a){const e=o[t];if("string"==typeof e){if(n(e,c))return t}else if(n(e[r],c))return t}return e}function i(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:window.location.pathname;return"/"===t?n:n.replace(t,"")}export{a as compileLocalizedPathname,i as getBasePath,c as getRoute,e as normalizeNameOrNameWithParams,o as serializeSearchParams};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{default as createSharedPathnamesNavigation}from"./navigation/react-client/createSharedPathnamesNavigation.js";export{default as createLocalizedPathnamesNavigation}from"./navigation/react-client/createLocalizedPathnamesNavigation.js";
|
|
1
|
+
export{default as createSharedPathnamesNavigation}from"./navigation/react-client/createSharedPathnamesNavigation.js";export{default as createLocalizedPathnamesNavigation}from"./navigation/react-client/createLocalizedPathnamesNavigation.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{default as createSharedPathnamesNavigation}from"./navigation/react-server/createSharedPathnamesNavigation.js";export{default as createLocalizedPathnamesNavigation}from"./navigation/react-server/createLocalizedPathnamesNavigation.js";
|
|
1
|
+
export{default as createSharedPathnamesNavigation}from"./navigation/react-server/createSharedPathnamesNavigation.js";export{default as createLocalizedPathnamesNavigation}from"./navigation/react-server/createLocalizedPathnamesNavigation.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function e(e){return{...e,localePrefix:o(
|
|
1
|
+
function e(e){return{...e,localePrefix:o(e.localePrefix)}}function o(e){return"object"==typeof e?e:{mode:e||"always"}}export{o as receiveLocalePrefixConfig,e as receiveRoutingConfig};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{headers as
|
|
1
|
+
import{headers as e}from"next/headers";import{notFound as t}from"next/navigation";import{cache as n}from"react";import{HEADER_LOCALE_NAME as o}from"../../shared/constants.js";const r=n((function(){let n;try{n=e().get(o)}catch(e){throw e instanceof Error&&"DYNAMIC_SERVER_USAGE"===e.digest?new Error("Usage of next-intl APIs in Server Components currently opts into dynamic rendering. This limitation will eventually be lifted, but as a stopgap solution, you can use the `unstable_setRequestLocale` API to enable static rendering, see https://next-intl-docs.vercel.app/docs/getting-started/app-router/with-i18n-routing#static-rendering",{cause:e}):e}return n||(console.error("\nUnable to find `next-intl` locale because the middleware didn't run on this request. See https://next-intl-docs.vercel.app/docs/routing/middleware#unable-to-find-locale. The `notFound()` function will be called as a result.\n"),t()),n}));const i=n((function(){return{locale:void 0}}));function a(e){i().locale=e}function l(){return i().locale||r()}export{l as getRequestLocale,a as setRequestLocale};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{cache as e}from"react";import{_createIntlFormatters as t,_createCache as o,initializeConfig as n}from"use-intl/core";import{getRequestLocale as r}from"./RequestLocale.js";import a from"next-intl/config";const i=e((function(){return new Date}));const s=e((function(){return Intl.DateTimeFormat().resolvedOptions().timeZone}));const c=e((async function(e,t){if("function"!=typeof e)throw new Error("Invalid i18n request configuration detected.\n\nPlease verify that:\n1. In case you've specified a custom location in your Next.js config, make sure that the path is correct.\n2. You have a default export in your i18n request configuration file.\n\nSee also: https://next-intl-docs.vercel.app/docs/usage/configuration#i18n-request\n");let o=!1;const n={get locale(){return o=!0,t||r()}};let a=e(n);return a instanceof Promise&&(a=await a),o?a.locale&&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"):a.locale||console.error("\nYou haven't read the `locale` param that was passed to `getRequestConfig` and also haven't 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"),{...a,locale:a.locale||n.locale,now:a.now||i(),timeZone:a.timeZone||s()}})),u=e(t),l=e(o);const p=e((async function(e){const t=await c(a,e);return{...n(t),_formatters:u(l())}}));export{p as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{default as getRequestConfig}from"./server/react-server/getRequestConfig.js";export{default as getFormatter}from"./server/react-server/getFormatter.js";export{default as getMessages}from"./server/react-server/getMessages.js";export{default as getNow}from"./server/react-server/getNow.js";export{default as getTimeZone}from"./server/react-server/getTimeZone.js";export{default as getTranslations}from"./server/react-server/getTranslations.js";export{default as getLocale}from"./server/react-server/getLocale.js";export{
|
|
1
|
+
export{default as getRequestConfig}from"./server/react-server/getRequestConfig.js";export{default as getFormatter}from"./server/react-server/getFormatter.js";export{default as getMessages}from"./server/react-server/getMessages.js";export{default as getNow}from"./server/react-server/getNow.js";export{default as getTimeZone}from"./server/react-server/getTimeZone.js";export{default as getTranslations}from"./server/react-server/getTranslations.js";export{default as getLocale}from"./server/react-server/getLocale.js";export{setRequestLocale as unstable_setRequestLocale}from"./server/react-server/RequestLocale.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("next/server"),a=require("../routing/config.js"),t=require("../shared/constants.js"),l=require("../shared/utils.js"),n=require("./getAlternateLinksHeaderValue.js"),o=require("./resolveLocale.js"),r=require("./syncCookie.js"),i=require("./utils.js");exports.default=function(s,c){var d,
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("next/server"),a=require("../routing/config.js"),t=require("../shared/constants.js"),l=require("../shared/utils.js"),n=require("./getAlternateLinksHeaderValue.js"),o=require("./resolveLocale.js"),r=require("./syncCookie.js"),i=require("./utils.js");exports.default=function(s,c){var d,h,m,f;const u=a.receiveRoutingConfig(s),x={alternateLinks:null===(d=null!==(h=null==c?void 0:c.alternateLinks)&&void 0!==h?h:s.alternateLinks)||void 0===d||d,localeDetection:null===(m=null!==(f=null==c?void 0:c.localeDetection)&&void 0!==f?f:null==s?void 0:s.localeDetection)||void 0===m||m};return function(a){var s;let c;try{c=decodeURI(a.nextUrl.pathname)}catch(a){return e.NextResponse.next()}const d=i.sanitizePathname(c),{domain:h,locale:m}=o.default(u,x,a.headers,a.cookies,d),f=h?h.defaultLocale===m:m===u.defaultLocale,P=(null===(s=u.domains)||void 0===s?void 0:s.filter((e=>i.isLocaleSupportedOnDomain(m,e))))||[],p=null!=u.domains&&!h;function v(l){const n=new URL(l,a.url);a.nextUrl.basePath&&(n.pathname=i.applyBasePath(n.pathname,a.nextUrl.basePath));const o=new Headers(a.headers);return o.set(t.HEADER_LOCALE_NAME,m),e.NextResponse.rewrite(n,{request:{headers:o}})}function g(t,n){const o=new URL(l.normalizeTrailingSlash(t),a.url);if(P.length>0&&!n){const e=i.getBestMatchingDomain(h,m,P);e&&(n=e.domain,e.defaultLocale===m&&"as-needed"===u.localePrefix.mode&&(o.pathname=i.getNormalizedPathname(o.pathname,u.locales,u.localePrefix)))}var r,s;n&&(o.host=n,a.headers.get("x-forwarded-host")&&(o.protocol=null!==(r=a.headers.get("x-forwarded-proto"))&&void 0!==r?r:a.nextUrl.protocol,o.port=null!==(s=a.headers.get("x-forwarded-port"))&&void 0!==s?s:""));return a.nextUrl.basePath&&(o.pathname=i.applyBasePath(o.pathname,a.nextUrl.basePath)),e.NextResponse.redirect(o.toString())}const L=i.getNormalizedPathname(d,u.locales,u.localePrefix),U=i.getPathnameMatch(d,u.locales,u.localePrefix),q=null!=U,j="never"===u.localePrefix.mode||f&&"as-needed"===u.localePrefix.mode;let k,D,R=L;if("pathnames"in u){let e;if([e,D]=i.getInternalTemplate(u.pathnames,L,m),D){const t=u.pathnames[D],n="string"==typeof t?t:t[m];if(l.matchesPathname(n,L))R=i.formatTemplatePathname(L,n,D);else{let o;o=e?"string"==typeof t?t:t[e]:D;const r=j?void 0:l.getLocalePrefix(m,u.localePrefix),s=i.formatTemplatePathname(L,o,n);k=g(i.formatPathname(s,r,a.nextUrl.search))}}}if(!k)if("/"!==R||q){const e=i.formatPathname(R,i.getLocaleAsPrefix(m),a.nextUrl.search);if(q){const t=i.formatPathname(L,U.prefix,a.nextUrl.search);if("never"===u.localePrefix.mode)k=g(i.formatPathname(L,void 0,a.nextUrl.search));else if(U.exact)if(f&&j)k=g(i.formatPathname(L,void 0,a.nextUrl.search));else if(u.domains){const a=i.getBestMatchingDomain(h,U.locale,P);k=(null==h?void 0:h.domain)===(null==a?void 0:a.domain)||p?v(e):g(t,null==a?void 0:a.domain)}else k=v(e);else k=g(t)}else k=j?v(e):g(i.formatPathname(L,l.getLocalePrefix(m,u.localePrefix),a.nextUrl.search))}else k=j?v(i.formatPathname(R,i.getLocaleAsPrefix(m),a.nextUrl.search)):g(i.formatPathname(L,l.getLocalePrefix(m,u.localePrefix),a.nextUrl.search));var w;(x.localeDetection&&r.default(a,k,m),"never"!==u.localePrefix.mode&&x.alternateLinks&&u.locales.length>1)&&k.headers.set("Link",n.default({routing:u,localizedPathnames:null!=D&&"pathnames"in u?null===(w=u.pathnames)||void 0===w?void 0:w[D]:void 0,request:a,resolvedLocale:m}));return k}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@formatjs/intl-localematcher"),t=require("negotiator"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@formatjs/intl-localematcher"),t=require("negotiator"),l=require("../shared/constants.js"),o=require("./utils.js");function a(e){return e&&e.__esModule?e:{default:e}}var n=a(t);function c(t,l,o){let a;const c=new n.default({headers:{"accept-language":t.get("accept-language")||void 0}}).languages();try{const t=function(e){return e.slice().sort(((e,t)=>t.length-e.length))}(l);a=e.match(c,t,o)}catch(e){}return a}function r(e,t){if(e.has(l.COOKIE_LOCALE_NAME)){var o;const a=null===(o=e.get(l.COOKIE_LOCALE_NAME))||void 0===o?void 0:o.value;if(a&&t.includes(a))return a}}function i(e,t,l,a,n){let i,{defaultLocale:u,localePrefix:s,locales:d}=e,{localeDetection:f}=t;var g;n&&(i=null===(g=o.getPathnameMatch(n,d,s))||void 0===g?void 0:g.locale);return!i&&f&&a&&(i=r(a,d)),!i&&f&&l&&(i=c(l,d,u)),i||(i=u),i}function u(e,t,l,a,n){const u=function(e,t){var l;let a=o.getHost(e);if(a=null===(l=a)||void 0===l?void 0:l.replace(/:\d+$/,""),a&&t)return t.find((e=>e.domain===a))}(l,e.domains);if(!u)return{locale:i(e,t,l,a,n)};let s;if(n){var d;const t=null===(d=o.getPathnameMatch(n,e.locales,e.localePrefix))||void 0===d?void 0:d.locale;if(t){if(!o.isLocaleSupportedOnDomain(t,u))return{locale:t,domain:u};s=t}}if(!s&&t.localeDetection&&a){const t=r(a,e.locales);t&&o.isLocaleSupportedOnDomain(t,u)&&(s=t)}if(!s&&t.localeDetection&&l){const t=c(l,u.locales||e.locales,u.defaultLocale);t&&(s=t)}return s||(s=u.defaultLocale),{locale:s,domain:u}}exports.default=function(e,t,l,o,a){if(e.domains){return u(e,t,l,o,a)}return{locale:i(e,t,l,o,a)}},exports.getAcceptLanguageLocale=c;
|
|
@@ -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/
|
|
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 +1,2 @@
|
|
|
1
|
+
"use client";
|
|
1
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 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../_virtual/_rollupPluginBabelHelpers.js"),r=require("react"),l=require("../../shared/utils.js"),t=require("../shared/
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../_virtual/_rollupPluginBabelHelpers.js"),r=require("react"),l=require("../../shared/utils.js"),t=require("../shared/BaseLink.js"),a=require("../../server/react-server/getLocale.js");function u(e){return e&&e.__esModule?e:{default:e}}var s=u(r);exports.default=async function(r){let{locale:u,localePrefix:i,...o}=r;const c=u||await a.default(),d=l.getLocalePrefix(c,i);return s.default.createElement(t.default,e.extends({locale:c,localePrefixMode:i.mode,prefix:d},o))};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../_virtual/_rollupPluginBabelHelpers.js"),r=require("react"),t=require("../../routing/config.js"),a=require("../../server/react-server/
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../_virtual/_rollupPluginBabelHelpers.js"),r=require("react"),t=require("../../routing/config.js"),a=require("../../server/react-server/RequestLocale.js"),n=require("../shared/utils.js"),o=require("./ServerLink.js"),l=require("./redirects.js");function c(e){return e&&e.__esModule?e:{default:e}}var i=c(r);exports.default=function(r){const c=t.receiveRoutingConfig(r);function u(e){let{href:r,locale:t}=e;return n.compileLocalizedPathname({...n.normalizeNameOrNameWithParams(r),locale:t,pathnames:c.pathnames})}function s(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(r){let{href:t,locale:l,...u}=r;const s=a.getRequestLocale(),f=l||s;return i.default.createElement(o.default,e.extends({href:n.compileLocalizedPathname({locale:f,pathname:t,params:"object"==typeof t?t.params:void 0,pathnames:c.pathnames}),locale:l,localePrefix:c.localePrefix},u))},redirect:function(e){const r=u({href:e,locale:a.getRequestLocale()});for(var t=arguments.length,n=new Array(t>1?t-1:0),o=1;o<t;o++)n[o-1]=arguments[o];return l.serverRedirect({localePrefix:c.localePrefix,pathname:r},...n)},permanentRedirect:function(e){const r=u({href:e,locale:a.getRequestLocale()});for(var t=arguments.length,n=new Array(t>1?t-1:0),o=1;o<t;o++)n[o-1]=arguments[o];return l.serverPermanentRedirect({localePrefix:c.localePrefix,pathname:r},...n)},getPathname:u,usePathname:s("usePathname"),useRouter:s("useRouter")}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../server/react-server/
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../server/react-server/RequestLocale.js"),r=require("../shared/redirects.js");function t(r){return function(t){const s=e.getRequestLocale();for(var c=arguments.length,n=new Array(c>1?c-1:0),a=1;a<c;a++)n[a-1]=arguments[a];return r({...t,locale:s},...n)}}const s=t(r.baseRedirect),c=t(r.basePermanentRedirect);exports.serverPermanentRedirect=c,exports.serverRedirect=s;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../_virtual/_rollupPluginBabelHelpers.js"),
|
|
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("../../shared/utils.js");function t(e){function t(e){return String(e)}const r=new URLSearchParams;for(const[a
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../shared/utils.js");function t(e){function t(e){return String(e)}const r=new URLSearchParams;for(const[n,a]of Object.entries(e))Array.isArray(a)?a.forEach((e=>{r.append(n,t(e))})):r.set(n,t(a));return"?"+r.toString()}exports.compileLocalizedPathname=function(r){let{pathname:n,locale:a,params:o,pathnames:i,query:s}=r;function c(e){let t=i[e];return t||(t=e),t}function p(r){let n="string"==typeof r?r:r[a];return o&&Object.entries(o).forEach((e=>{let t,r,[a,o]=e;Array.isArray(o)?(t="(\\[)?\\[...".concat(a,"\\](\\])?"),r=o.map((e=>String(e))).join("/")):(t="\\[".concat(a,"\\]"),r=String(o)),n=n.replace(new RegExp(t,"g"),r)})),n=n.replace(/\[\[\.\.\..+\]\]/g,""),n=e.normalizeTrailingSlash(n),s&&(n+=t(s)),n}if("string"==typeof n){return p(c(n))}{const{pathname:e,...t}=n;return{...t,pathname:p(c(e))}}},exports.getBasePath=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:window.location.pathname;return"/"===e?t:t.replace(e,"")},exports.getRoute=function(t,r,n){const a=e.getSortedPathnames(Object.keys(n)),o=decodeURI(r);for(const r of a){const a=n[r];if("string"==typeof a){const t=a;if(e.matchesPathname(t,o))return r}else if(e.matchesPathname(a[t],o))return r}return r},exports.normalizeNameOrNameWithParams=function(e){return"string"==typeof e?{pathname:e}:e},exports.serializeSearchParams=t;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("./navigation/react-client/createSharedPathnamesNavigation.js"),a=require("./navigation/react-client/createLocalizedPathnamesNavigation.js")
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("./navigation/react-client/createSharedPathnamesNavigation.js"),a=require("./navigation/react-client/createLocalizedPathnamesNavigation.js");exports.createSharedPathnamesNavigation=e.default,exports.createLocalizedPathnamesNavigation=a.default;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("./navigation/react-server/createSharedPathnamesNavigation.js"),a=require("./navigation/react-server/createLocalizedPathnamesNavigation.js")
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("./navigation/react-server/createSharedPathnamesNavigation.js"),a=require("./navigation/react-server/createLocalizedPathnamesNavigation.js");exports.createSharedPathnamesNavigation=e.default,exports.createLocalizedPathnamesNavigation=a.default;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";function e(e){return"object"==typeof e?e:{mode:e||"always"}}Object.defineProperty(exports,"__esModule",{value:!0}),exports.receiveLocalePrefixConfig=e,exports.receiveRoutingConfig=function(o){return{...o,localePrefix:e(
|
|
1
|
+
"use strict";function e(e){return"object"==typeof e?e:{mode:e||"always"}}Object.defineProperty(exports,"__esModule",{value:!0}),exports.receiveLocalePrefixConfig=e,exports.receiveRoutingConfig=function(o){return{...o,localePrefix:e(o.localePrefix)}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("next/headers"),t=require("
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("next/headers"),t=require("next/navigation"),n=require("react"),r=require("../../shared/constants.js");const o=n.cache((function(){let n;try{n=e.headers().get(r.HEADER_LOCALE_NAME)}catch(e){throw e instanceof Error&&"DYNAMIC_SERVER_USAGE"===e.digest?new Error("Usage of next-intl APIs in Server Components currently opts into dynamic rendering. This limitation will eventually be lifted, but as a stopgap solution, you can use the `unstable_setRequestLocale` API to enable static rendering, see https://next-intl-docs.vercel.app/docs/getting-started/app-router/with-i18n-routing#static-rendering",{cause:e}):e}return n||t.notFound(),n}));const s=n.cache((function(){return{locale:void 0}}));exports.getRequestLocale=function(){return s().locale||o()},exports.setRequestLocale=function(e){s().locale=e};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),t=require("use-intl/core"),n=require("./RequestLocale.js");function c(e){return e&&e.__esModule?e:{default:e}}var r=c(require("next-intl/config"));const o=e.cache((function(){return new Date}));const a=e.cache((function(){return Intl.DateTimeFormat().resolvedOptions().timeZone}));const i=e.cache((async function(e,t){const c={get locale(){return t||n.getRequestLocale()}};let r=e(c);return r instanceof Promise&&(r=await r),{...r,locale:r.locale||c.locale,now:r.now||o(),timeZone:r.timeZone||a()}})),u=e.cache(t._createIntlFormatters),s=e.cache(t._createCache);const l=e.cache((async function(e){const n=await i(r.default,e);return{...t.initializeConfig(n),_formatters:u(s())}}));exports.default=l;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("./server/react-server/getRequestConfig.js"),r=require("./server/react-server/getFormatter.js"),t=require("./server/react-server/getMessages.js"),s=require("./server/react-server/getNow.js"),a=require("./server/react-server/getTimeZone.js"),o=require("./server/react-server/getTranslations.js"),u=require("./server/react-server/getLocale.js"),g=require("./server/react-server/
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("./server/react-server/getRequestConfig.js"),r=require("./server/react-server/getFormatter.js"),t=require("./server/react-server/getMessages.js"),s=require("./server/react-server/getNow.js"),a=require("./server/react-server/getTimeZone.js"),o=require("./server/react-server/getTranslations.js"),u=require("./server/react-server/getLocale.js"),g=require("./server/react-server/RequestLocale.js");exports.getRequestConfig=e.default,exports.getFormatter=r.default,exports.getMessages=t.default,exports.getNow=s.default,exports.getTimeZone=a.default,exports.getTranslations=o.default,exports.getLocale=u.default,exports.unstable_setRequestLocale=g.setRequestLocale;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { NextRequest } from 'next/server';
|
|
2
2
|
import { ResolvedRoutingConfig } from '../routing/config';
|
|
3
|
-
import {
|
|
3
|
+
import { Locales, Pathnames } from '../routing/types';
|
|
4
4
|
/**
|
|
5
5
|
* See https://developers.google.com/search/docs/specialty/international/localized-versions
|
|
6
6
|
*/
|
|
7
|
-
export default function getAlternateLinksHeaderValue<AppLocales extends Locales,
|
|
8
|
-
routing:
|
|
7
|
+
export default function getAlternateLinksHeaderValue<AppLocales extends Locales, AppPathnames extends Pathnames<AppLocales> = never>({ localizedPathnames, request, resolvedLocale, routing }: {
|
|
8
|
+
routing: ResolvedRoutingConfig<AppLocales, AppPathnames>;
|
|
9
9
|
request: NextRequest;
|
|
10
10
|
resolvedLocale: AppLocales[number];
|
|
11
11
|
localizedPathnames?: Pathnames<AppLocales>[string];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { NextRequest, NextResponse } from 'next/server';
|
|
2
2
|
import { RoutingConfig } from '../routing/config';
|
|
3
|
-
import {
|
|
3
|
+
import { Locales, Pathnames } from '../routing/types';
|
|
4
4
|
import { MiddlewareOptions } from './config';
|
|
5
|
-
export default function createMiddleware<AppLocales extends Locales,
|
|
5
|
+
export default function createMiddleware<AppLocales extends Locales, AppPathnames extends Pathnames<AppLocales> = never>(routing: RoutingConfig<AppLocales, AppPathnames> & MiddlewareOptions, options?: MiddlewareOptions): (request: NextRequest) => NextResponse<unknown>;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { RequestCookies } from 'next/dist/server/web/spec-extension/cookies';
|
|
2
2
|
import { ResolvedRoutingConfig } from '../routing/config';
|
|
3
|
-
import { Locales, Pathnames,
|
|
3
|
+
import { Locales, Pathnames, DomainConfig } from '../routing/types';
|
|
4
4
|
import { ResolvedMiddlewareOptions } from './config';
|
|
5
5
|
export declare function getAcceptLanguageLocale<AppLocales extends Locales>(requestHeaders: Headers, locales: AppLocales, defaultLocale: string): string | undefined;
|
|
6
|
-
export default function resolveLocale<AppLocales extends Locales,
|
|
6
|
+
export default function resolveLocale<AppLocales extends Locales, AppPathnames extends Pathnames<AppLocales> = never>(routing: ResolvedRoutingConfig<AppLocales, AppPathnames>, options: ResolvedMiddlewareOptions, requestHeaders: Headers, requestCookies: RequestCookies, pathname: string): {
|
|
7
7
|
locale: AppLocales[number];
|
|
8
8
|
domain?: DomainConfig<AppLocales>;
|
|
9
9
|
};
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { Locales, LocalePrefixConfigVerbose, DomainConfig, Pathnames, DomainsConfig
|
|
1
|
+
import { Locales, LocalePrefixConfigVerbose, DomainConfig, Pathnames, DomainsConfig } from '../routing/types';
|
|
2
2
|
export declare function getFirstPathnameSegment(pathname: string): string;
|
|
3
3
|
export declare function getInternalTemplate<AppLocales extends Locales, AppPathnames extends Pathnames<AppLocales>>(pathnames: AppPathnames, pathname: string, locale: AppLocales[number]): [AppLocales[number] | undefined, keyof AppPathnames | undefined];
|
|
4
4
|
export declare function formatTemplatePathname(sourcePathname: string, sourceTemplate: string, targetTemplate: string, prefix?: string): string;
|
|
5
5
|
/**
|
|
6
6
|
* Removes potential prefixes from the pathname.
|
|
7
7
|
*/
|
|
8
|
-
export declare function getNormalizedPathname<AppLocales extends Locales
|
|
8
|
+
export declare function getNormalizedPathname<AppLocales extends Locales>(pathname: string, locales: AppLocales, localePrefix: LocalePrefixConfigVerbose<AppLocales>): string;
|
|
9
9
|
export declare function findCaseInsensitiveString(candidate: string, strings: Array<string>): string | undefined;
|
|
10
|
-
export declare function getLocalePrefixes<AppLocales extends Locales
|
|
11
|
-
export declare function getPathnameMatch<AppLocales extends Locales
|
|
10
|
+
export declare function getLocalePrefixes<AppLocales extends Locales>(locales: AppLocales, localePrefix: LocalePrefixConfigVerbose<AppLocales>, sort?: boolean): Array<[AppLocales[number], string]>;
|
|
11
|
+
export declare function getPathnameMatch<AppLocales extends Locales>(pathname: string, locales: AppLocales, localePrefix: LocalePrefixConfigVerbose<AppLocales>): {
|
|
12
12
|
locale: AppLocales[number];
|
|
13
13
|
prefix: string;
|
|
14
14
|
matchedPrefix: string;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { ComponentProps, ReactElement } from 'react';
|
|
2
|
-
import { Locales, LocalePrefixConfigVerbose
|
|
3
|
-
import
|
|
4
|
-
type Props<AppLocales extends Locales
|
|
2
|
+
import { Locales, LocalePrefixConfigVerbose } from '../../routing/types';
|
|
3
|
+
import BaseLink from '../shared/BaseLink';
|
|
4
|
+
type Props<AppLocales extends Locales> = Omit<ComponentProps<typeof BaseLink>, 'locale' | 'prefix' | 'localePrefixMode'> & {
|
|
5
5
|
locale?: AppLocales[number];
|
|
6
|
-
localePrefix: LocalePrefixConfigVerbose<AppLocales
|
|
6
|
+
localePrefix: LocalePrefixConfigVerbose<AppLocales>;
|
|
7
7
|
};
|
|
8
8
|
/**
|
|
9
9
|
* Wraps `next/link` and prefixes the `href` with the current locale if
|
|
@@ -25,7 +25,7 @@ type Props<AppLocales extends Locales, AppLocalePrefixMode extends LocalePrefixM
|
|
|
25
25
|
* the `set-cookie` response header would cause the locale cookie on the current
|
|
26
26
|
* page to be overwritten before the user even decides to change the locale.
|
|
27
27
|
*/
|
|
28
|
-
declare const ClientLinkWithRef: <AppLocales extends Locales
|
|
29
|
-
ref?: Props<AppLocales
|
|
28
|
+
declare const ClientLinkWithRef: <AppLocales extends Locales>(props: Props<AppLocales> & {
|
|
29
|
+
ref?: Props<AppLocales>["ref"];
|
|
30
30
|
}) => ReactElement;
|
|
31
31
|
export default ClientLinkWithRef;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import React, { ComponentProps, ReactElement } from 'react';
|
|
2
2
|
import { RoutingConfigLocalizedNavigation } from '../../routing/config';
|
|
3
|
-
import {
|
|
3
|
+
import { Locales, Pathnames } from '../../routing/types';
|
|
4
4
|
import { HrefOrHrefWithParams } from '../shared/utils';
|
|
5
5
|
import ClientLink from './ClientLink';
|
|
6
|
-
export default function createLocalizedPathnamesNavigation<AppLocales extends Locales,
|
|
6
|
+
export default function createLocalizedPathnamesNavigation<AppLocales extends Locales, AppPathnames extends Pathnames<AppLocales>>(routing: RoutingConfigLocalizedNavigation<AppLocales, AppPathnames>): {
|
|
7
7
|
Link: <Pathname extends keyof AppPathnames>(props: (Omit<Omit<Omit<Omit<Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, keyof {
|
|
8
8
|
href: string | import("url").UrlObject;
|
|
9
9
|
as?: string | import("url").UrlObject;
|
|
@@ -35,18 +35,10 @@ export default function createLocalizedPathnamesNavigation<AppLocales extends Lo
|
|
|
35
35
|
} & React.RefAttributes<HTMLAnchorElement>, "locale"> & {
|
|
36
36
|
locale: string;
|
|
37
37
|
prefix: string;
|
|
38
|
-
localePrefixMode: LocalePrefixMode;
|
|
38
|
+
localePrefixMode: import("../../routing/types").LocalePrefixMode;
|
|
39
39
|
}, "ref"> & React.RefAttributes<HTMLAnchorElement>, "locale" | "prefix" | "localePrefixMode"> & {
|
|
40
40
|
locale?: string | undefined;
|
|
41
|
-
localePrefix:
|
|
42
|
-
mode: "never";
|
|
43
|
-
} | {
|
|
44
|
-
mode: "always";
|
|
45
|
-
prefixes?: Partial<Record<string, string>> | undefined;
|
|
46
|
-
} | {
|
|
47
|
-
mode: "as-needed";
|
|
48
|
-
prefixes?: Partial<Record<string, string>> | undefined;
|
|
49
|
-
};
|
|
41
|
+
localePrefix: import("../../routing/types").LocalePrefixConfigVerbose<Locales>;
|
|
50
42
|
} & {
|
|
51
43
|
ref?: React.LegacyRef<HTMLAnchorElement> | undefined;
|
|
52
44
|
}, "localePrefix" | "href" | "name"> & {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { ReactElement } from 'react';
|
|
2
2
|
import { RoutingConfigSharedNavigation } from '../../routing/config';
|
|
3
|
-
import {
|
|
4
|
-
export default function createSharedPathnamesNavigation<AppLocales extends Locales
|
|
3
|
+
import { Locales } from '../../routing/types';
|
|
4
|
+
export default function createSharedPathnamesNavigation<const AppLocales extends Locales>(routing?: RoutingConfigSharedNavigation<AppLocales, never>): {
|
|
5
5
|
Link: (props: Omit<Omit<Omit<Omit<Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, keyof {
|
|
6
6
|
href: string | import("url").UrlObject;
|
|
7
7
|
as?: string | import("url").UrlObject;
|
|
@@ -33,10 +33,10 @@ export default function createSharedPathnamesNavigation<AppLocales extends Local
|
|
|
33
33
|
} & React.RefAttributes<HTMLAnchorElement>, "locale"> & {
|
|
34
34
|
locale: string;
|
|
35
35
|
prefix: string;
|
|
36
|
-
localePrefixMode: LocalePrefixMode;
|
|
36
|
+
localePrefixMode: import("../../routing/types").LocalePrefixMode;
|
|
37
37
|
}, "ref"> & React.RefAttributes<HTMLAnchorElement>, "locale" | "prefix" | "localePrefixMode"> & {
|
|
38
38
|
locale?: AppLocales[number] | undefined;
|
|
39
|
-
localePrefix: import("../../routing/types").LocalePrefixConfigVerbose<AppLocales
|
|
39
|
+
localePrefix: import("../../routing/types").LocalePrefixConfigVerbose<AppLocales>;
|
|
40
40
|
} & {
|
|
41
41
|
ref?: React.LegacyRef<HTMLAnchorElement> | undefined;
|
|
42
42
|
}, "localePrefix"> & {
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
export { default as createSharedPathnamesNavigation } from './createSharedPathnamesNavigation';
|
|
2
2
|
export { default as createLocalizedPathnamesNavigation } from './createLocalizedPathnamesNavigation';
|
|
3
|
-
export { default as createNavigation } from './createNavigation';
|
|
4
3
|
import type { Pathnames as PathnamesDeprecatedExport, Locales } from '../../routing/types';
|
|
5
4
|
/** @deprecated Please import from `next-intl/routing` instead. */
|
|
6
5
|
export type Pathnames<AppLocales extends Locales> = PathnamesDeprecatedExport<AppLocales>;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
export declare const clientRedirect: (params: Omit<Parameters<(<AppLocales extends import("../../routing/types").Locales
|
|
1
|
+
export declare const clientRedirect: (params: Omit<Parameters<(<AppLocales extends import("../../routing/types").Locales>(params: {
|
|
2
2
|
pathname: string;
|
|
3
3
|
locale: import("../../routing/types").Locales[number];
|
|
4
|
-
localePrefix: import("../../routing/types").LocalePrefixConfigVerbose<AppLocales
|
|
4
|
+
localePrefix: import("../../routing/types").LocalePrefixConfigVerbose<AppLocales>;
|
|
5
5
|
}, type?: import("next/navigation").RedirectType | undefined) => never)>[0], "locale">, type?: import("next/navigation").RedirectType | undefined) => never;
|
|
6
|
-
export declare const clientPermanentRedirect: (params: Omit<Parameters<(<AppLocales extends import("../../routing/types").Locales
|
|
6
|
+
export declare const clientPermanentRedirect: (params: Omit<Parameters<(<AppLocales extends import("../../routing/types").Locales>(params: {
|
|
7
7
|
pathname: string;
|
|
8
8
|
locale: import("../../routing/types").Locales[number];
|
|
9
|
-
localePrefix: import("../../routing/types").LocalePrefixConfigVerbose<AppLocales
|
|
9
|
+
localePrefix: import("../../routing/types").LocalePrefixConfigVerbose<AppLocales>;
|
|
10
10
|
}, type?: import("next/navigation").RedirectType | undefined) => never)>[0], "locale">, type?: import("next/navigation").RedirectType | undefined) => never;
|
|
@@ -1,2 +1,15 @@
|
|
|
1
|
-
import { Locales, LocalePrefixConfigVerbose
|
|
2
|
-
|
|
1
|
+
import { Locales, LocalePrefixConfigVerbose } from '../../routing/types';
|
|
2
|
+
/**
|
|
3
|
+
* Returns the pathname without a potential locale prefix.
|
|
4
|
+
*
|
|
5
|
+
* @example
|
|
6
|
+
* ```tsx
|
|
7
|
+
* 'use client';
|
|
8
|
+
*
|
|
9
|
+
* import {usePathname} from 'next-intl/client';
|
|
10
|
+
*
|
|
11
|
+
* // When the user is on `/en`, this will be `/`
|
|
12
|
+
* const pathname = usePathname();
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
15
|
+
export default function useBasePathname<AppLocales extends Locales>(localePrefix: LocalePrefixConfigVerbose<AppLocales>): string | null;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Locales, LocalePrefixConfigVerbose
|
|
1
|
+
import { Locales, LocalePrefixConfigVerbose } from '../../routing/types';
|
|
2
2
|
type IntlNavigateOptions<AppLocales extends Locales> = {
|
|
3
3
|
locale?: AppLocales[number];
|
|
4
4
|
};
|
|
@@ -21,7 +21,7 @@ type IntlNavigateOptions<AppLocales extends Locales> = {
|
|
|
21
21
|
* router.push('/about', {locale: 'de'});
|
|
22
22
|
* ```
|
|
23
23
|
*/
|
|
24
|
-
export default function useBaseRouter<AppLocales extends Locales
|
|
24
|
+
export default function useBaseRouter<AppLocales extends Locales>(localePrefix: LocalePrefixConfigVerbose<AppLocales>): {
|
|
25
25
|
push: (href: string, options?: (import("next/dist/shared/lib/app-router-context.shared-runtime").NavigateOptions & IntlNavigateOptions<AppLocales>) | undefined) => void;
|
|
26
26
|
replace: (href: string, options?: (import("next/dist/shared/lib/app-router-context.shared-runtime").NavigateOptions & IntlNavigateOptions<AppLocales>) | undefined) => void;
|
|
27
27
|
prefetch: (href: string, options?: (import("next/dist/shared/lib/app-router-context.shared-runtime").PrefetchOptions & IntlNavigateOptions<AppLocales>) | undefined) => void;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import React, { ComponentProps } from 'react';
|
|
2
|
-
import { Locales, LocalePrefixConfigVerbose
|
|
3
|
-
import
|
|
4
|
-
type Props<AppLocales extends Locales
|
|
2
|
+
import { Locales, LocalePrefixConfigVerbose } from '../../routing/types';
|
|
3
|
+
import BaseLink from '../shared/BaseLink';
|
|
4
|
+
type Props<AppLocales extends Locales> = Omit<ComponentProps<typeof BaseLink>, 'locale' | 'prefix' | 'localePrefixMode'> & {
|
|
5
5
|
locale?: AppLocales[number];
|
|
6
|
-
localePrefix: LocalePrefixConfigVerbose<AppLocales
|
|
6
|
+
localePrefix: LocalePrefixConfigVerbose<AppLocales>;
|
|
7
7
|
};
|
|
8
|
-
export default function ServerLink<AppLocales extends Locales
|
|
8
|
+
export default function ServerLink<AppLocales extends Locales>({ locale, localePrefix, ...rest }: Props<AppLocales>): Promise<React.JSX.Element>;
|
|
9
9
|
export {};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { RoutingConfigLocalizedNavigation } from '../../routing/config';
|
|
3
|
-
import {
|
|
3
|
+
import { Locales, Pathnames } from '../../routing/types';
|
|
4
4
|
import { HrefOrHrefWithParams } from '../shared/utils';
|
|
5
|
-
export default function createLocalizedPathnamesNavigation<AppLocales extends Locales,
|
|
5
|
+
export default function createLocalizedPathnamesNavigation<AppLocales extends Locales, AppPathnames extends Pathnames<AppLocales>>(routing: RoutingConfigLocalizedNavigation<AppLocales, AppPathnames>): {
|
|
6
6
|
Link: <Pathname extends keyof AppPathnames>({ href, locale, ...rest }: Omit<Omit<Omit<Omit<Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, keyof {
|
|
7
7
|
href: string | import("url").UrlObject;
|
|
8
8
|
as?: string | import("url").UrlObject;
|
|
@@ -34,18 +34,10 @@ export default function createLocalizedPathnamesNavigation<AppLocales extends Lo
|
|
|
34
34
|
} & React.RefAttributes<HTMLAnchorElement>, "locale"> & {
|
|
35
35
|
locale: string;
|
|
36
36
|
prefix: string;
|
|
37
|
-
localePrefixMode: LocalePrefixMode;
|
|
37
|
+
localePrefixMode: import("../../routing/types").LocalePrefixMode;
|
|
38
38
|
}, "ref"> & React.RefAttributes<HTMLAnchorElement>, "locale" | "prefix" | "localePrefixMode"> & {
|
|
39
39
|
locale?: string | undefined;
|
|
40
|
-
localePrefix:
|
|
41
|
-
mode: "never";
|
|
42
|
-
} | {
|
|
43
|
-
mode: "always";
|
|
44
|
-
prefixes?: Partial<Record<string, string>> | undefined;
|
|
45
|
-
} | {
|
|
46
|
-
mode: "as-needed";
|
|
47
|
-
prefixes?: Partial<Record<string, string>> | undefined;
|
|
48
|
-
};
|
|
40
|
+
localePrefix: import("../../routing/types").LocalePrefixConfigVerbose<Locales>;
|
|
49
41
|
}, "localePrefix" | "href" | "name"> & {
|
|
50
42
|
href: Pathname extends `${string}[[...${string}` ? Pathname | ({
|
|
51
43
|
pathname: Pathname;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import React, { ComponentProps } from 'react';
|
|
2
2
|
import { RoutingConfigSharedNavigation } from '../../routing/config';
|
|
3
|
-
import {
|
|
3
|
+
import { Locales } from '../../routing/types';
|
|
4
4
|
import ServerLink from './ServerLink';
|
|
5
|
-
export default function createSharedPathnamesNavigation<AppLocales extends Locales
|
|
6
|
-
Link: (props: Omit<ComponentProps<typeof ServerLink<AppLocales
|
|
5
|
+
export default function createSharedPathnamesNavigation<AppLocales extends Locales>(routing?: RoutingConfigSharedNavigation<AppLocales, never>): {
|
|
6
|
+
Link: (props: Omit<ComponentProps<typeof ServerLink<AppLocales>>, "localePrefix" | "locales">) => React.JSX.Element;
|
|
7
7
|
redirect: (pathname: string, type?: import("next/navigation").RedirectType | undefined) => never;
|
|
8
8
|
permanentRedirect: (pathname: string, type?: import("next/navigation").RedirectType | undefined) => never;
|
|
9
9
|
usePathname: () => never;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
1
|
export { default as createSharedPathnamesNavigation } from './createSharedPathnamesNavigation';
|
|
2
2
|
export { default as createLocalizedPathnamesNavigation } from './createLocalizedPathnamesNavigation';
|
|
3
|
-
export { default as createNavigation } from './createNavigation';
|
|
4
3
|
export type { Pathnames } from '../../routing/types';
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
export declare const serverRedirect: (params: Omit<Parameters<(<AppLocales extends import("../../routing/types").Locales
|
|
1
|
+
export declare const serverRedirect: (params: Omit<Parameters<(<AppLocales extends import("../../routing/types").Locales>(params: {
|
|
2
2
|
pathname: string;
|
|
3
3
|
locale: import("../../routing/types").Locales[number];
|
|
4
|
-
localePrefix: import("../../routing/types").LocalePrefixConfigVerbose<AppLocales
|
|
4
|
+
localePrefix: import("../../routing/types").LocalePrefixConfigVerbose<AppLocales>;
|
|
5
5
|
}, type?: import("next/navigation").RedirectType | undefined) => never)>[0], "locale">, type?: import("next/navigation").RedirectType | undefined) => never;
|
|
6
|
-
export declare const serverPermanentRedirect: (params: Omit<Parameters<(<AppLocales extends import("../../routing/types").Locales
|
|
6
|
+
export declare const serverPermanentRedirect: (params: Omit<Parameters<(<AppLocales extends import("../../routing/types").Locales>(params: {
|
|
7
7
|
pathname: string;
|
|
8
8
|
locale: import("../../routing/types").Locales[number];
|
|
9
|
-
localePrefix: import("../../routing/types").LocalePrefixConfigVerbose<AppLocales
|
|
9
|
+
localePrefix: import("../../routing/types").LocalePrefixConfigVerbose<AppLocales>;
|
|
10
10
|
}, type?: import("next/navigation").RedirectType | undefined) => never)>[0], "locale">, type?: import("next/navigation").RedirectType | undefined) => never;
|
|
@@ -1,15 +1,10 @@
|
|
|
1
1
|
import NextLink from 'next/link';
|
|
2
2
|
import React, { ComponentProps } from 'react';
|
|
3
|
+
import { LocalePrefixMode } from '../../routing/types';
|
|
3
4
|
type Props = Omit<ComponentProps<typeof NextLink>, 'locale'> & {
|
|
4
|
-
locale
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
unprefixed?: {
|
|
8
|
-
domains: {
|
|
9
|
-
[domain: string]: string;
|
|
10
|
-
};
|
|
11
|
-
pathname: string;
|
|
12
|
-
};
|
|
5
|
+
locale: string;
|
|
6
|
+
prefix: string;
|
|
7
|
+
localePrefixMode: LocalePrefixMode;
|
|
13
8
|
};
|
|
14
|
-
declare const
|
|
15
|
-
export default
|
|
9
|
+
declare const BaseLinkWithRef: React.ForwardRefExoticComponent<Omit<Props, "ref"> & React.RefAttributes<HTMLAnchorElement>>;
|
|
10
|
+
export default BaseLinkWithRef;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { Locales, LocalePrefixConfigVerbose
|
|
2
|
-
export declare const baseRedirect: <AppLocales extends Locales
|
|
1
|
+
import { Locales, LocalePrefixConfigVerbose } from '../../routing/types';
|
|
2
|
+
export declare const baseRedirect: <AppLocales extends Locales>(params: {
|
|
3
3
|
pathname: string;
|
|
4
4
|
locale: Locales[number];
|
|
5
|
-
localePrefix: LocalePrefixConfigVerbose<AppLocales
|
|
5
|
+
localePrefix: LocalePrefixConfigVerbose<AppLocales>;
|
|
6
6
|
}, type?: import("next/navigation").RedirectType | undefined) => never;
|
|
7
|
-
export declare const basePermanentRedirect: <AppLocales extends Locales
|
|
7
|
+
export declare const basePermanentRedirect: <AppLocales extends Locales>(params: {
|
|
8
8
|
pathname: string;
|
|
9
9
|
locale: Locales[number];
|
|
10
|
-
localePrefix: LocalePrefixConfigVerbose<AppLocales
|
|
10
|
+
localePrefix: LocalePrefixConfigVerbose<AppLocales>;
|
|
11
11
|
}, type?: import("next/navigation").RedirectType | undefined) => never;
|