next-intl 3.0.0-beta.7 → 3.0.0-beta.9

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.
Files changed (65) hide show
  1. package/client.d.ts +1 -1
  2. package/dist/client/next-intl.esm.js +37 -9
  3. package/dist/client/next-intl.esm.js.map +1 -1
  4. package/dist/client/useRouter.d.ts +10 -3
  5. package/dist/middleware/NextIntlMiddlewareConfig.d.ts +1 -1
  6. package/dist/next-intl.cjs.development.js +44 -16
  7. package/dist/next-intl.cjs.development.js.map +1 -1
  8. package/dist/next-intl.cjs.production.min.js +1 -1
  9. package/dist/next-intl.cjs.production.min.js.map +1 -1
  10. package/dist/next-intl.esm.js +2 -2
  11. package/dist/react-client/next-intl.esm.js +2 -2
  12. package/dist/react-client/next-intl.esm2.js +8 -5
  13. package/dist/react-client/next-intl.esm2.js.map +1 -1
  14. package/dist/react-client/next-intl.esm3.js +5 -8
  15. package/dist/react-client/next-intl.esm3.js.map +1 -1
  16. package/dist/react-client/useLocalizedRouter.d.ts +3 -3
  17. package/dist/react-server/getBaseTranslator.d.ts +42 -0
  18. package/dist/src/client/useRouter.d.ts +10 -3
  19. package/dist/src/client/useRouter.js +27 -8
  20. package/dist/src/client/useRouter.js.map +1 -1
  21. package/dist/src/middleware/NextIntlMiddlewareConfig.d.ts +1 -1
  22. package/dist/src/middleware/middleware.js +13 -7
  23. package/dist/src/middleware/middleware.js.map +1 -1
  24. package/dist/src/react-client/Link.js +1 -1
  25. package/dist/src/react-client/useLocalizedRouter.d.ts +9 -3
  26. package/dist/src/react-client/useLocalizedRouter.js +1 -1
  27. package/dist/src/react-client/useLocalizedRouter.js.map +1 -1
  28. package/dist/src/react-server/Link.js +1 -1
  29. package/dist/src/react-server/getBaseTranslator.d.ts +42 -0
  30. package/dist/src/react-server/getBaseTranslator.js +39 -0
  31. package/dist/src/react-server/getBaseTranslator.js.map +1 -0
  32. package/dist/src/react-server/useTranslations.js +2 -4
  33. package/dist/src/react-server/useTranslations.js.map +1 -1
  34. package/dist/src/server/getFormatter.js +2 -2
  35. package/dist/src/server/getIntl.js +1 -1
  36. package/dist/src/server/getLocale.js +1 -1
  37. package/dist/src/server/getLocaleFromHeader.js +1 -1
  38. package/dist/src/server/getLocaleFromHeader.js.map +1 -1
  39. package/dist/src/server/getNow.js +2 -2
  40. package/dist/src/server/getTimeZone.js +2 -2
  41. package/dist/src/server/getTranslations.js +4 -13
  42. package/dist/src/server/getTranslations.js.map +1 -1
  43. package/dist/src/server/getTranslator.js +4 -13
  44. package/dist/src/server/getTranslator.js.map +1 -1
  45. package/link.d.ts +3 -1
  46. package/middleware.d.ts +3 -1
  47. package/package.json +28 -13
  48. package/plugin.d.ts +4 -1
  49. package/server.d.ts +1 -1
  50. package/src/client/useRouter.tsx +56 -8
  51. package/src/middleware/NextIntlMiddlewareConfig.tsx +1 -1
  52. package/src/middleware/middleware.tsx +11 -6
  53. package/src/react-client/Link.tsx +1 -1
  54. package/src/react-client/useLocalizedRouter.tsx +1 -1
  55. package/src/react-server/Link.tsx +1 -1
  56. package/src/react-server/getBaseTranslator.tsx +128 -0
  57. package/src/react-server/useTranslations.tsx +6 -5
  58. package/src/server/getFormatter.tsx +2 -2
  59. package/src/server/getIntl.tsx +1 -1
  60. package/src/server/getLocale.tsx +1 -1
  61. package/src/server/getLocaleFromHeader.tsx +1 -1
  62. package/src/server/getNow.tsx +2 -2
  63. package/src/server/getTimeZone.tsx +2 -2
  64. package/src/server/getTranslations.tsx +4 -16
  65. package/src/server/getTranslator.tsx +4 -16
package/client.d.ts CHANGED
@@ -1 +1 @@
1
- export * from './dist/src/client';
1
+ export * from './dist/client';
@@ -1,9 +1,12 @@
1
- import { extends as _extends } from '../_virtual/next-intl.esm.js';
1
+ import { extends as _extends, objectWithoutPropertiesLoose as _objectWithoutPropertiesLoose } from '../_virtual/next-intl.esm.js';
2
2
  import { useRouter as useRouter$1 } from 'next/navigation';
3
3
  import { useMemo } from 'react';
4
4
  import { localizeHref } from '../shared/next-intl.esm2.js';
5
5
  import useClientLocale from './next-intl.esm2.js';
6
6
 
7
+ var _excluded = ["locale"],
8
+ _excluded2 = ["locale"],
9
+ _excluded3 = ["locale"];
7
10
  /**
8
11
  * Returns a wrapped instance of `useRouter` from `next/navigation` that
9
12
  * will automatically localize the `href` parameters it receives.
@@ -18,24 +21,49 @@ import useClientLocale from './next-intl.esm2.js';
18
21
  *
19
22
  * // When the user is on `/en`, the router will navigate to `/en/about`
20
23
  * router.push('/about');
24
+ *
25
+ * // Optionally, you can switch the locale by passing the second argument
26
+ * router.push('/about', {locale: 'de'});
21
27
  * ```
22
28
  */
