cloudflare-next-intl 0.8.60 → 0.9.0

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 (303) hide show
  1. package/README.md +60 -8
  2. package/dist/index.d.ts +1 -1
  3. package/dist/index.js +1 -1
  4. package/dist/package.json +1 -312
  5. package/dist/src/client/components/client_helper_script.js +2 -2
  6. package/dist/src/client/components/client_provider.d.ts +5 -17
  7. package/dist/src/client/components/client_provider.js +10 -22
  8. package/dist/src/client/components/client_provider_static.d.ts +4 -15
  9. package/dist/src/client/components/client_provider_static.js +8 -16
  10. package/dist/src/client/components/locale_link.d.ts +0 -22
  11. package/dist/src/client/components/locale_link.js +1 -23
  12. package/dist/src/client/components/locale_link_client.d.ts +1 -1
  13. package/dist/src/client/components/locale_link_client.js +4 -5
  14. package/dist/src/client/functions/get_cookie.d.ts +0 -9
  15. package/dist/src/client/functions/get_cookie.js +1 -10
  16. package/dist/src/client/functions/set_cookie.d.ts +0 -16
  17. package/dist/src/client/functions/set_cookie.js +1 -17
  18. package/dist/src/client/hooks/client_hooks.d.ts +1 -26
  19. package/dist/src/client/hooks/client_hooks.js +2 -27
  20. package/dist/src/client/hooks/use_path_name.d.ts +0 -9
  21. package/dist/src/client/hooks/use_path_name.js +1 -10
  22. package/dist/src/client/index.d.ts +4 -4
  23. package/dist/src/client/index.js +4 -8
  24. package/dist/src/config/index.d.ts +4 -4
  25. package/dist/src/config/index.js +4 -4
  26. package/dist/src/config/init_config.d.ts +1 -22
  27. package/dist/src/config/init_config.js +1 -31
  28. package/dist/src/config/intl_config.d.ts +1 -1
  29. package/dist/src/config/intl_sitemap.d.ts +1 -1
  30. package/dist/src/config/intl_sitemap.js +2 -2
  31. package/dist/src/config/middleware.d.ts +1 -14
  32. package/dist/src/config/middleware.js +11 -48
  33. package/dist/src/cookie_consent/client/components/auto_analytics_events.d.ts +1 -9
  34. package/dist/src/cookie_consent/client/components/auto_analytics_events.js +3 -12
  35. package/dist/src/cookie_consent/client/components/clarity_script.d.ts +0 -7
  36. package/dist/src/cookie_consent/client/components/clarity_script.js +1 -8
  37. package/dist/src/cookie_consent/client/components/cookie_consent_analytics.d.ts +1 -15
  38. package/dist/src/cookie_consent/client/components/cookie_consent_analytics.js +2 -20
  39. package/dist/src/cookie_consent/client/components/cookie_consent_dialog.d.ts +1 -24
  40. package/dist/src/cookie_consent/client/components/cookie_consent_dialog.js +6 -12
  41. package/dist/src/cookie_consent/client/components/default_dialog_styles.d.ts +1 -1
  42. package/dist/src/cookie_consent/client/components/default_privacy_policy_link.d.ts +0 -8
  43. package/dist/src/cookie_consent/client/components/default_privacy_policy_link.js +2 -10
  44. package/dist/src/cookie_consent/client/components/dialog_portal.d.ts +0 -8
  45. package/dist/src/cookie_consent/client/components/dialog_portal.js +0 -8
  46. package/dist/src/cookie_consent/client/components/privacy_policy_update_dialog.d.ts +1 -22
  47. package/dist/src/cookie_consent/client/components/privacy_policy_update_dialog.js +6 -12
  48. package/dist/src/cookie_consent/client/cookie_consent_provider.d.ts +1 -34
  49. package/dist/src/cookie_consent/client/cookie_consent_provider.js +8 -60
  50. package/dist/src/cookie_consent/client/use_cookie_consent.d.ts +1 -5
  51. package/dist/src/cookie_consent/client/use_cookie_consent.js +1 -5
  52. package/dist/src/cookie_consent/gdpr_countries.d.ts +1 -6
  53. package/dist/src/cookie_consent/gdpr_countries.js +2 -17
  54. package/dist/src/cookie_consent/index.d.ts +10 -10
  55. package/dist/src/cookie_consent/index.js +6 -6
  56. package/dist/src/cookie_consent/require_config.d.ts +1 -6
  57. package/dist/src/cookie_consent/require_config.js +0 -5
  58. package/dist/src/cookie_consent/types.d.ts +0 -42
  59. package/dist/src/db/access_token.d.ts +1 -13
  60. package/dist/src/db/access_token.js +2 -14
  61. package/dist/src/db/codegen_paths.d.ts +0 -1
  62. package/dist/src/db/codegen_paths.js +0 -6
  63. package/dist/src/db/connection.d.ts +7 -33
  64. package/dist/src/db/connection.js +6 -43
  65. package/dist/src/db/context.d.ts +4 -27
  66. package/dist/src/db/context.js +25 -104
  67. package/dist/src/db/encode_param.d.ts +0 -9
  68. package/dist/src/db/encode_param.js +0 -11
  69. package/dist/src/db/eslint_config.d.ts +0 -9
  70. package/dist/src/db/eslint_config.js +0 -9
  71. package/dist/src/db/helpers.d.ts +0 -61
  72. package/dist/src/db/helpers.js +0 -63
  73. package/dist/src/db/index.d.ts +4 -42
  74. package/dist/src/db/index.js +2 -40
  75. package/dist/src/db/inline_params.d.ts +0 -17
  76. package/dist/src/db/inline_params.js +37 -32
  77. package/dist/src/db/install_exec.d.ts +0 -14
  78. package/dist/src/db/install_exec.js +0 -12
  79. package/dist/src/db/parse_composite.d.ts +0 -16
  80. package/dist/src/db/parse_composite.js +6 -25
  81. package/dist/src/db/parse_statement.d.ts +1 -10
  82. package/dist/src/db/parse_statement.js +3 -16
  83. package/dist/src/db/parse_where.d.ts +1 -19
  84. package/dist/src/db/parse_where.js +88 -96
  85. package/dist/src/db/require_config.d.ts +1 -14
  86. package/dist/src/db/require_config.js +0 -13
  87. package/dist/src/db/resolve_config_value.d.ts +1 -11
  88. package/dist/src/db/resolve_config_value.js +0 -10
  89. package/dist/src/db/resolve_db_config.d.ts +3 -0
  90. package/dist/src/db/resolve_db_config.js +11 -0
  91. package/dist/src/db/resolve_mode.d.ts +1 -28
  92. package/dist/src/db/resolve_mode.js +1 -21
  93. package/dist/src/db/resolve_raw_sql.d.ts +0 -16
  94. package/dist/src/db/resolve_raw_sql.js +0 -16
  95. package/dist/src/db/rest_client.d.ts +2 -25
  96. package/dist/src/db/rest_client.js +1 -15
  97. package/dist/src/db/rest_execute.d.ts +2 -21
  98. package/dist/src/db/rest_execute.js +2 -21
  99. package/dist/src/db/rest_filters.d.ts +1 -28
  100. package/dist/src/db/rest_filters.js +1 -24
  101. package/dist/src/db/schema.d.ts +0 -6
  102. package/dist/src/db/schema.js +0 -6
  103. package/dist/src/db/sql_tokens.d.ts +0 -13
  104. package/dist/src/db/sql_tokens.js +17 -39
  105. package/dist/src/db/supabase_config.d.ts +1 -14
  106. package/dist/src/db/supabase_config.js +1 -11
  107. package/dist/src/db/supabase_transport.d.ts +1 -42
  108. package/dist/src/db/supabase_transport.js +6 -48
  109. package/dist/src/db/testing.d.ts +0 -57
  110. package/dist/src/db/testing.js +0 -57
  111. package/dist/src/db/transaction_batch.d.ts +2 -26
  112. package/dist/src/db/transaction_batch.js +3 -32
  113. package/dist/src/db/unsupported_sql.d.ts +0 -12
  114. package/dist/src/db/unsupported_sql.js +0 -11
  115. package/dist/src/error_handling/clear_client_cache.js +0 -1
  116. package/dist/src/error_handling/create_server_error_action.d.ts +2 -37
  117. package/dist/src/error_handling/create_server_error_action.js +2 -44
  118. package/dist/src/error_handling/default_ignored_console_errors.d.ts +0 -12
  119. package/dist/src/error_handling/default_ignored_console_errors.js +0 -15
  120. package/dist/src/error_handling/format_error_message.d.ts +1 -8
  121. package/dist/src/error_handling/format_error_message.js +1 -8
  122. package/dist/src/error_handling/index.d.ts +13 -13
  123. package/dist/src/error_handling/index.js +10 -10
  124. package/dist/src/error_handling/install_console_error_override.d.ts +1 -56
  125. package/dist/src/error_handling/install_console_error_override.js +1 -70
  126. package/dist/src/error_handling/install_global_error_override.d.ts +1 -19
  127. package/dist/src/error_handling/install_global_error_override.js +2 -20
  128. package/dist/src/error_handling/is_stale_deploy_error.js +2 -8
  129. package/dist/src/error_handling/report_error.d.ts +1 -46
  130. package/dist/src/error_handling/report_error.js +3 -80
  131. package/dist/src/error_handling/stringify_unknown.d.ts +0 -10
  132. package/dist/src/error_handling/stringify_unknown.js +0 -12
  133. package/dist/src/error_handling/use_stale_deploy_recovery.d.ts +0 -16
  134. package/dist/src/error_handling/use_stale_deploy_recovery.js +8 -28
  135. package/dist/src/error_handling/with_error_handling.d.ts +2 -8
  136. package/dist/src/error_handling/with_error_handling.js +1 -6
  137. package/dist/src/firebase_auth/client/auth_actions.d.ts +2 -79
  138. package/dist/src/firebase_auth/client/auth_actions.js +4 -81
  139. package/dist/src/firebase_auth/client/auth_user_cache.d.ts +1 -1
  140. package/dist/src/firebase_auth/client/auth_user_cache.js +0 -2
  141. package/dist/src/firebase_auth/client/auth_user_provider.d.ts +2 -25
  142. package/dist/src/firebase_auth/client/auth_user_provider.js +15 -116
  143. package/dist/src/firebase_auth/client/components/auto_firebase_performance_events.d.ts +0 -8
  144. package/dist/src/firebase_auth/client/components/auto_firebase_performance_events.js +3 -17
  145. package/dist/src/firebase_auth/client/firebase_client.d.ts +5 -14
  146. package/dist/src/firebase_auth/client/firebase_client.js +9 -49
  147. package/dist/src/firebase_auth/client/use_auth_user.d.ts +1 -11
  148. package/dist/src/firebase_auth/client/use_auth_user.js +1 -11
  149. package/dist/src/firebase_auth/decode_jwt_payload.d.ts +0 -20
  150. package/dist/src/firebase_auth/decode_jwt_payload.js +2 -22
  151. package/dist/src/firebase_auth/error_messages/firebase_auth_error_helper.d.ts +0 -5
  152. package/dist/src/firebase_auth/error_messages/firebase_auth_error_helper.js +3 -12
  153. package/dist/src/firebase_auth/index.d.ts +10 -10
  154. package/dist/src/firebase_auth/index.js +8 -14
  155. package/dist/src/firebase_auth/is_whitelisted.d.ts +0 -7
  156. package/dist/src/firebase_auth/is_whitelisted.js +1 -8
  157. package/dist/src/firebase_auth/middleware/update_session.d.ts +0 -32
  158. package/dist/src/firebase_auth/middleware/update_session.js +21 -225
  159. package/dist/src/firebase_auth/preserve_redirect_query.d.ts +0 -17
  160. package/dist/src/firebase_auth/preserve_redirect_query.js +0 -17
  161. package/dist/src/firebase_auth/require_config.d.ts +1 -7
  162. package/dist/src/firebase_auth/require_config.js +0 -6
  163. package/dist/src/firebase_auth/server/auth_user_server_provider.d.ts +2 -26
  164. package/dist/src/firebase_auth/server/auth_user_server_provider.js +5 -32
  165. package/dist/src/firebase_auth/server/clear_session_action.d.ts +0 -6
  166. package/dist/src/firebase_auth/server/clear_session_action.js +1 -7
  167. package/dist/src/firebase_auth/server/firebase_server.d.ts +2 -12
  168. package/dist/src/firebase_auth/server/firebase_server.js +6 -71
  169. package/dist/src/firebase_auth/server/mint_server_app_check_token.d.ts +1 -29
  170. package/dist/src/firebase_auth/server/mint_server_app_check_token.js +2 -45
  171. package/dist/src/firebase_auth/server/sign_custom_token_remote.d.ts +0 -13
  172. package/dist/src/firebase_auth/server/sign_custom_token_remote.js +0 -13
  173. package/dist/src/firebase_auth/server/use_auth_user_server.d.ts +1 -29
  174. package/dist/src/firebase_auth/server/use_auth_user_server.js +1 -29
  175. package/dist/src/firebase_auth/types.d.ts +3 -10
  176. package/dist/src/general/cache_variables.d.ts +1 -5
  177. package/dist/src/general/cache_variables.js +1 -6
  178. package/dist/src/general/general_functions.d.ts +1 -1
  179. package/dist/src/general/general_functions.js +7 -74
  180. package/dist/src/general/index.d.ts +2 -2
  181. package/dist/src/general/index.js +2 -2
  182. package/dist/src/general/metadata.d.ts +0 -25
  183. package/dist/src/general/metadata.js +2 -27
  184. package/dist/src/image_optimizer/manifest.js +0 -1
  185. package/dist/src/image_optimizer/next_image_shim.js +2 -10
  186. package/dist/src/image_optimizer/process_image.d.ts +1 -6
  187. package/dist/src/image_optimizer/process_image.js +45 -38
  188. package/dist/src/image_optimizer/run.d.ts +1 -5
  189. package/dist/src/image_optimizer/run.js +24 -15
  190. package/dist/src/image_optimizer/scan_used.d.ts +0 -15
  191. package/dist/src/image_optimizer/scan_used.js +0 -17
  192. package/dist/src/image_optimizer/types.d.ts +6 -32
  193. package/dist/src/image_optimizer/types.js +8 -1
  194. package/dist/src/index.d.ts +7 -7
  195. package/dist/src/index.js +7 -7
  196. package/dist/src/server/components/helper_script.d.ts +0 -23
  197. package/dist/src/server/components/helper_script.js +45 -26
  198. package/dist/src/server/components/link.d.ts +0 -20
  199. package/dist/src/server/components/link.js +2 -22
  200. package/dist/src/server/components/server_provider.d.ts +1 -88
  201. package/dist/src/server/components/server_provider.js +9 -109
  202. package/dist/src/server/components/server_provider_static.d.ts +1 -48
  203. package/dist/src/server/components/server_provider_static.js +8 -62
  204. package/dist/src/server/functions/geo.d.ts +1 -26
  205. package/dist/src/server/functions/geo.js +1 -35
  206. package/dist/src/server/functions/get_user_locale.js +3 -7
  207. package/dist/src/server/functions/locale_static_params.d.ts +0 -12
  208. package/dist/src/server/functions/locale_static_params.js +1 -13
  209. package/dist/src/server/functions/server.d.ts +1 -60
  210. package/dist/src/server/functions/server.js +9 -84
  211. package/dist/src/server/functions/use_functions.d.ts +1 -28
  212. package/dist/src/server/functions/use_functions.js +3 -30
  213. package/dist/src/server/index.d.ts +6 -6
  214. package/dist/src/server/index.js +6 -10
  215. package/dist/src/theme_switcher/components/theme_switcher.d.ts +0 -10
  216. package/dist/src/theme_switcher/components/theme_switcher.js +6 -16
  217. package/dist/src/theme_switcher/components/theme_switcher_button.js +9 -10
  218. package/dist/src/theme_switcher/index.d.ts +1 -1
  219. package/dist/src/theme_switcher/index.js +1 -1
  220. package/dist/src/types/index.d.ts +1 -1
  221. package/dist/src/types/types.d.ts +4 -844
  222. package/dist/src/vite/locale_file_plugin.d.ts +0 -10
  223. package/dist/src/vite/plugin.d.ts +0 -24
  224. package/llms.txt +8 -0
  225. package/package.json +19 -4
  226. package/dist/src/client/functions/get_cookie.bench.d.ts +0 -1
  227. package/dist/src/client/functions/get_cookie.bench.js +0 -11
  228. package/dist/src/client/functions/set_cookie.bench.d.ts +0 -1
  229. package/dist/src/client/functions/set_cookie.bench.js +0 -10
  230. package/dist/src/client/hooks/client_hooks.bench.d.ts +0 -1
  231. package/dist/src/client/hooks/client_hooks.bench.js +0 -19
  232. package/dist/src/client/hooks/use_path_name.bench.d.ts +0 -1
  233. package/dist/src/client/hooks/use_path_name.bench.js +0 -16
  234. package/dist/src/config/cookie_key.bench.d.ts +0 -1
  235. package/dist/src/config/cookie_key.bench.js +0 -9
  236. package/dist/src/config/init_config.bench.d.ts +0 -1
  237. package/dist/src/config/init_config.bench.js +0 -7
  238. package/dist/src/config/intl_sitemap.bench.d.ts +0 -1
  239. package/dist/src/config/intl_sitemap.bench.js +0 -18
  240. package/dist/src/config/middleware.bench.d.ts +0 -1
  241. package/dist/src/config/middleware.bench.js +0 -34
  242. package/dist/src/cookie_consent/client/components/cookie_consent_analytics.bench.d.ts +0 -1
  243. package/dist/src/cookie_consent/client/components/cookie_consent_analytics.bench.js +0 -14
  244. package/dist/src/cookie_consent/client/cookie_consent_provider.bench.d.ts +0 -1
  245. package/dist/src/cookie_consent/client/cookie_consent_provider.bench.js +0 -31
  246. package/dist/src/cookie_consent/gdpr_countries.bench.d.ts +0 -1
  247. package/dist/src/cookie_consent/gdpr_countries.bench.js +0 -37
  248. package/dist/src/db/db_performance.bench.d.ts +0 -1
  249. package/dist/src/db/db_performance.bench.js +0 -116
  250. package/dist/src/error_handling/install_console_error_override.bench.d.ts +0 -1
  251. package/dist/src/error_handling/install_console_error_override.bench.js +0 -10
  252. package/dist/src/error_handling/report_error.bench.d.ts +0 -1
  253. package/dist/src/error_handling/report_error.bench.js +0 -25
  254. package/dist/src/error_handling/stringify_unknown.bench.d.ts +0 -1
  255. package/dist/src/error_handling/stringify_unknown.bench.js +0 -29
  256. package/dist/src/firebase_auth/client/auth_actions.bench.d.ts +0 -1
  257. package/dist/src/firebase_auth/client/auth_actions.bench.js +0 -37
  258. package/dist/src/firebase_auth/client/auth_user_cache.bench.d.ts +0 -1
  259. package/dist/src/firebase_auth/client/auth_user_cache.bench.js +0 -11
  260. package/dist/src/firebase_auth/client/firebase_client.bench.d.ts +0 -1
  261. package/dist/src/firebase_auth/client/firebase_client.bench.js +0 -28
  262. package/dist/src/firebase_auth/client/use_auth_user.bench.d.ts +0 -1
  263. package/dist/src/firebase_auth/client/use_auth_user.bench.js +0 -18
  264. package/dist/src/firebase_auth/decode_jwt_payload.bench.d.ts +0 -1
  265. package/dist/src/firebase_auth/decode_jwt_payload.bench.js +0 -35
  266. package/dist/src/firebase_auth/error_messages/default_messages.en.bench.d.ts +0 -1
  267. package/dist/src/firebase_auth/error_messages/default_messages.en.bench.js +0 -10
  268. package/dist/src/firebase_auth/error_messages/firebase_auth_error_helper.bench.d.ts +0 -1
  269. package/dist/src/firebase_auth/error_messages/firebase_auth_error_helper.bench.js +0 -15
  270. package/dist/src/firebase_auth/middleware/update_session.bench.d.ts +0 -1
  271. package/dist/src/firebase_auth/middleware/update_session.bench.js +0 -45
  272. package/dist/src/firebase_auth/require_config.bench.d.ts +0 -1
  273. package/dist/src/firebase_auth/require_config.bench.js +0 -24
  274. package/dist/src/firebase_auth/server/firebase_server.bench.d.ts +0 -1
  275. package/dist/src/firebase_auth/server/firebase_server.bench.js +0 -27
  276. package/dist/src/firebase_auth/server/use_auth_user_server.bench.d.ts +0 -1
  277. package/dist/src/firebase_auth/server/use_auth_user_server.bench.js +0 -14
  278. package/dist/src/general/cache_variables.bench.d.ts +0 -1
  279. package/dist/src/general/cache_variables.bench.js +0 -21
  280. package/dist/src/general/general_functions.bench.d.ts +0 -1
  281. package/dist/src/general/general_functions.bench.js +0 -18
  282. package/dist/src/general/metadata.bench.d.ts +0 -1
  283. package/dist/src/general/metadata.bench.js +0 -15
  284. package/dist/src/image_optimizer/process_image.bench.d.ts +0 -1
  285. package/dist/src/image_optimizer/process_image.bench.js +0 -68
  286. package/dist/src/image_optimizer/test_helpers.d.ts +0 -3
  287. package/dist/src/image_optimizer/test_helpers.js +0 -25
  288. package/dist/src/server/components/helper_script.bench.d.ts +0 -1
  289. package/dist/src/server/components/helper_script.bench.js +0 -73
  290. package/dist/src/server/functions/geo.bench.d.ts +0 -1
  291. package/dist/src/server/functions/geo.bench.js +0 -14
  292. package/dist/src/server/functions/get_user_locale.bench.d.ts +0 -1
  293. package/dist/src/server/functions/get_user_locale.bench.js +0 -13
  294. package/dist/src/server/functions/server.bench.d.ts +0 -1
  295. package/dist/src/server/functions/server.bench.js +0 -39
  296. package/dist/src/server/functions/use_functions.bench.d.ts +0 -1
  297. package/dist/src/server/functions/use_functions.bench.js +0 -23
  298. package/dist/src/test_utils/image_optimizer_test_helpers.d.ts +0 -4
  299. package/dist/src/test_utils/image_optimizer_test_helpers.js +0 -40
  300. package/dist/src/test_utils/mock_next_server.d.ts +0 -5
  301. package/dist/src/test_utils/mock_next_server.js +0 -10
  302. package/dist/vitest.bench.config.d.ts +0 -2
  303. package/dist/vitest.bench.config.js +0 -18
