next-intl 3.25.0 → 4.0.0-beta-00a79d4

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 (450) hide show
  1. package/config.d.ts +2 -1
  2. package/dist/cjs/development/plugin.cjs +167 -0
  3. package/dist/{development → esm/development}/config.js +1 -5
  4. package/dist/esm/development/index.react-client.js +3 -0
  5. package/dist/esm/development/index.react-server.js +8 -0
  6. package/dist/{development → esm/development}/middleware/getAlternateLinksHeaderValue.js +18 -25
  7. package/dist/esm/development/middleware/middleware.js +155 -0
  8. package/dist/{development → esm/development}/middleware/resolveLocale.js +13 -25
  9. package/dist/esm/development/middleware/syncCookie.js +20 -0
  10. package/dist/{development → esm/development}/middleware/utils.js +24 -54
  11. package/dist/esm/development/middleware.js +1 -0
  12. package/dist/{development → esm/development}/navigation/react-client/createNavigation.js +22 -29
  13. package/dist/esm/development/navigation/react-client/useBasePathname.js +27 -0
  14. package/dist/esm/development/navigation/react-server/createNavigation.js +22 -0
  15. package/dist/esm/development/navigation/react-server/getServerLocale.js +12 -0
  16. package/dist/{development → esm/development}/navigation/shared/BaseLink.js +31 -36
  17. package/dist/{development → esm/development}/navigation/shared/createSharedNavigationFns.js +39 -50
  18. package/dist/{development → esm/development}/navigation/shared/syncLocaleCookie.js +5 -9
  19. package/dist/{development → esm/development}/navigation/shared/utils.js +21 -35
  20. package/dist/esm/development/navigation.react-client.js +1 -0
  21. package/dist/esm/development/navigation.react-server.js +1 -0
  22. package/dist/esm/development/plugin/createMessagesDeclaration.js +61 -0
  23. package/dist/esm/development/plugin/createNextIntlPlugin.js +23 -0
  24. package/dist/esm/development/plugin/getNextConfig.js +82 -0
  25. package/dist/esm/development/plugin/utils.js +11 -0
  26. package/dist/esm/development/plugin.js +1 -0
  27. package/dist/esm/development/react-client/index.js +35 -0
  28. package/dist/esm/development/react-server/NextIntlClientProviderServer.js +31 -0
  29. package/dist/esm/development/react-server/useConfig.js +21 -0
  30. package/dist/esm/development/react-server/useFormatter.js +9 -0
  31. package/dist/esm/development/react-server/useLocale.js +8 -0
  32. package/dist/esm/development/react-server/useMessages.js +9 -0
  33. package/dist/esm/development/react-server/useNow.js +12 -0
  34. package/dist/esm/development/react-server/useTimeZone.js +8 -0
  35. package/dist/esm/development/react-server/useTranslations.js +9 -0
  36. package/dist/esm/development/routing/config.js +28 -0
  37. package/dist/esm/development/routing/defineRouting.js +5 -0
  38. package/dist/esm/development/routing.js +1 -0
  39. package/dist/{development → esm/development}/server/react-client/index.js +5 -16
  40. package/dist/{development → esm/development}/server/react-server/RequestLocale.js +10 -14
  41. package/dist/{development → esm/development}/server/react-server/RequestLocaleCache.js +3 -8
  42. package/dist/esm/development/server/react-server/createRequestConfig.js +2 -0
  43. package/dist/esm/development/server/react-server/getConfig.js +53 -0
  44. package/dist/esm/development/server/react-server/getConfigNow.js +10 -0
  45. package/dist/esm/development/server/react-server/getDefaultNow.js +9 -0
  46. package/dist/esm/development/server/react-server/getFormats.js +10 -0
  47. package/dist/esm/development/server/react-server/getFormatter.js +21 -0
  48. package/dist/esm/development/server/react-server/getLocale.js +10 -0
  49. package/dist/esm/development/server/react-server/getMessages.js +19 -0
  50. package/dist/esm/development/server/react-server/getNow.js +8 -0
  51. package/dist/{development → esm/development}/server/react-server/getRequestConfig.js +1 -5
  52. package/dist/esm/development/server/react-server/getServerFormatter.js +21 -0
  53. package/dist/esm/development/server/react-server/getServerTranslator.js +12 -0
  54. package/dist/esm/development/server/react-server/getTimeZone.js +13 -0
  55. package/dist/{development → esm/development}/server/react-server/getTranslations.js +7 -15
  56. package/dist/esm/development/server.react-client.js +1 -0
  57. package/dist/esm/development/server.react-server.js +8 -0
  58. package/dist/esm/development/shared/NextIntlClientProvider.js +18 -0
  59. package/dist/esm/development/shared/constants.js +4 -0
  60. package/dist/esm/development/shared/use.js +13 -0
  61. package/dist/{development → esm/development}/shared/utils.js +6 -50
  62. package/dist/esm/production/index.react-client.js +1 -0
  63. package/dist/esm/production/middleware/getAlternateLinksHeaderValue.js +1 -0
  64. package/dist/esm/production/middleware/middleware.js +1 -0
  65. package/dist/esm/production/middleware/resolveLocale.js +1 -0
  66. package/dist/esm/production/middleware/syncCookie.js +1 -0
  67. package/dist/esm/production/middleware/utils.js +1 -0
  68. package/dist/esm/production/navigation/react-client/createNavigation.js +1 -0
  69. package/dist/esm/production/navigation/react-client/useBasePathname.js +1 -0
  70. package/dist/esm/production/navigation/react-server/createNavigation.js +1 -0
  71. package/dist/esm/production/navigation/shared/BaseLink.js +2 -0
  72. package/dist/esm/production/navigation/shared/createSharedNavigationFns.js +1 -0
  73. package/dist/esm/production/navigation/shared/syncLocaleCookie.js +1 -0
  74. package/dist/esm/production/navigation/shared/utils.js +1 -0
  75. package/dist/esm/production/navigation.react-client.js +1 -0
  76. package/dist/esm/production/navigation.react-server.js +1 -0
  77. package/dist/esm/production/plugin/createMessagesDeclaration.js +1 -0
  78. package/dist/esm/production/plugin/createNextIntlPlugin.js +1 -0
  79. package/dist/esm/production/plugin/getNextConfig.js +1 -0
  80. package/dist/esm/production/plugin/utils.js +1 -0
  81. package/dist/esm/production/plugin.js +1 -0
  82. package/dist/esm/production/react-client/index.js +1 -0
  83. package/dist/esm/production/react-server/NextIntlClientProviderServer.js +1 -0
  84. package/dist/esm/production/react-server/useConfig.js +1 -0
  85. package/dist/esm/production/react-server/useFormatter.js +1 -0
  86. package/dist/esm/production/react-server/useLocale.js +1 -0
  87. package/dist/esm/production/react-server/useMessages.js +1 -0
  88. package/dist/esm/production/react-server/useNow.js +1 -0
  89. package/dist/esm/production/react-server/useTimeZone.js +1 -0
  90. package/dist/esm/production/react-server/useTranslations.js +1 -0
  91. package/dist/esm/production/routing/config.js +1 -0
  92. package/dist/esm/production/server/react-client/index.js +1 -0
  93. package/dist/esm/production/server/react-server/RequestLocale.js +1 -0
  94. package/dist/esm/production/server/react-server/getConfig.js +1 -0
  95. package/dist/esm/production/server/react-server/getConfigNow.js +1 -0
  96. package/dist/esm/production/server/react-server/getDefaultNow.js +1 -0
  97. package/dist/esm/production/server/react-server/getFormats.js +1 -0
  98. package/dist/esm/production/server/react-server/getFormatter.js +1 -0
  99. package/dist/esm/production/server/react-server/getLocale.js +1 -0
  100. package/dist/esm/production/server/react-server/getMessages.js +1 -0
  101. package/dist/esm/production/server/react-server/getNow.js +1 -0
  102. package/dist/esm/production/server/react-server/getServerFormatter.js +1 -0
  103. package/dist/esm/{server → production/server}/react-server/getTimeZone.js +1 -1
  104. package/dist/esm/production/server/react-server/getTranslations.js +1 -0
  105. package/dist/esm/production/server.react-client.js +1 -0
  106. package/dist/esm/production/server.react-server.js +1 -0
  107. package/dist/esm/production/shared/NextIntlClientProvider.js +2 -0
  108. package/dist/esm/production/shared/constants.js +1 -0
  109. package/dist/esm/production/shared/use.js +1 -0
  110. package/dist/esm/production/shared/utils.js +1 -0
  111. package/dist/types/{src/index.react-client.d.ts → index.react-client.d.ts} +1 -1
  112. package/dist/types/index.react-server.d.ts +1 -0
  113. package/dist/types/{src/middleware → middleware}/getAlternateLinksHeaderValue.d.ts +3 -3
  114. package/dist/types/{src/middleware → middleware}/index.d.ts +1 -1
  115. package/dist/types/middleware/middleware.d.ts +4 -0
  116. package/dist/types/{src/middleware → middleware}/resolveLocale.d.ts +5 -4
  117. package/dist/types/middleware/syncCookie.d.ts +7 -0
  118. package/dist/types/{src/middleware → middleware}/utils.d.ts +4 -3
  119. package/dist/types/middleware.d.ts +1 -0
  120. package/dist/types/{src/navigation → navigation}/react-client/createNavigation.d.ts +58 -57
  121. package/dist/types/navigation/react-client/index.d.ts +2 -0
  122. package/dist/types/{src/navigation → navigation}/react-client/useBasePathname.d.ts +1 -1
  123. package/dist/types/{src/navigation → navigation}/react-server/createNavigation.d.ts +30 -30
  124. package/dist/types/navigation/react-server/index.d.ts +2 -0
  125. package/dist/types/navigation/shared/BaseLink.d.ts +19 -0
  126. package/dist/types/navigation/shared/createSharedNavigationFns.d.ts +386 -0
  127. package/dist/types/{src/navigation → navigation}/shared/syncLocaleCookie.d.ts +3 -2
  128. package/dist/types/{src/navigation → navigation}/shared/utils.d.ts +5 -4
  129. package/dist/types/navigation.react-client.d.ts +1 -0
  130. package/dist/types/navigation.react-server.d.ts +1 -0
  131. package/dist/types/plugin/createMessagesDeclaration.d.ts +1 -0
  132. package/dist/types/plugin/createNextIntlPlugin.d.ts +3 -0
  133. package/dist/types/plugin/getNextConfig.d.ts +3 -0
  134. package/dist/types/plugin/index.d.ts +1 -0
  135. package/dist/types/plugin/types.d.ts +6 -0
  136. package/dist/types/plugin/utils.d.ts +2 -0
  137. package/dist/types/plugin.d.ts +1 -0
  138. package/dist/types/{src/react-client → react-client}/index.d.ts +1 -2
  139. package/dist/types/react-server/NextIntlClientProviderServer.d.ts +5 -0
  140. package/dist/types/react-server/index.d.ts +15 -0
  141. package/dist/types/{src/react-server → react-server}/testUtils.d.ts +1 -1
  142. package/dist/types/{src/react-server → react-server}/useConfig.d.ts +1 -1
  143. package/dist/types/react-server/useFormatter.d.ts +2 -0
  144. package/dist/types/react-server/useLocale.d.ts +2 -0
  145. package/dist/types/react-server/useMessages.d.ts +2 -0
  146. package/dist/types/react-server/useNow.d.ts +2 -0
  147. package/dist/types/react-server/useTimeZone.d.ts +2 -0
  148. package/dist/types/{src/routing → routing}/config.d.ts +2 -4
  149. package/dist/types/{src/routing → routing}/defineRouting.d.ts +2 -2
  150. package/dist/types/routing/index.d.ts +3 -0
  151. package/dist/types/routing.d.ts +1 -0
  152. package/dist/types/{src/server → server}/react-client/index.d.ts +1 -2
  153. package/dist/types/server/react-server/RequestLocaleCache.d.ts +3 -0
  154. package/dist/types/{src/server → server}/react-server/createRequestConfig.d.ts +1 -1
  155. package/dist/types/{src/server → server}/react-server/getConfig.d.ts +2 -3
  156. package/dist/types/server/react-server/getConfigNow.d.ts +4 -0
  157. package/dist/types/server/react-server/getDefaultNow.d.ts +3 -0
  158. package/dist/types/server/react-server/getFormats.d.ts +3 -0
  159. package/dist/types/{src/server → server}/react-server/getFormatter.d.ts +2 -2
  160. package/dist/types/server/react-server/getLocale.d.ts +4 -0
  161. package/dist/types/server/react-server/getMessages.d.ts +6 -0
  162. package/dist/types/server/react-server/getNow.d.ts +4 -0
  163. package/dist/types/{src/server → server}/react-server/getRequestConfig.d.ts +2 -19
  164. package/dist/types/server/react-server/getServerFormatter.d.ts +10 -0
  165. package/dist/types/server/react-server/getServerTranslator.d.ts +4 -0
  166. package/dist/types/server/react-server/getTimeZone.d.ts +4 -0
  167. package/dist/types/server/react-server/getTranslations.d.ts +8 -0
  168. package/dist/types/server/react-server/index.d.ts +11 -0
  169. package/dist/types/server.react-client.d.ts +1 -0
  170. package/dist/types/server.react-server.d.ts +1 -0
  171. package/dist/types/{src/shared → shared}/NextIntlClientProvider.d.ts +5 -4
  172. package/dist/types/shared/constants.d.ts +1 -0
  173. package/dist/types/shared/use.d.ts +3 -0
  174. package/dist/types/{src/shared → shared}/utils.d.ts +3 -9
  175. package/middleware.d.ts +2 -1
  176. package/navigation.d.ts +2 -1
  177. package/package.json +57 -26
  178. package/plugin.d.cts +3 -0
  179. package/plugin.d.ts +3 -7
  180. package/routing.d.ts +2 -1
  181. package/server.d.ts +2 -1
  182. package/dist/config.js +0 -7
  183. package/dist/development/_virtual/_rollupPluginBabelHelpers.js +0 -15
  184. package/dist/development/index.react-client.js +0 -21
  185. package/dist/development/index.react-server.js +0 -28
  186. package/dist/development/middleware/middleware.js +0 -169
  187. package/dist/development/middleware/syncCookie.js +0 -20
  188. package/dist/development/middleware.js +0 -9
  189. package/dist/development/navigation/react-client/ClientLink.js +0 -55
  190. package/dist/development/navigation/react-client/createLocalizedPathnamesNavigation.js +0 -156
  191. package/dist/development/navigation/react-client/createSharedPathnamesNavigation.js +0 -67
  192. package/dist/development/navigation/react-client/redirects.js +0 -32
  193. package/dist/development/navigation/react-client/useBasePathname.js +0 -31
  194. package/dist/development/navigation/react-client/useBaseRouter.js +0 -72
  195. package/dist/development/navigation/react-server/ServerLink.js +0 -32
  196. package/dist/development/navigation/react-server/createLocalizedPathnamesNavigation.js +0 -95
  197. package/dist/development/navigation/react-server/createNavigation.js +0 -30
  198. package/dist/development/navigation/react-server/createSharedPathnamesNavigation.js +0 -56
  199. package/dist/development/navigation/react-server/getServerLocale.js +0 -16
  200. package/dist/development/navigation/react-server/redirects.js +0 -24
  201. package/dist/development/navigation/shared/LegacyBaseLink.js +0 -57
  202. package/dist/development/navigation/shared/redirects.js +0 -25
  203. package/dist/development/navigation.react-client.js +0 -13
  204. package/dist/development/navigation.react-server.js +0 -13
  205. package/dist/development/plugin.js +0 -101
  206. package/dist/development/react-client/index.js +0 -38
  207. package/dist/development/react-client/useLocale.js +0 -28
  208. package/dist/development/react-server/NextIntlClientProviderServer.js +0 -33
  209. package/dist/development/react-server/getTranslator.js +0 -16
  210. package/dist/development/react-server/useConfig.js +0 -25
  211. package/dist/development/react-server/useFormatter.js +0 -18
  212. package/dist/development/react-server/useLocale.js +0 -15
  213. package/dist/development/react-server/useMessages.js +0 -16
  214. package/dist/development/react-server/useNow.js +0 -19
  215. package/dist/development/react-server/useTimeZone.js +0 -15
  216. package/dist/development/react-server/useTranslations.js +0 -17
  217. package/dist/development/routing/config.js +0 -35
  218. package/dist/development/routing/defineRouting.js +0 -9
  219. package/dist/development/routing.js +0 -9
  220. package/dist/development/server/react-server/RequestLocaleLegacy.js +0 -43
  221. package/dist/development/server/react-server/createRequestConfig.js +0 -16
  222. package/dist/development/server/react-server/getConfig.js +0 -73
  223. package/dist/development/server/react-server/getFormatter.js +0 -25
  224. package/dist/development/server/react-server/getLocale.js +0 -14
  225. package/dist/development/server/react-server/getMessages.js +0 -24
  226. package/dist/development/server/react-server/getNow.js +0 -17
  227. package/dist/development/server/react-server/getTimeZone.js +0 -17
  228. package/dist/development/server.react-client.js +0 -17
  229. package/dist/development/server.react-server.js +0 -24
  230. package/dist/development/shared/NextIntlClientProvider.js +0 -30
  231. package/dist/development/shared/constants.js +0 -12
  232. package/dist/esm/_virtual/_rollupPluginBabelHelpers.js +0 -1
  233. package/dist/esm/index.react-client.js +0 -1
  234. package/dist/esm/middleware/getAlternateLinksHeaderValue.js +0 -1
  235. package/dist/esm/middleware/middleware.js +0 -1
  236. package/dist/esm/middleware/resolveLocale.js +0 -1
  237. package/dist/esm/middleware/syncCookie.js +0 -1
  238. package/dist/esm/middleware/utils.js +0 -1
  239. package/dist/esm/navigation/react-client/ClientLink.js +0 -1
  240. package/dist/esm/navigation/react-client/createLocalizedPathnamesNavigation.js +0 -1
  241. package/dist/esm/navigation/react-client/createNavigation.js +0 -1
  242. package/dist/esm/navigation/react-client/createSharedPathnamesNavigation.js +0 -1
  243. package/dist/esm/navigation/react-client/redirects.js +0 -1
  244. package/dist/esm/navigation/react-client/useBasePathname.js +0 -1
  245. package/dist/esm/navigation/react-client/useBaseRouter.js +0 -1
  246. package/dist/esm/navigation/react-server/ServerLink.js +0 -1
  247. package/dist/esm/navigation/react-server/createLocalizedPathnamesNavigation.js +0 -1
  248. package/dist/esm/navigation/react-server/createNavigation.js +0 -1
  249. package/dist/esm/navigation/react-server/createSharedPathnamesNavigation.js +0 -1
  250. package/dist/esm/navigation/react-server/redirects.js +0 -1
  251. package/dist/esm/navigation/shared/BaseLink.js +0 -2
  252. package/dist/esm/navigation/shared/LegacyBaseLink.js +0 -2
  253. package/dist/esm/navigation/shared/createSharedNavigationFns.js +0 -1
  254. package/dist/esm/navigation/shared/redirects.js +0 -1
  255. package/dist/esm/navigation/shared/syncLocaleCookie.js +0 -1
  256. package/dist/esm/navigation/shared/utils.js +0 -1
  257. package/dist/esm/navigation.react-client.js +0 -1
  258. package/dist/esm/navigation.react-server.js +0 -1
  259. package/dist/esm/plugin.js +0 -1
  260. package/dist/esm/react-client/index.js +0 -1
  261. package/dist/esm/react-client/useLocale.js +0 -1
  262. package/dist/esm/react-server/NextIntlClientProviderServer.js +0 -1
  263. package/dist/esm/react-server/useConfig.js +0 -1
  264. package/dist/esm/react-server/useFormatter.js +0 -1
  265. package/dist/esm/react-server/useLocale.js +0 -1
  266. package/dist/esm/react-server/useMessages.js +0 -1
  267. package/dist/esm/react-server/useNow.js +0 -1
  268. package/dist/esm/react-server/useTimeZone.js +0 -1
  269. package/dist/esm/react-server/useTranslations.js +0 -1
  270. package/dist/esm/routing/config.js +0 -1
  271. package/dist/esm/server/react-client/index.js +0 -1
  272. package/dist/esm/server/react-server/RequestLocale.js +0 -1
  273. package/dist/esm/server/react-server/RequestLocaleLegacy.js +0 -1
  274. package/dist/esm/server/react-server/getConfig.js +0 -1
  275. package/dist/esm/server/react-server/getFormatter.js +0 -1
  276. package/dist/esm/server/react-server/getLocale.js +0 -1
  277. package/dist/esm/server/react-server/getMessages.js +0 -1
  278. package/dist/esm/server/react-server/getNow.js +0 -1
  279. package/dist/esm/server/react-server/getTranslations.js +0 -1
  280. package/dist/esm/server.react-client.js +0 -1
  281. package/dist/esm/server.react-server.js +0 -1
  282. package/dist/esm/shared/NextIntlClientProvider.js +0 -2
  283. package/dist/esm/shared/constants.js +0 -1
  284. package/dist/esm/shared/utils.js +0 -1
  285. package/dist/index.react-client.js +0 -7
  286. package/dist/index.react-server.js +0 -7
  287. package/dist/middleware.js +0 -7
  288. package/dist/navigation.react-client.js +0 -7
  289. package/dist/navigation.react-server.js +0 -7
  290. package/dist/plugin.js +0 -7
  291. package/dist/production/_virtual/_rollupPluginBabelHelpers.js +0 -1
  292. package/dist/production/config.js +0 -1
  293. package/dist/production/index.react-client.js +0 -1
  294. package/dist/production/index.react-server.js +0 -1
  295. package/dist/production/middleware/getAlternateLinksHeaderValue.js +0 -1
  296. package/dist/production/middleware/middleware.js +0 -1
  297. package/dist/production/middleware/resolveLocale.js +0 -1
  298. package/dist/production/middleware/syncCookie.js +0 -1
  299. package/dist/production/middleware/utils.js +0 -1
  300. package/dist/production/middleware.js +0 -1
  301. package/dist/production/navigation/react-client/ClientLink.js +0 -1
  302. package/dist/production/navigation/react-client/createLocalizedPathnamesNavigation.js +0 -1
  303. package/dist/production/navigation/react-client/createNavigation.js +0 -1
  304. package/dist/production/navigation/react-client/createSharedPathnamesNavigation.js +0 -1
  305. package/dist/production/navigation/react-client/redirects.js +0 -1
  306. package/dist/production/navigation/react-client/useBasePathname.js +0 -1
  307. package/dist/production/navigation/react-client/useBaseRouter.js +0 -1
  308. package/dist/production/navigation/react-server/ServerLink.js +0 -1
  309. package/dist/production/navigation/react-server/createLocalizedPathnamesNavigation.js +0 -1
  310. package/dist/production/navigation/react-server/createNavigation.js +0 -1
  311. package/dist/production/navigation/react-server/createSharedPathnamesNavigation.js +0 -1
  312. package/dist/production/navigation/react-server/getServerLocale.js +0 -1
  313. package/dist/production/navigation/react-server/redirects.js +0 -1
  314. package/dist/production/navigation/shared/BaseLink.js +0 -2
  315. package/dist/production/navigation/shared/LegacyBaseLink.js +0 -2
  316. package/dist/production/navigation/shared/createSharedNavigationFns.js +0 -1
  317. package/dist/production/navigation/shared/redirects.js +0 -1
  318. package/dist/production/navigation/shared/syncLocaleCookie.js +0 -1
  319. package/dist/production/navigation/shared/utils.js +0 -1
  320. package/dist/production/navigation.react-client.js +0 -1
  321. package/dist/production/navigation.react-server.js +0 -1
  322. package/dist/production/plugin.js +0 -1
  323. package/dist/production/react-client/index.js +0 -1
  324. package/dist/production/react-client/useLocale.js +0 -1
  325. package/dist/production/react-server/NextIntlClientProviderServer.js +0 -1
  326. package/dist/production/react-server/getTranslator.js +0 -1
  327. package/dist/production/react-server/useConfig.js +0 -1
  328. package/dist/production/react-server/useFormatter.js +0 -1
  329. package/dist/production/react-server/useLocale.js +0 -1
  330. package/dist/production/react-server/useMessages.js +0 -1
  331. package/dist/production/react-server/useNow.js +0 -1
  332. package/dist/production/react-server/useTimeZone.js +0 -1
  333. package/dist/production/react-server/useTranslations.js +0 -1
  334. package/dist/production/routing/config.js +0 -1
  335. package/dist/production/routing/defineRouting.js +0 -1
  336. package/dist/production/routing.js +0 -1
  337. package/dist/production/server/react-client/index.js +0 -1
  338. package/dist/production/server/react-server/RequestLocale.js +0 -1
  339. package/dist/production/server/react-server/RequestLocaleCache.js +0 -1
  340. package/dist/production/server/react-server/RequestLocaleLegacy.js +0 -1
  341. package/dist/production/server/react-server/createRequestConfig.js +0 -1
  342. package/dist/production/server/react-server/getConfig.js +0 -1
  343. package/dist/production/server/react-server/getFormatter.js +0 -1
  344. package/dist/production/server/react-server/getLocale.js +0 -1
  345. package/dist/production/server/react-server/getMessages.js +0 -1
  346. package/dist/production/server/react-server/getNow.js +0 -1
  347. package/dist/production/server/react-server/getRequestConfig.js +0 -1
  348. package/dist/production/server/react-server/getTimeZone.js +0 -1
  349. package/dist/production/server/react-server/getTranslations.js +0 -1
  350. package/dist/production/server.react-client.js +0 -1
  351. package/dist/production/server.react-server.js +0 -1
  352. package/dist/production/shared/NextIntlClientProvider.js +0 -2
  353. package/dist/production/shared/constants.js +0 -1
  354. package/dist/production/shared/utils.js +0 -1
  355. package/dist/routing.js +0 -7
  356. package/dist/server.react-client.js +0 -7
  357. package/dist/server.react-server.js +0 -7
  358. package/dist/types/__mocks__/react.d.ts +0 -9
  359. package/dist/types/src/index.react-server.d.ts +0 -1
  360. package/dist/types/src/middleware/getAlternateLinksHeaderValue.test.d.ts +0 -1
  361. package/dist/types/src/middleware/middleware.d.ts +0 -13
  362. package/dist/types/src/middleware/middleware.test.d.ts +0 -1
  363. package/dist/types/src/middleware/resolveLocale.test.d.ts +0 -1
  364. package/dist/types/src/middleware/syncCookie.d.ts +0 -3
  365. package/dist/types/src/middleware/utils.test.d.ts +0 -1
  366. package/dist/types/src/middleware.d.ts +0 -1
  367. package/dist/types/src/navigation/createLocalizedPathnamesNavigation.test.d.ts +0 -1
  368. package/dist/types/src/navigation/createNavigation.test.d.ts +0 -1
  369. package/dist/types/src/navigation/createSharedPathnamesNavigation.test.d.ts +0 -1
  370. package/dist/types/src/navigation/react-client/ClientLink.d.ts +0 -31
  371. package/dist/types/src/navigation/react-client/ClientLink.test.d.ts +0 -1
  372. package/dist/types/src/navigation/react-client/createLocalizedPathnamesNavigation.d.ts +0 -91
  373. package/dist/types/src/navigation/react-client/createLocalizedPathnamesNavigation.test.d.ts +0 -1
  374. package/dist/types/src/navigation/react-client/createNavigation.test.d.ts +0 -1
  375. package/dist/types/src/navigation/react-client/createSharedPathnamesNavigation.d.ts +0 -66
  376. package/dist/types/src/navigation/react-client/createSharedPathnamesNavigation.test.d.ts +0 -1
  377. package/dist/types/src/navigation/react-client/index.d.ts +0 -7
  378. package/dist/types/src/navigation/react-client/redirects.d.ts +0 -10
  379. package/dist/types/src/navigation/react-client/useBasePathname.test.d.ts +0 -1
  380. package/dist/types/src/navigation/react-client/useBaseRouter.d.ts +0 -33
  381. package/dist/types/src/navigation/react-client/useBaseRouter.test.d.ts +0 -1
  382. package/dist/types/src/navigation/react-server/ServerLink.d.ts +0 -9
  383. package/dist/types/src/navigation/react-server/createLocalizedPathnamesNavigation.d.ts +0 -70
  384. package/dist/types/src/navigation/react-server/createNavigation.test.d.ts +0 -1
  385. package/dist/types/src/navigation/react-server/createSharedPathnamesNavigation.d.ts +0 -11
  386. package/dist/types/src/navigation/react-server/index.d.ts +0 -4
  387. package/dist/types/src/navigation/react-server/redirects.d.ts +0 -10
  388. package/dist/types/src/navigation/shared/BaseLink.d.ts +0 -17
  389. package/dist/types/src/navigation/shared/LegacyBaseLink.d.ts +0 -12
  390. package/dist/types/src/navigation/shared/createSharedNavigationFns.d.ts +0 -386
  391. package/dist/types/src/navigation/shared/redirects.d.ts +0 -11
  392. package/dist/types/src/navigation/shared/redirects.test.d.ts +0 -1
  393. package/dist/types/src/navigation/shared/utils.test.d.ts +0 -1
  394. package/dist/types/src/navigation.react-client.d.ts +0 -1
  395. package/dist/types/src/navigation.react-server.d.ts +0 -1
  396. package/dist/types/src/plugin.d.ts +0 -1
  397. package/dist/types/src/react-client/useFormatter.test.d.ts +0 -1
  398. package/dist/types/src/react-client/useLocale.d.ts +0 -1
  399. package/dist/types/src/react-client/useLocale.test.d.ts +0 -1
  400. package/dist/types/src/react-client/useNow.test.d.ts +0 -1
  401. package/dist/types/src/react-client/useTimeZone.test.d.ts +0 -1
  402. package/dist/types/src/react-client/useTranslations.test.d.ts +0 -1
  403. package/dist/types/src/react-server/NextIntlClientProviderServer.d.ts +0 -5
  404. package/dist/types/src/react-server/NextIntlClientProviderServer.test.d.ts +0 -1
  405. package/dist/types/src/react-server/getTranslator.d.ts +0 -51
  406. package/dist/types/src/react-server/index.d.ts +0 -15
  407. package/dist/types/src/react-server/index.test.d.ts +0 -1
  408. package/dist/types/src/react-server/useFormatter.d.ts +0 -2
  409. package/dist/types/src/react-server/useLocale.d.ts +0 -2
  410. package/dist/types/src/react-server/useMessages.d.ts +0 -2
  411. package/dist/types/src/react-server/useNow.d.ts +0 -2
  412. package/dist/types/src/react-server/useTimeZone.d.ts +0 -2
  413. package/dist/types/src/react-server/useTranslations.test.d.ts +0 -1
  414. package/dist/types/src/routing/defineRouting.test.d.ts +0 -1
  415. package/dist/types/src/routing/index.d.ts +0 -3
  416. package/dist/types/src/routing/types.test.d.ts +0 -1
  417. package/dist/types/src/routing.d.ts +0 -1
  418. package/dist/types/src/server/react-client/index.test.d.ts +0 -1
  419. package/dist/types/src/server/react-server/RequestLocaleCache.d.ts +0 -2
  420. package/dist/types/src/server/react-server/RequestLocaleLegacy.d.ts +0 -1
  421. package/dist/types/src/server/react-server/getLocale.d.ts +0 -3
  422. package/dist/types/src/server/react-server/getMessages.d.ts +0 -6
  423. package/dist/types/src/server/react-server/getNow.d.ts +0 -3
  424. package/dist/types/src/server/react-server/getTimeZone.d.ts +0 -3
  425. package/dist/types/src/server/react-server/getTranslations.d.ts +0 -92
  426. package/dist/types/src/server/react-server/index.d.ts +0 -14
  427. package/dist/types/src/server/react-server/index.test.d.ts +0 -1
  428. package/dist/types/src/server.react-client.d.ts +0 -1
  429. package/dist/types/src/server.react-server.d.ts +0 -1
  430. package/dist/types/src/shared/NextIntlClientProvider.test.d.ts +0 -1
  431. package/dist/types/src/shared/constants.d.ts +0 -3
  432. package/dist/types/src/shared/utils.test.d.ts +0 -1
  433. package/dist/types/test/setup.d.ts +0 -1
  434. /package/dist/esm/{config.js → production/config.js} +0 -0
  435. /package/dist/esm/{index.react-server.js → production/index.react-server.js} +0 -0
  436. /package/dist/esm/{middleware.js → production/middleware.js} +0 -0
  437. /package/dist/esm/{navigation → production/navigation}/react-server/getServerLocale.js +0 -0
  438. /package/dist/esm/{routing → production/routing}/defineRouting.js +0 -0
  439. /package/dist/esm/{routing.js → production/routing.js} +0 -0
  440. /package/dist/esm/{server → production/server}/react-server/RequestLocaleCache.js +0 -0
  441. /package/dist/esm/{server → production/server}/react-server/createRequestConfig.js +0 -0
  442. /package/dist/esm/{server → production/server}/react-server/getRequestConfig.js +0 -0
  443. /package/dist/esm/{react-server/getTranslator.js → production/server/react-server/getServerTranslator.js} +0 -0
  444. /package/dist/types/{src/config.d.ts → config.d.ts} +0 -0
  445. /package/dist/types/{src/navigation → navigation}/react-server/getServerLocale.d.ts +0 -0
  446. /package/dist/types/{src/navigation → navigation}/shared/StrictParams.d.ts +0 -0
  447. /package/dist/types/{src/react-server → react-server}/useTranslations.d.ts +0 -0
  448. /package/dist/types/{src/routing → routing}/types.d.ts +0 -0
  449. /package/dist/types/{src/server → server}/react-server/RequestLocale.d.ts +0 -0
  450. /package/dist/types/{src/shared → shared}/types.d.ts +0 -0
