@common.js/next-intl 4.13.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +5 -0
- package/config.d.ts +4 -0
- package/dist/cjs/development/ExtractorCodec-D9Tw618d.cjs +7 -0
- package/dist/cjs/development/JSONCodec-CzA8ubPy.cjs +55 -0
- package/dist/cjs/development/POCodec-CWGHK-Gp.cjs +111 -0
- package/dist/cjs/development/plugin-DlFYUFWh.cjs +1613 -0
- package/dist/cjs/development/plugin.cjs +13 -0
- package/dist/esm/development/config.js +13 -0
- package/dist/esm/development/extractor/ExtractionCompiler.js +284 -0
- package/dist/esm/development/extractor/catalog/CatalogLocales.js +398 -0
- package/dist/esm/development/extractor/catalog/CatalogManager.js +1515 -0
- package/dist/esm/development/extractor/catalog/CatalogPersister.js +341 -0
- package/dist/esm/development/extractor/catalog/SaveScheduler.js +314 -0
- package/dist/esm/development/extractor/catalogLoader.js +288 -0
- package/dist/esm/development/extractor/extractMessages.js +180 -0
- package/dist/esm/development/extractor/extractionLoader.js +37 -0
- package/dist/esm/development/extractor/extractor/LRUCache.js +68 -0
- package/dist/esm/development/extractor/extractor/MessageExtractor.js +273 -0
- package/dist/esm/development/extractor/format/ExtractorCodec.js +13 -0
- package/dist/esm/development/extractor/format/codecs/JSONCodec.js +91 -0
- package/dist/esm/development/extractor/format/codecs/POCodec.js +227 -0
- package/dist/esm/development/extractor/format/index.js +289 -0
- package/dist/esm/development/extractor/normalizeExtractorConfig.js +91 -0
- package/dist/esm/development/extractor/source/SourceFileFilter.js +104 -0
- package/dist/esm/development/extractor/source/SourceFileScanner.js +297 -0
- package/dist/esm/development/extractor/source/SourceFileWatcher.js +610 -0
- package/dist/esm/development/extractor/utils.js +133 -0
- package/dist/esm/development/extractor.js +25 -0
- package/dist/esm/development/index.react-client.js +59 -0
- package/dist/esm/development/index.react-server.js +61 -0
- package/dist/esm/development/middleware/getAlternateLinksHeaderValue.js +142 -0
- package/dist/esm/development/middleware/middleware.js +231 -0
- package/dist/esm/development/middleware/resolveLocale.js +150 -0
- package/dist/esm/development/middleware/syncCookie.js +87 -0
- package/dist/esm/development/middleware/utils.js +403 -0
- package/dist/esm/development/middleware.js +16 -0
- package/dist/esm/development/navigation/react-client/createNavigation.js +195 -0
- package/dist/esm/development/navigation/react-client/useBasePathname.js +46 -0
- package/dist/esm/development/navigation/react-server/createNavigation.js +111 -0
- package/dist/esm/development/navigation/react-server/getServerLocale.js +167 -0
- package/dist/esm/development/navigation/shared/BaseLink.js +115 -0
- package/dist/esm/development/navigation/shared/createSharedNavigationFns.js +214 -0
- package/dist/esm/development/navigation/shared/syncLocaleCookie.js +139 -0
- package/dist/esm/development/navigation/shared/utils.js +352 -0
- package/dist/esm/development/navigation.react-client.js +16 -0
- package/dist/esm/development/navigation.react-server.js +16 -0
- package/dist/esm/development/plugin/config.js +28 -0
- package/dist/esm/development/plugin/createNextIntlPlugin.js +66 -0
- package/dist/esm/development/plugin/declaration/createMessagesDeclaration.js +91 -0
- package/dist/esm/development/plugin/extractor/initExtractionCompiler.js +64 -0
- package/dist/esm/development/plugin/getNextConfig.js +355 -0
- package/dist/esm/development/plugin/nextFlags.js +47 -0
- package/dist/esm/development/plugin/utils.js +43 -0
- package/dist/esm/development/plugin/watchFile.js +32 -0
- package/dist/esm/development/plugin.js +16 -0
- package/dist/esm/development/react-client/index.js +67 -0
- package/dist/esm/development/react-server/NextIntlClientProviderServer.js +327 -0
- package/dist/esm/development/react-server/useConfig.js +40 -0
- package/dist/esm/development/react-server/useExtracted.js +21 -0
- package/dist/esm/development/react-server/useFormatter.js +21 -0
- package/dist/esm/development/react-server/useLocale.js +20 -0
- package/dist/esm/development/react-server/useMessages.js +21 -0
- package/dist/esm/development/react-server/useNow.js +25 -0
- package/dist/esm/development/react-server/useTimeZone.js +20 -0
- package/dist/esm/development/react-server/useTranslations.js +71 -0
- package/dist/esm/development/routing/config.js +82 -0
- package/dist/esm/development/routing/defineRouting.js +116 -0
- package/dist/esm/development/routing.js +16 -0
- package/dist/esm/development/server/react-client/index.js +68 -0
- package/dist/esm/development/server/react-server/RequestLocale.js +267 -0
- package/dist/esm/development/server/react-server/RequestLocaleCache.js +33 -0
- package/dist/esm/development/server/react-server/createRequestConfig.js +16 -0
- package/dist/esm/development/server/react-server/getConfig.js +283 -0
- package/dist/esm/development/server/react-server/getConfigNow.js +166 -0
- package/dist/esm/development/server/react-server/getDefaultNow.js +16 -0
- package/dist/esm/development/server/react-server/getExtracted.js +176 -0
- package/dist/esm/development/server/react-server/getFormats.js +166 -0
- package/dist/esm/development/server/react-server/getFormatter.js +186 -0
- package/dist/esm/development/server/react-server/getLocale.js +166 -0
- package/dist/esm/development/server/react-server/getMessages.js +194 -0
- package/dist/esm/development/server/react-server/getNow.js +164 -0
- package/dist/esm/development/server/react-server/getRequestConfig.js +15 -0
- package/dist/esm/development/server/react-server/getServerExtractor.js +108 -0
- package/dist/esm/development/server/react-server/getServerFormatter.js +81 -0
- package/dist/esm/development/server/react-server/getServerTranslator.js +70 -0
- package/dist/esm/development/server/react-server/getTimeZone.js +180 -0
- package/dist/esm/development/server/react-server/getTranslations.js +179 -0
- package/dist/esm/development/server/react-server/validateLocale.js +20 -0
- package/dist/esm/development/server.react-client.js +40 -0
- package/dist/esm/development/server.react-server.js +53 -0
- package/dist/esm/development/shared/NextIntlClientProvider.js +79 -0
- package/dist/esm/development/shared/constants.js +12 -0
- package/dist/esm/development/shared/use.js +59 -0
- package/dist/esm/development/shared/utils.js +201 -0
- package/dist/esm/production/config.js +13 -0
- package/dist/esm/production/extractor/ExtractionCompiler.js +275 -0
- package/dist/esm/production/extractor/catalog/CatalogLocales.js +384 -0
- package/dist/esm/production/extractor/catalog/CatalogManager.js +1401 -0
- package/dist/esm/production/extractor/catalog/CatalogPersister.js +334 -0
- package/dist/esm/production/extractor/catalog/SaveScheduler.js +278 -0
- package/dist/esm/production/extractor/catalogLoader.js +251 -0
- package/dist/esm/production/extractor/extractMessages.js +178 -0
- package/dist/esm/production/extractor/extractionLoader.js +27 -0
- package/dist/esm/production/extractor/extractor/LRUCache.js +59 -0
- package/dist/esm/production/extractor/extractor/MessageExtractor.js +259 -0
- package/dist/esm/production/extractor/format/ExtractorCodec.js +13 -0
- package/dist/esm/production/extractor/format/codecs/JSONCodec.js +83 -0
- package/dist/esm/production/extractor/format/codecs/POCodec.js +210 -0
- package/dist/esm/production/extractor/format/index.js +278 -0
- package/dist/esm/production/extractor/normalizeExtractorConfig.js +54 -0
- package/dist/esm/production/extractor/source/SourceFileFilter.js +99 -0
- package/dist/esm/production/extractor/source/SourceFileScanner.js +293 -0
- package/dist/esm/production/extractor/source/SourceFileWatcher.js +579 -0
- package/dist/esm/production/extractor/utils.js +108 -0
- package/dist/esm/production/extractor.js +25 -0
- package/dist/esm/production/index.react-client.js +59 -0
- package/dist/esm/production/index.react-server.js +61 -0
- package/dist/esm/production/middleware/getAlternateLinksHeaderValue.js +104 -0
- package/dist/esm/production/middleware/middleware.js +155 -0
- package/dist/esm/production/middleware/resolveLocale.js +99 -0
- package/dist/esm/production/middleware/syncCookie.js +81 -0
- package/dist/esm/production/middleware/utils.js +315 -0
- package/dist/esm/production/middleware.js +16 -0
- package/dist/esm/production/navigation/react-client/createNavigation.js +174 -0
- package/dist/esm/production/navigation/react-client/useBasePathname.js +32 -0
- package/dist/esm/production/navigation/react-server/createNavigation.js +110 -0
- package/dist/esm/production/navigation/react-server/getServerLocale.js +162 -0
- package/dist/esm/production/navigation/shared/BaseLink.js +98 -0
- package/dist/esm/production/navigation/shared/createSharedNavigationFns.js +182 -0
- package/dist/esm/production/navigation/shared/syncLocaleCookie.js +113 -0
- package/dist/esm/production/navigation/shared/utils.js +264 -0
- package/dist/esm/production/navigation.react-client.js +16 -0
- package/dist/esm/production/navigation.react-server.js +16 -0
- package/dist/esm/production/plugin/config.js +22 -0
- package/dist/esm/production/plugin/createNextIntlPlugin.js +48 -0
- package/dist/esm/production/plugin/declaration/createMessagesDeclaration.js +72 -0
- package/dist/esm/production/plugin/extractor/initExtractionCompiler.js +33 -0
- package/dist/esm/production/plugin/getNextConfig.js +242 -0
- package/dist/esm/production/plugin/nextFlags.js +44 -0
- package/dist/esm/production/plugin/utils.js +35 -0
- package/dist/esm/production/plugin/watchFile.js +26 -0
- package/dist/esm/production/plugin.js +16 -0
- package/dist/esm/production/react-client/index.js +57 -0
- package/dist/esm/production/react-server/NextIntlClientProviderServer.js +327 -0
- package/dist/esm/production/react-server/useConfig.js +35 -0
- package/dist/esm/production/react-server/useExtracted.js +21 -0
- package/dist/esm/production/react-server/useFormatter.js +21 -0
- package/dist/esm/production/react-server/useLocale.js +19 -0
- package/dist/esm/production/react-server/useMessages.js +21 -0
- package/dist/esm/production/react-server/useNow.js +22 -0
- package/dist/esm/production/react-server/useTimeZone.js +19 -0
- package/dist/esm/production/react-server/useTranslations.js +71 -0
- package/dist/esm/production/routing/config.js +77 -0
- package/dist/esm/production/routing/defineRouting.js +13 -0
- package/dist/esm/production/routing.js +16 -0
- package/dist/esm/production/server/react-client/index.js +51 -0
- package/dist/esm/production/server/react-server/RequestLocale.js +246 -0
- package/dist/esm/production/server/react-server/RequestLocaleCache.js +30 -0
- package/dist/esm/production/server/react-server/createRequestConfig.js +16 -0
- package/dist/esm/production/server/react-server/getConfig.js +262 -0
- package/dist/esm/production/server/react-server/getConfigNow.js +162 -0
- package/dist/esm/production/server/react-server/getDefaultNow.js +14 -0
- package/dist/esm/production/server/react-server/getExtracted.js +166 -0
- package/dist/esm/production/server/react-server/getFormats.js +157 -0
- package/dist/esm/production/server/react-server/getFormatter.js +179 -0
- package/dist/esm/production/server/react-server/getLocale.js +157 -0
- package/dist/esm/production/server/react-server/getMessages.js +190 -0
- package/dist/esm/production/server/react-server/getNow.js +164 -0
- package/dist/esm/production/server/react-server/getRequestConfig.js +13 -0
- package/dist/esm/production/server/react-server/getServerExtractor.js +20 -0
- package/dist/esm/production/server/react-server/getServerFormatter.js +78 -0
- package/dist/esm/production/server/react-server/getServerTranslator.js +69 -0
- package/dist/esm/production/server/react-server/getTimeZone.js +176 -0
- package/dist/esm/production/server/react-server/getTranslations.js +166 -0
- package/dist/esm/production/server.react-client.js +40 -0
- package/dist/esm/production/server.react-server.js +53 -0
- package/dist/esm/production/shared/NextIntlClientProvider.js +77 -0
- package/dist/esm/production/shared/constants.js +11 -0
- package/dist/esm/production/shared/use.js +51 -0
- package/dist/esm/production/shared/utils.js +156 -0
- package/dist/types/config.d.ts +1 -0
- package/dist/types/extractor/ExtractionCompiler.d.ts +16 -0
- package/dist/types/extractor/catalog/CatalogLocales.d.ts +29 -0
- package/dist/types/extractor/catalog/CatalogManager.d.ts +76 -0
- package/dist/types/extractor/catalog/CatalogPersister.d.ts +20 -0
- package/dist/types/extractor/catalog/SaveScheduler.d.ts +18 -0
- package/dist/types/extractor/extractMessages.d.ts +2 -0
- package/dist/types/extractor/extractor/LRUCache.d.ts +7 -0
- package/dist/types/extractor/extractor/MessageExtractor.bench.d.ts +1 -0
- package/dist/types/extractor/extractor/MessageExtractor.d.ts +17 -0
- package/dist/types/extractor/format/ExtractorCodec.d.ts +33 -0
- package/dist/types/extractor/format/codecs/JSONCodec.d.ts +2 -0
- package/dist/types/extractor/format/codecs/POCodec.d.ts +2 -0
- package/dist/types/extractor/format/codecs/fixtures/JSONCodecStructured.d.ts +2 -0
- package/dist/types/extractor/format/codecs/fixtures/POCodecSourceMessageKey.d.ts +2 -0
- package/dist/types/extractor/format/index.d.ts +15 -0
- package/dist/types/extractor/format/types.d.ts +8 -0
- package/dist/types/extractor/index.d.ts +2 -0
- package/dist/types/extractor/normalizeExtractorConfig.d.ts +5 -0
- package/dist/types/extractor/source/SourceFileFilter.d.ts +8 -0
- package/dist/types/extractor/source/SourceFileScanner.d.ts +4 -0
- package/dist/types/extractor/source/SourceFileWatcher.d.ts +15 -0
- package/dist/types/extractor/types.d.ts +79 -0
- package/dist/types/extractor/utils.d.ts +9 -0
- package/dist/types/extractor.d.ts +1 -0
- package/dist/types/index.react-client.d.ts +8 -0
- package/dist/types/index.react-server.d.ts +1 -0
- package/dist/types/middleware/getAlternateLinksHeaderValue.d.ts +13 -0
- package/dist/types/middleware/index.d.ts +4 -0
- package/dist/types/middleware/middleware.d.ts +4 -0
- package/dist/types/middleware/resolveLocale.d.ts +9 -0
- package/dist/types/middleware/syncCookie.d.ts +7 -0
- package/dist/types/middleware/utils.d.ts +26 -0
- package/dist/types/middleware.d.ts +1 -0
- package/dist/types/navigation/react-client/createNavigation.d.ts +465 -0
- package/dist/types/navigation/react-client/index.d.ts +2 -0
- package/dist/types/navigation/react-client/useBasePathname.d.ts +5 -0
- package/dist/types/navigation/react-server/createNavigation.d.ts +384 -0
- package/dist/types/navigation/react-server/getServerLocale.d.ts +5 -0
- package/dist/types/navigation/react-server/index.d.ts +2 -0
- package/dist/types/navigation/shared/BaseLink.d.ts +11 -0
- package/dist/types/navigation/shared/StrictParams.d.ts +8 -0
- package/dist/types/navigation/shared/createSharedNavigationFns.d.ts +370 -0
- package/dist/types/navigation/shared/syncLocaleCookie.d.ts +8 -0
- package/dist/types/navigation/shared/utils.d.ts +53 -0
- package/dist/types/navigation.react-client.d.ts +1 -0
- package/dist/types/navigation.react-server.d.ts +1 -0
- package/dist/types/plugin/catalog/catalogLoader.d.ts +10 -0
- package/dist/types/plugin/config.d.ts +3 -0
- package/dist/types/plugin/createNextIntlPlugin.d.ts +3 -0
- package/dist/types/plugin/declaration/createMessagesDeclaration.d.ts +1 -0
- package/dist/types/plugin/declaration/index.d.ts +1 -0
- package/dist/types/plugin/extractor/extractionLoader.d.ts +3 -0
- package/dist/types/plugin/extractor/initExtractionCompiler.d.ts +2 -0
- package/dist/types/plugin/getNextConfig.d.ts +4 -0
- package/dist/types/plugin/index.d.ts +1 -0
- package/dist/types/plugin/nextFlags.d.ts +2 -0
- package/dist/types/plugin/types.d.ts +25 -0
- package/dist/types/plugin/utils.d.ts +8 -0
- package/dist/types/plugin/watchFile.d.ts +6 -0
- package/dist/types/plugin.d.ts +1 -0
- package/dist/types/react-client/index.d.ts +16 -0
- package/dist/types/react-server/NextIntlClientProviderServer.d.ts +5 -0
- package/dist/types/react-server/index.d.ts +16 -0
- package/dist/types/react-server/testUtils.d.ts +2 -0
- package/dist/types/react-server/useConfig.d.ts +2 -0
- package/dist/types/react-server/useExtracted.d.ts +2 -0
- 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/react-server/useTranslations.d.ts +2 -0
- package/dist/types/routing/config.d.ts +73 -0
- package/dist/types/routing/defineRouting.d.ts +3 -0
- package/dist/types/routing/index.d.ts +3 -0
- package/dist/types/routing/types.d.ts +25 -0
- package/dist/types/routing.d.ts +1 -0
- package/dist/types/server/react-client/index.d.ts +10 -0
- package/dist/types/server/react-server/RequestLocale.d.ts +1 -0
- package/dist/types/server/react-server/RequestLocaleCache.d.ts +3 -0
- package/dist/types/server/react-server/createRequestConfig.d.ts +3 -0
- package/dist/types/server/react-server/getConfig.d.ts +13 -0
- 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/getExtracted.d.ts +10 -0
- package/dist/types/server/react-server/getFormats.d.ts +3 -0
- package/dist/types/server/react-server/getFormatter.d.ts +10 -0
- 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/server/react-server/getRequestConfig.d.ts +35 -0
- package/dist/types/server/react-server/getServerExtractor.d.ts +5 -0
- package/dist/types/server/react-server/getServerFormatter.d.ts +29 -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 +12 -0
- package/dist/types/server/react-server/validateLocale.d.ts +1 -0
- package/dist/types/server.react-client.d.ts +1 -0
- package/dist/types/server.react-server.d.ts +1 -0
- package/dist/types/shared/NextIntlClientProvider.d.ts +9 -0
- package/dist/types/shared/constants.d.ts +1 -0
- package/dist/types/shared/types.d.ts +5 -0
- package/dist/types/shared/use.d.ts +3 -0
- package/dist/types/shared/utils.d.ts +20 -0
- package/extractor/catalogLoader.d.ts +4 -0
- package/extractor/extractionLoader.d.ts +4 -0
- package/extractor.d.ts +2 -0
- package/middleware.d.ts +4 -0
- package/navigation.d.ts +2 -0
- package/package.json +60 -0
- package/plugin.d.cts +3 -0
- package/plugin.d.ts +4 -0
- package/routing.d.ts +2 -0
- package/server.d.ts +2 -0
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "default", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return getTranslations_default;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
var _react = require("react");
|
|
12
|
+
var _getConfigJs = /*#__PURE__*/ _interopRequireDefault(require("./getConfig.js"));
|
|
13
|
+
var _getServerTranslatorJs = /*#__PURE__*/ _interopRequireDefault(require("./getServerTranslator.js"));
|
|
14
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
15
|
+
try {
|
|
16
|
+
var info = gen[key](arg);
|
|
17
|
+
var value = info.value;
|
|
18
|
+
} catch (error) {
|
|
19
|
+
reject(error);
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
if (info.done) {
|
|
23
|
+
resolve(value);
|
|
24
|
+
} else {
|
|
25
|
+
Promise.resolve(value).then(_next, _throw);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
function _asyncToGenerator(fn) {
|
|
29
|
+
return function() {
|
|
30
|
+
var self = this, args = arguments;
|
|
31
|
+
return new Promise(function(resolve, reject) {
|
|
32
|
+
var gen = fn.apply(self, args);
|
|
33
|
+
function _next(value) {
|
|
34
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
|
|
35
|
+
}
|
|
36
|
+
function _throw(err) {
|
|
37
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
|
|
38
|
+
}
|
|
39
|
+
_next(undefined);
|
|
40
|
+
});
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
function _interopRequireDefault(obj) {
|
|
44
|
+
return obj && obj.__esModule ? obj : {
|
|
45
|
+
default: obj
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
var __generator = (void 0) && (void 0).__generator || function(thisArg, body) {
|
|
49
|
+
var f, y, t, g, _ = {
|
|
50
|
+
label: 0,
|
|
51
|
+
sent: function() {
|
|
52
|
+
if (t[0] & 1) throw t[1];
|
|
53
|
+
return t[1];
|
|
54
|
+
},
|
|
55
|
+
trys: [],
|
|
56
|
+
ops: []
|
|
57
|
+
};
|
|
58
|
+
return g = {
|
|
59
|
+
next: verb(0),
|
|
60
|
+
"throw": verb(1),
|
|
61
|
+
"return": verb(2)
|
|
62
|
+
}, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
63
|
+
return this;
|
|
64
|
+
}), g;
|
|
65
|
+
function verb(n) {
|
|
66
|
+
return function(v) {
|
|
67
|
+
return step([
|
|
68
|
+
n,
|
|
69
|
+
v
|
|
70
|
+
]);
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
function step(op) {
|
|
74
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
75
|
+
while(_)try {
|
|
76
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
77
|
+
if (y = 0, t) op = [
|
|
78
|
+
op[0] & 2,
|
|
79
|
+
t.value
|
|
80
|
+
];
|
|
81
|
+
switch(op[0]){
|
|
82
|
+
case 0:
|
|
83
|
+
case 1:
|
|
84
|
+
t = op;
|
|
85
|
+
break;
|
|
86
|
+
case 4:
|
|
87
|
+
_.label++;
|
|
88
|
+
return {
|
|
89
|
+
value: op[1],
|
|
90
|
+
done: false
|
|
91
|
+
};
|
|
92
|
+
case 5:
|
|
93
|
+
_.label++;
|
|
94
|
+
y = op[1];
|
|
95
|
+
op = [
|
|
96
|
+
0
|
|
97
|
+
];
|
|
98
|
+
continue;
|
|
99
|
+
case 7:
|
|
100
|
+
op = _.ops.pop();
|
|
101
|
+
_.trys.pop();
|
|
102
|
+
continue;
|
|
103
|
+
default:
|
|
104
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
105
|
+
_ = 0;
|
|
106
|
+
continue;
|
|
107
|
+
}
|
|
108
|
+
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
109
|
+
_.label = op[1];
|
|
110
|
+
break;
|
|
111
|
+
}
|
|
112
|
+
if (op[0] === 6 && _.label < t[1]) {
|
|
113
|
+
_.label = t[1];
|
|
114
|
+
t = op;
|
|
115
|
+
break;
|
|
116
|
+
}
|
|
117
|
+
if (t && _.label < t[2]) {
|
|
118
|
+
_.label = t[2];
|
|
119
|
+
_.ops.push(op);
|
|
120
|
+
break;
|
|
121
|
+
}
|
|
122
|
+
if (t[2]) _.ops.pop();
|
|
123
|
+
_.trys.pop();
|
|
124
|
+
continue;
|
|
125
|
+
}
|
|
126
|
+
op = body.call(thisArg, _);
|
|
127
|
+
} catch (e) {
|
|
128
|
+
op = [
|
|
129
|
+
6,
|
|
130
|
+
e
|
|
131
|
+
];
|
|
132
|
+
y = 0;
|
|
133
|
+
} finally{
|
|
134
|
+
f = t = 0;
|
|
135
|
+
}
|
|
136
|
+
if (op[0] & 5) throw op[1];
|
|
137
|
+
return {
|
|
138
|
+
value: op[0] ? op[1] : void 0,
|
|
139
|
+
done: true
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
};
|
|
143
|
+
function getTranslations(namespaceOrOpts) {
|
|
144
|
+
return _getTranslations.apply(this, arguments);
|
|
145
|
+
}
|
|
146
|
+
function _getTranslations() {
|
|
147
|
+
_getTranslations = // Maintainer note: `getTranslations` has two different call signatures.
|
|
148
|
+
// We need to define these with function overloads, otherwise TypeScript
|
|
149
|
+
// messes up the return type.
|
|
150
|
+
// Call signature 1: `getTranslations(namespace)`
|
|
151
|
+
// Call signature 2: `getTranslations({locale, namespace})`
|
|
152
|
+
// Implementation
|
|
153
|
+
_asyncToGenerator(function(namespaceOrOpts) {
|
|
154
|
+
var namespace, locale, config;
|
|
155
|
+
return __generator(this, function(_state) {
|
|
156
|
+
switch(_state.label){
|
|
157
|
+
case 0:
|
|
158
|
+
if (typeof namespaceOrOpts === "string") {
|
|
159
|
+
namespace = namespaceOrOpts;
|
|
160
|
+
} else if (namespaceOrOpts) {
|
|
161
|
+
locale = namespaceOrOpts.locale;
|
|
162
|
+
namespace = namespaceOrOpts.namespace;
|
|
163
|
+
}
|
|
164
|
+
return [
|
|
165
|
+
4,
|
|
166
|
+
(0, _getConfigJs.default)(locale)
|
|
167
|
+
];
|
|
168
|
+
case 1:
|
|
169
|
+
config = _state.sent();
|
|
170
|
+
return [
|
|
171
|
+
2,
|
|
172
|
+
(0, _getServerTranslatorJs.default)(config, namespace)
|
|
173
|
+
];
|
|
174
|
+
}
|
|
175
|
+
});
|
|
176
|
+
});
|
|
177
|
+
return _getTranslations.apply(this, arguments);
|
|
178
|
+
}
|
|
179
|
+
var getTranslations_default = (0, _react.cache)(getTranslations);
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "default", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return validateLocale;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
function validateLocale(locale) {
|
|
12
|
+
try {
|
|
13
|
+
var constructed = new Intl.Locale(locale);
|
|
14
|
+
if (!constructed.language) {
|
|
15
|
+
throw new Error("Language is required");
|
|
16
|
+
}
|
|
17
|
+
} catch (e) {
|
|
18
|
+
console.error('An invalid locale was provided: "'.concat(locale, '"\nPlease ensure you\'re using a valid Unicode locale identifier (e.g. "en-US").'));
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
function _export(target, all) {
|
|
6
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: all[name]
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
_export(exports, {
|
|
12
|
+
getExtracted: function() {
|
|
13
|
+
return _indexJs.getExtracted;
|
|
14
|
+
},
|
|
15
|
+
getFormatter: function() {
|
|
16
|
+
return _indexJs.getFormatter;
|
|
17
|
+
},
|
|
18
|
+
getLocale: function() {
|
|
19
|
+
return _indexJs.getLocale;
|
|
20
|
+
},
|
|
21
|
+
getMessages: function() {
|
|
22
|
+
return _indexJs.getMessages;
|
|
23
|
+
},
|
|
24
|
+
getNow: function() {
|
|
25
|
+
return _indexJs.getNow;
|
|
26
|
+
},
|
|
27
|
+
getRequestConfig: function() {
|
|
28
|
+
return _indexJs.getRequestConfig;
|
|
29
|
+
},
|
|
30
|
+
getTimeZone: function() {
|
|
31
|
+
return _indexJs.getTimeZone;
|
|
32
|
+
},
|
|
33
|
+
getTranslations: function() {
|
|
34
|
+
return _indexJs.getTranslations;
|
|
35
|
+
},
|
|
36
|
+
setRequestLocale: function() {
|
|
37
|
+
return _indexJs.setRequestLocale;
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
var _indexJs = require("./server/react-client/index.js");
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
function _export(target, all) {
|
|
6
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: all[name]
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
_export(exports, {
|
|
12
|
+
getRequestConfig: function() {
|
|
13
|
+
return _getRequestConfigJs.default;
|
|
14
|
+
},
|
|
15
|
+
getFormatter: function() {
|
|
16
|
+
return _getFormatterJs.default;
|
|
17
|
+
},
|
|
18
|
+
getNow: function() {
|
|
19
|
+
return _getNowJs.default;
|
|
20
|
+
},
|
|
21
|
+
getTimeZone: function() {
|
|
22
|
+
return _getTimeZoneJs.default;
|
|
23
|
+
},
|
|
24
|
+
getExtracted: function() {
|
|
25
|
+
return _getExtractedJs.default;
|
|
26
|
+
},
|
|
27
|
+
getMessages: function() {
|
|
28
|
+
return _getMessagesJs.default;
|
|
29
|
+
},
|
|
30
|
+
getLocale: function() {
|
|
31
|
+
return _getLocaleJs.default;
|
|
32
|
+
},
|
|
33
|
+
getTranslations: function() {
|
|
34
|
+
return _getTranslationsJs.default;
|
|
35
|
+
},
|
|
36
|
+
setRequestLocale: function() {
|
|
37
|
+
return _requestLocaleCacheJs.setCachedRequestLocale;
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
var _getRequestConfigJs = /*#__PURE__*/ _interopRequireDefault(require("./server/react-server/getRequestConfig.js"));
|
|
41
|
+
var _getFormatterJs = /*#__PURE__*/ _interopRequireDefault(require("./server/react-server/getFormatter.js"));
|
|
42
|
+
var _getNowJs = /*#__PURE__*/ _interopRequireDefault(require("./server/react-server/getNow.js"));
|
|
43
|
+
var _getTimeZoneJs = /*#__PURE__*/ _interopRequireDefault(require("./server/react-server/getTimeZone.js"));
|
|
44
|
+
var _getExtractedJs = /*#__PURE__*/ _interopRequireDefault(require("./server/react-server/getExtracted.js"));
|
|
45
|
+
var _getMessagesJs = /*#__PURE__*/ _interopRequireDefault(require("./server/react-server/getMessages.js"));
|
|
46
|
+
var _getLocaleJs = /*#__PURE__*/ _interopRequireDefault(require("./server/react-server/getLocale.js"));
|
|
47
|
+
var _getTranslationsJs = /*#__PURE__*/ _interopRequireDefault(require("./server/react-server/getTranslations.js"));
|
|
48
|
+
var _requestLocaleCacheJs = require("./server/react-server/RequestLocaleCache.js");
|
|
49
|
+
function _interopRequireDefault(obj) {
|
|
50
|
+
return obj && obj.__esModule ? obj : {
|
|
51
|
+
default: obj
|
|
52
|
+
};
|
|
53
|
+
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "default", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return NextIntlClientProvider;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
var _react = require("use-intl/react");
|
|
12
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
13
|
+
"use client";
|
|
14
|
+
function _defineProperty(obj, key, value) {
|
|
15
|
+
if (key in obj) {
|
|
16
|
+
Object.defineProperty(obj, key, {
|
|
17
|
+
value: value,
|
|
18
|
+
enumerable: true,
|
|
19
|
+
configurable: true,
|
|
20
|
+
writable: true
|
|
21
|
+
});
|
|
22
|
+
} else {
|
|
23
|
+
obj[key] = value;
|
|
24
|
+
}
|
|
25
|
+
return obj;
|
|
26
|
+
}
|
|
27
|
+
function _objectSpread(target) {
|
|
28
|
+
for(var i = 1; i < arguments.length; i++){
|
|
29
|
+
var source = arguments[i] != null ? arguments[i] : {};
|
|
30
|
+
var ownKeys = Object.keys(source);
|
|
31
|
+
if (typeof Object.getOwnPropertySymbols === "function") {
|
|
32
|
+
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
33
|
+
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
34
|
+
}));
|
|
35
|
+
}
|
|
36
|
+
ownKeys.forEach(function(key) {
|
|
37
|
+
_defineProperty(target, key, source[key]);
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
return target;
|
|
41
|
+
}
|
|
42
|
+
function _objectWithoutProperties(source, excluded) {
|
|
43
|
+
if (source == null) return {};
|
|
44
|
+
var target = _objectWithoutPropertiesLoose(source, excluded);
|
|
45
|
+
var key, i;
|
|
46
|
+
if (Object.getOwnPropertySymbols) {
|
|
47
|
+
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
|
|
48
|
+
for(i = 0; i < sourceSymbolKeys.length; i++){
|
|
49
|
+
key = sourceSymbolKeys[i];
|
|
50
|
+
if (excluded.indexOf(key) >= 0) continue;
|
|
51
|
+
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
|
|
52
|
+
target[key] = source[key];
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
return target;
|
|
56
|
+
}
|
|
57
|
+
function _objectWithoutPropertiesLoose(source, excluded) {
|
|
58
|
+
if (source == null) return {};
|
|
59
|
+
var target = {};
|
|
60
|
+
var sourceKeys = Object.keys(source);
|
|
61
|
+
var key, i;
|
|
62
|
+
for(i = 0; i < sourceKeys.length; i++){
|
|
63
|
+
key = sourceKeys[i];
|
|
64
|
+
if (excluded.indexOf(key) >= 0) continue;
|
|
65
|
+
target[key] = source[key];
|
|
66
|
+
}
|
|
67
|
+
return target;
|
|
68
|
+
}
|
|
69
|
+
function NextIntlClientProvider(_param) {
|
|
70
|
+
var locale = _param.locale, rest = _objectWithoutProperties(_param, [
|
|
71
|
+
"locale"
|
|
72
|
+
]);
|
|
73
|
+
if (!locale) {
|
|
74
|
+
throw new Error("Couldn't infer the `locale` prop in `NextIntlClientProvider`, please provide it explicitly.\n\nSee https://next-intl.dev/docs/configuration#locale");
|
|
75
|
+
}
|
|
76
|
+
return /*#__PURE__*/ (0, _jsxRuntime.jsx)(_react.IntlProvider, _objectSpread({
|
|
77
|
+
locale: locale
|
|
78
|
+
}, rest));
|
|
79
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
// Used to read the locale from the middleware
|
|
2
|
+
"use strict";
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "HEADER_LOCALE_NAME", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function() {
|
|
9
|
+
return HEADER_LOCALE_NAME;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
var HEADER_LOCALE_NAME = "X-NEXT-INTL-LOCALE";
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "default", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return use;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
var _react = /*#__PURE__*/ _interopRequireWildcard(require("react"));
|
|
12
|
+
function _getRequireWildcardCache(nodeInterop) {
|
|
13
|
+
if (typeof WeakMap !== "function") return null;
|
|
14
|
+
var cacheBabelInterop = new WeakMap();
|
|
15
|
+
var cacheNodeInterop = new WeakMap();
|
|
16
|
+
return (_getRequireWildcardCache = function(nodeInterop) {
|
|
17
|
+
return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
|
|
18
|
+
})(nodeInterop);
|
|
19
|
+
}
|
|
20
|
+
function _interopRequireWildcard(obj, nodeInterop) {
|
|
21
|
+
if (!nodeInterop && obj && obj.__esModule) {
|
|
22
|
+
return obj;
|
|
23
|
+
}
|
|
24
|
+
if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
|
|
25
|
+
return {
|
|
26
|
+
default: obj
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
var cache = _getRequireWildcardCache(nodeInterop);
|
|
30
|
+
if (cache && cache.has(obj)) {
|
|
31
|
+
return cache.get(obj);
|
|
32
|
+
}
|
|
33
|
+
var newObj = {};
|
|
34
|
+
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
35
|
+
for(var key in obj){
|
|
36
|
+
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
37
|
+
var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
|
|
38
|
+
if (desc && (desc.get || desc.set)) {
|
|
39
|
+
Object.defineProperty(newObj, key, desc);
|
|
40
|
+
} else {
|
|
41
|
+
newObj[key] = obj[key];
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
newObj.default = obj;
|
|
46
|
+
if (cache) {
|
|
47
|
+
cache.set(obj, newObj);
|
|
48
|
+
}
|
|
49
|
+
return newObj;
|
|
50
|
+
}
|
|
51
|
+
// @ts-expect-error -- Ooof, Next.js doesn't make this easy.
|
|
52
|
+
// `use` is only available in React 19 canary, but we can
|
|
53
|
+
// use it in Next.js already as Next.js "vendors" a fixed
|
|
54
|
+
// version of React. However, if we'd simply put `use` in
|
|
55
|
+
// ESM code, then the build doesn't work since React does
|
|
56
|
+
// not export `use` officially. Therefore, we have to use
|
|
57
|
+
// something that is not statically analyzable. Once React
|
|
58
|
+
// 19 is out, we can remove this in the next major version.
|
|
59
|
+
var use = _react["use".trim()];
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
function _export(target, all) {
|
|
6
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: all[name]
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
_export(exports, {
|
|
12
|
+
getLocaleAsPrefix: function() {
|
|
13
|
+
return getLocaleAsPrefix;
|
|
14
|
+
},
|
|
15
|
+
getLocalePrefix: function() {
|
|
16
|
+
return getLocalePrefix;
|
|
17
|
+
},
|
|
18
|
+
getLocalizedTemplate: function() {
|
|
19
|
+
return getLocalizedTemplate;
|
|
20
|
+
},
|
|
21
|
+
getSortedPathnames: function() {
|
|
22
|
+
return getSortedPathnames;
|
|
23
|
+
},
|
|
24
|
+
hasPathnamePrefixed: function() {
|
|
25
|
+
return hasPathnamePrefixed;
|
|
26
|
+
},
|
|
27
|
+
isLocalizableHref: function() {
|
|
28
|
+
return isLocalizableHref;
|
|
29
|
+
},
|
|
30
|
+
isPromise: function() {
|
|
31
|
+
return isPromise;
|
|
32
|
+
},
|
|
33
|
+
matchesPathname: function() {
|
|
34
|
+
return matchesPathname;
|
|
35
|
+
},
|
|
36
|
+
normalizeTrailingSlash: function() {
|
|
37
|
+
return normalizeTrailingSlash;
|
|
38
|
+
},
|
|
39
|
+
prefixPathname: function() {
|
|
40
|
+
return prefixPathname;
|
|
41
|
+
},
|
|
42
|
+
templateToRegex: function() {
|
|
43
|
+
return templateToRegex;
|
|
44
|
+
},
|
|
45
|
+
unprefixPathname: function() {
|
|
46
|
+
return unprefixPathname;
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
function _arrayLikeToArray(arr, len) {
|
|
50
|
+
if (len == null || len > arr.length) len = arr.length;
|
|
51
|
+
for(var i1 = 0, arr2 = new Array(len); i1 < len; i1++)arr2[i1] = arr[i1];
|
|
52
|
+
return arr2;
|
|
53
|
+
}
|
|
54
|
+
function _arrayWithHoles(arr) {
|
|
55
|
+
if (Array.isArray(arr)) return arr;
|
|
56
|
+
}
|
|
57
|
+
function _iterableToArray(iter) {
|
|
58
|
+
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
59
|
+
}
|
|
60
|
+
function _nonIterableRest() {
|
|
61
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
62
|
+
}
|
|
63
|
+
function _toArray(arr) {
|
|
64
|
+
return _arrayWithHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
|
|
65
|
+
}
|
|
66
|
+
function _unsupportedIterableToArray(o, minLen) {
|
|
67
|
+
if (!o) return;
|
|
68
|
+
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
|
|
69
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
70
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
71
|
+
if (n === "Map" || n === "Set") return Array.from(n);
|
|
72
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
|
73
|
+
}
|
|
74
|
+
function isRelativeHref(href) {
|
|
75
|
+
var pathname = typeof href === "object" ? href.pathname : href;
|
|
76
|
+
return pathname != null && !pathname.startsWith("/");
|
|
77
|
+
}
|
|
78
|
+
function isLocalHref(href) {
|
|
79
|
+
if (typeof href === "object") {
|
|
80
|
+
return href.host == null && href.hostname == null;
|
|
81
|
+
} else {
|
|
82
|
+
var hasProtocol = /^[a-z]+:/i.test(href);
|
|
83
|
+
return !hasProtocol;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
function isLocalizableHref(href) {
|
|
87
|
+
return isLocalHref(href) && !isRelativeHref(href);
|
|
88
|
+
}
|
|
89
|
+
function unprefixPathname(pathname, prefix) {
|
|
90
|
+
return pathname.replace(new RegExp("^".concat(prefix)), "") || "/";
|
|
91
|
+
}
|
|
92
|
+
function prefixPathname(prefix, pathname) {
|
|
93
|
+
var localizedHref = prefix;
|
|
94
|
+
// Avoid trailing slashes
|
|
95
|
+
if (/^\/(\?.*)?$/.test(pathname)) {
|
|
96
|
+
pathname = pathname.slice(1);
|
|
97
|
+
}
|
|
98
|
+
localizedHref += pathname;
|
|
99
|
+
return localizedHref;
|
|
100
|
+
}
|
|
101
|
+
function hasPathnamePrefixed(prefix, pathname) {
|
|
102
|
+
return pathname === prefix || pathname.startsWith("".concat(prefix, "/"));
|
|
103
|
+
}
|
|
104
|
+
function hasTrailingSlash() {
|
|
105
|
+
try {
|
|
106
|
+
// Provided via `env` setting in `next.config.js` via the plugin
|
|
107
|
+
return process.env._next_intl_trailing_slash === "true";
|
|
108
|
+
} catch (e) {
|
|
109
|
+
return false;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
function getLocalizedTemplate(pathnameConfig, locale, internalTemplate) {
|
|
113
|
+
return typeof pathnameConfig === "string" ? pathnameConfig : pathnameConfig[locale] || internalTemplate;
|
|
114
|
+
}
|
|
115
|
+
function normalizeTrailingSlash(pathname) {
|
|
116
|
+
var trailingSlash = hasTrailingSlash();
|
|
117
|
+
var ref = _toArray(pathname.split("#")), path = ref[0], hashParts = ref.slice(1);
|
|
118
|
+
var hash = hashParts.join("#");
|
|
119
|
+
var normalizedPath = path;
|
|
120
|
+
if (normalizedPath !== "/") {
|
|
121
|
+
var pathnameEndsWithSlash = normalizedPath.endsWith("/");
|
|
122
|
+
if (trailingSlash && !pathnameEndsWithSlash) {
|
|
123
|
+
normalizedPath += "/";
|
|
124
|
+
} else if (!trailingSlash && pathnameEndsWithSlash) {
|
|
125
|
+
normalizedPath = normalizedPath.slice(0, -1);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
if (hash) {
|
|
129
|
+
normalizedPath += "#" + hash;
|
|
130
|
+
}
|
|
131
|
+
return normalizedPath;
|
|
132
|
+
}
|
|
133
|
+
function matchesPathname(/** E.g. `/users/[userId]-[userName]` */ template, /** E.g. `/users/23-jane` */ pathname) {
|
|
134
|
+
var normalizedTemplate = normalizeTrailingSlash(template);
|
|
135
|
+
var normalizedPathname = normalizeTrailingSlash(pathname);
|
|
136
|
+
var regex = templateToRegex(normalizedTemplate);
|
|
137
|
+
return regex.test(normalizedPathname);
|
|
138
|
+
}
|
|
139
|
+
function getLocalePrefix(locale, localePrefix) {
|
|
140
|
+
var ref;
|
|
141
|
+
return localePrefix.mode !== "never" && ((ref = localePrefix.prefixes) === null || ref === void 0 ? void 0 : ref[locale]) || // We return a prefix even if `mode: 'never'`. It's up to the consumer
|
|
142
|
+
// to decide to use it or not.
|
|
143
|
+
getLocaleAsPrefix(locale);
|
|
144
|
+
}
|
|
145
|
+
function getLocaleAsPrefix(locale) {
|
|
146
|
+
return "/" + locale;
|
|
147
|
+
}
|
|
148
|
+
function templateToRegex(template) {
|
|
149
|
+
var regexPattern = template// Replace optional catchall ('[[...slug]]')
|
|
150
|
+
.replace(/\/\[\[(\.\.\.[^\]]+)\]\]/g, "(?:/(.*))?") // With leading slash
|
|
151
|
+
.replace(/\[\[(\.\.\.[^\]]+)\]\]/g, "(?:/(.*))?") // Without leading slash
|
|
152
|
+
// Replace catchall ('[...slug]')
|
|
153
|
+
.replace(/\[(\.\.\.[^\]]+)\]/g, "(.+)")// Replace regular parameter ('[slug]')
|
|
154
|
+
.replace(/\[([^\]]+)\]/g, "([^/]+)");
|
|
155
|
+
return new RegExp("^".concat(regexPattern, "$"));
|
|
156
|
+
}
|
|
157
|
+
function isOptionalCatchAllSegment(pathname) {
|
|
158
|
+
return pathname.includes("[[...");
|
|
159
|
+
}
|
|
160
|
+
function isCatchAllSegment(pathname) {
|
|
161
|
+
return pathname.includes("[...");
|
|
162
|
+
}
|
|
163
|
+
function isDynamicSegment(pathname) {
|
|
164
|
+
return pathname.includes("[");
|
|
165
|
+
}
|
|
166
|
+
function comparePathnamePairs(a, b) {
|
|
167
|
+
var pathA = a.split("/");
|
|
168
|
+
var pathB = b.split("/");
|
|
169
|
+
var maxLength = Math.max(pathA.length, pathB.length);
|
|
170
|
+
for(var i1 = 0; i1 < maxLength; i1++){
|
|
171
|
+
var segmentA = pathA[i1];
|
|
172
|
+
var segmentB = pathB[i1];
|
|
173
|
+
// If one of the paths ends, prioritize the shorter path
|
|
174
|
+
if (!segmentA && segmentB) return -1;
|
|
175
|
+
if (segmentA && !segmentB) return 1;
|
|
176
|
+
if (!segmentA && !segmentB) continue;
|
|
177
|
+
// Prioritize static segments over dynamic segments
|
|
178
|
+
if (!isDynamicSegment(segmentA) && isDynamicSegment(segmentB)) return -1;
|
|
179
|
+
if (isDynamicSegment(segmentA) && !isDynamicSegment(segmentB)) return 1;
|
|
180
|
+
// Prioritize non-catch-all segments over catch-all segments
|
|
181
|
+
if (!isCatchAllSegment(segmentA) && isCatchAllSegment(segmentB)) return -1;
|
|
182
|
+
if (isCatchAllSegment(segmentA) && !isCatchAllSegment(segmentB)) return 1;
|
|
183
|
+
// Prioritize non-optional catch-all segments over optional catch-all segments
|
|
184
|
+
if (!isOptionalCatchAllSegment(segmentA) && isOptionalCatchAllSegment(segmentB)) {
|
|
185
|
+
return -1;
|
|
186
|
+
}
|
|
187
|
+
if (isOptionalCatchAllSegment(segmentA) && !isOptionalCatchAllSegment(segmentB)) {
|
|
188
|
+
return 1;
|
|
189
|
+
}
|
|
190
|
+
if (segmentA === segmentB) continue;
|
|
191
|
+
}
|
|
192
|
+
// Both pathnames are completely static
|
|
193
|
+
return 0;
|
|
194
|
+
}
|
|
195
|
+
function getSortedPathnames(pathnames) {
|
|
196
|
+
return pathnames.sort(comparePathnamePairs);
|
|
197
|
+
}
|
|
198
|
+
function isPromise(value) {
|
|
199
|
+
// https://github.com/amannn/next-intl/issues/1711
|
|
200
|
+
return typeof value.then === "function";
|
|
201
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "default", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return t;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
function t() {
|
|
12
|
+
throw new Error("Couldn't find next-intl config file. Please follow the instructions at https://next-intl.dev/docs/getting-started/app-router");
|
|
13
|
+
}
|