next-intl 2.16.0 → 2.17.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (196) hide show
  1. package/client.d.ts +1 -1
  2. package/dist/client/NextIntlClientProvider.d.mts +8 -0
  3. package/dist/client/NextIntlClientProvider.d.ts +8 -4
  4. package/dist/client/NextIntlClientProvider.js +2 -0
  5. package/dist/client/NextIntlClientProvider.js.map +1 -0
  6. package/dist/client/NextIntlClientProvider.mjs +2 -0
  7. package/dist/client/NextIntlClientProvider.mjs.map +1 -0
  8. package/dist/client/index.d.mts +6 -0
  9. package/dist/client/index.d.ts +6 -6
  10. package/dist/client/index.js +2 -0
  11. package/dist/client/index.js.map +1 -0
  12. package/dist/client/index.mjs +2 -0
  13. package/dist/client/index.mjs.map +1 -0
  14. package/dist/client/useClientLocale.d.mts +3 -0
  15. package/dist/client/useClientLocale.d.ts +3 -1
  16. package/dist/client/useClientLocale.js +2 -0
  17. package/dist/client/useClientLocale.js.map +1 -0
  18. package/dist/client/useClientLocale.mjs +2 -0
  19. package/dist/client/useClientLocale.mjs.map +1 -0
  20. package/dist/{src/client/usePathname.d.ts → client/usePathname.d.mts} +3 -1
  21. package/dist/client/usePathname.d.ts +16 -14
  22. package/dist/client/usePathname.js +2 -0
  23. package/dist/client/usePathname.js.map +1 -0
  24. package/dist/client/usePathname.mjs +2 -0
  25. package/dist/client/usePathname.mjs.map +1 -0
  26. package/dist/{src/client/useRouter.d.ts → client/useRouter.d.mts} +3 -1
  27. package/dist/client/useRouter.d.ts +26 -24
  28. package/dist/client/useRouter.js +2 -0
  29. package/dist/client/useRouter.js.map +1 -0
  30. package/dist/client/useRouter.mjs +2 -0
  31. package/dist/client/useRouter.mjs.map +1 -0
  32. package/dist/{next-intl.esm.js → index.d.mts} +2 -2
  33. package/dist/index.d.ts +3 -8
  34. package/dist/index.js +2 -8
  35. package/dist/index.js.map +1 -0
  36. package/dist/index.mjs +2 -0
  37. package/dist/index.mjs.map +1 -0
  38. package/dist/{src/link/Link.d.ts → link/Link.d.mts} +6 -3
  39. package/dist/link/Link.d.ts +30 -27
  40. package/dist/link/Link.js +2 -0
  41. package/dist/link/Link.js.map +1 -0
  42. package/dist/link/Link.mjs +2 -0
  43. package/dist/link/Link.mjs.map +1 -0
  44. package/dist/link/index.d.mts +4 -0
  45. package/dist/link/index.d.ts +4 -1
  46. package/dist/link/index.js +2 -0
  47. package/dist/link/index.js.map +1 -0
  48. package/dist/link/index.mjs +2 -0
  49. package/dist/link/index.mjs.map +1 -0
  50. package/dist/{src/middleware/NextIntlMiddlewareConfig.d.ts → middleware/NextIntlMiddlewareConfig.d.mts} +4 -3
  51. package/dist/middleware/NextIntlMiddlewareConfig.d.ts +29 -28
  52. package/dist/middleware/NextIntlMiddlewareConfig.js +2 -0
  53. package/dist/middleware/NextIntlMiddlewareConfig.js.map +1 -0
  54. package/dist/middleware/NextIntlMiddlewareConfig.mjs +1 -0
  55. package/dist/middleware/NextIntlMiddlewareConfig.mjs.map +1 -0
  56. package/dist/{src/middleware/getAlternateLinksHeaderValue.d.ts → middleware/getAlternateLinksHeaderValue.d.mts} +5 -2
  57. package/dist/middleware/getAlternateLinksHeaderValue.d.ts +9 -6
  58. package/dist/middleware/getAlternateLinksHeaderValue.js +2 -0
  59. package/dist/middleware/getAlternateLinksHeaderValue.js.map +1 -0
  60. package/dist/middleware/getAlternateLinksHeaderValue.mjs +2 -0
  61. package/dist/middleware/getAlternateLinksHeaderValue.mjs.map +1 -0
  62. package/dist/middleware/index.d.mts +3 -0
  63. package/dist/middleware/index.d.ts +3 -4
  64. package/dist/middleware/index.js +2 -0
  65. package/dist/middleware/index.js.map +1 -0
  66. package/dist/middleware/index.mjs +2 -0
  67. package/dist/middleware/index.mjs.map +1 -0
  68. package/dist/middleware/middleware.d.mts +6 -0
  69. package/dist/middleware/middleware.d.ts +6 -3
  70. package/dist/middleware/middleware.js +2 -0
  71. package/dist/middleware/middleware.js.map +1 -0
  72. package/dist/middleware/middleware.mjs +2 -0
  73. package/dist/middleware/middleware.mjs.map +1 -0
  74. package/dist/middleware/resolveLocale.d.mts +9 -0
  75. package/dist/middleware/resolveLocale.d.ts +9 -6
  76. package/dist/middleware/resolveLocale.js +2 -0
  77. package/dist/middleware/resolveLocale.js.map +1 -0
  78. package/dist/middleware/resolveLocale.mjs +2 -0
  79. package/dist/middleware/resolveLocale.mjs.map +1 -0
  80. package/dist/middleware/utils.d.mts +8 -0
  81. package/dist/middleware/utils.d.ts +8 -5
  82. package/dist/middleware/utils.js +2 -0
  83. package/dist/middleware/utils.js.map +1 -0
  84. package/dist/middleware/utils.mjs +2 -0
  85. package/dist/middleware/utils.mjs.map +1 -0
  86. package/dist/react-client/index.d.mts +3 -0
  87. package/dist/react-client/index.d.ts +3 -12
  88. package/dist/react-client/index.js +2 -0
  89. package/dist/react-client/index.js.map +1 -0
  90. package/dist/react-client/index.mjs +2 -0
  91. package/dist/react-client/index.mjs.map +1 -0
  92. package/dist/react-server/index.d.mts +23 -0
  93. package/dist/react-server/index.d.ts +23 -17
  94. package/dist/react-server/index.js +7 -0
  95. package/dist/react-server/index.js.map +1 -0
  96. package/dist/react-server/index.mjs +7 -0
  97. package/dist/react-server/index.mjs.map +1 -0
  98. package/dist/server/index.d.mts +7 -0
  99. package/dist/server/index.d.ts +7 -6
  100. package/dist/server/index.js +14 -0
  101. package/dist/server/index.js.map +1 -0
  102. package/dist/server/index.mjs +14 -0
  103. package/dist/server/index.mjs.map +1 -0
  104. package/dist/{src/shared/BaseLink.d.ts → shared/BaseLink.d.mts} +3 -1
  105. package/dist/shared/BaseLink.d.ts +9 -7
  106. package/dist/shared/BaseLink.js +2 -0
  107. package/dist/shared/BaseLink.js.map +1 -0
  108. package/dist/shared/BaseLink.mjs +2 -0
  109. package/dist/shared/BaseLink.mjs.map +1 -0
  110. package/dist/{src/shared/NextIntlClientProvider.d.ts → shared/NextIntlClientProvider.d.mts} +4 -2
  111. package/dist/shared/NextIntlClientProvider.d.ts +11 -9
  112. package/dist/shared/NextIntlClientProvider.js +2 -0
  113. package/dist/shared/NextIntlClientProvider.js.map +1 -0
  114. package/dist/shared/NextIntlClientProvider.mjs +2 -0
  115. package/dist/shared/NextIntlClientProvider.mjs.map +1 -0
  116. package/dist/shared/constants.d.mts +4 -0
  117. package/dist/shared/constants.d.ts +4 -2
  118. package/dist/shared/constants.js +2 -0
  119. package/dist/shared/constants.js.map +1 -0
  120. package/dist/shared/constants.mjs +2 -0
  121. package/dist/shared/constants.mjs.map +1 -0
  122. package/dist/shared/utils.d.mts +16 -0
  123. package/dist/shared/utils.d.ts +16 -15
  124. package/dist/shared/utils.js +2 -0
  125. package/dist/shared/utils.js.map +1 -0
  126. package/dist/shared/utils.mjs +2 -0
  127. package/dist/shared/utils.mjs.map +1 -0
  128. package/link.d.ts +1 -1
  129. package/middleware.d.ts +1 -1
  130. package/package.json +31 -22
  131. package/server.d.ts +1 -1
  132. package/dist/_virtual/next-intl.esm.js +0 -29
  133. package/dist/_virtual/next-intl.esm.js.map +0 -1
  134. package/dist/next-intl.cjs.development.js +0 -82
  135. package/dist/next-intl.cjs.development.js.map +0 -1
  136. package/dist/next-intl.cjs.production.min.js +0 -2
  137. package/dist/next-intl.cjs.production.min.js.map +0 -1
  138. package/dist/next-intl.esm.js.map +0 -1
  139. package/dist/shared/next-intl.esm.js +0 -41
  140. package/dist/shared/next-intl.esm.js.map +0 -1
  141. package/dist/src/client/NextIntlClientProvider.d.ts +0 -4
  142. package/dist/src/client/NextIntlClientProvider.js +0 -16
  143. package/dist/src/client/NextIntlClientProvider.js.map +0 -1
  144. package/dist/src/client/index.d.ts +0 -6
  145. package/dist/src/client/index.js +0 -8
  146. package/dist/src/client/index.js.map +0 -1
  147. package/dist/src/client/useClientLocale.d.ts +0 -1
  148. package/dist/src/client/useClientLocale.js +0 -18
  149. package/dist/src/client/useClientLocale.js.map +0 -1
  150. package/dist/src/client/usePathname.js +0 -34
  151. package/dist/src/client/usePathname.js.map +0 -1
  152. package/dist/src/client/useRouter.js +0 -42
  153. package/dist/src/client/useRouter.js.map +0 -1
  154. package/dist/src/index.d.ts +0 -8
  155. package/dist/src/index.js +0 -9
  156. package/dist/src/index.js.map +0 -1
  157. package/dist/src/link/Link.js +0 -29
  158. package/dist/src/link/Link.js.map +0 -1
  159. package/dist/src/link/index.d.ts +0 -1
  160. package/dist/src/link/index.js +0 -2
  161. package/dist/src/link/index.js.map +0 -1
  162. package/dist/src/middleware/NextIntlMiddlewareConfig.js +0 -2
  163. package/dist/src/middleware/NextIntlMiddlewareConfig.js.map +0 -1
  164. package/dist/src/middleware/getAlternateLinksHeaderValue.js +0 -64
  165. package/dist/src/middleware/getAlternateLinksHeaderValue.js.map +0 -1
  166. package/dist/src/middleware/index.d.ts +0 -4
  167. package/dist/src/middleware/index.js +0 -5
  168. package/dist/src/middleware/index.js.map +0 -1
  169. package/dist/src/middleware/middleware.d.ts +0 -3
  170. package/dist/src/middleware/middleware.js +0 -142
  171. package/dist/src/middleware/middleware.js.map +0 -1
  172. package/dist/src/middleware/resolveLocale.d.ts +0 -6
  173. package/dist/src/middleware/resolveLocale.js +0 -88
  174. package/dist/src/middleware/resolveLocale.js.map +0 -1
  175. package/dist/src/middleware/utils.d.ts +0 -5
  176. package/dist/src/middleware/utils.js +0 -37
  177. package/dist/src/middleware/utils.js.map +0 -1
  178. package/dist/src/react-client/index.d.ts +0 -12
  179. package/dist/src/react-client/index.js +0 -14
  180. package/dist/src/react-client/index.js.map +0 -1
  181. package/dist/src/react-server/index.d.ts +0 -17
  182. package/dist/src/react-server/index.js +0 -25
  183. package/dist/src/react-server/index.js.map +0 -1
  184. package/dist/src/server/index.d.ts +0 -6
  185. package/dist/src/server/index.js +0 -30
  186. package/dist/src/server/index.js.map +0 -1
  187. package/dist/src/shared/BaseLink.js +0 -38
  188. package/dist/src/shared/BaseLink.js.map +0 -1
  189. package/dist/src/shared/NextIntlClientProvider.js +0 -33
  190. package/dist/src/shared/NextIntlClientProvider.js.map +0 -1
  191. package/dist/src/shared/constants.d.ts +0 -2
  192. package/dist/src/shared/constants.js +0 -6
  193. package/dist/src/shared/constants.js.map +0 -1
  194. package/dist/src/shared/utils.d.ts +0 -15
  195. package/dist/src/shared/utils.js +0 -53
  196. package/dist/src/shared/utils.js.map +0 -1
