@intlayer/next-intl 9.7.0 → 9.7.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.
Files changed (123) hide show
  1. package/dist/cjs/_virtual/_rolldown/runtime.cjs +1 -2
  2. package/dist/cjs/client/NextIntlClientProvider.cjs +2 -3
  3. package/dist/cjs/client/NextIntlClientProvider.cjs.map +1 -1
  4. package/dist/cjs/client/index.cjs +11 -11
  5. package/dist/cjs/client/useLocale.cjs +1 -2
  6. package/dist/cjs/getDictionary.cjs +2 -3
  7. package/dist/cjs/getDictionaryDynamic.cjs +2 -3
  8. package/dist/cjs/index.cjs +18 -18
  9. package/dist/cjs/middleware.cjs +1 -2
  10. package/dist/cjs/middleware.cjs.map +1 -1
  11. package/dist/cjs/navigation/Link.cjs +4 -5
  12. package/dist/cjs/navigation/Link.cjs.map +1 -1
  13. package/dist/cjs/navigation/createNavigation.cjs +4 -5
  14. package/dist/cjs/navigation/createNavigation.cjs.map +1 -1
  15. package/dist/cjs/navigation/hooks.cjs +2 -3
  16. package/dist/cjs/navigation/hooks.cjs.map +1 -1
  17. package/dist/cjs/navigation/index.cjs +3 -3
  18. package/dist/cjs/navigation/localizeHref.cjs +1 -2
  19. package/dist/cjs/plugin/index.cjs +3 -4
  20. package/dist/cjs/routing.cjs +1 -2
  21. package/dist/cjs/server/getLocale.cjs +2 -3
  22. package/dist/cjs/server/getMessages.cjs +1 -2
  23. package/dist/cjs/server/getRequestConfig.cjs +1 -2
  24. package/dist/cjs/server/getTranslations.cjs +2 -3
  25. package/dist/cjs/server/helpers.cjs +2 -3
  26. package/dist/cjs/server/index.cjs +9 -9
  27. package/dist/cjs/server/react/helpers.cjs +2 -3
  28. package/dist/cjs/server/react/index.cjs +14 -14
  29. package/dist/cjs/server/react/resolveLocale.cjs +2 -3
  30. package/dist/cjs/server/react/useDictionary.cjs +2 -3
  31. package/dist/cjs/server/react/useDictionaryDynamic.cjs +2 -3
  32. package/dist/cjs/server/react/useLocale.cjs +2 -3
  33. package/dist/cjs/server/react/useTranslations.cjs +2 -3
  34. package/dist/cjs/server/requestLocaleCache.cjs +1 -2
  35. package/dist/cjs/server/setLocale.cjs +1 -2
  36. package/dist/cjs/server/setRequestLocale.cjs +2 -3
  37. package/dist/esm/client/NextIntlClientProvider.mjs +2 -3
  38. package/dist/esm/client/NextIntlClientProvider.mjs.map +1 -1
  39. package/dist/esm/client/useLocale.mjs +1 -2
  40. package/dist/esm/getDictionary.mjs +1 -2
  41. package/dist/esm/getDictionaryDynamic.mjs +1 -2
  42. package/dist/esm/index.mjs +2 -2
  43. package/dist/esm/middleware.mjs +1 -2
  44. package/dist/esm/middleware.mjs.map +1 -1
  45. package/dist/esm/navigation/Link.mjs +2 -3
  46. package/dist/esm/navigation/Link.mjs.map +1 -1
  47. package/dist/esm/navigation/createNavigation.mjs +3 -4
  48. package/dist/esm/navigation/createNavigation.mjs.map +1 -1
  49. package/dist/esm/navigation/hooks.mjs +1 -2
  50. package/dist/esm/navigation/hooks.mjs.map +1 -1
  51. package/dist/esm/navigation/index.mjs +2 -2
  52. package/dist/esm/navigation/localizeHref.mjs +1 -2
  53. package/dist/esm/plugin/index.mjs +2 -3
  54. package/dist/esm/routing.mjs +1 -2
  55. package/dist/esm/server/getLocale.mjs +1 -2
  56. package/dist/esm/server/getMessages.mjs +1 -2
  57. package/dist/esm/server/getRequestConfig.mjs +1 -2
  58. package/dist/esm/server/getTranslations.mjs +1 -2
  59. package/dist/esm/server/helpers.mjs +1 -2
  60. package/dist/esm/server/index.mjs +3 -3
  61. package/dist/esm/server/react/helpers.mjs +1 -2
  62. package/dist/esm/server/react/index.mjs +3 -3
  63. package/dist/esm/server/react/resolveLocale.mjs +1 -2
  64. package/dist/esm/server/react/useDictionary.mjs +1 -2
  65. package/dist/esm/server/react/useDictionaryDynamic.mjs +1 -2
  66. package/dist/esm/server/react/useLocale.mjs +1 -2
  67. package/dist/esm/server/react/useTranslations.mjs +1 -2
  68. package/dist/esm/server/requestLocaleCache.mjs +1 -2
  69. package/dist/esm/server/setLocale.mjs +1 -2
  70. package/dist/esm/server/setRequestLocale.mjs +1 -2
  71. package/dist/types/client/NextIntlClientProvider.d.ts +0 -2
  72. package/dist/types/client/NextIntlClientProvider.d.ts.map +1 -1
  73. package/dist/types/client/useLocale.d.ts +0 -2
  74. package/dist/types/client/useLocale.d.ts.map +1 -1
  75. package/dist/types/getDictionary.d.ts +1 -2
  76. package/dist/types/getDictionary.d.ts.map +1 -1
  77. package/dist/types/getDictionaryDynamic.d.ts +1 -2
  78. package/dist/types/getDictionaryDynamic.d.ts.map +1 -1
  79. package/dist/types/index.d.ts +1 -1
  80. package/dist/types/middleware.d.ts +0 -2
  81. package/dist/types/middleware.d.ts.map +1 -1
  82. package/dist/types/navigation/Link.d.ts +0 -2
  83. package/dist/types/navigation/Link.d.ts.map +1 -1
  84. package/dist/types/navigation/createNavigation.d.ts +0 -2
  85. package/dist/types/navigation/createNavigation.d.ts.map +1 -1
  86. package/dist/types/navigation/hooks.d.ts +1 -2
  87. package/dist/types/navigation/hooks.d.ts.map +1 -1
  88. package/dist/types/navigation/index.d.ts +2 -2
  89. package/dist/types/navigation/localizeHref.d.ts +0 -2
  90. package/dist/types/navigation/localizeHref.d.ts.map +1 -1
  91. package/dist/types/plugin/index.d.ts +0 -2
  92. package/dist/types/plugin/index.d.ts.map +1 -1
  93. package/dist/types/routing.d.ts +0 -2
  94. package/dist/types/routing.d.ts.map +1 -1
  95. package/dist/types/server/getLocale.d.ts +0 -2
  96. package/dist/types/server/getLocale.d.ts.map +1 -1
  97. package/dist/types/server/getMessages.d.ts +0 -2
  98. package/dist/types/server/getMessages.d.ts.map +1 -1
  99. package/dist/types/server/getRequestConfig.d.ts +0 -2
  100. package/dist/types/server/getRequestConfig.d.ts.map +1 -1
  101. package/dist/types/server/getTranslations.d.ts +1 -2
  102. package/dist/types/server/getTranslations.d.ts.map +1 -1
  103. package/dist/types/server/helpers.d.ts +0 -2
  104. package/dist/types/server/helpers.d.ts.map +1 -1
  105. package/dist/types/server/react/helpers.d.ts +0 -2
  106. package/dist/types/server/react/helpers.d.ts.map +1 -1
  107. package/dist/types/server/react/resolveLocale.d.ts +0 -2
  108. package/dist/types/server/react/resolveLocale.d.ts.map +1 -1
  109. package/dist/types/server/react/useDictionary.d.ts +1 -2
  110. package/dist/types/server/react/useDictionary.d.ts.map +1 -1
  111. package/dist/types/server/react/useDictionaryDynamic.d.ts +1 -2
  112. package/dist/types/server/react/useDictionaryDynamic.d.ts.map +1 -1
  113. package/dist/types/server/react/useLocale.d.ts +0 -2
  114. package/dist/types/server/react/useLocale.d.ts.map +1 -1
  115. package/dist/types/server/react/useTranslations.d.ts +1 -2
  116. package/dist/types/server/react/useTranslations.d.ts.map +1 -1
  117. package/dist/types/server/requestLocaleCache.d.ts +0 -2
  118. package/dist/types/server/requestLocaleCache.d.ts.map +1 -1
  119. package/dist/types/server/setLocale.d.ts +0 -2
  120. package/dist/types/server/setLocale.d.ts.map +1 -1
  121. package/dist/types/server/setRequestLocale.d.ts +0 -2
  122. package/dist/types/server/setRequestLocale.d.ts.map +1 -1
  123. package/package.json +51 -51
