@intlayer/next-intl 9.0.0-canary.8 → 9.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (99) hide show
  1. package/dist/cjs/client/NextIntlClientProvider.cjs +0 -1
  2. package/dist/cjs/client/NextIntlClientProvider.cjs.map +1 -1
  3. package/dist/cjs/client/index.cjs +0 -1
  4. package/dist/cjs/client/useLocale.cjs +0 -1
  5. package/dist/cjs/client/useLocale.cjs.map +1 -1
  6. package/dist/cjs/getDictionary.cjs +19 -30
  7. package/dist/cjs/getDictionary.cjs.map +1 -1
  8. package/dist/cjs/getDictionaryDynamic.cjs +8 -24
  9. package/dist/cjs/getDictionaryDynamic.cjs.map +1 -1
  10. package/dist/cjs/index.cjs +0 -1
  11. package/dist/cjs/middleware.cjs +0 -1
  12. package/dist/cjs/middleware.cjs.map +1 -1
  13. package/dist/cjs/navigation/Link.cjs.map +1 -1
  14. package/dist/cjs/navigation/createNavigation.cjs +0 -1
  15. package/dist/cjs/navigation/createNavigation.cjs.map +1 -1
  16. package/dist/cjs/navigation/hooks.cjs +0 -1
  17. package/dist/cjs/navigation/hooks.cjs.map +1 -1
  18. package/dist/cjs/navigation/localizeHref.cjs +0 -1
  19. package/dist/cjs/navigation/localizeHref.cjs.map +1 -1
  20. package/dist/cjs/plugin/index.cjs +9 -15
  21. package/dist/cjs/plugin/index.cjs.map +1 -1
  22. package/dist/cjs/routing.cjs +0 -1
  23. package/dist/cjs/routing.cjs.map +1 -1
  24. package/dist/cjs/server/getLocale.cjs +0 -1
  25. package/dist/cjs/server/getLocale.cjs.map +1 -1
  26. package/dist/cjs/server/getMessages.cjs +0 -1
  27. package/dist/cjs/server/getMessages.cjs.map +1 -1
  28. package/dist/cjs/server/getRequestConfig.cjs +0 -1
  29. package/dist/cjs/server/getRequestConfig.cjs.map +1 -1
  30. package/dist/cjs/server/getTranslations.cjs +0 -1
  31. package/dist/cjs/server/getTranslations.cjs.map +1 -1
  32. package/dist/cjs/server/helpers.cjs +0 -1
  33. package/dist/cjs/server/helpers.cjs.map +1 -1
  34. package/dist/cjs/server/index.cjs +1 -1
  35. package/dist/cjs/server/requestLocaleCache.cjs +0 -1
  36. package/dist/cjs/server/requestLocaleCache.cjs.map +1 -1
  37. package/dist/cjs/server/setLocale.cjs +0 -1
  38. package/dist/cjs/server/setLocale.cjs.map +1 -1
  39. package/dist/cjs/server/setRequestLocale.cjs.map +1 -1
  40. package/dist/esm/client/NextIntlClientProvider.mjs.map +1 -1
  41. package/dist/esm/client/useLocale.mjs.map +1 -1
  42. package/dist/esm/getDictionary.mjs +19 -29
  43. package/dist/esm/getDictionary.mjs.map +1 -1
  44. package/dist/esm/getDictionaryDynamic.mjs +8 -23
  45. package/dist/esm/getDictionaryDynamic.mjs.map +1 -1
  46. package/dist/esm/middleware.mjs.map +1 -1
  47. package/dist/esm/navigation/Link.mjs.map +1 -1
  48. package/dist/esm/navigation/createNavigation.mjs.map +1 -1
  49. package/dist/esm/navigation/hooks.mjs.map +1 -1
  50. package/dist/esm/navigation/localizeHref.mjs.map +1 -1
  51. package/dist/esm/plugin/index.mjs +8 -14
  52. package/dist/esm/plugin/index.mjs.map +1 -1
  53. package/dist/esm/routing.mjs.map +1 -1
  54. package/dist/esm/server/getLocale.mjs.map +1 -1
  55. package/dist/esm/server/getMessages.mjs.map +1 -1
  56. package/dist/esm/server/getRequestConfig.mjs.map +1 -1
  57. package/dist/esm/server/getTranslations.mjs.map +1 -1
  58. package/dist/esm/server/helpers.mjs.map +1 -1
  59. package/dist/esm/server/requestLocaleCache.mjs.map +1 -1
  60. package/dist/esm/server/setLocale.mjs.map +1 -1
  61. package/dist/esm/server/setRequestLocale.mjs.map +1 -1
  62. package/dist/types/client/NextIntlClientProvider.d.ts +0 -1
  63. package/dist/types/client/NextIntlClientProvider.d.ts.map +1 -1
  64. package/dist/types/client/useLocale.d.ts +0 -1
  65. package/dist/types/client/useLocale.d.ts.map +1 -1
  66. package/dist/types/getDictionary.d.ts +25 -13
  67. package/dist/types/getDictionary.d.ts.map +1 -1
  68. package/dist/types/getDictionaryDynamic.d.ts +15 -7
  69. package/dist/types/getDictionaryDynamic.d.ts.map +1 -1
  70. package/dist/types/index.d.ts +1 -1
  71. package/dist/types/middleware.d.ts +0 -1
  72. package/dist/types/middleware.d.ts.map +1 -1
  73. package/dist/types/navigation/Link.d.ts +3 -6
  74. package/dist/types/navigation/Link.d.ts.map +1 -1
  75. package/dist/types/navigation/createNavigation.d.ts +0 -1
  76. package/dist/types/navigation/createNavigation.d.ts.map +1 -1
  77. package/dist/types/navigation/hooks.d.ts +4 -6
  78. package/dist/types/navigation/hooks.d.ts.map +1 -1
  79. package/dist/types/navigation/localizeHref.d.ts.map +1 -1
  80. package/dist/types/plugin/index.d.ts +0 -1
  81. package/dist/types/plugin/index.d.ts.map +1 -1
  82. package/dist/types/routing.d.ts +0 -1
  83. package/dist/types/routing.d.ts.map +1 -1
  84. package/dist/types/server/getLocale.d.ts +0 -1
  85. package/dist/types/server/getLocale.d.ts.map +1 -1
  86. package/dist/types/server/getMessages.d.ts +0 -1
  87. package/dist/types/server/getMessages.d.ts.map +1 -1
  88. package/dist/types/server/getRequestConfig.d.ts +0 -1
  89. package/dist/types/server/getRequestConfig.d.ts.map +1 -1
  90. package/dist/types/server/getTranslations.d.ts +7 -5
  91. package/dist/types/server/getTranslations.d.ts.map +1 -1
  92. package/dist/types/server/helpers.d.ts +0 -1
  93. package/dist/types/server/helpers.d.ts.map +1 -1
  94. package/dist/types/server/requestLocaleCache.d.ts +0 -1
  95. package/dist/types/server/requestLocaleCache.d.ts.map +1 -1
  96. package/dist/types/server/setLocale.d.ts.map +1 -1
  97. package/dist/types/server/setRequestLocale.d.ts +0 -1
  98. package/dist/types/server/setRequestLocale.d.ts.map +1 -1
  99. package/package.json +14 -14
@@ -1,7 +1,6 @@
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
4
  let _intlayer_config_built = require("@intlayer/config/built");
6
5
  let next_intlayer = require("next-intlayer");
7
6
  let _intlayer_config_colors = require("@intlayer/config/colors");
@@ -1 +1 @@
1
- {"version":3,"file":"NextIntlClientProvider.cjs","names":["CYAN","routing","IntlayerClientProvider"],"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 { IntlayerClientProvider } 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 <IntlayerClientProvider\n key={String(resolvedLocale)}\n locale={resolvedLocale}\n {...rest}\n >\n {children}\n </IntlayerClientProvider>\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;AACJ,KACE,QAAQ,IAAI,aAAa,iBACzB,OAAO,cAAc,YAGrB,2CAD+B,EAAE,iCAAK,CAC7B,CACP,yCAAY,0BAA0BA,6BAAK,CAAC,+HAC7C;CAeH,MAAM,6CAAwB;CAC9B,MAAM,OAAOC,gCAAS,QAAQ;CAE9B,MAAM,iBACJ,WAFmB,SAAS,gBAAgB,SAAS,yEAET,SAAS,GAAG;AAM1D,QACE,2CAACC,sCAAD;EAEE,QAAQ;EACR,GAAI;EAEH;EACsB,EALlB,OAAO,eAAe,CAKJ"}
1
+ {"version":3,"file":"NextIntlClientProvider.cjs","names":["CYAN","routing","IntlayerClientProvider"],"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 { IntlayerClientProvider } 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 <IntlayerClientProvider\n key={String(resolvedLocale)}\n locale={resolvedLocale}\n {...rest}\n >\n {children}\n </IntlayerClientProvider>\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,IACE,QAAQ,IAAI,aAAa,iBACzB,OAAO,cAAc,aAGrB,0CAD+B,EAAE,gCAAI,CAC7B,CAAC,CACP,yCAAY,0BAA0BA,4BAAI,EAAE,8HAC9C;CAeF,MAAM,4CAAuB;CAC7B,MAAM,OAAOC,gCAAS,QAAQ;CAE9B,MAAM,iBACJ,WAFmB,SAAS,gBAAgB,SAAS,yEAET,QAAQ,IAAI;CAM1D,OACE,2CAACC,sCAAD;EAEE,QAAQ;EACR,GAAI;EAEH;CACqB,GALjB,OAAO,cAAc,CAKJ;AAE5B"}
@@ -1,5 +1,4 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
3
2
  const require_client_NextIntlClientProvider = require('./NextIntlClientProvider.cjs');
4
3
  const require_client_useLocale = require('./useLocale.cjs');
5
4
  let _intlayer_use_intl = require("@intlayer/use-intl");
@@ -1,7 +1,6 @@
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
4
  let next_intlayer = require("next-intlayer");
6
5
 
7
6
  //#region src/client/useLocale.ts
@@ -1 +1 @@
1
- {"version":3,"file":"useLocale.cjs","names":[],"sources":["../../../src/client/useLocale.ts"],"sourcesContent":["'use client';\n\nimport type { useLocale as _useLocale } from 'next-intl';\nimport { useLocale as useLocaleIntlayer } from 'next-intlayer';\n\n/**\n * Drop-in for next-intl's `useLocale`.\n */\nexport const useLocale: typeof _useLocale = (): string => {\n const { locale } = useLocaleIntlayer();\n return locale as string;\n};\n"],"mappings":";;;;;;;;;;AAQA,MAAa,kBAA6C;CACxD,MAAM,EAAE,yCAA8B;AACtC,QAAO"}
1
+ {"version":3,"file":"useLocale.cjs","names":[],"sources":["../../../src/client/useLocale.ts"],"sourcesContent":["'use client';\n\nimport type { useLocale as _useLocale } from 'next-intl';\nimport { useLocale as useLocaleIntlayer } from 'next-intlayer';\n\n/**\n * Drop-in for next-intl's `useLocale`.\n */\nexport const useLocale: typeof _useLocale = (): string => {\n const { locale } = useLocaleIntlayer();\n return locale as string;\n};\n"],"mappings":";;;;;;;;;AAQA,MAAa,kBAA6C;CACxD,MAAM,EAAE,wCAA6B;CACrC,OAAO;AACT"}
@@ -1,44 +1,33 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_runtime = require('./_virtual/_rolldown/runtime.cjs');
3
2
  const require_server_getLocale = require('./server/getLocale.cjs');
3
+ let _intlayer_use_intl = require("@intlayer/use-intl");
4
4
  let next_intlayer = require("next-intlayer");