@@ -1,57 +0,0 @@
1
- "use client";
2
- 'use strict';
3
-
4
- Object.defineProperty(exports, '__esModule', { value: true });
5
-
6
- var _rollupPluginBabelHelpers = require('../../_virtual/_rollupPluginBabelHelpers.js');
7
- var navigation = require('next/navigation');
8
- var React = require('react');
9
- var useLocale = require('../../react-client/useLocale.js');
10
- var utils = require('../../shared/utils.js');
11
- var BaseLink = require('./BaseLink.js');
12
-
13
- function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
14
-
15
- var React__default = /*#__PURE__*/_interopDefault(React);
16
-
17
- function LegacyBaseLink(_ref, ref) {
18
- let {
19
- href,
20
- locale,
21
- localeCookie,
22
- localePrefixMode,
23
- prefix,
24
- ...rest
25
- } = _ref;
26
- // The types aren't entirely correct here. Outside of Next.js
27
- // `useParams` can be called, but the return type is `null`.
28
- const pathname = navigation.usePathname();
29
- const curLocale = useLocale.default();
30
- const isChangingLocale = locale !== curLocale;
31
- const [localizedHref, setLocalizedHref] = React.useState(() => utils.isLocalizableHref(href) && (localePrefixMode !== 'never' || isChangingLocale) ?
32
- // For the `localePrefix: 'as-needed' strategy, the href shouldn't
33
- // be prefixed if the locale is the default locale. To determine this, we
34
- // need a) the default locale and b) the information if we use prefixed
35
- // routing. The default locale can vary by domain, therefore during the
36
- // RSC as well as the SSR render, we can't determine the default locale
37
- // statically. Therefore we always prefix the href since this will
38
- // always result in a valid URL, even if it might cause a redirect. This
39
- // is better than pointing to a non-localized href during the server
40
- // render, which would potentially be wrong. The final href is
41
- // determined in the effect below.
42
- utils.prefixHref(href, prefix) : href);
43
- React.useEffect(() => {
44
- if (!pathname) return;
45
- setLocalizedHref(utils.localizeHref(href, locale, curLocale, pathname, prefix));
46
- }, [curLocale, href, locale, pathname, prefix]);
47
- return /*#__PURE__*/React__default.default.createElement(BaseLink.default, _rollupPluginBabelHelpers.extends({
48
- ref: ref,
49
- href: localizedHref,
50
- locale: locale,
51
- localeCookie: localeCookie
52
- }, rest));
53
- }
54
- const LegacyBaseLinkWithRef = /*#__PURE__*/React.forwardRef(LegacyBaseLink);
55
- LegacyBaseLinkWithRef.displayName = 'ClientLink';
56
-
57
- exports.default = LegacyBaseLinkWithRef;
@@ -1,25 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- var navigation = require('next/navigation');
6
- var utils = require('../../shared/utils.js');
7
-
8
- function createRedirectFn(redirectFn) {
9
- return function baseRedirect(params) {
10
- const prefix = utils.getLocalePrefix(params.locale, params.localePrefix);
11
-
12
- // This logic is considered legacy and is replaced by `applyPathnamePrefix`.
13
- // We keep it this way for now for backwards compatibility.
14
- const localizedPathname = params.localePrefix.mode === 'never' || !utils.isLocalizableHref(params.pathname) ? params.pathname : utils.prefixPathname(prefix, params.pathname);
15
- for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
16
- args[_key - 1] = arguments[_key];
17
- }
18
- return redirectFn(localizedPathname, ...args);
19
- };
20
- }
21
- const baseRedirect = createRedirectFn(navigation.redirect);
22
- const basePermanentRedirect = createRedirectFn(navigation.permanentRedirect);
23
-
24
- exports.basePermanentRedirect = basePermanentRedirect;
25
- exports.baseRedirect = baseRedirect;
@@ -1,13 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- var createSharedPathnamesNavigation = require('./navigation/react-client/createSharedPathnamesNavigation.js');
6
- var createLocalizedPathnamesNavigation = require('./navigation/react-client/createLocalizedPathnamesNavigation.js');
7
- var createNavigation = require('./navigation/react-client/createNavigation.js');
8
-
9
-
10
-
11
- exports.createSharedPathnamesNavigation = createSharedPathnamesNavigation.default;
12
- exports.createLocalizedPathnamesNavigation = createLocalizedPathnamesNavigation.default;
13
- exports.createNavigation = createNavigation.default;
@@ -1,13 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- var createSharedPathnamesNavigation = require('./navigation/react-server/createSharedPathnamesNavigation.js');
6
- var createLocalizedPathnamesNavigation = require('./navigation/react-server/createLocalizedPathnamesNavigation.js');
7
- var createNavigation = require('./navigation/react-server/createNavigation.js');
8
-
9
-
10
-
11
- exports.createSharedPathnamesNavigation = createSharedPathnamesNavigation.default;
12
- exports.createLocalizedPathnamesNavigation = createLocalizedPathnamesNavigation.default;
13
- exports.createNavigation = createNavigation.default;
@@ -1,101 +0,0 @@
1
- 'use strict';
2
-
3
- var fs = require('fs');
4
- var path = require('path');
5
-
6
- function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
7
-
8
- var fs__default = /*#__PURE__*/_interopDefault(fs);
9
- var path__default = /*#__PURE__*/_interopDefault(path);
10
-
11
- /* eslint-env node */
12
-
13
- function withExtensions(localPath) {
14
- return ["".concat(localPath, ".ts"), "".concat(localPath, ".tsx"), "".concat(localPath, ".js"), "".concat(localPath, ".jsx")];
15
- }
16
- let hasWarnedForDeprecatedI18nConfig = false;
17
- function resolveI18nPath(providedPath, cwd) {
18
- function resolvePath(pathname) {
19
- const parts = [];
20
- if (cwd) parts.push(cwd);
21
- parts.push(pathname);
22
- return path__default.default.resolve(...parts);
23
- }
24
- function pathExists(pathname) {
25
- return fs__default.default.existsSync(resolvePath(pathname));
26
- }
27
- if (providedPath) {
28
- if (!pathExists(providedPath)) {
29
- throw new Error("[next-intl] Could not find i18n config at ".concat(providedPath, ", please provide a valid path."));
30
- }
31
- return providedPath;
32
- } else {
33
- for (const candidate of [...withExtensions('./i18n/request'), ...withExtensions('./src/i18n/request')]) {
34
- if (pathExists(candidate)) {
35
- return candidate;
36
- }
37
- }
38
- for (const candidate of [...withExtensions('./i18n'), ...withExtensions('./src/i18n')]) {
39
- if (pathExists(candidate)) {
40
- if (!hasWarnedForDeprecatedI18nConfig) {
41
- console.warn("\n[next-intl] Reading request configuration from ".concat(candidate, " is deprecated, please see https://next-intl-docs.vercel.app/blog/next-intl-3-22#i18n-request \u2014 you can either move your configuration to ./i18n/request.ts or provide a custom path in your Next.js config:\n\nconst withNextIntl = createNextIntlPlugin(\n './path/to/i18n/request.tsx'\n);\n"));
42
- hasWarnedForDeprecatedI18nConfig = true;
43
- }
44
- return candidate;
45
- }
46
- }
47
- throw new Error("\n[next-intl] Could not locate request configuration module.\n\nThis path is supported by default: ./(src/)i18n/request.{js,jsx,ts,tsx}\n\nAlternatively, you can specify a custom location in your Next.js config:\n\nconst withNextIntl = createNextIntlPlugin(\n './path/to/i18n/request.tsx'\n);\n");
48
- }
49
- }
50
- function initPlugin(i18nPath, nextConfig) {
51
- if ((nextConfig === null || nextConfig === void 0 ? void 0 : nextConfig.i18n) != null) {
52
- console.warn("\n[next-intl] An `i18n` property was found in your Next.js config. This likely causes conflicts and should therefore be removed if you use the App Router.\n\nIf you're in progress of migrating from the Pages Router, you can refer to this example: https://next-intl-docs.vercel.app/examples#app-router-migration\n");
53
- }
54
- const useTurbo = process.env.TURBOPACK != null;
55
- const nextIntlConfig = {};
56
-
57
- // Assign alias for `next-intl/config`
58
- if (useTurbo) {
59
- var _nextConfig$experimen, _nextConfig$experimen2;
60
- if (i18nPath !== null && i18nPath !== void 0 && i18nPath.startsWith('/')) {
61
- throw new Error("[next-intl] Turbopack support for next-intl currently does not support absolute paths, please provide a relative one (e.g. './src/i18n/config.ts').\n\nFound: " + i18nPath + '\n');
62
- }
63
- nextIntlConfig.experimental = {
64
- ...(nextConfig === null || nextConfig === void 0 ? void 0 : nextConfig.experimental),
65
- turbo: {
66
- ...(nextConfig === null || nextConfig === void 0 || (_nextConfig$experimen = nextConfig.experimental) === null || _nextConfig$experimen === void 0 ? void 0 : _nextConfig$experimen.turbo),
67
- resolveAlias: {
68
- ...(nextConfig === null || nextConfig === void 0 || (_nextConfig$experimen2 = nextConfig.experimental) === null || _nextConfig$experimen2 === void 0 || (_nextConfig$experimen2 = _nextConfig$experimen2.turbo) === null || _nextConfig$experimen2 === void 0 ? void 0 : _nextConfig$experimen2.resolveAlias),
69
- // Turbo aliases don't work with absolute
70
- // paths (see error handling above)
71
- 'next-intl/config': resolveI18nPath(i18nPath)
72
- }
73
- }
74
- };
75
- } else {
76
- nextIntlConfig.webpack = function webpack() {
77
- for (var _len = arguments.length, _ref = new Array(_len), _key = 0; _key < _len; _key++) {
78
- _ref[_key] = arguments[_key];
79
- }
80
- let [config, options] = _ref;
81
- // Webpack requires absolute paths
82
- config.resolve.alias['next-intl/config'] = path__default.default.resolve(config.context, resolveI18nPath(i18nPath, config.context));
83
- if (typeof (nextConfig === null || nextConfig === void 0 ? void 0 : nextConfig.webpack) === 'function') {
84
- return nextConfig.webpack(config, options);
85
- }
86
- return config;
87
- };
88
- }
89
-
90
- // Forward config
91
- nextIntlConfig.env = {
92
- ...(nextConfig === null || nextConfig === void 0 ? void 0 : nextConfig.env),
93
- _next_intl_trailing_slash: nextConfig !== null && nextConfig !== void 0 && nextConfig.trailingSlash ? 'true' : undefined
94
- };
95
- return Object.assign({}, nextConfig, nextIntlConfig);
96
- }
97
- module.exports = function createNextIntlPlugin(i18nPath) {
98
- return function withNextIntl(nextConfig) {
99
- return initPlugin(i18nPath, nextConfig);
100
- };
101
- };
@@ -1,38 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- var useIntl = require('use-intl');
6
-
7
- /**
8
- * This is the main entry file when non-'react-server'
9
- * environments import from 'next-intl'.
10
- *
11
- * Maintainer notes:
12
- * - Make sure this mirrors the API from 'react-server'.
13
- * - Make sure everything exported from this module is
14
- * supported in all Next.js versions that are supported.
15
- */
16
-
17
-
18
- // eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
19
- function callHook(name, hook) {
20
- return function () {
21
- try {
22
- return hook(...arguments);
23
- } catch (_unused) {
24
- throw new Error("Failed to call `".concat(name, "` because the context from `NextIntlClientProvider` was not found.\n\nThis can happen because:\n1) You intended to render this component as a Server Component, the render\n failed, and therefore React attempted to render the component on the client\n instead. If this is the case, check the console for server errors.\n2) You intended to render this component on the client side, but no context was found.\n Learn more about this error here: https://next-intl-docs.vercel.app/docs/environments/server-client-components#missing-context") );
25
- }
26
- };
27
- }
28
- const useTranslations = callHook('useTranslations', useIntl.useTranslations);
29
- const useFormatter = callHook('useFormatter', useIntl.useFormatter);
30
-
31
- exports.useFormatter = useFormatter;
32
- exports.useTranslations = useTranslations;
33
- Object.keys(useIntl).forEach(function (k) {
34
- if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
35
- enumerable: true,
36
- get: function () { return useIntl[k]; }
37
- });
38
- });
@@ -1,28 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- var navigation = require('next/navigation');
6
- var _useLocale = require('use-intl/_useLocale');
7
- var constants = require('../shared/constants.js');
8
-
9
- function useLocale() {
10
- // The types aren't entirely correct here. Outside of Next.js
11
- // `useParams` can be called, but the return type is `null`.
12
- const params = navigation.useParams();
13
- let locale;
14
- try {
15
- // eslint-disable-next-line react-compiler/react-compiler
16
- // eslint-disable-next-line react-hooks/rules-of-hooks, react-compiler/react-compiler -- False positive
17
- locale = _useLocale.useLocale();
18
- } catch (error) {
19
- if (typeof (params === null || params === void 0 ? void 0 : params[constants.LOCALE_SEGMENT_NAME]) === 'string') {
20
- locale = params[constants.LOCALE_SEGMENT_NAME];
21
- } else {
22
- throw error;
23
- }
24
- }
25
- return locale;
26
- }
27
-
28
- exports.default = useLocale;
@@ -1,33 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- var _rollupPluginBabelHelpers = require('../_virtual/_rollupPluginBabelHelpers.js');
6
- var React = require('react');
7
- var NextIntlClientProvider = require('../shared/NextIntlClientProvider.js');
8
- var getLocale = require('../server/react-server/getLocale.js');
9
- var getNow = require('../server/react-server/getNow.js');
10
- var getTimeZone = require('../server/react-server/getTimeZone.js');
11
-
12
- function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
13
-
14
- var React__default = /*#__PURE__*/_interopDefault(React);
15
-
16
- async function NextIntlClientProviderServer(_ref) {
17
- let {
18
- locale,
19
- now,
20
- timeZone,
21
- ...rest
22
- } = _ref;
23
- return /*#__PURE__*/React__default.default.createElement(NextIntlClientProvider.default
24
- // We need to be careful about potentially reading from headers here.
25
- // See https://github.com/amannn/next-intl/issues/631
26
- , _rollupPluginBabelHelpers.extends({
27
- locale: locale !== null && locale !== void 0 ? locale : await getLocale.default(),
28
- now: now !== null && now !== void 0 ? now : await getNow.default(),
29
- timeZone: timeZone !== null && timeZone !== void 0 ? timeZone : await getTimeZone.default()
30
- }, rest));
31
- }
32
-
33
- exports.default = NextIntlClientProviderServer;
@@ -1,16 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- var React = require('react');
6
- var core = require('use-intl/core');
7
-
8
- function getTranslatorImpl(config, namespace) {
9
- return core.createTranslator({
10
- ...config,
11
- namespace
12
- });
13
- }
14
- var getBaseTranslator = React.cache(getTranslatorImpl);
15
-
16
- exports.default = getBaseTranslator;
@@ -1,25 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- var React = require('react');
6
- var getConfig = require('../server/react-server/getConfig.js');
7
-
8
- function useHook(hookName, promise) {
9
- try {
10
- return React.use(promise);
11
- } catch (error) {
12
- if (error instanceof TypeError && error.message.includes("Cannot read properties of null (reading 'use')")) {
13
- throw new Error("`".concat(hookName, "` is not callable within an async component. Please refer to https://next-intl-docs.vercel.app/docs/environments/server-client-components#async-components"), {
14
- cause: error
15
- });
16
- } else {
17
- throw error;
18
- }
19
- }
20
- }
21
- function useConfig(hookName) {
22
- return useHook(hookName, getConfig.default());
23
- }
24
-
25
- exports.default = useConfig;
@@ -1,18 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- var React = require('react');
6
- var core = require('use-intl/core');
7
- var useConfig = require('./useConfig.js');
8
-
9
- const createFormatterCached = React.cache(core.createFormatter);
10
- function useFormatter() {
11
- for (var _len = arguments.length, _ref = new Array(_len), _key = 0; _key < _len; _key++) {
12
- _ref[_key] = arguments[_key];
13
- }
14
- const config = useConfig.default('useFormatter');
15
- return createFormatterCached(config);
16
- }
17
-
18
- exports.default = useFormatter;
@@ -1,15 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- var useConfig = require('./useConfig.js');
6
-
7
- function useLocale() {
8
- for (var _len = arguments.length, _ref = new Array(_len), _key = 0; _key < _len; _key++) {
9
- _ref[_key] = arguments[_key];
10
- }
11
- const config = useConfig.default('useLocale');
12
- return config.locale;
13
- }
14
-
15
- exports.default = useLocale;
@@ -1,16 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- var getMessages = require('../server/react-server/getMessages.js');
6
- var useConfig = require('./useConfig.js');
7
-
8
- function useMessages() {
9
- for (var _len = arguments.length, _ref = new Array(_len), _key = 0; _key < _len; _key++) {
10
- _ref[_key] = arguments[_key];
11
- }
12
- const config = useConfig.default('useMessages');
13
- return getMessages.getMessagesFromConfig(config);
14
- }
15
-
16
- exports.default = useMessages;
@@ -1,19 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- var useConfig = require('./useConfig.js');
6
-
7
- function useNow() {
8
- for (var _len = arguments.length, _ref = new Array(_len), _key = 0; _key < _len; _key++) {
9
- _ref[_key] = arguments[_key];
10
- }
11
- let [options] = _ref;
12
- if ((options === null || options === void 0 ? void 0 : options.updateInterval) != null) {
13
- console.error("`useNow` doesn't support the `updateInterval` option in Server Components, the value will be ignored. If you need the value to update, you can convert the component to a Client Component.");
14
- }
15
- const config = useConfig.default('useNow');
16
- return config.now;
17
- }
18
-
19
- exports.default = useNow;
@@ -1,15 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- var useConfig = require('./useConfig.js');
6
-
7
- function useTimeZone() {
8
- for (var _len = arguments.length, _ref = new Array(_len), _key = 0; _key < _len; _key++) {
9
- _ref[_key] = arguments[_key];
10
- }
11
- const config = useConfig.default('useTimeZone');
12
- return config.timeZone;
13
- }
14
-
15
- exports.default = useTimeZone;
@@ -1,17 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- var getTranslator = require('./getTranslator.js');
6
- var useConfig = require('./useConfig.js');
7
-
8
- function useTranslations() {
9
- for (var _len = arguments.length, _ref = new Array(_len), _key = 0; _key < _len; _key++) {
10
- _ref[_key] = arguments[_key];
11
- }
12
- let [namespace] = _ref;
13
- const config = useConfig.default('useTranslations');
14
- return getTranslator.default(config, namespace);
15
- }
16
-
17
- exports.default = useTranslations;
@@ -1,35 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- function receiveRoutingConfig(input) {
6
- var _input$localeDetectio, _input$alternateLinks;
7
- return {
8
- ...input,
9
- localePrefix: receiveLocalePrefixConfig(input.localePrefix),
10
- localeCookie: receiveLocaleCookie(input.localeCookie),
11
- localeDetection: (_input$localeDetectio = input.localeDetection) !== null && _input$localeDetectio !== void 0 ? _input$localeDetectio : true,
12
- alternateLinks: (_input$alternateLinks = input.alternateLinks) !== null && _input$alternateLinks !== void 0 ? _input$alternateLinks : true
13
- };
14
- }
15
- function receiveLocaleCookie(localeCookie) {
16
- return (localeCookie !== null && localeCookie !== void 0 ? localeCookie : true) ? {
17
- name: 'NEXT_LOCALE',
18
- maxAge: 31536000,
19
- // 1 year
20
- sameSite: 'lax',
21
- ...(typeof localeCookie === 'object' && localeCookie)
22
-
23
- // `path` needs to be provided based on a detected base path
24
- // that depends on the environment when setting a cookie
25
- } : false;
26
- }
27
- function receiveLocalePrefixConfig(localePrefix) {
28
- return typeof localePrefix === 'object' ? localePrefix : {
29
- mode: localePrefix || 'always'
30
- };
31
- }
32
-
33
- exports.receiveLocaleCookie = receiveLocaleCookie;
34
- exports.receiveLocalePrefixConfig = receiveLocalePrefixConfig;
35
- exports.receiveRoutingConfig = receiveRoutingConfig;
@@ -1,9 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- function defineRouting(config) {
6
- return config;
7
- }
8
-
9
- exports.default = defineRouting;
@@ -1,9 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- var defineRouting = require('./routing/defineRouting.js');
6
-
7
-
8
-
9
- exports.defineRouting = defineRouting.default;
@@ -1,43 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- var headers = require('next/headers');
6
- var navigation = require('next/navigation');
7
- var React = require('react');
8
- var constants = require('../../shared/constants.js');
9
- var RequestLocaleCache = require('./RequestLocaleCache.js');
10
-
11
- // This was originally built for Next.js <14, where `headers()` was not async.
12
- // With https://github.com/vercel/next.js/pull/68812, the API became async.
13
- // This file can be removed once we remove the legacy navigation APIs.
14
- function getHeaders() {
15
- return headers.headers();
16
- }
17
- function getLocaleFromHeaderImpl() {
18
- let locale;
19
- try {
20
- locale = getHeaders().get(constants.HEADER_LOCALE_NAME);
21
- } catch (error) {
22
- if (error instanceof Error && error.digest === 'DYNAMIC_SERVER_USAGE') {
23
- throw new Error('Usage of next-intl APIs in Server Components currently opts into dynamic rendering. This limitation will eventually be lifted, but as a stopgap solution, you can use the `setRequestLocale` API to enable static rendering, see https://next-intl-docs.vercel.app/docs/getting-started/app-router/with-i18n-routing#static-rendering', {
24
- cause: error
25
- });
26
- } else {
27
- throw error;
28
- }
29
- }
30
- if (!locale) {
31
- {
32
- console.error("\nUnable to find `next-intl` locale because the middleware didn't run on this request. See https://next-intl-docs.vercel.app/docs/routing/middleware#unable-to-find-locale. The `notFound()` function will be called as a result.\n");
33
- }
34
- navigation.notFound();
35
- }
36
- return locale;
37
- }
38
- const getLocaleFromHeader = React.cache(getLocaleFromHeaderImpl);
39
- function getRequestLocale() {
40
- return RequestLocaleCache.getCachedRequestLocale() || getLocaleFromHeader();
41
- }
42
-
43
- exports.getRequestLocale = getRequestLocale;
@@ -1,16 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- var getRuntimeConfig = require('next-intl/config');
6
-
7
- function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
8
-
9
- var getRuntimeConfig__default = /*#__PURE__*/_interopDefault(getRuntimeConfig);
10
-
11
-
12
-
13
- Object.defineProperty(exports, "default", {
14
- enumerable: true,
15
- get: function () { return getRuntimeConfig__default.default; }
16
- });
@@ -1,73 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- var navigation = require('next/navigation');
6
- var React = require('react');
7
- var core = require('use-intl/core');
8
- var RequestLocale = require('./RequestLocale.js');
9
- var RequestLocaleLegacy = require('./RequestLocaleLegacy.js');
10
- var getRuntimeConfig = require('next-intl/config');
11
-
12
- function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
13
-
14
- var getRuntimeConfig__default = /*#__PURE__*/_interopDefault(getRuntimeConfig);
15
-
16
- // Make sure `now` is consistent across the request in case none was configured
17
- function getDefaultNowImpl() {
18
- return new Date();
19
- }
20
- const getDefaultNow = React.cache(getDefaultNowImpl);
21
-
22
- // This is automatically inherited by `NextIntlClientProvider` if
23
- // the component is rendered from a Server Component
24
- function getDefaultTimeZoneImpl() {
25
- return Intl.DateTimeFormat().resolvedOptions().timeZone;
26
- }
27
- const getDefaultTimeZone = React.cache(getDefaultTimeZoneImpl);
28
- async function receiveRuntimeConfigImpl(getConfig, localeOverride) {
29
- if (typeof getConfig !== 'function') {
30
- throw new Error("Invalid i18n request configuration detected.\n\nPlease verify that:\n1. In case you've specified a custom location in your Next.js config, make sure that the path is correct.\n2. You have a default export in your i18n request configuration file.\n\nSee also: https://next-intl-docs.vercel.app/docs/usage/configuration#i18n-request\n");
31
- }
32
- const params = {
33
- // In case the consumer doesn't read `params.locale` and instead provides the
34
- // `locale` (either in a single-language workflow or because the locale is
35
- // read from the user settings), don't attempt to read the request locale.
36
- get locale() {
37
- return localeOverride || RequestLocaleLegacy.getRequestLocale();
38
- },
39
- get requestLocale() {
40
- return localeOverride ? Promise.resolve(localeOverride) : RequestLocale.getRequestLocale();
41
- }
42
- };
43
- let result = getConfig(params);
44
- if (result instanceof Promise) {
45
- result = await result;
46
- }
47
- const locale = result.locale || (await params.requestLocale);
48
- if (!locale) {
49
- {
50
- console.error("\nUnable to find `next-intl` locale because the middleware didn't run on this request and no `locale` was returned in `getRequestConfig`. See https://next-intl-docs.vercel.app/docs/routing/middleware#unable-to-find-locale. The `notFound()` function will be called as a result.\n");
51
- }
52
- navigation.notFound();
53
- }
54
- return {
55
- ...result,
56
- locale,
57
- now: result.now || getDefaultNow(),
58
- timeZone: result.timeZone || getDefaultTimeZone()
59
- };
60
- }
61
- const receiveRuntimeConfig = React.cache(receiveRuntimeConfigImpl);
62
- const getFormatters = React.cache(core._createIntlFormatters);
63
- const getCache = React.cache(core._createCache);
64
- async function getConfigImpl(localeOverride) {
65
- const runtimeConfig = await receiveRuntimeConfig(getRuntimeConfig__default.default, localeOverride);
66
- return {
67
- ...core.initializeConfig(runtimeConfig),
68
- _formatters: getFormatters(getCache())
69
- };
70
- }
71
- const getConfig = React.cache(getConfigImpl);
72
-
73
- exports.default = getConfig;