next-intl 3.20.1-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/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/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/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/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/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/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/getTranslations.d.ts +9 -0
- 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/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/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/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
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
'use strict';
|
|
3
|
-
|
|
4
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
|
-
|
|
6
|
-
var _rollupPluginBabelHelpers = require('../../_virtual/_rollupPluginBabelHelpers.js');
|
|
7
|
-
var navigation = require('next/navigation');
|
|
8
|
-
var React = require('react');
|
|
9
|
-
var useLocale = require('../../react-client/useLocale.js');
|
|
10
|
-
var utils = require('../../shared/utils.js');
|
|
11
|
-
var BaseLink = require('./BaseLink.js');
|
|
12
|
-
|
|
13
|
-
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
14
|
-
|
|
15
|
-
var React__default = /*#__PURE__*/_interopDefault(React);
|
|
16
|
-
|
|
17
|
-
function LegacyBaseLink(_ref, ref) {
|
|
18
|
-
let {
|
|
19
|
-
href,
|
|
20
|
-
locale,
|
|
21
|
-
localePrefixMode,
|
|
22
|
-
prefix,
|
|
23
|
-
...rest
|
|
24
|
-
} = _ref;
|
|
25
|
-
// The types aren't entirely correct here. Outside of Next.js
|
|
26
|
-
// `useParams` can be called, but the return type is `null`.
|
|
27
|
-
const pathname = navigation.usePathname();
|
|
28
|
-
const curLocale = useLocale.default();
|
|
29
|
-
const isChangingLocale = locale !== curLocale;
|
|
30
|
-
const [localizedHref, setLocalizedHref] = React.useState(() => utils.isLocalizableHref(href) && (localePrefixMode !== 'never' || isChangingLocale) ?
|
|
31
|
-
// For the `localePrefix: 'as-needed' strategy, the href shouldn't
|
|
32
|
-
// be prefixed if the locale is the default locale. To determine this, we
|
|
33
|
-
// need a) the default locale and b) the information if we use prefixed
|
|
34
|
-
// routing. The default locale can vary by domain, therefore during the
|
|
35
|
-
// RSC as well as the SSR render, we can't determine the default locale
|
|
36
|
-
// statically. Therefore we always prefix the href since this will
|
|
37
|
-
// always result in a valid URL, even if it might cause a redirect. This
|
|
38
|
-
// is better than pointing to a non-localized href during the server
|
|
39
|
-
// render, which would potentially be wrong. The final href is
|
|
40
|
-
// determined in the effect below.
|
|
41
|
-
utils.prefixHref(href, prefix) : href);
|
|
42
|
-
React.useEffect(() => {
|
|
43
|
-
if (!pathname) return;
|
|
44
|
-
setLocalizedHref(utils.localizeHref(href, locale, curLocale, pathname, prefix));
|
|
45
|
-
}, [curLocale, href, locale, pathname, prefix]);
|
|
46
|
-
return /*#__PURE__*/React__default.default.createElement(BaseLink.default, _rollupPluginBabelHelpers.extends({
|
|
47
|
-
ref: ref,
|
|
48
|
-
href: localizedHref,
|
|
49
|
-
locale: locale
|
|
50
|
-
}, rest));
|
|
51
|
-
}
|
|
52
|
-
const LegacyBaseLinkWithRef = /*#__PURE__*/React.forwardRef(LegacyBaseLink);
|
|
53
|
-
LegacyBaseLinkWithRef.displayName = 'ClientLink';
|
|
54
|
-
|
|
55
|
-
exports.default = LegacyBaseLinkWithRef;
|
|
@@ -1,147 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
var _rollupPluginBabelHelpers = require('../../_virtual/_rollupPluginBabelHelpers.js');
|
|
6
|
-
var navigation = require('next/navigation');
|
|
7
|
-
var React = require('react');
|
|
8
|
-
var config = require('../../routing/config.js');
|
|
9
|
-
var utils$1 = require('../../shared/utils.js');
|
|
10
|
-
var BaseLink = require('./BaseLink.js');
|
|
11
|
-
var utils = require('./utils.js');
|
|
12
|
-
|
|
13
|
-
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
14
|
-
|
|
15
|
-
var React__default = /*#__PURE__*/_interopDefault(React);
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* Shared implementations for `react-server` and `react-client`
|
|
19
|
-
*/
|
|
20
|
-
function createSharedNavigationFns(getLocale, routing) {
|
|
21
|
-
const config$1 = config.receiveRoutingConfig(routing || {});
|
|
22
|
-
{
|
|
23
|
-
utils.validateReceivedConfig(config$1);
|
|
24
|
-
}
|
|
25
|
-
const pathnames = config$1.pathnames;
|
|
26
|
-
|
|
27
|
-
// This combination requires that the current host is known in order to
|
|
28
|
-
// compute a correct pathname. Since that can only be achieved by reading from
|
|
29
|
-
// headers, this would break static rendering. Therefore, as a workaround we
|
|
30
|
-
// always add a prefix in this case to be on the safe side. The downside is
|
|
31
|
-
// that the user might get redirected again if the middleware detects that the
|
|
32
|
-
// prefix is not needed.
|
|
33
|
-
const forcePrefixSsr = config$1.localePrefix.mode === 'as-needed' && config$1.domains || undefined;
|
|
34
|
-
function Link(_ref, ref) {
|
|
35
|
-
let {
|
|
36
|
-
href,
|
|
37
|
-
locale,
|
|
38
|
-
...rest
|
|
39
|
-
} = _ref;
|
|
40
|
-
let pathname, params;
|
|
41
|
-
if (typeof href === 'object') {
|
|
42
|
-
pathname = href.pathname;
|
|
43
|
-
// @ts-expect-error -- This is ok
|
|
44
|
-
params = href.params;
|
|
45
|
-
} else {
|
|
46
|
-
pathname = href;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
// @ts-expect-error -- This is ok
|
|
50
|
-
const isLocalizable = utils$1.isLocalizableHref(href);
|
|
51
|
-
const localePromiseOrValue = getLocale();
|
|
52
|
-
const curLocale = localePromiseOrValue instanceof Promise ? React.use(localePromiseOrValue) : localePromiseOrValue;
|
|
53
|
-
const finalPathname = isLocalizable ? getPathname(
|
|
54
|
-
// @ts-expect-error -- This is ok
|
|
55
|
-
{
|
|
56
|
-
locale: locale || curLocale,
|
|
57
|
-
href: pathnames == null ? pathname : {
|
|
58
|
-
pathname,
|
|
59
|
-
params
|
|
60
|
-
}
|
|
61
|
-
}, locale != null || forcePrefixSsr || undefined) : pathname;
|
|
62
|
-
return /*#__PURE__*/React__default.default.createElement(BaseLink.default, _rollupPluginBabelHelpers.extends({
|
|
63
|
-
ref: ref
|
|
64
|
-
// @ts-expect-error -- Available after the validation
|
|
65
|
-
,
|
|
66
|
-
defaultLocale: config$1.defaultLocale,
|
|
67
|
-
href: {
|
|
68
|
-
...(typeof href === 'object' && href),
|
|
69
|
-
// @ts-expect-error -- This is ok
|
|
70
|
-
pathname: finalPathname
|
|
71
|
-
},
|
|
72
|
-
locale: locale
|
|
73
|
-
// Provide the minimal relevant information to the client side in order
|
|
74
|
-
// to potentially remove the prefix in case of the `forcePrefixSsr` case
|
|
75
|
-
,
|
|
76
|
-
unprefixed: forcePrefixSsr && isLocalizable ? {
|
|
77
|
-
domains: config$1.domains.reduce((acc, domain) => {
|
|
78
|
-
// @ts-expect-error -- This is ok
|
|
79
|
-
acc[domain.domain] = domain.defaultLocale;
|
|
80
|
-
return acc;
|
|
81
|
-
}, {}),
|
|
82
|
-
pathname: getPathname(
|
|
83
|
-
// @ts-expect-error -- This is ok
|
|
84
|
-
{
|
|
85
|
-
locale: curLocale,
|
|
86
|
-
href: pathnames == null ? pathname : {
|
|
87
|
-
pathname,
|
|
88
|
-
params
|
|
89
|
-
}
|
|
90
|
-
}, false)
|
|
91
|
-
} : undefined
|
|
92
|
-
}, rest));
|
|
93
|
-
}
|
|
94
|
-
const LinkWithRef = /*#__PURE__*/React.forwardRef(Link);
|
|
95
|
-
function getPathname(args, /** @private Removed in types returned below */
|
|
96
|
-
_forcePrefix) {
|
|
97
|
-
const {
|
|
98
|
-
href,
|
|
99
|
-
locale
|
|
100
|
-
} = args;
|
|
101
|
-
let pathname;
|
|
102
|
-
if (pathnames == null) {
|
|
103
|
-
if (typeof href === 'object') {
|
|
104
|
-
pathname = href.pathname;
|
|
105
|
-
if (href.query) {
|
|
106
|
-
pathname += utils.serializeSearchParams(href.query);
|
|
107
|
-
}
|
|
108
|
-
} else {
|
|
109
|
-
pathname = href;
|
|
110
|
-
}
|
|
111
|
-
} else {
|
|
112
|
-
pathname = utils.compileLocalizedPathname({
|
|
113
|
-
locale,
|
|
114
|
-
// @ts-expect-error -- This is ok
|
|
115
|
-
...utils.normalizeNameOrNameWithParams(href),
|
|
116
|
-
// @ts-expect-error -- This is ok
|
|
117
|
-
pathnames: config$1.pathnames
|
|
118
|
-
});
|
|
119
|
-
}
|
|
120
|
-
return utils.applyPathnamePrefix(pathname, locale, config$1,
|
|
121
|
-
// @ts-expect-error -- This is ok
|
|
122
|
-
args.domain, _forcePrefix);
|
|
123
|
-
}
|
|
124
|
-
function getRedirectFn(fn) {
|
|
125
|
-
/** @see https://next-intl-docs.vercel.app/docs/routing/navigation#redirect */
|
|
126
|
-
return function redirectFn(args) {
|
|
127
|
-
for (var _len = arguments.length, rest = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
128
|
-
rest[_key - 1] = arguments[_key];
|
|
129
|
-
}
|
|
130
|
-
return fn(
|
|
131
|
-
// @ts-expect-error -- We're forcing the prefix when no domain is provided
|
|
132
|
-
getPathname(args, args.domain ? undefined : forcePrefixSsr), ...rest);
|
|
133
|
-
};
|
|
134
|
-
}
|
|
135
|
-
const redirect = getRedirectFn(navigation.redirect);
|
|
136
|
-
const permanentRedirect = getRedirectFn(navigation.permanentRedirect);
|
|
137
|
-
return {
|
|
138
|
-
config: config$1,
|
|
139
|
-
Link: LinkWithRef,
|
|
140
|
-
redirect,
|
|
141
|
-
permanentRedirect,
|
|
142
|
-
// Remove `_forcePrefix` from public API
|
|
143
|
-
getPathname: getPathname
|
|
144
|
-
};
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
exports.default = createSharedNavigationFns;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{useRouter as e,usePathname as t}from"next/navigation";import{useMemo as n}from"react";import o from"../../react-client/useLocale.js";import r from"../shared/createSharedNavigationFns.js";import a from"../shared/syncLocaleCookie.js";import{getRoute as s}from"../shared/utils.js";import c from"./useBasePathname.js";function i(i){function u(){return o()}const{Link:m,config:f,getPathname:h,...p}=r(u,i);return{...p,Link:m,usePathname:function(){const e=c(f.localePrefix),t=u();return n((()=>e&&f.pathnames?s(t,e,f.pathnames):e),[t,e])},useRouter:function(){const o=e(),r=u(),s=t();return n((()=>{function e(e){return function(t,n){const{locale:o,...c}=n||{},i=[h({href:t,locale:o||r,domain:window.location.host})];Object.keys(c).length>0&&i.push(c),e(...i),a(s,r,o)}}return{...o,push:e(o.push),replace:e(o.replace),prefetch:e(o.prefetch)}}),[r,s,o])},getPathname:h}}export{i as default};
|
|
@@ -1 +0,0 @@
|
|
|
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,2 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import{extends as e}from"../../_virtual/_rollupPluginBabelHelpers.js";import{usePathname as r}from"next/navigation";import t,{forwardRef as o,useState as l,useEffect as i}from"react";import a from"../../react-client/useLocale.js";import{isLocalizableHref as n,prefixHref as s,localizeHref as m}from"../../shared/utils.js";import f from"./BaseLink.js";function c(o,c){let{href:p,locale:u,localePrefixMode:d,prefix:x,...j}=o;const h=r(),v=a(),L=u!==v,[g,k]=l((()=>n(p)&&("never"!==d||L)?s(p,x):p));return i((()=>{h&&k(m(p,u,v,h,x))}),[v,p,u,h,x]),t.createElement(f,e({ref:c,href:g,locale:u},j))}const p=o(c);p.displayName="ClientLink";export{p as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{extends as e}from"../../_virtual/_rollupPluginBabelHelpers.js";import{redirect as t,permanentRedirect as a}from"next/navigation";import o,{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(t,a){let n,l,{href:c,locale:f,...s}=t;"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 o.createElement(m,e({ref:a,defaultLocale:j.defaultLocale,href:{..."object"==typeof c&&c,pathname:y},locale:f,unprefixed:v&&u?{domains:j.domains.reduce(((e,t)=>(e[t.domain]=t.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,t){const{href:a,locale:o}=e;let n;return null==g?"object"==typeof a?(n=a.pathname,a.query&&(n+=f(a.query))):n=a:n=s({locale:o,...p(a),pathnames:j.pathnames}),u(n,o,j,e.domain,t)}function b(e){return function(t){for(var a=arguments.length,o=new Array(a>1?a-1:0),n=1;n<a;n++)o[n-1]=arguments[n];return e(L(t,t.domain?void 0:v),...o)}}const P=b(t),k=b(a);return{config:j,Link:x,redirect:P,permanentRedirect:k,getPathname:L}}export{d as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("next/navigation"),t=require("react"),r=require("../../react-client/useLocale.js"),n=require("../shared/createSharedNavigationFns.js"),a=require("../shared/syncLocaleCookie.js"),u=require("../shared/utils.js"),s=require("./useBasePathname.js");exports.default=function(o){function c(){return r.default()}const{Link:i,config:l,getPathname:h,...f}=n.default(c,o);return{...f,Link:i,usePathname:function(){const e=s.default(l.localePrefix),r=c();return t.useMemo((()=>e&&l.pathnames?u.getRoute(r,e,l.pathnames):e),[r,e])},useRouter:function(){const r=e.useRouter(),n=c(),u=e.usePathname();return t.useMemo((()=>{function e(e){return function(t,r){const{locale:s,...o}=r||{},c=[h({href:t,locale:s||n,domain:window.location.host})];Object.keys(o).length>0&&c.push(o),e(...c),a.default(u,n,s)}}return{...r,push:e(r.push),replace:e(r.replace),prefetch:e(r.prefetch)}}),[n,u,r])},getPathname:h}};
|
|
@@ -1 +0,0 @@
|
|
|
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,2 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../_virtual/_rollupPluginBabelHelpers.js"),r=require("next/navigation"),t=require("react"),l=require("../../react-client/useLocale.js"),a=require("../../shared/utils.js"),u=require("./BaseLink.js");function i(e){return e&&e.__esModule?e:{default:e}}var s=i(t);function f(i,f){let{href:n,locale:o,localePrefixMode:c,prefix:d,...p}=i;const x=r.usePathname(),q=l.default(),v=o!==q,[_,j]=t.useState((()=>a.isLocalizableHref(n)&&("never"!==c||v)?a.prefixHref(n,d):n));return t.useEffect((()=>{x&&j(a.localizeHref(n,o,q,x,d))}),[q,n,o,x,d]),s.default.createElement(u.default,e.extends({ref:f,href:_,locale:o},p))}const n=t.forwardRef(f);n.displayName="ClientLink",exports.default=n;
|
|
@@ -1 +0,0 @@
|
|
|
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,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 +0,0 @@
|
|
|
1
|
-
export {};
|