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.
- package/config.d.ts +2 -1
- package/dist/cjs/development/plugin.cjs +167 -0
- package/dist/{development → esm/development}/config.js +1 -5
- package/dist/esm/development/index.react-client.js +3 -0
- package/dist/esm/development/index.react-server.js +8 -0
- package/dist/{development → esm/development}/middleware/getAlternateLinksHeaderValue.js +18 -25
- package/dist/esm/development/middleware/middleware.js +155 -0
- package/dist/{development → esm/development}/middleware/resolveLocale.js +13 -25
- package/dist/esm/development/middleware/syncCookie.js +20 -0
- package/dist/{development → esm/development}/middleware/utils.js +24 -54
- package/dist/esm/development/middleware.js +1 -0
- package/dist/{development → esm/development}/navigation/react-client/createNavigation.js +22 -29
- package/dist/esm/development/navigation/react-client/useBasePathname.js +27 -0
- package/dist/esm/development/navigation/react-server/createNavigation.js +22 -0
- package/dist/esm/development/navigation/react-server/getServerLocale.js +12 -0
- package/dist/{development → esm/development}/navigation/shared/BaseLink.js +31 -36
- package/dist/{development → esm/development}/navigation/shared/createSharedNavigationFns.js +39 -50
- package/dist/{development → esm/development}/navigation/shared/syncLocaleCookie.js +5 -9
- package/dist/{development → esm/development}/navigation/shared/utils.js +21 -35
- package/dist/esm/development/navigation.react-client.js +1 -0
- package/dist/esm/development/navigation.react-server.js +1 -0
- package/dist/esm/development/plugin/createMessagesDeclaration.js +61 -0
- package/dist/esm/development/plugin/createNextIntlPlugin.js +23 -0
- package/dist/esm/development/plugin/getNextConfig.js +82 -0
- package/dist/esm/development/plugin/utils.js +11 -0
- package/dist/esm/development/plugin.js +1 -0
- package/dist/esm/development/react-client/index.js +35 -0
- package/dist/esm/development/react-server/NextIntlClientProviderServer.js +31 -0
- package/dist/esm/development/react-server/useConfig.js +21 -0
- package/dist/esm/development/react-server/useFormatter.js +9 -0
- package/dist/esm/development/react-server/useLocale.js +8 -0
- package/dist/esm/development/react-server/useMessages.js +9 -0
- package/dist/esm/development/react-server/useNow.js +12 -0
- package/dist/esm/development/react-server/useTimeZone.js +8 -0
- package/dist/esm/development/react-server/useTranslations.js +9 -0
- package/dist/esm/development/routing/config.js +28 -0
- package/dist/esm/development/routing/defineRouting.js +5 -0
- package/dist/esm/development/routing.js +1 -0
- package/dist/{development → esm/development}/server/react-client/index.js +5 -16
- package/dist/{development → esm/development}/server/react-server/RequestLocale.js +10 -14
- package/dist/{development → esm/development}/server/react-server/RequestLocaleCache.js +3 -8
- package/dist/esm/development/server/react-server/createRequestConfig.js +2 -0
- package/dist/esm/development/server/react-server/getConfig.js +53 -0
- package/dist/esm/development/server/react-server/getConfigNow.js +10 -0
- package/dist/esm/development/server/react-server/getDefaultNow.js +9 -0
- package/dist/esm/development/server/react-server/getFormats.js +10 -0
- package/dist/esm/development/server/react-server/getFormatter.js +21 -0
- package/dist/esm/development/server/react-server/getLocale.js +10 -0
- package/dist/esm/development/server/react-server/getMessages.js +19 -0
- package/dist/esm/development/server/react-server/getNow.js +8 -0
- package/dist/{development → esm/development}/server/react-server/getRequestConfig.js +1 -5
- package/dist/esm/development/server/react-server/getServerFormatter.js +21 -0
- package/dist/esm/development/server/react-server/getServerTranslator.js +12 -0
- package/dist/esm/development/server/react-server/getTimeZone.js +13 -0
- package/dist/{development → esm/development}/server/react-server/getTranslations.js +7 -15
- package/dist/esm/development/server.react-client.js +1 -0
- package/dist/esm/development/server.react-server.js +8 -0
- package/dist/esm/development/shared/NextIntlClientProvider.js +18 -0
- package/dist/esm/development/shared/constants.js +4 -0
- package/dist/esm/development/shared/use.js +13 -0
- package/dist/{development → esm/development}/shared/utils.js +6 -50
- package/dist/esm/production/index.react-client.js +1 -0
- package/dist/esm/production/middleware/getAlternateLinksHeaderValue.js +1 -0
- package/dist/esm/production/middleware/middleware.js +1 -0
- package/dist/esm/production/middleware/resolveLocale.js +1 -0
- package/dist/esm/production/middleware/syncCookie.js +1 -0
- package/dist/esm/production/middleware/utils.js +1 -0
- package/dist/esm/production/navigation/react-client/createNavigation.js +1 -0
- package/dist/esm/production/navigation/react-client/useBasePathname.js +1 -0
- package/dist/esm/production/navigation/react-server/createNavigation.js +1 -0
- package/dist/esm/production/navigation/shared/BaseLink.js +2 -0
- package/dist/esm/production/navigation/shared/createSharedNavigationFns.js +1 -0
- package/dist/esm/production/navigation/shared/syncLocaleCookie.js +1 -0
- package/dist/esm/production/navigation/shared/utils.js +1 -0
- package/dist/esm/production/navigation.react-client.js +1 -0
- package/dist/esm/production/navigation.react-server.js +1 -0
- package/dist/esm/production/plugin/createMessagesDeclaration.js +1 -0
- package/dist/esm/production/plugin/createNextIntlPlugin.js +1 -0
- package/dist/esm/production/plugin/getNextConfig.js +1 -0
- package/dist/esm/production/plugin/utils.js +1 -0
- package/dist/esm/production/plugin.js +1 -0
- package/dist/esm/production/react-client/index.js +1 -0
- package/dist/esm/production/react-server/NextIntlClientProviderServer.js +1 -0
- package/dist/esm/production/react-server/useConfig.js +1 -0
- package/dist/esm/production/react-server/useFormatter.js +1 -0
- package/dist/esm/production/react-server/useLocale.js +1 -0
- package/dist/esm/production/react-server/useMessages.js +1 -0
- package/dist/esm/production/react-server/useNow.js +1 -0
- package/dist/esm/production/react-server/useTimeZone.js +1 -0
- package/dist/esm/production/react-server/useTranslations.js +1 -0
- package/dist/esm/production/routing/config.js +1 -0
- package/dist/esm/production/server/react-client/index.js +1 -0
- package/dist/esm/production/server/react-server/RequestLocale.js +1 -0
- package/dist/esm/production/server/react-server/getConfig.js +1 -0
- package/dist/esm/production/server/react-server/getConfigNow.js +1 -0
- package/dist/esm/production/server/react-server/getDefaultNow.js +1 -0
- package/dist/esm/production/server/react-server/getFormats.js +1 -0
- package/dist/esm/production/server/react-server/getFormatter.js +1 -0
- package/dist/esm/production/server/react-server/getLocale.js +1 -0
- package/dist/esm/production/server/react-server/getMessages.js +1 -0
- package/dist/esm/production/server/react-server/getNow.js +1 -0
- package/dist/esm/production/server/react-server/getServerFormatter.js +1 -0
- package/dist/esm/{server → production/server}/react-server/getTimeZone.js +1 -1
- package/dist/esm/production/server/react-server/getTranslations.js +1 -0
- package/dist/esm/production/server.react-client.js +1 -0
- package/dist/esm/production/server.react-server.js +1 -0
- package/dist/esm/production/shared/NextIntlClientProvider.js +2 -0
- package/dist/esm/production/shared/constants.js +1 -0
- package/dist/esm/production/shared/use.js +1 -0
- package/dist/esm/production/shared/utils.js +1 -0
- package/dist/types/{src/index.react-client.d.ts → index.react-client.d.ts} +1 -1
- package/dist/types/index.react-server.d.ts +1 -0
- package/dist/types/{src/middleware → middleware}/getAlternateLinksHeaderValue.d.ts +3 -3
- package/dist/types/{src/middleware → middleware}/index.d.ts +1 -1
- package/dist/types/middleware/middleware.d.ts +4 -0
- package/dist/types/{src/middleware → middleware}/resolveLocale.d.ts +5 -4
- package/dist/types/middleware/syncCookie.d.ts +7 -0
- package/dist/types/{src/middleware → middleware}/utils.d.ts +4 -3
- package/dist/types/middleware.d.ts +1 -0
- package/dist/types/{src/navigation → navigation}/react-client/createNavigation.d.ts +58 -57
- package/dist/types/navigation/react-client/index.d.ts +2 -0
- package/dist/types/{src/navigation → navigation}/react-client/useBasePathname.d.ts +1 -1
- package/dist/types/{src/navigation → navigation}/react-server/createNavigation.d.ts +30 -30
- package/dist/types/navigation/react-server/index.d.ts +2 -0
- package/dist/types/navigation/shared/BaseLink.d.ts +19 -0
- package/dist/types/navigation/shared/createSharedNavigationFns.d.ts +386 -0
- package/dist/types/{src/navigation → navigation}/shared/syncLocaleCookie.d.ts +3 -2
- package/dist/types/{src/navigation → navigation}/shared/utils.d.ts +5 -4
- package/dist/types/navigation.react-client.d.ts +1 -0
- package/dist/types/navigation.react-server.d.ts +1 -0
- package/dist/types/plugin/createMessagesDeclaration.d.ts +1 -0
- package/dist/types/plugin/createNextIntlPlugin.d.ts +3 -0
- package/dist/types/plugin/getNextConfig.d.ts +3 -0
- package/dist/types/plugin/index.d.ts +1 -0
- package/dist/types/plugin/types.d.ts +6 -0
- package/dist/types/plugin/utils.d.ts +2 -0
- package/dist/types/plugin.d.ts +1 -0
- package/dist/types/{src/react-client → react-client}/index.d.ts +1 -2
- package/dist/types/react-server/NextIntlClientProviderServer.d.ts +5 -0
- package/dist/types/react-server/index.d.ts +15 -0
- package/dist/types/{src/react-server → react-server}/testUtils.d.ts +1 -1
- package/dist/types/{src/react-server → react-server}/useConfig.d.ts +1 -1
- package/dist/types/react-server/useFormatter.d.ts +2 -0
- package/dist/types/react-server/useLocale.d.ts +2 -0
- package/dist/types/react-server/useMessages.d.ts +2 -0
- package/dist/types/react-server/useNow.d.ts +2 -0
- package/dist/types/react-server/useTimeZone.d.ts +2 -0
- package/dist/types/{src/routing → routing}/config.d.ts +2 -4
- package/dist/types/{src/routing → routing}/defineRouting.d.ts +2 -2
- package/dist/types/routing/index.d.ts +3 -0
- package/dist/types/routing.d.ts +1 -0
- package/dist/types/{src/server → server}/react-client/index.d.ts +1 -2
- package/dist/types/server/react-server/RequestLocaleCache.d.ts +3 -0
- package/dist/types/{src/server → server}/react-server/createRequestConfig.d.ts +1 -1
- package/dist/types/{src/server → server}/react-server/getConfig.d.ts +2 -3
- package/dist/types/server/react-server/getConfigNow.d.ts +4 -0
- package/dist/types/server/react-server/getDefaultNow.d.ts +3 -0
- package/dist/types/server/react-server/getFormats.d.ts +3 -0
- package/dist/types/{src/server → server}/react-server/getFormatter.d.ts +2 -2
- package/dist/types/server/react-server/getLocale.d.ts +4 -0
- package/dist/types/server/react-server/getMessages.d.ts +6 -0
- package/dist/types/server/react-server/getNow.d.ts +4 -0
- package/dist/types/{src/server → server}/react-server/getRequestConfig.d.ts +2 -19
- package/dist/types/server/react-server/getServerFormatter.d.ts +10 -0
- package/dist/types/server/react-server/getServerTranslator.d.ts +4 -0
- package/dist/types/server/react-server/getTimeZone.d.ts +4 -0
- package/dist/types/server/react-server/getTranslations.d.ts +8 -0
- package/dist/types/server/react-server/index.d.ts +11 -0
- package/dist/types/server.react-client.d.ts +1 -0
- package/dist/types/server.react-server.d.ts +1 -0
- package/dist/types/{src/shared → shared}/NextIntlClientProvider.d.ts +5 -4
- package/dist/types/shared/constants.d.ts +1 -0
- package/dist/types/shared/use.d.ts +3 -0
- package/dist/types/{src/shared → shared}/utils.d.ts +3 -9
- package/middleware.d.ts +2 -1
- package/navigation.d.ts +2 -1
- package/package.json +57 -26
- package/plugin.d.cts +3 -0
- package/plugin.d.ts +3 -7
- package/routing.d.ts +2 -1
- package/server.d.ts +2 -1
- package/dist/config.js +0 -7
- package/dist/development/_virtual/_rollupPluginBabelHelpers.js +0 -15
- package/dist/development/index.react-client.js +0 -21
- package/dist/development/index.react-server.js +0 -28
- package/dist/development/middleware/middleware.js +0 -169
- package/dist/development/middleware/syncCookie.js +0 -20
- package/dist/development/middleware.js +0 -9
- package/dist/development/navigation/react-client/ClientLink.js +0 -55
- package/dist/development/navigation/react-client/createLocalizedPathnamesNavigation.js +0 -156
- package/dist/development/navigation/react-client/createSharedPathnamesNavigation.js +0 -67
- package/dist/development/navigation/react-client/redirects.js +0 -32
- package/dist/development/navigation/react-client/useBasePathname.js +0 -31
- package/dist/development/navigation/react-client/useBaseRouter.js +0 -72
- package/dist/development/navigation/react-server/ServerLink.js +0 -32
- package/dist/development/navigation/react-server/createLocalizedPathnamesNavigation.js +0 -95
- package/dist/development/navigation/react-server/createNavigation.js +0 -30
- package/dist/development/navigation/react-server/createSharedPathnamesNavigation.js +0 -56
- package/dist/development/navigation/react-server/getServerLocale.js +0 -16
- package/dist/development/navigation/react-server/redirects.js +0 -24
- package/dist/development/navigation/shared/LegacyBaseLink.js +0 -57
- package/dist/development/navigation/shared/redirects.js +0 -25
- package/dist/development/navigation.react-client.js +0 -13
- package/dist/development/navigation.react-server.js +0 -13
- package/dist/development/plugin.js +0 -101
- package/dist/development/react-client/index.js +0 -38
- package/dist/development/react-client/useLocale.js +0 -28
- package/dist/development/react-server/NextIntlClientProviderServer.js +0 -33
- package/dist/development/react-server/getTranslator.js +0 -16
- package/dist/development/react-server/useConfig.js +0 -25
- package/dist/development/react-server/useFormatter.js +0 -18
- package/dist/development/react-server/useLocale.js +0 -15
- package/dist/development/react-server/useMessages.js +0 -16
- package/dist/development/react-server/useNow.js +0 -19
- package/dist/development/react-server/useTimeZone.js +0 -15
- package/dist/development/react-server/useTranslations.js +0 -17
- package/dist/development/routing/config.js +0 -35
- package/dist/development/routing/defineRouting.js +0 -9
- package/dist/development/routing.js +0 -9
- package/dist/development/server/react-server/RequestLocaleLegacy.js +0 -43
- package/dist/development/server/react-server/createRequestConfig.js +0 -16
- package/dist/development/server/react-server/getConfig.js +0 -73
- package/dist/development/server/react-server/getFormatter.js +0 -25
- package/dist/development/server/react-server/getLocale.js +0 -14
- package/dist/development/server/react-server/getMessages.js +0 -24
- package/dist/development/server/react-server/getNow.js +0 -17
- package/dist/development/server/react-server/getTimeZone.js +0 -17
- package/dist/development/server.react-client.js +0 -17
- package/dist/development/server.react-server.js +0 -24
- package/dist/development/shared/NextIntlClientProvider.js +0 -30
- package/dist/development/shared/constants.js +0 -12
- package/dist/esm/_virtual/_rollupPluginBabelHelpers.js +0 -1
- package/dist/esm/index.react-client.js +0 -1
- package/dist/esm/middleware/getAlternateLinksHeaderValue.js +0 -1
- package/dist/esm/middleware/middleware.js +0 -1
- package/dist/esm/middleware/resolveLocale.js +0 -1
- package/dist/esm/middleware/syncCookie.js +0 -1
- package/dist/esm/middleware/utils.js +0 -1
- package/dist/esm/navigation/react-client/ClientLink.js +0 -1
- package/dist/esm/navigation/react-client/createLocalizedPathnamesNavigation.js +0 -1
- package/dist/esm/navigation/react-client/createNavigation.js +0 -1
- package/dist/esm/navigation/react-client/createSharedPathnamesNavigation.js +0 -1
- package/dist/esm/navigation/react-client/redirects.js +0 -1
- package/dist/esm/navigation/react-client/useBasePathname.js +0 -1
- package/dist/esm/navigation/react-client/useBaseRouter.js +0 -1
- package/dist/esm/navigation/react-server/ServerLink.js +0 -1
- package/dist/esm/navigation/react-server/createLocalizedPathnamesNavigation.js +0 -1
- package/dist/esm/navigation/react-server/createNavigation.js +0 -1
- package/dist/esm/navigation/react-server/createSharedPathnamesNavigation.js +0 -1
- package/dist/esm/navigation/react-server/redirects.js +0 -1
- package/dist/esm/navigation/shared/BaseLink.js +0 -2
- package/dist/esm/navigation/shared/LegacyBaseLink.js +0 -2
- package/dist/esm/navigation/shared/createSharedNavigationFns.js +0 -1
- package/dist/esm/navigation/shared/redirects.js +0 -1
- package/dist/esm/navigation/shared/syncLocaleCookie.js +0 -1
- package/dist/esm/navigation/shared/utils.js +0 -1
- package/dist/esm/navigation.react-client.js +0 -1
- package/dist/esm/navigation.react-server.js +0 -1
- package/dist/esm/plugin.js +0 -1
- package/dist/esm/react-client/index.js +0 -1
- package/dist/esm/react-client/useLocale.js +0 -1
- package/dist/esm/react-server/NextIntlClientProviderServer.js +0 -1
- package/dist/esm/react-server/useConfig.js +0 -1
- package/dist/esm/react-server/useFormatter.js +0 -1
- package/dist/esm/react-server/useLocale.js +0 -1
- package/dist/esm/react-server/useMessages.js +0 -1
- package/dist/esm/react-server/useNow.js +0 -1
- package/dist/esm/react-server/useTimeZone.js +0 -1
- package/dist/esm/react-server/useTranslations.js +0 -1
- package/dist/esm/routing/config.js +0 -1
- package/dist/esm/server/react-client/index.js +0 -1
- package/dist/esm/server/react-server/RequestLocale.js +0 -1
- package/dist/esm/server/react-server/RequestLocaleLegacy.js +0 -1
- package/dist/esm/server/react-server/getConfig.js +0 -1
- package/dist/esm/server/react-server/getFormatter.js +0 -1
- package/dist/esm/server/react-server/getLocale.js +0 -1
- package/dist/esm/server/react-server/getMessages.js +0 -1
- package/dist/esm/server/react-server/getNow.js +0 -1
- package/dist/esm/server/react-server/getTranslations.js +0 -1
- package/dist/esm/server.react-client.js +0 -1
- package/dist/esm/server.react-server.js +0 -1
- package/dist/esm/shared/NextIntlClientProvider.js +0 -2
- package/dist/esm/shared/constants.js +0 -1
- package/dist/esm/shared/utils.js +0 -1
- package/dist/index.react-client.js +0 -7
- package/dist/index.react-server.js +0 -7
- package/dist/middleware.js +0 -7
- package/dist/navigation.react-client.js +0 -7
- package/dist/navigation.react-server.js +0 -7
- package/dist/plugin.js +0 -7
- package/dist/production/_virtual/_rollupPluginBabelHelpers.js +0 -1
- package/dist/production/config.js +0 -1
- package/dist/production/index.react-client.js +0 -1
- package/dist/production/index.react-server.js +0 -1
- package/dist/production/middleware/getAlternateLinksHeaderValue.js +0 -1
- package/dist/production/middleware/middleware.js +0 -1
- package/dist/production/middleware/resolveLocale.js +0 -1
- package/dist/production/middleware/syncCookie.js +0 -1
- package/dist/production/middleware/utils.js +0 -1
- package/dist/production/middleware.js +0 -1
- package/dist/production/navigation/react-client/ClientLink.js +0 -1
- package/dist/production/navigation/react-client/createLocalizedPathnamesNavigation.js +0 -1
- package/dist/production/navigation/react-client/createNavigation.js +0 -1
- package/dist/production/navigation/react-client/createSharedPathnamesNavigation.js +0 -1
- package/dist/production/navigation/react-client/redirects.js +0 -1
- package/dist/production/navigation/react-client/useBasePathname.js +0 -1
- package/dist/production/navigation/react-client/useBaseRouter.js +0 -1
- package/dist/production/navigation/react-server/ServerLink.js +0 -1
- package/dist/production/navigation/react-server/createLocalizedPathnamesNavigation.js +0 -1
- package/dist/production/navigation/react-server/createNavigation.js +0 -1
- package/dist/production/navigation/react-server/createSharedPathnamesNavigation.js +0 -1
- package/dist/production/navigation/react-server/getServerLocale.js +0 -1
- package/dist/production/navigation/react-server/redirects.js +0 -1
- package/dist/production/navigation/shared/BaseLink.js +0 -2
- package/dist/production/navigation/shared/LegacyBaseLink.js +0 -2
- package/dist/production/navigation/shared/createSharedNavigationFns.js +0 -1
- package/dist/production/navigation/shared/redirects.js +0 -1
- package/dist/production/navigation/shared/syncLocaleCookie.js +0 -1
- package/dist/production/navigation/shared/utils.js +0 -1
- package/dist/production/navigation.react-client.js +0 -1
- package/dist/production/navigation.react-server.js +0 -1
- package/dist/production/plugin.js +0 -1
- package/dist/production/react-client/index.js +0 -1
- package/dist/production/react-client/useLocale.js +0 -1
- package/dist/production/react-server/NextIntlClientProviderServer.js +0 -1
- package/dist/production/react-server/getTranslator.js +0 -1
- package/dist/production/react-server/useConfig.js +0 -1
- package/dist/production/react-server/useFormatter.js +0 -1
- package/dist/production/react-server/useLocale.js +0 -1
- package/dist/production/react-server/useMessages.js +0 -1
- package/dist/production/react-server/useNow.js +0 -1
- package/dist/production/react-server/useTimeZone.js +0 -1
- package/dist/production/react-server/useTranslations.js +0 -1
- package/dist/production/routing/config.js +0 -1
- package/dist/production/routing/defineRouting.js +0 -1
- package/dist/production/routing.js +0 -1
- package/dist/production/server/react-client/index.js +0 -1
- package/dist/production/server/react-server/RequestLocale.js +0 -1
- package/dist/production/server/react-server/RequestLocaleCache.js +0 -1
- package/dist/production/server/react-server/RequestLocaleLegacy.js +0 -1
- package/dist/production/server/react-server/createRequestConfig.js +0 -1
- package/dist/production/server/react-server/getConfig.js +0 -1
- package/dist/production/server/react-server/getFormatter.js +0 -1
- package/dist/production/server/react-server/getLocale.js +0 -1
- package/dist/production/server/react-server/getMessages.js +0 -1
- package/dist/production/server/react-server/getNow.js +0 -1
- package/dist/production/server/react-server/getRequestConfig.js +0 -1
- package/dist/production/server/react-server/getTimeZone.js +0 -1
- package/dist/production/server/react-server/getTranslations.js +0 -1
- package/dist/production/server.react-client.js +0 -1
- package/dist/production/server.react-server.js +0 -1
- package/dist/production/shared/NextIntlClientProvider.js +0 -2
- package/dist/production/shared/constants.js +0 -1
- package/dist/production/shared/utils.js +0 -1
- package/dist/routing.js +0 -7
- package/dist/server.react-client.js +0 -7
- package/dist/server.react-server.js +0 -7
- package/dist/types/__mocks__/react.d.ts +0 -9
- package/dist/types/src/index.react-server.d.ts +0 -1
- package/dist/types/src/middleware/getAlternateLinksHeaderValue.test.d.ts +0 -1
- package/dist/types/src/middleware/middleware.d.ts +0 -13
- package/dist/types/src/middleware/middleware.test.d.ts +0 -1
- package/dist/types/src/middleware/resolveLocale.test.d.ts +0 -1
- package/dist/types/src/middleware/syncCookie.d.ts +0 -3
- package/dist/types/src/middleware/utils.test.d.ts +0 -1
- package/dist/types/src/middleware.d.ts +0 -1
- package/dist/types/src/navigation/createLocalizedPathnamesNavigation.test.d.ts +0 -1
- package/dist/types/src/navigation/createNavigation.test.d.ts +0 -1
- package/dist/types/src/navigation/createSharedPathnamesNavigation.test.d.ts +0 -1
- package/dist/types/src/navigation/react-client/ClientLink.d.ts +0 -31
- package/dist/types/src/navigation/react-client/ClientLink.test.d.ts +0 -1
- package/dist/types/src/navigation/react-client/createLocalizedPathnamesNavigation.d.ts +0 -91
- package/dist/types/src/navigation/react-client/createLocalizedPathnamesNavigation.test.d.ts +0 -1
- package/dist/types/src/navigation/react-client/createNavigation.test.d.ts +0 -1
- package/dist/types/src/navigation/react-client/createSharedPathnamesNavigation.d.ts +0 -66
- package/dist/types/src/navigation/react-client/createSharedPathnamesNavigation.test.d.ts +0 -1
- package/dist/types/src/navigation/react-client/index.d.ts +0 -7
- package/dist/types/src/navigation/react-client/redirects.d.ts +0 -10
- package/dist/types/src/navigation/react-client/useBasePathname.test.d.ts +0 -1
- package/dist/types/src/navigation/react-client/useBaseRouter.d.ts +0 -33
- package/dist/types/src/navigation/react-client/useBaseRouter.test.d.ts +0 -1
- package/dist/types/src/navigation/react-server/ServerLink.d.ts +0 -9
- package/dist/types/src/navigation/react-server/createLocalizedPathnamesNavigation.d.ts +0 -70
- package/dist/types/src/navigation/react-server/createNavigation.test.d.ts +0 -1
- package/dist/types/src/navigation/react-server/createSharedPathnamesNavigation.d.ts +0 -11
- package/dist/types/src/navigation/react-server/index.d.ts +0 -4
- package/dist/types/src/navigation/react-server/redirects.d.ts +0 -10
- package/dist/types/src/navigation/shared/BaseLink.d.ts +0 -17
- package/dist/types/src/navigation/shared/LegacyBaseLink.d.ts +0 -12
- package/dist/types/src/navigation/shared/createSharedNavigationFns.d.ts +0 -386
- package/dist/types/src/navigation/shared/redirects.d.ts +0 -11
- package/dist/types/src/navigation/shared/redirects.test.d.ts +0 -1
- package/dist/types/src/navigation/shared/utils.test.d.ts +0 -1
- package/dist/types/src/navigation.react-client.d.ts +0 -1
- package/dist/types/src/navigation.react-server.d.ts +0 -1
- package/dist/types/src/plugin.d.ts +0 -1
- package/dist/types/src/react-client/useFormatter.test.d.ts +0 -1
- package/dist/types/src/react-client/useLocale.d.ts +0 -1
- package/dist/types/src/react-client/useLocale.test.d.ts +0 -1
- package/dist/types/src/react-client/useNow.test.d.ts +0 -1
- package/dist/types/src/react-client/useTimeZone.test.d.ts +0 -1
- package/dist/types/src/react-client/useTranslations.test.d.ts +0 -1
- package/dist/types/src/react-server/NextIntlClientProviderServer.d.ts +0 -5
- package/dist/types/src/react-server/NextIntlClientProviderServer.test.d.ts +0 -1
- package/dist/types/src/react-server/getTranslator.d.ts +0 -51
- package/dist/types/src/react-server/index.d.ts +0 -15
- package/dist/types/src/react-server/index.test.d.ts +0 -1
- package/dist/types/src/react-server/useFormatter.d.ts +0 -2
- package/dist/types/src/react-server/useLocale.d.ts +0 -2
- package/dist/types/src/react-server/useMessages.d.ts +0 -2
- package/dist/types/src/react-server/useNow.d.ts +0 -2
- package/dist/types/src/react-server/useTimeZone.d.ts +0 -2
- package/dist/types/src/react-server/useTranslations.test.d.ts +0 -1
- package/dist/types/src/routing/defineRouting.test.d.ts +0 -1
- package/dist/types/src/routing/index.d.ts +0 -3
- package/dist/types/src/routing/types.test.d.ts +0 -1
- package/dist/types/src/routing.d.ts +0 -1
- package/dist/types/src/server/react-client/index.test.d.ts +0 -1
- package/dist/types/src/server/react-server/RequestLocaleCache.d.ts +0 -2
- package/dist/types/src/server/react-server/RequestLocaleLegacy.d.ts +0 -1
- package/dist/types/src/server/react-server/getLocale.d.ts +0 -3
- package/dist/types/src/server/react-server/getMessages.d.ts +0 -6
- package/dist/types/src/server/react-server/getNow.d.ts +0 -3
- package/dist/types/src/server/react-server/getTimeZone.d.ts +0 -3
- package/dist/types/src/server/react-server/getTranslations.d.ts +0 -92
- package/dist/types/src/server/react-server/index.d.ts +0 -14
- package/dist/types/src/server/react-server/index.test.d.ts +0 -1
- package/dist/types/src/server.react-client.d.ts +0 -1
- package/dist/types/src/server.react-server.d.ts +0 -1
- package/dist/types/src/shared/NextIntlClientProvider.test.d.ts +0 -1
- package/dist/types/src/shared/constants.d.ts +0 -3
- package/dist/types/src/shared/utils.test.d.ts +0 -1
- package/dist/types/test/setup.d.ts +0 -1
- /package/dist/esm/{config.js → production/config.js} +0 -0
- /package/dist/esm/{index.react-server.js → production/index.react-server.js} +0 -0
- /package/dist/esm/{middleware.js → production/middleware.js} +0 -0
- /package/dist/esm/{navigation → production/navigation}/react-server/getServerLocale.js +0 -0
- /package/dist/esm/{routing → production/routing}/defineRouting.js +0 -0
- /package/dist/esm/{routing.js → production/routing.js} +0 -0
- /package/dist/esm/{server → production/server}/react-server/RequestLocaleCache.js +0 -0
- /package/dist/esm/{server → production/server}/react-server/createRequestConfig.js +0 -0
- /package/dist/esm/{server → production/server}/react-server/getRequestConfig.js +0 -0
- /package/dist/esm/{react-server/getTranslator.js → production/server/react-server/getServerTranslator.js} +0 -0
- /package/dist/types/{src/config.d.ts → config.d.ts} +0 -0
- /package/dist/types/{src/navigation → navigation}/react-server/getServerLocale.d.ts +0 -0
- /package/dist/types/{src/navigation → navigation}/shared/StrictParams.d.ts +0 -0
- /package/dist/types/{src/react-server → react-server}/useTranslations.d.ts +0 -0
- /package/dist/types/{src/routing → routing}/types.d.ts +0 -0
- /package/dist/types/{src/server → server}/react-server/RequestLocale.d.ts +0 -0
- /package/dist/types/{src/shared → shared}/types.d.ts +0 -0
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { cache } from 'react';
|
|
2
|
+
import { _createIntlFormatters, _createCache, initializeConfig } from 'use-intl/core';
|
|
3
|
+
import { getRequestLocale } from './RequestLocale.js';
|
|
4
|
+
import getRuntimeConfig from 'next-intl/config';
|
|
5
|
+
|
|
6
|
+
// This is automatically inherited by `NextIntlClientProvider` if
|
|
7
|
+
// the component is rendered from a Server Component
|
|
8
|
+
function getDefaultTimeZoneImpl() {
|
|
9
|
+
return Intl.DateTimeFormat().resolvedOptions().timeZone;
|
|
10
|
+
}
|
|
11
|
+
const getDefaultTimeZone = cache(getDefaultTimeZoneImpl);
|
|
12
|
+
async function receiveRuntimeConfigImpl(getConfig, localeOverride) {
|
|
13
|
+
if (typeof getConfig !== 'function') {
|
|
14
|
+
throw new Error(`Invalid i18n request configuration detected.
|
|
15
|
+
|
|
16
|
+
Please verify that:
|
|
17
|
+
1. In case you've specified a custom location in your Next.js config, make sure that the path is correct.
|
|
18
|
+
2. You have a default export in your i18n request configuration file.
|
|
19
|
+
|
|
20
|
+
See also: https://next-intl-docs.vercel.app/docs/usage/configuration#i18n-request
|
|
21
|
+
`);
|
|
22
|
+
}
|
|
23
|
+
const params = {
|
|
24
|
+
// In case the consumer doesn't read `params.locale` and instead provides the
|
|
25
|
+
// `locale` (either in a single-language workflow or because the locale is
|
|
26
|
+
// read from the user settings), don't attempt to read the request locale.
|
|
27
|
+
get requestLocale() {
|
|
28
|
+
return localeOverride ? Promise.resolve(localeOverride) : getRequestLocale();
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
let result = getConfig(params);
|
|
32
|
+
if (result instanceof Promise) {
|
|
33
|
+
result = await result;
|
|
34
|
+
}
|
|
35
|
+
if (!result.locale) {
|
|
36
|
+
throw new Error('No locale was returned from `getRequestConfig`.\n\nSee https://next-intl-docs.vercel.app/docs/usage/configuration#i18n-request');
|
|
37
|
+
}
|
|
38
|
+
return result;
|
|
39
|
+
}
|
|
40
|
+
const receiveRuntimeConfig = cache(receiveRuntimeConfigImpl);
|
|
41
|
+
const getFormatters = cache(_createIntlFormatters);
|
|
42
|
+
const getCache = cache(_createCache);
|
|
43
|
+
async function getConfigImpl(localeOverride) {
|
|
44
|
+
const runtimeConfig = await receiveRuntimeConfig(getRuntimeConfig, localeOverride);
|
|
45
|
+
return {
|
|
46
|
+
...initializeConfig(runtimeConfig),
|
|
47
|
+
_formatters: getFormatters(getCache()),
|
|
48
|
+
timeZone: runtimeConfig.timeZone || getDefaultTimeZone()
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
const getConfig = cache(getConfigImpl);
|
|
52
|
+
|
|
53
|
+
export { getConfig as default };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { cache } from 'react';
|
|
2
|
+
import getConfig from './getConfig.js';
|
|
3
|
+
|
|
4
|
+
async function getConfigNowImpl(locale) {
|
|
5
|
+
const config = await getConfig(locale);
|
|
6
|
+
return config.now;
|
|
7
|
+
}
|
|
8
|
+
const getConfigNow = cache(getConfigNowImpl);
|
|
9
|
+
|
|
10
|
+
export { getConfigNow as default };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { cache } from 'react';
|
|
2
|
+
import getConfig from './getConfig.js';
|
|
3
|
+
|
|
4
|
+
async function getFormatsCachedImpl() {
|
|
5
|
+
const config = await getConfig();
|
|
6
|
+
return config.formats;
|
|
7
|
+
}
|
|
8
|
+
const getFormats = cache(getFormatsCachedImpl);
|
|
9
|
+
|
|
10
|
+
export { getFormats as default };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { cache } from 'react';
|
|
2
|
+
import getConfig from './getConfig.js';
|
|
3
|
+
import getFormatterCached$1 from './getServerFormatter.js';
|
|
4
|
+
|
|
5
|
+
async function getFormatterCachedImpl(locale) {
|
|
6
|
+
const config = await getConfig(locale);
|
|
7
|
+
return getFormatterCached$1(config);
|
|
8
|
+
}
|
|
9
|
+
const getFormatterCached = cache(getFormatterCachedImpl);
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Returns a formatter based on the given locale.
|
|
13
|
+
*
|
|
14
|
+
* The formatter automatically receives the request config, but
|
|
15
|
+
* you can override it by passing in additional options.
|
|
16
|
+
*/
|
|
17
|
+
async function getFormatter(opts) {
|
|
18
|
+
return getFormatterCached(opts?.locale);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export { getFormatter as default };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { cache } from 'react';
|
|
2
|
+
import getConfig from './getConfig.js';
|
|
3
|
+
|
|
4
|
+
async function getLocaleCachedImpl() {
|
|
5
|
+
const config = await getConfig();
|
|
6
|
+
return config.locale;
|
|
7
|
+
}
|
|
8
|
+
const getLocaleCached = cache(getLocaleCachedImpl);
|
|
9
|
+
|
|
10
|
+
export { getLocaleCached as default };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { cache } from 'react';
|
|
2
|
+
import getConfig from './getConfig.js';
|
|
3
|
+
|
|
4
|
+
function getMessagesFromConfig(config) {
|
|
5
|
+
if (!config.messages) {
|
|
6
|
+
throw new Error('No messages found. Have you configured them correctly? See https://next-intl-docs.vercel.app/docs/configuration#messages');
|
|
7
|
+
}
|
|
8
|
+
return config.messages;
|
|
9
|
+
}
|
|
10
|
+
async function getMessagesCachedImpl(locale) {
|
|
11
|
+
const config = await getConfig(locale);
|
|
12
|
+
return getMessagesFromConfig(config);
|
|
13
|
+
}
|
|
14
|
+
const getMessagesCached = cache(getMessagesCachedImpl);
|
|
15
|
+
async function getMessages(opts) {
|
|
16
|
+
return getMessagesCached(opts?.locale);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export { getMessages as default, getMessagesFromConfig };
|
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
1
|
/**
|
|
6
2
|
* Should be called in `i18n/request.ts` to create the configuration for the current request.
|
|
7
3
|
*/
|
|
@@ -9,4 +5,4 @@ function getRequestConfig(createRequestConfig) {
|
|
|
9
5
|
return createRequestConfig;
|
|
10
6
|
}
|
|
11
7
|
|
|
12
|
-
|
|
8
|
+
export { getRequestConfig as default };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { cache } from 'react';
|
|
2
|
+
import { createFormatter } from 'use-intl/core';
|
|
3
|
+
import getDefaultNow from './getDefaultNow.js';
|
|
4
|
+
|
|
5
|
+
function getFormatterCachedImpl(config) {
|
|
6
|
+
// same here?
|
|
7
|
+
// also add a test
|
|
8
|
+
// also for getTranslations/useTranslations
|
|
9
|
+
// add a test with a getter maybe, don't mock
|
|
10
|
+
return createFormatter({
|
|
11
|
+
...config,
|
|
12
|
+
// Only init when necessary to avoid triggering a `dynamicIO` error
|
|
13
|
+
// unnecessarily (`now` is only needed for `format.relativeTime`)
|
|
14
|
+
get now() {
|
|
15
|
+
return config.now ?? getDefaultNow();
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
const getFormatterCached = cache(getFormatterCachedImpl);
|
|
20
|
+
|
|
21
|
+
export { getFormatterCached as default };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { cache } from 'react';
|
|
2
|
+
import { createTranslator } from 'use-intl/core';
|
|
3
|
+
|
|
4
|
+
function getServerTranslatorImpl(config, namespace) {
|
|
5
|
+
return createTranslator({
|
|
6
|
+
...config,
|
|
7
|
+
namespace
|
|
8
|
+
});
|
|
9
|
+
}
|
|
10
|
+
var getServerTranslator = cache(getServerTranslatorImpl);
|
|
11
|
+
|
|
12
|
+
export { getServerTranslator as default };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { cache } from 'react';
|
|
2
|
+
import getConfig from './getConfig.js';
|
|
3
|
+
|
|
4
|
+
async function getTimeZoneCachedImpl(locale) {
|
|
5
|
+
const config = await getConfig(locale);
|
|
6
|
+
return config.timeZone;
|
|
7
|
+
}
|
|
8
|
+
const getTimeZoneCached = cache(getTimeZoneCachedImpl);
|
|
9
|
+
async function getTimeZone(opts) {
|
|
10
|
+
return getTimeZoneCached(opts?.locale);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export { getTimeZone as default };
|
|
@@ -1,10 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var React = require('react');
|
|
6
|
-
var core = require('use-intl/core');
|
|
7
|
-
var getConfig = require('./getConfig.js');
|
|
1
|
+
import { cache } from 'react';
|
|
2
|
+
import getConfig from './getConfig.js';
|
|
3
|
+
import getServerTranslator from './getServerTranslator.js';
|
|
8
4
|
|
|
9
5
|
// Maintainer note: `getTranslations` has two different call signatures.
|
|
10
6
|
// We need to define these with function overloads, otherwise TypeScript
|
|
@@ -24,13 +20,9 @@ async function getTranslations(namespaceOrOpts) {
|
|
|
24
20
|
locale = namespaceOrOpts.locale;
|
|
25
21
|
namespace = namespaceOrOpts.namespace;
|
|
26
22
|
}
|
|
27
|
-
const config = await getConfig
|
|
28
|
-
return
|
|
29
|
-
...config,
|
|
30
|
-
namespace,
|
|
31
|
-
messages: config.messages
|
|
32
|
-
});
|
|
23
|
+
const config = await getConfig(locale);
|
|
24
|
+
return getServerTranslator(config, namespace);
|
|
33
25
|
}
|
|
34
|
-
var getTranslations$1 =
|
|
26
|
+
var getTranslations$1 = cache(getTranslations);
|
|
35
27
|
|
|
36
|
-
|
|
28
|
+
export { getTranslations$1 as default };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { getFormatter, getLocale, getMessages, getNow, getRequestConfig, getTimeZone, getTranslations, setRequestLocale } from './server/react-client/index.js';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { default as getRequestConfig } from './server/react-server/getRequestConfig.js';
|
|
2
|
+
export { default as getFormatter } from './server/react-server/getFormatter.js';
|
|
3
|
+
export { default as getNow } from './server/react-server/getNow.js';
|
|
4
|
+
export { default as getMessages } from './server/react-server/getMessages.js';
|
|
5
|
+
export { default as getTimeZone } from './server/react-server/getTimeZone.js';
|
|
6
|
+
export { default as getTranslations } from './server/react-server/getTranslations.js';
|
|
7
|
+
export { default as getLocale } from './server/react-server/getLocale.js';
|
|
8
|
+
export { setCachedRequestLocale as setRequestLocale } from './server/react-server/RequestLocaleCache.js';
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { IntlProvider } from 'use-intl/react';
|
|
3
|
+
import { jsx } from 'react/jsx-runtime';
|
|
4
|
+
|
|
5
|
+
function NextIntlClientProvider({
|
|
6
|
+
locale,
|
|
7
|
+
...rest
|
|
8
|
+
}) {
|
|
9
|
+
if (!locale) {
|
|
10
|
+
throw new Error("Couldn't infer the `locale` prop in `NextIntlClientProvider`, please provide it explicitly.\n\nSee https://next-intl-docs.vercel.app/docs/configuration#locale" );
|
|
11
|
+
}
|
|
12
|
+
return /*#__PURE__*/jsx(IntlProvider, {
|
|
13
|
+
locale: locale,
|
|
14
|
+
...rest
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export { NextIntlClientProvider as default };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
|
|
3
|
+
// @ts-expect-error -- Ooof, Next.js doesn't make this easy.
|
|
4
|
+
// `use` is only available in React 19 canary, but we can
|
|
5
|
+
// use it in Next.js already as Next.js "vendors" a fixed
|
|
6
|
+
// version of React. However, if we'd simply put `use` in
|
|
7
|
+
// ESM code, then the build doesn't work since React does
|
|
8
|
+
// not export `use` officially. Therefore, we have to use
|
|
9
|
+
// something that is not statically analyzable. Once React
|
|
10
|
+
// 19 is out, we can remove this in the next major version.
|
|
11
|
+
var use = react['use'.trim()];
|
|
12
|
+
|
|
13
|
+
export { use as default };
|
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
1
|
function isRelativeHref(href) {
|
|
6
2
|
const pathname = typeof href === 'object' ? href.pathname : href;
|
|
7
3
|
return pathname != null && !pathname.startsWith('/');
|
|
@@ -17,37 +13,8 @@ function isLocalHref(href) {
|
|
|
17
13
|
function isLocalizableHref(href) {
|
|
18
14
|
return isLocalHref(href) && !isRelativeHref(href);
|
|
19
15
|
}
|
|
20
|
-
function localizeHref(href, locale) {
|
|
21
|
-
let curLocale = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : locale;
|
|
22
|
-
let curPathname = arguments.length > 3 ? arguments[3] : undefined;
|
|
23
|
-
let prefix = arguments.length > 4 ? arguments[4] : undefined;
|
|
24
|
-
if (!isLocalizableHref(href)) {
|
|
25
|
-
return href;
|
|
26
|
-
}
|
|
27
|
-
const isSwitchingLocale = locale !== curLocale;
|
|
28
|
-
const isPathnamePrefixed = hasPathnamePrefixed(prefix, curPathname);
|
|
29
|
-
const shouldPrefix = isSwitchingLocale || isPathnamePrefixed;
|
|
30
|
-
if (shouldPrefix && prefix != null) {
|
|
31
|
-
return prefixHref(href, prefix);
|
|
32
|
-
}
|
|
33
|
-
return href;
|
|
34
|
-
}
|
|
35
|
-
function prefixHref(href, prefix) {
|
|
36
|
-
let prefixedHref;
|
|
37
|
-
if (typeof href === 'string') {
|
|
38
|
-
prefixedHref = prefixPathname(prefix, href);
|
|
39
|
-
} else {
|
|
40
|
-
prefixedHref = {
|
|
41
|
-
...href
|
|
42
|
-
};
|
|
43
|
-
if (href.pathname) {
|
|
44
|
-
prefixedHref.pathname = prefixPathname(prefix, href.pathname);
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
return prefixedHref;
|
|
48
|
-
}
|
|
49
16
|
function unprefixPathname(pathname, prefix) {
|
|
50
|
-
return pathname.replace(new RegExp(
|
|
17
|
+
return pathname.replace(new RegExp(`^${prefix}`), '') || '/';
|
|
51
18
|
}
|
|
52
19
|
function prefixPathname(prefix, pathname) {
|
|
53
20
|
let localizedHref = prefix;
|
|
@@ -60,13 +27,13 @@ function prefixPathname(prefix, pathname) {
|
|
|
60
27
|
return localizedHref;
|
|
61
28
|
}
|
|
62
29
|
function hasPathnamePrefixed(prefix, pathname) {
|
|
63
|
-
return pathname === prefix || pathname.startsWith(
|
|
30
|
+
return pathname === prefix || pathname.startsWith(`${prefix}/`);
|
|
64
31
|
}
|
|
65
32
|
function hasTrailingSlash() {
|
|
66
33
|
try {
|
|
67
34
|
// Provided via `env` setting in `next.config.js` via the plugin
|
|
68
35
|
return process.env._next_intl_trailing_slash === 'true';
|
|
69
|
-
} catch
|
|
36
|
+
} catch {
|
|
70
37
|
return false;
|
|
71
38
|
}
|
|
72
39
|
}
|
|
@@ -91,8 +58,7 @@ pathname) {
|
|
|
91
58
|
return regex.test(normalizedPathname);
|
|
92
59
|
}
|
|
93
60
|
function getLocalePrefix(locale, localePrefix) {
|
|
94
|
-
|
|
95
|
-
return localePrefix.mode !== 'never' && ((_localePrefix$prefixe = localePrefix.prefixes) === null || _localePrefix$prefixe === void 0 ? void 0 : _localePrefix$prefixe[locale]) ||
|
|
61
|
+
return localePrefix.mode !== 'never' && localePrefix.prefixes?.[locale] ||
|
|
96
62
|
// We return a prefix even if `mode: 'never'`. It's up to the consumer
|
|
97
63
|
// to decide to use it or not.
|
|
98
64
|
'/' + locale;
|
|
@@ -105,7 +71,7 @@ function templateToRegex(template) {
|
|
|
105
71
|
.replace(/\[(\.\.\.[^\]]+)\]/g, '(.+)')
|
|
106
72
|
// Replace regular parameter ('[slug]')
|
|
107
73
|
.replace(/\[([^\]]+)\]/g, '([^/]+)');
|
|
108
|
-
return new RegExp(
|
|
74
|
+
return new RegExp(`^${regexPattern}$`);
|
|
109
75
|
}
|
|
110
76
|
function isOptionalCatchAllSegment(pathname) {
|
|
111
77
|
return pathname.includes('[[...');
|
|
@@ -154,14 +120,4 @@ function getSortedPathnames(pathnames) {
|
|
|
154
120
|
return pathnames.sort(comparePathnamePairs);
|
|
155
121
|
}
|
|
156
122
|
|
|
157
|
-
|
|
158
|
-
exports.getSortedPathnames = getSortedPathnames;
|
|
159
|
-
exports.hasPathnamePrefixed = hasPathnamePrefixed;
|
|
160
|
-
exports.isLocalizableHref = isLocalizableHref;
|
|
161
|
-
exports.localizeHref = localizeHref;
|
|
162
|
-
exports.matchesPathname = matchesPathname;
|
|
163
|
-
exports.normalizeTrailingSlash = normalizeTrailingSlash;
|
|
164
|
-
exports.prefixHref = prefixHref;
|
|
165
|
-
exports.prefixPathname = prefixPathname;
|
|
166
|
-
exports.templateToRegex = templateToRegex;
|
|
167
|
-
exports.unprefixPathname = unprefixPathname;
|
|
123
|
+
export { getLocalePrefix, getSortedPathnames, hasPathnamePrefixed, isLocalizableHref, matchesPathname, normalizeTrailingSlash, prefixPathname, templateToRegex, unprefixPathname };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{useFormatter,useTranslations}from"./react-client/index.js";export{default as NextIntlClientProvider}from"./shared/NextIntlClientProvider.js";export*from"use-intl";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{normalizeTrailingSlash as e}from"../shared/utils.js";import{getHost as a,getNormalizedPathname as t,getLocalePrefixes as o,isLocaleSupportedOnDomain as n,applyBasePath as l,formatTemplatePathname as r}from"./utils.js";function m({localizedPathnames:m,request:p,resolvedLocale:s,routing:c}){const f=p.nextUrl.clone(),h=a(p.headers);function i(a,t){return a.pathname=e(a.pathname),p.nextUrl.basePath&&((a=new URL(a)).pathname=l(a.pathname,p.nextUrl.basePath)),`<${a.toString()}>; rel="alternate"; hreflang="${t}"`}function u(e,a){return m&&"object"==typeof m?r(e,m[s],m[a]):e}h&&(f.port="",f.host=h),f.protocol=p.headers.get("x-forwarded-proto")??f.protocol,f.pathname=t(f.pathname,c.locales,c.localePrefix);const d=o(c.locales,c.localePrefix,!1).flatMap((([e,a])=>{function t(e){return"/"===e?a:a+e}let o;if(c.domains){return c.domains.filter((a=>n(e,a))).map((a=>(o=new URL(f),o.port="",o.host=a.domain,o.pathname=u(f.pathname,e),e===a.defaultLocale&&"always"!==c.localePrefix.mode||(o.pathname=t(o.pathname)),i(o,e))))}{let a;a=m&&"object"==typeof m?u(f.pathname,e):f.pathname,e===c.defaultLocale&&"always"!==c.localePrefix.mode||(a=t(a)),o=new URL(a,f)}return i(o,e)}));if(!c.domains&&("always"!==c.localePrefix.mode||"/"===f.pathname)){const e=new URL(u(f.pathname,c.defaultLocale),f);d.push(i(e,"x-default"))}return d.join(", ")}export{m as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{NextResponse as e}from"next/server.js";import{receiveRoutingConfig as t}from"../routing/config.js";import{HEADER_LOCALE_NAME as r}from"../shared/constants.js";import{matchesPathname as o,normalizeTrailingSlash as a,getLocalePrefix as l}from"../shared/utils.js";import n from"./getAlternateLinksHeaderValue.js";import s from"./resolveLocale.js";import i from"./syncCookie.js";import{sanitizePathname as c,isLocaleSupportedOnDomain as d,getNormalizedPathname as f,getPathnameMatch as m,getInternalTemplate as h,formatTemplatePathname as x,formatPathname as p,getBestMatchingDomain as u,applyBasePath as U,getLocaleAsPrefix as P}from"./utils.js";function g(g){const v=t(g);return function(t){let g;try{g=decodeURI(t.nextUrl.pathname)}catch{return e.next()}const L=c(g),{domain:j,locale:w}=s(v,t.headers,t.cookies,L),k=j?j.defaultLocale===w:w===v.defaultLocale,b=v.domains?.filter((e=>d(w,e)))||[],y=null!=v.domains&&!j;function R(o){const a=new URL(o,t.url);t.nextUrl.basePath&&(a.pathname=U(a.pathname,t.nextUrl.basePath));const l=new Headers(t.headers);return l.set(r,w),e.rewrite(a,{request:{headers:l}})}function q(r,o){const l=new URL(r,t.url);if(l.pathname=a(l.pathname),b.length>0&&!o&&j){const e=u(j,w,b);e&&(o=e.domain,e.defaultLocale===w&&"as-needed"===v.localePrefix.mode&&(l.pathname=f(l.pathname,v.locales,v.localePrefix)))}return o&&(l.host=o,t.headers.get("x-forwarded-host")&&(l.protocol=t.headers.get("x-forwarded-proto")??t.nextUrl.protocol,l.port=t.headers.get("x-forwarded-port")??"")),t.nextUrl.basePath&&(l.pathname=U(l.pathname,t.nextUrl.basePath)),e.redirect(l.toString())}const H=f(L,v.locales,v.localePrefix),z=m(L,v.locales,v.localePrefix),A=null!=z,C="never"===v.localePrefix.mode||k&&"as-needed"===v.localePrefix.mode;let I,S,V=H;const B=v.pathnames;if(B){let e;if([e,S]=h(B,H,w),S){const r=B[S],a="string"==typeof r?r:r[w];if(o(a,H))V=x(H,a,S);else{let o;o=e?"string"==typeof r?r:r[e]:S;const n=C?void 0:l(w,v.localePrefix),s=x(H,o,a);I=q(p(s,n,t.nextUrl.search))}}}if(!I)if("/"!==V||A){const e=p(V,P(w),t.nextUrl.search);if(A){const r=p(H,z.prefix,t.nextUrl.search);if("never"===v.localePrefix.mode)I=q(p(H,void 0,t.nextUrl.search));else if(z.exact)if(k&&C)I=q(p(H,void 0,t.nextUrl.search));else if(v.domains){const t=u(j,z.locale,b);I=j?.domain===t?.domain||y?R(e):q(r,t?.domain)}else I=R(e);else I=q(r)}else I=C?R(e):q(p(H,l(w,v.localePrefix),t.nextUrl.search))}else I=C?R(p(V,P(w),t.nextUrl.search)):q(p(H,l(w,v.localePrefix),t.nextUrl.search));return i(t,I,w,v,j),"never"!==v.localePrefix.mode&&v.alternateLinks&&v.locales.length>1&&I.headers.set("Link",n({routing:v,localizedPathnames:null!=S&&B?B[S]:void 0,request:t,resolvedLocale:w})),I}}export{g as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{match as e}from"@formatjs/intl-localematcher";import o from"negotiator";import{getPathnameMatch as l,isLocaleSupportedOnDomain as t,getHost as a}from"./utils.js";function c(l,t,a){let c;const n=new o({headers:{"accept-language":l.get("accept-language")||void 0}}).languages();try{const o=function(e){return e.slice().sort(((e,o)=>o.length-e.length))}(t);c=e(n,o,a)}catch{}return c}function n(e,o){if(e.localeCookie&&o.has(e.localeCookie.name)){const l=o.get(e.localeCookie.name)?.value;if(l&&e.locales.includes(l))return l}}function i(e,o,t,a){let i;return a&&(i=l(a,e.locales,e.localePrefix)?.locale),!i&&e.localeDetection&&(i=n(e,t)),!i&&e.localeDetection&&(i=c(o,e.locales,e.defaultLocale)),i||(i=e.defaultLocale),i}function r(e,o,r,f){const u=function(e,o){const l=a(e);if(l)return o.find((e=>e.domain===l))}(o,e.domains);if(!u)return{locale:i(e,o,r,f)};let s;if(f){const o=l(f,e.locales,e.localePrefix)?.locale;if(o){if(!t(o,u))return{locale:o,domain:u};s=o}}if(!s&&e.localeDetection){const o=n(e,r);o&&t(o,u)&&(s=o)}if(!s&&e.localeDetection){const l=c(o,u.locales||e.locales,u.defaultLocale);l&&(s=l)}return s||(s=u.defaultLocale),{locale:s,domain:u}}function f(e,o,l,t){return e.domains?r(e,o,l,t):{locale:i(e,o,l,t)}}export{f as default,c as getAcceptLanguageLocale};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{getAcceptLanguageLocale as e}from"./resolveLocale.js";function o(o,a,l,s,t){if(!s.localeCookie)return;const{name:c,...i}=s.localeCookie,r=e(o.headers,t?.locales||s.locales,s.defaultLocale),n=o.cookies.has(c),f=n&&o.cookies.get(c)?.value!==l;(n?f:r!==l)&&a.cookies.set(c,l,{path:o.nextUrl.basePath||void 0,...i})}export{o as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{getSortedPathnames as e,matchesPathname as t,normalizeTrailingSlash as n,getLocalePrefix as r,templateToRegex as o,prefixPathname as c}from"../shared/utils.js";function i(n,r,o){const c=e(Object.keys(n));for(const e of c){const c=n[e];if("string"==typeof c){if(t(c,r))return[void 0,e]}else{const n=Object.entries(c),i=n.findIndex((([e])=>e===o));i>0&&n.unshift(n.splice(i,1)[0]);for(const[o,c]of n)if(t(c,r))return[o,e]}}for(const e of Object.keys(n))if(t(e,r))return[void 0,e];return[void 0,void 0]}function l(e,t,r,o){let c="";return c+=d(r,a(t,e)),c=n(c),c}function f(e,t,r){e.endsWith("/")||(e+="/");const o=s(t,r),c=new RegExp(`^(${o.map((([,e])=>e.replaceAll("/","\\/"))).join("|")})/(.*)`,"i"),i=e.match(c);let l=i?"/"+i[2]:e;return"/"!==l&&(l=n(l)),l}function s(e,t,n=!0){const o=e.map((e=>[e,r(e,t)]));return n&&o.sort(((e,t)=>t[1].length-e[1].length)),o}function u(e,t,n){const r=s(t,n);for(const[t,n]of r){let r,o;if(e===n||e.startsWith(n+"/"))r=o=!0;else{const t=e.toLowerCase(),c=n.toLowerCase();(t===c||t.startsWith(c+"/"))&&(r=!1,o=!0)}if(o)return{locale:t,prefix:n,matchedPrefix:e.slice(0,n.length),exact:r}}}function a(e,t){const r=n(t),c=n(e),i=o(c).exec(r);if(!i)return;const l={};for(let e=1;e<i.length;e++){const t=c.match(/\[([^\]]+)\]/g)?.[e-1].replace(/[[\]]/g,"");t&&(l[t]=i[e])}return l}function d(e,t){if(!t)return e;let n=e=e.replace(/\[\[/g,"[").replace(/\]\]/g,"]");return Object.entries(t).forEach((([e,t])=>{n=n.replace(`[${e}]`,t)})),n}function h(e,t,n){let r=e;return t&&(r=c(t,r)),n&&(r+=n),r}function p(e){return e.get("x-forwarded-host")??e.get("host")??void 0}function g(e,t){return t.defaultLocale===e||!t.locales||t.locales.includes(e)}function x(e,t,n){let r;return e&&g(t,e)&&(r=e),r||(r=n.find((e=>e.defaultLocale===t))),r||(r=n.find((e=>e.locales?.includes(t)))),r||null!=e?.locales||(r=e),r||(r=n.find((e=>!e.locales))),r}function m(e,t){return n(t+e)}function j(e){return`/${e}`}function v(e){return e.replace(/\\/g,"%5C").replace(/\/+/g,"/")}export{m as applyBasePath,h as formatPathname,d as formatPathnameTemplate,l as formatTemplatePathname,x as getBestMatchingDomain,p as getHost,i as getInternalTemplate,j as getLocaleAsPrefix,s as getLocalePrefixes,f as getNormalizedPathname,u as getPathnameMatch,a as getRouteParams,g as isLocaleSupportedOnDomain,v as sanitizePathname};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{useRouter as e,usePathname as t}from"next/navigation.js";import{useMemo as o}from"react";import{useLocale as n}from"use-intl";import r from"../shared/createSharedNavigationFns.js";import a from"../shared/syncLocaleCookie.js";import{getRoute as s}from"../shared/utils.js";import i from"./useBasePathname.js";function c(c){const{Link:m,config:u,getPathname:f,...h}=r(n,c);return{...h,Link:m,usePathname:function(){const e=i(u.localePrefix),t=n();return o((()=>e&&u.pathnames?s(t,e,u.pathnames):e),[t,e])},useRouter:function(){const r=e(),s=n(),i=t();return o((()=>{function e(e){return function(t,o){const{locale:n,...r}=o||{},c=[f({href:t,locale:n||s,domain:window.location.host})];Object.keys(r).length>0&&c.push(r),e(...c),a(u.localeCookie,i,s,n)}}return{...r,push:e(r.push),replace:e(r.replace),prefetch:e(r.prefetch)}}),[s,i,r])},getPathname:f}}export{c as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{usePathname as r}from"next/navigation.js";import{useMemo as t}from"react";import{useLocale as o}from"use-intl";import{hasPathnamePrefixed as n,unprefixPathname as i,getLocalePrefix as e}from"../../shared/utils.js";function m(m){const s=r(),f=o();return t((()=>{if(!s)return s;const r=e(f,m);return n(r,s)?i(s,r):s}),[f,m,s])}export{m as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import e from"../shared/createSharedNavigationFns.js";import o from"./getServerLocale.js";function t(t){const{config:n,...r}=e(o,t);function a(e){return()=>{throw new Error(`\`${e}\` is not supported in Server Components. You can use this hook if you convert the calling component to a Client Component.`)}}return{...r,usePathname:a("usePathname"),useRouter:a("useRouter")}}export{t as default};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import o from"next/link.js";import{usePathname as e}from"next/navigation.js";import{forwardRef as n,useState as t,useEffect as r}from"react";import{useLocale as i}from"use-intl";import c from"./syncLocaleCookie.js";import{jsx as a}from"react/jsx-runtime";function f({defaultLocale:n,href:f,locale:l,localeCookie:m,onClick:s,prefetch:u,unprefixed:p,...d},h){const k=i(),j=null!=l&&l!==k,x=l||k,C=function(){const[o,e]=t();return r((()=>{e(window.location.host)}),[]),o}(),v=C&&p&&(p.domains[C]===x||!Object.keys(p.domains).includes(C)&&k===n&&!l)?p.pathname:f,L=e();j&&(u=!1);return a(o,{ref:h,href:v,hrefLang:j?l:void 0,onClick:function(o){c(m,L,k,l),s&&s(o)},prefetch:u,...d})}var l=n(f);export{l as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{redirect as e,permanentRedirect as o}from"next/navigation.js";import{forwardRef as a}from"react";import{receiveRoutingConfig as t}from"../../routing/config.js";import n from"../../shared/use.js";import{isLocalizableHref as r}from"../../shared/utils.js";import i from"./BaseLink.js";import{serializeSearchParams as m,compileLocalizedPathname as l,applyPathnamePrefix as c,normalizeNameOrNameWithParams as f}from"./utils.js";import{jsx as s}from"react/jsx-runtime";function u(u,p){const d=t(p||{}),h=d.pathnames,j="as-needed"===d.localePrefix.mode&&d.domains||void 0;function g({href:e,locale:o,...a},t){let m,l;"object"==typeof e?(m=e.pathname,l=e.params):m=e;const c=r(e),f=u(),p=f instanceof Promise?n(f):f,g=c?x({locale:o||p,href:null==h?m:{pathname:m,params:l}},null!=o||j||void 0):m;return s(i,{ref:t,defaultLocale:d.defaultLocale,href:"object"==typeof e?{...e,pathname:g}:g,locale:o,localeCookie:d.localeCookie,unprefixed:j&&c?{domains:d.domains.reduce(((e,o)=>(e[o.domain]=o.defaultLocale,e)),{}),pathname:x({locale:p,href:null==h?m:{pathname:m,params:l}},!1)}:void 0,...a})}const v=a(g);function x(e,o){const{href:a,locale:t}=e;let n;return null==h?"object"==typeof a?(n=a.pathname,a.query&&(n+=m(a.query))):n=a:n=l({locale:t,...f(a),pathnames:d.pathnames}),c(n,t,d,e.domain,o)}function y(e){return function(o,...a){return e(x(o,o.domain?void 0:j),...a)}}const L=y(e),k=y(o);return{config:d,Link:v,redirect:L,permanentRedirect:k,getPathname:x}}export{u as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{getBasePath as t}from"./utils.js";function e(e,o,n,a){if(!e||!(a!==n&&null!=a)||!o)return;const f=t(o),r=""!==f?f:"/",{name:c,...i}=e;i.path||(i.path=r);let l=`${c}=${a};`;for(const[t,e]of Object.entries(i)){l+=`${"maxAge"===t?"max-age":t}`,"boolean"!=typeof e&&(l+="="+e),l+=";"}document.cookie=l}export{e as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{getSortedPathnames as e,matchesPathname as n,isLocalizableHref as t,prefixPathname as r,getLocalePrefix as o,normalizeTrailingSlash as a}from"../../shared/utils.js";function i(e){return"string"==typeof e?{pathname:e}:e}function f(e){function n(e){return String(e)}const t=new URLSearchParams;for(const[r,o]of Object.entries(e))Array.isArray(o)?o.forEach((e=>{t.append(r,n(e))})):t.set(r,n(o));return"?"+t.toString()}function c({pathname:e,locale:n,params:t,pathnames:r,query:o}){function i(e){let n=r[e];return n||(n=e),n}function c(e){let r="string"==typeof e?e:e[n];return t&&Object.entries(t).forEach((([e,n])=>{let t,o;Array.isArray(n)?(t=`(\\[)?\\[...${e}\\](\\])?`,o=n.map((e=>String(e))).join("/")):(t=`\\[${e}\\]`,o=String(n)),r=r.replace(new RegExp(t,"g"),o)})),r=r.replace(/\[\[\.\.\..+\]\]/g,""),r=a(r),o&&(r+=f(o)),r}if("string"==typeof e){return c(i(e))}{const{pathname:n,...t}=e;return{...t,pathname:c(i(n))}}}function s(t,r,o){const a=e(Object.keys(o)),i=decodeURI(r);for(const e of a){const r=o[e];if("string"==typeof r){if(n(r,i))return e}else if(n(r[t],i))return e}return r}function u(e,n=window.location.pathname){return"/"===e?n:n.replace(e,"")}function l(e,n,a,i,f){const{mode:c}=a.localePrefix;let s;if(void 0!==f)s=f;else if(t(e))if("always"===c)s=!0;else if("as-needed"===c){let e=a.defaultLocale;if(a.domains){const n=a.domains.find((e=>e.domain===i));n&&(e=n.defaultLocale)}s=e!==n}return s?r(o(n,a.localePrefix),e):e}export{l as applyPathnamePrefix,c as compileLocalizedPathname,u as getBasePath,s as getRoute,i as normalizeNameOrNameWithParams,f as serializeSearchParams};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{default as createNavigation}from"./navigation/react-client/createNavigation.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{default as createNavigation}from"./navigation/react-server/createNavigation.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import e from"fs";import s from"path";import{watch as t}from"chokidar";import{throwError as n}from"./utils.js";function o(o){const i=s.resolve(o);e.existsSync(i)||n(`\`createMessagesDeclaration\` points to a non-existent file: ${i}`),i.endsWith(".json")||n(`\`createMessagesDeclaration\` needs to point to a JSON file. Received: ${i}`);const c=process.argv.includes("dev"),a=process.argv.includes("build");var l;(c||a)&&(l=()=>{r(o),c&&function(e){const s=t(e);s.on("change",(()=>{r(e,!0)})),process.on("exit",(()=>{s.close()}))}(o)},"1"!==process.env._NEXT_INTL_COMPILE_MESSAGES&&(process.env._NEXT_INTL_COMPILE_MESSAGES="1",l()))}function r(s,t=!1){const n=s.replace(/\.json$/,".d.json.ts");function o(e){return`// This file is auto-generated by next-intl, do not edit directly.\n// See: https://next-intl-docs.vercel.app/docs/workflows/typescript#messages-arguments\n\ndeclare const messages: ${e.trim()};\nexport default messages;`}if(t)return e.promises.readFile(s,"utf-8").then((s=>e.promises.writeFile(n,o(s))));const r=e.readFileSync(s,"utf-8");e.writeFileSync(n,o(r))}export{o as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import e from"./createMessagesDeclaration.js";import t from"./getNextConfig.js";import{warn as r}from"./utils.js";function n(n={}){const o="string"==typeof n?{requestConfig:n}:n;return function(n){return function(n,o){return null!=o?.i18n&&r("\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"),n.experimental?.createMessagesDeclaration&&e(n.experimental.createMessagesDeclaration),t(n,o)}(o,n)}}export{n as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import t from"fs";import n from"path";import{throwError as e}from"./utils.js";function o(t){return[`${t}.ts`,`${t}.tsx`,`${t}.js`,`${t}.jsx`]}function i(i,r){function s(e){return t.existsSync(function(t){const e=[];return r&&e.push(r),e.push(t),n.resolve(...e)}(e))}if(i)return s(i)||e(`Could not find i18n config at ${i}, please provide a valid path.`),i;for(const t of[...o("./i18n/request"),...o("./src/i18n/request")])if(s(t))return t;e("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\nAlternatively, you can specify a custom location in your Next.js config:\n\nconst withNextIntl = createNextIntlPlugin(\n './path/to/i18n/request.tsx'\n);")}function r(t,o){const r={};return null!=process.env.TURBOPACK?(t.requestConfig?.startsWith("/")&&e("Turbopack support for next-intl currently does not support absolute paths, please provide a relative one (e.g. './src/i18n/config.ts').\n\nFound: "+t.requestConfig),r.experimental={...o?.experimental,turbo:{...o?.experimental?.turbo,resolveAlias:{...o?.experimental?.turbo?.resolveAlias,"next-intl/config":i(t.requestConfig)}}}):r.webpack=function(...[e,r]){return e.resolve.alias["next-intl/config"]=n.resolve(e.context,i(t.requestConfig,e.context)),"function"==typeof o?.webpack?o.webpack(e,r):e},r.env={...o?.env,_next_intl_trailing_slash:o?.trailingSlash?"true":void 0},Object.assign({},o,r)}export{r as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function n(n){return`\n[next-intl] ${n}\n`}function o(o){throw new Error(n(o))}function r(o){console.warn(n(o))}export{o as throwError,r as warn};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{default}from"./plugin/createNextIntlPlugin.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{useTranslations as r,useFormatter as t}from"use-intl";export*from"use-intl";function o(r,t){return(...r)=>{try{return t(...r)}catch{throw new Error(void 0)}}}const e=o(0,r),n=o(0,t);export{n as useFormatter,e as useTranslations};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import r from"../server/react-server/getConfigNow.js";import e from"../server/react-server/getFormats.js";import t from"../shared/NextIntlClientProvider.js";import{jsx as o}from"react/jsx-runtime";import a from"../server/react-server/getLocale.js";import s from"../server/react-server/getTimeZone.js";async function i({formats:i,locale:m,now:n,timeZone:f,...c}){return o(t,{formats:void 0===i?await e():i,locale:m??await a(),now:n??await r(),timeZone:f??await s(),...c})}export{i as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import e from"../server/react-server/getConfig.js";import r from"../shared/use.js";function n(n){return function(e,n){try{return r(n)}catch(r){throw r instanceof TypeError&&r.message.includes("Cannot read properties of null (reading 'use')")?new Error(`\`${e}\` is not callable within an async component. Please refer to https://next-intl-docs.vercel.app/docs/environments/server-client-components#async-components`,{cause:r}):r}}(n,e())}export{n as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import r from"../server/react-server/getServerFormatter.js";import e from"./useConfig.js";function t(){const t=e("useFormatter");return r(t)}export{t as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import e from"./useConfig.js";function o(){return e("useLocale").locale}export{o as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{getMessagesFromConfig as e}from"../server/react-server/getMessages.js";import s from"./useConfig.js";function r(){const r=s("useMessages");return e(r)}export{r as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import e from"../server/react-server/getDefaultNow.js";import o from"./useConfig.js";function t(t){null!=t?.updateInterval&&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.");return o("useNow").now??e()}export{t as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import e from"./useConfig.js";function o(){return e("useTimeZone").timeZone}export{o as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import r from"../server/react-server/getServerTranslator.js";import e from"./useConfig.js";function s(...[s]){const t=e("useTranslations");return r(t,s)}export{s as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function e(e){return{...e,localePrefix:(a=e.localePrefix,"object"==typeof a?a:{mode:a||"always"}),localeCookie:(o=e.localeCookie,!!(o??1)&&{name:"NEXT_LOCALE",maxAge:18e3,sameSite:"lax",..."object"==typeof o&&o}),localeDetection:e.localeDetection??!0,alternateLinks:e.alternateLinks??!0};var o,a}export{e as receiveRoutingConfig};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function e(e){return()=>{throw new Error(`\`${e}\` is not supported in Client Components.`)}}function t(...t){return e("getRequestConfig")}const n=e("getFormatter"),o=e("getNow"),r=e("getTimeZone"),s=e("getMessages"),g=e("getLocale"),i=e("getTranslations"),u=e("setRequestLocale");export{n as getFormatter,g as getLocale,s as getMessages,o as getNow,t as getRequestConfig,r as getTimeZone,i as getTranslations,u as setRequestLocale};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{headers as t}from"next/headers.js";import{cache as e}from"react";import{HEADER_LOCALE_NAME as n}from"../../shared/constants.js";import{getCachedRequestLocale as r}from"./RequestLocaleCache.js";const o=e((async function(){const e=t();return e instanceof Promise?await e:e}));const s=e((async function(){let t;try{t=(await o()).get(n)||void 0}catch(t){if(t instanceof Error&&"DYNAMIC_SERVER_USAGE"===t.digest){const e=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",{cause:t});throw e.digest=t.digest,e}throw t}return t}));async function i(){return r()||await s()}export{i as getRequestLocale};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{cache as e}from"react";import{_createIntlFormatters as t,_createCache as o,initializeConfig as n}from"use-intl/core";import{getRequestLocale as r}from"./RequestLocale.js";import i from"next-intl/config";const s=e((function(){return Intl.DateTimeFormat().resolvedOptions().timeZone}));const a=e((async function(e,t){let o=e({get requestLocale(){return t?Promise.resolve(t):r()}});if(o instanceof Promise&&(o=await o),!o.locale)throw new Error("No locale was returned from `getRequestConfig`.\n\nSee https://next-intl-docs.vercel.app/docs/usage/configuration#i18n-request");return o})),c=e(t),m=e(o);const u=e((async function(e){const t=await a(i,e);return{...n(t),_formatters:c(m()),timeZone:t.timeZone||s()}}));export{u as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{cache as t}from"react";import o from"./getConfig.js";const r=t((async function(t){return(await o(t)).now}));export{r as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{cache as t}from"react";const e=t((function(){return new Date}));export{e as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{cache as t}from"react";import o from"./getConfig.js";const r=t((async function(){return(await o()).formats}));export{r as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{cache as t}from"react";import r from"./getConfig.js";import o from"./getServerFormatter.js";const e=t((async function(t){const e=await r(t);return o(e)}));async function n(t){return e(t?.locale)}export{n as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{cache as t}from"react";import o from"./getConfig.js";const r=t((async function(){return(await o()).locale}));export{r as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{cache as e}from"react";import o from"./getConfig.js";function t(e){if(!e.messages)throw new Error("No messages found. Have you configured them correctly? See https://next-intl-docs.vercel.app/docs/configuration#messages");return e.messages}const r=e((async function(e){return t(await o(e))}));async function n(e){return r(e?.locale)}export{n as default,t as getMessagesFromConfig};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import o from"./getConfigNow.js";import t from"./getDefaultNow.js";async function a(a){return await o(a?.locale)??t()}export{a as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{cache as t}from"react";import{createFormatter as o}from"use-intl/core";import r from"./getDefaultNow.js";const e=t((function(t){return o({...t,get now(){return t.now??r()}})}));export{e as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{cache as t}from"react";import n from"./getConfig.js";const o=t((async function(t){return(await n(t)).timeZone}));async function r(t){return o(
|
|
1
|
+
import{cache as t}from"react";import n from"./getConfig.js";const o=t((async function(t){return(await n(t)).timeZone}));async function r(t){return o(t?.locale)}export{r as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{cache as r}from"react";import t from"./getConfig.js";import e from"./getServerTranslator.js";var o=r((async function(r){let o,a;"string"==typeof r?o=r:r&&(a=r.locale,o=r.namespace);const n=await t(a);return e(n,o)}));export{o as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{getFormatter,getLocale,getMessages,getNow,getRequestConfig,getTimeZone,getTranslations,setRequestLocale}from"./server/react-client/index.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{default as getRequestConfig}from"./server/react-server/getRequestConfig.js";export{default as getFormatter}from"./server/react-server/getFormatter.js";export{default as getNow}from"./server/react-server/getNow.js";export{default as getMessages}from"./server/react-server/getMessages.js";export{default as getTimeZone}from"./server/react-server/getTimeZone.js";export{default as getTranslations}from"./server/react-server/getTranslations.js";export{default as getLocale}from"./server/react-server/getLocale.js";export{setCachedRequestLocale as setRequestLocale}from"./server/react-server/RequestLocaleCache.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const L="X-NEXT-INTL-LOCALE";export{L as HEADER_LOCALE_NAME};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import*as r from"react";var a=r["use".trim()];export{a as default};
|