23
29
  function useRouter() {
24
30
  var router = useRouter$1();
25
31
  var locale = useClientLocale();
26
32
  return useMemo(function () {
27
- function localize(href) {
28
- return localizeHref(href, locale, locale, window.location.pathname);
33
+ function localize(href, nextLocale) {
34
+ return localizeHref(href, nextLocale || locale, locale, window.location.pathname);
29
35
  }
30
36
  return _extends({}, router, {
31
- push: function push(href) {
32
- return router.push(localize(href));
37
+ push: function push(href, options) {
38
+ var _ref = options || {},
39
+ nextLocale = _ref.locale,
40
+ rest = _objectWithoutPropertiesLoose(_ref, _excluded);
41
+ var args = [localize(href, nextLocale)];
42
+ if (Object.keys(rest).length > 0) {
43
+ args.push(rest);
44
+ }
45
+ return router.push.apply(router, args);
33
46
  },
34
- replace: function replace(href) {
35
- return router.replace(localize(href));
47
+ replace: function replace(href, options) {
48
+ var _ref2 = options || {},
49
+ nextLocale = _ref2.locale,
50
+ rest = _objectWithoutPropertiesLoose(_ref2, _excluded2);
51
+ var args = [localize(href, nextLocale)];
52
+ if (Object.keys(rest).length > 0) {
53
+ args.push(rest);
54
+ }
55
+ return router.replace.apply(router, args);
36
56
  },
37
- prefetch: function prefetch(href) {
38
- return router.prefetch(localize(href));
57
+ prefetch: function prefetch(href, options) {
58
+ var _ref3 = options || {},
59
+ nextLocale = _ref3.locale,
60
+ rest = _objectWithoutPropertiesLoose(_ref3, _excluded3);
61
+ var args = [localize(href, nextLocale)];
62
+ if (Object.keys(rest).length > 0) {
63
+ // @ts-expect-error TypeScript thinks `rest` can be an empty object
64
+ args.push(rest);
65
+ }
66
+ return router.prefetch.apply(router, args);
39
67
  }
40
68
  });
41
69
  }, [locale, router]);
@@ -1 +1 @@
1
- {"version":3,"file":"next-intl.esm.js","sources":["../../src/client/useRouter.tsx"],"sourcesContent":["import {useRouter as useNextRouter} from 'next/navigation';\nimport {useMemo} from 'react';\nimport {localizeHref} from '../shared/utils';\nimport useClientLocale from './useClientLocale';\n\n/**\n * Returns a wrapped instance of `useRouter` from `next/navigation` that\n * will automatically localize the `href` parameters it receives.\n *\n * @example\n * ```tsx\n * 'use client';\n *\n * import {useRouter} from 'next-intl/client';\n *\n * const router = useRouter();\n *\n * // When the user is on `/en`, the router will navigate to `/en/about`\n * router.push('/about');\n * ```\n */\nexport default function useRouter() {\n const router = useNextRouter();\n const locale = useClientLocale();\n\n return useMemo(() => {\n function localize(href: string) {\n return localizeHref(href, locale, locale, window.location.pathname);\n }\n\n return {\n ...router,\n push(href: string) {\n return router.push(localize(href));\n },\n replace(href: string) {\n return router.replace(localize(href));\n },\n prefetch(href: string) {\n return router.prefetch(localize(href));\n }\n };\n }, [locale, router]);\n}\n"],"names":["useRouter","router","useNextRouter","locale","useClientLocale","useMemo","localize","href","localizeHref","window","location","pathname","_extends","push","replace","prefetch"],"mappings":";;;;;;AAKA;;;;;;;;;;;;;;;AAeG;AACW,SAAUA,SAASA,GAAA;AAC/B,EAAA,IAAMC,MAAM,GAAGC,WAAa,EAAE,CAAA;AAC9B,EAAA,IAAMC,MAAM,GAAGC,eAAe,EAAE,CAAA;EAEhC,OAAOC,OAAO,CAAC,YAAK;IAClB,SAASC,QAAQA,CAACC,IAAY,EAAA;AAC5B,MAAA,OAAOC,YAAY,CAACD,IAAI,EAAEJ,MAAM,EAAEA,MAAM,EAAEM,MAAM,CAACC,QAAQ,CAACC,QAAQ,CAAC,CAAA;AACrE,KAAA;IAEA,OAAAC,QAAA,KACKX,MAAM,EAAA;MACTY,IAAI,EAAA,SAAAA,IAACN,CAAAA,IAAY,EAAA;QACf,OAAON,MAAM,CAACY,IAAI,CAACP,QAAQ,CAACC,IAAI,CAAC,CAAC,CAAA;OACnC;MACDO,OAAO,EAAA,SAAAA,OAACP,CAAAA,IAAY,EAAA;QAClB,OAAON,MAAM,CAACa,OAAO,CAACR,QAAQ,CAACC,IAAI,CAAC,CAAC,CAAA;OACtC;MACDQ,QAAQ,EAAA,SAAAA,QAACR,CAAAA,IAAY,EAAA;QACnB,OAAON,MAAM,CAACc,QAAQ,CAACT,QAAQ,CAACC,IAAI,CAAC,CAAC,CAAA;AACxC,OAAA;AAAC,KAAA,CAAA,CAAA;AAEL,GAAC,EAAE,CAACJ,MAAM,EAAEF,MAAM,CAAC,CAAC,CAAA;AACtB;;;;"}
1
+ {"version":3,"file":"next-intl.esm.js","sources":["../../src/client/useRouter.tsx"],"sourcesContent":["import {useRouter as useNextRouter} from 'next/navigation';\nimport {useMemo} from 'react';\nimport {localizeHref} from '../shared/utils';\nimport useClientLocale from './useClientLocale';\n\ntype IntlNavigateOptions = {\n locale?: string;\n};\n\n/**\n * Returns a wrapped instance of `useRouter` from `next/navigation` that\n * will automatically localize the `href` parameters it receives.\n *\n * @example\n * ```tsx\n * 'use client';\n *\n * import {useRouter} from 'next-intl/client';\n *\n * const router = useRouter();\n *\n * // When the user is on `/en`, the router will navigate to `/en/about`\n * router.push('/about');\n *\n * // Optionally, you can switch the locale by passing the second argument\n * router.push('/about', {locale: 'de'});\n * ```\n */\nexport default function useRouter() {\n const router = useNextRouter();\n const locale = useClientLocale();\n\n return useMemo(() => {\n function localize(href: string, nextLocale?: string) {\n return localizeHref(\n href,\n nextLocale || locale,\n locale,\n window.location.pathname\n );\n }\n\n return {\n ...router,\n push(\n href: string,\n options?: Parameters<typeof router.push>[1] & IntlNavigateOptions\n ) {\n const {locale: nextLocale, ...rest} = options || {};\n const args: [\n href: string,\n options?: Parameters<typeof router.push>[1]\n ] = [localize(href, nextLocale)];\n if (Object.keys(rest).length > 0) {\n args.push(rest);\n }\n return router.push(...args);\n },\n\n replace(\n href: string,\n options?: Parameters<typeof router.replace>[1] & IntlNavigateOptions\n ) {\n const {locale: nextLocale, ...rest} = options || {};\n const args: [\n href: string,\n options?: Parameters<typeof router.replace>[1]\n ] = [localize(href, nextLocale)];\n if (Object.keys(rest).length > 0) {\n args.push(rest);\n }\n return router.replace(...args);\n },\n\n prefetch(\n href: string,\n options?: Parameters<typeof router.prefetch>[1] & IntlNavigateOptions\n ) {\n const {locale: nextLocale, ...rest} = options || {};\n const args: [\n href: string,\n options?: Parameters<typeof router.prefetch>[1]\n ] = [localize(href, nextLocale)];\n if (Object.keys(rest).length > 0) {\n // @ts-expect-error TypeScript thinks `rest` can be an empty object\n args.push(rest);\n }\n return router.prefetch(...args);\n }\n };\n }, [locale, router]);\n}\n"],"names":["useRouter","router","useNextRouter","locale","useClientLocale","useMemo","localize","href","nextLocale","localizeHref","window","location","pathname","_extends","push","options","_ref","rest","_objectWithoutPropertiesLoose","_excluded","args","Object","keys","length","apply","replace","_ref2","_excluded2","prefetch","_ref3","_excluded3"],"mappings":";;;;;;;;;AASA;;;;;;;;;;;;;;;;;;AAkBG;AACW,SAAUA,SAASA,GAAA;AAC/B,EAAA,IAAMC,MAAM,GAAGC,WAAa,EAAE,CAAA;AAC9B,EAAA,IAAMC,MAAM,GAAGC,eAAe,EAAE,CAAA;EAEhC,OAAOC,OAAO,CAAC,YAAK;AAClB,IAAA,SAASC,QAAQA,CAACC,IAAY,EAAEC,UAAmB,EAAA;AACjD,MAAA,OAAOC,YAAY,CACjBF,IAAI,EACJC,UAAU,IAAIL,MAAM,EACpBA,MAAM,EACNO,MAAM,CAACC,QAAQ,CAACC,QAAQ,CACzB,CAAA;AACH,KAAA;IAEA,OAAAC,QAAA,KACKZ,MAAM,EAAA;AACTa,MAAAA,IAAI,EAAAA,SAAAA,IAAAA,CACFP,IAAY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qB,KAAA,CAAlB1B,MAAM;AAAiBc,UAAAA,IAAI,GAAAC,6BAAA,CAAAW,KAAA,EAAAC,UAAA,CAAA,CAAA;QAClC,IAAMV,IAAI,GAGN,CAACd,QAAQ,CAACC,IAAI,EAAEC,UAAU,CAAC,CAAC,CAAA;QAChC,IAAIa,MAAM,CAACC,IAAI,CAACL,IAAI,CAAC,CAACM,MAAM,GAAG,CAAC,EAAE;AAChC;AACAH,UAAAA,IAAI,CAACN,IAAI,CAACG,IAAI,CAAC,CAAA;AAChB,SAAA;QACD,OAAOhB,MAAM,CAAC2B,QAAQ,CAAAJ,KAAA,CAAfvB,MAAM,EAAamB,IAAI,CAAC,CAAA;AACjC,OAAA;AAAC,KAAA,CAAA,CAAA;AAEL,GAAC,EAAE,CAACjB,MAAM,EAAEF,MAAM,CAAC,CAAC,CAAA;AACtB;;;;"}
@@ -1,3 +1,6 @@
1
+ type IntlNavigateOptions = {
2
+ locale?: string;
3
+ };
1
4
  /**
2
5
  * Returns a wrapped instance of `useRouter` from `next/navigation` that
3
6
  * will automatically localize the `href` parameters it receives.
@@ -12,13 +15,17 @@
12
15
  *
13
16
  * // When the user is on `/en`, the router will navigate to `/en/about`
14
17
  * router.push('/about');
18
+ *
19
+ * // Optionally, you can switch the locale by passing the second argument
20
+ * router.push('/about', {locale: 'de'});
15
21
  * ```
16
22
  */
17
23
  export default function useRouter(): {
18
- push(href: string): void;
19
- replace(href: string): void;
20
- prefetch(href: string): void;
24
+ push(href: string, options?: (import("next/dist/shared/lib/app-router-context").NavigateOptions & IntlNavigateOptions) | undefined): void;
25
+ replace(href: string, options?: (import("next/dist/shared/lib/app-router-context").NavigateOptions & IntlNavigateOptions) | undefined): void;
26
+ prefetch(href: string, options?: (import("next/dist/shared/lib/app-router-context").PrefetchOptions & IntlNavigateOptions) | undefined): void;
21
27
  back(): void;
22
28
  forward(): void;
23
29
  refresh(): void;
24
30
  };
31
+ export {};
@@ -12,7 +12,7 @@ type RoutingConfigDomain = {
12
12
  locale: string;
13
13
  }>;
14
14
  };
15
- type LocalePrefix = 'as-needed' | 'always';
15
+ type LocalePrefix = 'as-needed' | 'always' | 'never';
16
16
  type RoutingBaseConfig = {
17
17
  /** A list of all locales that are supported. */
18
18
  locales: Array<string>;
@@ -109,12 +109,12 @@ function hasPathnamePrefixed(locale, pathname) {
109
109
  return pathname === prefix || pathname.startsWith(prefix + "/");
110
110
  }
111
111
 
112
- var _excluded$2 = ["href", "locale", "prefetch"];
112
+ var _excluded$3 = ["href", "locale", "prefetch"];
113
113
  function BaseLink(_ref, ref) {
114
114
  var href = _ref.href,
115
115
  locale = _ref.locale,
116
116
  prefetch = _ref.prefetch,
117
- rest = _objectWithoutPropertiesLoose(_ref, _excluded$2);
117
+ rest = _objectWithoutPropertiesLoose(_ref, _excluded$3);
118
118
  // The types aren't entirely correct here. Outside of Next.js
119
119
  // `useParams` can be called, but the return type is `null`.
120
120
  var pathname = navigation.usePathname();
@@ -152,10 +152,10 @@ function BaseLink(_ref, ref) {
152
152
  }
153
153
  var BaseLink$1 = /*#__PURE__*/React.forwardRef(BaseLink);
154
154
 
155
- var _excluded$1 = ["locale"];
155
+ var _excluded$2 = ["locale"];
156
156
  function Link(_ref, ref) {
157
157
  var locale = _ref.locale,
158
- rest = _objectWithoutPropertiesLoose(_ref, _excluded$1);
158
+ rest = _objectWithoutPropertiesLoose(_ref, _excluded$2);
159
159
  var defaultLocale = useClientLocale();
160
160
  return React__default["default"].createElement(BaseLink$1, _extends({
161
161
  ref: ref,
@@ -190,18 +190,18 @@ var hasWarned$1 = false;
190
190
  /** @deprecated Is available as `import Link from 'next-intl/link'` now. */
191
191
  function LinkDeprecated(props) {
192
192
  if (!hasWarned$1) {
193
- console.warn("\n\nDEPRECATION WARNING: The import for `Link` from next-intl has changed.\n\nPreviously: import {Link} from 'next-intl';\nNow: import Link from 'next-intl/link';\n\nPlease upgrade your import accordingly. See also https://next-intl-docs.vercel.app/docs/next-13/navigation#link\n\n");
193
+ console.warn("\n\nDEPRECATION WARNING: The import for `Link` from next-intl has changed.\n\nPreviously: import {Link} from 'next-intl';\nNow: import Link from 'next-intl/link';\n\nPlease upgrade your import accordingly. See also https://next-intl-docs.vercel.app/docs/routing/navigation#link\n\n");
194
194
  hasWarned$1 = true;
195
195
  }
196
196
  return React__default["default"].createElement(Link$1, _extends({}, props));
197
197
  }
198
198
 
199
- var _excluded = ["children", "locale", "now"];
199
+ var _excluded$1 = ["children", "locale", "now"];
200
200
  function NextIntlClientProvider(_ref) {
201
201
  var children = _ref.children,
202
202
  locale = _ref.locale,
203
203
  now = _ref.now,
204
- rest = _objectWithoutPropertiesLoose(_ref, _excluded);
204
+ rest = _objectWithoutPropertiesLoose(_ref, _excluded$1);
205
205
  var router$1;
206
206
  try {
207
207
  // Reading from context is practically ok to do conditionally
@@ -230,6 +230,9 @@ function NextIntlClientProvider(_ref) {
230
230
  }, rest), children);
231
231
  }
232
232
 
233
+ var _excluded = ["locale"],
234
+ _excluded2 = ["locale"],
235
+ _excluded3 = ["locale"];
233
236
  /**
234
237
  * Returns a wrapped instance of `useRouter` from `next/navigation` that
235
238
  * will automatically localize the `href` parameters it receives.
@@ -244,24 +247,49 @@ function NextIntlClientProvider(_ref) {
244
247
  *
245
248
  * // When the user is on `/en`, the router will navigate to `/en/about`
246
249
  * router.push('/about');
250
+ *
251
+ * // Optionally, you can switch the locale by passing the second argument
252
+ * router.push('/about', {locale: 'de'});
247
253
  * ```
248
254
  */
249
255
  function useRouter() {
250
256
  var router = navigation.useRouter();
251
257
  var locale = useClientLocale();
252
258
  return React.useMemo(function () {
253
- function localize(href) {
254
- return localizeHref(href, locale, locale, window.location.pathname);
259
+ function localize(href, nextLocale) {
260
+ return localizeHref(href, nextLocale || locale, locale, window.location.pathname);
255
261
  }
256
262
  return _extends({}, router, {
257
- push: function push(href) {
258
- return router.push(localize(href));
263
+ push: function push(href, options) {
264
+ var _ref = options || {},
265
+ nextLocale = _ref.locale,
266
+ rest = _objectWithoutPropertiesLoose(_ref, _excluded);
267
+ var args = [localize(href, nextLocale)];
268
+ if (Object.keys(rest).length > 0) {
269
+ args.push(rest);
270
+ }
271
+ return router.push.apply(router, args);
259
272
  },
260
- replace: function replace(href) {
261
- return router.replace(localize(href));
273
+ replace: function replace(href, options) {
274
+ var _ref2 = options || {},
275
+ nextLocale = _ref2.locale,
276
+ rest = _objectWithoutPropertiesLoose(_ref2, _excluded2);
277
+ var args = [localize(href, nextLocale)];
278
+ if (Object.keys(rest).length > 0) {
279
+ args.push(rest);
280
+ }
281
+ return router.replace.apply(router, args);
262
282
  },
263
- prefetch: function prefetch(href) {
264
- return router.prefetch(localize(href));
283
+ prefetch: function prefetch(href, options) {
284
+ var _ref3 = options || {},
285
+ nextLocale = _ref3.locale,
286
+ rest = _objectWithoutPropertiesLoose(_ref3, _excluded3);
287
+ var args = [localize(href, nextLocale)];
288
+ if (Object.keys(rest).length > 0) {
289
+ // @ts-expect-error TypeScript thinks `rest` can be an empty object
290
+ args.push(rest);
291
+ }
292
+ return router.prefetch.apply(router, args);
265
293
  }
266
294
  });
267
295
  }, [locale, router]);
@@ -272,7 +300,7 @@ function useRouter() {
272
300
  var hasWarned = false;
273
301
  function useLocalizedRouterDeprecated() {
274
302
  if (!hasWarned) {
275
- console.warn("\n\nDEPRECATION WARNING: The `useLocalizedRouter` import from `next-intl` is deprecated and will be removed in the stable release of next-intl. Please import `useLocalizedRouter` from `next-intl/client` instead. See https://next-intl-docs.vercel.app/docs/next-13/server-components\n\n");
303
+ console.warn("\n\nDEPRECATION WARNING: The `useLocalizedRouter` import from `next-intl` is deprecated and will be removed in the stable release of next-intl. Please import `useLocalizedRouter` from `next-intl/client` instead. See https://next-intl-docs.vercel.app/docs/getting-started/app-router-server-components\n\n");
276
304
  hasWarned = true;
277
305
  }
278
306
  return useRouter();
@@ -1 +1 @@
1
- {"version":3,"file":"next-intl.cjs.development.js","sources":["../src/shared/constants.tsx","../src/client/useClientLocale.tsx","../src/shared/utils.tsx","../src/shared/BaseLink.tsx","../src/link/Link.tsx","../src/react-client/Link.tsx","../src/shared/NextIntlClientProvider.tsx","../src/client/useRouter.tsx","../src/react-client/useLocalizedRouter.tsx","../src/react-client/index.tsx"],"sourcesContent":["// Reuse the legacy cookie name\n// https://nextjs.org/docs/advanced-features/i18n-routing#leveraging-the-next_locale-cookie\nexport const COOKIE_LOCALE_NAME = 'NEXT_LOCALE';\n\n// Should take precedence over the cookie\nexport const HEADER_LOCALE_NAME = 'X-NEXT-INTL-LOCALE';\n\n// In a URL like \"/en-US/about\", the locale segment is \"en-US\"\nexport const LOCALE_SEGMENT_NAME = 'locale';\n","import {useParams} from 'next/navigation';\nimport {useLocale} from 'use-intl';\nimport {LOCALE_SEGMENT_NAME} from '../shared/constants';\n\nexport default function useClientLocale(): string {\n let locale;\n\n // The types aren't entirely correct here. Outside of Next.js\n // `useParams` can be called, but the return type is `null`.\n const params = useParams() as ReturnType<typeof useParams> | null;\n\n if (params?.[LOCALE_SEGMENT_NAME]) {\n locale = params[LOCALE_SEGMENT_NAME];\n } else {\n // eslint-disable-next-line react-hooks/rules-of-hooks -- Reading from context conditionally is fine\n locale = useLocale();\n }\n\n return locale;\n}\n","import {UrlObject} from 'url';\nimport NextLink from 'next/link';\nimport {ComponentProps} from 'react';\n\ntype Href = ComponentProps<typeof NextLink>['href'];\n\nexport function isRelativeHref(href: Href) {\n const pathname = typeof href === 'object' ? href.pathname : href;\n return pathname != null && !pathname.startsWith('/');\n}\n\nexport function isLocalHref(href: Href) {\n if (typeof href === 'object') {\n return href.host == null && href.hostname == null;\n } else {\n const hasProtocol = /^[a-z]+:/i.test(href);\n return !hasProtocol;\n }\n}\n\nexport function localizeHref(\n href: string,\n locale: string,\n defaultLocale: string,\n pathname: string\n): string;\nexport function localizeHref(\n href: UrlObject | string,\n locale: string,\n defaultLocale: string,\n pathname: string\n): UrlObject | string;\nexport function localizeHref(\n href: UrlObject | string,\n locale: string,\n defaultLocale: string = locale,\n pathname: string\n) {\n if (!isLocalHref(href) || isRelativeHref(href)) {\n return href;\n }\n\n const isSwitchingLocale = locale !== defaultLocale;\n const isPathnamePrefixed =\n locale == null || hasPathnamePrefixed(locale, pathname);\n const shouldPrefix = isPathnamePrefixed || isSwitchingLocale;\n\n if (shouldPrefix && locale != null) {\n return prefixHref(href, locale);\n }\n\n return href;\n}\n\nexport function prefixHref(href: string, locale: string): string;\nexport function prefixHref(\n href: UrlObject | string,\n locale: string\n): UrlObject | string;\nexport function prefixHref(href: UrlObject | string, locale: string) {\n let prefixedHref;\n if (typeof href === 'string') {\n prefixedHref = localizePathname(locale, href);\n } else {\n prefixedHref = {...href};\n if (href.pathname) {\n prefixedHref.pathname = localizePathname(locale, href.pathname);\n }\n }\n\n return prefixedHref;\n}\n\nexport function unlocalizePathname(pathname: string, locale: string) {\n return pathname.replace(new RegExp(`^/${locale}`), '') || '/';\n}\n\nexport function localizePathname(locale: string, pathname: string) {\n let localizedHref = '/' + locale;\n\n if (pathname !== '/') {\n localizedHref += pathname;\n }\n\n return localizedHref;\n}\n\nexport function hasPathnamePrefixed(locale: string, pathname: string) {\n const prefix = `/${locale}`;\n return pathname === prefix || pathname.startsWith(`${prefix}/`);\n}\n","'use client';\n\nimport NextLink from 'next/link';\nimport {usePathname} from 'next/navigation';\nimport React, {ComponentProps, forwardRef, useEffect, useState} from 'react';\nimport useClientLocale from '../client/useClientLocale';\nimport {isLocalHref, localizeHref, prefixHref} from './utils';\n\ntype Props = Omit<ComponentProps<typeof NextLink>, 'locale'> & {\n locale: string;\n};\n\nfunction BaseLink({href, locale, prefetch, ...rest}: Props, ref: Props['ref']) {\n // The types aren't entirely correct here. Outside of Next.js\n // `useParams` can be called, but the return type is `null`.\n const pathname = usePathname() as ReturnType<typeof usePathname> | null;\n\n const defaultLocale = useClientLocale();\n const isChangingLocale = locale !== defaultLocale;\n\n const [localizedHref, setLocalizedHref] = useState<typeof href>(() =>\n isLocalHref(href) && locale\n ? // Potentially the href shouldn't be prefixed, but to determine this we\n // need a) the default locale and b) the information if we use prefixed\n // routing. During the server side render (both in RSC as well as SSR),\n // we don't have this information. Therefore we always prefix the href\n // since this will always result in a valid URL, even if it might cause\n // a redirect. This is better than pointing to a non-localized href\n // during the server render, which would potentially be wrong. The final\n // href is determined in the effect below.\n prefixHref(href, locale)\n : href\n );\n\n useEffect(() => {\n if (!pathname) return;\n\n setLocalizedHref(\n localizeHref(href, locale, defaultLocale, pathname ?? undefined)\n );\n }, [defaultLocale, href, locale, pathname]);\n\n if (isChangingLocale) {\n if (prefetch && process.env.NODE_ENV !== 'production') {\n console.error(\n 'The `prefetch` prop is currently not supported when using the `locale` prop on `Link` to switch the locale.`'\n );\n }\n prefetch = false;\n }\n\n return (\n <NextLink ref={ref} href={localizedHref} prefetch={prefetch} {...rest} />\n );\n}\n\nexport default forwardRef(BaseLink);\n","import React, {ComponentProps, forwardRef} from 'react';\nimport useClientLocale from '../client/useClientLocale';\nimport BaseLink from '../shared/BaseLink';\n\ntype Props = Omit<ComponentProps<typeof BaseLink>, 'locale'> & {\n locale?: string;\n};\n\nfunction Link({locale, ...rest}: Props, ref: Props['ref']) {\n const defaultLocale = useClientLocale();\n return <BaseLink ref={ref} locale={locale || defaultLocale} {...rest} />;\n}\n\n/**\n * Wraps `next/link` and prefixes the `href` with the current locale if\n * necessary.\n *\n * @example\n * ```tsx\n * import {Link} from 'next-intl';\n *\n * // When the user is on `/en`, the link will point to `/en/about`\n * <Link href=\"/about\">About</Link>\n *\n * // You can override the `locale` to switch to another language\n * <Link href=\"/\" locale=\"de\">Switch to German</Link>\n * ```\n *\n * Note that when a `locale` prop is passed to switch the locale, the `prefetch`\n * prop is not supported. This is because Next.js would prefetch the page and\n * the `set-cookie` response header would cause the locale cookie on the current\n * page to be overwritten before the user even decides to change the locale.\n */\nexport default forwardRef(Link);\n","import React, {ComponentProps} from 'react';\nimport Link from '../link';\n\n// TODO: Only available for backwards compatibility\n// during the beta, remove for stable release\n\nlet hasWarned = false;\n\n/** @deprecated Is available as `import Link from 'next-intl/link'` now. */\nexport default function LinkDeprecated(props: ComponentProps<typeof Link>) {\n if (!hasWarned) {\n console.warn(\n `\\n\\nDEPRECATION WARNING: The import for \\`Link\\` from next-intl has changed.\n\nPreviously: import {Link} from 'next-intl';\nNow: import Link from 'next-intl/link';\n\nPlease upgrade your import accordingly. See also https://next-intl-docs.vercel.app/docs/next-13/navigation#link\\n\\n`\n );\n hasWarned = true;\n }\n\n return <Link {...props} />;\n}\n","'use client';\n\nimport {useRouter} from 'next/router';\nimport React, {ComponentProps} from 'react';\nimport {IntlProvider} from 'use-intl';\n\ntype Props = Omit<ComponentProps<typeof IntlProvider>, 'locale' | 'now'> & {\n locale?: string;\n /** If a string is supplied, make sure this conforms to the ISO 8601 format (YYYY-MM-DDTHH:mm:ss.sssZ */\n now?: Date | string;\n};\n\nexport default function NextIntlClientProvider({\n children,\n locale,\n now,\n ...rest\n}: Props) {\n let router;\n try {\n // Reading from context is practically ok to do conditionally\n // eslint-disable-next-line react-hooks/rules-of-hooks\n router = useRouter();\n } catch (error) {\n // Calling `useRouter` is not supported in the app folder\n }\n\n // The router can be undefined if used in a context outside\n // of Next.js (e.g. unit tests, Storybook, ...)\n if (!locale && router) {\n locale = router.locale;\n }\n\n // Currently RSC serialize dates to strings, therefore make sure we have\n // a date object. We might be able to remove this once more types have\n // first-class serialization support (https://github.com/facebook/react/issues/25687)\n if (typeof now === 'string') {\n now = new Date(now);\n }\n\n if (!locale) {\n throw new Error(\n process.env.NODE_ENV !== 'production'\n ? \"Couldn't determine locale. Please pass an explicit `locale` prop the provider, or if you're using the `pages` folder, use internationalized routing (https://nextjs.org/docs/advanced-features/i18n-routing).\"\n : undefined\n );\n }\n\n return (\n <IntlProvider locale={locale} now={now} {...rest}>\n {children}\n </IntlProvider>\n );\n}\n","import {useRouter as useNextRouter} from 'next/navigation';\nimport {useMemo} from 'react';\nimport {localizeHref} from '../shared/utils';\nimport useClientLocale from './useClientLocale';\n\n/**\n * Returns a wrapped instance of `useRouter` from `next/navigation` that\n * will automatically localize the `href` parameters it receives.\n *\n * @example\n * ```tsx\n * 'use client';\n *\n * import {useRouter} from 'next-intl/client';\n *\n * const router = useRouter();\n *\n * // When the user is on `/en`, the router will navigate to `/en/about`\n * router.push('/about');\n * ```\n */\nexport default function useRouter() {\n const router = useNextRouter();\n const locale = useClientLocale();\n\n return useMemo(() => {\n function localize(href: string) {\n return localizeHref(href, locale, locale, window.location.pathname);\n }\n\n return {\n ...router,\n push(href: string) {\n return router.push(localize(href));\n },\n replace(href: string) {\n return router.replace(localize(href));\n },\n prefetch(href: string) {\n return router.prefetch(localize(href));\n }\n };\n }, [locale, router]);\n}\n","import useRouter from '../client/useRouter';\n\n// TODO: Only available for backwards compatibility\n// during the beta, remove for stable release\n\nlet hasWarned = false;\n\nexport default function useLocalizedRouterDeprecated() {\n if (!hasWarned) {\n console.warn(\n `\\n\\nDEPRECATION WARNING: The \\`useLocalizedRouter\\` import from \\`next-intl\\` is deprecated and will be removed in the stable release of next-intl. Please import \\`useLocalizedRouter\\` from \\`next-intl/client\\` instead. See https://next-intl-docs.vercel.app/docs/next-13/server-components\\n\\n`\n );\n hasWarned = true;\n }\n\n return useRouter();\n}\n","/**\n * This is the main entry file when non-'react-server'\n * environments import from 'next-intl'.\n *\n * Maintainer notes:\n * - Make sure this mirrors the API from 'react-server'.\n * - Make sure everything exported from this module is\n * supported in all Next.js versions that are supported.\n */\n\nimport Link from './Link';\n\nexport * from 'use-intl';\nexport {default as NextIntlClientProvider} from '../shared/NextIntlClientProvider';\n\n// Legacy export (TBD if we'll deprecate this in favour of `NextIntlClientProvider`)\nexport {default as NextIntlProvider} from '../shared/NextIntlClientProvider';\n\n/** @deprecated Is available as `import Link from 'next-intl/link'` now. */\nexport const LocalizedLink = Link;\nexport {default as Link} from './Link';\n\nexport {default as useLocalizedRouter} from './useLocalizedRouter';\n"],"names":["LOCALE_SEGMENT_NAME","useClientLocale","locale","params","useParams","useLocale","isRelativeHref","href","pathname","startsWith","isLocalHref","host","hostname","hasProtocol","test","localizeHref","defaultLocale","isSwitchingLocale","isPathnamePrefixed","hasPathnamePrefixed","shouldPrefix","prefixHref","prefixedHref","localizePathname","_extends","localizedHref","prefix","_excluded","BaseLink","_ref","ref","prefetch","rest","_objectWithoutPropertiesLoose","usePathname","isChangingLocale","_useState","useState","setLocalizedHref","useEffect","undefined","process","console","error","React","createElement","NextLink","forwardRef","Link","hasWarned","LinkDeprecated","props","warn","NextIntlClientProvider","children","now","router","useRouter","Date","Error","IntlProvider","useNextRouter","useMemo","localize","window","location","push","replace","useLocalizedRouterDeprecated","LocalizedLink"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAOA;AACO,IAAMA,mBAAmB,GAAG,QAAQ;;ACJ7B,SAAUC,eAAeA,GAAA;AACrC,EAAA,IAAIC,MAAM,CAAA;AAEV;AACA;AACA,EAAA,IAAMC,MAAM,GAAGC,oBAAS,EAAyC,CAAA;AAEjE,EAAA,IAAID,MAAM,IAANA,IAAAA,IAAAA,MAAM,CAAGH,mBAAmB,CAAC,EAAE;AACjCE,IAAAA,MAAM,GAAGC,MAAM,CAACH,mBAAmB,CAAC,CAAA;AACrC,GAAA,MAAM;AACL;IACAE,MAAM,GAAGG,iBAAS,EAAE,CAAA;AACrB,GAAA;AAED,EAAA,OAAOH,MAAM,CAAA;AACf;;ACbM,SAAUI,cAAcA,CAACC,IAAU,EAAA;EACvC,IAAMC,QAAQ,GAAG,OAAOD,IAAI,KAAK,QAAQ,GAAGA,IAAI,CAACC,QAAQ,GAAGD,IAAI,CAAA;EAChE,OAAOC,QAAQ,IAAI,IAAI,IAAI,CAACA,QAAQ,CAACC,UAAU,CAAC,GAAG,CAAC,CAAA;AACtD,CAAA;AAEM,SAAUC,WAAWA,CAACH,IAAU,EAAA;AACpC,EAAA,IAAI,OAAOA,IAAI,KAAK,QAAQ,EAAE;IAC5B,OAAOA,IAAI,CAACI,IAAI,IAAI,IAAI,IAAIJ,IAAI,C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OAAOiD,MAAM,CAACzB,QAAQ,CAACgC,QAAQ,CAACxD,IAAI,CAAC,CAAC,CAAA;AACxC,OAAA;AAAC,KAAA,CAAA,CAAA;AAEL,GAAC,EAAE,CAACL,MAAM,EAAEsD,MAAM,CAAC,CAAC,CAAA;AACtB;;ACzCA;AACA;AAEA,IAAIP,SAAS,GAAG,KAAK,CAAA;AAEP,SAAUmB,4BAA4BA,GAAA;EAClD,IAAI,CAACnB,SAAS,EAAE;IACdP,OAAO,CAACU,IAAI,CAAA,8RAC4R,CACvS,CAAA;AACDH,IAAAA,SAAS,GAAG,IAAI,CAAA;AACjB,GAAA;EAED,OAAOQ,SAAS,EAAE,CAAA;AACpB;;AChBA;;;;;;;;AAQG;AAUH;AACO,IAAMY,aAAa,GAAGrB;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"next-intl.cjs.development.js","sources":["../src/shared/constants.tsx","../src/client/useClientLocale.tsx","../src/shared/utils.tsx","../src/shared/BaseLink.tsx","../src/link/Link.tsx","../src/react-client/Link.tsx","../src/shared/NextIntlClientProvider.tsx","../src/client/useRouter.tsx","../src/react-client/useLocalizedRouter.tsx","../src/react-client/index.tsx"],"sourcesContent":["// Reuse the legacy cookie name\n// https://nextjs.org/docs/advanced-features/i18n-routing#leveraging-the-next_locale-cookie\nexport const COOKIE_LOCALE_NAME = 'NEXT_LOCALE';\n\n// Should take precedence over the cookie\nexport const HEADER_LOCALE_NAME = 'X-NEXT-INTL-LOCALE';\n\n// In a URL like \"/en-US/about\", the locale segment is \"en-US\"\nexport const LOCALE_SEGMENT_NAME = 'locale';\n","import {useParams} from 'next/navigation';\nimport {useLocale} from 'use-intl';\nimport {LOCALE_SEGMENT_NAME} from '../shared/constants';\n\nexport default function useClientLocale(): string {\n let locale;\n\n // The types aren't entirely correct here. Outside of Next.js\n // `useParams` can be called, but the return type is `null`.\n const params = useParams() as ReturnType<typeof useParams> | null;\n\n if (params?.[LOCALE_SEGMENT_NAME]) {\n locale = params[LOCALE_SEGMENT_NAME];\n } else {\n // eslint-disable-next-line react-hooks/rules-of-hooks -- Reading from context conditionally is fine\n locale = useLocale();\n }\n\n return locale;\n}\n","import {UrlObject} from 'url';\nimport NextLink from 'next/link';\nimport {ComponentProps} from 'react';\n\ntype Href = ComponentProps<typeof NextLink>['href'];\n\nexport function isRelativeHref(href: Href) {\n const pathname = typeof href === 'object' ? href.pathname : href;\n return pathname != null && !pathname.startsWith('/');\n}\n\nexport function isLocalHref(href: Href) {\n if (typeof href === 'object') {\n return href.host == null && href.hostname == null;\n } else {\n const hasProtocol = /^[a-z]+:/i.test(href);\n return !hasProtocol;\n }\n}\n\nexport function localizeHref(\n href: string,\n locale: string,\n defaultLocale: string,\n pathname: string\n): string;\nexport function localizeHref(\n href: UrlObject | string,\n locale: string,\n defaultLocale: string,\n pathname: string\n): UrlObject | string;\nexport function localizeHref(\n href: UrlObject | string,\n locale: string,\n defaultLocale: string = locale,\n pathname: string\n) {\n if (!isLocalHref(href) || isRelativeHref(href)) {\n return href;\n }\n\n const isSwitchingLocale = locale !== defaultLocale;\n const isPathnamePrefixed =\n locale == null || hasPathnamePrefixed(locale, pathname);\n const shouldPrefix = isPathnamePrefixed || isSwitchingLocale;\n\n if (shouldPrefix && locale != null) {\n return prefixHref(href, locale);\n }\n\n return href;\n}\n\nexport function prefixHref(href: string, locale: string): string;\nexport function prefixHref(\n href: UrlObject | string,\n locale: string\n): UrlObject | string;\nexport function prefixHref(href: UrlObject | string, locale: string) {\n let prefixedHref;\n if (typeof href === 'string') {\n prefixedHref = localizePathname(locale, href);\n } else {\n prefixedHref = {...href};\n if (href.pathname) {\n prefixedHref.pathname = localizePathname(locale, href.pathname);\n }\n }\n\n return prefixedHref;\n}\n\nexport function unlocalizePathname(pathname: string, locale: string) {\n return pathname.replace(new RegExp(`^/${locale}`), '') || '/';\n}\n\nexport function localizePathname(locale: string, pathname: string) {\n let localizedHref = '/' + locale;\n\n if (pathname !== '/') {\n localizedHref += pathname;\n }\n\n return localizedHref;\n}\n\nexport function hasPathnamePrefixed(locale: string, pathname: string) {\n const prefix = `/${locale}`;\n return pathname === prefix || pathname.startsWith(`${prefix}/`);\n}\n","'use client';\n\nimport NextLink from 'next/link';\nimport {usePathname} from 'next/navigation';\nimport React, {ComponentProps, forwardRef, useEffect, useState} from 'react';\nimport useClientLocale from '../client/useClientLocale';\nimport {isLocalHref, localizeHref, prefixHref} from './utils';\n\ntype Props = Omit<ComponentProps<typeof NextLink>, 'locale'> & {\n locale: string;\n};\n\nfunction BaseLink({href, locale, prefetch, ...rest}: Props, ref: Props['ref']) {\n // The types aren't entirely correct here. Outside of Next.js\n // `useParams` can be called, but the return type is `null`.\n const pathname = usePathname() as ReturnType<typeof usePathname> | null;\n\n const defaultLocale = useClientLocale();\n const isChangingLocale = locale !== defaultLocale;\n\n const [localizedHref, setLocalizedHref] = useState<typeof href>(() =>\n isLocalHref(href) && locale\n ? // Potentially the href shouldn't be prefixed, but to determine this we\n // need a) the default locale and b) the information if we use prefixed\n // routing. During the server side render (both in RSC as well as SSR),\n // we don't have this information. Therefore we always prefix the href\n // since this will always result in a valid URL, even if it might cause\n // a redirect. This is better than pointing to a non-localized href\n // during the server render, which would potentially be wrong. The final\n // href is determined in the effect below.\n prefixHref(href, locale)\n : href\n );\n\n useEffect(() => {\n if (!pathname) return;\n\n setLocalizedHref(\n localizeHref(href, locale, defaultLocale, pathname ?? undefined)\n );\n }, [defaultLocale, href, locale, pathname]);\n\n if (isChangingLocale) {\n if (prefetch && process.env.NODE_ENV !== 'production') {\n console.error(\n 'The `prefetch` prop is currently not supported when using the `locale` prop on `Link` to switch the locale.`'\n );\n }\n prefetch = false;\n }\n\n return (\n <NextLink ref={ref} href={localizedHref} prefetch={prefetch} {...rest} />\n );\n}\n\nexport default forwardRef(BaseLink);\n","import React, {ComponentProps, forwardRef} from 'react';\nimport useClientLocale from '../client/useClientLocale';\nimport BaseLink from '../shared/BaseLink';\n\ntype Props = Omit<ComponentProps<typeof BaseLink>, 'locale'> & {\n locale?: string;\n};\n\nfunction Link({locale, ...rest}: Props, ref: Props['ref']) {\n const defaultLocale = useClientLocale();\n return <BaseLink ref={ref} locale={locale || defaultLocale} {...rest} />;\n}\n\n/**\n * Wraps `next/link` and prefixes the `href` with the current locale if\n * necessary.\n *\n * @example\n * ```tsx\n * import {Link} from 'next-intl';\n *\n * // When the user is on `/en`, the link will point to `/en/about`\n * <Link href=\"/about\">About</Link>\n *\n * // You can override the `locale` to switch to another language\n * <Link href=\"/\" locale=\"de\">Switch to German</Link>\n * ```\n *\n * Note that when a `locale` prop is passed to switch the locale, the `prefetch`\n * prop is not supported. This is because Next.js would prefetch the page and\n * the `set-cookie` response header would cause the locale cookie on the current\n * page to be overwritten before the user even decides to change the locale.\n */\nexport default forwardRef(Link);\n","import React, {ComponentProps} from 'react';\nimport Link from '../link';\n\n// TODO: Only available for backwards compatibility\n// during the beta, remove for stable release\n\nlet hasWarned = false;\n\n/** @deprecated Is available as `import Link from 'next-intl/link'` now. */\nexport default function LinkDeprecated(props: ComponentProps<typeof Link>) {\n if (!hasWarned) {\n console.warn(\n `\\n\\nDEPRECATION WARNING: The import for \\`Link\\` from next-intl has changed.\n\nPreviously: import {Link} from 'next-intl';\nNow: import Link from 'next-intl/link';\n\nPlease upgrade your import accordingly. See also https://next-intl-docs.vercel.app/docs/routing/navigation#link\\n\\n`\n );\n hasWarned = true;\n }\n\n return <Link {...props} />;\n}\n","'use client';\n\nimport {useRouter} from 'next/router';\nimport React, {ComponentProps} from 'react';\nimport {IntlProvider} from 'use-intl';\n\ntype Props = Omit<ComponentProps<typeof IntlProvider>, 'locale' | 'now'> & {\n locale?: string;\n /** If a string is supplied, make sure this conforms to the ISO 8601 format (YYYY-MM-DDTHH:mm:ss.sssZ */\n now?: Date | string;\n};\n\nexport default function NextIntlClientProvider({\n children,\n locale,\n now,\n ...rest\n}: Props) {\n let router;\n try {\n // Reading from context is practically ok to do conditionally\n // eslint-disable-next-line react-hooks/rules-of-hooks\n router = useRouter();\n } catch (error) {\n // Calling `useRouter` is not supported in the app folder\n }\n\n // The router can be undefined if used in a context outside\n // of Next.js (e.g. unit tests, Storybook, ...)\n if (!locale && router) {\n locale = router.locale;\n }\n\n // Currently RSC serialize dates to strings, therefore make sure we have\n // a date object. We might be able to remove this once more types have\n // first-class serialization support (https://github.com/facebook/react/issues/25687)\n if (typeof now === 'string') {\n now = new Date(now);\n }\n\n if (!locale) {\n throw new Error(\n process.env.NODE_ENV !== 'production'\n ? \"Couldn't determine locale. Please pass an explicit `locale` prop the provider, or if you're using the `pages` folder, use internationalized routing (https://nextjs.org/docs/advanced-features/i18n-routing).\"\n : undefined\n );\n }\n\n return (\n <IntlProvider locale={locale} now={now} {...rest}>\n {children}\n </IntlProvider>\n );\n}\n","import {useRouter as useNextRouter} from 'next/navigation';\nimport {useMemo} from 'react';\nimport {localizeHref} from '../shared/utils';\nimport useClientLocale from './useClientLocale';\n\ntype IntlNavigateOptions = {\n locale?: string;\n};\n\n/**\n * Returns a wrapped instance of `useRouter` from `next/navigation` that\n * will automatically localize the `href` parameters it receives.\n *\n * @example\n * ```tsx\n * 'use client';\n *\n * import {useRouter} from 'next-intl/client';\n *\n * const router = useRouter();\n *\n * // When the user is on `/en`, the router will navigate to `/en/about`\n * router.push('/about');\n *\n * // Optionally, you can switch the locale by passing the second argument\n * router.push('/about', {locale: 'de'});\n * ```\n */\nexport default function useRouter() {\n const router = useNextRouter();\n const locale = useClientLocale();\n\n return useMemo(() => {\n function localize(href: string, nextLocale?: string) {\n return localizeHref(\n href,\n nextLocale || locale,\n locale,\n window.location.pathname\n );\n }\n\n return {\n ...router,\n push(\n href: string,\n options?: Parameters<typeof router.push>[1] & IntlNavigateOptions\n ) {\n const {locale: nextLocale, ...rest} = options || {};\n const args: [\n href: string,\n options?: Parameters<typeof router.push>[1]\n ] = [localize(href, nextLocale)];\n if (Object.keys(rest).length > 0) {\n args.push(rest);\n }\n return router.push(...args);\n },\n\n replace(\n href: string,\n options?: Parameters<typeof router.replace>[1] & IntlNavigateOptions\n ) {\n const {locale: nextLocale, ...rest} = options || {};\n const args: [\n href: string,\n options?: Parameters<typeof router.replace>[1]\n ] = [localize(href, nextLocale)];\n if (Object.keys(rest).length > 0) {\n args.push(rest);\n }\n return router.replace(...args);\n },\n\n prefetch(\n href: string,\n options?: Parameters<typeof router.prefetch>[1] & IntlNavigateOptions\n ) {\n const {locale: nextLocale, ...rest} = options || {};\n const args: [\n href: string,\n options?: Parameters<typeof router.prefetch>[1]\n ] = [localize(href, nextLocale)];\n if (Object.keys(rest).length > 0) {\n // @ts-expect-error TypeScript thinks `rest` can be an empty object\n args.push(rest);\n }\n return router.prefetch(...args);\n }\n };\n }, [locale, router]);\n}\n","import useRouter from '../client/useRouter';\n\n// TODO: Only available for backwards compatibility\n// during the beta, remove for stable release\n\nlet hasWarned = false;\n\nexport default function useLocalizedRouterDeprecated() {\n if (!hasWarned) {\n console.warn(\n `\\n\\nDEPRECATION WARNING: The \\`useLocalizedRouter\\` import from \\`next-intl\\` is deprecated and will be removed in the stable release of next-intl. Please import \\`useLocalizedRouter\\` from \\`next-intl/client\\` instead. See https://next-intl-docs.vercel.app/docs/getting-started/app-router-server-components\\n\\n`\n );\n hasWarned = true;\n }\n\n return useRouter();\n}\n","/**\n * This is the main entry file when non-'react-server'\n * environments import from 'next-intl'.\n *\n * Maintainer notes:\n * - Make sure this mirrors the API from 'react-server'.\n * - Make sure everything exported from this module is\n * supported in all Next.js versions that are supported.\n */\n\nimport Link from './Link';\n\nexport * from 'use-intl';\nexport {default as NextIntlClientProvider} from '../shared/NextIntlClientProvider';\n\n// Legacy export (TBD if we'll deprecate this in favour of `NextIntlClientProvider`)\nexport {default as NextIntlProvider} from '../shared/NextIntlClientProvider';\n\n/** @deprecated Is available as `import Link from 'next-intl/link'` now. */\nexport const LocalizedLink = Link;\nexport {default as Link} from './Link';\n\nexport {default as useLocalizedRouter} from './useLocalizedRouter';\n"],"names":["LOCALE_SEGMENT_NAME","useClientLocale","locale","params","useParams","useLocale","isRelativeHref","href","pathname","startsWith","isLocalHref","host","hostname","hasProtocol","test","localizeHref","defaultLocale","isSwitchingLocale","isPathnamePrefixed","hasPathnamePrefixed","shouldPrefix","prefixHref","prefixedHref","localizePathname","_extends","localizedHref","prefix","_excluded","BaseLink","_ref","ref","prefetch","rest","_objectWithoutPropertiesLoose","usePathname","isChangingLocale","_useState","useState","setLocalizedHref","useEffect","undefined","process","console","error","React","createElement","NextLink","forwardRef","Link","hasWarned","LinkDeprecated","props","warn","NextIntlClientProvider","children","now","router","useRouter","Date","Error","IntlProvider","useNextRouter","useMemo","localize","nextLocale","window","location","push","options","args","Object","keys","length","apply","replace","_ref2","_excluded2","_ref3","_excluded3","useLocalizedRouterDeprecated","LocalizedLink"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAOA;AACO,IAAMA,mBAAmB,GAAG,QAAQ;;ACJ7B,SAAUC,eAAeA,GAAA;AACrC,EAAA,IAAIC,MAAM,CAAA;AAEV;AACA;AACA,EAAA,IAAMC,MAAM,GAAGC,oBAAS,EAAyC,CAAA;AAEjE,EAAA,IAAID,MAAM,IAANA,IAAAA,IAAAA,MAAM,CAAGH,mBAAmB,CAAC,EAAE;AACjCE,IAAAA,MAAM,GAAGC,MAAM,CAACH,mBAAmB,CAAC,CAAA;AACrC,GAAA,MAAM;AACL;IACAE,MAAM,GAAGG,iBAAS,EAAE,CAAA;AACrB,GAAA;AAED,EAAA,OAAOH,MAAM,CAAA;AACf;;ACbM,SAAUI,cAAcA,CAACC,IAAU,EAAA;EACvC,IAAMC,QAAQ,GAAG,OAAOD,IAAI,KAAK,QAAQ,GAAGA,IAAI,CAACC,QAAQ,GAAGD,IAAI,CAAA;EAChE,OAAOC,QAAQ,IAAI,IAAI,IAAI,CAACA,QAAQ,CAACC,UAAU,CAAC,GAAG,CAAC,CAAA;AACtD,CAAA;AAEM,SAAUC,WAAWA,CAACH,IAAU,EAAA;AACpC,EAAA,I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IAAI,GAGN,CAACN,QAAQ,CAACxD,IAAI,EAAEyD,UAAU,CAAC,CAAC,CAAA;QAChC,IAAIM,MAAM,CAACC,IAAI,CAACvC,IAAI,CAAC,CAACwC,MAAM,GAAG,CAAC,EAAE;AAChC;AACAH,UAAAA,IAAI,CAACF,IAAI,CAACnC,IAAI,CAAC,CAAA;AAChB,SAAA;QACD,OAAOwB,MAAM,CAACzB,QAAQ,CAAA0C,KAAA,CAAfjB,MAAM,EAAaa,IAAI,CAAC,CAAA;AACjC,OAAA;AAAC,KAAA,CAAA,CAAA;AAEL,GAAC,EAAE,CAACnE,MAAM,EAAEsD,MAAM,CAAC,CAAC,CAAA;AACtB;;ACzFA;AACA;AAEA,IAAIP,SAAS,GAAG,KAAK,CAAA;AAEP,SAAU8B,4BAA4BA,GAAA;EAClD,IAAI,CAAC9B,SAAS,EAAE;IACdP,OAAO,CAACU,IAAI,CAAA,iTAC+S,CAC1T,CAAA;AACDH,IAAAA,SAAS,GAAG,IAAI,CAAA;AACjB,GAAA;EAED,OAAOQ,SAAS,EAAE,CAAA;AACpB;;AChBA;;;;;;;;AAQG;AAUH;AACO,IAAMuB,aAAa,GAAGhC;;;;;;;;;;;;;;"}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),t=require("next/navigation"),n=require("use-intl"),r=require("next/link"),o=require("next/router");function a(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var u=a(e),i=a(r);function l(){return l=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},l.apply(this,arguments)}function c(e,t){if(null==e)return{};var n,r,o={},a=Object.keys(e);for(r=0;r<a.length;r++)t.indexOf(n=a[r])>=0||(o[n]=e[n]);return o}var f="locale";function s(){var e=t.useParams();return null!=e&&e[f]?e[f]:n.useLocale()}function p(e){return"object"==typeof e?null==e.host&&null==e.hostname:!/^[a-z]+:/i.test(e)}function d(e,t,n,r){if(void 0===n&&(n=t),!p(e)||function(e){var t="object"==typeof e?e.pathname:e;return null!=t&&!t.startsWith("/")}(e))return e;var o=t!==n,a=null==t||function(e,t){var n="/"+e;return t===n||t.startsWith(n+"/")}(t,r);return(a||o)&&null!=t?h(e,t):e}function h(e,t){var n;return"string"==typeof e?n=v(t,e):(n=l({},e),e.pathname&&(n.pathname=v(t,e.pathname))),n}function v(e,t){var n="/"+e;return"/"!==t&&(n+=t),n}var m=["href","locale","prefetch"];function x(n,r){var o=n.href,a=n.locale,f=n.prefetch,v=c(n,m),x=t.usePathname(),y=s(),w=a!==y,b=e.useState((function(){return p(o)&&a?h(o,a):o})),P=b[0],g=b[1];return e.useEffect((function(){x&&g(d(o,a,y,null!=x?x:void 0))}),[y,o,a,x]),w&&(f=!1),u.default.createElement(i.default,l({ref:r,href:P,prefetch:f},v))}var y=e.forwardRef(x),w=["locale"];function b(e,t){var n=e.locale,r=c(e,w),o=s();return u.default.createElement(y,l({ref:t,locale:n||o},r))}var P=e.forwardRef(b),g=!1;function O(e){return g||(console.warn("\n\nDEPRECATION WARNING: The import for `Link` from next-intl has changed.\n\nPreviously: import {Link} from 'next-intl';\nNow: import Link from 'next-intl/link';\n\nPlease upgrade your import accordingly. See also https://next-intl-docs.vercel.app/docs/next-13/navigation#link\n\n"),g=!0),u.default.createElement(P,l({},e))}var E=["children","locale","now"];function R(e){var t,r=e.children,a=e.locale,i=e.now,f=c(e,E);try{t=o.useRouter()}catch(e){}if(!a&&t&&(a=t.locale),"string"==typeof i&&(i=new Date(i)),!a)throw new Error(void 0);return u.default.createElement(n.IntlProvider,l({locale:a,now:i},f),r)}var j=!1,k=O;exports.Link=O,exports.LocalizedLink=k,exports.NextIntlClientProvider=R,exports.NextIntlProvider=R,exports.useLocalizedRouter=function(){return j||(console.warn("\n\nDEPRECATION WARNING: The `useLocalizedRouter` import from `next-intl` is deprecated and will be removed in the stable release of next-intl. Please import `useLocalizedRouter` from `next-intl/client` instead. See https://next-intl-docs.vercel.app/docs/next-13/server-components\n\n"),j=!0),function(){var n=t.useRouter(),r=s();return e.useMemo((function(){function e(e){return d(e,r,r,window.location.pathname)}return l({},n,{push:function(t){return n.push(e(t))},replace:function(t){return n.replace(e(t))},prefetch:function(t){return n.prefetch(e(t))}})}),[r,n])}()},Object.keys(n).forEach((function(e){"default"===e||exports.hasOwnProperty(e)||Object.defineProperty(exports,e,{enumerable:!0,get:function(){return n[e]}})}));
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),t=require("next/navigation"),n=require("use-intl"),r=require("next/link"),o=require("next/router");function a(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var l=a(e),u=a(r);function i(){return i=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},i.apply(this,arguments)}function c(e,t){if(null==e)return{};var n,r,o={},a=Object.keys(e);for(r=0;r<a.length;r++)t.indexOf(n=a[r])>=0||(o[n]=e[n]);return o}var f="locale";function s(){var e=t.useParams();return null!=e&&e[f]?e[f]:n.useLocale()}function p(e){return"object"==typeof e?null==e.host&&null==e.hostname:!/^[a-z]+:/i.test(e)}function h(e,t,n,r){if(void 0===n&&(n=t),!p(e)||function(e){var t="object"==typeof e?e.pathname:e;return null!=t&&!t.startsWith("/")}(e))return e;var o=t!==n,a=null==t||function(e,t){var n="/"+e;return t===n||t.startsWith(n+"/")}(t,r);return(a||o)&&null!=t?d(e,t):e}function d(e,t){var n;return"string"==typeof e?n=v(t,e):(n=i({},e),e.pathname&&(n.pathname=v(t,e.pathname))),n}function v(e,t){var n="/"+e;return"/"!==t&&(n+=t),n}var m=["href","locale","prefetch"];function y(n,r){var o=n.href,a=n.locale,f=n.prefetch,v=c(n,m),y=t.usePathname(),x=s(),g=a!==x,b=e.useState((function(){return p(o)&&a?d(o,a):o})),w=b[0],O=b[1];return e.useEffect((function(){y&&O(h(o,a,x,null!=y?y:void 0))}),[x,o,a,y]),g&&(f=!1),l.default.createElement(u.default,i({ref:r,href:w,prefetch:f},v))}var x=e.forwardRef(y),g=["locale"];function b(e,t){var n=e.locale,r=c(e,g),o=s();return l.default.createElement(x,i({ref:t,locale:n||o},r))}var w=e.forwardRef(b),O=!1;function P(e){return O||(console.warn("\n\nDEPRECATION WARNING: The import for `Link` from next-intl has changed.\n\nPreviously: import {Link} from 'next-intl';\nNow: import Link from 'next-intl/link';\n\nPlease upgrade your import accordingly. See also https://next-intl-docs.vercel.app/docs/routing/navigation#link\n\n"),O=!0),l.default.createElement(w,i({},e))}var j=["children","locale","now"];function k(e){var t,r=e.children,a=e.locale,u=e.now,f=c(e,j);try{t=o.useRouter()}catch(e){}if(!a&&t&&(a=t.locale),"string"==typeof u&&(u=new Date(u)),!a)throw new Error(void 0);return l.default.createElement(n.IntlProvider,i({locale:a,now:u},f),r)}var E=["locale"],R=["locale"],L=["locale"],N=!1,I=P;exports.Link=P,exports.LocalizedLink=I,exports.NextIntlClientProvider=k,exports.NextIntlProvider=k,exports.useLocalizedRouter=function(){return N||(console.warn("\n\nDEPRECATION WARNING: The `useLocalizedRouter` import from `next-intl` is deprecated and will be removed in the stable release of next-intl. Please import `useLocalizedRouter` from `next-intl/client` instead. See https://next-intl-docs.vercel.app/docs/getting-started/app-router-server-components\n\n"),N=!0),function(){var n=t.useRouter(),r=s();return e.useMemo((function(){function e(e,t){return h(e,t||r,r,window.location.pathname)}return i({},n,{push:function(t,r){var o=r||{},a=o.locale,l=c(o,E),u=[e(t,a)];return Object.keys(l).length>0&&u.push(l),n.push.apply(n,u)},replace:function(t,r){var o=r||{},a=o.locale,l=c(o,R),u=[e(t,a)];return Object.keys(l).length>0&&u.push(l),n.replace.apply(n,u)},prefetch:function(t,r){var o=r||{},a=o.locale,l=c(o,L),u=[e(t,a)];return Object.keys(l).length>0&&u.push(l),n.prefetch.apply(n,u)}})}),[r,n])}()},Object.keys(n).forEach((function(e){"default"===e||exports.hasOwnProperty(e)||Object.defineProperty(exports,e,{enumerable:!0,get:function(){return n[e]}})}));
2
2
  //# sourceMappingURL=next-intl.cjs.production.min.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"next-intl.cjs.production.min.js","sources":["../src/shared/constants.tsx","../src/client/useClientLocale.tsx","../src/shared/utils.tsx","../src/shared/BaseLink.tsx","../src/link/Link.tsx","../src/react-client/Link.tsx","../src/shared/NextIntlClientProvider.tsx","../src/react-client/useLocalizedRouter.tsx","../src/react-client/index.tsx","../src/client/useRouter.tsx"],"sourcesContent":["// Reuse the legacy cookie name\n// https://nextjs.org/docs/advanced-features/i18n-routing#leveraging-the-next_locale-cookie\nexport const COOKIE_LOCALE_NAME = 'NEXT_LOCALE';\n\n// Should take precedence over the cookie\nexport const HEADER_LOCALE_NAME = 'X-NEXT-INTL-LOCALE';\n\n// In a URL like \"/en-US/about\", the locale segment is \"en-US\"\nexport const LOCALE_SEGMENT_NAME = 'locale';\n","import {useParams} from 'next/navigation';\nimport {useLocale} from 'use-intl';\nimport {LOCALE_SEGMENT_NAME} from '../shared/constants';\n\nexport default function useClientLocale(): string {\n let locale;\n\n // The types aren't entirely correct here. Outside of Next.js\n // `useParams` can be called, but the return type is `null`.\n const params = useParams() as ReturnType<typeof useParams> | null;\n\n if (params?.[LOCALE_SEGMENT_NAME]) {\n locale = params[LOCALE_SEGMENT_NAME];\n } else {\n // eslint-disable-next-line react-hooks/rules-of-hooks -- Reading from context conditionally is fine\n locale = useLocale();\n }\n\n return locale;\n}\n","import {UrlObject} from 'url';\nimport NextLink from 'next/link';\nimport {ComponentProps} from 'react';\n\ntype Href = ComponentProps<typeof NextLink>['href'];\n\nexport function isRelativeHref(href: Href) {\n const pathname = typeof href === 'object' ? href.pathname : href;\n return pathname != null && !pathname.startsWith('/');\n}\n\nexport function isLocalHref(href: Href) {\n if (typeof href === 'object') {\n return href.host == null && href.hostname == null;\n } else {\n const hasProtocol = /^[a-z]+:/i.test(href);\n return !hasProtocol;\n }\n}\n\nexport function localizeHref(\n href: string,\n locale: string,\n defaultLocale: string,\n pathname: string\n): string;\nexport function localizeHref(\n href: UrlObject | string,\n locale: string,\n defaultLocale: string,\n pathname: string\n): UrlObject | string;\nexport function localizeHref(\n href: UrlObject | string,\n locale: string,\n defaultLocale: string = locale,\n pathname: string\n) {\n if (!isLocalHref(href) || isRelativeHref(href)) {\n return href;\n }\n\n const isSwitchingLocale = locale !== defaultLocale;\n const isPathnamePrefixed =\n locale == null || hasPathnamePrefixed(locale, pathname);\n const shouldPrefix = isPathnamePrefixed || isSwitchingLocale;\n\n if (shouldPrefix && locale != null) {\n return prefixHref(href, locale);\n }\n\n return href;\n}\n\nexport function prefixHref(href: string, locale: string): string;\nexport function prefixHref(\n href: UrlObject | string,\n locale: string\n): UrlObject | string;\nexport function prefixHref(href: UrlObject | string, locale: string) {\n let prefixedHref;\n if (typeof href === 'string') {\n prefixedHref = localizePathname(locale, href);\n } else {\n prefixedHref = {...href};\n if (href.pathname) {\n prefixedHref.pathname = localizePathname(locale, href.pathname);\n }\n }\n\n return prefixedHref;\n}\n\nexport function unlocalizePathname(pathname: string, locale: string) {\n return pathname.replace(new RegExp(`^/${locale}`), '') || '/';\n}\n\nexport function localizePathname(locale: string, pathname: string) {\n let localizedHref = '/' + locale;\n\n if (pathname !== '/') {\n localizedHref += pathname;\n }\n\n return localizedHref;\n}\n\nexport function hasPathnamePrefixed(locale: string, pathname: string) {\n const prefix = `/${locale}`;\n return pathname === prefix || pathname.startsWith(`${prefix}/`);\n}\n","'use client';\n\nimport NextLink from 'next/link';\nimport {usePathname} from 'next/navigation';\nimport React, {ComponentProps, forwardRef, useEffect, useState} from 'react';\nimport useClientLocale from '../client/useClientLocale';\nimport {isLocalHref, localizeHref, prefixHref} from './utils';\n\ntype Props = Omit<ComponentProps<typeof NextLink>, 'locale'> & {\n locale: string;\n};\n\nfunction BaseLink({href, locale, prefetch, ...rest}: Props, ref: Props['ref']) {\n // The types aren't entirely correct here. Outside of Next.js\n // `useParams` can be called, but the return type is `null`.\n const pathname = usePathname() as ReturnType<typeof usePathname> | null;\n\n const defaultLocale = useClientLocale();\n const isChangingLocale = locale !== defaultLocale;\n\n const [localizedHref, setLocalizedHref] = useState<typeof href>(() =>\n isLocalHref(href) && locale\n ? // Potentially the href shouldn't be prefixed, but to determine this we\n // need a) the default locale and b) the information if we use prefixed\n // routing. During the server side render (both in RSC as well as SSR),\n // we don't have this information. Therefore we always prefix the href\n // since this will always result in a valid URL, even if it might cause\n // a redirect. This is better than pointing to a non-localized href\n // during the server render, which would potentially be wrong. The final\n // href is determined in the effect below.\n prefixHref(href, locale)\n : href\n );\n\n useEffect(() => {\n if (!pathname) return;\n\n setLocalizedHref(\n localizeHref(href, locale, defaultLocale, pathname ?? undefined)\n );\n }, [defaultLocale, href, locale, pathname]);\n\n if (isChangingLocale) {\n if (prefetch && process.env.NODE_ENV !== 'production') {\n console.error(\n 'The `prefetch` prop is currently not supported when using the `locale` prop on `Link` to switch the locale.`'\n );\n }\n prefetch = false;\n }\n\n return (\n <NextLink ref={ref} href={localizedHref} prefetch={prefetch} {...rest} />\n );\n}\n\nexport default forwardRef(BaseLink);\n","import React, {ComponentProps, forwardRef} from 'react';\nimport useClientLocale from '../client/useClientLocale';\nimport BaseLink from '../shared/BaseLink';\n\ntype Props = Omit<ComponentProps<typeof BaseLink>, 'locale'> & {\n locale?: string;\n};\n\nfunction Link({locale, ...rest}: Props, ref: Props['ref']) {\n const defaultLocale = useClientLocale();\n return <BaseLink ref={ref} locale={locale || defaultLocale} {...rest} />;\n}\n\n/**\n * Wraps `next/link` and prefixes the `href` with the current locale if\n * necessary.\n *\n * @example\n * ```tsx\n * import {Link} from 'next-intl';\n *\n * // When the user is on `/en`, the link will point to `/en/about`\n * <Link href=\"/about\">About</Link>\n *\n * // You can override the `locale` to switch to another language\n * <Link href=\"/\" locale=\"de\">Switch to German</Link>\n * ```\n *\n * Note that when a `locale` prop is passed to switch the locale, the `prefetch`\n * prop is not supported. This is because Next.js would prefetch the page and\n * the `set-cookie` response header would cause the locale cookie on the current\n * page to be overwritten before the user even decides to change the locale.\n */\nexport default forwardRef(Link);\n","import React, {ComponentProps} from 'react';\nimport Link from '../link';\n\n// TODO: Only available for backwards compatibility\n// during the beta, remove for stable release\n\nlet hasWarned = false;\n\n/** @deprecated Is available as `import Link from 'next-intl/link'` now. */\nexport default function LinkDeprecated(props: ComponentProps<typeof Link>) {\n if (!hasWarned) {\n console.warn(\n `\\n\\nDEPRECATION WARNING: The import for \\`Link\\` from next-intl has changed.\n\nPreviously: import {Link} from 'next-intl';\nNow: import Link from 'next-intl/link';\n\nPlease upgrade your import accordingly. See also https://next-intl-docs.vercel.app/docs/next-13/navigation#link\\n\\n`\n );\n hasWarned = true;\n }\n\n return <Link {...props} />;\n}\n","'use client';\n\nimport {useRouter} from 'next/router';\nimport React, {ComponentProps} from 'react';\nimport {IntlProvider} from 'use-intl';\n\ntype Props = Omit<ComponentProps<typeof IntlProvider>, 'locale' | 'now'> & {\n locale?: string;\n /** If a string is supplied, make sure this conforms to the ISO 8601 format (YYYY-MM-DDTHH:mm:ss.sssZ */\n now?: Date | string;\n};\n\nexport default function NextIntlClientProvider({\n children,\n locale,\n now,\n ...rest\n}: Props) {\n let router;\n try {\n // Reading from context is practically ok to do conditionally\n // eslint-disable-next-line react-hooks/rules-of-hooks\n router = useRouter();\n } catch (error) {\n // Calling `useRouter` is not supported in the app folder\n }\n\n // The router can be undefined if used in a context outside\n // of Next.js (e.g. unit tests, Storybook, ...)\n if (!locale && router) {\n locale = router.locale;\n }\n\n // Currently RSC serialize dates to strings, therefore make sure we have\n // a date object. We might be able to remove this once more types have\n // first-class serialization support (https://github.com/facebook/react/issues/25687)\n if (typeof now === 'string') {\n now = new Date(now);\n }\n\n if (!locale) {\n throw new Error(\n process.env.NODE_ENV !== 'production'\n ? \"Couldn't determine locale. Please pass an explicit `locale` prop the provider, or if you're using the `pages` folder, use internationalized routing (https://nextjs.org/docs/advanced-features/i18n-routing).\"\n : undefined\n );\n }\n\n return (\n <IntlProvider locale={locale} now={now} {...rest}>\n {children}\n </IntlProvider>\n );\n}\n","import useRouter from '../client/useRouter';\n\n// TODO: Only available for backwards compatibility\n// during the beta, remove for stable release\n\nlet hasWarned = false;\n\nexport default function useLocalizedRouterDeprecated() {\n if (!hasWarned) {\n console.warn(\n `\\n\\nDEPRECATION WARNING: The \\`useLocalizedRouter\\` import from \\`next-intl\\` is deprecated and will be removed in the stable release of next-intl. Please import \\`useLocalizedRouter\\` from \\`next-intl/client\\` instead. See https://next-intl-docs.vercel.app/docs/next-13/server-components\\n\\n`\n );\n hasWarned = true;\n }\n\n return useRouter();\n}\n","/**\n * This is the main entry file when non-'react-server'\n * environments import from 'next-intl'.\n *\n * Maintainer notes:\n * - Make sure this mirrors the API from 'react-server'.\n * - Make sure everything exported from this module is\n * supported in all Next.js versions that are supported.\n */\n\nimport Link from './Link';\n\nexport * from 'use-intl';\nexport {default as NextIntlClientProvider} from '../shared/NextIntlClientProvider';\n\n// Legacy export (TBD if we'll deprecate this in favour of `NextIntlClientProvider`)\nexport {default as NextIntlProvider} from '../shared/NextIntlClientProvider';\n\n/** @deprecated Is available as `import Link from 'next-intl/link'` now. */\nexport const LocalizedLink = Link;\nexport {default as Link} from './Link';\n\nexport {default as useLocalizedRouter} from './useLocalizedRouter';\n","import {useRouter as useNextRouter} from 'next/navigation';\nimport {useMemo} from 'react';\nimport {localizeHref} from '../shared/utils';\nimport useClientLocale from './useClientLocale';\n\n/**\n * Returns a wrapped instance of `useRouter` from `next/navigation` that\n * will automatically localize the `href` parameters it receives.\n *\n * @example\n * ```tsx\n * 'use client';\n *\n * import {useRouter} from 'next-intl/client';\n *\n * const router = useRouter();\n *\n * // When the user is on `/en`, the router will navigate to `/en/about`\n * router.push('/about');\n * ```\n */\nexport default function useRouter() {\n const router = useNextRouter();\n const locale = useClientLocale();\n\n return useMemo(() => {\n function localize(href: string) {\n return localizeHref(href, locale, locale, window.location.pathname);\n }\n\n return {\n ...router,\n push(href: string) {\n return router.push(localize(href));\n },\n replace(href: string) {\n return router.replace(localize(href));\n },\n prefetch(href: string) {\n return router.prefetch(localize(href));\n }\n };\n }, [locale, router]);\n}\n"],"names":["LOCALE_SEGMENT_NAME","useClientLocale","params","useParams","useLocale","isLocalHref","href","host","hostname","test","localizeHref","locale","defaultLocale","pathname","startsWith","isRelativeHref","isSwitchingLocale","isPathnamePrefixed","prefix","hasPathnamePrefixed","prefixHref","prefixedHref","localizePathname","_extends","localizedHref","_excluded","BaseLink","_ref","ref","prefetch","rest","_objectWithoutPropertiesLoose","usePathname","isChangingLocale","_useState","useState","setLocalizedHref","useEffect","undefined","React","createElement","NextLink","BaseLink$1","forwardRef","Link","Link$1","hasWarned","LinkDeprecated","props","console","warn","NextIntlClientProvider","router","children","now","useRouter","error","Date","Error","IntlProvider","LocalizedLink","useNextRouter","useMemo","localize","window","location","push","replace"],"mappings":"goBAQO,IAAMA,EAAsB,SCJrB,SAAUC,IACtB,IAIMC,EAASC,EAAAA,YASf,OAPID,MAAAA,GAAAA,EAASF,GACFE,EAAOF,GAGPI,EAASA,WAItB,CCRM,SAAUC,EAAYC,GAC1B,MAAoB,iBAATA,EACW,MAAbA,EAAKC,MAAiC,MAAjBD,EAAKE,UAEb,YAAYC,KAAKH,EAGzC,CAcM,SAAUI,EACdJ,EACAK,EACAC,EACAC,GAEA,QAHA,IAAAD,IAAAA,EAAwBD,IAGnBN,EAAYC,IAhCb,SAAyBA,GAC7B,IAAMO,EAA2B,iBAATP,EAAoBA,EAAKO,SAAWP,EAC5D,OAAmB,MAAZO,IAAqBA,EAASC,WAAW,IAClD,CA6B4BC,CAAeT,GACvC,OAAOA,EAGT,IAAMU,EAAoBL,IAAWC,EAC/BK,EACM,MAAVN,GA2CY,SAAoBA,EAAgBE,GAClD,IAAMK,MAAaP,EACnB,OAAOE,IAAaK,GAAUL,EAASC,WAAcI,EAAM,IAC7D,CA9CsBC,CAAo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["../src/shared/constants.tsx","../src/client/useClientLocale.tsx","../src/shared/utils.tsx","../src/shared/BaseLink.tsx","../src/link/Link.tsx","../src/react-client/Link.tsx","../src/shared/NextIntlClientProvider.tsx","../src/react-client/useLocalizedRouter.tsx","../src/react-client/index.tsx","../src/client/useRouter.tsx"],"sourcesContent":["// Reuse the legacy cookie name\n// https://nextjs.org/docs/advanced-features/i18n-routing#leveraging-the-next_locale-cookie\nexport const COOKIE_LOCALE_NAME = 'NEXT_LOCALE';\n\n// Should take precedence over the cookie\nexport const HEADER_LOCALE_NAME = 'X-NEXT-INTL-LOCALE';\n\n// In a URL like \"/en-US/about\", the locale segment is \"en-US\"\nexport const LOCALE_SEGMENT_NAME = 'locale';\n","import {useParams} from 'next/navigation';\nimport {useLocale} from 'use-intl';\nimport {LOCALE_SEGMENT_NAME} from '../shared/constants';\n\nexport default function useClientLocale(): string {\n let locale;\n\n // The types aren't entirely correct here. Outside of Next.js\n // `useParams` can be called, but the return type is `null`.\n const params = useParams() as ReturnType<typeof useParams> | null;\n\n if (params?.[LOCALE_SEGMENT_NAME]) {\n locale = params[LOCALE_SEGMENT_NAME];\n } else {\n // eslint-disable-next-line react-hooks/rules-of-hooks -- Reading from context conditionally is fine\n locale = useLocale();\n }\n\n return locale;\n}\n","import {UrlObject} from 'url';\nimport NextLink from 'next/link';\nimport {ComponentProps} from 'react';\n\ntype Href = ComponentProps<typeof NextLink>['href'];\n\nexport function isRelativeHref(href: Href) {\n const pathname = typeof href === 'object' ? href.pathname : href;\n return pathname != null && !pathname.startsWith('/');\n}\n\nexport function isLocalHref(href: Href) {\n if (typeof href === 'object') {\n return href.host == null && href.hostname == null;\n } else {\n const hasProtocol = /^[a-z]+:/i.test(href);\n return !hasProtocol;\n }\n}\n\nexport function localizeHref(\n href: string,\n locale: string,\n defaultLocale: string,\n pathname: string\n): string;\nexport function localizeHref(\n href: UrlObject | string,\n locale: string,\n defaultLocale: string,\n pathname: string\n): UrlObject | string;\nexport function localizeHref(\n href: UrlObject | string,\n locale: string,\n defaultLocale: string = locale,\n pathname: string\n) {\n if (!isLocalHref(href) || isRelativeHref(href)) {\n return href;\n }\n\n const isSwitchingLocale = locale !== defaultLocale;\n const isPathnamePrefixed =\n locale == null || hasPathnamePrefixed(locale, pathname);\n const shouldPrefix = isPathnamePrefixed || isSwitchingLocale;\n\n if (shouldPrefix && locale != null) {\n return prefixHref(href, locale);\n }\n\n return href;\n}\n\nexport function prefixHref(href: string, locale: string): string;\nexport function prefixHref(\n href: UrlObject | string,\n locale: string\n): UrlObject | string;\nexport function prefixHref(href: UrlObject | string, locale: string) {\n let prefixedHref;\n if (typeof href === 'string') {\n prefixedHref = localizePathname(locale, href);\n } else {\n prefixedHref = {...href};\n if (href.pathname) {\n prefixedHref.pathname = localizePathname(locale, href.pathname);\n }\n }\n\n return prefixedHref;\n}\n\nexport function unlocalizePathname(pathname: string, locale: string) {\n return pathname.replace(new RegExp(`^/${locale}`), '') || '/';\n}\n\nexport function localizePathname(locale: string, pathname: string) {\n let localizedHref = '/' + locale;\n\n if (pathname !== '/') {\n localizedHref += pathname;\n }\n\n return localizedHref;\n}\n\nexport function hasPathnamePrefixed(locale: string, pathname: string) {\n const prefix = `/${locale}`;\n return pathname === prefix || pathname.startsWith(`${prefix}/`);\n}\n","'use client';\n\nimport NextLink from 'next/link';\nimport {usePathname} from 'next/navigation';\nimport React, {ComponentProps, forwardRef, useEffect, useState} from 'react';\nimport useClientLocale from '../client/useClientLocale';\nimport {isLocalHref, localizeHref, prefixHref} from './utils';\n\ntype Props = Omit<ComponentProps<typeof NextLink>, 'locale'> & {\n locale: string;\n};\n\nfunction BaseLink({href, locale, prefetch, ...rest}: Props, ref: Props['ref']) {\n // The types aren't entirely correct here. Outside of Next.js\n // `useParams` can be called, but the return type is `null`.\n const pathname = usePathname() as ReturnType<typeof usePathname> | null;\n\n const defaultLocale = useClientLocale();\n const isChangingLocale = locale !== defaultLocale;\n\n const [localizedHref, setLocalizedHref] = useState<typeof href>(() =>\n isLocalHref(href) && locale\n ? // Potentially the href shouldn't be prefixed, but to determine this we\n // need a) the default locale and b) the information if we use prefixed\n // routing. During the server side render (both in RSC as well as SSR),\n // we don't have this information. Therefore we always prefix the href\n // since this will always result in a valid URL, even if it might cause\n // a redirect. This is better than pointing to a non-localized href\n // during the server render, which would potentially be wrong. The final\n // href is determined in the effect below.\n prefixHref(href, locale)\n : href\n );\n\n useEffect(() => {\n if (!pathname) return;\n\n setLocalizedHref(\n localizeHref(href, locale, defaultLocale, pathname ?? undefined)\n );\n }, [defaultLocale, href, locale, pathname]);\n\n if (isChangingLocale) {\n if (prefetch && process.env.NODE_ENV !== 'production') {\n console.error(\n 'The `prefetch` prop is currently not supported when using the `locale` prop on `Link` to switch the locale.`'\n );\n }\n prefetch = false;\n }\n\n return (\n <NextLink ref={ref} href={localizedHref} prefetch={prefetch} {...rest} />\n );\n}\n\nexport default forwardRef(BaseLink);\n","import React, {ComponentProps, forwardRef} from 'react';\nimport useClientLocale from '../client/useClientLocale';\nimport BaseLink from '../shared/BaseLink';\n\ntype Props = Omit<ComponentProps<typeof BaseLink>, 'locale'> & {\n locale?: string;\n};\n\nfunction Link({locale, ...rest}: Props, ref: Props['ref']) {\n const defaultLocale = useClientLocale();\n return <BaseLink ref={ref} locale={locale || defaultLocale} {...rest} />;\n}\n\n/**\n * Wraps `next/link` and prefixes the `href` with the current locale if\n * necessary.\n *\n * @example\n * ```tsx\n * import {Link} from 'next-intl';\n *\n * // When the user is on `/en`, the link will point to `/en/about`\n * <Link href=\"/about\">About</Link>\n *\n * // You can override the `locale` to switch to another language\n * <Link href=\"/\" locale=\"de\">Switch to German</Link>\n * ```\n *\n * Note that when a `locale` prop is passed to switch the locale, the `prefetch`\n * prop is not supported. This is because Next.js would prefetch the page and\n * the `set-cookie` response header would cause the locale cookie on the current\n * page to be overwritten before the user even decides to change the locale.\n */\nexport default forwardRef(Link);\n","import React, {ComponentProps} from 'react';\nimport Link from '../link';\n\n// TODO: Only available for backwards compatibility\n// during the beta, remove for stable release\n\nlet hasWarned = false;\n\n/** @deprecated Is available as `import Link from 'next-intl/link'` now. */\nexport default function LinkDeprecated(props: ComponentProps<typeof Link>) {\n if (!hasWarned) {\n console.warn(\n `\\n\\nDEPRECATION WARNING: The import for \\`Link\\` from next-intl has changed.\n\nPreviously: import {Link} from 'next-intl';\nNow: import Link from 'next-intl/link';\n\nPlease upgrade your import accordingly. See also https://next-intl-docs.vercel.app/docs/routing/navigation#link\\n\\n`\n );\n hasWarned = true;\n }\n\n return <Link {...props} />;\n}\n","'use client';\n\nimport {useRouter} from 'next/router';\nimport React, {ComponentProps} from 'react';\nimport {IntlProvider} from 'use-intl';\n\ntype Props = Omit<ComponentProps<typeof IntlProvider>, 'locale' | 'now'> & {\n locale?: string;\n /** If a string is supplied, make sure this conforms to the ISO 8601 format (YYYY-MM-DDTHH:mm:ss.sssZ */\n now?: Date | string;\n};\n\nexport default function NextIntlClientProvider({\n children,\n locale,\n now,\n ...rest\n}: Props) {\n let router;\n try {\n // Reading from context is practically ok to do conditionally\n // eslint-disable-next-line react-hooks/rules-of-hooks\n router = useRouter();\n } catch (error) {\n // Calling `useRouter` is not supported in the app folder\n }\n\n // The router can be undefined if used in a context outside\n // of Next.js (e.g. unit tests, Storybook, ...)\n if (!locale && router) {\n locale = router.locale;\n }\n\n // Currently RSC serialize dates to strings, therefore make sure we have\n // a date object. We might be able to remove this once more types have\n // first-class serialization support (https://github.com/facebook/react/issues/25687)\n if (typeof now === 'string') {\n now = new Date(now);\n }\n\n if (!locale) {\n throw new Error(\n process.env.NODE_ENV !== 'production'\n ? \"Couldn't determine locale. Please pass an explicit `locale` prop the provider, or if you're using the `pages` folder, use internationalized routing (https://nextjs.org/docs/advanced-features/i18n-routing).\"\n : undefined\n );\n }\n\n return (\n <IntlProvider locale={locale} now={now} {...rest}>\n {children}\n </IntlProvider>\n );\n}\n","import useRouter from '../client/useRouter';\n\n// TODO: Only available for backwards compatibility\n// during the beta, remove for stable release\n\nlet hasWarned = false;\n\nexport default function useLocalizedRouterDeprecated() {\n if (!hasWarned) {\n console.warn(\n `\\n\\nDEPRECATION WARNING: The \\`useLocalizedRouter\\` import from \\`next-intl\\` is deprecated and will be removed in the stable release of next-intl. Please import \\`useLocalizedRouter\\` from \\`next-intl/client\\` instead. See https://next-intl-docs.vercel.app/docs/getting-started/app-router-server-components\\n\\n`\n );\n hasWarned = true;\n }\n\n return useRouter();\n}\n","/**\n * This is the main entry file when non-'react-server'\n * environments import from 'next-intl'.\n *\n * Maintainer notes:\n * - Make sure this mirrors the API from 'react-server'.\n * - Make sure everything exported from this module is\n * supported in all Next.js versions that are supported.\n */\n\nimport Link from './Link';\n\nexport * from 'use-intl';\nexport {default as NextIntlClientProvider} from '../shared/NextIntlClientProvider';\n\n// Legacy export (TBD if we'll deprecate this in favour of `NextIntlClientProvider`)\nexport {default as NextIntlProvider} from '../shared/NextIntlClientProvider';\n\n/** @deprecated Is available as `import Link from 'next-intl/link'` now. */\nexport const LocalizedLink = Link;\nexport {default as Link} from './Link';\n\nexport {default as useLocalizedRouter} from './useLocalizedRouter';\n","import {useRouter as useNextRouter} from 'next/navigation';\nimport {useMemo} from 'react';\nimport {localizeHref} from '../shared/utils';\nimport useClientLocale from './useClientLocale';\n\ntype IntlNavigateOptions = {\n locale?: string;\n};\n\n/**\n * Returns a wrapped instance of `useRouter` from `next/navigation` that\n * will automatically localize the `href` parameters it receives.\n *\n * @example\n * ```tsx\n * 'use client';\n *\n * import {useRouter} from 'next-intl/client';\n *\n * const router = useRouter();\n *\n * // When the user is on `/en`, the router will navigate to `/en/about`\n * router.push('/about');\n *\n * // Optionally, you can switch the locale by passing the second argument\n * router.push('/about', {locale: 'de'});\n * ```\n */\nexport default function useRouter() {\n const router = useNextRouter();\n const locale = useClientLocale();\n\n return useMemo(() => {\n function localize(href: string, nextLocale?: string) {\n return localizeHref(\n href,\n nextLocale || locale,\n locale,\n window.location.pathname\n );\n }\n\n return {\n ...router,\n push(\n href: string,\n options?: Parameters<typeof router.push>[1] & IntlNavigateOptions\n ) {\n const {locale: nextLocale, ...rest} = options || {};\n const args: [\n href: string,\n options?: Parameters<typeof router.push>[1]\n ] = [localize(href, nextLocale)];\n if (Object.keys(rest).length > 0) {\n args.push(rest);\n }\n return router.push(...args);\n },\n\n replace(\n href: string,\n options?: Parameters<typeof router.replace>[1] & IntlNavigateOptions\n ) {\n const {locale: nextLocale, ...rest} = options || {};\n const args: [\n href: string,\n options?: Parameters<typeof router.replace>[1]\n ] = [localize(href, nextLocale)];\n if (Object.keys(rest).length > 0) {\n args.push(rest);\n }\n return router.replace(...args);\n },\n\n prefetch(\n href: string,\n options?: Parameters<typeof router.prefetch>[1] & IntlNavigateOptions\n ) {\n const {locale: nextLocale, ...rest} = options || {};\n const args: [\n href: string,\n options?: Parameters<typeof router.prefetch>[1]\n ] = [localize(href, nextLocale)];\n if (Object.keys(rest).length > 0) {\n // @ts-expect-error TypeScript thinks `rest` can be an empty object\n args.push(rest);\n }\n return router.prefetch(...args);\n }\n };\n }, [locale, router]);\n}\n"],"names":["LOCALE_SEGMENT_NAME","useClientLocale","params","useParams","useLocale","isLocalHref","href","host","hostname","test","localizeHref","locale","defaultLocale","pathname","startsWith","isRelativeHref","isSwitchingLocale","isPathnamePrefixed","prefix","hasPathnamePrefixed","prefixHref","prefixedHref","localizePathname","_extends","localizedHref","_excluded","BaseLink","_ref","ref","prefetch","rest","_objectWithoutPropertiesLoose","usePathname","isChangingLocale","_useState","useState","setLocalizedHref","useEffect","undefined","React","createElement","NextLink","BaseLink$1","forwardRef","Link","Link$1","hasWarned","LinkDeprecated","props","console","warn","NextIntlClientProvider","router","children","now","useRouter","error","Date","Error","IntlProvider","LocalizedLink","useNextRouter","useMemo","localize","nextLocale","window","location","push","options","args","Object","keys","length","apply","replace","_ref2","_excluded2","_ref3","_excluded3"],"mappings":"goBAQO,IAAMA,EAAsB,SCJrB,SAAUC,IACtB,IAIMC,EAASC,EAAAA,YASf,OAPID,MAAAA,GAAA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ntlClientProvider, default as NextIntlProvider } from './shared/next-intl.esm.js';
3
- export { default as Link } from './react-client/next-intl.esm3.js';
4
- export { default as useLocalizedRouter } from './react-client/next-intl.esm2.js';
3
+ export { default as Link } from './react-client/next-intl.esm2.js';
4
+ export { default as useLocalizedRouter } from './react-client/next-intl.esm3.js';
5
5
  export * from 'use-intl';
6
6
  //# sourceMappingURL=next-intl.esm.js.map
@@ -1,5 +1,5 @@
1
- import LinkDeprecated from './next-intl.esm3.js';
2
- export { default as Link } from './next-intl.esm3.js';
1
+ import LinkDeprecated from './next-intl.esm2.js';
2
+ export { default as Link } from './next-intl.esm2.js';
3
3
  export * from 'use-intl';
4
4
  import 'next/router';
5
5
  import 'react';
@@ -1,15 +1,18 @@
1
- import useRouter from '../client/next-intl.esm.js';
1
+ import { extends as _extends } from '../_virtual/next-intl.esm.js';
2
+ import React from 'react';
3
+ import Link from '../link/next-intl.esm.js';
2
4
 
3
5
  // TODO: Only available for backwards compatibility
4
6
  // during the beta, remove for stable release
5
7
  var hasWarned = false;
6
- function useLocalizedRouterDeprecated() {
8
+ /** @deprecated Is available as `import Link from 'next-intl/link'` now. */
9
+ function LinkDeprecated(props) {
7
10
  if (!hasWarned) {
8
- console.warn("\n\nDEPRECATION WARNING: The `useLocalizedRouter` import from `next-intl` is deprecated and will be removed in the stable release of next-intl. Please import `useLocalizedRouter` from `next-intl/client` instead. See https://next-intl-docs.vercel.app/docs/next-13/server-components\n\n");
11
+ console.warn("\n\nDEPRECATION WARNING: The import for `Link` from next-intl has changed.\n\nPreviously: import {Link} from 'next-intl';\nNow: import Link from 'next-intl/link';\n\nPlease upgrade your import accordingly. See also https://next-intl-docs.vercel.app/docs/routing/navigation#link\n\n");
9
12
  hasWarned = true;
10
13
  }
11
- return useRouter();
14
+ return React.createElement(Link, _extends({}, props));
12
15
  }
13
16
 
14
- export { useLocalizedRouterDeprecated as default };
17
+ export { LinkDeprecated as default };
15
18
  //# sourceMappingURL=next-intl.esm2.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"next-intl.esm2.js","sources":["../../src/react-client/useLocalizedRouter.tsx"],"sourcesContent":["import useRouter from '../client/useRouter';\n\n// TODO: Only available for backwards compatibility\n// during the beta, remove for stable release\n\nlet hasWarned = false;\n\nexport default function useLocalizedRouterDeprecated() {\n if (!hasWarned) {\n console.warn(\n `\\n\\nDEPRECATION WARNING: The \\`useLocalizedRouter\\` import from \\`next-intl\\` is deprecated and will be removed in the stable release of next-intl. Please import \\`useLocalizedRouter\\` from \\`next-intl/client\\` instead. See https://next-intl-docs.vercel.app/docs/next-13/server-components\\n\\n`\n );\n hasWarned = true;\n }\n\n return useRouter();\n}\n"],"names":["hasWarned","useLocalizedRouterDeprecated","console","warn","useRouter"],"mappings":";;AAEA;AACA;AAEA,IAAIA,SAAS,GAAG,KAAK,CAAA;AAEP,SAAUC,4BAA4BA,GAAA;EAClD,IAAI,CAACD,SAAS,EAAE;IACdE,OAAO,CAACC,IAAI,CAAA,8RAC4R,CACvS,CAAA;AACDH,IAAAA,SAAS,GAAG,IAAI,CAAA;AACjB,GAAA;EAED,OAAOI,SAAS,EAAE,CAAA;AACpB;;;;"}
1
+ {"version":3,"file":"next-intl.esm2.js","sources":["../../src/react-client/Link.tsx"],"sourcesContent":["import React, {ComponentProps} from 'react';\nimport Link from '../link';\n\n// TODO: Only available for backwards compatibility\n// during the beta, remove for stable release\n\nlet hasWarned = false;\n\n/** @deprecated Is available as `import Link from 'next-intl/link'` now. */\nexport default function LinkDeprecated(props: ComponentProps<typeof Link>) {\n if (!hasWarned) {\n console.warn(\n `\\n\\nDEPRECATION WARNING: The import for \\`Link\\` from next-intl has changed.\n\nPreviously: import {Link} from 'next-intl';\nNow: import Link from 'next-intl/link';\n\nPlease upgrade your import accordingly. See also https://next-intl-docs.vercel.app/docs/routing/navigation#link\\n\\n`\n );\n hasWarned = true;\n }\n\n return <Link {...props} />;\n}\n"],"names":["hasWarned","LinkDeprecated","props","console","warn","React","createElement","Link","_extends"],"mappings":";;;;AAGA;AACA;AAEA,IAAIA,SAAS,GAAG,KAAK,CAAA;AAErB;AACwB,SAAAC,cAAcA,CAACC,KAAkC,EAAA;EACvE,IAAI,CAACF,SAAS,EAAE;IACdG,OAAO,CAACC,IAAI,CAAA,kSAMoG,CAC/G,CAAA;AACDJ,IAAAA,SAAS,GAAG,IAAI,CAAA;AACjB,GAAA;EAED,OAAOK,KAAC,CAAAC,aAAA,CAAAC,IAAI,EAAAC,QAAA,CAAA,EAAA,EAAKN,KAAK,EAAI,CAAA;AAC5B;;;;"}
@@ -1,18 +1,15 @@
1
- import { extends as _extends } from '../_virtual/next-intl.esm.js';
2
- import React from 'react';
3
- import Link from '../link/next-intl.esm.js';
1
+ import useRouter from '../client/next-intl.esm.js';
4
2
 
5
3
  // TODO: Only available for backwards compatibility
6
4
  // during the beta, remove for stable release
7
5
  var hasWarned = false;
8
- /** @deprecated Is available as `import Link from 'next-intl/link'` now. */
9
- function LinkDeprecated(props) {
6
+ function useLocalizedRouterDeprecated() {
10
7
  if (!hasWarned) {
11
- console.warn("\n\nDEPRECATION WARNING: The import for `Link` from next-intl has changed.\n\nPreviously: import {Link} from 'next-intl';\nNow: import Link from 'next-intl/link';\n\nPlease upgrade your import accordingly. See also https://next-intl-docs.vercel.app/docs/next-13/navigation#link\n\n");
8
+ console.warn("\n\nDEPRECATION WARNING: The `useLocalizedRouter` import from `next-intl` is deprecated and will be removed in the stable release of next-intl. Please import `useLocalizedRouter` from `next-intl/client` instead. See https://next-intl-docs.vercel.app/docs/getting-started/app-router-server-components\n\n");
12
9
  hasWarned = true;
13
10
  }
14
- return React.createElement(Link, _extends({}, props));
11
+ return useRouter();
15
12
  }
16
13
 
17
- export { LinkDeprecated as default };
14
+ export { useLocalizedRouterDeprecated as default };
18
15
  //# sourceMappingURL=next-intl.esm3.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"next-intl.esm3.js","sources":["../../src/react-client/Link.tsx"],"sourcesContent":["import React, {ComponentProps} from 'react';\nimport Link from '../link';\n\n// TODO: Only available for backwards compatibility\n// during the beta, remove for stable release\n\nlet hasWarned = false;\n\n/** @deprecated Is available as `import Link from 'next-intl/link'` now. */\nexport default function LinkDeprecated(props: ComponentProps<typeof Link>) {\n if (!hasWarned) {\n console.warn(\n `\\n\\nDEPRECATION WARNING: The import for \\`Link\\` from next-intl has changed.\n\nPreviously: import {Link} from 'next-intl';\nNow: import Link from 'next-intl/link';\n\nPlease upgrade your import accordingly. See also https://next-intl-docs.vercel.app/docs/next-13/navigation#link\\n\\n`\n );\n hasWarned = true;\n }\n\n return <Link {...props} />;\n}\n"],"names":["hasWarned","LinkDeprecated","props","console","warn","React","createElement","Link","_extends"],"mappings":";;;;AAGA;AACA;AAEA,IAAIA,SAAS,GAAG,KAAK,CAAA;AAErB;AACwB,SAAAC,cAAcA,CAACC,KAAkC,EAAA;EACvE,IAAI,CAACF,SAAS,EAAE;IACdG,OAAO,CAACC,IAAI,CAAA,kSAMoG,CAC/G,CAAA;AACDJ,IAAAA,SAAS,GAAG,IAAI,CAAA;AACjB,GAAA;EAED,OAAOK,KAAC,CAAAC,aAAA,CAAAC,IAAI,EAAAC,QAAA,CAAA,EAAA,EAAKN,KAAK,EAAI,CAAA;AAC5B;;;;"}
1
+ {"version":3,"file":"next-intl.esm3.js","sources":["../../src/react-client/useLocalizedRouter.tsx"],"sourcesContent":["import useRouter from '../client/useRouter';\n\n// TODO: Only available for backwards compatibility\n// during the beta, remove for stable release\n\nlet hasWarned = false;\n\nexport default function useLocalizedRouterDeprecated() {\n if (!hasWarned) {\n console.warn(\n `\\n\\nDEPRECATION WARNING: The \\`useLocalizedRouter\\` import from \\`next-intl\\` is deprecated and will be removed in the stable release of next-intl. Please import \\`useLocalizedRouter\\` from \\`next-intl/client\\` instead. See https://next-intl-docs.vercel.app/docs/getting-started/app-router-server-components\\n\\n`\n );\n hasWarned = true;\n }\n\n return useRouter();\n}\n"],"names":["hasWarned","useLocalizedRouterDeprecated","console","warn","useRouter"],"mappings":";;AAEA;AACA;AAEA,IAAIA,SAAS,GAAG,KAAK,CAAA;AAEP,SAAUC,4BAA4BA,GAAA;EAClD,IAAI,CAACD,SAAS,EAAE;IACdE,OAAO,CAACC,IAAI,CAAA,iTAC+S,CAC1T,CAAA;AACDH,IAAAA,SAAS,GAAG,IAAI,CAAA;AACjB,GAAA;EAED,OAAOI,SAAS,EAAE,CAAA;AACpB;;;;"}
@@ -1,7 +1,7 @@
1
1
  export default function useLocalizedRouterDeprecated(): {
2
- push(href: string): void;
3
- replace(href: string): void;
4
- prefetch(href: string): void;
2
+ push(href: string, options?: import("next/dist/shared/lib/app-router-context").NavigateOptions | undefined): void;
3
+ replace(href: string, options?: import("next/dist/shared/lib/app-router-context").NavigateOptions | undefined): void;
4
+ prefetch(href: string, options?: import("next/dist/shared/lib/app-router-context").PrefetchOptions | undefined): void;
5
5
  back(): void;
6
6
  forward(): void;
7
7
  refresh(): void;