package/client.d.ts CHANGED
@@ -1 +1 @@
1
- export * from './dist/src/client';
1
+ export * from './dist/client';
@@ -0,0 +1,8 @@
1
+ import { ComponentProps } from 'react';
2
+ import NextIntlClientProvider$1 from '../shared/NextIntlClientProvider.mjs';
3
+ import 'use-intl';
4
+
5
+ /** @deprecated Should be imported from `next-intl`, not `next-intl/client`. */
6
+ declare function NextIntlClientProvider(props: ComponentProps<typeof NextIntlClientProvider$1>): JSX.Element;
7
+
8
+ export { NextIntlClientProvider as default };
@@ -1,4 +1,8 @@
1
- import { ComponentProps } from 'react';
2
- import NextIntlClientProvider_ from '../shared/NextIntlClientProvider';
3
- /** @deprecated Should be imported from `next-intl`, not `next-intl/client`. */
4
- export default function NextIntlClientProvider(props: ComponentProps<typeof NextIntlClientProvider_>): JSX.Element;
1
+ import { ComponentProps } from 'react';
2
+ import NextIntlClientProvider$1 from '../shared/NextIntlClientProvider.js';
3
+ import 'use-intl';
4
+
5
+ /** @deprecated Should be imported from `next-intl`, not `next-intl/client`. */
6
+ declare function NextIntlClientProvider(props: ComponentProps<typeof NextIntlClientProvider$1>): JSX.Element;
7
+
8
+ export { NextIntlClientProvider as default };
@@ -0,0 +1,2 @@
1
+ "use strict";var x=Object.create;var o=Object.defineProperty;var P=Object.getOwnPropertyDescriptor;var s=Object.getOwnPropertyNames;var C=Object.getPrototypeOf,I=Object.prototype.hasOwnProperty;var u=(t,e)=>{for(var r in e)o(t,r,{get:e[r],enumerable:!0})},l=(t,e,r,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of s(e))!I.call(t,n)&&n!==r&&o(t,n,{get:()=>e[n],enumerable:!(i=P(e,n))||i.enumerable});return t};var p=(t,e,r)=>(r=t!=null?x(C(t)):{},l(e||!t||!t.__esModule?o(r,"default",{value:t,enumerable:!0}):r,t)),v=t=>l(o({},"__esModule",{value:!0}),t);var N={};u(N,{default:()=>a});module.exports=v(N);var d=p(require("react")),f=p(require("../shared/NextIntlClientProvider"));let m=!1;function a(t){return m||(m=!0,console.warn("\nImporting `NextIntlClientProvider` from `next-intl/client` is deprecated. Please update the import:\n\n import {NextIntlClientProvider} from 'next-intl';\n")),d.default.createElement(f.default,{...t})}
2
+ //# sourceMappingURL=NextIntlClientProvider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/client/NextIntlClientProvider.tsx"],"sourcesContent":["import React, {ComponentProps} from 'react';\nimport NextIntlClientProvider_ from '../shared/NextIntlClientProvider';\n\nlet hasWarned = false;\n/** @deprecated Should be imported from `next-intl`, not `next-intl/client`. */\nexport default function NextIntlClientProvider(\n props: ComponentProps<typeof NextIntlClientProvider_>\n) {\n if (!hasWarned) {\n hasWarned = true;\n console.warn(`\nImporting \\`NextIntlClientProvider\\` from \\`next-intl/client\\` is deprecated. Please update the import:\n\n import {NextIntlClientProvider} from 'next-intl';\n`);\n }\n return <NextIntlClientProvider_ {...props} />;\n}\n"],"mappings":"0jBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,aAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAAoC,oBACpCC,EAAoC,+CAEpC,IAAIC,EAAY,GAED,SAARJ,EACLK,EACA,CACA,OAAKD,IACHA,EAAY,GACZ,QAAQ,KAAK,gKAIhB,GAEQ,EAAAE,QAAA,cAAC,EAAAC,QAAA,CAAyB,GAAGF,EAAO,CAC7C","names":["NextIntlClientProvider_exports","__export","NextIntlClientProvider","__toCommonJS","import_react","import_NextIntlClientProvider","hasWarned","props","React","NextIntlClientProvider_"]}
@@ -0,0 +1,2 @@
1
+ import r from"react";import n from"../shared/NextIntlClientProvider";let t=!1;function o(e){return t||(t=!0,console.warn("\nImporting `NextIntlClientProvider` from `next-intl/client` is deprecated. Please update the import:\n\n import {NextIntlClientProvider} from 'next-intl';\n")),r.createElement(n,{...e})}export{o as default};
2
+ //# sourceMappingURL=NextIntlClientProvider.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/client/NextIntlClientProvider.tsx"],"sourcesContent":["import React, {ComponentProps} from 'react';\nimport NextIntlClientProvider_ from '../shared/NextIntlClientProvider';\n\nlet hasWarned = false;\n/** @deprecated Should be imported from `next-intl`, not `next-intl/client`. */\nexport default function NextIntlClientProvider(\n props: ComponentProps<typeof NextIntlClientProvider_>\n) {\n if (!hasWarned) {\n hasWarned = true;\n console.warn(`\nImporting \\`NextIntlClientProvider\\` from \\`next-intl/client\\` is deprecated. Please update the import:\n\n import {NextIntlClientProvider} from 'next-intl';\n`);\n }\n return <NextIntlClientProvider_ {...props} />;\n}\n"],"mappings":"AAAA,OAAOA,MAA6B,QACpC,OAAOC,MAA6B,mCAEpC,IAAIC,EAAY,GAED,SAARC,EACLC,EACA,CACA,OAAKF,IACHA,EAAY,GACZ,QAAQ,KAAK,gKAIhB,GAEQF,EAAA,cAACC,EAAA,CAAyB,GAAGG,EAAO,CAC7C","names":["React","NextIntlClientProvider_","hasWarned","NextIntlClientProvider","props"]}
@@ -0,0 +1,6 @@
1
+ export { default as useRouter } from './useRouter.mjs';
2
+ export { default as usePathname } from './usePathname.mjs';
3
+ export { default as NextIntlClientProvider } from './NextIntlClientProvider.mjs';
4
+ import 'react';
5
+ import '../shared/NextIntlClientProvider.mjs';
6
+ import 'use-intl';
@@ -1,6 +1,6 @@
1
- /**
2
- * Client-only APIs available via `next-intl/client`.
3
- */
4
- export { default as useRouter } from './useRouter';
5
- export { default as usePathname } from './usePathname';
6
- export { default as NextIntlClientProvider } from './NextIntlClientProvider';
1
+ export { default as useRouter } from './useRouter.js';
2
+ export { default as usePathname } from './usePathname.js';
3
+ export { default as NextIntlClientProvider } from './NextIntlClientProvider.js';
4
+ import 'react';
5
+ import '../shared/NextIntlClientProvider.js';
6
+ import 'use-intl';
@@ -0,0 +1,2 @@
1
+ "use strict";var x=Object.create;var o=Object.defineProperty;var n=Object.getOwnPropertyDescriptor;var p=Object.getOwnPropertyNames;var i=Object.getPrototypeOf,P=Object.prototype.hasOwnProperty;var h=(e,t)=>{for(var r in t)o(e,r,{get:t[r],enumerable:!0})},l=(e,t,r,u)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of p(t))!P.call(e,a)&&a!==r&&o(e,a,{get:()=>t[a],enumerable:!(u=n(t,a))||u.enumerable});return e};var f=(e,t,r)=>(r=e!=null?x(i(e)):{},l(t||!e||!e.__esModule?o(r,"default",{value:e,enumerable:!0}):r,e)),v=e=>l(o({},"__esModule",{value:!0}),e);var C={};h(C,{NextIntlClientProvider:()=>m.default,usePathname:()=>d.default,useRouter:()=>s.default});module.exports=v(C);var s=f(require("./useRouter")),d=f(require("./usePathname")),m=f(require("./NextIntlClientProvider"));0&&(module.exports={NextIntlClientProvider,usePathname,useRouter});
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/client/index.tsx"],"sourcesContent":["/**\n * Client-only APIs available via `next-intl/client`.\n */\n\nexport {default as useRouter} from './useRouter';\nexport {default as usePathname} from './usePathname';\n\n// Legacy export (deprecation is handled by component)\nexport {default as NextIntlClientProvider} from './NextIntlClientProvider';\n"],"mappings":"0jBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,yGAAAE,EAAAF,GAIA,IAAAG,EAAmC,0BACnCC,EAAqC,4BAGrCC,EAAgD","names":["client_exports","__export","__toCommonJS","import_useRouter","import_usePathname","import_NextIntlClientProvider"]}
@@ -0,0 +1,2 @@
1
+ import{default as r}from"./useRouter";import{default as o}from"./usePathname";import{default as u}from"./NextIntlClientProvider";export{u as NextIntlClientProvider,o as usePathname,r as useRouter};
2
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/client/index.tsx"],"sourcesContent":["/**\n * Client-only APIs available via `next-intl/client`.\n */\n\nexport {default as useRouter} from './useRouter';\nexport {default as usePathname} from './usePathname';\n\n// Legacy export (deprecation is handled by component)\nexport {default as NextIntlClientProvider} from './NextIntlClientProvider';\n"],"mappings":"AAIA,OAAmB,WAAXA,MAA2B,cACnC,OAAmB,WAAXA,MAA6B,gBAGrC,OAAmB,WAAXA,MAAwC","names":["default"]}
@@ -0,0 +1,3 @@
1
+ declare function useClientLocale(): string;
2
+
3
+ export { useClientLocale as default };
@@ -1 +1,3 @@
1
- export default function useClientLocale(): string;
1
+ declare function useClientLocale(): string;
2
+
3
+ export { useClientLocale as default };
@@ -0,0 +1,2 @@
1
+ "use strict";var l=Object.defineProperty;var i=Object.getOwnPropertyDescriptor;var m=Object.getOwnPropertyNames;var c=Object.prototype.hasOwnProperty;var p=(o,e)=>{for(var r in e)l(o,r,{get:e[r],enumerable:!0})},E=(o,e,r,u)=>{if(e&&typeof e=="object"||typeof e=="function")for(let t of m(e))!c.call(o,t)&&t!==r&&l(o,t,{get:()=>e[t],enumerable:!(u=i(e,t))||u.enumerable});return o};var L=o=>E(l({},"__esModule",{value:!0}),o);var y={};p(y,{default:()=>f});module.exports=L(y);var n=require("next/navigation"),a=require("use-intl"),s=require("../shared/constants");function f(){let o;const e=(0,n.useParams)();return e!=null&&e[s.LOCALE_SEGMENT_NAME]?o=e[s.LOCALE_SEGMENT_NAME]:o=(0,a.useLocale)(),o}
2
+ //# sourceMappingURL=useClientLocale.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/client/useClientLocale.tsx"],"sourcesContent":["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"],"mappings":"yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,aAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAAwB,2BACxBC,EAAwB,oBACxBC,EAAkC,+BAEnB,SAARJ,GAA2C,CAChD,IAAIK,EAIJ,MAAMC,KAAS,aAAU,EAEzB,OAAIA,GAAA,MAAAA,EAAS,uBACXD,EAASC,EAAO,qBAAmB,EAGnCD,KAAS,aAAU,EAGdA,CACT","names":["useClientLocale_exports","__export","useClientLocale","__toCommonJS","import_navigation","import_use_intl","import_constants","locale","params"]}
@@ -0,0 +1,2 @@
1
+ import{useParams as r}from"next/navigation";import{useLocale as l}from"use-intl";import{LOCALE_SEGMENT_NAME as t}from"../shared/constants";function s(){let o;const e=r();return e!=null&&e[t]?o=e[t]:o=l(),o}export{s as default};
2
+ //# sourceMappingURL=useClientLocale.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/client/useClientLocale.tsx"],"sourcesContent":["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"],"mappings":"AAAA,OAAQ,aAAAA,MAAgB,kBACxB,OAAQ,aAAAC,MAAgB,WACxB,OAAQ,uBAAAC,MAA0B,sBAEnB,SAARC,GAA2C,CAChD,IAAIC,EAIJ,MAAMC,EAASL,EAAU,EAEzB,OAAIK,GAAA,MAAAA,EAASH,GACXE,EAASC,EAAOH,CAAmB,EAGnCE,EAASH,EAAU,EAGdG,CACT","names":["useParams","useLocale","LOCALE_SEGMENT_NAME","useClientLocale","locale","params"]}
@@ -11,4 +11,6 @@
11
11
  * const pathname = usePathname();