@@ -1,4 +1,4 @@
1
- //#region \0rolldown/runtime.js
1
+ // \0rolldown/runtime.js
2
2
  var __create = Object.create;
3
3
  var __defProp = Object.defineProperty;
4
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -24,5 +24,4 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
24
24
  enumerable: true
25
25
  }) : target, mod));
26
26
 
27
- //#endregion
28
27
  exports.__toESM = __toESM;
@@ -1,15 +1,15 @@
1
1
  'use client';
2
2
 
3
3
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
- let next_intlayer = require("next-intlayer");
5
4
  let _intlayer_config_built = require("@intlayer/config/built");
6
5
  let _intlayer_config_colors = require("@intlayer/config/colors");
7
6
  let _intlayer_config_logger = require("@intlayer/config/logger");
8
7
  let _intlayer_core_localization = require("@intlayer/core/localization");
8
+ let next_intlayer = require("next-intlayer");
9
9
  let next_navigation = require("next/navigation");
10
10
  let react_jsx_runtime = require("react/jsx-runtime");
11
11
 
12
- //#region src/client/NextIntlClientProvider.tsx
12
+ // src/client/NextIntlClientProvider.tsx
13
13
  /**
14
14
  * Drop-in for next-intl's `NextIntlClientProvider`.
15
15
  * `messages`, `timeZone`, and `now` are accepted for API compatibility
@@ -27,6 +27,5 @@ const NextIntlClientProvider = ({ locale, children, messages: _messages, timeZon
27
27
  }, String(resolvedLocale));
28
28
  };
29
29
 
30
- //#endregion
31
30
  exports.NextIntlClientProvider = NextIntlClientProvider;
32
31
  //# sourceMappingURL=NextIntlClientProvider.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"NextIntlClientProvider.cjs","names":["getAppLogger","colorize","CYAN","usePathname","routing","getLocaleFromPath","IntlayerProvider"],"sources":["../../../src/client/NextIntlClientProvider.tsx"],"sourcesContent":["'use client';\n\nimport { log, routing } from '@intlayer/config/built';\nimport { CYAN } from '@intlayer/config/colors';\nimport { colorize, getAppLogger } from '@intlayer/config/logger';\nimport { getLocaleFromPath } from '@intlayer/core/localization';\nimport type { LocalesValues } from '@intlayer/types/module_augmentation';\nimport { usePathname } from 'next/navigation';\nimport type { NextIntlClientProvider as _NextIntlClientProvider } from 'next-intl';\nimport { IntlayerProvider } from 'next-intlayer';\nimport type { ComponentProps } from 'react';\n\n/**\n * Drop-in for next-intl's `NextIntlClientProvider`.\n * `messages`, `timeZone`, and `now` are accepted for API compatibility\n * but have no effect — Intlayer uses its own compiled dictionaries.\n */\nexport const NextIntlClientProvider: typeof _NextIntlClientProvider = ({\n locale,\n children,\n messages: _messages,\n timeZone: _timeZone,\n now: _now,\n ...rest\n}) => {\n if (\n process.env.NODE_ENV === 'development' &&\n typeof _messages !== 'undefined'\n ) {\n const appLogger = getAppLogger({ log });\n appLogger(\n `${colorize('NextIntlClientProvider', CYAN)} do not pass the messages prop with intlayer. Messages are loaded automatically under the hood for bundle optimization reason`\n );\n }\n\n // next-intl drives the locale from the request: apps render\n // `<NextIntlClientProvider>` without a `locale` prop and the server resolves it\n // from the `[locale]` route segment. As a client component we cannot read the\n // server request here, so when no explicit `locale` is given we derive it from\n // the URL (the same `[locale]` segment) using Intlayer's routing config. This\n // keeps `useLocale`, `Link` and the locale switcher in sync with the URL\n // instead of falling back to the stored cookie / default locale.\n //\n // Only prefix-based routing carries the locale in the path. For `no-prefix` /\n // `search-params` the path has no locale segment, so we leave `locale`\n // undefined and let the provider resolve it from storage (cookie) — deriving\n // from the path there would wrongly clobber the cookie with the default locale.\n const pathname = usePathname();\n const mode = routing?.mode ?? 'prefix-no-default';\n const isPrefixMode = mode === 'prefix-all' || mode === 'prefix-no-default';\n const resolvedLocale =\n locale ?? (isPrefixMode ? getLocaleFromPath(pathname) : undefined);\n\n // `key={resolvedLocale}` remounts the provider when the locale changes via\n // navigation (next-intl switches locale by routing to a locale-prefixed path).\n // This re-seeds the client locale context so client components re-render in\n // the new language instead of keeping the previous one.\n return (\n <IntlayerProvider\n key={String(resolvedLocale)}\n locale={resolvedLocale}\n {...rest}\n >\n {children}\n </IntlayerProvider>\n );\n};\n\n/**\n *\n */\nexport type NextIntlClientProviderProps = Omit<\n ComponentProps<typeof _NextIntlClientProvider>,\n 'messages'\n> & {\n /**\n * @deprecated\n * has no use case with intlayer. Messages are loaded automatically under the hood for bundle optimization reason\n */\n messages?: never;\n /**\n * locale\n */\n locale: LocalesValues;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;AAiBA,MAAa,0BAA0D,EACrE,QACA,UACA,UAAU,WACV,UAAU,WACV,KAAK,MACL,GAAG,WACC;CACJ,6BAC2B,iBACzB,OAAO,cAAc,aAGrB,IADkBA,sCAAa,EAAE,gCAAI,CAC7B,CAAC,CACP,OAAGC,kCAAS,0BAA0BC,4BAAI,EAAE,8HAC9C;CAeF,MAAM,eAAWC,6BAAY;CAC7B,MAAM,OAAOC,gCAAS,QAAQ;CAE9B,MAAM,iBACJ,WAFmB,SAAS,gBAAgB,SAAS,0BAE3BC,+CAAkB,QAAQ,IAAI;CAM1D,OACE,2CAACC,gCAAD;EAEE,QAAQ;EACR,GAAI;EAEH;CACe,GALX,OAAO,cAAc,CAKV;AAEtB"}
1
+ {"version":3,"file":"NextIntlClientProvider.cjs","names":["getAppLogger","colorize","CYAN","usePathname","routing","getLocaleFromPath","IntlayerProvider"],"sources":["../../../src/client/NextIntlClientProvider.tsx"],"sourcesContent":["'use client';\n\nimport { log, routing } from '@intlayer/config/built';\nimport { CYAN } from '@intlayer/config/colors';\nimport { colorize, getAppLogger } from '@intlayer/config/logger';\nimport { getLocaleFromPath } from '@intlayer/core/localization';\nimport type { LocalesValues } from '@intlayer/types/module_augmentation';\nimport type { NextIntlClientProvider as _NextIntlClientProvider } from 'next-intl';\nimport { IntlayerProvider } from 'next-intlayer';\nimport { usePathname } from 'next/navigation';\nimport type { ComponentProps } from 'react';\n\n/**\n * Drop-in for next-intl's `NextIntlClientProvider`.\n * `messages`, `timeZone`, and `now` are accepted for API compatibility\n * but have no effect — Intlayer uses its own compiled dictionaries.\n */\nexport const NextIntlClientProvider: typeof _NextIntlClientProvider = ({\n locale,\n children,\n messages: _messages,\n timeZone: _timeZone,\n now: _now,\n ...rest\n}) => {\n if (\n process.env.NODE_ENV === 'development' &&\n typeof _messages !== 'undefined'\n ) {\n const appLogger = getAppLogger({ log });\n appLogger(\n `${colorize('NextIntlClientProvider', CYAN)} do not pass the messages prop with intlayer. Messages are loaded automatically under the hood for bundle optimization reason`\n );\n }\n\n // next-intl drives the locale from the request: apps render\n // `<NextIntlClientProvider>` without a `locale` prop and the server resolves it\n // from the `[locale]` route segment. As a client component we cannot read the\n // server request here, so when no explicit `locale` is given we derive it from\n // the URL (the same `[locale]` segment) using Intlayer's routing config. This\n // keeps `useLocale`, `Link` and the locale switcher in sync with the URL\n // instead of falling back to the stored cookie / default locale.\n //\n // Only prefix-based routing carries the locale in the path. For `no-prefix` /\n // `search-params` the path has no locale segment, so we leave `locale`\n // undefined and let the provider resolve it from storage (cookie) — deriving\n // from the path there would wrongly clobber the cookie with the default locale.\n const pathname = usePathname();\n const mode = routing?.mode ?? 'prefix-no-default';\n const isPrefixMode = mode === 'prefix-all' || mode === 'prefix-no-default';\n const resolvedLocale =\n locale ?? (isPrefixMode ? getLocaleFromPath(pathname) : undefined);\n\n // `key={resolvedLocale}` remounts the provider when the locale changes via\n // navigation (next-intl switches locale by routing to a locale-prefixed path).\n // This re-seeds the client locale context so client components re-render in\n // the new language instead of keeping the previous one.\n return (\n <IntlayerProvider\n key={String(resolvedLocale)}\n locale={resolvedLocale}\n {...rest}\n >\n {children}\n </IntlayerProvider>\n );\n};\n\n/**\n *\n */\nexport type NextIntlClientProviderProps = Omit<\n ComponentProps<typeof _NextIntlClientProvider>,\n 'messages'\n> & {\n /**\n * @deprecated\n * has no use case with intlayer. Messages are loaded automatically under the hood for bundle optimization reason\n */\n messages?: never;\n /**\n * locale\n */\n locale: LocalesValues;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;AAiBA,MAAa,0BAA0D,EACrE,QACA,UACA,UAAU,WACV,UAAU,WACV,KAAK,MACL,GAAG,WACC;CACJ,6BAC2B,iBACzB,OAAO,cAAc,aAGrB,IADkBA,sCAAa,EAAE,gCAAI,CAC7B,CAAC,CACP,OAAGC,kCAAS,0BAA0BC,4BAAI,EAAE,8HAC9C;CAeF,MAAM,eAAWC,6BAAY;CAC7B,MAAM,OAAOC,gCAAS,QAAQ;CAE9B,MAAM,iBACJ,WAFmB,SAAS,gBAAgB,SAAS,0BAE3BC,+CAAkB,QAAQ,IAAI;CAM1D,OACE,2CAACC,gCAAD;EAEE,QAAQ;EACR,GAAI;EAEH;CACe,GALX,OAAO,cAAc,CAKV;AAEtB"}
@@ -1,59 +1,59 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_client_NextIntlClientProvider = require('./NextIntlClientProvider.cjs');
3
- const require_client_useLocale = require('./useLocale.cjs');
2
+ const require_client_NextIntlClientProvider = require("./NextIntlClientProvider.cjs");
3
+ const require_client_useLocale = require("./useLocale.cjs");
4
4
  let _intlayer_use_intl = require("@intlayer/use-intl");
5
5
 
6
- Object.defineProperty(exports, 'IntlProvider', {
6
+ Object.defineProperty(exports, "IntlProvider", {
7
7
  enumerable: true,
8
8
  get: function () {
9
9
  return _intlayer_use_intl.IntlProvider;
10
10
  }
11
11
  });
12
12
  exports.NextIntlClientProvider = require_client_NextIntlClientProvider.NextIntlClientProvider;
13
- Object.defineProperty(exports, 'useDictionary', {
13
+ Object.defineProperty(exports, "useDictionary", {
14
14
  enumerable: true,
15
15
  get: function () {
16
16
  return _intlayer_use_intl.useDictionary;
17
17
  }
18
18
  });
19
- Object.defineProperty(exports, 'useDictionaryDynamic', {
19
+ Object.defineProperty(exports, "useDictionaryDynamic", {
20
20
  enumerable: true,
21
21
  get: function () {
22
22
  return _intlayer_use_intl.useDictionaryDynamic;
23
23
  }
24
24
  });
25
- Object.defineProperty(exports, 'useExtracted', {
25
+ Object.defineProperty(exports, "useExtracted", {
26
26
  enumerable: true,
27
27
  get: function () {
28
28
  return _intlayer_use_intl._useExtracted;
29
29
  }
30
30
  });
31
- Object.defineProperty(exports, 'useFormatter', {
31
+ Object.defineProperty(exports, "useFormatter", {
32
32
  enumerable: true,
33
33
  get: function () {
34
34
  return _intlayer_use_intl.useFormatter;
35
35
  }
36
36
  });
37
37
  exports.useLocale = require_client_useLocale.useLocale;
38
- Object.defineProperty(exports, 'useMessages', {
38
+ Object.defineProperty(exports, "useMessages", {
39
39
  enumerable: true,
40
40
  get: function () {
41
41
  return _intlayer_use_intl.useMessages;
42
42
  }
43
43
  });
44
- Object.defineProperty(exports, 'useNow', {
44
+ Object.defineProperty(exports, "useNow", {
45
45
  enumerable: true,
46
46
  get: function () {
47
47
  return _intlayer_use_intl.useNow;
48
48
  }
49
49
  });
50
- Object.defineProperty(exports, 'useTimeZone', {
50
+ Object.defineProperty(exports, "useTimeZone", {
51
51
  enumerable: true,
52
52
  get: function () {
53
53
  return _intlayer_use_intl.useTimeZone;
54
54
  }
55
55
  });
56
- Object.defineProperty(exports, 'useTranslations', {
56
+ Object.defineProperty(exports, "useTranslations", {
57
57
  enumerable: true,
58
58
  get: function () {
59
59
  return _intlayer_use_intl.useTranslations;
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
4
  let next_intlayer = require("next-intlayer");
5
5
 
6
- //#region src/client/useLocale.ts
6
+ // src/client/useLocale.ts
7
7
  /**
8
8
  * Drop-in for next-intl's `useLocale`.
9
9
  */
@@ -12,6 +12,5 @@ const useLocale = () => {
12
12
  return locale;
13
13
  };
14
14
 
15
- //#endregion
16
15
  exports.useLocale = useLocale;
17
16
  //# sourceMappingURL=useLocale.cjs.map
@@ -1,9 +1,9 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_server_getLocale = require('./server/getLocale.cjs');
2
+ const require_server_getLocale = require("./server/getLocale.cjs");
3
3
  let _intlayer_use_intl = require("@intlayer/use-intl");
4
4
  let next_intlayer = require("next-intlayer");
5
5
 
6
- //#region src/getDictionary.ts
6
+ // src/getDictionary.ts
7
7
  const readRestArgument = (rest) => {
8
8
  if (typeof rest === "string") return { namespacePrefix: rest };
9
9
  return { localeOverride: rest?.locale };
@@ -30,6 +30,5 @@ const getDictionary = (async (dictionary, rest) => {
30
30
  return (0, _intlayer_use_intl.createDictionaryTranslator)(locale, content, namespacePrefix);
31
31
  });
32
32
 
33
- //#endregion
34
33
  exports.getDictionary = getDictionary;
35
34
  //# sourceMappingURL=getDictionary.cjs.map
@@ -1,9 +1,9 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_server_getLocale = require('./server/getLocale.cjs');
2
+ const require_server_getLocale = require("./server/getLocale.cjs");
3
3
  let _intlayer_use_intl = require("@intlayer/use-intl");
4
4
  let next_intlayer_server = require("next-intlayer/server");
5
5
 
6
- //#region src/getDictionaryDynamic.ts
6
+ // src/getDictionaryDynamic.ts
7
7
  /**
8
8
  * Dynamic dictionary-accepting variant of `getTranslations`.
9
9
  *
@@ -16,6 +16,5 @@ const getDictionaryDynamic = (async (dictionaryPromise, key, namespacePrefix) =>
16
16
  return (0, _intlayer_use_intl.createDictionaryTranslator)(locale, content, namespacePrefix);
17
17
  });
18
18
 
19
- //#endregion
20
19
  exports.getDictionaryDynamic = getDictionaryDynamic;
21
20
  //# sourceMappingURL=getDictionaryDynamic.cjs.map
@@ -1,97 +1,97 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_routing = require('./routing.cjs');
3
- const require_client_NextIntlClientProvider = require('./client/NextIntlClientProvider.cjs');
4
- const require_client_useLocale = require('./client/useLocale.cjs');
2
+ const require_routing = require("./routing.cjs");
3
+ const require_client_NextIntlClientProvider = require("./client/NextIntlClientProvider.cjs");
4
+ const require_client_useLocale = require("./client/useLocale.cjs");
5
5
  let _intlayer_use_intl = require("@intlayer/use-intl");
6
6
 
7
- Object.defineProperty(exports, 'IntlError', {
7
+ Object.defineProperty(exports, "IntlError", {
8
8
  enumerable: true,
9
9
  get: function () {
10
10
  return _intlayer_use_intl.IntlError;
11
11
  }
12
12
  });
13
- Object.defineProperty(exports, 'IntlErrorCode', {
13
+ Object.defineProperty(exports, "IntlErrorCode", {
14
14
  enumerable: true,
15
15
  get: function () {
16
16
  return _intlayer_use_intl.IntlErrorCode;
17
17
  }
18
18
  });
19
- Object.defineProperty(exports, 'IntlProvider', {
19
+ Object.defineProperty(exports, "IntlProvider", {
20
20
  enumerable: true,
21
21
  get: function () {
22
22
  return _intlayer_use_intl.IntlProvider;
23
23
  }
24
24
  });
25
25
  exports.NextIntlClientProvider = require_client_NextIntlClientProvider.NextIntlClientProvider;
26
- Object.defineProperty(exports, 'createFormatter', {
26
+ Object.defineProperty(exports, "createFormatter", {
27
27
  enumerable: true,
28
28
  get: function () {
29
29
  return _intlayer_use_intl.createFormatter;
30
30
  }
31
31
  });
32
- Object.defineProperty(exports, 'createTranslator', {
32
+ Object.defineProperty(exports, "createTranslator", {
33
33
  enumerable: true,
34
34
  get: function () {
35
35
  return _intlayer_use_intl.createTranslator;
36
36
  }
37
37
  });
38
38
  exports.defineRouting = require_routing.defineRouting;
39
- Object.defineProperty(exports, 'hasLocale', {
39
+ Object.defineProperty(exports, "hasLocale", {
40
40
  enumerable: true,
41
41
  get: function () {
42
42
  return _intlayer_use_intl.hasLocale;
43
43
  }
44
44
  });
45
- Object.defineProperty(exports, 'initializeConfig', {
45
+ Object.defineProperty(exports, "initializeConfig", {
46
46
  enumerable: true,
47
47
  get: function () {
48
48
  return _intlayer_use_intl.initializeConfig;
49
49
  }
50
50
  });
51
- Object.defineProperty(exports, 'useDictionary', {
51
+ Object.defineProperty(exports, "useDictionary", {
52
52
  enumerable: true,
53
53
  get: function () {
54
54
  return _intlayer_use_intl.useDictionary;
55
55
  }
56
56
  });
57
- Object.defineProperty(exports, 'useDictionaryDynamic', {
57
+ Object.defineProperty(exports, "useDictionaryDynamic", {
58
58
  enumerable: true,
59
59
  get: function () {
60
60
  return _intlayer_use_intl.useDictionaryDynamic;
61
61
  }
62
62
  });
63
- Object.defineProperty(exports, 'useExtracted', {
63
+ Object.defineProperty(exports, "useExtracted", {
64
64
  enumerable: true,
65
65
  get: function () {
66
66
  return _intlayer_use_intl._useExtracted;
67
67
  }
68
68
  });
69
- Object.defineProperty(exports, 'useFormatter', {
69
+ Object.defineProperty(exports, "useFormatter", {
70
70
  enumerable: true,
71
71
  get: function () {
72
72
  return _intlayer_use_intl.useFormatter;
73
73
  }
74
74
  });
75
75
  exports.useLocale = require_client_useLocale.useLocale;
76
- Object.defineProperty(exports, 'useMessages', {
76
+ Object.defineProperty(exports, "useMessages", {
77
77
  enumerable: true,
78
78
  get: function () {
79
79
  return _intlayer_use_intl.useMessages;
80
80
  }
81
81
  });
82
- Object.defineProperty(exports, 'useNow', {
82
+ Object.defineProperty(exports, "useNow", {
83
83
  enumerable: true,
84
84
  get: function () {
85
85
  return _intlayer_use_intl.useNow;
86
86
  }
87
87
  });
88
- Object.defineProperty(exports, 'useTimeZone', {
88
+ Object.defineProperty(exports, "useTimeZone", {
89
89
  enumerable: true,
90
90
  get: function () {
91
91
  return _intlayer_use_intl.useTimeZone;
92
92
  }
93
93
  });
94
- Object.defineProperty(exports, 'useTranslations', {
94
+ Object.defineProperty(exports, "useTranslations", {
95
95
  enumerable: true,
96
96
  get: function () {
97
97
  return _intlayer_use_intl.useTranslations;
@@ -1,7 +1,7 @@
1
1
  Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
2
2
  let next_intlayer_middleware = require("next-intlayer/middleware");
3
3
 
4
- //#region src/middleware.ts
4
+ // src/middleware.ts
5
5
  /**
6
6
  * Drop-in replacement for next-intl's `createMiddleware`.
7
7
  *
@@ -30,7 +30,6 @@ const createMiddleware = (_routing) => (request, event) => {
30
30
  return response;
31
31
  };
32
32
 
33
- //#endregion
34
33
  exports.createMiddleware = createMiddleware;
35
34
  exports.default = createMiddleware;
36
35
  //# sourceMappingURL=middleware.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"middleware.cjs","names":["intlayerMiddleware"],"sources":["../../src/middleware.ts"],"sourcesContent":["import type { NextFetchEvent, NextRequest } from 'next/server';\nimport type _createMiddleware from 'next-intl/middleware';\nimport { intlayerMiddleware } from 'next-intlayer/middleware';\n\n/**\n * Drop-in replacement for next-intl's `createMiddleware`.\n *\n * Returns Intlayer's proxy/middleware, which handles locale detection and\n * routing from the Intlayer configuration. The `routing` argument is accepted\n * for API compatibility but ignored — locales come from `intlayer.config`.\n *\n * @example\n * ```ts\n * // proxy.ts (or middleware.ts on Next <= 15)\n * import createMiddleware from 'next-intl/middleware';\n * export default createMiddleware(routing);\n * export const config = { matcher: ['/((?!api|_next|.*\\\\..*).*)'] };\n * ```\n */\nexport const createMiddleware: typeof _createMiddleware =\n (_routing?: unknown) => (request: NextRequest, event?: NextFetchEvent) => {\n const response = intlayerMiddleware(request, event);\n\n if (response) {\n // Intlayer middleware writes the resolved locale to the x-intlayer-locale header\n // We read it and explicitly set the NEXT_LOCALE cookie to maintain compatibility with next-intl\n const resolvedLocale = response.headers.get('x-intlayer-locale');\n if (resolvedLocale) {\n response.cookies.set('NEXT_LOCALE', resolvedLocale, {\n path: '/',\n sameSite: 'lax',\n maxAge: 60 * 60 * 24 * 365,\n });\n }\n }\n\n return response;\n };\n\nexport default createMiddleware;\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAmBA,MAAa,oBACV,cAAwB,SAAsB,UAA2B;CACxE,MAAM,eAAWA,6CAAmB,SAAS,KAAK;CAElD,IAAI,UAAU;EAGZ,MAAM,iBAAiB,SAAS,QAAQ,IAAI,mBAAmB;EAC/D,IAAI,gBACF,SAAS,QAAQ,IAAI,eAAe,gBAAgB;GAClD,MAAM;GACN,UAAU;GACV,QAAQ;EACV,CAAC;CAEL;CAEA,OAAO;AACT"}
1
+ {"version":3,"file":"middleware.cjs","names":["intlayerMiddleware"],"sources":["../../src/middleware.ts"],"sourcesContent":["import type _createMiddleware from 'next-intl/middleware';\nimport { intlayerMiddleware } from 'next-intlayer/middleware';\nimport type { NextFetchEvent, NextRequest } from 'next/server';\n\n/**\n * Drop-in replacement for next-intl's `createMiddleware`.\n *\n * Returns Intlayer's proxy/middleware, which handles locale detection and\n * routing from the Intlayer configuration. The `routing` argument is accepted\n * for API compatibility but ignored — locales come from `intlayer.config`.\n *\n * @example\n * ```ts\n * // proxy.ts (or middleware.ts on Next <= 15)\n * import createMiddleware from 'next-intl/middleware';\n * export default createMiddleware(routing);\n * export const config = { matcher: ['/((?!api|_next|.*\\\\..*).*)'] };\n * ```\n */\nexport const createMiddleware: typeof _createMiddleware =\n (_routing?: unknown) => (request: NextRequest, event?: NextFetchEvent) => {\n const response = intlayerMiddleware(request, event);\n\n if (response) {\n // Intlayer middleware writes the resolved locale to the x-intlayer-locale header\n // We read it and explicitly set the NEXT_LOCALE cookie to maintain compatibility with next-intl\n const resolvedLocale = response.headers.get('x-intlayer-locale');\n if (resolvedLocale) {\n response.cookies.set('NEXT_LOCALE', resolvedLocale, {\n path: '/',\n sameSite: 'lax',\n maxAge: 60 * 60 * 24 * 365,\n });\n }\n }\n\n return response;\n };\n\nexport default createMiddleware;\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAmBA,MAAa,oBACV,cAAwB,SAAsB,UAA2B;CACxE,MAAM,eAAWA,6CAAmB,SAAS,KAAK;CAElD,IAAI,UAAU;EAGZ,MAAM,iBAAiB,SAAS,QAAQ,IAAI,mBAAmB;EAC/D,IAAI,gBACF,SAAS,QAAQ,IAAI,eAAe,gBAAgB;GAClD,MAAM;GACN,UAAU;GACV,QAAQ;EACV,CAAC;CAEL;CAEA,OAAO;AACT"}
@@ -1,15 +1,15 @@
1
1
  'use client';
2
2
 
3
3
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
- const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
5
- const require_navigation_localizeHref = require('./localizeHref.cjs');
4
+ const require_runtime = require("../_virtual/_rolldown/runtime.cjs");
5
+ const require_navigation_localizeHref = require("./localizeHref.cjs");
6
6
  let next_intlayer = require("next-intlayer");
7
- let react = require("react");
8
7
  let react_jsx_runtime = require("react/jsx-runtime");
8
+ let react = require("react");
9
9
  let next_link = require("next/link");
10
10
  next_link = require_runtime.__toESM(next_link);
11
11
 
12
- //#region src/navigation/Link.tsx
12
+ // src/navigation/Link.tsx
13
13
  /**
14
14
  * Drop-in for the `Link` returned by next-intl's `createNavigation`. Prefixes
15
15
  * `href` with the active locale (or the `locale` prop) before delegating to
@@ -25,6 +25,5 @@ const Link = (0, react.forwardRef)(({ href, locale, ...rest }, ref) => {
25
25
  });
26
26
  Link.displayName = "Link";
27
27
 
28
- //#endregion
29
28
  exports.Link = Link;
30
29
  //# sourceMappingURL=Link.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"Link.cjs","names":["forwardRef","useLocale","NextLink","localizeHref"],"sources":["../../../src/navigation/Link.tsx"],"sourcesContent":["'use client';\n\nimport NextLink from 'next/link';\nimport { useLocale } from 'next-intlayer';\nimport { type ComponentPropsWithoutRef, forwardRef, type Ref } from 'react';\nimport { localizeHref, type NextIntlHref } from './localizeHref';\n\n/**\n * Props for the compat `Link`: identical to `next/link` except `href` accepts a\n * `next-intl` href and an optional `locale` overrides the current one.\n */\nexport type LinkProps = Omit<\n ComponentPropsWithoutRef<typeof NextLink>,\n 'href' | 'locale'\n> & {\n href: NextIntlHref;\n locale?: string;\n};\n\n/**\n * Drop-in for the `Link` returned by next-intl's `createNavigation`. Prefixes\n * `href` with the active locale (or the `locale` prop) before delegating to\n * `next/link`.\n */\nexport const Link = forwardRef(\n ({ href, locale, ...rest }: LinkProps, ref: Ref<HTMLAnchorElement>) => {\n const { locale: currentLocale } = useLocale();\n const targetLocale = locale ?? (currentLocale as string);\n\n return (\n <NextLink ref={ref} href={localizeHref(href, targetLocale)} {...rest} />\n );\n }\n);\n\nLink.displayName = 'Link';\n"],"mappings":";;;;;;;;;;;;;;;;;AAwBA,MAAa,WAAOA,mBACjB,EAAE,MAAM,QAAQ,GAAG,QAAmB,QAAgC;CACrE,MAAM,EAAE,QAAQ,sBAAkBC,yBAAU;CAG5C,OACE,2CAACC,mBAAD;EAAe;EAAK,MAAMC,6CAAa,MAHpB,UAAW,aAG2B;EAAG,GAAI;CAAO;AAE3E,CACF;AAEA,KAAK,cAAc"}
1
+ {"version":3,"file":"Link.cjs","names":["forwardRef","useLocale","NextLink","localizeHref"],"sources":["../../../src/navigation/Link.tsx"],"sourcesContent":["'use client';\n\nimport { useLocale } from 'next-intlayer';\nimport NextLink from 'next/link';\nimport { type ComponentPropsWithoutRef, forwardRef, type Ref } from 'react';\nimport { localizeHref, type NextIntlHref } from './localizeHref';\n\n/**\n * Props for the compat `Link`: identical to `next/link` except `href` accepts a\n * `next-intl` href and an optional `locale` overrides the current one.\n */\nexport type LinkProps = Omit<\n ComponentPropsWithoutRef<typeof NextLink>,\n 'href' | 'locale'\n> & {\n href: NextIntlHref;\n locale?: string;\n};\n\n/**\n * Drop-in for the `Link` returned by next-intl's `createNavigation`. Prefixes\n * `href` with the active locale (or the `locale` prop) before delegating to\n * `next/link`.\n */\nexport const Link = forwardRef(\n ({ href, locale, ...rest }: LinkProps, ref: Ref<HTMLAnchorElement>) => {\n const { locale: currentLocale } = useLocale();\n const targetLocale = locale ?? (currentLocale as string);\n\n return (\n <NextLink ref={ref} href={localizeHref(href, targetLocale)} {...rest} />\n );\n }\n);\n\nLink.displayName = 'Link';\n"],"mappings":";;;;;;;;;;;;;;;;;AAwBA,MAAa,WAAOA,mBACjB,EAAE,MAAM,QAAQ,GAAG,QAAmB,QAAgC;CACrE,MAAM,EAAE,QAAQ,sBAAkBC,yBAAU;CAG5C,OACE,2CAACC,mBAAD;EAAe;EAAK,MAAMC,6CAAa,MAHpB,UAAW,aAG2B;EAAG,GAAI;CAAO;AAE3E,CACF;AAEA,KAAK,cAAc"}
@@ -1,10 +1,10 @@
1
1
  Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
2
- const require_navigation_localizeHref = require('./localizeHref.cjs');
3
- const require_navigation_Link = require('./Link.cjs');
4
- const require_navigation_hooks = require('./hooks.cjs');
2
+ const require_navigation_hooks = require("./hooks.cjs");
3
+ const require_navigation_Link = require("./Link.cjs");
4
+ const require_navigation_localizeHref = require("./localizeHref.cjs");
5
5
  let next_navigation = require("next/navigation");
6
6
 
7
- //#region src/navigation/createNavigation.ts
7
+ // src/navigation/createNavigation.ts
8
8
  /**
9
9
  * Drop-in replacement for next-intl's `createNavigation`.
10
10
  *
@@ -33,7 +33,6 @@ const createNavigation = (_routing) => {
33
33
  };
34
34
  };
35
35
 
36
- //#endregion
37
36
  exports.createNavigation = createNavigation;
38
37
  exports.default = createNavigation;
39
38
  //# sourceMappingURL=createNavigation.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"createNavigation.cjs","names":["localizeHref","nextRedirect","nextPermanentRedirect","Link"],"sources":["../../../src/navigation/createNavigation.ts"],"sourcesContent":["import {\n permanentRedirect as nextPermanentRedirect,\n redirect as nextRedirect,\n} from 'next/navigation';\nimport type { createNavigation as _createNavigation } from 'next-intl/navigation';\nimport { usePathname, useRouter } from './hooks';\nimport { Link } from './Link';\nimport { localizeHref, type NextIntlHref } from './localizeHref';\n\n/** Arguments shared by `getPathname`, `redirect` and `permanentRedirect`. */\ntype LocalizedHrefArgs = { href: NextIntlHref; locale: string };\n\n/** The optional `RedirectType` accepted by `next/navigation`'s redirect APIs. */\ntype RedirectTypeArg = Parameters<typeof nextRedirect>[1];\n\n/**\n * Drop-in replacement for next-intl's `createNavigation`.\n *\n * Returns locale-aware navigation APIs (`Link`, `usePathname`, `useRouter`,\n * `getPathname`, `redirect`, `permanentRedirect`) backed by Intlayer's routing\n * configuration. The `routing` argument is accepted for API compatibility;\n * locales come from the Intlayer configuration.\n *\n * @example\n * ```ts\n * export const { Link, redirect, usePathname, useRouter, getPathname } =\n * createNavigation();\n * ```\n */\nexport const createNavigation: typeof _createNavigation = (\n _routing?: unknown\n) => {\n const getPathname = ({ href, locale }: LocalizedHrefArgs): string =>\n localizeHref(href, locale);\n\n const redirect = (\n { href, locale }: LocalizedHrefArgs,\n type?: RedirectTypeArg\n ) => nextRedirect(localizeHref(href, locale), type);\n\n const permanentRedirect = (\n { href, locale }: LocalizedHrefArgs,\n type?: RedirectTypeArg\n ) => nextPermanentRedirect(localizeHref(href, locale), type);\n\n return {\n Link: Link as ReturnType<typeof _createNavigation>['Link'],\n usePathname,\n useRouter,\n getPathname,\n redirect,\n permanentRedirect,\n } as ReturnType<typeof _createNavigation>;\n};\n\nexport default createNavigation;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AA6BA,MAAa,oBACX,aACG;CACH,MAAM,eAAe,EAAE,MAAM,aAC3BA,6CAAa,MAAM,MAAM;CAE3B,MAAM,YACJ,EAAE,MAAM,UACR,aACGC,0BAAaD,6CAAa,MAAM,MAAM,GAAG,IAAI;CAElD,MAAM,qBACJ,EAAE,MAAM,UACR,aACGE,mCAAsBF,6CAAa,MAAM,MAAM,GAAG,IAAI;CAE3D,OAAO;EACL,MAAMG;EACN;EACA;EACA;EACA;EACA;CACF;AACF"}
1
+ {"version":3,"file":"createNavigation.cjs","names":["localizeHref","nextRedirect","nextPermanentRedirect","Link"],"sources":["../../../src/navigation/createNavigation.ts"],"sourcesContent":["import type { createNavigation as _createNavigation } from 'next-intl/navigation';\nimport {\n permanentRedirect as nextPermanentRedirect,\n redirect as nextRedirect,\n} from 'next/navigation';\nimport { usePathname, useRouter } from './hooks';\nimport { Link } from './Link';\nimport { localizeHref, type NextIntlHref } from './localizeHref';\n\n/** Arguments shared by `getPathname`, `redirect` and `permanentRedirect`. */\ntype LocalizedHrefArgs = { href: NextIntlHref; locale: string };\n\n/** The optional `RedirectType` accepted by `next/navigation`'s redirect APIs. */\ntype RedirectTypeArg = Parameters<typeof nextRedirect>[1];\n\n/**\n * Drop-in replacement for next-intl's `createNavigation`.\n *\n * Returns locale-aware navigation APIs (`Link`, `usePathname`, `useRouter`,\n * `getPathname`, `redirect`, `permanentRedirect`) backed by Intlayer's routing\n * configuration. The `routing` argument is accepted for API compatibility;\n * locales come from the Intlayer configuration.\n *\n * @example\n * ```ts\n * export const { Link, redirect, usePathname, useRouter, getPathname } =\n * createNavigation();\n * ```\n */\nexport const createNavigation: typeof _createNavigation = (\n _routing?: unknown\n) => {\n const getPathname = ({ href, locale }: LocalizedHrefArgs): string =>\n localizeHref(href, locale);\n\n const redirect = (\n { href, locale }: LocalizedHrefArgs,\n type?: RedirectTypeArg\n ) => nextRedirect(localizeHref(href, locale), type);\n\n const permanentRedirect = (\n { href, locale }: LocalizedHrefArgs,\n type?: RedirectTypeArg\n ) => nextPermanentRedirect(localizeHref(href, locale), type);\n\n return {\n Link: Link as ReturnType<typeof _createNavigation>['Link'],\n usePathname,\n useRouter,\n getPathname,\n redirect,\n permanentRedirect,\n } as ReturnType<typeof _createNavigation>;\n};\n\nexport default createNavigation;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AA6BA,MAAa,oBACX,aACG;CACH,MAAM,eAAe,EAAE,MAAM,aAC3BA,6CAAa,MAAM,MAAM;CAE3B,MAAM,YACJ,EAAE,MAAM,UACR,aACGC,0BAAaD,6CAAa,MAAM,MAAM,GAAG,IAAI;CAElD,MAAM,qBACJ,EAAE,MAAM,UACR,aACGE,mCAAsBF,6CAAa,MAAM,MAAM,GAAG,IAAI;CAE3D,OAAO;EACL,MAAMG;EACN;EACA;EACA;EACA;EACA;CACF;AACF"}
@@ -1,11 +1,11 @@
1
1
  'use client';
2
2
 
3
3
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
- const require_navigation_localizeHref = require('./localizeHref.cjs');
4
+ const require_navigation_localizeHref = require("./localizeHref.cjs");
5
5
  let next_intlayer = require("next-intlayer");
6
6
  let next_navigation = require("next/navigation");
7
7
 
8
- //#region src/navigation/hooks.ts
8
+ // src/navigation/hooks.ts
9
9
  /**
10
10
  * Drop-in for the `usePathname` returned by next-intl's `createNavigation`.
11
11
  * Returns the current pathname with the locale prefix stripped.
@@ -35,7 +35,6 @@ const useRouter = () => {
35
35
  };
36
36
  };
37
37
 
38
- //#endregion
39
38
  exports.usePathname = usePathname;
40
39
  exports.useRouter = useRouter;
41
40
  //# sourceMappingURL=hooks.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"hooks.cjs","names":["useNextPathname","useLocale","useNextRouter","localizeHref"],"sources":["../../../src/navigation/hooks.ts"],"sourcesContent":["'use client';\n\nimport {\n usePathname as useNextPathname,\n useRouter as useNextRouter,\n} from 'next/navigation';\nimport { useLocale } from 'next-intlayer';\nimport { localizeHref, type NextIntlHref } from './localizeHref';\n\n/**\n * Options accepted by the locale-aware router methods: the standard Next.js\n * navigate options plus an optional target `locale`.\n */\ntype NavigateOptions = { locale?: string } & Record<string, unknown>;\n\n/**\n * Drop-in for the `usePathname` returned by next-intl's `createNavigation`.\n * Returns the current pathname with the locale prefix stripped.\n */\nexport const usePathname = (): string => {\n const pathname = useNextPathname();\n const { locale } = useLocale();\n const prefix = `/${locale}`;\n\n if (pathname === prefix) return '/';\n if (pathname.startsWith(`${prefix}/`)) return pathname.slice(prefix.length);\n return pathname;\n};\n\n/**\n * Drop-in for the `useRouter` returned by next-intl's `createNavigation`.\n * Wraps the Next.js router so `push`/`replace`/`prefetch` localize their href\n * (honouring an optional `locale` option) before navigating.\n */\nexport const useRouter = () => {\n const router = useNextRouter();\n const { locale: currentLocale } = useLocale();\n\n const localize = (href: NextIntlHref, locale?: string): string =>\n localizeHref(href, locale ?? (currentLocale as string));\n\n return {\n ...router,\n push: (href: NextIntlHref, options?: NavigateOptions) =>\n router.push(\n localize(href, options?.locale),\n options as Parameters<typeof router.push>[1]\n ),\n replace: (href: NextIntlHref, options?: NavigateOptions) =>\n router.replace(\n localize(href, options?.locale),\n options as Parameters<typeof router.replace>[1]\n ),\n prefetch: (href: NextIntlHref, options?: NavigateOptions) =>\n router.prefetch(localize(href, options?.locale)),\n };\n};\n"],"mappings":";;;;;;;;;;;;AAmBA,MAAa,oBAA4B;CACvC,MAAM,eAAWA,6BAAgB;CACjC,MAAM,EAAE,eAAWC,yBAAU;CAC7B,MAAM,SAAS,IAAI;CAEnB,IAAI,aAAa,QAAQ,OAAO;CAChC,IAAI,SAAS,WAAW,GAAG,OAAO,EAAE,GAAG,OAAO,SAAS,MAAM,OAAO,MAAM;CAC1E,OAAO;AACT;;;;;;AAOA,MAAa,kBAAkB;CAC7B,MAAM,aAASC,2BAAc;CAC7B,MAAM,EAAE,QAAQ,sBAAkBD,yBAAU;CAE5C,MAAM,YAAY,MAAoB,WACpCE,6CAAa,MAAM,UAAW,aAAwB;CAExD,OAAO;EACL,GAAG;EACH,OAAO,MAAoB,YACzB,OAAO,KACL,SAAS,MAAM,SAAS,MAAM,GAC9B,OACF;EACF,UAAU,MAAoB,YAC5B,OAAO,QACL,SAAS,MAAM,SAAS,MAAM,GAC9B,OACF;EACF,WAAW,MAAoB,YAC7B,OAAO,SAAS,SAAS,MAAM,SAAS,MAAM,CAAC;CACnD;AACF"}
1
+ {"version":3,"file":"hooks.cjs","names":["useNextPathname","useLocale","useNextRouter","localizeHref"],"sources":["../../../src/navigation/hooks.ts"],"sourcesContent":["'use client';\n\nimport { useLocale } from 'next-intlayer';\nimport {\n usePathname as useNextPathname,\n useRouter as useNextRouter,\n} from 'next/navigation';\nimport { localizeHref, type NextIntlHref } from './localizeHref';\n\n/**\n * Options accepted by the locale-aware router methods: the standard Next.js\n * navigate options plus an optional target `locale`.\n */\ntype NavigateOptions = { locale?: string } & Record<string, unknown>;\n\n/**\n * Drop-in for the `usePathname` returned by next-intl's `createNavigation`.\n * Returns the current pathname with the locale prefix stripped.\n */\nexport const usePathname = (): string => {\n const pathname = useNextPathname();\n const { locale } = useLocale();\n const prefix = `/${locale}`;\n\n if (pathname === prefix) return '/';\n if (pathname.startsWith(`${prefix}/`)) return pathname.slice(prefix.length);\n return pathname;\n};\n\n/**\n * Drop-in for the `useRouter` returned by next-intl's `createNavigation`.\n * Wraps the Next.js router so `push`/`replace`/`prefetch` localize their href\n * (honouring an optional `locale` option) before navigating.\n */\nexport const useRouter = () => {\n const router = useNextRouter();\n const { locale: currentLocale } = useLocale();\n\n const localize = (href: NextIntlHref, locale?: string): string =>\n localizeHref(href, locale ?? (currentLocale as string));\n\n return {\n ...router,\n push: (href: NextIntlHref, options?: NavigateOptions) =>\n router.push(\n localize(href, options?.locale),\n options as Parameters<typeof router.push>[1]\n ),\n replace: (href: NextIntlHref, options?: NavigateOptions) =>\n router.replace(\n localize(href, options?.locale),\n options as Parameters<typeof router.replace>[1]\n ),\n prefetch: (href: NextIntlHref, options?: NavigateOptions) =>\n router.prefetch(localize(href, options?.locale)),\n };\n};\n"],"mappings":";;;;;;;;;;;;AAmBA,MAAa,oBAA4B;CACvC,MAAM,eAAWA,6BAAgB;CACjC,MAAM,EAAE,eAAWC,yBAAU;CAC7B,MAAM,SAAS,IAAI;CAEnB,IAAI,aAAa,QAAQ,OAAO;CAChC,IAAI,SAAS,WAAW,GAAG,OAAO,EAAE,GAAG,OAAO,SAAS,MAAM,OAAO,MAAM;CAC1E,OAAO;AACT;;;;;;AAOA,MAAa,kBAAkB;CAC7B,MAAM,aAASC,2BAAc;CAC7B,MAAM,EAAE,QAAQ,sBAAkBD,yBAAU;CAE5C,MAAM,YAAY,MAAoB,WACpCE,6CAAa,MAAM,UAAW,aAAwB;CAExD,OAAO;EACL,GAAG;EACH,OAAO,MAAoB,YACzB,OAAO,KACL,SAAS,MAAM,SAAS,MAAM,GAC9B,OACF;EACF,UAAU,MAAoB,YAC5B,OAAO,QACL,SAAS,MAAM,SAAS,MAAM,GAC9B,OACF;EACF,WAAW,MAAoB,YAC7B,OAAO,SAAS,SAAS,MAAM,SAAS,MAAM,CAAC;CACnD;AACF"}
@@ -1,7 +1,7 @@
1
1
  Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
2
- const require_navigation_Link = require('./Link.cjs');
3
- const require_navigation_hooks = require('./hooks.cjs');
4
- const require_navigation_createNavigation = require('./createNavigation.cjs');
2
+ const require_navigation_createNavigation = require("./createNavigation.cjs");
3
+ const require_navigation_hooks = require("./hooks.cjs");
4
+ const require_navigation_Link = require("./Link.cjs");
5
5
 
6
6
  exports.Link = require_navigation_Link.Link;
7
7
  exports.createNavigation = require_navigation_createNavigation.createNavigation;
@@ -1,7 +1,7 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
  let _intlayer_core_localization = require("@intlayer/core/localization");
3
3
 
4
- //#region src/navigation/localizeHref.ts
4
+ // src/navigation/localizeHref.ts
5
5
  /**
6
6
  * Prefix a `next-intl` href with the given locale using Intlayer's
7
7
  * `getLocalizedUrl`, preserving any query parameters.
@@ -21,6 +21,5 @@ const localizeHref = (href, locale) => {
21
21
  return queryString ? `${localizedPathname}?${queryString}` : localizedPathname;
22
22
  };
23
23
 
24
- //#endregion
25
24
  exports.localizeHref = localizeHref;
26
25
  //# sourceMappingURL=localizeHref.cjs.map
@@ -1,16 +1,16 @@
1
1
  Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
2
- const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
3
- let next_intlayer_server = require("next-intlayer/server");
2
+ const require_runtime = require("../_virtual/_rolldown/runtime.cjs");
4
3
  let _intlayer_config_colors = require("@intlayer/config/colors");
5
4
  _intlayer_config_colors = require_runtime.__toESM(_intlayer_config_colors);
6
5
  let _intlayer_config_logger = require("@intlayer/config/logger");
6
+ let next_intlayer_server = require("next-intlayer/server");
7
7
  let node_module = require("node:module");
8
8
  let node_path = require("node:path");
9
9
  let _intlayer_config_callers = require("@intlayer/config/callers");
10
10
  let _intlayer_config_node = require("@intlayer/config/node");
11
11
  let _intlayer_engine_utils = require("@intlayer/engine/utils");
12
12
 
13
- //#region src/plugin/index.ts
13
+ // src/plugin/index.ts
14
14
  /**
15
15
  * `require` that works in both the CJS and ESM builds of this plugin.
16
16
  * `import.meta.url` is rewritten to the module path in the CJS output by the
@@ -176,7 +176,6 @@ const createNextIntlPlugin = (_i18nPath) => {
176
176
  };
177
177
  };
178
178
 
179
- //#endregion
180
179
  exports.createNextIntlPlugin = createNextIntlPlugin;
181
180
  exports.default = createNextIntlPlugin;
182
181
  //# sourceMappingURL=index.cjs.map
@@ -1,7 +1,7 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
  let _intlayer_config_built = require("@intlayer/config/built");
3
3
 
4
- //#region src/routing.ts
4
+ // src/routing.ts
5
5
  /**
6
6
  * Drop-in replacement for next-intl's `defineRouting()`.
7
7
  *
@@ -24,6 +24,5 @@ const defineRouting = (config) => ({
24
24
  ...config
25
25
  });
26
26
 
27
- //#endregion
28
27
  exports.defineRouting = defineRouting;
29
28
  //# sourceMappingURL=routing.cjs.map
@@ -1,8 +1,8 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_server_requestLocaleCache = require('./requestLocaleCache.cjs');
2
+ const require_server_requestLocaleCache = require("./requestLocaleCache.cjs");
3
3
  let next_intlayer_server = require("next-intlayer/server");
4
4
 
5
- //#region src/server/getLocale.ts
5
+ // src/server/getLocale.ts
6
6
  /**
7
7
  * Drop-in for next-intl's `getLocale()` server function.
8
8
  *
@@ -21,6 +21,5 @@ const getLocale = async () => {
21
21
  return await (0, next_intlayer_server.getLocale)();
22
22
  };
23
23
 
24
- //#endregion
25
24
  exports.getLocale = getLocale;
26
25
  //# sourceMappingURL=getLocale.cjs.map
@@ -3,7 +3,7 @@ let _intlayer_config_built = require("@intlayer/config/built");
3
3
  let _intlayer_config_colors = require("@intlayer/config/colors");
4
4
  let _intlayer_config_logger = require("@intlayer/config/logger");
5
5
 
6
- //#region src/server/getMessages.ts
6
+ // src/server/getMessages.ts
7
7
  /**
8
8
  * Drop-in replacement for next-intl's `getMessages()` server function.
9
9
  *
@@ -24,6 +24,5 @@ const getMessages = async () => {
24
24
  return {};
25
25
  };
26
26
 
27
- //#endregion
28
27
  exports.getMessages = getMessages;
29
28
  //# sourceMappingURL=getMessages.cjs.map
@@ -3,7 +3,7 @@ let _intlayer_config_built = require("@intlayer/config/built");
3
3
  let _intlayer_config_colors = require("@intlayer/config/colors");
4
4
  let _intlayer_config_logger = require("@intlayer/config/logger");
5
5
 
6
- //#region src/server/getRequestConfig.ts
6
+ // src/server/getRequestConfig.ts
7
7
  /**
8
8
  * Drop-in for next-intl's `getRequestConfig`.
9
9
  *
@@ -21,7 +21,6 @@ const getRequestConfig = (createRequestConfig) => {
21
21
  return createRequestConfig;
22
22
  };
23
23
 
24
- //#endregion
25
24
  exports.default = getRequestConfig;
26
25
  exports.getRequestConfig = getRequestConfig;
27
26
  //# sourceMappingURL=getRequestConfig.cjs.map
@@ -1,8 +1,8 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_server_getLocale = require('./getLocale.cjs');
2
+ const require_server_getLocale = require("./getLocale.cjs");
3
3
  let _intlayer_use_intl = require("@intlayer/use-intl");
4
4
 
5
- //#region src/server/getTranslations.ts
5
+ // src/server/getTranslations.ts
6
6
  /**
7
7
  * Drop-in for next-intl's server `getTranslations()`.
8
8
  *
@@ -45,6 +45,5 @@ const getTranslations = (async (namespaceOrOptions) => {
45
45
  });
46
46
  });
47
47
 
48
- //#endregion
49
48
  exports.getTranslations = getTranslations;
50
49
  //# sourceMappingURL=getTranslations.cjs.map
@@ -1,8 +1,8 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_server_getLocale = require('./getLocale.cjs');
2
+ const require_server_getLocale = require("./getLocale.cjs");
3
3
  let _intlayer_use_intl = require("@intlayer/use-intl");
4
4
 
5
- //#region src/server/helpers.ts
5
+ // src/server/helpers.ts
6
6
  /**
7
7
  * Drop-in for next-intl's server `getFormatter()`.
8
8
  * Returns locale-aware formatters backed by the native `Intl.*` APIs,
@@ -23,7 +23,6 @@ const getNow = (async () => /* @__PURE__ */ new Date());
23
23
  */
24
24
  const getTimeZone = (async () => Intl.DateTimeFormat().resolvedOptions().timeZone);
25
25
 
26
- //#endregion
27
26
  exports.getFormatter = getFormatter;
28
27
  exports.getNow = getNow;
29
28
  exports.getTimeZone = getTimeZone;