next-intl 2.22.0 → 2.22.2
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/README.md +1 -1
- package/config.d.ts +3 -0
- package/dist/config.js +7 -0
- package/dist/development/_virtual/_rollupPluginBabelHelpers.js +20 -0
- package/dist/development/config.js +9 -0
- package/dist/development/index.js +21 -0
- package/dist/development/index.react-server.js +28 -0
- package/dist/development/middleware/getAlternateLinksHeaderValue.js +81 -0
- package/dist/development/middleware/middleware.js +146 -0
- package/dist/development/middleware/resolveLocale.js +110 -0
- package/dist/development/middleware/utils.js +150 -0
- package/dist/development/middleware.js +9 -0
- package/dist/development/navigation/BaseLink.js +52 -0
- package/dist/development/navigation/baseRedirect.js +22 -0
- package/dist/development/navigation/createLocalizedPathnamesNavigation.js +135 -0
- package/dist/development/navigation/createSharedPathnamesNavigation.js +19 -0
- package/dist/development/navigation/react-server/BaseLink.js +25 -0
- package/dist/development/navigation/react-server/baseRedirect.js +16 -0
- package/dist/development/navigation/react-server/createLocalizedPathnamesNavigation.js +77 -0
- package/dist/development/navigation/react-server/createSharedPathnamesNavigation.js +22 -0
- package/dist/development/navigation/useBasePathname.js +37 -0
- package/dist/development/navigation/useBaseRouter.js +76 -0
- package/dist/development/navigation/utils.js +108 -0
- package/dist/development/navigation.js +11 -0
- package/dist/development/navigation.react-server.js +11 -0
- package/dist/development/plugin.js +48 -0
- package/dist/development/react-client/index.js +38 -0
- package/dist/development/react-client/useLocale.js +24 -0
- package/dist/development/react-server/NextIntlClientProvider.js +33 -0
- package/dist/development/react-server/getBaseTranslator.js +21 -0
- package/dist/development/react-server/useFormatter.js +19 -0
- package/dist/development/react-server/useHook.js +21 -0
- package/dist/development/react-server/useLocale.js +14 -0
- package/dist/development/react-server/useMessages.js +19 -0
- package/dist/development/react-server/useNow.js +23 -0
- package/dist/development/react-server/useTimeZone.js +19 -0
- package/dist/development/react-server/useTranslations.js +19 -0
- package/dist/development/server/RequestLocale.js +43 -0
- package/dist/development/server/createRequestConfig.js +17 -0
- package/dist/development/server/getConfig.js +43 -0
- package/dist/development/server/getFormatter.js +26 -0
- package/dist/development/server/getLocale.js +11 -0
- package/dist/development/server/getMessages.js +21 -0
- package/dist/development/server/getNow.js +18 -0
- package/dist/development/server/getRequestConfig.js +12 -0
- package/dist/development/server/getTimeZone.js +18 -0
- package/dist/development/server/getTranslations.js +31 -0
- package/dist/development/server/resolveLocaleArg.js +15 -0
- package/dist/development/server.js +23 -0
- package/dist/development/shared/BaseLinkWithLocale.js +58 -0
- package/dist/development/shared/NextIntlClientProvider.js +30 -0
- package/dist/development/shared/constants.js +17 -0
- package/dist/development/shared/redirectWithLocale.js +16 -0
- package/dist/development/shared/utils.js +87 -0
- package/dist/esm/_virtual/_rollupPluginBabelHelpers.js +1 -0
- package/dist/esm/config.js +1 -0
- package/dist/esm/index.js +1 -0
- package/dist/esm/index.react-server.js +1 -0
- package/dist/esm/middleware/getAlternateLinksHeaderValue.js +1 -0
- package/dist/esm/middleware/middleware.js +1 -0
- package/dist/esm/middleware/resolveLocale.js +1 -0
- package/dist/esm/middleware/utils.js +1 -0
- package/dist/esm/middleware.js +1 -0
- package/dist/esm/navigation/BaseLink.js +1 -0
- package/dist/esm/navigation/baseRedirect.js +1 -0
- package/dist/esm/navigation/createLocalizedPathnamesNavigation.js +1 -0
- package/dist/esm/navigation/createSharedPathnamesNavigation.js +1 -0
- package/dist/esm/navigation/react-server/BaseLink.js +1 -0
- package/dist/esm/navigation/react-server/baseRedirect.js +1 -0
- package/dist/esm/navigation/react-server/createLocalizedPathnamesNavigation.js +1 -0
- package/dist/esm/navigation/react-server/createSharedPathnamesNavigation.js +1 -0
- package/dist/esm/navigation/useBasePathname.js +2 -0
- package/dist/esm/navigation/useBaseRouter.js +1 -0
- package/dist/esm/navigation/utils.js +1 -0
- package/dist/esm/navigation.js +1 -0
- package/dist/esm/navigation.react-server.js +1 -0
- package/dist/esm/plugin.js +1 -0
- package/dist/esm/react-client/index.js +1 -0
- package/dist/esm/react-client/useLocale.js +1 -0
- package/dist/esm/react-server/NextIntlClientProvider.js +1 -0
- package/dist/esm/react-server/getBaseTranslator.js +1 -0
- package/dist/esm/react-server/useFormatter.js +1 -0
- package/dist/esm/react-server/useHook.js +1 -0
- package/dist/esm/react-server/useLocale.js +1 -0
- package/dist/esm/react-server/useMessages.js +1 -0
- package/dist/esm/react-server/useNow.js +1 -0
- package/dist/esm/react-server/useTimeZone.js +1 -0
- package/dist/esm/react-server/useTranslations.js +1 -0
- package/dist/esm/server/RequestLocale.js +1 -0
- package/dist/esm/server/createRequestConfig.js +1 -0
- package/dist/esm/server/getConfig.js +1 -0
- package/dist/esm/server/getFormatter.js +1 -0
- package/dist/esm/server/getLocale.js +1 -0
- package/dist/esm/server/getMessages.js +1 -0
- package/dist/esm/server/getNow.js +1 -0
- package/dist/esm/server/getRequestConfig.js +1 -0
- package/dist/esm/server/getTimeZone.js +1 -0
- package/dist/esm/server/getTranslations.js +1 -0
- package/dist/esm/server/resolveLocaleArg.js +1 -0
- package/dist/esm/server.js +1 -0
- package/dist/esm/shared/BaseLinkWithLocale.js +2 -0
- package/dist/esm/shared/NextIntlClientProvider.js +2 -0
- package/dist/esm/shared/constants.js +1 -0
- package/dist/esm/shared/redirectWithLocale.js +1 -0
- package/dist/esm/shared/utils.js +1 -0
- package/dist/index.js +3 -4
- package/dist/index.react-server.js +7 -0
- package/dist/middleware.js +7 -0
- package/dist/navigation.js +7 -0
- package/dist/navigation.react-server.js +7 -0
- package/dist/plugin.js +7 -0
- package/dist/production/_virtual/_rollupPluginBabelHelpers.js +1 -0
- package/dist/production/config.js +1 -0
- package/dist/production/index.js +1 -0
- package/dist/production/index.react-server.js +1 -0
- package/dist/production/middleware/getAlternateLinksHeaderValue.js +1 -0
- package/dist/production/middleware/middleware.js +1 -0
- package/dist/production/middleware/resolveLocale.js +1 -0
- package/dist/production/middleware/utils.js +1 -0
- package/dist/production/middleware.js +1 -0
- package/dist/production/navigation/BaseLink.js +1 -0
- package/dist/production/navigation/baseRedirect.js +1 -0
- package/dist/production/navigation/createLocalizedPathnamesNavigation.js +1 -0
- package/dist/production/navigation/createSharedPathnamesNavigation.js +1 -0
- package/dist/production/navigation/react-server/BaseLink.js +1 -0
- package/dist/production/navigation/react-server/baseRedirect.js +1 -0
- package/dist/production/navigation/react-server/createLocalizedPathnamesNavigation.js +1 -0
- package/dist/production/navigation/react-server/createSharedPathnamesNavigation.js +1 -0
- package/dist/production/navigation/useBasePathname.js +2 -0
- package/dist/production/navigation/useBaseRouter.js +1 -0
- package/dist/production/navigation/utils.js +1 -0
- package/dist/production/navigation.js +1 -0
- package/dist/production/navigation.react-server.js +1 -0
- package/dist/production/plugin.js +1 -0
- package/dist/production/react-client/index.js +1 -0
- package/dist/production/react-client/useLocale.js +1 -0
- package/dist/production/react-server/NextIntlClientProvider.js +1 -0
- package/dist/production/react-server/getBaseTranslator.js +1 -0
- package/dist/production/react-server/useFormatter.js +1 -0
- package/dist/production/react-server/useHook.js +1 -0
- package/dist/production/react-server/useLocale.js +1 -0
- package/dist/production/react-server/useMessages.js +1 -0
- package/dist/production/react-server/useNow.js +1 -0
- package/dist/production/react-server/useTimeZone.js +1 -0
- package/dist/production/react-server/useTranslations.js +1 -0
- package/dist/production/server/RequestLocale.js +1 -0
- package/dist/production/server/createRequestConfig.js +1 -0
- package/dist/production/server/getConfig.js +1 -0
- package/dist/production/server/getFormatter.js +1 -0
- package/dist/production/server/getLocale.js +1 -0
- package/dist/production/server/getMessages.js +1 -0
- package/dist/production/server/getNow.js +1 -0
- package/dist/production/server/getRequestConfig.js +1 -0
- package/dist/production/server/getTimeZone.js +1 -0
- package/dist/production/server/getTranslations.js +1 -0
- package/dist/production/server/resolveLocaleArg.js +1 -0
- package/dist/production/server.js +1 -0
- package/dist/production/shared/BaseLinkWithLocale.js +2 -0
- package/dist/production/shared/NextIntlClientProvider.js +2 -0
- package/dist/production/shared/constants.js +1 -0
- package/dist/production/shared/redirectWithLocale.js +1 -0
- package/dist/production/shared/utils.js +1 -0
- package/dist/server.js +7 -0
- package/dist/types/src/config.d.ts +1 -0
- package/dist/types/src/index.react-server.d.ts +1 -0
- package/dist/{src → types/src}/middleware/NextIntlMiddlewareConfig.d.ts +14 -10
- package/dist/types/src/middleware/getAlternateLinksHeaderValue.d.ts +12 -0
- package/dist/types/src/middleware/middleware.d.ts +4 -0
- package/dist/types/src/middleware/resolveLocale.d.ts +7 -0
- package/dist/types/src/middleware/utils.d.ts +17 -0
- package/dist/types/src/middleware.d.ts +1 -0
- package/dist/types/src/navigation/BaseLink.d.ts +63 -0
- package/dist/types/src/navigation/StrictParams.d.ts +8 -0
- package/dist/types/src/navigation/baseRedirect.d.ts +3 -0
- package/dist/types/src/navigation/createLocalizedPathnamesNavigation.d.ts +78 -0
- package/dist/types/src/navigation/createSharedPathnamesNavigation.d.ts +13 -0
- package/dist/types/src/navigation/index.d.ts +3 -0
- package/dist/types/src/navigation/react-server/BaseLink.d.ts +8 -0
- package/dist/types/src/navigation/react-server/baseRedirect.d.ts +3 -0
- package/dist/types/src/navigation/react-server/createLocalizedPathnamesNavigation.d.ts +60 -0
- package/dist/types/src/navigation/react-server/createSharedPathnamesNavigation.d.ts +44 -0
- package/dist/types/src/navigation/react-server/index.d.ts +3 -0
- package/dist/{src/client/usePathname.d.ts → types/src/navigation/useBasePathname.d.ts} +1 -1
- package/dist/{client/useRouter.d.ts → types/src/navigation/useBaseRouter.d.ts} +32 -31
- package/dist/types/src/navigation/utils.d.ts +51 -0
- package/dist/types/src/navigation.d.ts +1 -0
- package/dist/types/src/navigation.react-server.d.ts +1 -0
- package/dist/types/src/plugin.d.ts +1 -0
- package/dist/{react-client → types/src/react-client}/index.d.ts +15 -12
- package/dist/types/src/react-client/useLocale.d.ts +1 -0
- package/dist/types/src/react-server/NextIntlClientProvider.d.ts +5 -0
- package/dist/types/src/react-server/getBaseTranslator.d.ts +42 -0
- package/dist/types/src/react-server/index.d.ts +15 -0
- package/dist/types/src/react-server/useFormatter.d.ts +2 -0
- package/dist/types/src/react-server/useHook.d.ts +1 -0
- package/dist/types/src/react-server/useLocale.d.ts +2 -0
- package/dist/types/src/react-server/useMessages.d.ts +2 -0
- package/dist/types/src/react-server/useNow.d.ts +2 -0
- package/dist/types/src/react-server/useTimeZone.d.ts +2 -0
- package/dist/types/src/react-server/useTranslations.d.ts +2 -0
- package/dist/types/src/server/RequestLocale.d.ts +2 -0
- package/dist/types/src/server/createRequestConfig.d.ts +4 -0
- package/dist/types/src/server/getConfig.d.ts +23 -0
- package/dist/types/src/server/getFormatter.d.ts +14 -0
- package/dist/types/src/server/getLocale.d.ts +1 -0
- package/dist/types/src/server/getMessages.d.ts +3 -0
- package/dist/types/src/server/getNow.d.ts +3 -0
- package/dist/types/src/server/getRequestConfig.d.ts +10 -0
- package/dist/types/src/server/getTimeZone.d.ts +3 -0
- package/dist/types/src/server/getTranslations.d.ts +83 -0
- package/dist/types/src/server/index.d.ts +11 -0
- package/dist/types/src/server/resolveLocaleArg.d.ts +3 -0
- package/dist/types/src/server.d.ts +1 -0
- package/dist/types/src/shared/NextIntlClientProvider.d.ts +8 -0
- package/dist/{shared → types/src/shared}/constants.d.ts +3 -2
- package/dist/types/src/shared/redirectWithLocale.d.ts +3 -0
- package/dist/types/src/shared/types.d.ts +6 -0
- package/dist/{src → types/src}/shared/utils.d.ts +6 -0
- package/dist/types/test/middleware/getAlternateLinksHeaderValue.test.d.ts +1 -0
- package/dist/types/test/middleware/middleware.test.d.ts +1 -0
- package/dist/types/test/middleware/utils.test.d.ts +1 -0
- package/dist/types/test/navigation/BaseLink.test.d.ts +1 -0
- package/dist/types/test/navigation/createLocalizedPathnamesNavigation.test.d.ts +1 -0
- package/dist/types/test/navigation/createSharedPathnamesNavigation.test.d.ts +1 -0
- package/dist/types/test/navigation/useBasePathname.test.d.ts +1 -0
- package/dist/types/test/navigation/useBaseRouter.test.d.ts +1 -0
- package/dist/types/test/navigation/utils.test.d.ts +1 -0
- package/dist/types/test/react-client/useFormatter.test.d.ts +1 -0
- package/dist/types/test/react-client/useLocale.test.d.ts +1 -0
- package/dist/types/test/react-client/useNow.test.d.ts +1 -0
- package/dist/types/test/react-client/useTimeZone.test.d.ts +1 -0
- package/dist/types/test/react-client/useTranslations.test.d.ts +1 -0
- package/dist/types/test/server/index.test.d.ts +1 -0
- package/dist/types/test/setup.d.ts +1 -0
- package/dist/types/test/shared/NextIntlClientProvider.test.d.ts +1 -0
- package/dist/types/test/shared/utils.test.d.ts +1 -0
- package/middleware.d.ts +1 -1
- package/navigation.d.ts +1 -0
- package/package.json +45 -34
- package/plugin.d.ts +6 -0
- package/server.d.ts +1 -1
- package/client.d.ts +0 -1
- package/dist/_virtual/next-intl.esm.js +0 -29
- package/dist/_virtual/next-intl.esm.js.map +0 -1
- package/dist/client/NextIntlClientProvider.d.ts +0 -4
- package/dist/client/index.d.ts +0 -6
- package/dist/client/useClientLocale.d.ts +0 -1
- package/dist/client/usePathname.d.ts +0 -14
- package/dist/index.d.ts +0 -8
- package/dist/link/Link.d.ts +0 -27
- package/dist/link/index.d.ts +0 -1
- package/dist/link/react-server/Link.d.ts +0 -1
- package/dist/link/react-server/index.d.ts +0 -1
- package/dist/middleware/NextIntlMiddlewareConfig.d.ts +0 -28
- package/dist/middleware/getAlternateLinksHeaderValue.d.ts +0 -6
- package/dist/middleware/index.d.ts +0 -4
- package/dist/middleware/middleware.d.ts +0 -3
- package/dist/middleware/resolveLocale.d.ts +0 -6
- package/dist/middleware/utils.d.ts +0 -5
- package/dist/next-intl.cjs.development.js +0 -82
- package/dist/next-intl.cjs.development.js.map +0 -1
- package/dist/next-intl.cjs.production.min.js +0 -2
- package/dist/next-intl.cjs.production.min.js.map +0 -1
- package/dist/next-intl.esm.js +0 -3
- package/dist/next-intl.esm.js.map +0 -1
- package/dist/react-server/index.d.ts +0 -17
- package/dist/server/index.d.ts +0 -6
- package/dist/shared/BaseLink.d.ts +0 -7
- package/dist/shared/NextIntlClientProvider.d.ts +0 -9
- package/dist/shared/next-intl.esm.js +0 -41
- package/dist/shared/next-intl.esm.js.map +0 -1
- package/dist/shared/utils.d.ts +0 -15
- package/dist/src/client/NextIntlClientProvider.d.ts +0 -4
- package/dist/src/client/NextIntlClientProvider.js +0 -16
- package/dist/src/client/NextIntlClientProvider.js.map +0 -1
- package/dist/src/client/index.d.ts +0 -6
- package/dist/src/client/index.js +0 -8
- package/dist/src/client/index.js.map +0 -1
- package/dist/src/client/useClientLocale.d.ts +0 -1
- package/dist/src/client/useClientLocale.js +0 -18
- package/dist/src/client/useClientLocale.js.map +0 -1
- package/dist/src/client/usePathname.js +0 -34
- package/dist/src/client/usePathname.js.map +0 -1
- package/dist/src/client/useRouter.d.ts +0 -31
- package/dist/src/client/useRouter.js +0 -61
- package/dist/src/client/useRouter.js.map +0 -1
- package/dist/src/index.js +0 -9
- package/dist/src/index.js.map +0 -1
- package/dist/src/link/Link.d.ts +0 -27
- package/dist/src/link/Link.js +0 -29
- package/dist/src/link/Link.js.map +0 -1
- package/dist/src/link/index.d.ts +0 -1
- package/dist/src/link/index.js +0 -2
- package/dist/src/link/index.js.map +0 -1
- package/dist/src/link/react-server/Link.d.ts +0 -1
- package/dist/src/link/react-server/Link.js +0 -6
- package/dist/src/link/react-server/Link.js.map +0 -1
- package/dist/src/link/react-server/index.d.ts +0 -1
- package/dist/src/link/react-server/index.js +0 -2
- package/dist/src/link/react-server/index.js.map +0 -1
- package/dist/src/middleware/NextIntlMiddlewareConfig.js +0 -2
- package/dist/src/middleware/NextIntlMiddlewareConfig.js.map +0 -1
- package/dist/src/middleware/getAlternateLinksHeaderValue.d.ts +0 -6
- package/dist/src/middleware/getAlternateLinksHeaderValue.js +0 -71
- package/dist/src/middleware/getAlternateLinksHeaderValue.js.map +0 -1
- package/dist/src/middleware/index.js +0 -5
- package/dist/src/middleware/index.js.map +0 -1
- package/dist/src/middleware/middleware.d.ts +0 -3
- package/dist/src/middleware/middleware.js +0 -149
- package/dist/src/middleware/middleware.js.map +0 -1
- package/dist/src/middleware/resolveLocale.d.ts +0 -6
- package/dist/src/middleware/resolveLocale.js +0 -88
- package/dist/src/middleware/resolveLocale.js.map +0 -1
- package/dist/src/middleware/utils.d.ts +0 -5
- package/dist/src/middleware/utils.js +0 -37
- package/dist/src/middleware/utils.js.map +0 -1
- package/dist/src/react-client/index.d.ts +0 -12
- package/dist/src/react-client/index.js +0 -14
- package/dist/src/react-client/index.js.map +0 -1
- package/dist/src/react-server/index.d.ts +0 -17
- package/dist/src/react-server/index.js +0 -25
- package/dist/src/react-server/index.js.map +0 -1
- package/dist/src/server/index.d.ts +0 -6
- package/dist/src/server/index.js +0 -30
- package/dist/src/server/index.js.map +0 -1
- package/dist/src/shared/BaseLink.js +0 -38
- package/dist/src/shared/BaseLink.js.map +0 -1
- package/dist/src/shared/NextIntlClientProvider.d.ts +0 -9
- package/dist/src/shared/NextIntlClientProvider.js +0 -33
- package/dist/src/shared/NextIntlClientProvider.js.map +0 -1
- package/dist/src/shared/constants.d.ts +0 -2
- package/dist/src/shared/constants.js +0 -6
- package/dist/src/shared/constants.js.map +0 -1
- package/dist/src/shared/utils.js +0 -53
- package/dist/src/shared/utils.js.map +0 -1
- package/link.d.ts +0 -3
- package/src/client/NextIntlClientProvider.tsx +0 -18
- package/src/client/index.tsx +0 -9
- package/src/client/useClientLocale.tsx +0 -20
- package/src/client/usePathname.tsx +0 -40
- package/src/client/useRouter.tsx +0 -92
- package/src/index.tsx +0 -9
- package/src/link/Link.tsx +0 -34
- package/src/link/index.tsx +0 -1
- package/src/link/react-server/Link.tsx +0 -6
- package/src/link/react-server/index.tsx +0 -1
- package/src/middleware/NextIntlMiddlewareConfig.tsx +0 -42
- package/src/middleware/getAlternateLinksHeaderValue.tsx +0 -97
- package/src/middleware/index.tsx +0 -5
- package/src/middleware/middleware.tsx +0 -206
- package/src/middleware/resolveLocale.tsx +0 -151
- package/src/middleware/utils.tsx +0 -61
- package/src/react-client/index.tsx +0 -15
- package/src/react-server/index.tsx +0 -29
- package/src/server/index.tsx +0 -34
- package/src/shared/BaseLink.tsx +0 -57
- package/src/shared/NextIntlClientProvider.tsx +0 -54
- package/src/shared/constants.tsx +0 -6
- package/src/shared/utils.tsx +0 -91
- /package/dist/{src → types/src}/index.d.ts +0 -0
- /package/dist/{src → types/src}/middleware/index.d.ts +0 -0
- /package/dist/{src/shared/BaseLink.d.ts → types/src/shared/BaseLinkWithLocale.d.ts} +0 -0
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
function isRelativeHref(href) {
|
|
6
|
+
const pathname = typeof href === 'object' ? href.pathname : href;
|
|
7
|
+
return pathname != null && !pathname.startsWith('/');
|
|
8
|
+
}
|
|
9
|
+
function isLocalHref(href) {
|
|
10
|
+
if (typeof href === 'object') {
|
|
11
|
+
return href.host == null && href.hostname == null;
|
|
12
|
+
} else {
|
|
13
|
+
const hasProtocol = /^[a-z]+:/i.test(href);
|
|
14
|
+
return !hasProtocol;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
function localizeHref(href, locale) {
|
|
18
|
+
let defaultLocale = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : locale;
|
|
19
|
+
let pathname = arguments.length > 3 ? arguments[3] : undefined;
|
|
20
|
+
if (!isLocalHref(href) || isRelativeHref(href)) {
|
|
21
|
+
return href;
|
|
22
|
+
}
|
|
23
|
+
const isSwitchingLocale = locale !== defaultLocale;
|
|
24
|
+
const isPathnamePrefixed = locale == null || hasPathnamePrefixed(locale, pathname);
|
|
25
|
+
const shouldPrefix = isPathnamePrefixed || isSwitchingLocale;
|
|
26
|
+
if (shouldPrefix && locale != null) {
|
|
27
|
+
return prefixHref(href, locale);
|
|
28
|
+
}
|
|
29
|
+
return href;
|
|
30
|
+
}
|
|
31
|
+
function prefixHref(href, locale) {
|
|
32
|
+
let prefixedHref;
|
|
33
|
+
if (typeof href === 'string') {
|
|
34
|
+
prefixedHref = localizePathname(locale, href);
|
|
35
|
+
} else {
|
|
36
|
+
prefixedHref = {
|
|
37
|
+
...href
|
|
38
|
+
};
|
|
39
|
+
if (href.pathname) {
|
|
40
|
+
prefixedHref.pathname = localizePathname(locale, href.pathname);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
return prefixedHref;
|
|
44
|
+
}
|
|
45
|
+
function unlocalizePathname(pathname, locale) {
|
|
46
|
+
return pathname.replace(new RegExp("^/".concat(locale)), '') || '/';
|
|
47
|
+
}
|
|
48
|
+
function localizePathname(locale, pathname) {
|
|
49
|
+
let localizedHref = '/' + locale;
|
|
50
|
+
|
|
51
|
+
// Avoid trailing slashes
|
|
52
|
+
if (/^\/(\?.*)?$/.test(pathname)) {
|
|
53
|
+
pathname = pathname.slice(1);
|
|
54
|
+
}
|
|
55
|
+
localizedHref += pathname;
|
|
56
|
+
return localizedHref;
|
|
57
|
+
}
|
|
58
|
+
function hasPathnamePrefixed(locale, pathname) {
|
|
59
|
+
const prefix = "/".concat(locale);
|
|
60
|
+
return pathname === prefix || pathname.startsWith("".concat(prefix, "/"));
|
|
61
|
+
}
|
|
62
|
+
function matchesPathname( /** E.g. `/users/[userId]-[userName]` */
|
|
63
|
+
template, /** E.g. `/users/23-jane` */
|
|
64
|
+
pathname) {
|
|
65
|
+
const regex = templateToRegex(template);
|
|
66
|
+
return regex.test(pathname);
|
|
67
|
+
}
|
|
68
|
+
function templateToRegex(template) {
|
|
69
|
+
const regexPattern = template.replace(/\[([^\]]+)\]/g, match => {
|
|
70
|
+
if (match.startsWith('[...')) return '(.*)';
|
|
71
|
+
if (match.startsWith('[[...')) return '(.*)';
|
|
72
|
+
return '([^/]+)';
|
|
73
|
+
})
|
|
74
|
+
// Clean up regex match remainders from optional catchall ('[[...slug]]')
|
|
75
|
+
.replaceAll('(.*)]', '(.*)');
|
|
76
|
+
return new RegExp("^".concat(regexPattern, "$"));
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
exports.hasPathnamePrefixed = hasPathnamePrefixed;
|
|
80
|
+
exports.isLocalHref = isLocalHref;
|
|
81
|
+
exports.isRelativeHref = isRelativeHref;
|
|
82
|
+
exports.localizeHref = localizeHref;
|
|
83
|
+
exports.localizePathname = localizePathname;
|
|
84
|
+
exports.matchesPathname = matchesPathname;
|
|
85
|
+
exports.prefixHref = prefixHref;
|
|
86
|
+
exports.templateToRegex = templateToRegex;
|
|
87
|
+
exports.unlocalizePathname = unlocalizePathname;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function t(){return t=Object.assign?Object.assign.bind():function(t){for(var n=1;n<arguments.length;n++){var r=arguments[n];for(var e in r)Object.prototype.hasOwnProperty.call(r,e)&&(t[e]=r[e])}return t},t.apply(this,arguments)}export{t as extends};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function t(){throw new Error("Couldn't find next-intl config file. Please follow the instructions at https://next-intl-docs.vercel.app/docs/getting-started/app-router-server-components")}export{t as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{useFormatter,useTranslations}from"./react-client/index.js";export{default as useLocale}from"./react-client/useLocale.js";export{default as NextIntlClientProvider}from"./shared/NextIntlClientProvider.js";export*from"use-intl";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{default as useLocale}from"./react-server/useLocale.js";export{default as useTranslations}from"./react-server/useTranslations.js";export{default as useFormatter}from"./react-server/useFormatter.js";export{default as useNow}from"./react-server/useNow.js";export{default as useTimeZone}from"./react-server/useTimeZone.js";export{default as useMessages}from"./react-server/useMessages.js";export{default as NextIntlClientProvider}from"./react-server/NextIntlClientProvider.js";export*from"use-intl/core";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{getHost as t,getNormalizedPathname as e,isLocaleSupportedOnDomain as a,formatTemplatePathname as o}from"./utils.js";function n(t,e){return"<".concat(t,'>; rel="alternate"; hreflang="').concat(e,'"')}function l(l){var r;let{config:c,localizedPathnames:i,request:f,resolvedLocale:p}=l;const s=f.nextUrl.clone(),u=t(f.headers);function m(t,e){return i&&"object"==typeof i?o(t,i[p],i[e]):t}u&&(s.port="",s.host=u),s.protocol=null!==(r=f.headers.get("x-forwarded-proto"))&&void 0!==r?r:s.protocol,s.pathname=e(s.pathname,c.locales);const d=c.locales.flatMap((t=>{function e(e){return"/"===e?"/".concat(t):"/".concat(t).concat(e)}let o;if(c.domains){return(c.domains.filter((e=>a(t,e)))||[]).map((a=>(o=new URL(s),o.port="",o.host=a.domain,o.pathname=m(o.pathname,t),t===a.defaultLocale&&"always"!==c.localePrefix||(o.pathname=e(o.pathname)),n(o.toString(),t))))}{let a;a=i&&"object"==typeof i?m(s.pathname,t):s.pathname,t===c.defaultLocale&&"always"!==c.localePrefix||(a=e(a)),o=new URL(a,s)}return n(o.toString(),t)}));if(!c.domains){const t=new URL(m(s.pathname,c.defaultLocale),s);d.push(n(t.toString(),"x-default"))}return d.join(", ")}export{l as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{NextResponse as e}from"next/server";import{COOKIE_LOCALE_NAME as n,HEADER_LOCALE_NAME as l}from"../shared/constants.js";import{matchesPathname as t}from"../shared/utils.js";import a from"./getAlternateLinksHeaderValue.js";import o from"./resolveLocale.js";import{isLocaleSupportedOnDomain as r,getNormalizedPathname as i,getKnownLocaleFromPathname as s,getInternalTemplate as c,formatTemplatePathname as d,getPathWithSearch as f,getBasePath as u,getBestMatchingDomain as m}from"./utils.js";function v(v){const h=function(e){var n,l,t;return{...e,alternateLinks:null===(n=e.alternateLinks)||void 0===n||n,localePrefix:null!==(l=e.localePrefix)&&void 0!==l?l:"always",localeDetection:null===(t=e.localeDetection)||void 0===t||t}}(v);return function(v){var p,x;const{domain:L,locale:P}=o(h,v.headers,v.cookies,v.nextUrl.pathname),g=(null===(p=v.cookies.get(n))||void 0===p?void 0:p.value)!==P,U=L?L.defaultLocale===P:P===h.defaultLocale,k=(null===(x=h.domains)||void 0===x?void 0:x.filter((e=>r(P,e))))||[],j=null!=h.domains&&!L;function w(n){return e.rewrite(new URL(n,v.url),function(){const e=new Headers(v.headers);return e.set(l,P),{request:{headers:e}}}())}function y(n,l){const t=new URL(n,v.url);if(k.length>0&&!l){const e=m(L,P,k);e&&(l=e.domain,e.defaultLocale===P&&"as-needed"===h.localePrefix&&(t.pathname=t.pathname.replace("/".concat(P),"")))}return l&&(t.host=l),e.redirect(t.toString())}const q=i(v.nextUrl.pathname,h.locales),A=s(v.nextUrl.pathname,h.locales),D=null!=A;let H,R,S=v.nextUrl.pathname;if(h.pathnames){let e;if([e=P,R]=c(h.pathnames,q),R){const n=h.pathnames[R],l="string"==typeof n?n:n[P];if(t(l,q))S=d(q,l,R,A);else{const t=h.defaultLocale===P||(null==L?void 0:L.defaultLocale)===P;H=y(f(d(q,"string"==typeof n?n:n[e],l,A||!t?P:void 0),v.nextUrl.search))}}}if(!H)if("/"===S){const e=f("/".concat(P),v.nextUrl.search);H="never"===h.localePrefix||U&&"as-needed"===h.localePrefix?w(e):y(e)}else{const e=f(S,v.nextUrl.search);if(D){const n=u(e,A);if("never"===h.localePrefix)H=y(n);else if(A===P)if(U&&"as-needed"===h.localePrefix)H=y(n);else if(h.domains){const l=m(L,A,k);H=(null==L?void 0:L.domain)===(null==l?void 0:l.domain)||j?w(e):y(n,null==l?void 0:l.domain)}else H=w(e);else H=y("/".concat(P).concat(n))}else H="never"===h.localePrefix||U&&("as-needed"===h.localePrefix||h.domains)?w("/".concat(P).concat(e)):y("/".concat(P).concat(e))}var z;(g&&H.cookies.set(n,P,{sameSite:"strict",maxAge:31536e3}),"never"!==h.localePrefix&&h.alternateLinks&&h.locales.length>1)&&H.headers.set("Link",a({config:h,localizedPathnames:null!=R?null===(z=h.pathnames)||void 0===z?void 0:z[R]:void 0,request:v,resolvedLocale:P}));return H}}export{v as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{match as t}from"@formatjs/intl-localematcher";import o from"negotiator";import{COOKIE_LOCALE_NAME as e}from"../shared/constants.js";import{getLocaleFromPathname as n,isLocaleSupportedOnDomain as a,getHost as l}from"./utils.js";function c(a,l,c,i){let r,{defaultLocale:s,localeDetection:u,locales:f}=a;if(i){const t=n(i);f.includes(t)&&(r=t)}if(!r&&u&&c&&c.has(e)){var d;const t=null===(d=c.get(e))||void 0===d?void 0:d.value;t&&f.includes(t)&&(r=t)}return!r&&u&&l&&(r=function(e,n,a){let l;const c=new o({headers:{"accept-language":e.get("accept-language")||void 0}}).languages();try{l=t(c,n,a)}catch(t){}return l}(l,f,s)),r||(r=s),r}function i(t,o,e,n){const{domains:i}=t,r=c(t,o,e,n);if(i){const t=function(t,o){var e;let n=l(t);if(n=null===(e=n)||void 0===e?void 0:e.replace(/:\d+$/,""),n&&o)return o.find((t=>t.domain===n))}(o,i),e=n&&n.startsWith("/".concat(r));if(t)return{locale:a(r,t)||e?r:t.defaultLocale,domain:t}}return{locale:r}}function r(t,o,e,n){return t.domains?i(t,o,e,n):{locale:c(t,o,e,n)}}export{r as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{matchesPathname as t,templateToRegex as n}from"../shared/utils.js";function e(t){return t.split("/")[1]}function o(n,e){for(const[o,c]of Object.entries(n))if("string"==typeof c){if(t(c,e))return[void 0,o]}else for(const[n,l]of Object.entries(c))if(t(l,e))return[n,o];return[void 0,void 0]}function c(t,n,e,o){const c=u(n,t);let l="";return o&&(l="/".concat(o)),l+=s(e,c),l.endsWith("/")&&(l=l.slice(0,-1)),l}function l(t,n){t.endsWith("/")||(t+="/");const e=t.match("^/(".concat(n.join("|"),")(.*)"));let o=e?e[2]:t;return o.endsWith("/")&&"/"!==o&&(o=o.slice(0,-1)),o}function r(t,n){const o=e(t);return n.includes(o)?o:void 0}function i(t,n){let e=t.replace("/".concat(n),"");return e.startsWith("/")||(e="/".concat(e)),e}function u(t,e){const o=n(t).exec(e);if(!o)return;const c={};for(let n=1;n<o.length;n++){var l;const e=null===(l=t.match(/\[([^\]]+)\]/g))||void 0===l?void 0:l[n-1].replace(/[[\]]/g,"");e&&(c[e]=o[n])}return c}function s(t,n){if(!n)return t;let e=t=t.replaceAll("[[","[").replaceAll("]]","]");return Object.entries(n).forEach((t=>{let[n,o]=t;e=e.replace("[".concat(n,"]"),o)})),e}function f(t,n){let e=t;return n&&(e+=n),e}function a(t){var n,e;return null!==(n=null!==(e=t.get("x-forwarded-host"))&&void 0!==e?e:t.get("host"))&&void 0!==n?n:void 0}function d(t,n){return n.defaultLocale===t||!n.locales||n.locales.includes(t)}function v(t,n,e){let o;return t&&d(n,t)&&(o=t),o||(o=e.find((t=>t.defaultLocale===n))),o||(o=e.find((t=>null!=t.locales&&t.locales.includes(n)))),o||null!=(null==t?void 0:t.locales)||(o=t),o||(o=e.find((t=>!t.locales))),o}export{s as formatPathname,c as formatTemplatePathname,i as getBasePath,v as getBestMatchingDomain,a as getHost,o as getInternalTemplate,r as getKnownLocaleFromPathname,e as getLocaleFromPathname,l as getNormalizedPathname,f as getPathWithSearch,u as getRouteParams,d as isLocaleSupportedOnDomain};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{default}from"./middleware/middleware.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{extends as e}from"../_virtual/_rollupPluginBabelHelpers.js";import r,{forwardRef as t}from"react";import a from"../react-client/useLocale.js";import l from"../shared/BaseLinkWithLocale.js";function o(t,o){let{locale:s,...i}=t;const n=a(),c=s||n;return r.createElement(l,e({ref:o,hrefLang:c,locale:c},i))}const s=t(o);s.displayName="Link";var i=s;export{i as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import r from"../react-client/useLocale.js";import e from"../shared/redirectWithLocale.js";function t(t){let n;try{n=r()}catch(r){throw new Error("`redirect()` can only be called during render. To redirect in an event handler or similar, you can use `useRouter()` instead.")}for(var a=arguments.length,o=new Array(a>1?a-1:0),c=1;c<a;c++)o[c-1]=arguments[c];return e(t,n,...o)}export{t as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{extends as e}from"../_virtual/_rollupPluginBabelHelpers.js";import r,{forwardRef as t}from"react";import o from"../react-client/useLocale.js";import a from"./BaseLink.js";import n from"./baseRedirect.js";import l from"./useBasePathname.js";import c from"./useBaseRouter.js";import{getRoute as s,compileLocalizedPathname as u,normalizeNameOrNameWithParams as i}from"./utils.js";function f(f){let{locales:m,pathnames:p}=f;function h(){const e=o();if(!m.includes(e))throw new Error('Unknown locale encountered: "'.concat(e,'". Make sure to validate the locale in `app/[locale]/layout.tsx`.'));return e}function d(t,o){let{href:n,locale:l,...c}=t;const s=h(),i=l||s;return r.createElement(a,e({ref:o,href:u({locale:i,pathname:n,params:"object"==typeof n?n.params:void 0,pathnames:p}),locale:l},c))}const v=t(d);function j(e){let{href:r,locale:t}=e;return u({...i(r),locale:t,pathnames:p})}return v.displayName="Link",{Link:v,redirect:function(e){const r=j({href:e,locale:h()});for(var t=arguments.length,o=new Array(t>1?t-1:0),a=1;a<t;a++)o[a-1]=arguments[a];return n(r,...o)},usePathname:function(){const e=l(),r=h();return s({pathname:e,locale:r,pathnames:p})},useRouter:function(){const e=c(),r=h();return{...e,push(t){for(var o,a=arguments.length,n=new Array(a>1?a-1:0),l=1;l<a;l++)n[l-1]=arguments[l];const c=j({href:t,locale:(null===(o=n[0])||void 0===o?void 0:o.locale)||r});return e.push(c,...n)},replace(t){for(var o,a=arguments.length,n=new Array(a>1?a-1:0),l=1;l<a;l++)n[l-1]=arguments[l];const c=j({href:t,locale:(null===(o=n[0])||void 0===o?void 0:o.locale)||r});return e.replace(c,...n)},prefetch(t){for(var o,a=arguments.length,n=new Array(a>1?a-1:0),l=1;l<a;l++)n[l-1]=arguments[l];const c=j({href:t,locale:(null===(o=n[0])||void 0===o?void 0:o.locale)||r});return e.prefetch(c,...n)}}},getPathname:j}}export{f as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import e from"./BaseLink.js";import r from"./baseRedirect.js";import t from"./useBasePathname.js";import s from"./useBaseRouter.js";function o(o){return{Link:e,redirect:r,usePathname:t,useRouter:s}}export{o as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{extends as e}from"../../_virtual/_rollupPluginBabelHelpers.js";import r from"react";import t from"../../react-server/useLocale.js";import o from"../../shared/BaseLinkWithLocale.js";function l(l){let{locale:a,...s}=l;const c=t();return r.createElement(o,e({locale:a||c},s))}export{l as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{getRequestLocale as r}from"../../server/RequestLocale.js";import e from"../../shared/redirectWithLocale.js";function t(t){const o=r();for(var a=arguments.length,s=new Array(a>1?a-1:0),n=1;n<a;n++)s[n-1]=arguments[n];return e(t,o,...s)}export{t as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{extends as e}from"../../_virtual/_rollupPluginBabelHelpers.js";import t from"react";import{getRequestLocale as r}from"../../server/RequestLocale.js";import{compileLocalizedPathname as o,normalizeNameOrNameWithParams as n}from"../utils.js";import a from"./BaseLink.js";import s from"./baseRedirect.js";function l(l){let{locales:u,pathnames:c}=l;function m(e){let{href:t,locale:r}=e;return o({...n(t),locale:r,pathnames:c})}function i(e){return()=>{throw new Error("`".concat(e,"` is not supported in Server Components. You can use this hook if you convert the component to a Client Component."))}}return{Link:function(n){let{href:s,locale:l,...u}=n;const m=r(),i=l||m;return t.createElement(a,e({href:o({locale:i,pathname:s,params:"object"==typeof s?s.params:void 0,pathnames:c}),locale:l},u))},redirect:function(e){const t=m({href:e,locale:r()});for(var o=arguments.length,n=new Array(o>1?o-1:0),a=1;a<o;a++)n[a-1]=arguments[a];return s(t,...n)},getPathname:m,usePathname:i("usePathname"),useRouter:i("useRouter")}}export{l as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import e from"./BaseLink.js";import o from"./baseRedirect.js";function t(t){function n(e){return()=>{throw new Error("`".concat(e,"` is not supported in Server Components. You can use this hook if you convert the component to a Client Component."))}}return{Link:e,redirect:o,usePathname:n("usePathname"),useRouter:n("useRouter")}}export{t as default};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import{usePathname as r}from"next/navigation";import{useMemo as t}from"react";import o from"../react-client/useLocale.js";import{hasPathnamePrefixed as e,unlocalizePathname as i}from"../shared/utils.js";function n(){const n=r(),a=o();return t((()=>{if(!n)return n;return e(a,n)?i(n,a):n}),[a,n])}export{n as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{useRouter as e}from"next/navigation";import{useMemo as t}from"react";import r from"../react-client/useLocale.js";import{localizeHref as n}from"../shared/utils.js";function o(){const o=e(),c=r();return t((()=>{function e(e,t){return n(e,t||c,c,window.location.pathname)}return{...o,push(t,r){const{locale:n,...c}=r||{},s=[e(t,n)];return Object.keys(c).length>0&&s.push(c),o.push(...s)},replace(t,r){const{locale:n,...c}=r||{},s=[e(t,n)];return Object.keys(c).length>0&&s.push(c),o.replace(...s)},prefetch(t,r){const{locale:n,...c}=r||{},s=[e(t,n)];return Object.keys(c).length>0&&s.push(c),o.prefetch(...s)}}}),[c,o])}export{o as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{unlocalizePathname as t,matchesPathname as n}from"../shared/utils.js";function r(t){return"string"==typeof t?{pathname:t}:t}function e(t){function n(t){return String(t)}const r=new URLSearchParams;for(const[e,a]of Object.entries(t))Array.isArray(a)?a.forEach((t=>{r.append(e,n(t))})):r.set(e,n(a));return"?"+r.toString()}function a(t){let{pathname:n,locale:r,params:a,pathnames:o,query:i}=t;function c(t){let n=o[t];return n||(n=t),n}function s(t){const n="string"==typeof t?t:t[r];let o=n;if(a&&Object.entries(a).forEach((t=>{let[n,r]=t;o=Array.isArray(r)?o.replace(new RegExp("(\\[)?\\[...".concat(n,"\\](\\])?"),"g"),r.map((t=>String(t))).join("/")):o.replace("[".concat(n,"]"),String(r))})),o.includes("["))throw new Error("Insufficient params provided for localized pathname.\nTemplate: ".concat(n,"\nParams: ").concat(JSON.stringify(a)));return i&&(o+=e(i)),o}if("string"==typeof n){return s(c(n))}{const{pathname:t,...r}=n;return{...r,pathname:s(c(t))}}}function o(r){var e;let{locale:a,pathname:o,pathnames:i}=r;const c=t(o,a);let s=null===(e=Object.entries(i).find((t=>{let[,r]=t;const e="string"!=typeof r?r[a]:r;return n(e,c)})))||void 0===e?void 0:e[0];return s||(s=o),s}export{a as compileLocalizedPathname,o as getRoute,r as normalizeNameOrNameWithParams,e as serializeSearchParams};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{default as createSharedPathnamesNavigation}from"./navigation/createSharedPathnamesNavigation.js";export{default as createLocalizedPathnamesNavigation}from"./navigation/createLocalizedPathnamesNavigation.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{default as createSharedPathnamesNavigation}from"./navigation/react-server/createSharedPathnamesNavigation.js";export{default as createLocalizedPathnamesNavigation}from"./navigation/react-server/createLocalizedPathnamesNavigation.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import n from"fs";import e from"path";function t(t,o){return null!=(null==o?void 0:o.i18n)&&console.warn("\nnext-intl has found an `i18n` config in your next.config.js. 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` folder, you can refer to this example: https://github.com/amannn/next-intl/tree/feat/next-13-rsc/packages/example-next-13-with-pages\n"),Object.assign({},o,{webpack(){for(var i=arguments.length,r=new Array(i),s=0;s<i;s++)r[s]=arguments[s];let[a,l]=r;return a.resolve.alias["next-intl/config"]=require.resolve(function(t,o){let i=o;if(i){if(i=e.resolve(i),!n.existsSync(i))throw new Error("Could not find i18n config at ".concat(i,", please provide a valid path."))}else if(i=["./i18n.tsx","./i18n.ts","./i18n.js","./i18n.jsx","./src/i18n.tsx","./src/i18n.ts","./src/i18n.js","./src/i18n.jsx"].map((n=>e.resolve(t,n))).find((e=>n.existsSync(e))),!i)throw new Error("\n\nCould not locate i18n config. Create one at `./(src/)i18n.{js,jsx,ts,tsx}` or specify a custom location:\n\nconst withNextIntl = require('next-intl/plugin')(\n './path/to/i18n.tsx'\n);\n\nmodule.exports = withNextIntl({\n // Other Next.js configuration ...\n});\n");return i}(a.context,t)),"function"==typeof(null==o?void 0:o.webpack)?o.webpack(a,l):a}})}module.exports=function(n){return e=>t(n,e)};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{useTranslations as e,useFormatter as t}from"use-intl";export*from"use-intl";function n(e,t){return function(){try{return t(...arguments)}catch(t){throw new Error("Failed to call `".concat(e,"` because the context from `NextIntlClientProvider` was not found.\n\nThis can happen because:\n1) You intended to render this component as a Server Component, the render\n failed, and therefore React attempted to render the component on the client\n instead. If this is the case, check the console for server errors.\n2) You intended to render this component on the client side, but no context was found.\n Learn more about this error here: https://next-intl-docs.vercel.app/docs/environments/server-client-components#missing-context"))}}}const o=n("useTranslations",e),r=n("useFormatter",t);export{r as useFormatter,o as useTranslations};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{useParams as t}from"next/navigation";import{useLocale as o}from"use-intl/_useLocale";import{LOCALE_SEGMENT_NAME as e}from"../shared/constants.js";function n(){let n;const r=t();return n="string"==typeof(null==r?void 0:r[e])?r[e]:o(),n}export{n as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{extends as e}from"../_virtual/_rollupPluginBabelHelpers.js";import o from"react";import r from"../shared/NextIntlClientProvider.js";import l from"./useLocale.js";import t from"./useNow.js";import n from"./useTimeZone.js";function m(m){let{locale:i,now:s,timeZone:u,...a}=m;const p=l(),f=t(),c=n();return o.createElement(r,e({locale:null!=i?i:p,now:null!=s?s:f,timeZone:null!=u?u:c},a))}export{m as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{cache as e}from"react";import{createTranslator as s}from"use-intl/core";import a from"../server/getConfig.js";const r=e((()=>new Map));var t=e((async function(e,t){const o=await a(e);return s({...o,messageFormatCache:r(),namespace:t,messages:o.messages})}));export{t as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import r from"../server/getFormatter.js";import o from"./useHook.js";import e from"./useLocale.js";function t(){for(var t=arguments.length,s=new Array(t),a=0;a<t;a++)s[a]=arguments[a];const m=e();return o("useFormatter",r({locale:m}))}export{t as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{use as e}from"react";function n(n,t){try{return e(t)}catch(e){throw e instanceof TypeError&&e.message.includes("Cannot read properties of null (reading 'use')")?new Error("`".concat(n,"` is not callable within an async component. Please refer to https://next-intl-docs.vercel.app/docs/environments/server-client-components#async-components"),{cause:e}):e}}export{n as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{getRequestLocale as r}from"../server/RequestLocale.js";function e(){for(var e=arguments.length,t=new Array(e),o=0;o<e;o++)t[o]=arguments[o];return r()}export{e as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import e from"../server/getMessages.js";import r from"./useHook.js";import s from"./useLocale.js";function o(){for(var o=arguments.length,t=new Array(o),a=0;a<o;a++)t[a]=arguments[a];const f=s();return r("useMessages",e({locale:f}))}export{o as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import e from"../server/getNow.js";import o from"./useHook.js";import t from"./useLocale.js";function n(){for(var n=arguments.length,r=new Array(n),l=0;l<n;l++)r[l]=arguments[l];let[u]=r;null!=(null==u?void 0:u.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.");const a=t();return o("useNow",e({locale:a}))}export{n as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import e from"../server/getTimeZone.js";import o from"./useHook.js";import r from"./useLocale.js";function t(){for(var t=arguments.length,s=new Array(t),m=0;m<t;m++)s[m]=arguments[m];const n=r();return o("useTimeZone",e({locale:n}))}export{t as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import r from"./getBaseTranslator.js";import o from"./useHook.js";import t from"./useLocale.js";function e(){for(var e=arguments.length,s=new Array(e),a=0;a<e;a++)s[a]=arguments[a];let[n]=s;const f=t();return o("useTranslations",r(f,n))}export{e as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{headers as e}from"next/headers";import{cache as t}from"react";import{HEADER_LOCALE_NAME as n}from"../shared/constants.js";const r=t((()=>{let t;try{t=e().get(n)}catch(e){throw e instanceof Error&&"DYNAMIC_SERVER_USAGE"===e.digest?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 `unstable_setRequestLocale` API to enable static rendering, see https://next-intl-docs.vercel.app/docs/getting-started/app-router-server-components#static-rendering",{cause:e}):e}if(!t)throw new Error("Unable to find `next-intl` locale because the middleware didn't run on this request. See https://next-intl-docs.vercel.app/docs/routing/middleware#unable-to-find-locale");return t})),o=t((()=>({locale:void 0})));function i(e){o().locale=e}function s(){return o().locale||r()}export{s as getRequestLocale,i as setRequestLocale};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import t from"next-intl/config";export{default}from"next-intl/config";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{cache as o}from"react";import{initializeConfig as e}from"use-intl/core";import t from"next-intl/config";const n=o((()=>new Date)),i=o((()=>Intl.DateTimeFormat().resolvedOptions().timeZone)),r=o((async(o,e)=>{var t,r;let a=null==e?void 0:e({locale:o});return a instanceof Promise&&(a=await a),{...a,now:(null===(t=a)||void 0===t?void 0:t.now)||n(),timeZone:(null===(r=a)||void 0===r?void 0:r.timeZone)||i()}}));var a=o((async o=>{const n={...await r(o,t),locale:o};return e(n)}));export{a as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{cache as o}from"react";import{createFormatter as r}from"use-intl/core";import t from"./getConfig.js";import e from"./resolveLocaleArg.js";const n=o((async o=>{const e=await t(o);return r(e)}));async function a(o){const r=await e(o);return n(r)}export{a as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{getRequestLocale as e}from"./RequestLocale.js";function o(){return Promise.resolve(e())}export{o as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{cache as e}from"react";import o from"./getConfig.js";import s from"./resolveLocaleArg.js";const r=e((async e=>{const s=await o(e);if(!s.messages)throw new Error("No messages found. Have you configured them correctly? See https://next-intl-docs.vercel.app/docs/configuration#messages");return s.messages}));async function t(e){const o=await s(e);return r(o)}export{t as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{cache as o}from"react";import t from"./getConfig.js";import r from"./resolveLocaleArg.js";const a=o((async o=>(await t(o)).now));async function n(o){const t=await r(o);return a(t)}export{n as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function t(t){return t}export{t as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{cache as o}from"react";import t from"./getConfig.js";import r from"./resolveLocaleArg.js";const a=o((async o=>(await t(o)).timeZone));async function e(o){const t=await r(o);return a(t)}export{e as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{cache as e}from"react";import{createTranslator as t}from"use-intl/core";import a from"./getConfig.js";import o from"./getLocale.js";var r=e((async function(e){let r,s;"string"==typeof e?r=e:e&&(s=e.locale,r=e.namespace);const m=await a(s||await o());return t({...m,namespace:r,messages:m.messages})}));export{r as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import e from"./getLocale.js";function l(l){return null!=l&&l.locale?Promise.resolve(l.locale):e()}export{l as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{default as getRequestConfig}from"./server/getRequestConfig.js";export{default as getFormatter}from"./server/getFormatter.js";export{default as getNow}from"./server/getNow.js";export{default as getTimeZone}from"./server/getTimeZone.js";export{default as getTranslations}from"./server/getTranslations.js";export{default as getMessages}from"./server/getMessages.js";export{default as getLocale}from"./server/getLocale.js";export{setRequestLocale as unstable_setRequestLocale}from"./server/RequestLocale.js";
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import{extends as e}from"../_virtual/_rollupPluginBabelHelpers.js";import r from"next/link";import{usePathname as t}from"next/navigation";import o,{forwardRef as l,useState as n,useEffect as i}from"react";import p from"../react-client/useLocale.js";import{isLocalHref as c,prefixHref as a,localizeHref as s}from"./utils.js";function f(l,f){let{href:m,locale:u,prefetch:h,...d}=l;const v=t(),x=p(),g=u!==x,[j,k]=n((()=>c(m)&&u?a(m,u):m));return i((()=>{v&&k(s(m,u,x,null!=v?v:void 0))}),[x,m,u,v]),g&&(h&&console.error("The `prefetch` prop is currently not supported when using the `locale` prop on `Link` to switch the locale.`"),h=!1),o.createElement(r,e({ref:f,href:j,prefetch:h},d))}var m=l(f);export{m as default};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import{extends as e}from"../_virtual/_rollupPluginBabelHelpers.js";import l from"react";import{IntlProvider as t}from"use-intl/_IntlProvider";function r(r){let{locale:o,...i}=r;if(!o)throw new Error("Failed to determine locale in `NextIntlClientProvider`, please provide the `locale` prop explicitly.\n\nSee https://next-intl-docs.vercel.app/docs/configuration#locale");return l.createElement(t,e({locale:o},i))}export{r as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const L="NEXT_LOCALE",E="X-NEXT-INTL-LOCALE",o="locale";export{L as COOKIE_LOCALE_NAME,E as HEADER_LOCALE_NAME,o as LOCALE_SEGMENT_NAME};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{redirect as r}from"next/navigation";import{localizePathname as t}from"./utils.js";function n(n,o){const a=t(o,n);for(var e=arguments.length,i=new Array(e>2?e-2:0),f=2;f<e;f++)i[f-2]=arguments[f];return r(a,...i)}export{n as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function t(t){const n="object"==typeof t?t.pathname:t;return null!=n&&!n.startsWith("/")}function n(t){if("object"==typeof t)return null==t.host&&null==t.hostname;return!/^[a-z]+:/i.test(t)}function e(e,c){let o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:c,a=arguments.length>3?arguments[3]:void 0;if(!n(e)||t(e))return e;const l=c!==o;return(null==c||u(c,a)||l)&&null!=c?r(e,c):e}function r(t,n){let e;return"string"==typeof t?e=o(n,t):(e={...t},t.pathname&&(e.pathname=o(n,t.pathname))),e}function c(t,n){return t.replace(new RegExp("^/".concat(n)),"")||"/"}function o(t,n){let e="/"+t;return/^\/(\?.*)?$/.test(n)&&(n=n.slice(1)),e+=n,e}function u(t,n){const e="/".concat(t);return n===e||n.startsWith("".concat(e,"/"))}function a(t,n){return l(t).test(n)}function l(t){const n=t.replace(/\[([^\]]+)\]/g,(t=>t.startsWith("[...")||t.startsWith("[[...")?"(.*)":"([^/]+)")).replaceAll("(.*)]","(.*)");return new RegExp("^".concat(n,"$"))}export{u as hasPathnamePrefixed,n as isLocalHref,t as isRelativeHref,e as localizeHref,o as localizePathname,a as matchesPathname,r as prefixHref,l as templateToRegex,c as unlocalizePathname};
|
package/dist/index.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
'use strict'
|
|
1
|
+
'use strict';
|
|
3
2
|
|
|
4
3
|
if (process.env.NODE_ENV === 'production') {
|
|
5
|
-
module.exports = require('./
|
|
4
|
+
module.exports = require('./production/index.js');
|
|
6
5
|
} else {
|
|
7
|
-
module.exports = require('./
|
|
6
|
+
module.exports = require('./development/index.js');
|
|
8
7
|
}
|
package/dist/plugin.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";function e(){return e=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},e.apply(this,arguments)}Object.defineProperty(exports,"__esModule",{value:!0}),exports.extends=e;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=function(){throw new Error("Couldn't find next-intl config file. Please follow the instructions at https://next-intl-docs.vercel.app/docs/getting-started/app-router-server-components")};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("./react-client/index.js"),t=require("./react-client/useLocale.js"),r=require("./shared/NextIntlClientProvider.js"),s=require("use-intl");exports.useFormatter=e.useFormatter,exports.useTranslations=e.useTranslations,exports.useLocale=t.default,exports.NextIntlClientProvider=r.default,Object.keys(s).forEach((function(e){"default"===e||Object.prototype.hasOwnProperty.call(exports,e)||Object.defineProperty(exports,e,{enumerable:!0,get:function(){return s[e]}})}));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("./react-server/useLocale.js"),r=require("./react-server/useTranslations.js"),t=require("./react-server/useFormatter.js"),s=require("./react-server/useNow.js"),u=require("./react-server/useTimeZone.js"),o=require("./react-server/useMessages.js"),a=require("./react-server/NextIntlClientProvider.js"),i=require("use-intl/core");exports.useLocale=e.default,exports.useTranslations=r.default,exports.useFormatter=t.default,exports.useNow=s.default,exports.useTimeZone=u.default,exports.useMessages=o.default,exports.NextIntlClientProvider=a.default,Object.keys(i).forEach((function(e){"default"===e||Object.prototype.hasOwnProperty.call(exports,e)||Object.defineProperty(exports,e,{enumerable:!0,get:function(){return i[e]}})}));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("./utils.js");function t(e,t){return"<".concat(e,'>; rel="alternate"; hreflang="').concat(t,'"')}exports.default=function(a){var o;let{config:n,localizedPathnames:r,request:l,resolvedLocale:c}=a;const i=l.nextUrl.clone(),s=e.getHost(l.headers);function p(t,a){return r&&"object"==typeof r?e.formatTemplatePathname(t,r[c],r[a]):t}s&&(i.port="",i.host=s),i.protocol=null!==(o=l.headers.get("x-forwarded-proto"))&&void 0!==o?o:i.protocol,i.pathname=e.getNormalizedPathname(i.pathname,n.locales);const u=n.locales.flatMap((a=>{function o(e){return"/"===e?"/".concat(a):"/".concat(a).concat(e)}let l;if(n.domains){return(n.domains.filter((t=>e.isLocaleSupportedOnDomain(a,t)))||[]).map((e=>(l=new URL(i),l.port="",l.host=e.domain,l.pathname=p(l.pathname,a),a===e.defaultLocale&&"always"!==n.localePrefix||(l.pathname=o(l.pathname)),t(l.toString(),a))))}{let e;e=r&&"object"==typeof r?p(i.pathname,a):i.pathname,a===n.defaultLocale&&"always"!==n.localePrefix||(e=o(e)),l=new URL(e,i)}return t(l.toString(),a)}));if(!n.domains){const e=new URL(p(i.pathname,n.defaultLocale),i);u.push(t(e.toString(),"x-default"))}return u.join(", ")};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("next/server"),t=require("../shared/constants.js"),a=require("../shared/utils.js"),n=require("./getAlternateLinksHeaderValue.js"),l=require("./resolveLocale.js"),o=require("./utils.js");exports.default=function(r){const i=function(e){var t,a,n;return{...e,alternateLinks:null===(t=e.alternateLinks)||void 0===t||t,localePrefix:null!==(a=e.localePrefix)&&void 0!==a?a:"always",localeDetection:null===(n=e.localeDetection)||void 0===n||n}}(r);return function(r){var s,c;const{domain:d,locale:u}=l.default(i,r.headers,r.cookies,r.nextUrl.pathname),f=(null===(s=r.cookies.get(t.COOKIE_LOCALE_NAME))||void 0===s?void 0:s.value)!==u,h=d?d.defaultLocale===u:u===i.defaultLocale,m=(null===(c=i.domains)||void 0===c?void 0:c.filter((e=>o.isLocaleSupportedOnDomain(u,e))))||[],v=null!=i.domains&&!d;function p(a){return e.NextResponse.rewrite(new URL(a,r.url),function(){const e=new Headers(r.headers);return e.set(t.HEADER_LOCALE_NAME,u),{request:{headers:e}}}())}function x(t,a){const n=new URL(t,r.url);if(m.length>0&&!a){const e=o.getBestMatchingDomain(d,u,m);e&&(a=e.domain,e.defaultLocale===u&&"as-needed"===i.localePrefix&&(n.pathname=n.pathname.replace("/".concat(u),"")))}return a&&(n.host=a),e.NextResponse.redirect(n.toString())}const L=o.getNormalizedPathname(r.nextUrl.pathname,i.locales),P=o.getKnownLocaleFromPathname(r.nextUrl.pathname,i.locales),g=null!=P;let E,A,O=r.nextUrl.pathname;if(i.pathnames){let e;if([e=u,A]=o.getInternalTemplate(i.pathnames,L),A){const t=i.pathnames[A],n="string"==typeof t?t:t[u];if(a.matchesPathname(n,L))O=o.formatTemplatePathname(L,n,A,P);else{const a=i.defaultLocale===u||(null==d?void 0:d.defaultLocale)===u;E=x(o.getPathWithSearch(o.formatTemplatePathname(L,"string"==typeof t?t:t[e],n,P||!a?u:void 0),r.nextUrl.search))}}}if(!E)if("/"===O){const e=o.getPathWithSearch("/".concat(u),r.nextUrl.search);E="never"===i.localePrefix||h&&"as-needed"===i.localePrefix?p(e):x(e)}else{const e=o.getPathWithSearch(O,r.nextUrl.search);if(g){const t=o.getBasePath(e,P);if("never"===i.localePrefix)E=x(t);else if(P===u)if(h&&"as-needed"===i.localePrefix)E=x(t);else if(i.domains){const a=o.getBestMatchingDomain(d,P,m);E=(null==d?void 0:d.domain)===(null==a?void 0:a.domain)||v?p(e):x(t,null==a?void 0:a.domain)}else E=p(e);else E=x("/".concat(u).concat(t))}else E="never"===i.localePrefix||h&&("as-needed"===i.localePrefix||i.domains)?p("/".concat(u).concat(e)):x("/".concat(u).concat(e))}var U;(f&&E.cookies.set(t.COOKIE_LOCALE_NAME,u,{sameSite:"strict",maxAge:31536e3}),"never"!==i.localePrefix&&i.alternateLinks&&i.locales.length>1)&&E.headers.set("Link",n.default({config:i,localizedPathnames:null!=A?null===(U=i.pathnames)||void 0===U?void 0:U[A]:void 0,request:r,resolvedLocale:u}));return E}};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@formatjs/intl-localematcher"),t=require("negotiator"),a=require("../shared/constants.js"),n=require("./utils.js");function o(e){return e&&e.__esModule?e:{default:e}}var r=o(t);function l(t,o,l,c){let i,{defaultLocale:u,localeDetection:s,locales:d}=t;if(c){const e=n.getLocaleFromPathname(c);d.includes(e)&&(i=e)}if(!i&&s&&l&&l.has(a.COOKIE_LOCALE_NAME)){var f;const e=null===(f=l.get(a.COOKIE_LOCALE_NAME))||void 0===f?void 0:f.value;e&&d.includes(e)&&(i=e)}return!i&&s&&o&&(i=function(t,a,n){let o;const l=new r.default({headers:{"accept-language":t.get("accept-language")||void 0}}).languages();try{o=e.match(l,a,n)}catch(e){}return o}(o,d,u)),i||(i=u),i}function c(e,t,a,o){const{domains:r}=e,c=l(e,t,a,o);if(r){const e=function(e,t){var a;let o=n.getHost(e);if(o=null===(a=o)||void 0===a?void 0:a.replace(/:\d+$/,""),o&&t)return t.find((e=>e.domain===o))}(t,r),a=o&&o.startsWith("/".concat(c));if(e)return{locale:n.isLocaleSupportedOnDomain(c,e)||a?c:e.defaultLocale,domain:e}}return{locale:c}}exports.default=function(e,t,a,n){return e.domains?c(e,t,a,n):{locale:l(e,t,a,n)}};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../shared/utils.js");function t(e){return e.split("/")[1]}function n(t,n){const o=e.templateToRegex(t).exec(n);if(!o)return;const r={};for(let e=1;e<o.length;e++){var a;const n=null===(a=t.match(/\[([^\]]+)\]/g))||void 0===a?void 0:a[e-1].replace(/[[\]]/g,"");n&&(r[n]=o[e])}return r}function o(e,t){if(!t)return e;let n=e=e.replaceAll("[[","[").replaceAll("]]","]");return Object.entries(t).forEach((e=>{let[t,o]=e;n=n.replace("[".concat(t,"]"),o)})),n}function r(e,t){return t.defaultLocale===e||!t.locales||t.locales.includes(e)}exports.formatPathname=o,exports.formatTemplatePathname=function(e,t,r,a){const c=n(t,e);let l="";return a&&(l="/".concat(a)),l+=o(r,c),l.endsWith("/")&&(l=l.slice(0,-1)),l},exports.getBasePath=function(e,t){let n=e.replace("/".concat(t),"");return n.startsWith("/")||(n="/".concat(n)),n},exports.getBestMatchingDomain=function(e,t,n){let o;return e&&r(t,e)&&(o=e),o||(o=n.find((e=>e.defaultLocale===t))),o||(o=n.find((e=>null!=e.locales&&e.locales.includes(t)))),o||null!=(null==e?void 0:e.locales)||(o=e),o||(o=n.find((e=>!e.locales))),o},exports.getHost=function(e){var t,n;return null!==(t=null!==(n=e.get("x-forwarded-host"))&&void 0!==n?n:e.get("host"))&&void 0!==t?t:void 0},exports.getInternalTemplate=function(t,n){for(const[o,r]of Object.entries(t))if("string"==typeof r){const t=r;if(e.matchesPathname(t,n))return[void 0,o]}else for(const[t,a]of Object.entries(r))if(e.matchesPathname(a,n))return[t,o];return[void 0,void 0]},exports.getKnownLocaleFromPathname=function(e,n){const o=t(e);return n.includes(o)?o:void 0},exports.getLocaleFromPathname=t,exports.getNormalizedPathname=function(e,t){e.endsWith("/")||(e+="/");const n=e.match("^/(".concat(t.join("|"),")(.*)"));let o=n?n[2]:e;return o.endsWith("/")&&"/"!==o&&(o=o.slice(0,-1)),o},exports.getPathWithSearch=function(e,t){let n=e;return t&&(n+=t),n},exports.getRouteParams=n,exports.isLocaleSupportedOnDomain=r;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("./middleware/middleware.js");exports.default=e.default;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../_virtual/_rollupPluginBabelHelpers.js"),r=require("react"),t=require("../react-client/useLocale.js"),a=require("../shared/BaseLinkWithLocale.js");function l(e){return e&&e.__esModule?e:{default:e}}var u=l(r);function s(r,l){let{locale:s,...n}=r;const i=t.default(),o=s||i;return u.default.createElement(a.default,e.extends({ref:l,hrefLang:o,locale:o},n))}const n=r.forwardRef(s);n.displayName="Link";var i=n;exports.default=i;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../react-client/useLocale.js"),r=require("../shared/redirectWithLocale.js");exports.default=function(t){let a;try{a=e.default()}catch(e){throw new Error(void 0)}for(var o=arguments.length,u=new Array(o>1?o-1:0),c=1;c<o;c++)u[c-1]=arguments[c];return r.default(t,a,...u)};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../_virtual/_rollupPluginBabelHelpers.js"),r=require("react"),a=require("../react-client/useLocale.js"),t=require("./BaseLink.js"),l=require("./baseRedirect.js"),n=require("./useBasePathname.js"),o=require("./useBaseRouter.js"),u=require("./utils.js");function c(e){return e&&e.__esModule?e:{default:e}}var s=c(r);exports.default=function(c){let{locales:i,pathnames:f}=c;function h(){const e=a.default();if(!i.includes(e))throw new Error(void 0);return e}function d(r,a){let{href:l,locale:n,...o}=r;const c=h(),i=n||c;return s.default.createElement(t.default,e.extends({ref:a,href:u.compileLocalizedPathname({locale:i,pathname:l,params:"object"==typeof l?l.params:void 0,pathnames:f}),locale:n},o))}const p=r.forwardRef(d);function m(e){let{href:r,locale:a}=e;return u.compileLocalizedPathname({...u.normalizeNameOrNameWithParams(r),locale:a,pathnames:f})}return p.displayName="Link",{Link:p,redirect:function(e){const r=m({href:e,locale:h()});for(var a=arguments.length,t=new Array(a>1?a-1:0),n=1;n<a;n++)t[n-1]=arguments[n];return l.default(r,...t)},usePathname:function(){const e=n.default(),r=h();return u.getRoute({pathname:e,locale:r,pathnames:f})},useRouter:function(){const e=o.default(),r=h();return{...e,push(a){for(var t,l=arguments.length,n=new Array(l>1?l-1:0),o=1;o<l;o++)n[o-1]=arguments[o];const u=m({href:a,locale:(null===(t=n[0])||void 0===t?void 0:t.locale)||r});return e.push(u,...n)},replace(a){for(var t,l=arguments.length,n=new Array(l>1?l-1:0),o=1;o<l;o++)n[o-1]=arguments[o];const u=m({href:a,locale:(null===(t=n[0])||void 0===t?void 0:t.locale)||r});return e.replace(u,...n)},prefetch(a){for(var t,l=arguments.length,n=new Array(l>1?l-1:0),o=1;o<l;o++)n[o-1]=arguments[o];const u=m({href:a,locale:(null===(t=n[0])||void 0===t?void 0:t.locale)||r});return e.prefetch(u,...n)}}},getPathname:m}};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("./BaseLink.js"),r=require("./baseRedirect.js"),u=require("./useBasePathname.js"),t=require("./useBaseRouter.js");exports.default=function(s){return{Link:e.default,redirect:r.default,usePathname:u.default,useRouter:t.default}};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../_virtual/_rollupPluginBabelHelpers.js"),r=require("react"),t=require("../../react-server/useLocale.js"),l=require("../../shared/BaseLinkWithLocale.js");function u(e){return e&&e.__esModule?e:{default:e}}var a=u(r);exports.default=function(r){let{locale:u,...s}=r;const o=t.default();return a.default.createElement(l.default,e.extends({locale:u||o},s))};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../server/RequestLocale.js"),r=require("../../shared/redirectWithLocale.js");exports.default=function(t){const s=e.getRequestLocale();for(var u=arguments.length,a=new Array(u>1?u-1:0),o=1;o<u;o++)a[o-1]=arguments[o];return r.default(t,s,...a)};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../_virtual/_rollupPluginBabelHelpers.js"),t=require("react"),r=require("../../server/RequestLocale.js"),a=require("../utils.js"),o=require("./BaseLink.js"),n=require("./baseRedirect.js");function u(e){return e&&e.__esModule?e:{default:e}}var l=u(t);exports.default=function(t){let{locales:u,pathnames:s}=t;function c(e){let{href:t,locale:r}=e;return a.compileLocalizedPathname({...a.normalizeNameOrNameWithParams(t),locale:r,pathnames:s})}function i(e){return()=>{throw new Error("`".concat(e,"` is not supported in Server Components. You can use this hook if you convert the component to a Client Component."))}}return{Link:function(t){let{href:n,locale:u,...c}=t;const i=r.getRequestLocale(),m=u||i;return l.default.createElement(o.default,e.extends({href:a.compileLocalizedPathname({locale:m,pathname:n,params:"object"==typeof n?n.params:void 0,pathnames:s}),locale:u},c))},redirect:function(e){const t=c({href:e,locale:r.getRequestLocale()});for(var a=arguments.length,o=new Array(a>1?a-1:0),u=1;u<a;u++)o[u-1]=arguments[u];return n.default(t,...o)},getPathname:c,usePathname:i("usePathname"),useRouter:i("useRouter")}};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("./BaseLink.js"),t=require("./baseRedirect.js");exports.default=function(r){function o(e){return()=>{throw new Error("`".concat(e,"` is not supported in Server Components. You can use this hook if you convert the component to a Client Component."))}}return{Link:e.default,redirect:t.default,usePathname:o("usePathname"),useRouter:o("useRouter")}};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("next/navigation"),r=require("react"),t=require("../react-client/useLocale.js"),a=require("../shared/utils.js");exports.default=function(){const u=e.usePathname(),n=t.default();return r.useMemo((()=>{if(!u)return u;return a.hasPathnamePrefixed(n,u)?a.unlocalizePathname(u,n):u}),[n,u])};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("next/navigation"),t=require("react"),r=require("../react-client/useLocale.js"),u=require("../shared/utils.js");exports.default=function(){const n=e.useRouter(),c=r.default();return t.useMemo((()=>{function e(e,t){return u.localizeHref(e,t||c,c,window.location.pathname)}return{...n,push(t,r){const{locale:u,...c}=r||{},s=[e(t,u)];return Object.keys(c).length>0&&s.push(c),n.push(...s)},replace(t,r){const{locale:u,...c}=r||{},s=[e(t,u)];return Object.keys(c).length>0&&s.push(c),n.replace(...s)},prefetch(t,r){const{locale:u,...c}=r||{},s=[e(t,u)];return Object.keys(c).length>0&&s.push(c),n.prefetch(...s)}}}),[c,n])};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../shared/utils.js");function t(e){function t(e){return String(e)}const r=new URLSearchParams;for(const[n,a]of Object.entries(e))Array.isArray(a)?a.forEach((e=>{r.append(n,t(e))})):r.set(n,t(a));return"?"+r.toString()}exports.compileLocalizedPathname=function(e){let{pathname:r,locale:n,params:a,pathnames:o,query:i}=e;function s(e){let t=o[e];return t||(t=e),t}function c(e){let r="string"==typeof e?e:e[n];return a&&Object.entries(a).forEach((e=>{let[t,n]=e;r=Array.isArray(n)?r.replace(new RegExp("(\\[)?\\[...".concat(t,"\\](\\])?"),"g"),n.map((e=>String(e))).join("/")):r.replace("[".concat(t,"]"),String(n))})),i&&(r+=t(i)),r}if("string"==typeof r){return c(s(r))}{const{pathname:e,...t}=r;return{...t,pathname:c(s(e))}}},exports.getRoute=function(t){var r;let{locale:n,pathname:a,pathnames:o}=t;const i=e.unlocalizePathname(a,n);let s=null===(r=Object.entries(o).find((t=>{let[,r]=t;const a="string"!=typeof r?r[n]:r;return e.matchesPathname(a,i)})))||void 0===r?void 0:r[0];return s||(s=a),s},exports.normalizeNameOrNameWithParams=function(e){return"string"==typeof e?{pathname:e}:e},exports.serializeSearchParams=t;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("./navigation/createSharedPathnamesNavigation.js"),a=require("./navigation/createLocalizedPathnamesNavigation.js");exports.createSharedPathnamesNavigation=e.default,exports.createLocalizedPathnamesNavigation=a.default;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("./navigation/react-server/createSharedPathnamesNavigation.js"),a=require("./navigation/react-server/createLocalizedPathnamesNavigation.js");exports.createSharedPathnamesNavigation=e.default,exports.createLocalizedPathnamesNavigation=a.default;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var n=require("fs"),e=require("path");function t(n){return n&&n.__esModule?n:{default:n}}var r=t(n),i=t(e);function o(n,e){return null!=(null==e?void 0:e.i18n)&&console.warn("\nnext-intl has found an `i18n` config in your next.config.js. 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` folder, you can refer to this example: https://github.com/amannn/next-intl/tree/feat/next-13-rsc/packages/example-next-13-with-pages\n"),Object.assign({},e,{webpack(){for(var t=arguments.length,o=new Array(t),s=0;s<t;s++)o[s]=arguments[s];let[a,l]=o;return a.resolve.alias["next-intl/config"]=require.resolve(function(n,e){let t=e;if(t){if(t=i.default.resolve(t),!r.default.existsSync(t))throw new Error("Could not find i18n config at ".concat(t,", please provide a valid path."))}else if(t=["./i18n.tsx","./i18n.ts","./i18n.js","./i18n.jsx","./src/i18n.tsx","./src/i18n.ts","./src/i18n.js","./src/i18n.jsx"].map((e=>i.default.resolve(n,e))).find((n=>r.default.existsSync(n))),!t)throw new Error("\n\nCould not locate i18n config. Create one at `./(src/)i18n.{js,jsx,ts,tsx}` or specify a custom location:\n\nconst withNextIntl = require('next-intl/plugin')(\n './path/to/i18n.tsx'\n);\n\nmodule.exports = withNextIntl({\n // Other Next.js configuration ...\n});\n");return t}(a.context,n)),"function"==typeof(null==e?void 0:e.webpack)?e.webpack(a,l):a}})}module.exports=function(n){return e=>o(n,e)};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("use-intl");function t(e,t){return function(){try{return t(...arguments)}catch(e){throw new Error(void 0)}}}const r=t(0,e.useTranslations),o=t(0,e.useFormatter);exports.useFormatter=o,exports.useTranslations=r,Object.keys(e).forEach((function(t){"default"===t||Object.prototype.hasOwnProperty.call(exports,t)||Object.defineProperty(exports,t,{enumerable:!0,get:function(){return e[t]}})}));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("next/navigation"),t=require("use-intl/_useLocale"),r=require("../shared/constants.js");exports.default=function(){let s;const u=e.useParams();return s="string"==typeof(null==u?void 0:u[r.LOCALE_SEGMENT_NAME])?u[r.LOCALE_SEGMENT_NAME]:t.useLocale(),s};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../_virtual/_rollupPluginBabelHelpers.js"),l=require("react"),r=require("../shared/NextIntlClientProvider.js"),u=require("./useLocale.js"),t=require("./useNow.js"),n=require("./useTimeZone.js");function o(e){return e&&e.__esModule?e:{default:e}}var a=o(l);exports.default=function(l){let{locale:o,now:s,timeZone:i,...d}=l;const c=u.default(),f=t.default(),j=n.default();return a.default.createElement(r.default,e.extends({locale:null!=o?o:c,now:null!=s?s:f,timeZone:null!=i?i:j},d))};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),r=require("use-intl/core"),a=require("../server/getConfig.js");const s=e.cache((()=>new Map));var t=e.cache((async function(e,t){const c=await a.default(e);return r.createTranslator({...c,messageFormatCache:s(),namespace:t,messages:c.messages})}));exports.default=t;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../server/getFormatter.js"),r=require("./useHook.js"),t=require("./useLocale.js");exports.default=function(){for(var u=arguments.length,o=new Array(u),s=0;s<u;s++)o[s]=arguments[s];const a=t.default();return r.default("useFormatter",e.default({locale:a}))};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react");exports.default=function(n,r){try{return e.use(r)}catch(e){throw e instanceof TypeError&&e.message.includes("Cannot read properties of null (reading 'use')")?new Error("`".concat(n,"` is not callable within an async component. Please refer to https://next-intl-docs.vercel.app/docs/environments/server-client-components#async-components"),{cause:e}):e}};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../server/RequestLocale.js");exports.default=function(){for(var r=arguments.length,t=new Array(r),s=0;s<r;s++)t[s]=arguments[s];return e.getRequestLocale()};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../server/getMessages.js"),r=require("./useHook.js"),s=require("./useLocale.js");exports.default=function(){for(var t=arguments.length,u=new Array(t),a=0;a<t;a++)u[a]=arguments[a];const o=s.default();return r.default("useMessages",e.default({locale:o}))};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../server/getNow.js"),t=require("./useHook.js"),o=require("./useLocale.js");exports.default=function(){for(var r=arguments.length,n=new Array(r),u=0;u<r;u++)n[u]=arguments[u];let[l]=n;null!=(null==l?void 0:l.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.");const a=o.default();return t.default("useNow",e.default({locale:a}))};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../server/getTimeZone.js"),r=require("./useHook.js"),t=require("./useLocale.js");exports.default=function(){for(var u=arguments.length,o=new Array(u),s=0;s<u;s++)o[s]=arguments[s];const a=t.default();return r.default("useTimeZone",e.default({locale:a}))};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("./getBaseTranslator.js"),r=require("./useHook.js"),t=require("./useLocale.js");exports.default=function(){for(var s=arguments.length,u=new Array(s),a=0;a<s;a++)u[a]=arguments[a];let[o]=u;const l=t.default();return r.default("useTranslations",e.default(l,o))};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("next/headers"),t=require("react"),r=require("../shared/constants.js");const n=t.cache((()=>{let t;try{t=e.headers().get(r.HEADER_LOCALE_NAME)}catch(e){throw e instanceof Error&&"DYNAMIC_SERVER_USAGE"===e.digest?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 `unstable_setRequestLocale` API to enable static rendering, see https://next-intl-docs.vercel.app/docs/getting-started/app-router-server-components#static-rendering",{cause:e}):e}if(!t)throw new Error("Unable to find `next-intl` locale because the middleware didn't run on this request. See https://next-intl-docs.vercel.app/docs/routing/middleware#unable-to-find-locale");return t})),o=t.cache((()=>({locale:void 0})));exports.getRequestLocale=function(){return o().locale||n()},exports.setRequestLocale=function(e){o().locale=e};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(exports,"__esModule",{value:!0});var t=e(require("next-intl/config"));Object.defineProperty(exports,"default",{enumerable:!0,get:function(){return t.default}});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),t=require("use-intl/core");function n(e){return e&&e.__esModule?e:{default:e}}var i=n(require("next-intl/config"));const o=e.cache((()=>new Date)),a=e.cache((()=>Intl.DateTimeFormat().resolvedOptions().timeZone)),r=e.cache((async(e,t)=>{var n,i;let r=null==t?void 0:t({locale:e});return r instanceof Promise&&(r=await r),{...r,now:(null===(n=r)||void 0===n?void 0:n.now)||o(),timeZone:(null===(i=r)||void 0===i?void 0:i.timeZone)||a()}}));var l=e.cache((async e=>{const n={...await r(e,i.default),locale:e};return t.initializeConfig(n)}));exports.default=l;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),r=require("use-intl/core"),t=require("./getConfig.js"),a=require("./resolveLocaleArg.js");const c=e.cache((async e=>{const a=await t.default(e);return r.createFormatter(a)}));exports.default=async function(e){const r=await a.default(e);return c(r)};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("./RequestLocale.js");exports.default=function(){return Promise.resolve(e.getRequestLocale())};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),r=require("./getConfig.js"),s=require("./resolveLocaleArg.js");const t=e.cache((async e=>{const s=await r.default(e);if(!s.messages)throw new Error("No messages found. Have you configured them correctly? See https://next-intl-docs.vercel.app/docs/configuration#messages");return s.messages}));exports.default=async function(e){const r=await s.default(e);return t(r)};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),r=require("./getConfig.js"),t=require("./resolveLocaleArg.js");const a=e.cache((async e=>(await r.default(e)).now));exports.default=async function(e){const r=await t.default(e);return a(r)};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=function(e){return e};
|