12
12
  * ```
13
13
  */
14
- export default function usePathname(): string;
14
+ declare function usePathname(): string;
15
+
16
+ export { usePathname as default };
@@ -1,14 +1,16 @@
1
- /**
2
- * Returns the pathname without a potential locale prefix.
3
- *
4
- * @example
5
- * ```tsx
6
- * 'use client';
7
- *
8
- * import {usePathname} from 'next-intl/client';
9
- *
10
- * // When the user is on `/en`, this will be `/`
11
- * const pathname = usePathname();
12
- * ```
13
- */
14
- export default function usePathname(): string;
1
+ /**
2
+ * Returns the pathname without a potential locale prefix.
3
+ *
4
+ * @example
5
+ * ```tsx
6
+ * 'use client';
7
+ *
8
+ * import {usePathname} from 'next-intl/client';
9
+ *
10
+ * // When the user is on `/en`, this will be `/`
11
+ * const pathname = usePathname();
12
+ * ```
13
+ */
14
+ declare function usePathname(): string;
15
+
16
+ export { usePathname as default };
@@ -0,0 +1,2 @@
1
+ "use strict";"use client";var h=Object.create;var o=Object.defineProperty;var f=Object.getOwnPropertyDescriptor;var c=Object.getOwnPropertyNames;var p=Object.getPrototypeOf,x=Object.prototype.hasOwnProperty;var d=(e,t)=>{for(var a in t)o(e,a,{get:t[a],enumerable:!0})},s=(e,t,a,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of c(t))!x.call(e,n)&&n!==a&&o(e,n,{get:()=>t[n],enumerable:!(r=f(t,n))||r.enumerable});return e};var y=(e,t,a)=>(a=e!=null?h(p(e)):{},s(t||!e||!e.__esModule?o(a,"default",{value:e,enumerable:!0}):a,e)),z=e=>s(o({},"__esModule",{value:!0}),e);var N={};d(N,{default:()=>P});module.exports=z(N);var u=require("next/navigation"),i=require("react"),m=require("../shared/utils"),l=y(require("./useClientLocale"));function P(){const e=(0,u.usePathname)(),t=(0,l.default)();return(0,i.useMemo)(()=>e&&((0,m.hasPathnamePrefixed)(t,e)?(0,m.unlocalizePathname)(e,t):e),[t,e])}
2
+ //# sourceMappingURL=usePathname.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/client/usePathname.tsx"],"sourcesContent":["'use client';\n\nimport {usePathname as useNextPathname} from 'next/navigation';\nimport {useMemo} from 'react';\nimport {hasPathnamePrefixed, unlocalizePathname} from '../shared/utils';\nimport useClientLocale from './useClientLocale';\n\n/**\n * Returns the pathname without a potential locale prefix.\n *\n * @example\n * ```tsx\n * 'use client';\n *\n * import {usePathname} from 'next-intl/client';\n *\n * // When the user is on `/en`, this will be `/`\n * const pathname = usePathname();\n * ```\n */\nexport default function usePathname(): string {\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 = useNextPathname() as ReturnType<\n typeof useNextPathname\n > | null;\n\n const locale = useClientLocale();\n\n return useMemo(() => {\n if (!pathname) return pathname as ReturnType<typeof useNextPathname>;\n\n const isPathnamePrefixed = hasPathnamePrefixed(locale, pathname);\n const unlocalizedPathname = isPathnamePrefixed\n ? unlocalizePathname(pathname, locale)\n : pathname;\n\n return unlocalizedPathname;\n }, [locale, pathname]);\n}\n"],"mappings":"ukBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,aAAAE,IAAA,eAAAC,EAAAH,GAEA,IAAAI,EAA6C,2BAC7CC,EAAsB,iBACtBC,EAAsD,2BACtDC,EAA4B,gCAeb,SAARL,GAAuC,CAG5C,MAAMM,KAAW,EAAAC,aAAgB,EAI3BC,KAAS,EAAAC,SAAgB,EAE/B,SAAO,WAAQ,IACRH,OAEsB,uBAAoBE,EAAQF,CAAQ,KAE3D,sBAAmBA,EAAUE,CAAM,EACnCF,GAGH,CAACE,EAAQF,CAAQ,CAAC,CACvB","names":["usePathname_exports","__export","usePathname","__toCommonJS","import_navigation","import_react","import_utils","import_useClientLocale","pathname","useNextPathname","locale","useClientLocale"]}
@@ -0,0 +1,2 @@
1
+ "use client";import{usePathname as a}from"next/navigation";import{useMemo as n}from"react";import{hasPathnamePrefixed as o,unlocalizePathname as m}from"../shared/utils";import r from"./useClientLocale";function s(){const e=a(),t=r();return n(()=>e&&(o(t,e)?m(e,t):e),[t,e])}export{s as default};
2
+ //# sourceMappingURL=usePathname.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/client/usePathname.tsx"],"sourcesContent":["'use client';\n\nimport {usePathname as useNextPathname} from 'next/navigation';\nimport {useMemo} from 'react';\nimport {hasPathnamePrefixed, unlocalizePathname} from '../shared/utils';\nimport useClientLocale from './useClientLocale';\n\n/**\n * Returns the pathname without a potential locale prefix.\n *\n * @example\n * ```tsx\n * 'use client';\n *\n * import {usePathname} from 'next-intl/client';\n *\n * // When the user is on `/en`, this will be `/`\n * const pathname = usePathname();\n * ```\n */\nexport default function usePathname(): string {\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 = useNextPathname() as ReturnType<\n typeof useNextPathname\n > | null;\n\n const locale = useClientLocale();\n\n return useMemo(() => {\n if (!pathname) return pathname as ReturnType<typeof useNextPathname>;\n\n const isPathnamePrefixed = hasPathnamePrefixed(locale, pathname);\n const unlocalizedPathname = isPathnamePrefixed\n ? unlocalizePathname(pathname, locale)\n : pathname;\n\n return unlocalizedPathname;\n }, [locale, pathname]);\n}\n"],"mappings":"aAEA,OAAQ,eAAeA,MAAsB,kBAC7C,OAAQ,WAAAC,MAAc,QACtB,OAAQ,uBAAAC,EAAqB,sBAAAC,MAAyB,kBACtD,OAAOC,MAAqB,oBAeb,SAARC,GAAuC,CAG5C,MAAMC,EAAWN,EAAgB,EAI3BO,EAASH,EAAgB,EAE/B,OAAOH,EAAQ,IACRK,IAEsBJ,EAAoBK,EAAQD,CAAQ,EAE3DH,EAAmBG,EAAUC,CAAM,EACnCD,GAGH,CAACC,EAAQD,CAAQ,CAAC,CACvB","names":["useNextPathname","useMemo","hasPathnamePrefixed","unlocalizePathname","useClientLocale","usePathname","pathname","locale"]}
@@ -14,7 +14,7 @@
14
14
  * router.push('/about');