5
5
 
6
6
  //#region src/getDictionary.ts
7
- const navigatePath = (objectValue, path) => {
8
- if (!path) return objectValue;
9
- const parts = path.split(".");
10
- let current = objectValue;
11
- for (const part of parts) {
12
- if (current === null || current === void 0 || typeof current !== "object") return;
13
- current = current[part];
14
- }
15
- return current;
7
+ const readRestArgument = (rest) => {
8
+ if (typeof rest === "string") return { namespacePrefix: rest };
9
+ return { localeOverride: rest?.locale };
16
10
  };
17
11
  /**
18
12
  * Dictionary-accepting variant of `getTranslations`.
19
13
  *
20
- * Used internally by the SWC optimization: instead of looking up the dictionary
21
- * at runtime by key, the SWC plugin pre-imports the dictionary JSON at build time
22
- * and passes it directly here. This enables tree-shaking of unused locale content.
14
+ * Used internally by the build-time optimization: instead of looking up the
15
+ * dictionary at runtime by key, the babel/swc plugin pre-imports the dictionary
16
+ * JSON at build time and passes it directly here. This enables tree-shaking of
17
+ * unused locale content.
23
18
  *
24
- * Runs on the server, where next-intl apps do not mount an `IntlayerServerProvider`.
25
- * The request locale therefore cannot be read from a server context and is resolved
26
- * asynchronously from the cookie/header via `getLocale()`. `getTranslations` is always
27
- * awaited, so an async resolver is a drop-in replacement.
19
+ * Runs on the server, where next-intl apps do not mount an
20
+ * `IntlayerServerProvider`. The request locale therefore cannot be read from a
21
+ * server context and is resolved asynchronously from the cookie/header via
22
+ * `getLocale()` (or the explicit `{ locale }` of the object overload).
23
+ * `getTranslations` is always awaited, so an async resolver is a drop-in
24
+ * replacement.
28
25
  */
29
- const getDictionary = async (dictionary, namespacePrefix) => {
30
- const content = (0, next_intlayer.getDictionary)(dictionary, await require_server_getLocale.getLocale());
31
- const resolveKey = (key) => namespacePrefix ? `${namespacePrefix}.${key}` : key;
32
- return Object.assign((lookup, params) => {
33
- const rawValue = navigatePath(content, resolveKey(String(lookup)));
34
- const str = String(rawValue ?? resolveKey(String(lookup)));
35
- if (!params) return str;
36
- return str.replace(/\{(\w+)\}/g, (_, k) => params[k] != null ? String(params[k]) : `{${k}}`);
37
- }, {
38
- has: (lookup) => navigatePath(content, resolveKey(String(lookup))) != null,
39
- raw: (lookup) => navigatePath(content, resolveKey(String(lookup)))
40
- });
41
- };
26
+ const getDictionary = (async (dictionary, rest) => {
27
+ const { namespacePrefix, localeOverride } = readRestArgument(rest);
28
+ const locale = localeOverride ?? await require_server_getLocale.getLocale();
29
+ return (0, _intlayer_use_intl.createDictionaryTranslator)(locale, (0, next_intlayer.getDictionary)(dictionary, locale), namespacePrefix);
30
+ });
42
31
 
43
32
  //#endregion
44
33
  exports.getDictionary = getDictionary;
@@ -1 +1 @@
1
- {"version":3,"file":"getDictionary.cjs","names":["getLocale"],"sources":["../../src/getDictionary.ts"],"sourcesContent":["import type { ValidDotPathsFor } from '@intlayer/core/transpiler';\nimport type { Dictionary } from '@intlayer/types/dictionary';\nimport type { LocalesValues } from '@intlayer/types/module_augmentation';\nimport { getDictionary as getDictionaryBase } from 'next-intlayer';\nimport { getLocale } from './server/getLocale';\n\nconst navigatePath = (objectValue: unknown, path: string): unknown => {\n if (!path) return objectValue;\n const parts = path.split('.');\n let current: unknown = objectValue;\n for (const part of parts) {\n if (\n current === null ||\n current === undefined ||\n typeof current !== 'object'\n ) {\n return undefined;\n }\n current = (current as Record<string, unknown>)[part];\n }\n return current;\n};\n\n/**\n * Dictionary-accepting variant of `getTranslations`.\n *\n * Used internally by the SWC optimization: instead of looking up the dictionary\n * at runtime by key, the SWC plugin pre-imports the dictionary JSON at build time\n * and passes it directly here. This enables tree-shaking of unused locale content.\n *\n * Runs on the server, where next-intl apps do not mount an `IntlayerServerProvider`.\n * The request locale therefore cannot be read from a server context and is resolved\n * asynchronously from the cookie/header via `getLocale()`. `getTranslations` is always\n * awaited, so an async resolver is a drop-in replacement.\n */\nexport const getDictionary = async <T extends Dictionary>(\n dictionary: T,\n namespacePrefix?: string\n) => {\n const locale = (await getLocale()) as LocalesValues;\n const content = getDictionaryBase(dictionary, locale);\n\n const resolveKey = (key: string): string =>\n namespacePrefix ? `${namespacePrefix}.${key}` : key;\n\n return Object.assign(\n <P extends ValidDotPathsFor<any>>(\n lookup: P,\n params?: Record<string, unknown>\n ): string => {\n const rawValue = navigatePath(content, resolveKey(String(lookup)));\n const str = String(rawValue ?? resolveKey(String(lookup)));\n if (!params) return str;\n return str.replace(/\\{(\\w+)\\}/g, (_, k) =>\n params[k] != null ? String(params[k]) : `{${k}}`\n );\n },\n {\n has: <P extends ValidDotPathsFor<any>>(lookup: P): boolean =>\n navigatePath(content, resolveKey(String(lookup))) != null,\n raw: <P extends ValidDotPathsFor<any>>(lookup: P): unknown =>\n navigatePath(content, resolveKey(String(lookup))),\n }\n );\n};\n"],"mappings":";;;;;;AAMA,MAAM,gBAAgB,aAAsB,SAA0B;AACpE,KAAI,CAAC,KAAM,QAAO;CAClB,MAAM,QAAQ,KAAK,MAAM,IAAI;CAC7B,IAAI,UAAmB;AACvB,MAAK,MAAM,QAAQ,OAAO;AACxB,MACE,YAAY,QACZ,YAAY,UACZ,OAAO,YAAY,SAEnB;AAEF,YAAW,QAAoC;;AAEjD,QAAO;;;;;;;;;;;;;;AAeT,MAAa,gBAAgB,OAC3B,YACA,oBACG;CAEH,MAAM,2CAA4B,YAAY,MADxBA,oCAAW,CACoB;CAErD,MAAM,cAAc,QAClB,kBAAkB,GAAG,gBAAgB,GAAG,QAAQ;AAElD,QAAO,OAAO,QAEV,QACA,WACW;EACX,MAAM,WAAW,aAAa,SAAS,WAAW,OAAO,OAAO,CAAC,CAAC;EAClE,MAAM,MAAM,OAAO,YAAY,WAAW,OAAO,OAAO,CAAC,CAAC;AAC1D,MAAI,CAAC,OAAQ,QAAO;AACpB,SAAO,IAAI,QAAQ,eAAe,GAAG,MACnC,OAAO,MAAM,OAAO,OAAO,OAAO,GAAG,GAAG,IAAI,EAAE,GAC/C;IAEH;EACE,MAAuC,WACrC,aAAa,SAAS,WAAW,OAAO,OAAO,CAAC,CAAC,IAAI;EACvD,MAAuC,WACrC,aAAa,SAAS,WAAW,OAAO,OAAO,CAAC,CAAC;EACpD,CACF"}
1
+ {"version":3,"file":"getDictionary.cjs","names":["getLocale"],"sources":["../../src/getDictionary.ts"],"sourcesContent":["import type { Dictionary } from '@intlayer/types/dictionary';\nimport type {\n DictionaryKeys,\n LocalesValues,\n} from '@intlayer/types/module_augmentation';\nimport {\n createDictionaryTranslator,\n type ScopedTranslateFunction,\n type TranslateFunction,\n} from '@intlayer/use-intl';\nimport { getDictionary as getDictionaryBase } from 'next-intlayer';\nimport { getLocale } from './server/getLocale';\n\n/**\n * Trailing argument left by the optimize pass. `getTranslations('ns.scope')`\n * yields the key-prefix remainder as a string, while the object overload\n * `getTranslations({ locale, namespace })` keeps its options object (with the\n * namespace stripped, since the dictionary is now passed directly).\n */\ntype DictionaryTranslatorRest = string | { locale?: LocalesValues };\n\nconst readRestArgument = (\n rest: DictionaryTranslatorRest | undefined\n): { namespacePrefix?: string; localeOverride?: LocalesValues } => {\n if (typeof rest === 'string') return { namespacePrefix: rest };\n return { localeOverride: rest?.locale };\n};\n\n/**\n * Overload set for {@link getDictionary}: a string rest argument is the\n * key-prefix remainder of a nested namespace (relative dot-paths under the\n * scope); otherwise the translator is typed against the dictionary's\n * dot-paths.\n */\ntype GetDictionary = {\n <T extends Dictionary, Prefix extends string>(\n dictionary: T,\n namespacePrefix: Prefix\n ): Promise<ScopedTranslateFunction<T['key'] & DictionaryKeys, Prefix>>;\n <T extends Dictionary>(\n dictionary: T,\n options?: { locale?: LocalesValues }\n ): Promise<TranslateFunction<T['key'] & DictionaryKeys>>;\n};\n\n/**\n * Dictionary-accepting variant of `getTranslations`.\n *\n * Used internally by the build-time optimization: instead of looking up the\n * dictionary at runtime by key, the babel/swc plugin pre-imports the dictionary\n * JSON at build time and passes it directly here. This enables tree-shaking of\n * unused locale content.\n *\n * Runs on the server, where next-intl apps do not mount an\n * `IntlayerServerProvider`. The request locale therefore cannot be read from a\n * server context and is resolved asynchronously from the cookie/header via\n * `getLocale()` (or the explicit `{ locale }` of the object overload).\n * `getTranslations` is always awaited, so an async resolver is a drop-in\n * replacement.\n */\nexport const getDictionary = (async <T extends Dictionary>(\n dictionary: T,\n rest?: DictionaryTranslatorRest\n) => {\n const { namespacePrefix, localeOverride } = readRestArgument(rest);\n const locale = localeOverride ?? ((await getLocale()) as LocalesValues);\n const content = getDictionaryBase(dictionary, locale);\n\n return createDictionaryTranslator(locale, content, namespacePrefix);\n}) as GetDictionary;\n"],"mappings":";;;;;;AAqBA,MAAM,oBACJ,SACiE;CACjE,IAAI,OAAO,SAAS,UAAU,OAAO,EAAE,iBAAiB,KAAK;CAC7D,OAAO,EAAE,gBAAgB,MAAM,OAAO;AACxC;;;;;;;;;;;;;;;;AAkCA,MAAa,iBAAiB,OAC5B,YACA,SACG;CACH,MAAM,EAAE,iBAAiB,mBAAmB,iBAAiB,IAAI;CACjE,MAAM,SAAS,kBAAoB,MAAMA,mCAAU;CAGnD,0DAAkC,yCAFA,YAAY,MAEE,GAAG,eAAe;AACpE"}
@@ -1,34 +1,18 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_runtime = require('./_virtual/_rolldown/runtime.cjs');
2
+ const require_server_getLocale = require('./server/getLocale.cjs');
3
+ let _intlayer_use_intl = require("@intlayer/use-intl");
3
4
  let next_intlayer_server = require("next-intlayer/server");
4
5
 
5
6
  //#region src/getDictionaryDynamic.ts
6
- const navigatePath = (objectValue, path) => {
7
- if (!path) return objectValue;
8
- const parts = path.split(".");
9
- let current = objectValue;
10
- for (const part of parts) {
11
- if (current === null || current === void 0 || typeof current !== "object") return;
12
- current = current[part];
13
- }
14
- return current;
15
- };
16
7
  /**
17
8
  * Dynamic dictionary-accepting variant of `getTranslations`.
9
+ *
10
+ * Counterpart to {@link getDictionary} for dictionaries imported lazily per
11
+ * locale. Used internally by the build-time optimization.
18
12
  */
19
- const getDictionaryDynamic = async (dictionaryPromise, key, namespacePrefix) => {
20
- const content = await (0, next_intlayer_server.useDictionaryDynamic)(dictionaryPromise, key);
21
- const resolveKey = (lookupKey) => namespacePrefix ? `${namespacePrefix}.${lookupKey}` : lookupKey;
22
- return Object.assign((lookup, params) => {
23
- const rawValue = navigatePath(content, resolveKey(String(lookup)));
24
- const str = String(rawValue ?? resolveKey(String(lookup)));
25
- if (!params) return str;
26
- return str.replace(/\{(\w+)\}/g, (_, k) => params[k] != null ? String(params[k]) : `{${k}}`);
27
- }, {
28
- has: (lookup) => navigatePath(content, resolveKey(String(lookup))) != null,
29
- raw: (lookup) => navigatePath(content, resolveKey(String(lookup)))
30
- });
31
- };
13
+ const getDictionaryDynamic = (async (dictionaryPromise, key, namespacePrefix) => {
14
+ return (0, _intlayer_use_intl.createDictionaryTranslator)(await require_server_getLocale.getLocale(), await (0, next_intlayer_server.useDictionaryDynamic)(dictionaryPromise, key), namespacePrefix);
15
+ });
32
16
 
33
17
  //#endregion
34
18
  exports.getDictionaryDynamic = getDictionaryDynamic;
@@ -1 +1 @@
1
- {"version":3,"file":"getDictionaryDynamic.cjs","names":[],"sources":["../../src/getDictionaryDynamic.ts"],"sourcesContent":["import type { ValidDotPathsFor } from '@intlayer/core/transpiler';\nimport type { Dictionary } from '@intlayer/types/dictionary';\nimport type { StrictModeLocaleMap } from '@intlayer/types/module_augmentation';\nimport { useDictionaryDynamic as getDictionaryDynamicBase } from 'next-intlayer/server';\n\nconst navigatePath = (objectValue: unknown, path: string): unknown => {\n if (!path) return objectValue;\n const parts = path.split('.');\n let current: unknown = objectValue;\n for (const part of parts) {\n if (\n current === null ||\n current === undefined ||\n typeof current !== 'object'\n ) {\n return undefined;\n }\n current = (current as Record<string, unknown>)[part];\n }\n return current;\n};\n\n/**\n * Dynamic dictionary-accepting variant of `getTranslations`.\n */\nexport const getDictionaryDynamic = async <\n const T extends Dictionary,\n const K extends string,\n>(\n dictionaryPromise: StrictModeLocaleMap<() => Promise<T>>,\n key: K,\n namespacePrefix?: string\n) => {\n const content = await getDictionaryDynamicBase<T, any>(\n dictionaryPromise,\n key as any\n );\n\n const resolveKey = (lookupKey: string): string =>\n namespacePrefix ? `${namespacePrefix}.${lookupKey}` : lookupKey;\n\n return Object.assign(\n <P extends ValidDotPathsFor<any>>(\n lookup: P,\n params?: Record<string, unknown>\n ): string => {\n const rawValue = navigatePath(content, resolveKey(String(lookup)));\n const str = String(rawValue ?? resolveKey(String(lookup)));\n if (!params) return str;\n return str.replace(/\\{(\\w+)\\}/g, (_, k) =>\n params[k] != null ? String(params[k]) : `{${k}}`\n );\n },\n {\n has: <P extends ValidDotPathsFor<any>>(lookup: P): boolean =>\n navigatePath(content, resolveKey(String(lookup))) != null,\n raw: <P extends ValidDotPathsFor<any>>(lookup: P): unknown =>\n navigatePath(content, resolveKey(String(lookup))),\n }\n );\n};\n"],"mappings":";;;;;AAKA,MAAM,gBAAgB,aAAsB,SAA0B;AACpE,KAAI,CAAC,KAAM,QAAO;CAClB,MAAM,QAAQ,KAAK,MAAM,IAAI;CAC7B,IAAI,UAAmB;AACvB,MAAK,MAAM,QAAQ,OAAO;AACxB,MACE,YAAY,QACZ,YAAY,UACZ,OAAO,YAAY,SAEnB;AAEF,YAAW,QAAoC;;AAEjD,QAAO;;;;;AAMT,MAAa,uBAAuB,OAIlC,mBACA,KACA,oBACG;CACH,MAAM,UAAU,qDACd,mBACA,IACD;CAED,MAAM,cAAc,cAClB,kBAAkB,GAAG,gBAAgB,GAAG,cAAc;AAExD,QAAO,OAAO,QAEV,QACA,WACW;EACX,MAAM,WAAW,aAAa,SAAS,WAAW,OAAO,OAAO,CAAC,CAAC;EAClE,MAAM,MAAM,OAAO,YAAY,WAAW,OAAO,OAAO,CAAC,CAAC;AAC1D,MAAI,CAAC,OAAQ,QAAO;AACpB,SAAO,IAAI,QAAQ,eAAe,GAAG,MACnC,OAAO,MAAM,OAAO,OAAO,OAAO,GAAG,GAAG,IAAI,EAAE,GAC/C;IAEH;EACE,MAAuC,WACrC,aAAa,SAAS,WAAW,OAAO,OAAO,CAAC,CAAC,IAAI;EACvD,MAAuC,WACrC,aAAa,SAAS,WAAW,OAAO,OAAO,CAAC,CAAC;EACpD,CACF"}
1
+ {"version":3,"file":"getDictionaryDynamic.cjs","names":["getLocale"],"sources":["../../src/getDictionaryDynamic.ts"],"sourcesContent":["import type { Dictionary } from '@intlayer/types/dictionary';\nimport type {\n DictionaryKeys,\n LocalesValues,\n StrictModeLocaleMap,\n} from '@intlayer/types/module_augmentation';\nimport {\n createDictionaryTranslator,\n type ScopedTranslateFunction,\n type TranslateFunction,\n} from '@intlayer/use-intl';\nimport { useDictionaryDynamic as getDictionaryDynamicBase } from 'next-intlayer/server';\nimport { getLocale } from './server/getLocale';\n\n/**\n * Overload set for {@link getDictionaryDynamic}: without a prefix the\n * translator is typed against the dictionary's dot-paths; with a prefix the\n * keys are relative dot-paths under that scope.\n */\ntype GetDictionaryDynamic = {\n <T extends Dictionary, K extends DictionaryKeys>(\n dictionaryPromise: StrictModeLocaleMap<() => Promise<T>>,\n key: K\n ): Promise<TranslateFunction<K>>;\n <T extends Dictionary, K extends DictionaryKeys, Prefix extends string>(\n dictionaryPromise: StrictModeLocaleMap<() => Promise<T>>,\n key: K,\n namespacePrefix: Prefix\n ): Promise<ScopedTranslateFunction<K, Prefix>>;\n};\n\n/**\n * Dynamic dictionary-accepting variant of `getTranslations`.\n *\n * Counterpart to {@link getDictionary} for dictionaries imported lazily per\n * locale. Used internally by the build-time optimization.\n */\nexport const getDictionaryDynamic = (async <\n const T extends Dictionary,\n const K extends DictionaryKeys,\n>(\n dictionaryPromise: StrictModeLocaleMap<() => Promise<T>>,\n key: K,\n namespacePrefix?: string\n) => {\n const locale = (await getLocale()) as LocalesValues;\n const content = await getDictionaryDynamicBase<T, K>(dictionaryPromise, key);\n\n return createDictionaryTranslator(locale, content, namespacePrefix);\n}) as GetDictionaryDynamic;\n"],"mappings":";;;;;;;;;;;;AAqCA,MAAa,wBAAwB,OAInC,mBACA,KACA,oBACG;CAIH,0DAAkC,MAHZA,mCAAU,GAGU,qDAFW,mBAAmB,GAAG,GAExB,eAAe;AACpE"}
@@ -1,5 +1,4 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_runtime = require('./_virtual/_rolldown/runtime.cjs');
3
2
  const require_routing = require('./routing.cjs');
4
3
  const require_client_NextIntlClientProvider = require('./client/NextIntlClientProvider.cjs');
5
4
  const require_client_useLocale = require('./client/useLocale.cjs');
@@ -1,5 +1,4 @@
1
1
  Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
2
- const require_runtime = require('./_virtual/_rolldown/runtime.cjs');
3
2
  let next_intlayer_middleware = require("next-intlayer/middleware");
4
3
 
5
4
  //#region src/middleware.ts
@@ -1 +1 @@
1
- {"version":3,"file":"middleware.cjs","names":[],"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,4DAA8B,SAAS,MAAM;AAEnD,KAAI,UAAU;EAGZ,MAAM,iBAAiB,SAAS,QAAQ,IAAI,oBAAoB;AAChE,MAAI,eACF,UAAS,QAAQ,IAAI,eAAe,gBAAgB;GAClD,MAAM;GACN,UAAU;GACV,QAAQ,OAAU,KAAK;GACxB,CAAC;;AAIN,QAAO"}
1
+ {"version":3,"file":"middleware.cjs","names":[],"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,4DAA8B,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,OAAU,KAAK;EACzB,CAAC;CAEL;CAEA,OAAO;AACT"}
@@ -1 +1 @@
1
- {"version":3,"file":"Link.cjs","names":["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,8BACV,EAAE,MAAM,QAAQ,GAAG,QAAmB,QAAgC;CACrE,MAAM,EAAE,QAAQ,gDAA6B;AAG7C,QACE,2CAACA,mBAAD;EAAe;EAAK,MAAMC,6CAAa,MAHpB,UAAW,cAG4B;EAAE,GAAI;EAAQ;EAG7E;AAED,KAAK,cAAc"}
1
+ {"version":3,"file":"Link.cjs","names":["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,8BACV,EAAE,MAAM,QAAQ,GAAG,QAAmB,QAAgC;CACrE,MAAM,EAAE,QAAQ,+CAA4B;CAG5C,OACE,2CAACA,mBAAD;EAAe;EAAK,MAAMC,6CAAa,MAHpB,UAAW,aAG2B;EAAG,GAAI;CAAO;AAE3E,CACF;AAEA,KAAK,cAAc"}
@@ -1,5 +1,4 @@
1
1
  Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
2
- const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
3
2
  const require_navigation_localizeHref = require('./localizeHref.cjs');
4
3
  const require_navigation_Link = require('./Link.cjs');
5
4
  const require_navigation_hooks = require('./hooks.cjs');
@@ -1 +1 @@
1
- {"version":3,"file":"createNavigation.cjs","names":["localizeHref","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,OAAO;CAE5B,MAAM,YACJ,EAAE,MAAM,UACR,uCACgBA,6CAAa,MAAM,OAAO,EAAE,KAAK;CAEnD,MAAM,qBACJ,EAAE,MAAM,UACR,gDACyBA,6CAAa,MAAM,OAAO,EAAE,KAAK;AAE5D,QAAO;EACL,MAAMC;EACN;EACA;EACA;EACA;EACA;EACD"}
1
+ {"version":3,"file":"createNavigation.cjs","names":["localizeHref","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,uCACgBA,6CAAa,MAAM,MAAM,GAAG,IAAI;CAElD,MAAM,qBACJ,EAAE,MAAM,UACR,gDACyBA,6CAAa,MAAM,MAAM,GAAG,IAAI;CAE3D,OAAO;EACL,MAAMC;EACN;EACA;EACA;EACA;EACA;CACF;AACF"}
@@ -1,7 +1,6 @@
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
4
  const require_navigation_localizeHref = require('./localizeHref.cjs');
6
5
  let next_intlayer = require("next-intlayer");
7
6
  let next_navigation = require("next/navigation");
@@ -1 +1 @@
1
- {"version":3,"file":"hooks.cjs","names":["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,6CAA4B;CAClC,MAAM,EAAE,yCAAsB;CAC9B,MAAM,SAAS,IAAI;AAEnB,KAAI,aAAa,OAAQ,QAAO;AAChC,KAAI,SAAS,WAAW,GAAG,OAAO,GAAG,CAAE,QAAO,SAAS,MAAM,OAAO,OAAO;AAC3E,QAAO;;;;;;;AAQT,MAAa,kBAAkB;CAC7B,MAAM,yCAAwB;CAC9B,MAAM,EAAE,QAAQ,gDAA6B;CAE7C,MAAM,YAAY,MAAoB,WACpCA,6CAAa,MAAM,UAAW,cAAyB;AAEzD,QAAO;EACL,GAAG;EACH,OAAO,MAAoB,YACzB,OAAO,KACL,SAAS,MAAM,SAAS,OAAO,EAC/B,QACD;EACH,UAAU,MAAoB,YAC5B,OAAO,QACL,SAAS,MAAM,SAAS,OAAO,EAC/B,QACD;EACH,WAAW,MAAoB,YAC7B,OAAO,SAAS,SAAS,MAAM,SAAS,OAAO,CAAC;EACnD"}
1
+ {"version":3,"file":"hooks.cjs","names":["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,4CAA2B;CACjC,MAAM,EAAE,wCAAqB;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,wCAAuB;CAC7B,MAAM,EAAE,QAAQ,+CAA4B;CAE5C,MAAM,YAAY,MAAoB,WACpCA,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,5 +1,4 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
3
2
  let _intlayer_core_localization = require("@intlayer/core/localization");
4
3
 
5
4
  //#region src/navigation/localizeHref.ts
@@ -1 +1 @@
1
- {"version":3,"file":"localizeHref.cjs","names":[],"sources":["../../../src/navigation/localizeHref.ts"],"sourcesContent":["import { getLocalizedUrl } from '@intlayer/core/localization';\nimport type { LocalesValues } from '@intlayer/types/module_augmentation';\n\n/**\n * A `next-intl` navigation href: either a pathname string or an object with a\n * `pathname` and optional `query`. The `pathnames` (typed routes) feature is\n * accepted for API compatibility but not interpolated.\n */\nexport type NextIntlHref =\n | string\n | {\n pathname: string;\n query?: Record<string, string | number | (string | number)[]>;\n params?: Record<string, string | number | (string | number)[]>;\n };\n\n/**\n * Prefix a `next-intl` href with the given locale using Intlayer's\n * `getLocalizedUrl`, preserving any query parameters.\n *\n * @param href - The target href (string or `{ pathname, query }`).\n * @param locale - The locale to localize the href for.\n * @returns The localized URL string.\n */\nexport const localizeHref = (href: NextIntlHref, locale: string): string => {\n const pathname = typeof href === 'string' ? href : href.pathname;\n const localizedPathname = getLocalizedUrl(pathname, locale as LocalesValues);\n\n if (typeof href === 'string' || !href.query) {\n return localizedPathname;\n }\n\n const searchParams = new URLSearchParams();\n for (const [key, value] of Object.entries(href.query)) {\n if (Array.isArray(value)) {\n for (const entry of value) {\n searchParams.append(key, String(entry));\n }\n } else {\n searchParams.append(key, String(value));\n }\n }\n\n const queryString = searchParams.toString();\n return queryString\n ? `${localizedPathname}?${queryString}`\n : localizedPathname;\n};\n"],"mappings":";;;;;;;;;;;;;AAwBA,MAAa,gBAAgB,MAAoB,WAA2B;CAE1E,MAAM,qEADW,OAAO,SAAS,WAAW,OAAO,KAAK,UACJ,OAAwB;AAE5E,KAAI,OAAO,SAAS,YAAY,CAAC,KAAK,MACpC,QAAO;CAGT,MAAM,eAAe,IAAI,iBAAiB;AAC1C,MAAK,MAAM,CAAC,KAAK,UAAU,OAAO,QAAQ,KAAK,MAAM,CACnD,KAAI,MAAM,QAAQ,MAAM,CACtB,MAAK,MAAM,SAAS,MAClB,cAAa,OAAO,KAAK,OAAO,MAAM,CAAC;KAGzC,cAAa,OAAO,KAAK,OAAO,MAAM,CAAC;CAI3C,MAAM,cAAc,aAAa,UAAU;AAC3C,QAAO,cACH,GAAG,kBAAkB,GAAG,gBACxB"}
1
+ {"version":3,"file":"localizeHref.cjs","names":[],"sources":["../../../src/navigation/localizeHref.ts"],"sourcesContent":["import { getLocalizedUrl } from '@intlayer/core/localization';\nimport type { LocalesValues } from '@intlayer/types/module_augmentation';\n\n/**\n * A `next-intl` navigation href: either a pathname string or an object with a\n * `pathname` and optional `query`. The `pathnames` (typed routes) feature is\n * accepted for API compatibility but not interpolated.\n */\nexport type NextIntlHref =\n | string\n | {\n pathname: string;\n query?: Record<string, string | number | (string | number)[]>;\n params?: Record<string, string | number | (string | number)[]>;\n };\n\n/**\n * Prefix a `next-intl` href with the given locale using Intlayer's\n * `getLocalizedUrl`, preserving any query parameters.\n *\n * @param href - The target href (string or `{ pathname, query }`).\n * @param locale - The locale to localize the href for.\n * @returns The localized URL string.\n */\nexport const localizeHref = (href: NextIntlHref, locale: string): string => {\n const pathname = typeof href === 'string' ? href : href.pathname;\n const localizedPathname = getLocalizedUrl(pathname, locale as LocalesValues);\n\n if (typeof href === 'string' || !href.query) {\n return localizedPathname;\n }\n\n const searchParams = new URLSearchParams();\n for (const [key, value] of Object.entries(href.query)) {\n if (Array.isArray(value)) {\n for (const entry of value) {\n searchParams.append(key, String(entry));\n }\n } else {\n searchParams.append(key, String(value));\n }\n }\n\n const queryString = searchParams.toString();\n return queryString\n ? `${localizedPathname}?${queryString}`\n : localizedPathname;\n};\n"],"mappings":";;;;;;;;;;;;AAwBA,MAAa,gBAAgB,MAAoB,WAA2B;CAE1E,MAAM,qEADW,OAAO,SAAS,WAAW,OAAO,KAAK,UACJ,MAAuB;CAE3E,IAAI,OAAO,SAAS,YAAY,CAAC,KAAK,OACpC,OAAO;CAGT,MAAM,eAAe,IAAI,gBAAgB;CACzC,KAAK,MAAM,CAAC,KAAK,UAAU,OAAO,QAAQ,KAAK,KAAK,GAClD,IAAI,MAAM,QAAQ,KAAK,GACrB,KAAK,MAAM,SAAS,OAClB,aAAa,OAAO,KAAK,OAAO,KAAK,CAAC;MAGxC,aAAa,OAAO,KAAK,OAAO,KAAK,CAAC;CAI1C,MAAM,cAAc,aAAa,SAAS;CAC1C,OAAO,cACH,GAAG,kBAAkB,GAAG,gBACxB;AACN"}
@@ -6,8 +6,9 @@ _intlayer_config_colors = require_runtime.__toESM(_intlayer_config_colors);
6
6
  let _intlayer_config_logger = require("@intlayer/config/logger");
7
7
  let node_module = require("node:module");
8
8
  let node_path = require("node:path");
9
- let _intlayer_chokidar_utils = require("@intlayer/chokidar/utils");
9
+ let _intlayer_config_callers = require("@intlayer/config/callers");
10
10
  let _intlayer_config_node = require("@intlayer/config/node");
11
+ let _intlayer_engine_utils = require("@intlayer/engine/utils");
11
12
 
12
13
  //#region src/plugin/index.ts
13
14
  /**
@@ -89,19 +90,12 @@ const resolveEsmPath = (specifier) => {
89
90
  * @returns Relative specifier such as `./node_modules/@intlayer/next-intl/...`.
90
91
  */
91
92
  const toTurbopackAlias = (absolutePath) => `./${(0, node_path.relative)(process.cwd(), absolutePath).split(node_path.sep).join("/")}`;
92
- const NEXT_INTL_SWC_CALLERS = [{
93
- callerName: "useTranslations",
94
- importSources: ["next-intl", "@intlayer/next-intl"],
95
- namespaceArgIndex: 0,
96
- staticReplacement: "useDictionary",
97
- dynamicReplacement: "useDictionaryDynamic"
98
- }, {
99
- callerName: "getTranslations",
100
- importSources: ["next-intl/server", "@intlayer/next-intl/server"],
101
- namespaceArgIndex: 0,
102
- staticReplacement: "getDictionary",
103
- dynamicReplacement: "getDictionaryDynamic"
104
- }];
93
+ /**
94
+ * SWC extra-caller configs derived from the shared caller registry
95
+ * (`@intlayer/config/callers`) — the single source of truth also consumed by
96
+ * the babel analyzer/optimizer and the LSP.
97
+ */
98
+ const NEXT_INTL_SWC_CALLERS = (0, _intlayer_config_callers.toSwcExtraCallers)(_intlayer_config_callers.NEXT_INTL_CALLERS);
105
99
  /**
106
100
  * A Next.js plugin for next-intl compat that wraps next-intlayer's plugin
107
101
  * and configures resolve aliases so `next-intl` imports are served by
@@ -111,7 +105,7 @@ const createNextIntlPlugin = (_i18nPath) => {
111
105
  return async (nextConfig = {}) => {
112
106
  const intlayerConfig = (0, _intlayer_config_node.getConfiguration)();
113
107
  const appLogger = (0, _intlayer_config_logger.getAppLogger)(intlayerConfig);
114
- (0, _intlayer_chokidar_utils.runOnce)((0, node_path.join)(intlayerConfig?.system?.baseDir ?? process.cwd(), ".intlayer", "cache", "intlayer-issues-invitation.lock"), () => {
108
+ (0, _intlayer_engine_utils.runOnce)((0, node_path.join)(intlayerConfig?.system?.baseDir ?? process.cwd(), ".intlayer", "cache", "intlayer-issues-invitation.lock"), () => {
115
109
  appLogger([(0, _intlayer_config_logger.colorize)("Please report any issues you met on GitHub:", _intlayer_config_colors.GREY), (0, _intlayer_config_logger.colorize)("https://github.com/aymericzip/intlayer/issues", _intlayer_config_colors.GREY_LIGHT)]);
116
110
  }, { cacheTimeoutMs: 1e3 * 60 * 60 });
117
111
  const customWebpack = nextConfig.webpack;
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","names":["sep","ANSIColors"],"sources":["../../../src/plugin/index.ts"],"sourcesContent":["import { createRequire } from 'node:module';\nimport { dirname, join, relative, resolve, sep } from 'node:path';\nimport { runOnce } from '@intlayer/chokidar/utils';\nimport * as ANSIColors from '@intlayer/config/colors';\nimport { colorize, getAppLogger } from '@intlayer/config/logger';\nimport { getConfiguration } from '@intlayer/config/node';\nimport type { NextConfig } from 'next';\nimport { withIntlayer } from 'next-intlayer/server';\n\n/**\n * `require` that works in both the CJS and ESM builds of this plugin.\n * `import.meta.url` is rewritten to the module path in the CJS output by the\n * bundler, so `createRequire` resolves correctly in either format.\n */\nconst compatRequire = createRequire(import.meta.url);\n\n/**\n * Maps each original `next-intl` import specifier to the `@intlayer/next-intl`\n * specifier that should serve it instead.\n */\nconst ALIAS_ENTRIES: { request: string; replacement: string }[] = [\n { request: 'next-intl/server', replacement: '@intlayer/next-intl/server' },\n { request: 'next-intl/routing', replacement: '@intlayer/next-intl/routing' },\n {\n request: 'next-intl/navigation',\n replacement: '@intlayer/next-intl/navigation',\n },\n {\n request: 'next-intl/middleware',\n replacement: '@intlayer/next-intl/middleware',\n },\n { request: 'next-intl', replacement: '@intlayer/next-intl' },\n];\n\n/**\n * Split a package specifier into its package name and export subpath.\n *\n * @param specifier - e.g. `@intlayer/next-intl/server` or `next-intl`.\n * @returns `{ packageName, exportKey }` where `exportKey` is the `exports` map\n * key (`.` for the package root).\n */\nconst splitSpecifier = (\n specifier: string\n): { packageName: string; exportKey: string } => {\n const segments = specifier.split('/');\n const packageName = specifier.startsWith('@')\n ? segments.slice(0, 2).join('/')\n : (segments[0] ?? specifier);\n const subpath = specifier.slice(packageName?.length);\n return { packageName, exportKey: subpath === '' ? '.' : `.${subpath}` };\n};\n\n/**\n * Resolve the absolute path of a package export, preferring the ESM (`import`)\n * condition so Turbopack and modern bundlers load the `.mjs` build (which keeps\n * the `\"use client\"` directives) rather than the CommonJS fallback.\n *\n * Both Turbopack and webpack ignore alias values that are bare package\n * specifiers, so the aliases must point at real files.\n *\n * @param specifier - Package specifier, e.g. `@intlayer/next-intl/server`.\n * @returns Absolute path to the resolved module file.\n */\nconst resolveEsmPath = (specifier: string): string => {\n const { packageName, exportKey } = splitSpecifier(specifier);\n const packageJson = compatRequire(`${packageName}/package.json`) as {\n exports?: Record<\n string,\n string | { import?: string; require?: string; default?: string }\n >;\n };\n const packageDir = dirname(\n compatRequire.resolve(`${packageName}/package.json`)\n );\n\n const exportEntry = packageJson.exports?.[exportKey];\n const relativeFile =\n typeof exportEntry === 'string'\n ? exportEntry\n : (exportEntry?.import ?? exportEntry?.require ?? exportEntry?.default);\n\n // Fall back to Node resolution if the exports map is unexpected.\n if (!relativeFile) return compatRequire.resolve(specifier);\n\n return resolve(packageDir, relativeFile);\n};\n\n/**\n * Format an absolute path as a project-root-relative specifier (prefixed with\n * `./` and using forward slashes). Turbopack only honours `resolveAlias` values\n * that are project-root-relative paths — bare specifiers are ignored and\n * absolute paths are misread as root-relative. Mirrors `withIntlayer`'s\n * Turbopack alias formatter.\n *\n * @param absolutePath - Absolute path to the target module file.\n * @returns Relative specifier such as `./node_modules/@intlayer/next-intl/...`.\n */\nconst toTurbopackAlias = (absolutePath: string): string =>\n `./${relative(process.cwd(), absolutePath).split(sep).join('/')}`;\n\nconst NEXT_INTL_SWC_CALLERS = [\n {\n callerName: 'useTranslations',\n importSources: ['next-intl', '@intlayer/next-intl'],\n namespaceArgIndex: 0,\n staticReplacement: 'useDictionary',\n dynamicReplacement: 'useDictionaryDynamic',\n },\n {\n callerName: 'getTranslations',\n importSources: ['next-intl/server', '@intlayer/next-intl/server'],\n namespaceArgIndex: 0,\n staticReplacement: 'getDictionary',\n dynamicReplacement: 'getDictionaryDynamic',\n },\n];\n\n/**\n * A Next.js plugin for next-intl compat that wraps next-intlayer's plugin\n * and configures resolve aliases so `next-intl` imports are served by\n * `@intlayer/next-intl`.\n */\nexport const createNextIntlPlugin = (_i18nPath?: string) => {\n return async (nextConfig: NextConfig = {}): Promise<NextConfig> => {\n const intlayerConfig = getConfiguration();\n const appLogger = getAppLogger(intlayerConfig);\n\n runOnce(\n join(\n intlayerConfig?.system?.baseDir ?? process.cwd(),\n '.intlayer',\n 'cache',\n 'intlayer-issues-invitation.lock'\n ),\n () => {\n appLogger([\n colorize(\n 'Please report any issues you met on GitHub:',\n ANSIColors.GREY\n ),\n colorize(\n 'https://github.com/aymericzip/intlayer/issues',\n ANSIColors.GREY_LIGHT\n ),\n ]);\n },\n {\n cacheTimeoutMs: 1000 * 60 * 60, // 1 hour\n }\n );\n\n const customWebpack = nextConfig.webpack;\n\n const resolvedTargets = ALIAS_ENTRIES.map(({ request, replacement }) => ({\n request,\n absolutePath: resolveEsmPath(replacement),\n }));\n\n // Webpack resolves aliases from absolute paths.\n const webpackAlias = Object.fromEntries(\n resolvedTargets.map(({ request, absolutePath }) => [\n request,\n absolutePath,\n ])\n );\n\n // Turbopack only honours project-root-relative `./` paths.\n const turboAlias = Object.fromEntries(\n resolvedTargets.map(({ request, absolutePath }) => [\n request,\n toTurbopackAlias(absolutePath),\n ])\n );\n\n const aliasConfig = {\n webpack: (config: any, options: any) => {\n config.resolve.alias = {\n ...config.resolve.alias,\n ...webpackAlias,\n };\n\n if (typeof customWebpack === 'function') {\n return customWebpack(config, options);\n }\n return config;\n },\n };\n\n const mergedConfig: NextConfig = {\n ...nextConfig,\n ...aliasConfig,\n turbopack: {\n ...(nextConfig.turbopack ?? {}),\n resolveAlias: {\n ...(nextConfig.turbopack?.resolveAlias ?? {}),\n ...turboAlias,\n },\n },\n };\n\n // Only inject the NEXT_LOCALE cookie default when the user has not\n // configured their own routing.storage in intlayer.config.ts.\n // This lets users override via intlayer.config.ts while keeping\n // next-intl compatibility (NEXT_LOCALE) as the default.\n let hasUserDefinedStorage = false;\n try {\n hasUserDefinedStorage = !!(\n intlayerConfig?.routing &&\n 'storage' in intlayerConfig.routing &&\n intlayerConfig.routing.storage !== undefined\n );\n } catch {\n // If the config file cannot be read, fall back to the NEXT_LOCALE default.\n }\n\n const configOptions = hasUserDefinedStorage\n ? { swcExtraCallers: NEXT_INTL_SWC_CALLERS }\n : {\n override: {\n routing: {\n storage: [\n { type: 'cookie' as const, name: 'NEXT_LOCALE' },\n { type: 'header' as const, name: 'x-intlayer-locale' },\n ],\n },\n },\n swcExtraCallers: NEXT_INTL_SWC_CALLERS,\n };\n\n return withIntlayer(mergedConfig, configOptions);\n };\n};\n\nexport default createNextIntlPlugin;\n"],"mappings":"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"}
1
+ {"version":3,"file":"index.cjs","names":["sep","NEXT_INTL_CALLERS","ANSIColors"],"sources":["../../../src/plugin/index.ts"],"sourcesContent":["import { createRequire } from 'node:module';\nimport { dirname, join, relative, resolve, sep } from 'node:path';\nimport { NEXT_INTL_CALLERS, toSwcExtraCallers } from '@intlayer/config/callers';\nimport * as ANSIColors from '@intlayer/config/colors';\nimport { colorize, getAppLogger } from '@intlayer/config/logger';\nimport { getConfiguration } from '@intlayer/config/node';\nimport { runOnce } from '@intlayer/engine/utils';\nimport type { NextConfig } from 'next';\nimport { withIntlayer } from 'next-intlayer/server';\n\n/**\n * `require` that works in both the CJS and ESM builds of this plugin.\n * `import.meta.url` is rewritten to the module path in the CJS output by the\n * bundler, so `createRequire` resolves correctly in either format.\n */\nconst compatRequire = createRequire(import.meta.url);\n\n/**\n * Maps each original `next-intl` import specifier to the `@intlayer/next-intl`\n * specifier that should serve it instead.\n */\nconst ALIAS_ENTRIES: { request: string; replacement: string }[] = [\n { request: 'next-intl/server', replacement: '@intlayer/next-intl/server' },\n { request: 'next-intl/routing', replacement: '@intlayer/next-intl/routing' },\n {\n request: 'next-intl/navigation',\n replacement: '@intlayer/next-intl/navigation',\n },\n {\n request: 'next-intl/middleware',\n replacement: '@intlayer/next-intl/middleware',\n },\n { request: 'next-intl', replacement: '@intlayer/next-intl' },\n];\n\n/**\n * Split a package specifier into its package name and export subpath.\n *\n * @param specifier - e.g. `@intlayer/next-intl/server` or `next-intl`.\n * @returns `{ packageName, exportKey }` where `exportKey` is the `exports` map\n * key (`.` for the package root).\n */\nconst splitSpecifier = (\n specifier: string\n): { packageName: string; exportKey: string } => {\n const segments = specifier.split('/');\n const packageName = specifier.startsWith('@')\n ? segments.slice(0, 2).join('/')\n : (segments[0] ?? specifier);\n const subpath = specifier.slice(packageName?.length);\n return { packageName, exportKey: subpath === '' ? '.' : `.${subpath}` };\n};\n\n/**\n * Resolve the absolute path of a package export, preferring the ESM (`import`)\n * condition so Turbopack and modern bundlers load the `.mjs` build (which keeps\n * the `\"use client\"` directives) rather than the CommonJS fallback.\n *\n * Both Turbopack and webpack ignore alias values that are bare package\n * specifiers, so the aliases must point at real files.\n *\n * @param specifier - Package specifier, e.g. `@intlayer/next-intl/server`.\n * @returns Absolute path to the resolved module file.\n */\nconst resolveEsmPath = (specifier: string): string => {\n const { packageName, exportKey } = splitSpecifier(specifier);\n const packageJson = compatRequire(`${packageName}/package.json`) as {\n exports?: Record<\n string,\n string | { import?: string; require?: string; default?: string }\n >;\n };\n const packageDir = dirname(\n compatRequire.resolve(`${packageName}/package.json`)\n );\n\n const exportEntry = packageJson.exports?.[exportKey];\n const relativeFile =\n typeof exportEntry === 'string'\n ? exportEntry\n : (exportEntry?.import ?? exportEntry?.require ?? exportEntry?.default);\n\n // Fall back to Node resolution if the exports map is unexpected.\n if (!relativeFile) return compatRequire.resolve(specifier);\n\n return resolve(packageDir, relativeFile);\n};\n\n/**\n * Format an absolute path as a project-root-relative specifier (prefixed with\n * `./` and using forward slashes). Turbopack only honours `resolveAlias` values\n * that are project-root-relative paths — bare specifiers are ignored and\n * absolute paths are misread as root-relative. Mirrors `withIntlayer`'s\n * Turbopack alias formatter.\n *\n * @param absolutePath - Absolute path to the target module file.\n * @returns Relative specifier such as `./node_modules/@intlayer/next-intl/...`.\n */\nconst toTurbopackAlias = (absolutePath: string): string =>\n `./${relative(process.cwd(), absolutePath).split(sep).join('/')}`;\n\n/**\n * SWC extra-caller configs derived from the shared caller registry\n * (`@intlayer/config/callers`) — the single source of truth also consumed by\n * the babel analyzer/optimizer and the LSP.\n */\nconst NEXT_INTL_SWC_CALLERS = toSwcExtraCallers(NEXT_INTL_CALLERS);\n\n/**\n * A Next.js plugin for next-intl compat that wraps next-intlayer's plugin\n * and configures resolve aliases so `next-intl` imports are served by\n * `@intlayer/next-intl`.\n */\nexport const createNextIntlPlugin = (_i18nPath?: string) => {\n return async (nextConfig: NextConfig = {}): Promise<NextConfig> => {\n const intlayerConfig = getConfiguration();\n const appLogger = getAppLogger(intlayerConfig);\n\n runOnce(\n join(\n intlayerConfig?.system?.baseDir ?? process.cwd(),\n '.intlayer',\n 'cache',\n 'intlayer-issues-invitation.lock'\n ),\n () => {\n appLogger([\n colorize(\n 'Please report any issues you met on GitHub:',\n ANSIColors.GREY\n ),\n colorize(\n 'https://github.com/aymericzip/intlayer/issues',\n ANSIColors.GREY_LIGHT\n ),\n ]);\n },\n {\n cacheTimeoutMs: 1000 * 60 * 60, // 1 hour\n }\n );\n\n const customWebpack = nextConfig.webpack;\n\n const resolvedTargets = ALIAS_ENTRIES.map(({ request, replacement }) => ({\n request,\n absolutePath: resolveEsmPath(replacement),\n }));\n\n // Webpack resolves aliases from absolute paths.\n const webpackAlias = Object.fromEntries(\n resolvedTargets.map(({ request, absolutePath }) => [\n request,\n absolutePath,\n ])\n );\n\n // Turbopack only honours project-root-relative `./` paths.\n const turboAlias = Object.fromEntries(\n resolvedTargets.map(({ request, absolutePath }) => [\n request,\n toTurbopackAlias(absolutePath),\n ])\n );\n\n const aliasConfig = {\n webpack: (config: any, options: any) => {\n config.resolve.alias = {\n ...config.resolve.alias,\n ...webpackAlias,\n };\n\n if (typeof customWebpack === 'function') {\n return customWebpack(config, options);\n }\n return config;\n },\n };\n\n const mergedConfig: NextConfig = {\n ...nextConfig,\n ...aliasConfig,\n turbopack: {\n ...(nextConfig.turbopack ?? {}),\n resolveAlias: {\n ...(nextConfig.turbopack?.resolveAlias ?? {}),\n ...turboAlias,\n },\n },\n };\n\n // Only inject the NEXT_LOCALE cookie default when the user has not\n // configured their own routing.storage in intlayer.config.ts.\n // This lets users override via intlayer.config.ts while keeping\n // next-intl compatibility (NEXT_LOCALE) as the default.\n let hasUserDefinedStorage = false;\n try {\n hasUserDefinedStorage = !!(\n intlayerConfig?.routing &&\n 'storage' in intlayerConfig.routing &&\n intlayerConfig.routing.storage !== undefined\n );\n } catch {\n // If the config file cannot be read, fall back to the NEXT_LOCALE default.\n }\n\n const configOptions = hasUserDefinedStorage\n ? { swcExtraCallers: NEXT_INTL_SWC_CALLERS }\n : {\n override: {\n routing: {\n storage: [\n { type: 'cookie' as const, name: 'NEXT_LOCALE' },\n { type: 'header' as const, name: 'x-intlayer-locale' },\n ],\n },\n },\n swcExtraCallers: NEXT_INTL_SWC_CALLERS,\n };\n\n return withIntlayer(mergedConfig, configOptions);\n };\n};\n\nexport default createNextIntlPlugin;\n"],"mappings":"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"}
@@ -1,5 +1,4 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_runtime = require('./_virtual/_rolldown/runtime.cjs');
3
2
  let _intlayer_config_built = require("@intlayer/config/built");
4
3
 
5
4
  //#region src/routing.ts
@@ -1 +1 @@
1
- {"version":3,"file":"routing.cjs","names":["internationalization","routing"],"sources":["../../src/routing.ts"],"sourcesContent":["import { internationalization, routing } from '@intlayer/config/built';\nimport type { LocalesValues } from '@intlayer/types/module_augmentation';\n\nexport type Routing = {\n locales: LocalesValues[];\n defaultLocale: LocalesValues;\n localePrefix?: 'always' | 'as-needed' | 'never';\n pathnames?: Record<string, string | Record<string, string>>;\n};\n\n/**\n * Drop-in replacement for next-intl's `defineRouting()`.\n *\n * Merges the provided config with Intlayer's own routing / internationalization\n * configuration so you don't have to repeat locale lists. All fields are\n * optional — omitted values are read from the Intlayer config at runtime.\n *\n * @example\n * ```ts\n * export default defineRouting({\n * locales: ['en', 'fr'],\n * defaultLocale: 'en',\n * });\n * ```\n */\nexport const defineRouting: (config?: Partial<Routing>) => Routing = (\n config?: Partial<Routing>\n): Routing => ({\n locales:\n config?.locales ??\n ((internationalization?.locales ?? []) as LocalesValues[]),\n defaultLocale:\n config?.defaultLocale ??\n (internationalization?.defaultLocale as LocalesValues),\n localePrefix:\n config?.localePrefix ?? (routing?.prefixDefault ? 'always' : 'as-needed'),\n ...config,\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAyBA,MAAa,iBACX,YACa;CACb,SACE,QAAQ,WACNA,6CAAsB,WAAW,EAAE;CACvC,eACE,QAAQ,iBACPA,6CAAsB;CACzB,cACE,QAAQ,iBAAiBC,gCAAS,gBAAgB,WAAW;CAC/D,GAAG;CACJ"}
1
+ {"version":3,"file":"routing.cjs","names":["internationalization","routing"],"sources":["../../src/routing.ts"],"sourcesContent":["import { internationalization, routing } from '@intlayer/config/built';\nimport type { LocalesValues } from '@intlayer/types/module_augmentation';\n\nexport type Routing = {\n locales: LocalesValues[];\n defaultLocale: LocalesValues;\n localePrefix?: 'always' | 'as-needed' | 'never';\n pathnames?: Record<string, string | Record<string, string>>;\n};\n\n/**\n * Drop-in replacement for next-intl's `defineRouting()`.\n *\n * Merges the provided config with Intlayer's own routing / internationalization\n * configuration so you don't have to repeat locale lists. All fields are\n * optional — omitted values are read from the Intlayer config at runtime.\n *\n * @example\n * ```ts\n * export default defineRouting({\n * locales: ['en', 'fr'],\n * defaultLocale: 'en',\n * });\n * ```\n */\nexport const defineRouting: (config?: Partial<Routing>) => Routing = (\n config?: Partial<Routing>\n): Routing => ({\n locales:\n config?.locales ??\n ((internationalization?.locales ?? []) as LocalesValues[]),\n defaultLocale:\n config?.defaultLocale ??\n (internationalization?.defaultLocale as LocalesValues),\n localePrefix:\n config?.localePrefix ?? (routing?.prefixDefault ? 'always' : 'as-needed'),\n ...config,\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAyBA,MAAa,iBACX,YACa;CACb,SACE,QAAQ,WACNA,6CAAsB,WAAW,CAAC;CACtC,eACE,QAAQ,iBACPA,6CAAsB;CACzB,cACE,QAAQ,iBAAiBC,gCAAS,gBAAgB,WAAW;CAC/D,GAAG;AACL"}
@@ -1,5 +1,4 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
3
2
  const require_server_requestLocaleCache = require('./requestLocaleCache.cjs');
4
3
  let next_intlayer_server = require("next-intlayer/server");
5
4
 
@@ -1 +1 @@
1
- {"version":3,"file":"getLocale.cjs","names":["getCachedRequestLocale"],"sources":["../../../src/server/getLocale.ts"],"sourcesContent":["import type { getLocale as _getLocale } from 'next-intl/server';\nimport { getLocale as getLocaleIntlayer } from 'next-intlayer/server';\nimport { getCachedRequestLocale } from './requestLocaleCache';\n\n/**\n * Drop-in for next-intl's `getLocale()` server function.\n *\n * Resolution order mirrors next-intl's per-request model:\n *\n * 1. The locale forwarded through `setRequestLocale(locale)` (the `[locale]`\n * route segment) — the source of truth for URL-driven routing. This is what\n * keeps server-rendered content and the locale switcher in sync with the URL\n * instead of a stale cookie.\n * 2. Otherwise Intlayer's own resolution (cookie / header / Accept-Language),\n * for apps that drive the locale from storage rather than the route.\n */\nexport const getLocale: typeof _getLocale = async (): Promise<string> => {\n const requestLocale = getCachedRequestLocale();\n if (requestLocale) return requestLocale as string;\n\n return (await getLocaleIntlayer()) as string;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAgBA,MAAa,YAA+B,YAA6B;CACvE,MAAM,gBAAgBA,0DAAwB;AAC9C,KAAI,cAAe,QAAO;AAE1B,QAAQ,2CAAyB"}
1
+ {"version":3,"file":"getLocale.cjs","names":["getCachedRequestLocale"],"sources":["../../../src/server/getLocale.ts"],"sourcesContent":["import type { getLocale as _getLocale } from 'next-intl/server';\nimport { getLocale as getLocaleIntlayer } from 'next-intlayer/server';\nimport { getCachedRequestLocale } from './requestLocaleCache';\n\n/**\n * Drop-in for next-intl's `getLocale()` server function.\n *\n * Resolution order mirrors next-intl's per-request model:\n *\n * 1. The locale forwarded through `setRequestLocale(locale)` (the `[locale]`\n * route segment) — the source of truth for URL-driven routing. This is what\n * keeps server-rendered content and the locale switcher in sync with the URL\n * instead of a stale cookie.\n * 2. Otherwise Intlayer's own resolution (cookie / header / Accept-Language),\n * for apps that drive the locale from storage rather than the route.\n */\nexport const getLocale: typeof _getLocale = async (): Promise<string> => {\n const requestLocale = getCachedRequestLocale();\n if (requestLocale) return requestLocale as string;\n\n return (await getLocaleIntlayer()) as string;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;AAgBA,MAAa,YAA+B,YAA6B;CACvE,MAAM,gBAAgBA,yDAAuB;CAC7C,IAAI,eAAe,OAAO;CAE1B,OAAQ,0CAAwB;AAClC"}
@@ -1,5 +1,4 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
3
2
  let _intlayer_config_built = require("@intlayer/config/built");
4
3
  let _intlayer_config_colors = require("@intlayer/config/colors");
5
4
  let _intlayer_config_logger = require("@intlayer/config/logger");
@@ -1 +1 @@
1
- {"version":3,"file":"getMessages.cjs","names":["CYAN"],"sources":["../../../src/server/getMessages.ts"],"sourcesContent":["import { log } from '@intlayer/config/built';\nimport { CYAN } from '@intlayer/config/colors';\nimport { colorize, getAppLogger } from '@intlayer/config/logger';\nimport type { getMessages as _getMessages } from 'next-intl/server';\n\n/**\n * Drop-in replacement for next-intl's `getMessages()` server function.\n *\n * Returns all compiled dictionary content for the current locale as a flat\n * record keyed by dictionary name. Useful when you need to pass messages\n * to a `NextIntlClientProvider`.\n *\n * @example\n * ```ts\n * const messages = await getMessages();\n * ```\n *\n * @deprecated getMessages has no use case with intlayer.\n * Messages are loaded automatically under the hood\n */\nexport const getMessages: typeof _getMessages = async () => {\n if (process.env.NODE_ENV === 'development') {\n const appLogger = getAppLogger({ log });\n appLogger(\n `${colorize('getMessages', CYAN)} has no use case with intlayer. Messages are loaded automatically under the hood for bundle optimization reason`\n );\n }\n\n return {};\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAoBA,MAAa,cAAmC,YAAY;AAC1D,KAAI,QAAQ,IAAI,aAAa,cAE3B,2CAD+B,EAAE,iCAAK,CAC7B,CACP,yCAAY,eAAeA,6BAAK,CAAC,iHAClC;AAGH,QAAO,EAAE"}
1
+ {"version":3,"file":"getMessages.cjs","names":["CYAN"],"sources":["../../../src/server/getMessages.ts"],"sourcesContent":["import { log } from '@intlayer/config/built';\nimport { CYAN } from '@intlayer/config/colors';\nimport { colorize, getAppLogger } from '@intlayer/config/logger';\nimport type { getMessages as _getMessages } from 'next-intl/server';\n\n/**\n * Drop-in replacement for next-intl's `getMessages()` server function.\n *\n * Returns all compiled dictionary content for the current locale as a flat\n * record keyed by dictionary name. Useful when you need to pass messages\n * to a `NextIntlClientProvider`.\n *\n * @example\n * ```ts\n * const messages = await getMessages();\n * ```\n *\n * @deprecated getMessages has no use case with intlayer.\n * Messages are loaded automatically under the hood\n */\nexport const getMessages: typeof _getMessages = async () => {\n if (process.env.NODE_ENV === 'development') {\n const appLogger = getAppLogger({ log });\n appLogger(\n `${colorize('getMessages', CYAN)} has no use case with intlayer. Messages are loaded automatically under the hood for bundle optimization reason`\n );\n }\n\n return {};\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAoBA,MAAa,cAAmC,YAAY;CAC1D,IAAI,QAAQ,IAAI,aAAa,eAE3B,0CAD+B,EAAE,gCAAI,CAC7B,CAAC,CACP,yCAAY,eAAeA,4BAAI,EAAE,gHACnC;CAGF,OAAO,CAAC;AACV"}
@@ -1,5 +1,4 @@
1
1
  Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
2
- const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
3
2
  let _intlayer_config_built = require("@intlayer/config/built");
4
3
  let _intlayer_config_colors = require("@intlayer/config/colors");
5
4
  let _intlayer_config_logger = require("@intlayer/config/logger");
@@ -1 +1 @@
1
- {"version":3,"file":"getRequestConfig.cjs","names":["CYAN"],"sources":["../../../src/server/getRequestConfig.ts"],"sourcesContent":["import { log } from '@intlayer/config/built';\nimport { CYAN } from '@intlayer/config/colors';\nimport { colorize, getAppLogger } from '@intlayer/config/logger';\nimport type { getRequestConfig as _getRequestConfig } from 'next-intl/server';\n\n/**\n * Drop-in for next-intl's `getRequestConfig`.\n *\n * In next-intl this registers the per-request config (locale + messages) read\n * by its own plugin. With intlayer the locale is resolved from routing /\n * storage and messages come from compiled dictionaries, so the returned config\n * is never consumed — this is an identity passthrough kept so existing\n * `i18n/request.ts` files keep resolving and type-checking.\n *\n * @deprecated getRequestConfig has no use case with intlayer. The locale and\n * messages are resolved automatically; the file can be removed.\n */\nexport const getRequestConfig: typeof _getRequestConfig = (\n createRequestConfig\n) => {\n if (process.env.NODE_ENV === 'development') {\n const appLogger = getAppLogger({ log });\n appLogger(\n `${colorize('getRequestConfig', CYAN)} has no use case with intlayer. The locale and messages are resolved automatically; the i18n/request.ts file can be removed`\n );\n }\n\n return createRequestConfig;\n};\n\nexport default getRequestConfig;\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAiBA,MAAa,oBACX,wBACG;AACH,KAAI,QAAQ,IAAI,aAAa,cAE3B,2CAD+B,EAAE,iCAAK,CAC7B,CACP,yCAAY,oBAAoBA,6BAAK,CAAC,6HACvC;AAGH,QAAO"}
1
+ {"version":3,"file":"getRequestConfig.cjs","names":["CYAN"],"sources":["../../../src/server/getRequestConfig.ts"],"sourcesContent":["import { log } from '@intlayer/config/built';\nimport { CYAN } from '@intlayer/config/colors';\nimport { colorize, getAppLogger } from '@intlayer/config/logger';\nimport type { getRequestConfig as _getRequestConfig } from 'next-intl/server';\n\n/**\n * Drop-in for next-intl's `getRequestConfig`.\n *\n * In next-intl this registers the per-request config (locale + messages) read\n * by its own plugin. With intlayer the locale is resolved from routing /\n * storage and messages come from compiled dictionaries, so the returned config\n * is never consumed — this is an identity passthrough kept so existing\n * `i18n/request.ts` files keep resolving and type-checking.\n *\n * @deprecated getRequestConfig has no use case with intlayer. The locale and\n * messages are resolved automatically; the file can be removed.\n */\nexport const getRequestConfig: typeof _getRequestConfig = (\n createRequestConfig\n) => {\n if (process.env.NODE_ENV === 'development') {\n const appLogger = getAppLogger({ log });\n appLogger(\n `${colorize('getRequestConfig', CYAN)} has no use case with intlayer. The locale and messages are resolved automatically; the i18n/request.ts file can be removed`\n );\n }\n\n return createRequestConfig;\n};\n\nexport default getRequestConfig;\n"],"mappings":";;;;;;;;;;;;;;;;;;AAiBA,MAAa,oBACX,wBACG;CACH,IAAI,QAAQ,IAAI,aAAa,eAE3B,0CAD+B,EAAE,gCAAI,CAC7B,CAAC,CACP,yCAAY,oBAAoBA,4BAAI,EAAE,4HACxC;CAGF,OAAO;AACT"}
@@ -1,5 +1,4 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
3
2
  const require_server_getLocale = require('./getLocale.cjs');
4
3
  let _intlayer_use_intl = require("@intlayer/use-intl");
5
4
 
@@ -1 +1 @@
1
- {"version":3,"file":"getTranslations.cjs","names":["getLocale"],"sources":["../../../src/server/getTranslations.ts"],"sourcesContent":["import type {\n DictionaryKeys,\n LocalesValues,\n} from '@intlayer/types/module_augmentation';\nimport {\n createTranslator,\n type LooseTranslateFunction,\n type TranslateFunction,\n} from '@intlayer/use-intl';\nimport { getLocale } from './getLocale';\n\n/**\n * Options accepted by the options-object overload of {@link getTranslations}.\n */\ntype GetTranslationsOptions<N extends DictionaryKeys> = {\n /** The dictionary namespace to scope translations to. */\n namespace?: N;\n /** Override the locale instead of reading it from the current request. */\n locale?: LocalesValues;\n};\n\n/**\n * Overload set for {@link getTranslations}:\n *\n * 1. A bare dictionary key → fully-typed `t()` (autocompleted dot-paths).\n * 2. An options object `{ namespace?, locale? }` → typed when namespace is\n * a known `DictionaryKeys` value.\n * 3. A nested namespace `'dictionary.sub.scope'` → `t()` accepts relative\n * `string` paths, matching next-intl's scoped-namespace behaviour.\n * 4. No namespace → root scope; the first segment of each key designates\n * the dictionary (`t('about.title')`).\n *\n * The translate function shape (`t`, `t.rich`, `t.markup`, `t.raw`, `t.has`)\n * is shared with `@intlayer/use-intl`.\n */\ntype GetTranslations = {\n <N extends DictionaryKeys>(namespace: N): Promise<TranslateFunction<N>>;\n <N extends DictionaryKeys>(\n options: GetTranslationsOptions<N>\n ): Promise<TranslateFunction<N>>;\n (namespace: `${string}.${string}`): Promise<LooseTranslateFunction>;\n (): Promise<LooseTranslateFunction>;\n};\n\n/**\n * Drop-in for next-intl's server `getTranslations()`.\n *\n * Messages support ICU MessageFormat syntax: simple arguments (`{name}`),\n * plural (`{count, plural, one {…} other {…}}`, `#`), select, and formatted\n * arguments (`{value, number}`). Rich text is available through `t.rich()`\n * and `t.markup()`.\n *\n * Resolves the active locale from the current request (or the `locale` option)\n * and delegates to `@intlayer/use-intl`'s `createTranslator`, the same runtime\n * that backs the client `useTranslations`.\n *\n * @example\n * ```ts\n * // Bare namespace — fully typed dot-paths\n * const t = await getTranslations('about');\n * return <h1>{t('counter.label')}</h1>;\n *\n * // ICU plural\n * t('items', { count: 3 });\n *\n * // Options object with locale override\n * const t = await getTranslations({ namespace: 'about', locale: 'fr' });\n *\n * // Rich text\n * t.rich('terms', { link: (chunks) => <a href=\"/terms\">{chunks}</a> });\n * ```\n */\nexport const getTranslations: GetTranslations = (async (\n namespaceOrOptions?: string | GetTranslationsOptions<DictionaryKeys>\n) => {\n let namespace: string | undefined;\n let localeOverride: LocalesValues | undefined;\n\n if (typeof namespaceOrOptions === 'object' && namespaceOrOptions !== null) {\n namespace = namespaceOrOptions.namespace;\n localeOverride = namespaceOrOptions.locale;\n } else {\n namespace = namespaceOrOptions as string | undefined;\n }\n\n const locale = localeOverride ?? (await getLocale());\n\n return createTranslator({ locale: locale as LocalesValues, namespace });\n}) as GetTranslations;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwEA,MAAa,mBAAoC,OAC/C,uBACG;CACH,IAAI;CACJ,IAAI;AAEJ,KAAI,OAAO,uBAAuB,YAAY,uBAAuB,MAAM;AACzE,cAAY,mBAAmB;AAC/B,mBAAiB,mBAAmB;OAEpC,aAAY;AAKd,iDAAwB;EAAE,QAFX,kBAAmB,MAAMA,oCAAW;EAEQ;EAAW,CAAC"}
1
+ {"version":3,"file":"getTranslations.cjs","names":["getLocale"],"sources":["../../../src/server/getTranslations.ts"],"sourcesContent":["import type {\n DictionaryKeys,\n LocalesValues,\n} from '@intlayer/types/module_augmentation';\nimport {\n createTranslator,\n type LooseTranslateFunction,\n type TranslateFunction,\n type TranslateFunctionForNamespace,\n} from '@intlayer/use-intl';\nimport { getLocale } from './getLocale';\n\n/**\n * Options accepted by the options-object overload of {@link getTranslations}.\n */\ntype GetTranslationsOptions<N extends DictionaryKeys> = {\n /** The dictionary namespace to scope translations to. */\n namespace?: N;\n /** Override the locale instead of reading it from the current request. */\n locale?: LocalesValues;\n};\n\n/**\n * Overload set for {@link getTranslations}:\n *\n * 1. A bare dictionary key → fully-typed `t()` (autocompleted dot-paths).\n * 2. An options object `{ namespace?, locale? }` → typed when namespace is\n * a known `DictionaryKeys` value.\n * 3. A nested namespace `'dictionary.sub.scope'` → `t()` accepts relative\n * dot-paths under the scope, typed against the dictionary, matching\n * next-intl's scoped-namespace behaviour.\n * 4. No namespace → root scope; the first segment of each key designates\n * the dictionary (`t('about.title')`).\n *\n * The translate function shape (`t`, `t.rich`, `t.markup`, `t.raw`, `t.has`)\n * is shared with `@intlayer/use-intl`.\n */\ntype GetTranslations = {\n <N extends DictionaryKeys>(namespace: N): Promise<TranslateFunction<N>>;\n <N extends DictionaryKeys>(\n options: GetTranslationsOptions<N>\n ): Promise<TranslateFunction<N>>;\n <N extends `${string}.${string}`>(\n namespace: N\n ): Promise<TranslateFunctionForNamespace<N>>;\n (): Promise<LooseTranslateFunction>;\n};\n\n/**\n * Drop-in for next-intl's server `getTranslations()`.\n *\n * Messages support ICU MessageFormat syntax: simple arguments (`{name}`),\n * plural (`{count, plural, one {…} other {…}}`, `#`), select, and formatted\n * arguments (`{value, number}`). Rich text is available through `t.rich()`\n * and `t.markup()`.\n *\n * Resolves the active locale from the current request (or the `locale` option)\n * and delegates to `@intlayer/use-intl`'s `createTranslator`, the same runtime\n * that backs the client `useTranslations`.\n *\n * @example\n * ```ts\n * // Bare namespace — fully typed dot-paths\n * const t = await getTranslations('about');\n * return <h1>{t('counter.label')}</h1>;\n *\n * // ICU plural\n * t('items', { count: 3 });\n *\n * // Options object with locale override\n * const t = await getTranslations({ namespace: 'about', locale: 'fr' });\n *\n * // Rich text\n * t.rich('terms', { link: (chunks) => <a href=\"/terms\">{chunks}</a> });\n * ```\n */\nexport const getTranslations: GetTranslations = (async (\n namespaceOrOptions?: string | GetTranslationsOptions<DictionaryKeys>\n) => {\n let namespace: string | undefined;\n let localeOverride: LocalesValues | undefined;\n\n if (typeof namespaceOrOptions === 'object' && namespaceOrOptions !== null) {\n namespace = namespaceOrOptions.namespace;\n localeOverride = namespaceOrOptions.locale;\n } else {\n namespace = namespaceOrOptions as string | undefined;\n }\n\n const locale = localeOverride ?? (await getLocale());\n\n return createTranslator({ locale: locale as LocalesValues, namespace });\n}) as GetTranslations;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4EA,MAAa,mBAAoC,OAC/C,uBACG;CACH,IAAI;CACJ,IAAI;CAEJ,IAAI,OAAO,uBAAuB,YAAY,uBAAuB,MAAM;EACzE,YAAY,mBAAmB;EAC/B,iBAAiB,mBAAmB;CACtC,OACE,YAAY;CAKd,gDAAwB;EAAE,QAFX,kBAAmB,MAAMA,mCAAU;EAES;CAAU,CAAC;AACxE"}
@@ -1,5 +1,4 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
3
2
  const require_server_getLocale = require('./getLocale.cjs');
4
3
  let _intlayer_use_intl = require("@intlayer/use-intl");
5
4
 
@@ -1 +1 @@
1
- {"version":3,"file":"helpers.cjs","names":["getLocale"],"sources":["../../../src/server/helpers.ts"],"sourcesContent":["import { createFormatter } from '@intlayer/use-intl';\nimport type {\n getFormatter as _getFormatter,\n getNow as _getNow,\n getTimeZone as _getTimeZone,\n} from 'next-intl/server';\nimport { getLocale } from './getLocale';\n\n/**\n * Drop-in for next-intl's server `getFormatter()`.\n * Returns locale-aware formatters backed by the native `Intl.*` APIs,\n * built by `@intlayer/use-intl`'s `createFormatter`.\n */\nexport const getFormatter: typeof _getFormatter = (async (options?: {\n locale?: string;\n}) => {\n const locale = options?.locale ?? (await getLocale());\n return createFormatter({ locale: locale as string });\n}) as typeof _getFormatter;\n\n/**\n * Drop-in for next-intl's server `getNow()`.\n * Returns the current `Date`.\n */\nexport const getNow: typeof _getNow = (async () =>\n new Date()) as typeof _getNow;\n\n/**\n * Drop-in for next-intl's server `getTimeZone()`.\n * Returns the system time zone resolved from `Intl.DateTimeFormat`.\n */\nexport const getTimeZone: typeof _getTimeZone = (async () =>\n Intl.DateTimeFormat().resolvedOptions().timeZone) as typeof _getTimeZone;\n"],"mappings":";;;;;;;;;;;AAaA,MAAa,gBAAsC,OAAO,YAEpD;AAEJ,gDAAuB,EAAE,QADV,SAAS,UAAW,MAAMA,oCAAW,EACD,CAAC;;;;;;AAOtD,MAAa,UAA0B,4BACrC,IAAI,MAAM;;;;;AAMZ,MAAa,eAAoC,YAC/C,KAAK,gBAAgB,CAAC,iBAAiB,CAAC"}
1
+ {"version":3,"file":"helpers.cjs","names":["getLocale"],"sources":["../../../src/server/helpers.ts"],"sourcesContent":["import { createFormatter } from '@intlayer/use-intl';\nimport type {\n getFormatter as _getFormatter,\n getNow as _getNow,\n getTimeZone as _getTimeZone,\n} from 'next-intl/server';\nimport { getLocale } from './getLocale';\n\n/**\n * Drop-in for next-intl's server `getFormatter()`.\n * Returns locale-aware formatters backed by the native `Intl.*` APIs,\n * built by `@intlayer/use-intl`'s `createFormatter`.\n */\nexport const getFormatter: typeof _getFormatter = (async (options?: {\n locale?: string;\n}) => {\n const locale = options?.locale ?? (await getLocale());\n return createFormatter({ locale: locale as string });\n}) as typeof _getFormatter;\n\n/**\n * Drop-in for next-intl's server `getNow()`.\n * Returns the current `Date`.\n */\nexport const getNow: typeof _getNow = (async () =>\n new Date()) as typeof _getNow;\n\n/**\n * Drop-in for next-intl's server `getTimeZone()`.\n * Returns the system time zone resolved from `Intl.DateTimeFormat`.\n */\nexport const getTimeZone: typeof _getTimeZone = (async () =>\n Intl.DateTimeFormat().resolvedOptions().timeZone) as typeof _getTimeZone;\n"],"mappings":";;;;;;;;;;AAaA,MAAa,gBAAsC,OAAO,YAEpD;CAEJ,+CAAuB,EAAE,QADV,SAAS,UAAW,MAAMA,mCAAU,EACD,CAAC;AACrD;;;;;AAMA,MAAa,UAA0B,4BACrC,IAAI,KAAK;;;;;AAMX,MAAa,eAAoC,YAC/C,KAAK,eAAe,CAAC,CAAC,gBAAgB,CAAC,CAAC"}
@@ -15,7 +15,7 @@ exports.getFormatter = require_server_helpers.getFormatter;
15
15
  exports.getLocale = require_server_getLocale.getLocale;
16
16
  exports.getMessages = require_server_getMessages.getMessages;
17
17
  exports.getNow = require_server_helpers.getNow;
18
- exports.getRequestConfig = require_server_getRequestConfig;
18
+ exports.getRequestConfig = require_server_getRequestConfig.default;
19
19
  exports.getTimeZone = require_server_helpers.getTimeZone;
20
20
  exports.getTranslations = require_server_getTranslations.getTranslations;
21
21
  exports.setLocale = require_server_setLocale.setLocale;
@@ -1,5 +1,4 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
3
2
  let react = require("react");
4
3
 
5
4
  //#region src/server/requestLocaleCache.ts
@@ -1 +1 @@
1
- {"version":3,"file":"requestLocaleCache.cjs","names":[],"sources":["../../../src/server/requestLocaleCache.ts"],"sourcesContent":["import type { LocalesValues } from '@intlayer/types/module_augmentation';\nimport { cache } from 'react';\n\n/**\n * Request-scoped holder for the locale provided through {@link setRequestLocale}.\n *\n * next-intl resolves the active locale per request from the `[locale]` route\n * segment, which the app forwards via `setRequestLocale(locale)`. React's\n * `cache()` gives a per-request singleton (the same trick next-intl uses in its\n * own `RequestLocaleCache`), so the value set in the layout/page is readable by\n * the other server APIs (`getLocale`, `getTranslations`, …) during the same\n * render.\n *\n * @see https://github.com/vercel/next.js/discussions/58862\n */\nconst getRequestLocaleHolder = cache((): { locale?: LocalesValues } => ({\n locale: undefined,\n}));\n\n/**\n * Read the locale stored for the current request, or `undefined` when\n * `setRequestLocale` has not been called.\n */\nexport const getCachedRequestLocale = (): LocalesValues | undefined =>\n getRequestLocaleHolder().locale;\n\n/**\n * Store the locale for the current request. Called by `setRequestLocale`.\n *\n * @param locale - The locale resolved from the `[locale]` route segment.\n */\nexport const setCachedRequestLocale = (locale: LocalesValues): void => {\n getRequestLocaleHolder().locale = locale;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;AAeA,MAAM,iDAAkE,EACtE,QAAQ,QACT,EAAE;;;;;AAMH,MAAa,+BACX,wBAAwB,CAAC;;;;;;AAO3B,MAAa,0BAA0B,WAAgC;AACrE,yBAAwB,CAAC,SAAS"}
1
+ {"version":3,"file":"requestLocaleCache.cjs","names":[],"sources":["../../../src/server/requestLocaleCache.ts"],"sourcesContent":["import type { LocalesValues } from '@intlayer/types/module_augmentation';\nimport { cache } from 'react';\n\n/**\n * Request-scoped holder for the locale provided through {@link setRequestLocale}.\n *\n * next-intl resolves the active locale per request from the `[locale]` route\n * segment, which the app forwards via `setRequestLocale(locale)`. React's\n * `cache()` gives a per-request singleton (the same trick next-intl uses in its\n * own `RequestLocaleCache`), so the value set in the layout/page is readable by\n * the other server APIs (`getLocale`, `getTranslations`, …) during the same\n * render.\n *\n * @see https://github.com/vercel/next.js/discussions/58862\n */\nconst getRequestLocaleHolder = cache((): { locale?: LocalesValues } => ({\n locale: undefined,\n}));\n\n/**\n * Read the locale stored for the current request, or `undefined` when\n * `setRequestLocale` has not been called.\n */\nexport const getCachedRequestLocale = (): LocalesValues | undefined =>\n getRequestLocaleHolder().locale;\n\n/**\n * Store the locale for the current request. Called by `setRequestLocale`.\n *\n * @param locale - The locale resolved from the `[locale]` route segment.\n */\nexport const setCachedRequestLocale = (locale: LocalesValues): void => {\n getRequestLocaleHolder().locale = locale;\n};\n"],"mappings":";;;;;;;;;;;;;;;;AAeA,MAAM,iDAAkE,EACtE,QAAQ,OACV,EAAE;;;;;AAMF,MAAa,+BACX,uBAAuB,CAAC,CAAC;;;;;;AAO3B,MAAa,0BAA0B,WAAgC;CACrE,uBAAuB,CAAC,CAAC,SAAS;AACpC"}
@@ -1,5 +1,4 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
3
2
  let _intlayer_core_utils = require("@intlayer/core/utils");
4
3
  let next_headers_js = require("next/headers.js");
5
4