package/README.md CHANGED
@@ -277,6 +277,8 @@ export default defineConfig({
277
277
  formats: ["avif", "webp"], // Target sibling formats, in browser-preference order (default: ["webp"], or `false`).
278
278
  // Also supports: "png", "jpeg", "gif", "tiff", "heif", "jp2", "jxl"
279
279
  quality: 80, // Compression quality (default: 80)
280
+ effort: 4, // Encoder effort 0-9 for avif/webp/png/heif/jxl (default: sharp's own default per format)
281
+ concurrency: 4, // Images processed in parallel (default: cpu count, clamped to 1-8)
280
282
  blur: { quality: 70, stdDeviation: 20 }, // Next.js blur placeholder options (or `false`)
281
283
  overrides: { // Per-image overrides keyed by public src path (wins over scanned <Image> props)
282
284
  "/images/hero.png": { maxWidth: false, formats: ["webp"], blur: { quality: 80 } },
@@ -308,7 +310,7 @@ import { Image } from "cloudflare-next-intl/image";
308
310
  <Image src="/images/icon.svg" formats={false} blur={false} maxWidth={false} />
309
311
  ```
310
312
 
311
- Supported props: `formats` (array or `false`), `maxWidth` (number or `false`), `quality` (number), `blur` (`true`, `false`, or `{ size, quality, stdDeviation }`).
313
+ Supported props: `formats` (array or `false`), `maxWidth` (number or `false`), `quality` (number), `blur` (`true`, `false`, or `{ size, quality, stdDeviation }`). `effort` is not scanned from JSX props — set it via the centralized `overrides` config or the global option.
312
314
 
313
315
  ##### Multi-Size Variants (Responsive Images)
314
316
 
@@ -454,6 +456,17 @@ export async function generateMetadata({ params }) {
454
456
  Set `firebaseAuth` on your `RoutingConfig` to enable — `IntlProvider` then
455
457
  auto-wires `AuthUserProvider` and server-side `getAuthUser` session validation.
456
458
 
459
+ Requires `firebase` (or the scoped `@firebase/app` + `@firebase/auth` +
460
+ `@firebase/app-check` + `@firebase/performance` packages) as a **peer**
461
+ dependency — `npm install firebase` if you don't already have it. Declared as
462
+ a peer, not a bundled dependency, so your own `firebase` install is the one
463
+ and only copy that gets used: `@firebase/app` keeps its app registry
464
+ (`getApps()`/`initializeApp()`) as module-level state, so a second, separately
465
+ installed copy would silently initialize its own untracked Firebase app
466
+ instead of joining yours. All `firebase_auth*` subpaths load their Firebase
467
+ imports lazily (dynamic `import()`), so nothing is pulled in — installed or
468
+ bundled — for apps that never set `firebaseAuth`.
469
+
457
470
  Features include:
458
471
  - `whiteListPaths`: Array of paths exempt from auth redirects (matches exact path or path-segment prefix, e.g. `/bonds` matches `/bonds/some-slug`).
459
472
  - `actionLinkPath`: Pinned route for handling Firebase action links (e.g. `/auth/action`), prioritized during cross-origin action link redirects.
@@ -593,7 +606,11 @@ third party without consent can itself be GDPR-relevant.
593
606
 
594
607
  #### Stale Deploy & Chunk Load Error Recovery
595
608
 
596
- When a new version of your application is deployed to Cloudflare Workers, users on older client sessions may encounter `ChunkLoadError` or failed dynamic imports when requesting outdated chunks. Use `isStaleDeployError` and `clearClientCache` in error boundaries or global error handlers to automatically recover:
609
+ When a new version of your application is deployed to Cloudflare Workers, users on older client sessions may encounter `ChunkLoadError` or failed dynamic imports when requesting outdated chunks.
610
+
611
+ `IntlHelperScript` renders an early-catch `<script>` (production only, id `stale-deploy-early-catch`) that runs before hydration and listens for `window.error`/`unhandledrejection` events matching the same patterns as `isStaleDeployError` (inlined as JSON, so it stays in sync with `staleDeployPatterns` config), then force-reloads once per build id. This covers the case a React-level recovery (`useStaleDeployRecovery` below) cannot: when the chunk that failed to load is part of your own error boundary/global-error bundle, React never gets a chance to render the recovery UI. Both layers share the same `sessionStorage['stale-deploy-recovery-reloaded']` marker keyed by build id, so they can't double-reload each other. No setup beyond rendering `<IntlHelperScript />` is required.
612
+
613
+ For errors that don't crash the module graph itself (a normal thrown error reaching an error boundary), use `isStaleDeployError` and `clearClientCache` in error boundaries or global error handlers to automatically recover:
597
614
 
598
615
  ```typescript
599
616
  import { isStaleDeployError, clearClientCache } from "cloudflare-next-intl/errorHandling";
@@ -714,6 +731,36 @@ query code is identical either way — switching is a config change only.
714
731
  A direct connection always wins if both are configured, so adding a `supabase`
715
732
  block cannot silently reroute live traffic.
716
733
 
734
+ #### Standalone usage (no Next.js / `@intl-config`)
735
+
736
+ `withPublicDb`/`withUserDb` normally read their `db` config from
737
+ `@intl-config` (Next.js apps, via `setIntlConfig`). Outside Next.js — Firebase
738
+ Functions, a script, any plain TypeScript project with no bundler alias to
739
+ set up — pass the `db` block directly as the last argument instead:
740
+
741
+ ```typescript
742
+ // e.g. firebase/functions/src/index.ts — no @intl-config alias needed
743
+ import { withPublicDb, withUserDb } from "cloudflare-next-intl/db";
744
+
745
+ const rows = await withPublicDb(
746
+ (db) => db.select().from(bonds).limit(10),
747
+ { connectionString: process.env.DATABASE_URL },
748
+ );
749
+
750
+ const own = await withUserDb(
751
+ (db) => db.select().from(invitations),
752
+ uid,
753
+ { supabase: { url: process.env.SUPABASE_URL, anonKey: process.env.SUPABASE_ANON_KEY } },
754
+ );
755
+ ```
756
+
757
+ Import the whole package (`npm install cloudflare-next-intl`) but only the
758
+ `cloudflare-next-intl/db` subpath — its dynamic `import()`s for `pg`/
759
+ `drizzle-orm`/`@supabase/supabase-js` mean nothing Next.js/React-specific ever
760
+ loads. This is the same `db` export Next.js apps use; the override argument is
761
+ additive; Next.js call sites that omit it keep reading `@intl-config` exactly
762
+ as before.
763
+
717
764
  ```typescript
718
765
  export default setIntlConfig({
719
766
  locales: ["en", "uk"] as const,
@@ -893,12 +940,12 @@ allowed to see the rows; call `.transaction(...)` on the handle either one
893
940
  hands your callback when a write needs more than one statement to succeed or
894
941
  fail together (see [Multi-statement transactions](#multi-statement-transactions-dbtransaction) above):
895
942
 
896
- - `withPublicDb(fn)` — runs `fn` as the anonymous role: a pooled connection
897
- with no transaction/role switch in connection-string mode, or the anon key
898
- as the PostgREST bearer token in Supabase mode. No user id is attached
899
- either way, so RLS policies that test `auth.jwt()->>'sub'` will deny access
900
- — use `withUserDb` for user-owned rows.
901
- - `withUserDb(fn, uid?)` — runs `fn` as the signed-in user. In
943
+ - `withPublicDb(fn, dbOverride?)` — runs `fn` as the anonymous role: a pooled
944
+ connection with no transaction/role switch in connection-string mode, or the
945
+ anon key as the PostgREST bearer token in Supabase mode. No user id is
946
+ attached either way, so RLS policies that test `auth.jwt()->>'sub'` will
947
+ deny access — use `withUserDb` for user-owned rows.
948
+ - `withUserDb(fn, uid?, dbOverride?)` — runs `fn` as the signed-in user. In
902
949
  connection-string mode this opens a transaction where Postgres sees the
903
950
  resolved user id as `auth.jwt()->>'sub'` under `db.authenticatedRole`; in
904
951
  Supabase mode identity instead rides on the JWT from `getAccessToken`/
@@ -909,6 +956,11 @@ fail together (see [Multi-statement transactions](#multi-statement-transactions-
909
956
  signed-in Firebase user when `firebaseAuth` is configured — you rarely need
910
957
  to pass it explicitly.
911
958
 
959
+ `dbOverride` — a `db` block (`{ connectionString }` or `{ supabase }`) used
960
+ for that one call instead of `@intl-config`'s. This is what makes `db` usable
961
+ outside Next.js — see [Standalone usage](#standalone-usage-no-nextintl-config)
962
+ below.
963
+
912
964
  ```typescript
913
965
  // anywhere on the server
914
966
  import { withPublicDb } from "cloudflare-next-intl/db";
package/dist/index.d.ts CHANGED
@@ -1 +1 @@
1
- export * from './src';
1
+ export * from './src/index.js';
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- export * from './src';
1
+ export * from './src/index.js';
package/dist/package.json CHANGED
@@ -1,314 +1,3 @@
1
1
  {
2
- "name": "cloudflare-next-intl",
3
- "version": "0.8.53",
4
- "description": "Optimized Next Intl Package Special for App Router and Cloudflare",
5
- "main": "dist/index.js",
6
- "types": "dist/index.d.ts",
7
- "sideEffects": false,
8
- "bin": {
9
- "cfni-db-codegen": "bin/db_codegen.mjs",
10
- "cfni-db-install-exec": "bin/db_install_exec.mjs"
11
- },
12
- "files": [
13
- "dist",
14
- "bin",
15
- "supabase",
16
- "LICENSE",
17
- "README.md",
18
- "llms.txt"
19
- ],
20
- "exports": {
21
- ".": {
22
- "types": "./dist/index.d.ts",
23
- "import": "./dist/index.js"
24
- },
25
- "./client": {
26
- "types": "./dist/src/client/index.d.ts",
27
- "import": "./dist/src/client/index.js"
28
- },
29
- "./server": {
30
- "types": "./dist/src/server/index.d.ts",
31
- "import": "./dist/src/server/index.js"
32
- },
33
- "./geo": {
34
- "types": "./dist/src/server/functions/geo.d.ts",
35
- "import": "./dist/src/server/functions/geo.js"
36
- },
37
- "./getCountry": {
38
- "types": "./dist/src/server/functions/geo.d.ts",
39
- "import": "./dist/src/server/functions/geo.js"
40
- },
41
- "./getTimezone": {
42
- "types": "./dist/src/server/functions/geo.d.ts",
43
- "import": "./dist/src/server/functions/geo.js"
44
- },
45
- "./middleware": {
46
- "types": "./dist/src/config/middleware.d.ts",
47
- "import": "./dist/src/config/middleware.js"
48
- },
49
- "./setIntlConfig": {
50
- "types": "./dist/src/config/init_config.d.ts",
51
- "import": "./dist/src/config/init_config.js"
52
- },
53
- "./serverProvider": {
54
- "types": "./dist/src/server/components/server_provider.d.ts",
55
- "import": "./dist/src/server/components/server_provider.js"
56
- },
57
- "./serverProviderStatic": {
58
- "types": "./dist/src/server/components/server_provider_static.d.ts",
59
- "import": "./dist/src/server/components/server_provider_static.js"
60
- },
61
- "./Link": {
62
- "types": "./dist/src/server/components/link.d.ts",
63
- "import": "./dist/src/server/components/link.js"
64
- },
65
- "./IntlHelperScript": {
66
- "types": "./dist/src/server/components/helper_script.d.ts",
67
- "import": "./dist/src/server/components/helper_script.js"
68
- },
69
- "./LocaleLink": {
70
- "types": "./dist/src/client/components/locale_link.d.ts",
71
- "import": "./dist/src/client/components/locale_link.js"
72
- },
73
- "./usePathname": {
74
- "types": "./dist/src/client/hooks/use_path_name.d.ts",
75
- "import": "./dist/src/client/hooks/use_path_name.js"
76
- },
77
- "./metadata": {
78
- "types": "./dist/src/general/metadata.d.ts",
79
- "import": "./dist/src/general/metadata.js"
80
- },
81
- "./setCookieClient": {
82
- "types": "./dist/src/client/functions/set_cookie.d.ts",
83
- "import": "./dist/src/client/functions/set_cookie.js"
84
- },
85
- "./getCookieClient": {
86
- "types": "./dist/src/client/functions/get_cookie.d.ts",
87
- "import": "./dist/src/client/functions/get_cookie.js"
88
- },
89
- "./localeStaticParams": {
90
- "types": "./dist/src/server/functions/locale_static_params.d.ts",
91
- "import": "./dist/src/server/functions/locale_static_params.js"
92
- },
93
- "./use": {
94
- "react-server": {
95
- "types": "./dist/src/server/functions/use_functions.d.ts",
96
- "import": "./dist/src/server/functions/use_functions.js"
97
- },
98
- "default": {
99
- "types": "./dist/src/client/hooks/client_hooks.d.ts",
100
- "import": "./dist/src/client/hooks/client_hooks.js"
101
- }
102
- },
103
- "./ThemeSwitcher": {
104
- "types": "./dist/src/theme_switcher/components/theme_switcher.d.ts",
105
- "import": "./dist/src/theme_switcher/components/theme_switcher.js"
106
- },
107
- "./firebaseAuthClient": {
108
- "types": "./dist/src/firebase_auth/client/firebase_client.d.ts",
109
- "import": "./dist/src/firebase_auth/client/firebase_client.js"
110
- },
111
- "./firebaseAuthClientProvider": {
112
- "types": "./dist/src/firebase_auth/client/auth_user_provider.d.ts",
113
- "import": "./dist/src/firebase_auth/client/auth_user_provider.js"
114
- },
115
- "./firebaseAuthServerProvider": {
116
- "types": "./dist/src/firebase_auth/server/auth_user_server_provider.d.ts",
117
- "import": "./dist/src/firebase_auth/server/auth_user_server_provider.js"
118
- },
119
- "./useFirebaseAuthUser": {
120
- "react-server": {
121
- "types": "./dist/src/firebase_auth/server/use_auth_user_server.d.ts",
122
- "import": "./dist/src/firebase_auth/server/use_auth_user_server.js"
123
- },
124
- "default": {
125
- "types": "./dist/src/firebase_auth/client/use_auth_user.d.ts",
126
- "import": "./dist/src/firebase_auth/client/use_auth_user.js"
127
- }
128
- },
129
- "./getFirebaseAuthUser": {
130
- "types": "./dist/src/firebase_auth/server/use_auth_user_server.d.ts",
131
- "import": "./dist/src/firebase_auth/server/use_auth_user_server.js"
132
- },
133
- "./firebaseAuthActions": {
134
- "types": "./dist/src/firebase_auth/client/auth_actions.d.ts",
135
- "import": "./dist/src/firebase_auth/client/auth_actions.js"
136
- },
137
- "./firebaseAuthMiddleware": {
138
- "types": "./dist/src/firebase_auth/middleware/update_session.d.ts",
139
- "import": "./dist/src/firebase_auth/middleware/update_session.js"
140
- },
141
- "./cookieConsent": {
142
- "types": "./dist/src/cookie_consent/index.d.ts",
143
- "import": "./dist/src/cookie_consent/index.js"
144
- },
145
- "./CookieConsentProvider": {
146
- "types": "./dist/src/cookie_consent/client/cookie_consent_provider.d.ts",
147
- "import": "./dist/src/cookie_consent/client/cookie_consent_provider.js"
148
- },
149
- "./useCookieConsent": {
150
- "types": "./dist/src/cookie_consent/client/use_cookie_consent.d.ts",
151
- "import": "./dist/src/cookie_consent/client/use_cookie_consent.js"
152
- },
153
- "./CookieConsentDialog": {
154
- "types": "./dist/src/cookie_consent/client/components/cookie_consent_dialog.d.ts",
155
- "import": "./dist/src/cookie_consent/client/components/cookie_consent_dialog.js"
156
- },
157
- "./PrivacyPolicyUpdateDialog": {
158
- "types": "./dist/src/cookie_consent/client/components/privacy_policy_update_dialog.d.ts",
159
- "import": "./dist/src/cookie_consent/client/components/privacy_policy_update_dialog.js"
160
- },
161
- "./cookieConsentAnalytics": {
162
- "types": "./dist/src/cookie_consent/client/components/cookie_consent_analytics.d.ts",
163
- "import": "./dist/src/cookie_consent/client/components/cookie_consent_analytics.js"
164
- },
165
- "./errorHandling": {
166
- "types": "./dist/src/error_handling/index.d.ts",
167
- "import": "./dist/src/error_handling/index.js"
168
- },
169
- "./installConsoleErrorOverride": {
170
- "types": "./dist/src/error_handling/install_console_error_override.d.ts",
171
- "import": "./dist/src/error_handling/install_console_error_override.js"
172
- },
173
- "./installGlobalErrorOverride": {
174
- "types": "./dist/src/error_handling/install_global_error_override.d.ts",
175
- "import": "./dist/src/error_handling/install_global_error_override.js"
176
- },
177
- "./stringifyUnknown": {
178
- "types": "./dist/src/error_handling/stringify_unknown.d.ts",
179
- "import": "./dist/src/error_handling/stringify_unknown.js"
180
- },
181
- "./formatErrorMessage": {
182
- "types": "./dist/src/error_handling/format_error_message.d.ts",
183
- "import": "./dist/src/error_handling/format_error_message.js"
184
- },
185
- "./defaultIgnoredConsoleErrors": {
186
- "types": "./dist/src/error_handling/default_ignored_console_errors.d.ts",
187
- "import": "./dist/src/error_handling/default_ignored_console_errors.js"
188
- },
189
- "./createServerErrorAction": {
190
- "types": "./dist/src/error_handling/create_server_error_action.d.ts",
191
- "import": "./dist/src/error_handling/create_server_error_action.js"
192
- },
193
- "./isStaleDeployError": {
194
- "types": "./dist/src/error_handling/is_stale_deploy_error.d.ts",
195
- "import": "./dist/src/error_handling/is_stale_deploy_error.js"
196
- },
197
- "./clearClientCache": {
198
- "types": "./dist/src/error_handling/clear_client_cache.d.ts",
199
- "import": "./dist/src/error_handling/clear_client_cache.js"
200
- },
201
- "./db": {
202
- "types": "./dist/src/db/index.d.ts",
203
- "import": "./dist/src/db/index.js"
204
- },
205
- "./dbEslint": {
206
- "types": "./dist/src/db/eslint_config.d.ts",
207
- "import": "./dist/src/db/eslint_config.js"
208
- },
209
- "./dbHelpers": {
210
- "types": "./dist/src/db/helpers.d.ts",
211
- "import": "./dist/src/db/helpers.js"
212
- },
213
- "./dbTesting": {
214
- "types": "./dist/src/db/testing.d.ts",
215
- "import": "./dist/src/db/testing.js"
216
- },
217
- "./dbSchema": {
218
- "types": "./dist/src/db/schema.d.ts",
219
- "import": "./dist/src/db/schema.js"
220
- },
221
- "./vite": {
222
- "types": "./dist/src/vite/index.d.ts",
223
- "import": "./dist/src/vite/index.js"
224
- }
225
- },
226
- "scripts": {
227
- "test": "vitest run --coverage",
228
- "bench": "vitest bench --run",
229
- "build": "tsc"
230
- },
231
- "repository": {
232
- "type": "git",
233
- "url": "git+https://github.com/demian-ilnytskyi/cloudflare-next-intl.git"
234
- },
235
- "keywords": [
236
- "nextjs",
237
- "i18n",
238
- "internationalization",
239
- "localization",
240
- "multilingual",
241
- "translation",
242
- "language",
243
- "optimized",
244
- "performance",
245
- "bundle-size",
246
- "fast",
247
- "efficient",
248
- "app-router",
249
- "server-components",
250
- "ssr",
251
- "ssg",
252
- "tree-shaking",
253
- "dynamic-imports",
254
- "react",
255
- "next-intl",
256
- "messages",
257
- "formatting",
258
- "icu"
259
- ],
260
- "author": "Demian Ilnutskyi",
261
- "license": "MIT",
262
- "bugs": {
263
- "url": "https://github.com/demian-ilnytskyi/cloudflare-next-intl/issues"
264
- },
265
- "homepage": "https://github.com/demian-ilnytskyi/cloudflare-next-intl#readme",
266
- "dependencies": {
267
- "@microsoft/clarity": "^1.0.2",
268
- "@supabase/supabase-js": "^2.112.3",
269
- "drizzle-kit": "^0.31.10",
270
- "drizzle-orm": "^0.45.2",
271
- "embedded-postgres": "^18.4.0-beta.17",
272
- "firebase": "^12.17.0",
273
- "jose": "^6.2.8",
274
- "pg": "^8.23.0"
275
- },
276
- "peerDependencies": {
277
- "next": ">=12.0.0",
278
- "react": "^16.8.0 || ^17.0.0 || ^18.0.0 || >=19.0.0-rc <19.0.0 || ^19.0.0",
279
- "typescript": ">=5.0.0",
280
- "vite": ">=6"
281
- },
282
- "peerDependenciesMeta": {
283
- "typescript": {
284
- "optional": true
285
- },
286
- "vite": {
287
- "optional": true
288
- }
289
- },
290
- "devDependencies": {
291
- "@eslint/eslintrc": "^3",
292
- "@eslint/js": "^9.27.0",
293
- "@testing-library/dom": "^10.4.1",
294
- "@testing-library/jest-dom": "^7.0.0",
295
- "@testing-library/react": "^16.3.2",
296
- "@types/node": "^20.14.5",
297
- "@types/pg": "^8.23.1",
298
- "@types/react": "^19.0.0",
299
- "@types/react-dom": "^19.0.0",
300
- "@vitest/coverage-v8": "^3.2.7",
301
- "eslint": "^9.28.0",
302
- "eslint-config-next": "15.3.3",
303
- "eslint-config-prettier": "^10.1.2",
304
- "jsdom": "^29.1.1",
305
- "next": "^15.3.0",
306
- "react": "19.2.0",
307
- "react-dom": "19.2.0",
308
- "tsup": "^8.5.1",
309
- "typescript": "^5.5.3",
310
- "typescript-eslint": "^8.33.1",
311
- "vite": "^7.0.0",
312
- "vitest": "^3.0.8"
313
- }
2
+ "type": "module"
314
3
  }
@@ -1,7 +1,7 @@
1
1
  'use client';
2
2
  import { useEffect } from "react";
3
- import { isDarkCookieKey } from "../../config";
4
- import getCookie from "../functions/get_cookie";
3
+ import { isDarkCookieKey } from "../../config/index.js";
4
+ import getCookie from "../functions/get_cookie.js";
5
5
  export default function ClientHelperScript() {
6
6
  useEffect(() => {
7
7
  const isDark = getCookie(isDarkCookieKey);
@@ -1,8 +1,8 @@
1
- import type { TranslationObject } from "../../types/types";
2
- import type { SerializedAuthUser } from "../../firebase_auth/types";
3
- import type { CookieConsentAnalyticsConfig, AutoAnalyticsEventsConfig } from "../../types/types";
4
- import type { CookieConsentDialogProps } from "../../cookie_consent/client/components/cookie_consent_dialog";
5
- import type { PrivacyPolicyUpdateDialogProps } from "../../cookie_consent/client/components/privacy_policy_update_dialog";
1
+ import type { TranslationObject } from "../../types/types.js";
2
+ import type { SerializedAuthUser } from "../../firebase_auth/types.js";
3
+ import type { CookieConsentAnalyticsConfig, AutoAnalyticsEventsConfig } from "../../types/types.js";
4
+ import type { CookieConsentDialogProps } from "../../cookie_consent/client/components/cookie_consent_dialog.js";
5
+ import type { PrivacyPolicyUpdateDialogProps } from "../../cookie_consent/client/components/privacy_policy_update_dialog.js";
6
6
  interface LocaleContextType {
7
7
  language: string;
8
8
  messages: TranslationObject;
@@ -12,24 +12,12 @@ export default function LocationzationClientProvider({ language, messages, initi
12
12
  language: string;
13
13
  messages: TranslationObject;
14
14
  initialAuthUser?: SerializedAuthUser | null;
15
- /** Set when `firebaseAuth.autoWireClientProvider` is `false` — skips wrapping `children` in the client `AuthUserProvider` entirely. */
16
15
  skipAuthProvider?: boolean;
17
- /** Resolved server-side from `cookieConsent.analytics`/`getAnalytics` when `autoWireAnalytics` isn't `false`. */
18
16
  analyticsConfig?: CookieConsentAnalyticsConfig;
19
- /** From `cookieConsent.autoAnalyticsEvents` — forwarded as-is to the auto-wired `AutoAnalyticsEvents`. */
20
17
  autoAnalyticsEventsConfig?: AutoAnalyticsEventsConfig;
21
- /**
22
- * Resolved server-side from `cookieConsent.getCountryCode`/`gdprCountries`.
23
- * `false` means the visitor's country doesn't require the consent
24
- * banner — `CookieConsentProvider` seeds consent as implicitly granted
25
- * for a first-time visitor instead of `null`.
26
- */
27
18
  requiresConsent?: boolean;
28
- /** From `cookieConsent.autoWireDialogs` — renders `CookieConsentDialog`/`PrivacyPolicyUpdateDialog` automatically when `true` (default). */
29
19
  autoWireDialogs?: boolean;
30
- /** From `cookieConsent.dialogProps` — forwarded as-is to the auto-wired `CookieConsentDialog`. */
31
20
  dialogProps?: CookieConsentDialogProps;
32
- /** From `cookieConsent.updateDialogProps` — forwarded as-is to the auto-wired `PrivacyPolicyUpdateDialog`. */
33
21
  updateDialogProps?: PrivacyPolicyUpdateDialogProps;
34
22
  children: React.ReactNode;
35
23
  }): Component;
@@ -1,36 +1,24 @@
1
1
  "use client";
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
- import { setLocaleCache, setMessageForLocaleCache } from "../../general/cache_variables";
3
+ import { setLocaleCache, setMessageForLocaleCache } from "../../general/cache_variables.js";
4
4
  import { createContext, useMemo } from "react";
5
5
  import dynamic from "next/dynamic";
6
6
  import config from "@intl-config";
7
- import installConsoleErrorOverride from "../../error_handling/install_console_error_override";
8
- import installGlobalErrorOverride from "../../error_handling/install_global_error_override";
7
+ import installConsoleErrorOverride from "../../error_handling/install_console_error_override.js";
8
+ import installGlobalErrorOverride from "../../error_handling/install_global_error_override.js";
9
9
  export const LocaleContext = createContext(undefined);
10
- // Hoisted to module scope — calling `dynamic()` inside the component body
11
- // creates a brand-new component identity every render, forcing React to
12
- // unmount/remount `AuthUserProvider` on every render instead of reusing the
13
- // existing instance. That remount re-subscribes `onIdTokenChanged`, which
14
- // Firebase immediately replays with the current user, triggering a state
15
- // update (and a `getIdToken(true)` refresh) that causes another render —
16
- // an infinite loop of session-cookie writes, one per render.
17
- const AuthUserProvider = dynamic(() => import("../../firebase_auth/client/auth_user_provider"));
18
- const AutoFirebasePerformanceEvents = dynamic(() => import("../../firebase_auth/client/components/auto_firebase_performance_events"));
19
- const CookieConsentProvider = dynamic(() => import("../../cookie_consent/client/cookie_consent_provider"));
20
- const CookieConsentAnalytics = dynamic(() => import("../../cookie_consent/client/components/cookie_consent_analytics"));
21
- const AutoAnalyticsEvents = dynamic(() => import("../../cookie_consent/client/components/auto_analytics_events"));
22
- const CookieConsentDialog = dynamic(() => import("../../cookie_consent/client/components/cookie_consent_dialog"));
23
- const PrivacyPolicyUpdateDialog = dynamic(() => import("../../cookie_consent/client/components/privacy_policy_update_dialog"));
10
+ const AuthUserProvider = dynamic(() => import("../../firebase_auth/client/auth_user_provider.js"));
11
+ const AutoFirebasePerformanceEvents = dynamic(() => import("../../firebase_auth/client/components/auto_firebase_performance_events.js"));
12
+ const CookieConsentProvider = dynamic(() => import("../../cookie_consent/client/cookie_consent_provider.js"));
13
+ const CookieConsentAnalytics = dynamic(() => import("../../cookie_consent/client/components/cookie_consent_analytics.js"));
14
+ const AutoAnalyticsEvents = dynamic(() => import("../../cookie_consent/client/components/auto_analytics_events.js"));
15
+ const CookieConsentDialog = dynamic(() => import("../../cookie_consent/client/components/cookie_consent_dialog.js"));
16
+ const PrivacyPolicyUpdateDialog = dynamic(() => import("../../cookie_consent/client/components/privacy_policy_update_dialog.js"));
24
17
  export default function LocationzationClientProvider({ language, messages, initialAuthUser = null, skipAuthProvider = false, analyticsConfig, autoAnalyticsEventsConfig, requiresConsent = true, autoWireDialogs = true, dialogProps, updateDialogProps, children }) {
25
18
  setLocaleCache(language);
26
19
  setMessageForLocaleCache(language, messages);
27
20
  installConsoleErrorOverride(config, true);
28
21
  installGlobalErrorOverride(config);
29
- // `LocaleContext.Provider` stays the outermost element here — the
30
- // client `AuthUserProvider` (and its descendants calling
31
- // usePathname()/useLocale()) must render as a CHILD of it, not a
32
- // sibling wrapping it, or those hooks would throw for running outside
33
- // the provider.
34
22
  let providedChildren = children;
35
23
  if (config.firebaseAuth && !skipAuthProvider) {
36
24
  providedChildren = _jsxs(AuthUserProvider, { initialUser: initialAuthUser, children: [children, config.firebaseAuth.performance !== false && _jsx(AutoFirebasePerformanceEvents, {})] });
@@ -1,7 +1,7 @@
1
- import type { TranslationObject } from "../../types/types";
2
- import type { CookieConsentAnalyticsConfig, AutoAnalyticsEventsConfig } from "../../types/types";
3
- import type { CookieConsentDialogProps } from "../../cookie_consent/client/components/cookie_consent_dialog";
4
- import type { PrivacyPolicyUpdateDialogProps } from "../../cookie_consent/client/components/privacy_policy_update_dialog";
1
+ import type { TranslationObject } from "../../types/types.js";
2
+ import type { CookieConsentAnalyticsConfig, AutoAnalyticsEventsConfig } from "../../types/types.js";
3
+ import type { CookieConsentDialogProps } from "../../cookie_consent/client/components/cookie_consent_dialog.js";
4
+ import type { PrivacyPolicyUpdateDialogProps } from "../../cookie_consent/client/components/privacy_policy_update_dialog.js";
5
5
  interface LocaleContextType {
6
6
  language: string;
7
7
  messages: TranslationObject;
@@ -10,22 +10,11 @@ export declare const LocaleContext: import("react").Context<LocaleContextType |
10
10
  export default function LocationzationClientProvider({ language, messages, analyticsConfig, autoAnalyticsEventsConfig, requiresConsent, autoWireDialogs, dialogProps, updateDialogProps, children }: {
11
11
  language: string;
12
12
  messages: TranslationObject;
13
- /** Resolved server-side from `cookieConsent.analytics`/`getAnalytics` when `autoWireAnalytics` isn't `false`. */
14
13
  analyticsConfig?: CookieConsentAnalyticsConfig;
15
- /** From `cookieConsent.autoAnalyticsEvents` — forwarded as-is to the auto-wired `AutoAnalyticsEvents`. */
16
14
  autoAnalyticsEventsConfig?: AutoAnalyticsEventsConfig;
17
- /**
18
- * Resolved server-side from `cookieConsent.getCountryCode`/`gdprCountries`.
19
- * `false` means the visitor's country doesn't require the consent
20
- * banner — `CookieConsentProvider` seeds consent as implicitly granted
21
- * for a first-time visitor instead of `null`.
22
- */
23
15
  requiresConsent?: boolean;
24
- /** From `cookieConsent.autoWireDialogs` — renders `CookieConsentDialog`/`PrivacyPolicyUpdateDialog` automatically when `true` (default). */
25
16
  autoWireDialogs?: boolean;
26
- /** From `cookieConsent.dialogProps` — forwarded as-is to the auto-wired `CookieConsentDialog`. */
27
17
  dialogProps?: CookieConsentDialogProps;
28
- /** From `cookieConsent.updateDialogProps` — forwarded as-is to the auto-wired `PrivacyPolicyUpdateDialog`. */
29
18
  updateDialogProps?: PrivacyPolicyUpdateDialogProps;
30
19
  children: React.ReactNode;
31
20
  }): Component;
@@ -1,25 +1,17 @@
1
1
  "use client";
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
- import { setLocaleCache, setMessageForLocaleCache } from "../../general/cache_variables";
3
+ import { setLocaleCache, setMessageForLocaleCache } from "../../general/cache_variables.js";
4
4
  import { createContext, useMemo } from "react";
5
5
  import dynamic from "next/dynamic";
6
6
  import config from "@intl-config";
7
- import installConsoleErrorOverride from "../../error_handling/install_console_error_override";
8
- import installGlobalErrorOverride from "../../error_handling/install_global_error_override";
7
+ import installConsoleErrorOverride from "../../error_handling/install_console_error_override.js";
8
+ import installGlobalErrorOverride from "../../error_handling/install_global_error_override.js";
9
9
  export const LocaleContext = createContext(undefined);
10
- // `output: 'export'`-safe: unlike `client_provider.tsx`, this file has no
11
- // import anywhere in it pointing at `firebase_auth/client/auth_user_provider`
12
- // (which itself pulls in the "use server" `clear_session_action`). Next's
13
- // server-actions build step registers a "use server" file the moment any
14
- // `import()` in the compiled module graph points to it, so removing the
15
- // import entirely — not just skipping its use at runtime — is what keeps
16
- // `output: 'export'` builds from failing. See `server_provider_static.tsx`
17
- // for the full explanation.
18
- const CookieConsentProvider = dynamic(() => import("../../cookie_consent/client/cookie_consent_provider"));
19
- const CookieConsentAnalytics = dynamic(() => import("../../cookie_consent/client/components/cookie_consent_analytics"));
20
- const AutoAnalyticsEvents = dynamic(() => import("../../cookie_consent/client/components/auto_analytics_events"));
21
- const CookieConsentDialog = dynamic(() => import("../../cookie_consent/client/components/cookie_consent_dialog"));
22
- const PrivacyPolicyUpdateDialog = dynamic(() => import("../../cookie_consent/client/components/privacy_policy_update_dialog"));
10
+ const CookieConsentProvider = dynamic(() => import("../../cookie_consent/client/cookie_consent_provider.js"));
11
+ const CookieConsentAnalytics = dynamic(() => import("../../cookie_consent/client/components/cookie_consent_analytics.js"));
12
+ const AutoAnalyticsEvents = dynamic(() => import("../../cookie_consent/client/components/auto_analytics_events.js"));
13
+ const CookieConsentDialog = dynamic(() => import("../../cookie_consent/client/components/cookie_consent_dialog.js"));
14
+ const PrivacyPolicyUpdateDialog = dynamic(() => import("../../cookie_consent/client/components/privacy_policy_update_dialog.js"));
23
15
  export default function LocationzationClientProvider({ language, messages, analyticsConfig, autoAnalyticsEventsConfig, requiresConsent = true, autoWireDialogs = true, dialogProps, updateDialogProps, children }) {
24
16
  setLocaleCache(language);
25
17
  setMessageForLocaleCache(language, messages);
@@ -4,27 +4,5 @@ type NextLinkProps = Omit<ComponentProps<'a'>, keyof LinkProps> & Omit<LinkProps
4
4
  export type LocaleLinkProps = NextLinkProps & {
5
5
  locale: string;
6
6
  };
7
- /**
8
- * Client-only link component for linking to a SPECIFIC locale — e.g. a
9
- * language switcher. Import from `cloudflare-next-intl/LocaleLink`.
10
- *
11
- * For normal in-app navigation that should stay on the current locale, use
12
- * the server-side `Link` (`cloudflare-next-intl/Link`) instead — it infers
13
- * the locale automatically and doesn't require `"use client"`.
14
- *
15
- * Renders inside a `Suspense` boundary; falls back to a disabled `<a>`
16
- * (`pointer-events-none`) while resolving.
17
- *
18
- * @param locale Required. The locale to link to (e.g. `"de"`), prepended to
19
- * `href` regardless of the current locale.
20
- *
21
- * @example
22
- * ```tsx
23
- * "use client";
24
- * import LocaleLink from "cloudflare-next-intl/LocaleLink";
25
- *
26
- * <LocaleLink href="/about" locale="de">Über uns</LocaleLink> // -> "/de/about"
27
- * ```
28
- */
29
7
  declare const LocaleLink: import("react").ForwardRefExoticComponent<Omit<LocaleLinkProps, "ref"> & import("react").RefAttributes<HTMLAnchorElement>>;
30
8
  export default LocaleLink;