15
15
  * ```
16
16
  */
17
- export default function useRouter(): {
17
+ declare function useRouter(): {
18
18
  push(href: string): void;
19
19
  replace(href: string): void;
20
20
  prefetch(href: string): void;
@@ -22,3 +22,5 @@ export default function useRouter(): {
22
22
  forward(): void;
23
23
  refresh(): void;
24
24
  };
25
+
26
+ export { useRouter as default };
@@ -1,24 +1,26 @@
1
- /**
2
- * Returns a wrapped instance of `useRouter` from `next/navigation` that
3
- * will automatically localize the `href` parameters it receives.
4
- *
5
- * @example
6
- * ```tsx
7
- * 'use client';
8
- *
9
- * import {useRouter} from 'next-intl/client';
10
- *
11
- * const router = useRouter();
12
- *
13
- * // When the user is on `/en`, the router will navigate to `/en/about`
14
- * router.push('/about');
15
- * ```
16
- */
17
- export default function useRouter(): {
18
- push(href: string): void;
19
- replace(href: string): void;
20
- prefetch(href: string): void;
21
- back(): void;
22
- forward(): void;
23
- refresh(): void;
24
- };
1
+ /**
2
+ * Returns a wrapped instance of `useRouter` from `next/navigation` that
3
+ * will automatically localize the `href` parameters it receives.
4
+ *
5
+ * @example
6
+ * ```tsx
7
+ * 'use client';
8
+ *
9
+ * import {useRouter} from 'next-intl/client';
10
+ *
11
+ * const router = useRouter();
12
+ *
13
+ * // When the user is on `/en`, the router will navigate to `/en/about`
14
+ * router.push('/about');
15
+ * ```
16
+ */
17
+ declare function useRouter(): {
18
+ push(href: string): void;
19
+ replace(href: string): void;
20
+ prefetch(href: string): void;
21
+ back(): void;
22
+ forward(): void;
23
+ refresh(): void;
24
+ };
25
+
26
+ export { useRouter as default };
@@ -0,0 +1,2 @@
1
+ "use strict";var f=Object.create;var u=Object.defineProperty;var m=Object.getOwnPropertyDescriptor;var h=Object.getOwnPropertyNames;var g=Object.getPrototypeOf,R=Object.prototype.hasOwnProperty;var d=(r,e)=>{for(var t in e)u(r,t,{get:e[t],enumerable:!0})},i=(r,e,t,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of h(e))!R.call(r,n)&&n!==t&&u(r,n,{get:()=>e[n],enumerable:!(o=m(e,n))||o.enumerable});return r};var w=(r,e,t)=>(t=r!=null?f(g(r)):{},i(e||!r||!r.__esModule?u(t,"default",{value:r,enumerable:!0}):t,r)),x=r=>i(u({},"__esModule",{value:!0}),r);var z={};d(z,{default:()=>a});module.exports=x(z);var s=require("next/navigation"),c=require("react"),l=require("../shared/utils"),p=w(require("./useClientLocale"));function a(){const r=(0,s.useRouter)(),e=(0,p.default)();return(0,c.useMemo)(()=>{function t(o){return(0,l.localizeHref)(o,e,e,window.location.pathname)}return{...r,push(o){return r.push(t(o))},replace(o){return r.replace(t(o))},prefetch(o){return r.prefetch(t(o))}}},[e,r])}
2
+ //# sourceMappingURL=useRouter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"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"],"mappings":"0jBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,aAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAAyC,2BACzCC,EAAsB,iBACtBC,EAA2B,2BAC3BC,EAA4B,gCAkBb,SAARL,GAA6B,CAClC,MAAMM,KAAS,EAAAC,WAAc,EACvBC,KAAS,EAAAC,SAAgB,EAE/B,SAAO,WAAQ,IAAM,CACnB,SAASC,EAASC,EAAc,CAC9B,SAAO,gBAAaA,EAAMH,EAAQA,EAAQ,OAAO,SAAS,QAAQ,CACpE,CAEA,MAAO,CACL,GAAGF,EACH,KAAKK,EAAc,CACjB,OAAOL,EAAO,KAAKI,EAASC,CAAI,CAAC,CACnC,EACA,QAAQA,EAAc,CACpB,OAAOL,EAAO,QAAQI,EAASC,CAAI,CAAC,CACtC,EACA,SAASA,EAAc,CACrB,OAAOL,EAAO,SAASI,EAASC,CAAI,CAAC,CACvC,CACF,CACF,EAAG,CAACH,EAAQF,CAAM,CAAC,CACrB","names":["useRouter_exports","__export","useRouter","__toCommonJS","import_navigation","import_react","import_utils","import_useClientLocale","router","useNextRouter","locale","useClientLocale","localize","href"]}
@@ -0,0 +1,2 @@
1
+ import{useRouter as n}from"next/navigation";import{useMemo as u}from"react";import{localizeHref as i}from"../shared/utils";import s from"./useClientLocale";function c(){const e=n(),t=s();return u(()=>{function o(r){return i(r,t,t,window.location.pathname)}return{...e,push(r){return e.push(o(r))},replace(r){return e.replace(o(r))},prefetch(r){return e.prefetch(o(r))}}},[t,e])}export{c as default};
2
+ //# sourceMappingURL=useRouter.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"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"],"mappings":"AAAA,OAAQ,aAAaA,MAAoB,kBACzC,OAAQ,WAAAC,MAAc,QACtB,OAAQ,gBAAAC,MAAmB,kBAC3B,OAAOC,MAAqB,oBAkBb,SAARC,GAA6B,CAClC,MAAMC,EAASL,EAAc,EACvBM,EAASH,EAAgB,EAE/B,OAAOF,EAAQ,IAAM,CACnB,SAASM,EAASC,EAAc,CAC9B,OAAON,EAAaM,EAAMF,EAAQA,EAAQ,OAAO,SAAS,QAAQ,CACpE,CAEA,MAAO,CACL,GAAGD,EACH,KAAKG,EAAc,CACjB,OAAOH,EAAO,KAAKE,EAASC,CAAI,CAAC,CACnC,EACA,QAAQA,EAAc,CACpB,OAAOH,EAAO,QAAQE,EAASC,CAAI,CAAC,CACtC,EACA,SAASA,EAAc,CACrB,OAAOH,EAAO,SAASE,EAASC,CAAI,CAAC,CACvC,CACF,CACF,EAAG,CAACF,EAAQD,CAAM,CAAC,CACrB","names":["useNextRouter","useMemo","localizeHref","useClientLocale","useRouter","router","locale","localize","href"]}
@@ -1,3 +1,3 @@
1
1
  export * from 'use-intl';
2
- export { default as NextIntlClientProvider, default as NextIntlProvider } from './shared/next-intl.esm.js';
3
- //# sourceMappingURL=next-intl.esm.js.map
2
+ export { default as NextIntlClientProvider, default as NextIntlProvider } from './shared/NextIntlClientProvider.mjs';
3
+ import 'react';
package/dist/index.d.ts CHANGED
@@ -1,8 +1,3 @@
1
- /**
2
- * This is the default entry file when consumers import from
3
- * 'next-intl'. We use the client APIs in this case.
4
- *
5
- * Note that the `react-server` environment (i.e. RSC) imports
6
- * from `./react-server` instead.
7
- */
8
- export * from './react-client';
1
+ export * from 'use-intl';
2
+ export { default as NextIntlClientProvider, default as NextIntlProvider } from './shared/NextIntlClientProvider.js';
3
+ import 'react';
package/dist/index.js CHANGED
@@ -1,8 +1,2 @@
1
-
2
- 'use strict'
3
-
4
- if (process.env.NODE_ENV === 'production') {
5
- module.exports = require('./next-intl.cjs.production.min.js')
6
- } else {
7
- module.exports = require('./next-intl.cjs.development.js')
8
- }
1
+ "use strict";var a=Object.defineProperty;var b=Object.getOwnPropertyDescriptor;var c=Object.getOwnPropertyNames;var d=Object.prototype.hasOwnProperty;var p=(r,o,f,x)=>{if(o&&typeof o=="object"||typeof o=="function")for(let e of c(o))!d.call(r,e)&&e!==f&&a(r,e,{get:()=>o[e],enumerable:!(x=b(o,e))||x.enumerable});return r},t=(r,o,f)=>(p(r,o,"default"),f&&p(f,o,"default"));var g=r=>p(a({},"__esModule",{value:!0}),r);var m={};module.exports=g(m);t(m,require("./react-client"),module.exports);0&&(module.exports={...require("./react-client")});
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/index.tsx"],"sourcesContent":["/**\n * This is the default entry file when consumers import from\n * 'next-intl'. We use the client APIs in this case.\n *\n * Note that the `react-server` environment (i.e. RSC) imports\n * from `./react-server` instead.\n */\n\nexport * from './react-client';\n"],"mappings":"iaAAA,IAAAA,EAAA,kBAAAC,EAAAD,GAQAE,EAAAF,EAAc,0BARd","names":["src_exports","__toCommonJS","__reExport"]}
package/dist/index.mjs ADDED
@@ -0,0 +1,2 @@
1
+ export*from"./react-client";
2
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/index.tsx"],"sourcesContent":["/**\n * This is the default entry file when consumers import from\n * 'next-intl'. We use the client APIs in this case.\n *\n * Note that the `react-server` environment (i.e. RSC) imports\n * from `./react-server` instead.\n */\n\nexport * from './react-client';\n"],"mappings":"AAQA,WAAc","names":[]}
@@ -1,6 +1,8 @@
1
1
  import React, { ComponentProps } from 'react';
2
- import BaseLink from '../shared/BaseLink';
3
- type Props = Omit<ComponentProps<typeof BaseLink>, 'locale'> & {
2
+ import _default$1 from '../shared/BaseLink.mjs';
3
+ import 'next/link';
4
+
5
+ type Props = Omit<ComponentProps<typeof _default$1>, 'locale'> & {
4
6
  locale?: string;
5
7
  };
6
8
  /**
@@ -24,4 +26,5 @@ type Props = Omit<ComponentProps<typeof BaseLink>, 'locale'> & {
24
26
  * page to be overwritten before the user even decides to change the locale.
25
27
  */
26
28
  declare const _default: React.ForwardRefExoticComponent<Omit<Props, "ref"> & React.RefAttributes<HTMLAnchorElement>>;
27
- export default _default;
29
+
30
+ export { _default as default };
@@ -1,27 +1,30 @@
1
- import React, { ComponentProps } from 'react';
2
- import BaseLink from '../shared/BaseLink';
3
- type Props = Omit<ComponentProps<typeof BaseLink>, 'locale'> & {
4
- locale?: string;
5
- };
6
- /**
7
- * Wraps `next/link` and prefixes the `href` with the current locale if
8
- * necessary.
9
- *
10
- * @example
11
- * ```tsx
12
- * import {Link} from 'next-intl';
13
- *
14
- * // When the user is on `/en`, the link will point to `/en/about`
15
- * <Link href="/about">About</Link>
16
- *
17
- * // You can override the `locale` to switch to another language
18
- * <Link href="/" locale="de">Switch to German</Link>
19
- * ```
20
- *
21
- * Note that when a `locale` prop is passed to switch the locale, the `prefetch`
22
- * prop is not supported. This is because Next.js would prefetch the page and
23
- * the `set-cookie` response header would cause the locale cookie on the current
24
- * page to be overwritten before the user even decides to change the locale.
25
- */
26
- declare const _default: React.ForwardRefExoticComponent<Omit<Props, "ref"> & React.RefAttributes<HTMLAnchorElement>>;
27
- export default _default;
1
+ import React, { ComponentProps } from 'react';
2
+ import _default$1 from '../shared/BaseLink.js';
3
+ import 'next/link';
4
+
5
+ type Props = Omit<ComponentProps<typeof _default$1>, 'locale'> & {
6
+ locale?: string;
7
+ };
8
+ /**
9
+ * Wraps `next/link` and prefixes the `href` with the current locale if
10
+ * necessary.
11
+ *
12
+ * @example
13
+ * ```tsx
14
+ * import {Link} from 'next-intl';
15
+ *
16
+ * // When the user is on `/en`, the link will point to `/en/about`
17
+ * <Link href="/about">About</Link>
18
+ *
19
+ * // You can override the `locale` to switch to another language
20
+ * <Link href="/" locale="de">Switch to German</Link>
21
+ * ```
22
+ *
23
+ * Note that when a `locale` prop is passed to switch the locale, the `prefetch`
24
+ * prop is not supported. This is because Next.js would prefetch the page and
25
+ * the `set-cookie` response header would cause the locale cookie on the current
26
+ * page to be overwritten before the user even decides to change the locale.
27
+ */
28
+ declare const _default: React.ForwardRefExoticComponent<Omit<Props, "ref"> & React.RefAttributes<HTMLAnchorElement>>;
29
+
30
+ export { _default as default };
@@ -0,0 +1,2 @@
1
+ "use strict";var m=Object.create;var p=Object.defineProperty;var c=Object.getOwnPropertyDescriptor;var u=Object.getOwnPropertyNames;var L=Object.getPrototypeOf,P=Object.prototype.hasOwnProperty;var d=(o,e)=>{for(var r in e)p(o,r,{get:e[r],enumerable:!0})},a=(o,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let t of u(e))!P.call(o,t)&&t!==r&&p(o,t,{get:()=>e[t],enumerable:!(n=c(e,t))||n.enumerable});return o};var l=(o,e,r)=>(r=o!=null?m(L(o)):{},a(e||!o||!o.__esModule?p(r,"default",{value:o,enumerable:!0}):r,o)),k=o=>a(p({},"__esModule",{value:!0}),o);var B={};d(B,{default:()=>y});module.exports=k(B);var f=l(require("react")),i=l(require("../client/useClientLocale")),s=l(require("../shared/BaseLink"));function C({locale:o,...e},r){const n=(0,i.default)();return f.default.createElement(s.default,{ref:r,locale:o||n,...e})}var y=(0,f.forwardRef)(C);
2
+ //# sourceMappingURL=Link.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/link/Link.tsx"],"sourcesContent":["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"],"mappings":"0jBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,aAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAAgD,oBAChDC,EAA4B,wCAC5BC,EAAqB,iCAMrB,SAASC,EAAK,CAAC,OAAAC,EAAQ,GAAGC,CAAI,EAAUC,EAAmB,CACzD,MAAMC,KAAgB,EAAAC,SAAgB,EACtC,OAAO,EAAAC,QAAA,cAAC,EAAAC,QAAA,CAAS,IAAKJ,EAAK,OAAQF,GAAUG,EAAgB,GAAGF,EAAM,CACxE,CAsBA,IAAOP,KAAQ,cAAWK,CAAI","names":["Link_exports","__export","Link_default","__toCommonJS","import_react","import_useClientLocale","import_BaseLink","Link","locale","rest","ref","defaultLocale","useClientLocale","React","BaseLink"]}
@@ -0,0 +1,2 @@
1
+ import n,{forwardRef as p}from"react";import f from"../client/useClientLocale";import l from"../shared/BaseLink";function a({locale:o,...e},r){const t=f();return n.createElement(l,{ref:r,locale:o||t,...e})}var u=p(a);export{u as default};
2
+ //# sourceMappingURL=Link.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/link/Link.tsx"],"sourcesContent":["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"],"mappings":"AAAA,OAAOA,GAAwB,cAAAC,MAAiB,QAChD,OAAOC,MAAqB,4BAC5B,OAAOC,MAAc,qBAMrB,SAASC,EAAK,CAAC,OAAAC,EAAQ,GAAGC,CAAI,EAAUC,EAAmB,CACzD,MAAMC,EAAgBN,EAAgB,EACtC,OAAOF,EAAA,cAACG,EAAA,CAAS,IAAKI,EAAK,OAAQF,GAAUG,EAAgB,GAAGF,EAAM,CACxE,CAsBA,IAAOG,EAAQR,EAAWG,CAAI","names":["React","forwardRef","useClientLocale","BaseLink","Link","locale","rest","ref","defaultLocale","Link_default"]}
@@ -0,0 +1,4 @@
1
+ export { default } from './Link.mjs';
2
+ import 'react';
3
+ import '../shared/BaseLink.mjs';
4
+ import 'next/link';
@@ -1 +1,4 @@
1
- export { default } from './Link';
1
+ export { default } from './Link.js';
2
+ import 'react';
3
+ import '../shared/BaseLink.js';
4
+ import 'next/link';
@@ -0,0 +1,2 @@
1
+ "use strict";var m=Object.create;var t=Object.defineProperty;var p=Object.getOwnPropertyDescriptor;var u=Object.getOwnPropertyNames;var x=Object.getPrototypeOf,b=Object.prototype.hasOwnProperty;var c=(e,f)=>{for(var o in f)t(e,o,{get:f[o],enumerable:!0})},d=(e,f,o,a)=>{if(f&&typeof f=="object"||typeof f=="function")for(let r of u(f))!b.call(e,r)&&r!==o&&t(e,r,{get:()=>f[r],enumerable:!(a=p(f,r))||a.enumerable});return e};var g=(e,f,o)=>(o=e!=null?m(x(e)):{},d(f||!e||!e.__esModule?t(o,"default",{value:e,enumerable:!0}):o,e)),h=e=>d(t({},"__esModule",{value:!0}),e);var i={};c(i,{default:()=>l.default});module.exports=h(i);var l=g(require("./Link"));
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/link/index.tsx"],"sourcesContent":["export {default} from './Link';\n"],"mappings":"0jBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,wCAAAE,EAAAF,GAAA,IAAAG,EAAsB","names":["link_exports","__export","__toCommonJS","import_Link"]}
@@ -0,0 +1,2 @@
1
+ import{default as o}from"./Link";export{o as default};
2
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/link/index.tsx"],"sourcesContent":["export {default} from './Link';\n"],"mappings":"AAAA,OAAQ,WAAAA,MAAc","names":["default"]}
@@ -7,7 +7,7 @@ type RoutingBaseConfig = {
7
7
  */
8
8
  localePrefix?: LocalePrefix;
9
9
  };
10
- export type DomainConfig = Omit<RoutingBaseConfig, 'locales' | 'localePrefix'> & {
10
+ type DomainConfig = Omit<RoutingBaseConfig, 'locales' | 'localePrefix'> & {
11
11
  /** The domain name (e.g. "example.com", "www.example.com" or "fr.example.com"). Note that the `x-forwarded-host` or alternatively the `host` header will be used to determine the requested domain. */
12
12
  domain: string;
13
13
  locales?: RoutingBaseConfig['locales'];
@@ -20,9 +20,10 @@ type MiddlewareConfig = RoutingBaseConfig & {
20
20
  /** Sets the `Link` response header to notify search engines about content in other languages (defaults to `true`). See https://developers.google.com/search/docs/specialty/international/localized-versions#http */
21
21
  alternateLinks?: boolean;
22
22
  };
23
- export type MiddlewareConfigWithDefaults = MiddlewareConfig & {
23
+ type MiddlewareConfigWithDefaults = MiddlewareConfig & {
24
24
  alternateLinks: boolean;
25
25
  localePrefix: LocalePrefix;
26
26
  localeDetection: boolean;
27
27
  };
28
- export default MiddlewareConfig;
28
+
29
+ export { DomainConfig, MiddlewareConfigWithDefaults, MiddlewareConfig as default };
@@ -1,28 +1,29 @@
1
- type LocalePrefix = 'as-needed' | 'always';
2
- type RoutingBaseConfig = {
3
- /** A list of all locales that are supported. */
4
- locales: Array<string>;
5
- defaultLocale: string;
6
- /** The default locale can be used without a prefix (e.g. `/about`). If you prefer to have a prefix for the default locale as well (e.g. `/en/about`), you can switch this option to `always`.
7
- */
8
- localePrefix?: LocalePrefix;
9
- };
10
- export type DomainConfig = Omit<RoutingBaseConfig, 'locales' | 'localePrefix'> & {
11
- /** The domain name (e.g. "example.com", "www.example.com" or "fr.example.com"). Note that the `x-forwarded-host` or alternatively the `host` header will be used to determine the requested domain. */
12
- domain: string;
13
- locales?: RoutingBaseConfig['locales'];
14
- };
15
- type MiddlewareConfig = RoutingBaseConfig & {
16
- /** Can be used to change the locale handling per domain. */
17
- domains?: Array<DomainConfig>;
18
- /** By setting this to `false`, the `accept-language` header will no longer be used for locale detection. */
19
- localeDetection?: boolean;
20
- /** Sets the `Link` response header to notify search engines about content in other languages (defaults to `true`). See https://developers.google.com/search/docs/specialty/international/localized-versions#http */
21
- alternateLinks?: boolean;
22
- };
23
- export type MiddlewareConfigWithDefaults = MiddlewareConfig & {
24
- alternateLinks: boolean;
25
- localePrefix: LocalePrefix;
26
- localeDetection: boolean;
27
- };
28
- export default MiddlewareConfig;
1
+ type LocalePrefix = 'as-needed' | 'always';
2
+ type RoutingBaseConfig = {
3
+ /** A list of all locales that are supported. */
4
+ locales: Array<string>;
5
+ defaultLocale: string;
6
+ /** The default locale can be used without a prefix (e.g. `/about`). If you prefer to have a prefix for the default locale as well (e.g. `/en/about`), you can switch this option to `always`.
7
+ */
8
+ localePrefix?: LocalePrefix;
9
+ };
10
+ type DomainConfig = Omit<RoutingBaseConfig, 'locales' | 'localePrefix'> & {
11
+ /** The domain name (e.g. "example.com", "www.example.com" or "fr.example.com"). Note that the `x-forwarded-host` or alternatively the `host` header will be used to determine the requested domain. */
12
+ domain: string;
13
+ locales?: RoutingBaseConfig['locales'];
14
+ };
15
+ type MiddlewareConfig = RoutingBaseConfig & {
16
+ /** Can be used to change the locale handling per domain. */
17
+ domains?: Array<DomainConfig>;
18
+ /** By setting this to `false`, the `accept-language` header will no longer be used for locale detection. */
19
+ localeDetection?: boolean;
20
+ /** Sets the `Link` response header to notify search engines about content in other languages (defaults to `true`). See https://developers.google.com/search/docs/specialty/international/localized-versions#http */
21
+ alternateLinks?: boolean;
22
+ };
23
+ type MiddlewareConfigWithDefaults = MiddlewareConfig & {
24
+ alternateLinks: boolean;
25
+ localePrefix: LocalePrefix;
26
+ localeDetection: boolean;
27
+ };
28
+
29
+ export { DomainConfig, MiddlewareConfigWithDefaults, MiddlewareConfig as default };
@@ -0,0 +1,2 @@
1
+ "use strict";var l=Object.defineProperty;var t=Object.getOwnPropertyDescriptor;var r=Object.getOwnPropertyNames;var f=Object.prototype.hasOwnProperty;var g=(o,e,n,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of r(e))!f.call(o,a)&&a!==n&&l(o,a,{get:()=>e[a],enumerable:!(i=t(e,a))||i.enumerable});return o};var s=o=>g(l({},"__esModule",{value:!0}),o);var c={};module.exports=s(c);
2
+ //# sourceMappingURL=NextIntlMiddlewareConfig.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/middleware/NextIntlMiddlewareConfig.tsx"],"sourcesContent":["type LocalePrefix = 'as-needed' | 'always';\n\ntype RoutingBaseConfig = {\n /** A list of all locales that are supported. */\n locales: Array<string>;\n\n /* Used by default if none of the defined locales match. */\n defaultLocale: string;\n\n /** The default locale can be used without a prefix (e.g. `/about`). If you prefer to have a prefix for the default locale as well (e.g. `/en/about`), you can switch this option to `always`.\n */\n localePrefix?: LocalePrefix;\n};\n\nexport type DomainConfig = Omit<\n RoutingBaseConfig,\n 'locales' | 'localePrefix'\n> & {\n /** The domain name (e.g. \"example.com\", \"www.example.com\" or \"fr.example.com\"). Note that the `x-forwarded-host` or alternatively the `host` header will be used to determine the requested domain. */\n domain: string;\n // Optional here\n locales?: RoutingBaseConfig['locales'];\n};\n\ntype MiddlewareConfig = RoutingBaseConfig & {\n /** Can be used to change the locale handling per domain. */\n domains?: Array<DomainConfig>;\n\n /** By setting this to `false`, the `accept-language` header will no longer be used for locale detection. */\n localeDetection?: boolean;\n\n /** Sets the `Link` response header to notify search engines about content in other languages (defaults to `true`). See https://developers.google.com/search/docs/specialty/international/localized-versions#http */\n alternateLinks?: boolean;\n};\n\nexport type MiddlewareConfigWithDefaults = MiddlewareConfig & {\n alternateLinks: boolean;\n localePrefix: LocalePrefix;\n localeDetection: boolean;\n};\n\nexport default MiddlewareConfig;\n"],"mappings":"+WAAA,IAAAA,EAAA,kBAAAC,EAAAD","names":["NextIntlMiddlewareConfig_exports","__toCommonJS"]}
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=NextIntlMiddlewareConfig.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -1,6 +1,9 @@
1
1
  import { NextRequest } from 'next/server';
2
- import { MiddlewareConfigWithDefaults } from './NextIntlMiddlewareConfig';
2
+ import { MiddlewareConfigWithDefaults } from './NextIntlMiddlewareConfig.mjs';
3
+
3
4
  /**
4
5
  * See https://developers.google.com/search/docs/specialty/international/localized-versions
5
6
  */
6
- export default function getAlternateLinksHeaderValue(config: MiddlewareConfigWithDefaults, request: NextRequest): string;
7
+ declare function getAlternateLinksHeaderValue(config: MiddlewareConfigWithDefaults, request: NextRequest): string;
8
+
9
+ export { getAlternateLinksHeaderValue as default };
@@ -1,6 +1,9 @@
1
- import { NextRequest } from 'next/server';
2
- import { MiddlewareConfigWithDefaults } from './NextIntlMiddlewareConfig';
3
- /**
4
- * See https://developers.google.com/search/docs/specialty/international/localized-versions
5
- */
6
- export default function getAlternateLinksHeaderValue(config: MiddlewareConfigWithDefaults, request: NextRequest): string;
1
+ import { NextRequest } from 'next/server';
2
+ import { MiddlewareConfigWithDefaults } from './NextIntlMiddlewareConfig.js';
3
+
4
+ /**
5
+ * See https://developers.google.com/search/docs/specialty/international/localized-versions
6
+ */
7
+ declare function getAlternateLinksHeaderValue(config: MiddlewareConfigWithDefaults, request: NextRequest): string;
8
+
9
+ export { getAlternateLinksHeaderValue as default };