@intlayer/config 9.0.0-canary.16 → 9.0.0-canary.18

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 (232) hide show
  1. package/dist/cjs/built.cjs.map +1 -1
  2. package/dist/cjs/bundle/index.cjs.map +1 -1
  3. package/dist/cjs/bundle/logBundle.cjs.map +1 -1
  4. package/dist/cjs/callers/base.cjs.map +1 -1
  5. package/dist/cjs/callers/compat/i18next.cjs.map +1 -1
  6. package/dist/cjs/callers/compat/lingui.cjs.map +1 -1
  7. package/dist/cjs/callers/compat/nextIntl.cjs.map +1 -1
  8. package/dist/cjs/callers/compat/reactI18next.cjs.map +1 -1
  9. package/dist/cjs/callers/compat/reactIntl.cjs.map +1 -1
  10. package/dist/cjs/callers/compat/useIntl.cjs.map +1 -1
  11. package/dist/cjs/callers/compat/vueI18n.cjs.map +1 -1
  12. package/dist/cjs/callers/index.cjs.map +1 -1
  13. package/dist/cjs/callers/transform.cjs.map +1 -1
  14. package/dist/cjs/configFile/buildBrowserConfiguration.cjs.map +1 -1
  15. package/dist/cjs/configFile/buildConfigurationFields.cjs +0 -1
  16. package/dist/cjs/configFile/buildConfigurationFields.cjs.map +1 -1
  17. package/dist/cjs/configFile/configurationSchema.cjs.map +1 -1
  18. package/dist/cjs/configFile/getConfiguration.cjs +0 -1
  19. package/dist/cjs/configFile/getConfiguration.cjs.map +1 -1
  20. package/dist/cjs/configFile/loadConfigurationFile.cjs.map +1 -1
  21. package/dist/cjs/configFile/searchConfigurationFile.cjs +0 -1
  22. package/dist/cjs/configFile/searchConfigurationFile.cjs.map +1 -1
  23. package/dist/cjs/defaultValues/build.cjs.map +1 -1
  24. package/dist/cjs/defaultValues/content.cjs.map +1 -1
  25. package/dist/cjs/defaultValues/internationalization.cjs.map +1 -1
  26. package/dist/cjs/defaultValues/routing.cjs.map +1 -1
  27. package/dist/cjs/envVars/envVars.cjs.map +1 -1
  28. package/dist/cjs/loadEnvFile.cjs.map +1 -1
  29. package/dist/cjs/loadExternalFile/bundleFile.cjs +4 -3
  30. package/dist/cjs/loadExternalFile/bundleFile.cjs.map +1 -1
  31. package/dist/cjs/loadExternalFile/bundleJSFile.cjs +0 -1
  32. package/dist/cjs/loadExternalFile/bundleJSFile.cjs.map +1 -1
  33. package/dist/cjs/loadExternalFile/loadExternalFile.cjs +4 -1
  34. package/dist/cjs/loadExternalFile/loadExternalFile.cjs.map +1 -1
  35. package/dist/cjs/loadExternalFile/parseFileContent.cjs.map +1 -1
  36. package/dist/cjs/loadExternalFile/transpileTSToCJS.cjs +0 -1
  37. package/dist/cjs/loadExternalFile/transpileTSToCJS.cjs.map +1 -1
  38. package/dist/cjs/logger.cjs +2 -1
  39. package/dist/cjs/logger.cjs.map +1 -1
  40. package/dist/cjs/utils/ESMxCJSHelpers.cjs +0 -1
  41. package/dist/cjs/utils/ESMxCJSHelpers.cjs.map +1 -1
  42. package/dist/cjs/utils/alias.cjs +0 -1
  43. package/dist/cjs/utils/alias.cjs.map +1 -1
  44. package/dist/cjs/utils/cacheDisk.cjs +2 -1
  45. package/dist/cjs/utils/cacheDisk.cjs.map +1 -1
  46. package/dist/cjs/utils/cacheMemory.cjs +0 -1
  47. package/dist/cjs/utils/cacheMemory.cjs.map +1 -1
  48. package/dist/cjs/utils/clearModuleCache.cjs.map +1 -1
  49. package/dist/cjs/utils/compareVersions.cjs.map +1 -1
  50. package/dist/cjs/utils/extractErrorMessage.cjs.map +1 -1
  51. package/dist/cjs/utils/getDictionarySelectorUsage.cjs.map +1 -1
  52. package/dist/cjs/utils/getExtension.cjs.map +1 -1
  53. package/dist/cjs/utils/getPackageJsonPath.cjs +0 -1
  54. package/dist/cjs/utils/getPackageJsonPath.cjs.map +1 -1
  55. package/dist/cjs/utils/getStorageAttributes.cjs +2 -1
  56. package/dist/cjs/utils/getStorageAttributes.cjs.map +1 -1
  57. package/dist/cjs/utils/getUsedNodeTypes.cjs +0 -1
  58. package/dist/cjs/utils/getUsedNodeTypes.cjs.map +1 -1
  59. package/dist/cjs/utils/logStack.cjs.map +1 -1
  60. package/dist/cjs/utils/normalizePath.cjs.map +1 -1
  61. package/dist/cjs/utils/parseFilePathPattern.cjs.map +1 -1
  62. package/dist/cjs/utils/pathSecurity.cjs +0 -1
  63. package/dist/cjs/utils/pathSecurity.cjs.map +1 -1
  64. package/dist/cjs/utils/retryManager.cjs.map +1 -1
  65. package/dist/cjs/utils/setIntlayerIdentifier.cjs.map +1 -1
  66. package/dist/cjs/utils/stringFormatter/camelCaseToKebabCase.cjs.map +1 -1
  67. package/dist/cjs/utils/stringFormatter/camelCaseToSentence.cjs.map +1 -1
  68. package/dist/cjs/utils/stringFormatter/kebabCaseToCamelCase.cjs.map +1 -1
  69. package/dist/cjs/utils/stringFormatter/toLowerCamelCase.cjs.map +1 -1
  70. package/dist/esm/built.mjs.map +1 -1
  71. package/dist/esm/bundle/index.mjs +3 -3
  72. package/dist/esm/bundle/index.mjs.map +1 -1
  73. package/dist/esm/bundle/logBundle.mjs.map +1 -1
  74. package/dist/esm/callers/base.mjs.map +1 -1
  75. package/dist/esm/callers/compat/i18next.mjs.map +1 -1
  76. package/dist/esm/callers/compat/lingui.mjs.map +1 -1
  77. package/dist/esm/callers/compat/nextIntl.mjs.map +1 -1
  78. package/dist/esm/callers/compat/reactI18next.mjs.map +1 -1
  79. package/dist/esm/callers/compat/reactIntl.mjs.map +1 -1
  80. package/dist/esm/callers/compat/useIntl.mjs.map +1 -1
  81. package/dist/esm/callers/compat/vueI18n.mjs.map +1 -1
  82. package/dist/esm/callers/index.mjs.map +1 -1
  83. package/dist/esm/callers/transform.mjs.map +1 -1
  84. package/dist/esm/configFile/buildBrowserConfiguration.mjs.map +1 -1
  85. package/dist/esm/configFile/buildConfigurationFields.mjs.map +1 -1
  86. package/dist/esm/configFile/configurationSchema.mjs.map +1 -1
  87. package/dist/esm/configFile/getConfiguration.mjs.map +1 -1
  88. package/dist/esm/configFile/loadConfigurationFile.mjs.map +1 -1
  89. package/dist/esm/configFile/searchConfigurationFile.mjs.map +1 -1
  90. package/dist/esm/defaultValues/build.mjs.map +1 -1
  91. package/dist/esm/defaultValues/content.mjs.map +1 -1
  92. package/dist/esm/defaultValues/internationalization.mjs.map +1 -1
  93. package/dist/esm/defaultValues/routing.mjs.map +1 -1
  94. package/dist/esm/envVars/envVars.mjs.map +1 -1
  95. package/dist/esm/loadEnvFile.mjs.map +1 -1
  96. package/dist/esm/loadExternalFile/bundleFile.mjs +4 -2
  97. package/dist/esm/loadExternalFile/bundleFile.mjs.map +1 -1
  98. package/dist/esm/loadExternalFile/bundleJSFile.mjs.map +1 -1
  99. package/dist/esm/loadExternalFile/loadExternalFile.mjs +4 -1
  100. package/dist/esm/loadExternalFile/loadExternalFile.mjs.map +1 -1
  101. package/dist/esm/loadExternalFile/parseFileContent.mjs.map +1 -1
  102. package/dist/esm/loadExternalFile/transpileTSToCJS.mjs.map +1 -1
  103. package/dist/esm/logger.mjs +2 -1
  104. package/dist/esm/logger.mjs.map +1 -1
  105. package/dist/esm/utils/ESMxCJSHelpers.mjs.map +1 -1
  106. package/dist/esm/utils/alias.mjs.map +1 -1
  107. package/dist/esm/utils/cacheDisk.mjs +6 -5
  108. package/dist/esm/utils/cacheDisk.mjs.map +1 -1
  109. package/dist/esm/utils/cacheMemory.mjs.map +1 -1
  110. package/dist/esm/utils/clearModuleCache.mjs.map +1 -1
  111. package/dist/esm/utils/compareVersions.mjs.map +1 -1
  112. package/dist/esm/utils/extractErrorMessage.mjs.map +1 -1
  113. package/dist/esm/utils/getDictionarySelectorUsage.mjs.map +1 -1
  114. package/dist/esm/utils/getExtension.mjs.map +1 -1
  115. package/dist/esm/utils/getPackageJsonPath.mjs.map +1 -1
  116. package/dist/esm/utils/getStorageAttributes.mjs +2 -1
  117. package/dist/esm/utils/getStorageAttributes.mjs.map +1 -1
  118. package/dist/esm/utils/getUsedNodeTypes.mjs.map +1 -1
  119. package/dist/esm/utils/logStack.mjs.map +1 -1
  120. package/dist/esm/utils/normalizePath.mjs.map +1 -1
  121. package/dist/esm/utils/parseFilePathPattern.mjs.map +1 -1
  122. package/dist/esm/utils/pathSecurity.mjs.map +1 -1
  123. package/dist/esm/utils/retryManager.mjs.map +1 -1
  124. package/dist/esm/utils/setIntlayerIdentifier.mjs.map +1 -1
  125. package/dist/esm/utils/stringFormatter/camelCaseToKebabCase.mjs.map +1 -1
  126. package/dist/esm/utils/stringFormatter/camelCaseToSentence.mjs.map +1 -1
  127. package/dist/esm/utils/stringFormatter/kebabCaseToCamelCase.mjs.map +1 -1
  128. package/dist/esm/utils/stringFormatter/toLowerCamelCase.mjs.map +1 -1
  129. package/dist/types/built.d.ts.map +1 -1
  130. package/dist/types/bundle/index.d.ts +2 -4
  131. package/dist/types/bundle/index.d.ts.map +1 -1
  132. package/dist/types/bundle/logBundle.d.ts +0 -1
  133. package/dist/types/bundle/logBundle.d.ts.map +1 -1
  134. package/dist/types/callers/base.d.ts +0 -1
  135. package/dist/types/callers/base.d.ts.map +1 -1
  136. package/dist/types/callers/compat/i18next.d.ts +0 -1
  137. package/dist/types/callers/compat/i18next.d.ts.map +1 -1
  138. package/dist/types/callers/compat/lingui.d.ts +0 -1
  139. package/dist/types/callers/compat/lingui.d.ts.map +1 -1
  140. package/dist/types/callers/compat/nextIntl.d.ts +0 -1
  141. package/dist/types/callers/compat/nextIntl.d.ts.map +1 -1
  142. package/dist/types/callers/compat/reactI18next.d.ts +0 -1
  143. package/dist/types/callers/compat/reactI18next.d.ts.map +1 -1
  144. package/dist/types/callers/compat/reactIntl.d.ts +0 -1
  145. package/dist/types/callers/compat/reactIntl.d.ts.map +1 -1
  146. package/dist/types/callers/compat/useIntl.d.ts +0 -1
  147. package/dist/types/callers/compat/useIntl.d.ts.map +1 -1
  148. package/dist/types/callers/compat/vueI18n.d.ts +0 -1
  149. package/dist/types/callers/compat/vueI18n.d.ts.map +1 -1
  150. package/dist/types/callers/index.d.ts +0 -1
  151. package/dist/types/callers/index.d.ts.map +1 -1
  152. package/dist/types/callers/transform.d.ts +7 -4
  153. package/dist/types/callers/transform.d.ts.map +1 -1
  154. package/dist/types/callers/types.d.ts +17 -9
  155. package/dist/types/callers/types.d.ts.map +1 -1
  156. package/dist/types/colors.d.ts +14 -14
  157. package/dist/types/colors.d.ts.map +1 -1
  158. package/dist/types/configFile/buildBrowserConfiguration.d.ts +0 -1
  159. package/dist/types/configFile/buildBrowserConfiguration.d.ts.map +1 -1
  160. package/dist/types/configFile/buildConfigurationFields.d.ts +0 -1
  161. package/dist/types/configFile/buildConfigurationFields.d.ts.map +1 -1
  162. package/dist/types/configFile/configurationSchema.d.ts +32 -33
  163. package/dist/types/configFile/configurationSchema.d.ts.map +1 -1
  164. package/dist/types/configFile/getConfiguration.d.ts +0 -1
  165. package/dist/types/configFile/getConfiguration.d.ts.map +1 -1
  166. package/dist/types/configFile/index.d.ts +1 -1
  167. package/dist/types/configFile/loadConfigurationFile.d.ts +1 -2
  168. package/dist/types/configFile/loadConfigurationFile.d.ts.map +1 -1
  169. package/dist/types/configFile/searchConfigurationFile.d.ts +1 -1
  170. package/dist/types/configFile/searchConfigurationFile.d.ts.map +1 -1
  171. package/dist/types/defaultValues/analytics.d.ts.map +1 -1
  172. package/dist/types/defaultValues/build.d.ts.map +1 -1
  173. package/dist/types/defaultValues/compiler.d.ts.map +1 -1
  174. package/dist/types/defaultValues/content.d.ts.map +1 -1
  175. package/dist/types/defaultValues/dictionary.d.ts +0 -1
  176. package/dist/types/defaultValues/dictionary.d.ts.map +1 -1
  177. package/dist/types/defaultValues/editor.d.ts.map +1 -1
  178. package/dist/types/defaultValues/internationalization.d.ts +0 -1
  179. package/dist/types/defaultValues/internationalization.d.ts.map +1 -1
  180. package/dist/types/defaultValues/log.d.ts.map +1 -1
  181. package/dist/types/defaultValues/routing.d.ts +0 -1
  182. package/dist/types/defaultValues/routing.d.ts.map +1 -1
  183. package/dist/types/defaultValues/system.d.ts.map +1 -1
  184. package/dist/types/envVars/envVars.d.ts +0 -1
  185. package/dist/types/envVars/envVars.d.ts.map +1 -1
  186. package/dist/types/loadEnvFile.d.ts.map +1 -1
  187. package/dist/types/loadExternalFile/bundleFile.d.ts +0 -1
  188. package/dist/types/loadExternalFile/bundleFile.d.ts.map +1 -1
  189. package/dist/types/loadExternalFile/bundleJSFile.d.ts +57 -59
  190. package/dist/types/loadExternalFile/bundleJSFile.d.ts.map +1 -1
  191. package/dist/types/loadExternalFile/loadExternalFile.d.ts +0 -1
  192. package/dist/types/loadExternalFile/loadExternalFile.d.ts.map +1 -1
  193. package/dist/types/loadExternalFile/parseFileContent.d.ts +0 -1
  194. package/dist/types/loadExternalFile/parseFileContent.d.ts.map +1 -1
  195. package/dist/types/loadExternalFile/transpileTSToCJS.d.ts +1 -3
  196. package/dist/types/loadExternalFile/transpileTSToCJS.d.ts.map +1 -1
  197. package/dist/types/logger.d.ts +2 -3
  198. package/dist/types/logger.d.ts.map +1 -1
  199. package/dist/types/node.d.ts +1 -1
  200. package/dist/types/utils/ESMxCJSHelpers.d.ts.map +1 -1
  201. package/dist/types/utils/alias.d.ts +1 -6
  202. package/dist/types/utils/alias.d.ts.map +1 -1
  203. package/dist/types/utils/cacheDisk.d.ts +22 -11
  204. package/dist/types/utils/cacheDisk.d.ts.map +1 -1
  205. package/dist/types/utils/cacheMemory.d.ts +3 -3
  206. package/dist/types/utils/cacheMemory.d.ts.map +1 -1
  207. package/dist/types/utils/clearModuleCache.d.ts.map +1 -1
  208. package/dist/types/utils/compareVersions.d.ts +1 -1
  209. package/dist/types/utils/compareVersions.d.ts.map +1 -1
  210. package/dist/types/utils/extractErrorMessage.d.ts.map +1 -1
  211. package/dist/types/utils/getDictionarySelectorUsage.d.ts +0 -1
  212. package/dist/types/utils/getDictionarySelectorUsage.d.ts.map +1 -1
  213. package/dist/types/utils/getExtension.d.ts +1 -2
  214. package/dist/types/utils/getExtension.d.ts.map +1 -1
  215. package/dist/types/utils/getPackageJsonPath.d.ts.map +1 -1
  216. package/dist/types/utils/getStorageAttributes.d.ts +0 -1
  217. package/dist/types/utils/getStorageAttributes.d.ts.map +1 -1
  218. package/dist/types/utils/getUsedNodeTypes.d.ts +0 -1
  219. package/dist/types/utils/getUsedNodeTypes.d.ts.map +1 -1
  220. package/dist/types/utils/logStack.d.ts.map +1 -1
  221. package/dist/types/utils/normalizePath.d.ts.map +1 -1
  222. package/dist/types/utils/parseFilePathPattern.d.ts +0 -1
  223. package/dist/types/utils/parseFilePathPattern.d.ts.map +1 -1
  224. package/dist/types/utils/pathSecurity.d.ts.map +1 -1
  225. package/dist/types/utils/retryManager.d.ts +8 -9
  226. package/dist/types/utils/retryManager.d.ts.map +1 -1
  227. package/dist/types/utils/setIntlayerIdentifier.d.ts.map +1 -1
  228. package/dist/types/utils/stringFormatter/camelCaseToKebabCase.d.ts.map +1 -1
  229. package/dist/types/utils/stringFormatter/camelCaseToSentence.d.ts.map +1 -1
  230. package/dist/types/utils/stringFormatter/kebabCaseToCamelCase.d.ts.map +1 -1
  231. package/dist/types/utils/stringFormatter/toLowerCamelCase.d.ts.map +1 -1
  232. package/package.json +5 -5
@@ -1 +1 @@
1
- {"version":3,"file":"built.cjs","names":["getConfiguration"],"sources":["../../src/built.ts"],"sourcesContent":["/**\n * @intlayer/config/built is a package that only returns the configuration file as a JSON object.\n * Using an external package allow to alias it in the bundle configuration (such as webpack).\n */\n\nimport type { IntlayerConfig } from '@intlayer/types/config';\nimport { getConfiguration } from './configFile/getConfiguration';\n\nconst configuration: IntlayerConfig = getConfiguration();\n\nconst parsedJSONConfig = JSON.parse(JSON.stringify(configuration));\n\nexport const internationalization = parsedJSONConfig.internationalization;\nexport const dictionary = parsedJSONConfig.dictionary;\nexport const routing = parsedJSONConfig.routing;\nexport const content = parsedJSONConfig.content;\nexport const system = parsedJSONConfig.system;\nexport const editor = parsedJSONConfig.editor;\nexport const analytics = parsedJSONConfig.analytics;\nexport const log = parsedJSONConfig.log;\nexport const ai = parsedJSONConfig.ai;\nexport const build = parsedJSONConfig.build;\nexport const compiler = parsedJSONConfig.compiler;\nexport const schemas = parsedJSONConfig.schemas;\nexport const plugins = parsedJSONConfig.plugins;\n"],"mappings":";;;;AAQA,MAAM,gBAAgCA,sDAAkB;AAExD,MAAM,mBAAmB,KAAK,MAAM,KAAK,UAAU,cAAc,CAAC;AAElE,MAAa,uBAAuB,iBAAiB;AACrD,MAAa,aAAa,iBAAiB;AAC3C,MAAa,UAAU,iBAAiB;AACxC,MAAa,UAAU,iBAAiB;AACxC,MAAa,SAAS,iBAAiB;AACvC,MAAa,SAAS,iBAAiB;AACvC,MAAa,YAAY,iBAAiB;AAC1C,MAAa,MAAM,iBAAiB;AACpC,MAAa,KAAK,iBAAiB;AACnC,MAAa,QAAQ,iBAAiB;AACtC,MAAa,WAAW,iBAAiB;AACzC,MAAa,UAAU,iBAAiB;AACxC,MAAa,UAAU,iBAAiB"}
1
+ {"version":3,"file":"built.cjs","names":["getConfiguration"],"sources":["../../src/built.ts"],"sourcesContent":["/**\n * @intlayer/config/built is a package that only returns the configuration file as a JSON object.\n * Using an external package allow to alias it in the bundle configuration (such as webpack).\n */\n\nimport type { IntlayerConfig } from '@intlayer/types/config';\nimport { getConfiguration } from './configFile/getConfiguration';\n\nconst configuration: IntlayerConfig = getConfiguration();\n\nconst parsedJSONConfig = JSON.parse(JSON.stringify(configuration));\n\nexport const internationalization = parsedJSONConfig.internationalization;\nexport const dictionary = parsedJSONConfig.dictionary;\nexport const routing = parsedJSONConfig.routing;\nexport const content = parsedJSONConfig.content;\nexport const system = parsedJSONConfig.system;\nexport const editor = parsedJSONConfig.editor;\nexport const analytics = parsedJSONConfig.analytics;\nexport const log = parsedJSONConfig.log;\nexport const ai = parsedJSONConfig.ai;\nexport const build = parsedJSONConfig.build;\nexport const compiler = parsedJSONConfig.compiler;\nexport const schemas = parsedJSONConfig.schemas;\nexport const plugins = parsedJSONConfig.plugins;\n"],"mappings":";;;;AAQA,MAAM,gBAAgCA,qDAAiB;AAEvD,MAAM,mBAAmB,KAAK,MAAM,KAAK,UAAU,aAAa,CAAC;AAEjE,MAAa,uBAAuB,iBAAiB;AACrD,MAAa,aAAa,iBAAiB;AAC3C,MAAa,UAAU,iBAAiB;AACxC,MAAa,UAAU,iBAAiB;AACxC,MAAa,SAAS,iBAAiB;AACvC,MAAa,SAAS,iBAAiB;AACvC,MAAa,YAAY,iBAAiB;AAC1C,MAAa,MAAM,iBAAiB;AACpC,MAAa,KAAK,iBAAiB;AACnC,MAAa,QAAQ,iBAAiB;AACtC,MAAa,WAAW,iBAAiB;AACzC,MAAa,UAAU,iBAAiB;AACxC,MAAa,UAAU,iBAAiB"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","names":["exec","packageJSON","getConfiguration","BundleLogger","getAlias","getConfigEnvVars"],"sources":["../../../src/bundle/index.ts"],"sourcesContent":["import { exec } from 'node:child_process';\nimport { mkdir, rm, writeFile } from 'node:fs/promises';\nimport { isAbsolute, join, resolve } from 'node:path';\nimport { promisify } from 'node:util';\nimport packageJSON from '@intlayer/types/package.json' with { type: 'json' };\nimport { type BuildOptions, build, type Plugin } from 'esbuild';\nimport {\n type GetConfigurationOptions,\n getConfiguration,\n} from '../configFile/getConfiguration';\nimport { getConfigEnvVars } from '../envVars/envVars';\nimport { getAlias } from '../utils/alias';\nimport { BundleLogger } from './logBundle';\n\nconst execAsync = promisify(exec);\n\nexport const packageList = [\n 'next-intlayer',\n 'react-intlayer',\n 'vue-intlayer',\n 'svelte-intlayer',\n 'preact-intlayer',\n 'solid-intlayer',\n 'angular-intlayer',\n 'lit-intlayer',\n 'express-intlayer',\n 'hono-intlayer',\n 'fastify-intlayer',\n 'adonis-intlayer',\n 'vanilla-intlayer',\n 'intlayer',\n] as const;\n\nconst defaultVersion = packageJSON.version;\n\nexport type BundleIntlayerOptions = {\n outfile?: string;\n configOptions?: GetConfigurationOptions;\n bundlePackages?: string[];\n version?: string;\n} & BuildOptions;\n\n/**\n * Bundle the application content using esbuild.\n * It uses the Intlayer configuration to set up aliases and other esbuild options.\n *\n * @param options - Bundle options including entryPoint, outfile, and esbuild options.\n * @returns The build result.\n */\nexport const bundleIntlayer = async (options: BundleIntlayerOptions) => {\n const {\n outfile = 'intlayer-bundle.js',\n configOptions,\n bundlePackages = [...packageList],\n version = defaultVersion,\n ...esbuildOptions\n } = options;\n\n const intlayerConfig = getConfiguration(configOptions);\n\n const logger = new BundleLogger(intlayerConfig);\n\n const alias = getAlias({\n configuration: intlayerConfig,\n formatter: (value: string) => resolve(process.cwd(), value),\n });\n\n // Fetch dictionaries and calculate tree-shaking variables\n\n const treeShakingDefines = getConfigEnvVars(\n intlayerConfig,\n (key) => `process.env.${key}`,\n (value) => `\"${value}\"` // Properly wraps the string in quotes\n );\n\n const intlayerBundlePlugin: Plugin = {\n name: 'intlayer-bundle-plugin',\n setup(build) {\n // Create a regex that matches the provided packages\n // It matches both the package name and any sub-exports\n const packagesRegex = new RegExp(\n `^(${bundlePackages\n .map((packages) => packages.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&'))\n .join('|')})(\\\\/.*)?$`\n );\n\n build.onResolve({ filter: packagesRegex }, () => ({\n external: false,\n }));\n\n // Also ensure @intlayer/ packages are bundled if not explicitly excluded\n build.onResolve({ filter: /^@intlayer\\// }, () => ({\n external: false,\n }));\n },\n };\n\n const tempDir = join(intlayerConfig.system.tempDir, 'intlayer-bundle-tmp');\n\n logger.setStatus('installing');\n\n try {\n // Clean and prepare temp directory\n await rm(tempDir, { recursive: true, force: true });\n await mkdir(tempDir, { recursive: true });\n\n // Write package.json to fetch packages via npm/bun\n const deps = Object.fromEntries(\n bundlePackages.map((pkg) => [pkg, version])\n );\n await writeFile(\n join(tempDir, 'package.json'),\n JSON.stringify({ dependencies: deps, type: 'module' })\n );\n\n // Determine package manager (prefer bun if available)\n let pm = 'npm install';\n try {\n await execAsync('bun --version');\n pm = 'bun install';\n } catch {}\n\n // Install the packages in the temp directory\n await execAsync(pm, { cwd: tempDir });\n\n const absoluteOutfile = isAbsolute(outfile)\n ? outfile\n : join(process.cwd(), outfile);\n\n const buildOptions: BuildOptions = {\n bundle: true,\n outfile: absoluteOutfile,\n absWorkingDir: tempDir,\n platform: 'browser',\n conditions: ['browser', 'module', 'import', 'default'],\n minify: true,\n minifyIdentifiers: true,\n treeShaking: true,\n format: 'iife',\n ignoreAnnotations: true,\n stdin: {\n contents: bundlePackages\n .map((packageName) => {\n // Convert package name to global name (e.g. vanilla-intlayer -> VanillaIntlayer)\n const globalName = packageName\n .split('-')\n .map((part) => `${part.charAt(0).toUpperCase()}${part.slice(1)}`)\n .join('');\n // Create a global variable for each package\n return `import * as ${globalName} from '${packageName}';\\nif (typeof window !== 'undefined') { window['${globalName}'] = ${globalName}; }`;\n })\n .join('\\n'),\n resolveDir: tempDir,\n },\n define: {\n 'process.env': '{}', // Fix ReferenceError: process is not defined\n // Inject generated environment variables\n ...treeShakingDefines,\n ...esbuildOptions.define,\n },\n alias: {\n ...alias,\n ...esbuildOptions.alias,\n },\n ...esbuildOptions,\n plugins: [intlayerBundlePlugin, ...(esbuildOptions.plugins || [])],\n };\n\n logger.setStatus('bundling');\n const result = await build(buildOptions);\n logger.setStatus('success');\n return result;\n } catch (error) {\n logger.setError(error);\n throw error;\n } finally {\n // Clean up temp directory\n await rm(tempDir, { recursive: true, force: true });\n }\n};\n"],"mappings":";;;;;;;;;;;;;;;AAcA,MAAM,qCAAsBA,wBAAK;AAEjC,MAAa,cAAc;CACzB;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACD;AAED,MAAM,iBAAiBC,qCAAY;;;;;;;;AAgBnC,MAAa,iBAAiB,OAAO,YAAmC;CACtE,MAAM,EACJ,UAAU,sBACV,eACA,iBAAiB,CAAC,GAAG,YAAY,EACjC,UAAU,gBACV,GAAG,mBACD;CAEJ,MAAM,iBAAiBC,qDAAiB,cAAc;CAEtD,MAAM,SAAS,IAAIC,sCAAa,eAAe;CAE/C,MAAM,QAAQC,6BAAS;EACrB,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,GAAG,KAAK,OAAO,EAAE,CAAC,aAAa,GAAG,KAAK,MAAM,EAAE,GAAG,CAChE,KAAK,GAAG;AAEX,YAAO,eAAe,WAAW,SAAS,YAAY,mDAAmD,WAAW,OAAO,WAAW;MACtI,CACD,KAAK,KAAK;IACb,YAAY;IACb;GACD,QAAQ;IACN,eAAe;IAEf,GAAG;IACH,GAAG,eAAe;IACnB;GACD,OAAO;IACL,GAAG;IACH,GAAG,eAAe;IACnB;GACD,GAAG;GACH,SAAS,CAAC,sBAAsB,GAAI,eAAe,WAAW,EAAE,CAAE;GACnE;AAED,SAAO,UAAU,WAAW;EAC5B,MAAM,SAAS,yBAAY,aAAa;AACxC,SAAO,UAAU,UAAU;AAC3B,SAAO;UACA,OAAO;AACd,SAAO,SAAS,MAAM;AACtB,QAAM;WACE;AAER,iCAAS,SAAS;GAAE,WAAW;GAAM,OAAO;GAAM,CAAC"}
1
+ {"version":3,"file":"index.cjs","names":["exec","packageJSON","getConfiguration","BundleLogger","getAlias","getConfigEnvVars"],"sources":["../../../src/bundle/index.ts"],"sourcesContent":["import { exec } from 'node:child_process';\nimport { mkdir, rm, writeFile } from 'node:fs/promises';\nimport { isAbsolute, join, resolve } from 'node:path';\nimport { promisify } from 'node:util';\nimport packageJSON from '@intlayer/types/package.json' with { type: 'json' };\nimport { type BuildOptions, build, type Plugin } from 'esbuild';\nimport {\n type GetConfigurationOptions,\n getConfiguration,\n} from '../configFile/getConfiguration';\nimport { getConfigEnvVars } from '../envVars/envVars';\nimport { getAlias } from '../utils/alias';\nimport { BundleLogger } from './logBundle';\n\nconst execAsync = promisify(exec);\n\nexport const packageList = [\n 'next-intlayer',\n 'react-intlayer',\n 'vue-intlayer',\n 'svelte-intlayer',\n 'preact-intlayer',\n 'solid-intlayer',\n 'angular-intlayer',\n 'lit-intlayer',\n 'express-intlayer',\n 'hono-intlayer',\n 'fastify-intlayer',\n 'adonis-intlayer',\n 'vanilla-intlayer',\n 'intlayer',\n] as const;\n\nconst defaultVersion = packageJSON.version;\n\nexport type BundleIntlayerOptions = {\n outfile?: string;\n configOptions?: GetConfigurationOptions;\n bundlePackages?: string[];\n version?: string;\n} & BuildOptions;\n\n/**\n * Bundle the application content using esbuild.\n * It uses the Intlayer configuration to set up aliases and other esbuild options.\n *\n * @param options - Bundle options including entryPoint, outfile, and esbuild options.\n * @returns The build result.\n */\nexport const bundleIntlayer = async (options: BundleIntlayerOptions) => {\n const {\n outfile = 'intlayer-bundle.js',\n configOptions,\n bundlePackages = [...packageList],\n version = defaultVersion,\n ...esbuildOptions\n } = options;\n\n const intlayerConfig = getConfiguration(configOptions);\n\n const logger = new BundleLogger(intlayerConfig);\n\n const alias = getAlias({\n configuration: intlayerConfig,\n formatter: (value: string) => resolve(process.cwd(), value),\n });\n\n // Fetch dictionaries and calculate tree-shaking variables\n\n const treeShakingDefines = getConfigEnvVars(\n intlayerConfig,\n (key) => `process.env.${key}`,\n (value) => `\"${value}\"` // Properly wraps the string in quotes\n );\n\n const intlayerBundlePlugin: Plugin = {\n name: 'intlayer-bundle-plugin',\n setup(build) {\n // Create a regex that matches the provided packages\n // It matches both the package name and any sub-exports\n const packagesRegex = new RegExp(\n `^(${bundlePackages\n .map((packages) => packages.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&'))\n .join('|')})(\\\\/.*)?$`\n );\n\n build.onResolve({ filter: packagesRegex }, () => ({\n external: false,\n }));\n\n // Also ensure @intlayer/ packages are bundled if not explicitly excluded\n build.onResolve({ filter: /^@intlayer\\// }, () => ({\n external: false,\n }));\n },\n };\n\n const tempDir = join(intlayerConfig.system.tempDir, 'intlayer-bundle-tmp');\n\n logger.setStatus('installing');\n\n try {\n // Clean and prepare temp directory\n await rm(tempDir, { recursive: true, force: true });\n await mkdir(tempDir, { recursive: true });\n\n // Write package.json to fetch packages via npm/bun\n const deps = Object.fromEntries(\n bundlePackages.map((pkg) => [pkg, version])\n );\n await writeFile(\n join(tempDir, 'package.json'),\n JSON.stringify({ dependencies: deps, type: 'module' })\n );\n\n // Determine package manager (prefer bun if available)\n let pm = 'npm install';\n try {\n await execAsync('bun --version');\n pm = 'bun install';\n } catch {}\n\n // Install the packages in the temp directory\n await execAsync(pm, { cwd: tempDir });\n\n const absoluteOutfile = isAbsolute(outfile)\n ? outfile\n : join(process.cwd(), outfile);\n\n const buildOptions: BuildOptions = {\n bundle: true,\n outfile: absoluteOutfile,\n absWorkingDir: tempDir,\n platform: 'browser',\n conditions: ['browser', 'module', 'import', 'default'],\n minify: true,\n minifyIdentifiers: true,\n treeShaking: true,\n format: 'iife',\n ignoreAnnotations: true,\n stdin: {\n contents: bundlePackages\n .map((packageName) => {\n // Convert package name to global name (e.g. vanilla-intlayer -> VanillaIntlayer)\n const globalName = packageName\n .split('-')\n .map((part) => `${part.charAt(0).toUpperCase()}${part.slice(1)}`)\n .join('');\n // Create a global variable for each package\n return `import * as ${globalName} from '${packageName}';\\nif (typeof window !== 'undefined') { window['${globalName}'] = ${globalName}; }`;\n })\n .join('\\n'),\n resolveDir: tempDir,\n },\n define: {\n 'process.env': '{}', // Fix ReferenceError: process is not defined\n // Inject generated environment variables\n ...treeShakingDefines,\n ...esbuildOptions.define,\n },\n alias: {\n ...alias,\n ...esbuildOptions.alias,\n },\n ...esbuildOptions,\n plugins: [intlayerBundlePlugin, ...(esbuildOptions.plugins || [])],\n };\n\n logger.setStatus('bundling');\n const result = await build(buildOptions);\n logger.setStatus('success');\n return result;\n } catch (error) {\n logger.setError(error);\n throw error;\n } finally {\n // Clean up temp directory\n await rm(tempDir, { recursive: true, force: true });\n }\n};\n"],"mappings":";;;;;;;;;;;;;;;AAcA,MAAM,qCAAsBA,uBAAI;AAEhC,MAAa,cAAc;CACzB;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF;AAEA,MAAM,iBAAiBC,qCAAY;;;;;;;;AAgBnC,MAAa,iBAAiB,OAAO,YAAmC;CACtE,MAAM,EACJ,UAAU,sBACV,eACA,iB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C;IAAW;IAAU;IAAU;GAAS;GACrD,QAAQ;GACR,mBAAmB;GACnB,aAAa;GACb,QAAQ;GACR,mBAAmB;GACnB,OAAO;IACL,UAAU,eACP,KAAK,gBAAgB;KAEpB,MAAM,aAAa,YAChB,MAAM,GAAG,CAAC,CACV,KAAK,SAAS,GAAG,KAAK,OAAO,CAAC,CAAC,CAAC,YAAY,IAAI,KAAK,MAAM,CAAC,GAAG,CAAC,CAChE,KAAK,EAAE;KAEV,OAAO,eAAe,WAAW,SAAS,YAAY,mDAAmD,WAAW,OAAO,WAAW;IACxI,CAAC,CAAC,CACD,KAAK,IAAI;IACZ,YAAY;GACd;GACA,QAAQ;IACN,eAAe;IAEf,GAAG;IACH,GAAG,eAAe;GACpB;GACA,OAAO;IACL,GAAG;IACH,GAAG,eAAe;GACpB;GACA,GAAG;GACH,SAAS,CAAC,sBAAsB,GAAI,eAAe,WAAW,CAAC,CAAE;EACnE;EAEA,OAAO,UAAU,UAAU;EAC3B,MAAM,SAAS,yBAAY,YAAY;EACvC,OAAO,UAAU,SAAS;EAC1B,OAAO;CACT,SAAS,OAAO;EACd,OAAO,SAAS,KAAK;EACrB,MAAM;CACR,UAAU;EAER,+BAAS,SAAS;GAAE,WAAW;GAAM,OAAO;EAAK,CAAC;CACpD;AACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"logBundle.cjs","names":["getPrefix","extractErrorMessage","spinnerFrames","colorize","v","x"],"sources":["../../../src/bundle/logBundle.ts"],"sourcesContent":["import type { IntlayerConfig } from '@intlayer/types/config';\nimport * as ANSIColors from '../colors';\nimport { colorize, getPrefix, spinnerFrames, v, x } from '../logger';\nimport { extractErrorMessage } from '../utils/extractErrorMessage';\n\nexport class BundleLogger {\n private status: 'pending' | 'installing' | 'bundling' | 'success' | 'error' =\n 'pending';\n private spinnerTimer: NodeJS.Timeout | null = null;\n private spinnerIndex = 0;\n private renderedLines = 0;\n private isFinished = false;\n private readonly prefix: string;\n private lastRenderedState = '';\n private error: string | undefined;\n\n constructor(configuration?: IntlayerConfig) {\n this.prefix = getPrefix(configuration?.log?.prefix) ?? '';\n }\n\n setStatus(status: 'installing' | 'bundling' | 'success') {\n if (this.isFinished) return;\n this.status = status;\n if (status === 'success') {\n this.finish();\n } else {\n this.startSpinner();\n this.render();\n }\n }\n\n setError(error?: unknown) {\n if (this.isFinished) return;\n this.status = 'error';\n this.error = extractErrorMessage(error);\n this.finish();\n }\n\n private startSpinner() {\n if (this.spinnerTimer || this.isFinished) return;\n this.spinnerTimer = setInterval(() => {\n this.spinnerIndex = (this.spinnerIndex + 1) % spinnerFrames.length;\n this.render();\n }, 100);\n }\n\n private stopSpinner() {\n if (!this.spinnerTimer) return;\n clearInterval(this.spinnerTimer);\n this.spinnerTimer = null;\n }\n\n private finish() {\n this.isFinished = true;\n this.stopSpinner();\n this.render();\n }\n\n private render() {\n const frame = spinnerFrames[this.spinnerIndex];\n const clock = colorize(frame, ANSIColors.BLUE);\n const lines: string[] = [];\n\n if (this.status === 'installing') {\n lines.push(`${this.prefix} ${clock} Fetching and resolving packages...`);\n } else if (this.status === 'bundling') {\n lines.push(`${this.prefix} ${v} Fetching and resolving packages...`);\n lines.push(`${this.prefix} ${clock} Bundling application...`);\n } else if (this.status === 'success') {\n lines.push(`${this.prefix} ${v} Fetching and resolving packages...`);\n lines.push(`${this.prefix} ${v} Bundling application...`);\n } else if (this.status === 'error') {\n lines.push(\n `${this.prefix} ${x} Bundle failed: ${colorize(this.error ?? 'Unknown error', ANSIColors.RED)}`\n );\n }\n\n const currentState = lines.join('\\n');\n if (currentState === this.lastRenderedState) return;\n this.lastRenderedState = currentState;\n\n if (this.renderedLines > 0) {\n process.stdout.write(`\\x1b[${this.renderedLines}F`);\n }\n\n const totalLinesToClear = Math.max(this.renderedLines, lines.length);\n for (let i = 0; i < totalLinesToClear; i++) {\n process.stdout.write('\\x1b[2K');\n if (lines[i] !== undefined) {\n process.stdout.write(lines[i]);\n }\n process.stdout.write('\\n');\n }\n\n this.renderedLines =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AAM,KAAK,GAAG,KAAK,OAAO,GAAGA,iBAAE,qCAAqC;AACpE,SAAM,KAAK,GAAG,KAAK,OAAO,GAAGA,iBAAE,0BAA0B;aAChD,KAAK,WAAW,QACzB,OAAM,KACJ,GAAG,KAAK,OAAO,GAAGC,iBAAE,kBAAkBF,wBAAS,KAAK,SAAS,oCAAgC,GAC9F;EAGH,MAAM,eAAe,MAAM,KAAK,KAAK;AACrC,MAAI,iBAAiB,KAAK,kBAAmB;AAC7C,OAAK,oBAAoB;AAEzB,MAAI,KAAK,gBAAgB,EACvB,SAAQ,OAAO,MAAM,QAAQ,KAAK,cAAc,GAAG;EAGrD,MAAM,oBAAoB,KAAK,IAAI,KAAK,eAAe,MAAM,OAAO;AACpE,OAAK,IAAI,IAAI,GAAG,IAAI,mBAAmB,KAAK;AAC1C,WAAQ,OAAO,MAAM,UAAU;AAC/B,OAAI,MAAM,OAAO,OACf,SAAQ,OAAO,MAAM,MAAM,GAAG;AAEhC,WAAQ,OAAO,MAAM,KAAK;;AAG5B,OAAK,gBAAgB,MAAM"}
1
+ {"version":3,"file":"logBundle.cjs","names":["getPrefix","extractErrorMessage","spinnerFrames","colorize","v","x"],"sources":["../../../src/bundle/logBundle.ts"],"sourcesContent":["import type { IntlayerConfig } from '@intlayer/types/config';\nimport * as ANSIColors from '../colors';\nimport { colorize, getPrefix, spinnerFrames, v, x } from '../logger';\nimport { extractErrorMessage } from '../utils/extractErrorMessage';\n\nexport class BundleLogger {\n private status: 'pending' | 'installing' | 'bundling' | 'success' | 'error' =\n 'pending';\n private spinnerTimer: NodeJS.Timeout | null = null;\n private spinnerIndex = 0;\n private renderedLines = 0;\n private isFinished = false;\n private readonly prefix: string;\n private lastRenderedState = '';\n private error: string | undefined;\n\n constructor(configuration?: IntlayerConfig) {\n this.prefix = getPrefix(configuration?.log?.prefix) ?? '';\n }\n\n setStatus(status: 'installing' | 'bundling' | 'success') {\n if (this.isFinished) return;\n this.status = status;\n if (status === 'success') {\n this.finish();\n } else {\n this.startSpinner();\n this.render();\n }\n }\n\n setError(error?: unknown) {\n if (this.isFinished) return;\n this.status = 'error';\n this.error = extractErrorMessage(error);\n this.finish();\n }\n\n private startSpinner() {\n if (this.spinnerTimer || this.isFinished) return;\n this.spinnerTimer = setInterval(() => {\n this.spinnerIndex = (this.spinnerIndex + 1) % spinnerFrames.length;\n this.render();\n }, 100);\n }\n\n private stopSpinner() {\n if (!this.spinnerTimer) return;\n clearInterval(this.spinnerTimer);\n this.spinnerTimer = null;\n }\n\n private finish() {\n this.isFinished = true;\n this.stopSpinner();\n this.render();\n }\n\n private render() {\n const frame = spinnerFrames[this.spinnerIndex];\n const clock = colorize(frame, ANSIColors.BLUE);\n const lines: string[] = [];\n\n if (this.status === 'installing') {\n lines.push(`${this.prefix} ${clock} Fetching and resolving packages...`);\n } else if (this.status === 'bundling') {\n lines.push(`${this.prefix} ${v} Fetching and resolving packages...`);\n lines.push(`${this.prefix} ${clock} Bundling application...`);\n } else if (this.status === 'success') {\n lines.push(`${this.prefix} ${v} Fetching and resolving packages...`);\n lines.push(`${this.prefix} ${v} Bundling application...`);\n } else if (this.status === 'error') {\n lines.push(\n `${this.prefix} ${x} Bundle failed: ${colorize(this.error ?? 'Unknown error', ANSIColors.RED)}`\n );\n }\n\n const currentState = lines.join('\\n');\n if (currentState === this.lastRenderedState) return;\n this.lastRenderedState = currentState;\n\n if (this.renderedLines > 0) {\n process.stdout.write(`\\x1b[${this.renderedLines}F`);\n }\n\n const totalLinesToClear = Math.max(this.renderedLines, lines.length);\n for (let i = 0; i < totalLinesToClear; i++) {\n process.stdout.write('\\x1b[2K');\n if (lines[i] !== undefined) {\n process.stdout.write(lines[i]);\n }\n process.stdout.write('\\n');\n }\n\n this.renderedLines = lines.length;\n }\n}\n"],"mappings":";;;;;;AAKA,IAAa,eAAb,MAA0B;CACxB,AAAQ,SACN;CACF,AAAQ,eAAsC;CAC9C,AAAQ,eAAe;CACvB,AAAQ,gBAAgB;CACxB,AAAQ,aAAa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C1D,OAAO,IAAI,KAAK,WAAW,SACzB,MAAM,KACJ,GAAG,KAAK,OAAO,GAAGC,iBAAE,kBAAkBF,wBAAS,KAAK,SAAS,mCAA+B,GAC9F;EAGF,MAAM,eAAe,MAAM,KAAK,IAAI;EACpC,IAAI,iBAAiB,KAAK,mBAAmB;EAC7C,KAAK,oBAAoB;EAEzB,IAAI,KAAK,gBAAgB,GACvB,QAAQ,OAAO,MAAM,QAAQ,KAAK,cAAc,EAAE;EAGpD,MAAM,oBAAoB,KAAK,IAAI,KAAK,eAAe,MAAM,MAAM;EACnE,KAAK,IAAI,IAAI,GAAG,IAAI,mBAAmB,KAAK;GAC1C,QAAQ,OAAO,MAAM,SAAS;GAC9B,IAAI,MAAM,OAAO,QACf,QAAQ,OAAO,MAAM,MAAM,EAAE;GAE/B,QAAQ,OAAO,MAAM,IAAI;EAC3B;EAEA,KAAK,gBAAgB,MAAM;CAC7B;AACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"base.cjs","names":[],"sources":["../../../src/callers/base.ts"],"sourcesContent":["import type { CallerDescriptor } from './types';\n\n/**\n * Base intlayer getters — always active, independent of any compat library.\n *\n * Their result is the dictionary content object itself: fields are consumed\n * through member access (`content.title`) or destructuring\n * (`const { title } = useIntlayer('home')`).\n */\nexport const BASE_CALLERS: CallerDescriptor[] = [\n {\n callerName: 'useIntlayer',\n library: 'intlayer',\n importSources: [\n 'intlayer',\n 'react-intlayer',\n 'next-intlayer',\n 'vue-intlayer',\n 'svelte-intlayer',\n 'solid-intlayer',\n 'preact-intlayer',\n 'angular-intlayer',\n ],\n namespaceSources: [{ from: 'argument', index: 0 }],\n translationFunction: 'content',\n },\n {\n callerName: 'getIntlayer',\n library: 'intlayer',\n importSources: ['intlayer', '@intlayer/core'],\n namespaceSources: [{ from: 'argument', index: 0 }],\n translationFunction: 'content',\n },\n];\n"],"mappings":";;;;;;;;;;AASA,MAAa,eAAmC,CAC9C;CACE,YAAY;CACZ,SAAS;CACT,eAAe;EACb;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACD;CACD,kBAAkB,CAAC;EAAE,MAAM;EAAY,OAAO;EAAG,CAAC;CAClD,qBAAqB;CACtB,EACD;CACE,YAAY;CACZ,SAAS;CACT,eAAe,CAAC,YAAY,iBAAiB;CAC7C,kBAAkB,CAAC;EAAE,MAAM;EAAY,OAAO;EAAG,CAAC;CAClD,qBAAqB;CACtB,CACF"}
1
+ {"version":3,"file":"base.cjs","names":[],"sources":["../../../src/callers/base.ts"],"sourcesContent":["import type { CallerDescriptor } from './types';\n\n/**\n * Base intlayer getters — always active, independent of any compat library.\n *\n * Their result is the dictionary content object itself: fields are consumed\n * through member access (`content.title`) or destructuring\n * (`const { title } = useIntlayer('home')`).\n */\nexport const BASE_CALLERS: CallerDescriptor[] = [\n {\n callerName: 'useIntlayer',\n library: 'intlayer',\n importSources: [\n 'intlayer',\n 'react-intlayer',\n 'next-intlayer',\n 'vue-intlayer',\n 'svelte-intlayer',\n 'solid-intlayer',\n 'preact-intlayer',\n 'angular-intlayer',\n ],\n namespaceSources: [{ from: 'argument', index: 0 }],\n translationFunction: 'content',\n },\n {\n callerName: 'getIntlayer',\n library: 'intlayer',\n importSources: ['intlayer', '@intlayer/core'],\n namespaceSources: [{ from: 'argument', index: 0 }],\n translationFunction: 'content',\n },\n];\n"],"mappings":";;;;;;;;;;AASA,MAAa,eAAmC,CAC9C;CACE,YAAY;CACZ,SAAS;CACT,eAAe;EACb;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF;CACA,kBAAkB,CAAC;EAAE,MAAM;EAAY,OAAO;CAAE,CAAC;CACjD,qBAAqB;AACvB,GACA;CACE,YAAY;CACZ,SAAS;CACT,eAAe,CAAC,YAAY,gBAAgB;CAC5C,kBAAkB,CAAC;EAAE,MAAM;EAAY,OAAO;CAAE,CAAC;CACjD,qBAAqB;AACvB,CACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"i18next.cjs","names":[],"sources":["../../../../src/callers/compat/i18next.ts"],"sourcesContent":["import type { CallerDescriptor } from '../types';\n\n/**\n * i18next — `@intlayer/i18next` compat adapter.\n *\n * Mirrors `compat/i18next/src/plugin/index.ts` (`I18NEXT_COMPAT_CALLERS`).\n */\nexport const I18NEXT_CALLERS: CallerDescriptor[] = [\n {\n callerName: 'getFixedT',\n library: 'i18next',\n importSources: ['i18next', '@intlayer/i18next'],\n // `i18n.getFixedT(...)` — instance method, never imported as a specifier.\n matchAsMethod: true,\n // Signature: getFixedT(locale, namespace, keyPrefix?)\n namespaceSources: [{ from: 'argument', index: 1 }],\n keyPrefixSources: [{ from: 'argument', index: 2 }],\n translationFunction: 'return-value',\n },\n];\n"],"mappings":";;;;;;;;AAOA,MAAa,kBAAsC,CACjD;CACE,YAAY;CACZ,SAAS;CACT,eAAe,CAAC,WAAW,oBAAoB;CAE/C,eAAe;CAEf,kBAAkB,CAAC;EAAE,MAAM;EAAY,OAAO;EAAG,CAAC;CAClD,kBAAkB,CAAC;EAAE,MAAM;EAAY,OAAO;EAAG,CAAC;CAClD,qBAAqB;CACtB,CACF"}
1
+ {"version":3,"file":"i18next.cjs","names":[],"sources":["../../../../src/callers/compat/i18next.ts"],"sourcesContent":["import type { CallerDescriptor } from '../types';\n\n/**\n * i18next — `@intlayer/i18next` compat adapter.\n *\n * Mirrors `compat/i18next/src/plugin/index.ts` (`I18NEXT_COMPAT_CALLERS`).\n */\nexport const I18NEXT_CALLERS: CallerDescriptor[] = [\n {\n callerName: 'getFixedT',\n library: 'i18next',\n importSources: ['i18next', '@intlayer/i18next'],\n // `i18n.getFixedT(...)` — instance method, never imported as a specifier.\n matchAsMethod: true,\n // Signature: getFixedT(locale, namespace, keyPrefix?)\n namespaceSources: [{ from: 'argument', index: 1 }],\n keyPrefixSources: [{ from: 'argument', index: 2 }],\n translationFunction: 'return-value',\n },\n];\n"],"mappings":";;;;;;;;AAOA,MAAa,kBAAsC,CACjD;CACE,YAAY;CACZ,SAAS;CACT,eAAe,CAAC,WAAW,mBAAmB;CAE9C,eAAe;CAEf,kBAAkB,CAAC;EAAE,MAAM;EAAY,OAAO;CAAE,CAAC;CACjD,kBAAkB,CAAC;EAAE,MAAM;EAAY,OAAO;CAAE,CAAC;CACjD,qBAAqB;AACvB,CACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"lingui.cjs","names":[],"sources":["../../../../src/callers/compat/lingui.ts"],"sourcesContent":["import type { CallerDescriptor } from '../types';\n\n/**\n * Lingui — `@intlayer/lingui` compat adapter.\n *\n * Lingui is a single-catalog library: every message lives in the `messages`\n * dictionary and catalog keys are flat (a dotted id such as\n * `results-table.bundleSize` is one literal key, not a nested path).\n *\n * `t` and `_` are generic names, so all lingui callers require an import from\n * a lingui module to participate in matching — this avoids false positives on\n * unrelated `t()` helpers.\n *\n * Mirrors `compat/lingui/src/plugin/index.ts`.\n */\nconst LINGUI_IMPORT_SOURCES = [\n '@lingui/core',\n '@lingui/react',\n '@lingui/macro',\n '@lingui/core/macro',\n '@lingui/react/macro',\n '@intlayer/lingui',\n];\n\nexport const LINGUI_CALLERS: CallerDescriptor[] = [\n {\n callerName: 'useLingui',\n library: 'lingui',\n importSources: LINGUI_IMPORT_SOURCES,\n // `const { i18n, t, _ } = useLingui()` — single-catalog hook, no\n // namespace argument: every call reads the `messages` dictionary.\n namespaceSources: [{ from: 'fixed', value: 'messages' }],\n translationFunction: 'destructured-t',\n staticReplacement: 'useDictionary',\n dynamicReplacement: 'useDictionaryDynamic',\n },\n {\n callerName: '_',\n library: 'lingui',\n importSources: LINGUI_IMPORT_SOURCES,\n requiresImport: true,\n // `i18n._('id')` and the destructured `const { _ } = useLingui()` form.\n matchAsMethod: true,\n namespaceSources: [{ from: 'fixed', value: 'messages' }],\n translationFunction: 'self',\n flatKey: true,\n },\n {\n callerName: 't',\n library: 'lingui',\n importSources: LINGUI_IMPORT_SOURCES,\n requiresImport: true,\n // `i18n.t('id')`, `t({ id: 'id' })` and the macro tagged template ``t`…` ``.\n matchAsMethod: true,\n matchAsTaggedTemplate: true,\n namespaceSources: [{ from: 'fixed', value: 'messages' }],\n translationFunction: 'self',\n flatKey: true,\n },\n {\n callerName: 'Trans',\n library: 'lingui',\n importSources: LINGUI_IMPORT_SOURCES,\n requiresImport: true,\n // <Trans id=\"home.title\" message=\"Welcome\" />\n jsxIdAttribute: 'id',\n namespaceSources: [{ from: 'fixed', value: 'messages' }],\n translationFunction: 'self',\n flatKey: true,\n },\n];\n"],"mappings":";;;;;;;;;;;;;;;;AAeA,MAAM,wBAAwB;CAC5B;CACA;CACA;CACA;CACA;CACA;CACD;AAED,MAAa,iBAAqC;CAChD;EACE,YAAY;EACZ,SAAS;EACT,eAAe;EAGf,kBAAkB,CAAC;GAAE,MAAM;GAAS,OAAO;GAAY,CAAC;EACxD,qBAAqB;EACrB,mBAAmB;EACnB,oBAAoB;EACrB;CACD;EACE,YAAY;EACZ,SAAS;EACT,eAAe;EACf,gBAAgB;EAEhB,eAAe;EACf,kBAAkB,CAAC;GAAE,MAAM;GAAS,OAAO;GAAY,CAAC;EACxD,qBAAqB;EACrB,SAAS;EACV;CACD;EACE,YAAY;EACZ,SAAS;EACT,eAAe;EACf,gBAAgB;EAEhB,eAAe;EACf,uBAAuB;EACvB,kBAAkB,CAAC;GAAE,MAAM;GAAS,OAAO;GAAY,CAAC;EACxD,qBAAqB;EACrB,SAAS;EACV;CACD;EACE,YAAY;EACZ,SAAS;EACT,eAAe;EACf,gBAAgB;EAEhB,gBAAgB;EAChB,kBAAkB,CAAC;GAAE,MAAM;GAAS,OAAO;GAAY,CAAC;EACxD,qBAAqB;EACrB,SAAS;EACV;CACF"}
1
+ {"version":3,"file":"lingui.cjs","names":[],"sources":["../../../../src/callers/compat/lingui.ts"],"sourcesContent":["import type { CallerDescriptor } from '../types';\n\n/**\n * Lingui — `@intlayer/lingui` compat adapter.\n *\n * Lingui is a single-catalog library: every message lives in the `messages`\n * dictionary and catalog keys are flat (a dotted id such as\n * `results-table.bundleSize` is one literal key, not a nested path).\n *\n * `t` and `_` are generic names, so all lingui callers require an import from\n * a lingui module to participate in matching — this avoids false positives on\n * unrelated `t()` helpers.\n *\n * Mirrors `compat/lingui/src/plugin/index.ts`.\n */\nconst LINGUI_IMPORT_SOURCES = [\n '@lingui/core',\n '@lingui/react',\n '@lingui/macro',\n '@lingui/core/macro',\n '@lingui/react/macro',\n '@intlayer/lingui',\n];\n\nexport const LINGUI_CALLERS: CallerDescriptor[] = [\n {\n callerName: 'useLingui',\n library: 'lingui',\n importSources: LINGUI_IMPORT_SOURCES,\n // `const { i18n, t, _ } = useLingui()` — single-catalog hook, no\n // namespace argument: every call reads the `messages` dictionary.\n namespaceSources: [{ from: 'fixed', value: 'messages' }],\n translationFunction: 'destructured-t',\n staticReplacement: 'useDictionary',\n dynamicReplacement: 'useDictionaryDynamic',\n },\n {\n callerName: '_',\n library: 'lingui',\n importSources: LINGUI_IMPORT_SOURCES,\n requiresImport: true,\n // `i18n._('id')` and the destructured `const { _ } = useLingui()` form.\n matchAsMethod: true,\n namespaceSources: [{ from: 'fixed', value: 'messages' }],\n translationFunction: 'self',\n flatKey: true,\n },\n {\n callerName: 't',\n library: 'lingui',\n importSources: LINGUI_IMPORT_SOURCES,\n requiresImport: true,\n // `i18n.t('id')`, `t({ id: 'id' })` and the macro tagged template ``t`…` ``.\n matchAsMethod: true,\n matchAsTaggedTemplate: true,\n namespaceSources: [{ from: 'fixed', value: 'messages' }],\n translationFunction: 'self',\n flatKey: true,\n },\n {\n callerName: 'Trans',\n library: 'lingui',\n importSources: LINGUI_IMPORT_SOURCES,\n requiresImport: true,\n // <Trans id=\"home.title\" message=\"Welcome\" />\n jsxIdAttribute: 'id',\n namespaceSources: [{ from: 'fixed', value: 'messages' }],\n translationFunction: 'self',\n flatKey: true,\n },\n];\n"],"mappings":";;;;;;;;;;;;;;;;AAeA,MAAM,wBAAwB;CAC5B;CACA;CACA;CACA;CACA;CACA;AACF;AAEA,MAAa,iBAAqC;CAChD;EACE,YAAY;EACZ,SAAS;EACT,eAAe;EAGf,kBAAkB,CAAC;GAAE,MAAM;GAAS,OAAO;EAAW,CAAC;EACvD,qBAAqB;EACrB,mBAAmB;EACnB,oBAAoB;CACtB;CACA;EACE,YAAY;EACZ,SAAS;EACT,eAAe;EACf,gBAAgB;EAEhB,eAAe;EACf,kBAAkB,CAAC;GAAE,MAAM;GAAS,OAAO;EAAW,CAAC;EACvD,qBAAqB;EACrB,SAAS;CACX;CACA;EACE,YAAY;EACZ,SAAS;EACT,eAAe;EACf,gBAAgB;EAEhB,eAAe;EACf,uBAAuB;EACvB,kBAAkB,CAAC;GAAE,MAAM;GAAS,OAAO;EAAW,CAAC;EACvD,qBAAqB;EACrB,SAAS;CACX;CACA;EACE,YAAY;EACZ,SAAS;EACT,eAAe;EACf,gBAAgB;EAEhB,gBAAgB;EAChB,kBAAkB,CAAC;GAAE,MAAM;GAAS,OAAO;EAAW,CAAC;EACvD,qBAAqB;EACrB,SAAS;CACX;AACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"nextIntl.cjs","names":[],"sources":["../../../../src/callers/compat/nextIntl.ts"],"sourcesContent":["import type { CallerDescriptor } from '../types';\n\n/**\n * next-intl — `@intlayer/next-intl` compat adapter.\n *\n * Mirrors `compat/next-intl/src/plugin/index.ts` (`NEXT_INTL_SWC_CALLERS`),\n * adding the `getTranslations({ locale, namespace })` object overload.\n */\nexport const NEXT_INTL_CALLERS: CallerDescriptor[] = [\n {\n callerName: 'useTranslations',\n library: 'next-intl',\n importSources: ['next-intl', '@intlayer/next-intl'],\n namespaceSources: [{ from: 'argument', index: 0 }],\n translationFunction: 'return-value',\n // useTranslations('about.counter') → dictionary `about`, prefix `counter`\n nestedNamespace: true,\n // bare useTranslations() → first id segment is the dictionary\n allowRootScope: true,\n staticReplacement: 'useDictionary',\n dynamicReplacement: 'useDictionaryDynamic',\n },\n {\n callerName: 'getTranslations',\n library: 'next-intl',\n importSources: ['next-intl/server', '@intlayer/next-intl/server'],\n // Both overloads: getTranslations('ns') and\n // getTranslations({ locale, namespace: 'ns' }).\n namespaceSources: [\n { from: 'argument', index: 0 },\n { from: 'option', argumentIndex: 0, property: 'namespace' },\n ],\n translationFunction: 'return-value',\n nestedNamespace: true,\n allowRootScope: true,\n staticReplacement: 'getDictionary',\n dynamicReplacement: 'getDictionaryDynamic',\n },\n];\n"],"mappings":";;;;;;;;;AAQA,MAAa,oBAAwC,CACnD;CACE,YAAY;CACZ,SAAS;CACT,eAAe,CAAC,aAAa,sBAAsB;CACnD,kBAAkB,CAAC;EAAE,MAAM;EAAY,OAAO;EAAG,CAAC;CAClD,qBAAqB;CAErB,iBAAiB;CAEjB,gBAAgB;CAChB,mBAAmB;CACnB,oBAAoB;CACrB,EACD;CACE,YAAY;CACZ,SAAS;CACT,eAAe,CAAC,oBAAoB,6BAA6B;CAGjE,kBAAkB,CAChB;EAAE,MAAM;EAAY,OAAO;EAAG,EAC9B;EAAE,MAAM;EAAU,eAAe;EAAG,UAAU;EAAa,CAC5D;CACD,qBAAqB;CACrB,iBAAiB;CACjB,gBAAgB;CAChB,mBAAmB;CACnB,oBAAoB;CACrB,CACF"}
1
+ {"version":3,"file":"nextIntl.cjs","names":[],"sources":["../../../../src/callers/compat/nextIntl.ts"],"sourcesContent":["import type { CallerDescriptor } from '../types';\n\n/**\n * next-intl — `@intlayer/next-intl` compat adapter.\n *\n * Mirrors `compat/next-intl/src/plugin/index.ts` (`NEXT_INTL_SWC_CALLERS`),\n * adding the `getTranslations({ locale, namespace })` object overload.\n */\nexport const NEXT_INTL_CALLERS: CallerDescriptor[] = [\n {\n callerName: 'useTranslations',\n library: 'next-intl',\n importSources: ['next-intl', '@intlayer/next-intl'],\n namespaceSources: [{ from: 'argument', index: 0 }],\n translationFunction: 'return-value',\n // useTranslations('about.counter') → dictionary `about`, prefix `counter`\n nestedNamespace: true,\n // bare useTranslations() → first id segment is the dictionary\n allowRootScope: true,\n staticReplacement: 'useDictionary',\n dynamicReplacement: 'useDictionaryDynamic',\n },\n {\n callerName: 'getTranslations',\n library: 'next-intl',\n importSources: ['next-intl/server', '@intlayer/next-intl/server'],\n // Both overloads: getTranslations('ns') and\n // getTranslations({ locale, namespace: 'ns' }).\n namespaceSources: [\n { from: 'argument', index: 0 },\n { from: 'option', argumentIndex: 0, property: 'namespace' },\n ],\n translationFunction: 'return-value',\n nestedNamespace: true,\n allowRootScope: true,\n staticReplacement: 'getDictionary',\n dynamicReplacement: 'getDictionaryDynamic',\n },\n];\n"],"mappings":";;;;;;;;;AAQA,MAAa,oBAAwC,CACnD;CACE,YAAY;CACZ,SAAS;CACT,eAAe,CAAC,aAAa,qBAAqB;CAClD,kBAAkB,CAAC;EAAE,MAAM;EAAY,OAAO;CAAE,CAAC;CACjD,qBAAqB;CAErB,iBAAiB;CAEjB,gBAAgB;CAChB,mBAAmB;CACnB,oBAAoB;AACtB,GACA;CACE,YAAY;CACZ,SAAS;CACT,eAAe,CAAC,oBAAoB,4BAA4B;CAGhE,kBAAkB,CAChB;EAAE,MAAM;EAAY,OAAO;CAAE,GAC7B;EAAE,MAAM;EAAU,eAAe;EAAG,UAAU;CAAY,CAC5D;CACA,qBAAqB;CACrB,iBAAiB;CACjB,gBAAgB;CAChB,mBAAmB;CACnB,oBAAoB;AACtB,CACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"reactI18next.cjs","names":[],"sources":["../../../../src/callers/compat/reactI18next.ts"],"sourcesContent":["import type { CallerDescriptor } from '../types';\n\n/**\n * react-i18next / next-i18next — `@intlayer/react-i18next` and\n * `@intlayer/next-i18next` compat adapters (next-i18next re-exports the\n * react-i18next hook, so both libraries share the same callers).\n *\n * Mirrors `compat/react-i18next/src/plugin/index.ts` and\n * `compat/next-i18next/src/plugin/index.ts`.\n */\nexport const REACT_I18NEXT_CALLERS: CallerDescriptor[] = [\n {\n callerName: 'useTranslation',\n library: 'react-i18next',\n importSources: [\n 'react-i18next',\n 'next-i18next',\n '@intlayer/react-i18next',\n '@intlayer/next-i18next',\n ],\n namespaceSources: [{ from: 'argument', index: 0 }],\n keyPrefixSources: [\n { from: 'option', argumentIndex: 1, property: 'keyPrefix' },\n ],\n translationFunction: 'destructured-t',\n staticReplacement: 'useDictionary',\n dynamicReplacement: 'useDictionaryDynamic',\n },\n {\n callerName: 'Trans',\n library: 'react-i18next',\n importSources: [\n 'react-i18next',\n 'next-i18next',\n '@intlayer/react-i18next',\n '@intlayer/next-i18next',\n ],\n // <Trans ns=\"home\" i18nKey=\"richText\" /> — the namespace attribute is\n // optional; without it the analyser falls back to the single translator\n // namespace declared in the same file.\n jsxIdAttribute: 'i18nKey',\n jsxNamespaceAttribute: 'ns',\n namespaceSources: [],\n translationFunction: 'self',\n },\n];\n"],"mappings":";;;;;;;;;;;AAUA,MAAa,wBAA4C,CACvD;CACE,YAAY;CACZ,SAAS;CACT,eAAe;EACb;EACA;EACA;EACA;EACD;CACD,kBAAkB,CAAC;EAAE,MAAM;EAAY,OAAO;EAAG,CAAC;CAClD,kBAAkB,CAChB;EAAE,MAAM;EAAU,eAAe;EAAG,UAAU;EAAa,CAC5D;CACD,qBAAqB;CACrB,mBAAmB;CACnB,oBAAoB;CACrB,EACD;CACE,YAAY;CACZ,SAAS;CACT,eAAe;EACb;EACA;EACA;EACA;EACD;CAID,gBAAgB;CAChB,uBAAuB;CACvB,kBAAkB,EAAE;CACpB,qBAAqB;CACtB,CACF"}
1
+ {"version":3,"file":"reactI18next.cjs","names":[],"sources":["../../../../src/callers/compat/reactI18next.ts"],"sourcesContent":["import type { CallerDescriptor } from '../types';\n\n/**\n * react-i18next / next-i18next — `@intlayer/react-i18next` and\n * `@intlayer/next-i18next` compat adapters (next-i18next re-exports the\n * react-i18next hook, so both libraries share the same callers).\n *\n * Mirrors `compat/react-i18next/src/plugin/index.ts` and\n * `compat/next-i18next/src/plugin/index.ts`.\n */\nexport const REACT_I18NEXT_CALLERS: CallerDescriptor[] = [\n {\n callerName: 'useTranslation',\n library: 'react-i18next',\n importSources: [\n 'react-i18next',\n 'next-i18next',\n '@intlayer/react-i18next',\n '@intlayer/next-i18next',\n ],\n namespaceSources: [{ from: 'argument', index: 0 }],\n keyPrefixSources: [\n { from: 'option', argumentIndex: 1, property: 'keyPrefix' },\n ],\n translationFunction: 'destructured-t',\n staticReplacement: 'useDictionary',\n dynamicReplacement: 'useDictionaryDynamic',\n },\n {\n callerName: 'Trans',\n library: 'react-i18next',\n importSources: [\n 'react-i18next',\n 'next-i18next',\n '@intlayer/react-i18next',\n '@intlayer/next-i18next',\n ],\n // <Trans ns=\"home\" i18nKey=\"richText\" /> — the namespace attribute is\n // optional; without it the analyser falls back to the single translator\n // namespace declared in the same file.\n jsxIdAttribute: 'i18nKey',\n jsxNamespaceAttribute: 'ns',\n namespaceSources: [],\n translationFunction: 'self',\n },\n];\n"],"mappings":";;;;;;;;;;;AAUA,MAAa,wBAA4C,CACvD;CACE,YAAY;CACZ,SAAS;CACT,eAAe;EACb;EACA;EACA;EACA;CACF;CACA,kBAAkB,CAAC;EAAE,MAAM;EAAY,OAAO;CAAE,CAAC;CACjD,kBAAkB,CAChB;EAAE,MAAM;EAAU,eAAe;EAAG,UAAU;CAAY,CAC5D;CACA,qBAAqB;CACrB,mBAAmB;CACnB,oBAAoB;AACtB,GACA;CACE,YAAY;CACZ,SAAS;CACT,eAAe;EACb;EACA;EACA;EACA;CACF;CAIA,gBAAgB;CAChB,uBAAuB;CACvB,kBAAkB,CAAC;CACnB,qBAAqB;AACvB,CACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"reactIntl.cjs","names":[],"sources":["../../../../src/callers/compat/reactIntl.ts"],"sourcesContent":["import type { CallerDescriptor } from '../types';\n\n/**\n * react-intl (FormatJS) — `@intlayer/react-intl` compat adapter.\n *\n * The full dotted message id encodes both the dictionary key and the field\n * path: `formatMessage({ id: 'home.title' })` → dictionary `home`, field\n * `title`.\n *\n * Mirrors `compat/react-intl/src/plugin/index.ts`.\n */\nexport const REACT_INTL_CALLERS: CallerDescriptor[] = [\n {\n callerName: 'formatMessage',\n library: 'react-intl',\n importSources: ['react-intl', '@intlayer/react-intl'],\n // Matches both `intl.formatMessage(...)` and the destructured\n // `const { formatMessage } = useIntl()` identifier form.\n matchAsMethod: true,\n namespaceSources: [{ from: 'path-first-segment' }],\n translationFunction: 'self',\n },\n {\n callerName: 'FormattedMessage',\n library: 'react-intl',\n importSources: ['react-intl', '@intlayer/react-intl'],\n jsxIdAttribute: 'id',\n namespaceSources: [{ from: 'path-first-segment' }],\n translationFunction: 'self',\n },\n];\n"],"mappings":";;;;;;;;;;;;AAWA,MAAa,qBAAyC,CACpD;CACE,YAAY;CACZ,SAAS;CACT,eAAe,CAAC,cAAc,uBAAuB;CAGrD,eAAe;CACf,kBAAkB,CAAC,EAAE,MAAM,sBAAsB,CAAC;CAClD,qBAAqB;CACtB,EACD;CACE,YAAY;CACZ,SAAS;CACT,eAAe,CAAC,cAAc,uBAAuB;CACrD,gBAAgB;CAChB,kBAAkB,CAAC,EAAE,MAAM,sBAAsB,CAAC;CAClD,qBAAqB;CACtB,CACF"}
1
+ {"version":3,"file":"reactIntl.cjs","names":[],"sources":["../../../../src/callers/compat/reactIntl.ts"],"sourcesContent":["import type { CallerDescriptor } from '../types';\n\n/**\n * react-intl (FormatJS) — `@intlayer/react-intl` compat adapter.\n *\n * The full dotted message id encodes both the dictionary key and the field\n * path: `formatMessage({ id: 'home.title' })` → dictionary `home`, field\n * `title`.\n *\n * Mirrors `compat/react-intl/src/plugin/index.ts`.\n */\nexport const REACT_INTL_CALLERS: CallerDescriptor[] = [\n {\n callerName: 'formatMessage',\n library: 'react-intl',\n importSources: ['react-intl', '@intlayer/react-intl'],\n // Matches both `intl.formatMessage(...)` and the destructured\n // `const { formatMessage } = useIntl()` identifier form.\n matchAsMethod: true,\n namespaceSources: [{ from: 'path-first-segment' }],\n translationFunction: 'self',\n },\n {\n callerName: 'FormattedMessage',\n library: 'react-intl',\n importSources: ['react-intl', '@intlayer/react-intl'],\n jsxIdAttribute: 'id',\n namespaceSources: [{ from: 'path-first-segment' }],\n translationFunction: 'self',\n },\n];\n"],"mappings":";;;;;;;;;;;;AAWA,MAAa,qBAAyC,CACpD;CACE,YAAY;CACZ,SAAS;CACT,eAAe,CAAC,cAAc,sBAAsB;CAGpD,eAAe;CACf,kBAAkB,CAAC,EAAE,MAAM,qBAAqB,CAAC;CACjD,qBAAqB;AACvB,GACA;CACE,YAAY;CACZ,SAAS;CACT,eAAe,CAAC,cAAc,sBAAsB;CACpD,gBAAgB;CAChB,kBAAkB,CAAC,EAAE,MAAM,qBAAqB,CAAC;CACjD,qBAAqB;AACvB,CACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"useIntl.cjs","names":[],"sources":["../../../../src/callers/compat/useIntl.ts"],"sourcesContent":["import type { CallerDescriptor } from '../types';\n\n/**\n * use-intl — `@intlayer/use-intl` compat adapter.\n *\n * Mirrors `compat/use-intl/src/plugin/index.ts`.\n */\nexport const USE_INTL_CALLERS: CallerDescriptor[] = [\n {\n callerName: 'useTranslations',\n library: 'use-intl',\n importSources: ['use-intl', 'use-intl/react', '@intlayer/use-intl'],\n namespaceSources: [{ from: 'argument', index: 0 }],\n translationFunction: 'return-value',\n // Same namespace semantics as next-intl (next-intl re-exports use-intl).\n nestedNamespace: true,\n allowRootScope: true,\n staticReplacement: 'useDictionary',\n dynamicReplacement: 'useDictionaryDynamic',\n },\n {\n callerName: 'createTranslator',\n library: 'use-intl',\n importSources: ['use-intl', 'use-intl/core', '@intlayer/use-intl'],\n namespaceSources: [\n { from: 'option', argumentIndex: 0, property: 'namespace' },\n ],\n translationFunction: 'return-value',\n nestedNamespace: true,\n allowRootScope: true,\n },\n];\n"],"mappings":";;;;;;;;AAOA,MAAa,mBAAuC,CAClD;CACE,YAAY;CACZ,SAAS;CACT,eAAe;EAAC;EAAY;EAAkB;EAAqB;CACnE,kBAAkB,CAAC;EAAE,MAAM;EAAY,OAAO;EAAG,CAAC;CAClD,qBAAqB;CAErB,iBAAiB;CACjB,gBAAgB;CAChB,mBAAmB;CACnB,oBAAoB;CACrB,EACD;CACE,YAAY;CACZ,SAAS;CACT,eAAe;EAAC;EAAY;EAAiB;EAAqB;CAClE,kBAAkB,CAChB;EAAE,MAAM;EAAU,eAAe;EAAG,UAAU;EAAa,CAC5D;CACD,qBAAqB;CACrB,iBAAiB;CACjB,gBAAgB;CACjB,CACF"}
1
+ {"version":3,"file":"useIntl.cjs","names":[],"sources":["../../../../src/callers/compat/useIntl.ts"],"sourcesContent":["import type { CallerDescriptor } from '../types';\n\n/**\n * use-intl — `@intlayer/use-intl` compat adapter.\n *\n * Mirrors `compat/use-intl/src/plugin/index.ts`.\n */\nexport const USE_INTL_CALLERS: CallerDescriptor[] = [\n {\n callerName: 'useTranslations',\n library: 'use-intl',\n importSources: ['use-intl', 'use-intl/react', '@intlayer/use-intl'],\n namespaceSources: [{ from: 'argument', index: 0 }],\n translationFunction: 'return-value',\n // Same namespace semantics as next-intl (next-intl re-exports use-intl).\n nestedNamespace: true,\n allowRootScope: true,\n staticReplacement: 'useDictionary',\n dynamicReplacement: 'useDictionaryDynamic',\n },\n {\n callerName: 'createTranslator',\n library: 'use-intl',\n importSources: ['use-intl', 'use-intl/core', '@intlayer/use-intl'],\n namespaceSources: [\n { from: 'option', argumentIndex: 0, property: 'namespace' },\n ],\n translationFunction: 'return-value',\n nestedNamespace: true,\n allowRootScope: true,\n },\n];\n"],"mappings":";;;;;;;;AAOA,MAAa,mBAAuC,CAClD;CACE,YAAY;CACZ,SAAS;CACT,eAAe;EAAC;EAAY;EAAkB;CAAoB;CAClE,kBAAkB,CAAC;EAAE,MAAM;EAAY,OAAO;CAAE,CAAC;CACjD,qBAAqB;CAErB,iBAAiB;CACjB,gBAAgB;CAChB,mBAAmB;CACnB,oBAAoB;AACtB,GACA;CACE,YAAY;CACZ,SAAS;CACT,eAAe;EAAC;EAAY;EAAiB;CAAoB;CACjE,kBAAkB,CAChB;EAAE,MAAM;EAAU,eAAe;EAAG,UAAU;CAAY,CAC5D;CACA,qBAAqB;CACrB,iBAAiB;CACjB,gBAAgB;AAClB,CACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"vueI18n.cjs","names":[],"sources":["../../../../src/callers/compat/vueI18n.ts"],"sourcesContent":["import type { CallerDescriptor } from '../types';\n\n/**\n * vue-i18n — `@intlayer/vue-i18n` compat adapter.\n *\n * Mirrors `compat/vue-i18n/src/plugin/index.ts`.\n */\nexport const VUE_I18N_CALLERS: CallerDescriptor[] = [\n {\n callerName: 'useI18n',\n library: 'vue-i18n',\n importSources: ['vue-i18n', '@intlayer/vue-i18n'],\n // `const { t } = useI18n({ namespace: 'ns' })` — the namespace is an\n // intlayer extension of vue-i18n's options object.\n namespaceSources: [\n { from: 'option', argumentIndex: 0, property: 'namespace' },\n ],\n translationFunction: 'destructured-t',\n // Bare `useI18n()` resolves the first key segment as the dictionary:\n // `t('footer.github')` → dictionary `footer`, field `github`.\n allowRootScope: true,\n staticReplacement: 'useDictionary',\n dynamicReplacement: 'useDictionaryDynamic',\n },\n];\n"],"mappings":";;;;;;;;AAOA,MAAa,mBAAuC,CAClD;CACE,YAAY;CACZ,SAAS;CACT,eAAe,CAAC,YAAY,qBAAqB;CAGjD,kBAAkB,CAChB;EAAE,MAAM;EAAU,eAAe;EAAG,UAAU;EAAa,CAC5D;CACD,qBAAqB;CAGrB,gBAAgB;CAChB,mBAAmB;CACnB,oBAAoB;CACrB,CACF"}
1
+ {"version":3,"file":"vueI18n.cjs","names":[],"sources":["../../../../src/callers/compat/vueI18n.ts"],"sourcesContent":["import type { CallerDescriptor } from '../types';\n\n/**\n * vue-i18n — `@intlayer/vue-i18n` compat adapter.\n *\n * Mirrors `compat/vue-i18n/src/plugin/index.ts`.\n */\nexport const VUE_I18N_CALLERS: CallerDescriptor[] = [\n {\n callerName: 'useI18n',\n library: 'vue-i18n',\n importSources: ['vue-i18n', '@intlayer/vue-i18n'],\n // `const { t } = useI18n({ namespace: 'ns' })` — the namespace is an\n // intlayer extension of vue-i18n's options object.\n namespaceSources: [\n { from: 'option', argumentIndex: 0, property: 'namespace' },\n ],\n translationFunction: 'destructured-t',\n // Bare `useI18n()` resolves the first key segment as the dictionary:\n // `t('footer.github')` → dictionary `footer`, field `github`.\n allowRootScope: true,\n staticReplacement: 'useDictionary',\n dynamicReplacement: 'useDictionaryDynamic',\n },\n];\n"],"mappings":";;;;;;;;AAOA,MAAa,mBAAuC,CAClD;CACE,YAAY;CACZ,SAAS;CACT,eAAe,CAAC,YAAY,oBAAoB;CAGhD,kBAAkB,CAChB;EAAE,MAAM;EAAU,eAAe;EAAG,UAAU;CAAY,CAC5D;CACA,qBAAqB;CAGrB,gBAAgB;CAChB,mBAAmB;CACnB,oBAAoB;AACtB,CACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","names":["I18NEXT_CALLERS","REACT_I18NEXT_CALLERS","NEXT_INTL_CALLERS","USE_INTL_CALLERS","REACT_INTL_CALLERS","LINGUI_CALLERS","VUE_I18N_CALLERS","BASE_CALLERS"],"sources":["../../../src/callers/index.ts"],"sourcesContent":["import { BASE_CALLERS } from './base';\nimport { I18NEXT_CALLERS } from './compat/i18next';\nimport { LINGUI_CALLERS } from './compat/lingui';\nimport { NEXT_INTL_CALLERS } from './compat/nextIntl';\nimport { REACT_I18NEXT_CALLERS } from './compat/reactI18next';\nimport { REACT_INTL_CALLERS } from './compat/reactIntl';\nimport { USE_INTL_CALLERS } from './compat/useIntl';\nimport { VUE_I18N_CALLERS } from './compat/vueI18n';\nimport type { CallerDescriptor } from './types';\n\nexport { BASE_CALLERS } from './base';\nexport { I18NEXT_CALLERS } from './compat/i18next';\nexport { LINGUI_CALLERS } from './compat/lingui';\nexport { NEXT_INTL_CALLERS } from './compat/nextIntl';\nexport { REACT_I18NEXT_CALLERS } from './compat/reactI18next';\nexport { REACT_INTL_CALLERS } from './compat/reactIntl';\nexport { USE_INTL_CALLERS } from './compat/useIntl';\nexport { VUE_I18N_CALLERS } from './compat/vueI18n';\nexport {\n getRewritableCallers,\n type SwcExtraCallerConfig,\n toSwcExtraCallers,\n} from './transform';\nexport type {\n CallerDescriptor,\n CallerResultShape,\n CallerValueSource,\n} from './types';\n\n/**\n * Compat-adapter callers, grouped in one list. Each compat package's bundler\n * plugin injects its own slice (e.g. `REACT_I18NEXT_CALLERS`) into the build\n * pipeline; this aggregate exists for consumers that need every syntax at\n * once, such as the LSP.\n */\nexport const COMPAT_CALLERS: CallerDescriptor[] = [\n ...I18NEXT_CALLERS,\n ...REACT_I18NEXT_CALLERS,\n ...NEXT_INTL_CALLERS,\n ...USE_INTL_CALLERS,\n ...REACT_INTL_CALLERS,\n ...LINGUI_CALLERS,\n ...VUE_I18N_CALLERS,\n];\n\n/** Base + compat callers — the full registry the matchers run against. */\nexport const ALL_CALLERS: CallerDescriptor[] = [\n ...BASE_CALLERS,\n ...COMPAT_CALLERS,\n];\n\n/**\n * Descriptors indexed by caller name. A name can map to several descriptors\n * (e.g. `Trans` exists in both react-i18next and lingui with different\n * attributes); matchers try them in registry order.\n */\nexport const CALLERS_BY_NAME: Map<string, CallerDescriptor[]> = (() => {\n const byName = new Map<string, CallerDescriptor[]>();\n\n for (const descriptor of ALL_CALLERS) {\n const existing = byName.get(descriptor.callerName);\n\n if (existing) {\n existing.push(descriptor);\n } else {\n byName.set(descriptor.callerName, [descriptor]);\n }\n }\n\n return byName;\n})();\n\n/**\n * Caller names whose dictionary key can appear as a positional string literal\n * argument (`caller('key', …)` / `caller(locale, 'key', …)`). Used to build\n * text-search regexes over project source files (find-references) and the\n * completion trigger pattern. Callers whose key never appears positionally\n * (fixed namespace, options object, JSX-only) are excluded on purpose.\n */\nexport const getPositionalKeyCallerNames = (): string[] => {\n const names = new Set<string>();\n\n for (const descriptor of ALL_CALLERS) {\n const hasPositionalNamespace = descriptor.namespaceSources.some(\n (source) => source.from === 'argument'\n );\n\n if (hasPositionalNamespace) names.add(descriptor.callerName);\n }\n\n return [...names];\n};\n\n/**\n * Returns `true` when the descriptor may participate in matching for a file\n * importing from `importSources`. Descriptors flagged `requiresImport` only\n * activate when the file imports from one of their declared modules;\n * everything else is always active (results are still validated against the\n * project's dictionaries downstream).\n *\n * @param descriptor - The caller descriptor to gate.\n * @param fileImportSources - Module specifiers imported by the analysed file.\n */\nexport const isCallerActive = (\n descriptor: CallerDescriptor,\n fileImportSources: ReadonlySet<string>\n): boolean => {\n if (!descriptor.requiresImport) return true;\n\n return descriptor.importSources.some((source) =>\n fileImportSources.has(source)\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAmCA,MAAa,iBAAqC;CAChD,GAAGA;CACH,GAAGC;CACH,GAAGC;CACH,GAAGC;CACH,GAAGC;CACH,GAAGC;CACH,GAAGC;CACJ;;AAGD,MAAa,cAAkC,CAC7C,GAAGC,mCACH,GAAG,eACJ;;;;;;AAOD,MAAa,yBAA0D;CACrE,MAAM,yBAAS,IAAI,KAAiC;AAEpD,MAAK,MAAM,cAAc,aAAa;EACpC,MAAM,WAAW,OAAO,IAAI,WAAW,WAAW;AAElD,MAAI,SACF,UAAS,KAAK,WAAW;MAEzB,QAAO,IAAI,WAAW,YAAY,CAAC,WAAW,CAAC;;AAInD,QAAO;IACL;;;;;;;;AASJ,MAAa,oCAA8C;CACzD,MAAM,wBAAQ,IAAI,KAAa;AAE/B,MAAK,MAAM,cAAc,YAKvB,KAJ+B,WAAW,iBAAiB,MACxD,WAAW,OAAO,SAAS,WAGJ,CAAE,OAAM,IAAI,WAAW,WAAW;AAG9D,QAAO,CAAC,GAAG,MAAM;;;;;;;;;;;;AAanB,MAAa,kBACX,YACA,sBACY;AACZ,KAAI,CAAC,WAAW,eAAgB,QAAO;AAEvC,QAAO,WAAW,cAAc,MAAM,WACpC,kBAAkB,IAAI,OAAO,CAC9B"}
1
+ {"version":3,"file":"index.cjs","names":["I18NEXT_CALLERS","REACT_I18NEXT_CALLERS","NEXT_INTL_CALLERS","USE_INTL_CALLERS","REACT_INTL_CALLERS","LINGUI_CALLERS","VUE_I18N_CALLERS","BASE_CALLERS"],"sources":["../../../src/callers/index.ts"],"sourcesContent":["import { BASE_CALLERS } from './base';\nimport { I18NEXT_CALLERS } from './compat/i18next';\nimport { LINGUI_CALLERS } from './compat/lingui';\nimport { NEXT_INTL_CALLERS } from './compat/nextIntl';\nimport { REACT_I18NEXT_CALLERS } from './compat/reactI18next';\nimport { REACT_INTL_CALLERS } from './compat/reactIntl';\nimport { USE_INTL_CALLERS } from './compat/useIntl';\nimport { VUE_I18N_CALLERS } from './compat/vueI18n';\nimport type { CallerDescriptor } from './types';\n\nexport { BASE_CALLERS } from './base';\nexport { I18NEXT_CALLERS } from './compat/i18next';\nexport { LINGUI_CALLERS } from './compat/lingui';\nexport { NEXT_INTL_CALLERS } from './compat/nextIntl';\nexport { REACT_I18NEXT_CALLERS } from './compat/reactI18next';\nexport { REACT_INTL_CALLERS } from './compat/reactIntl';\nexport { USE_INTL_CALLERS } from './compat/useIntl';\nexport { VUE_I18N_CALLERS } from './compat/vueI18n';\nexport {\n getRewritableCallers,\n type SwcExtraCallerConfig,\n toSwcExtraCallers,\n} from './transform';\nexport type {\n CallerDescriptor,\n CallerResultShape,\n CallerValueSource,\n} from './types';\n\n/**\n * Compat-adapter callers, grouped in one list. Each compat package's bundler\n * plugin injects its own slice (e.g. `REACT_I18NEXT_CALLERS`) into the build\n * pipeline; this aggregate exists for consumers that need every syntax at\n * once, such as the LSP.\n */\nexport const COMPAT_CALLERS: CallerDescriptor[] = [\n ...I18NEXT_CALLERS,\n ...REACT_I18NEXT_CALLERS,\n ...NEXT_INTL_CALLERS,\n ...USE_INTL_CALLERS,\n ...REACT_INTL_CALLERS,\n ...LINGUI_CALLERS,\n ...VUE_I18N_CALLERS,\n];\n\n/** Base + compat callers — the full registry the matchers run against. */\nexport const ALL_CALLERS: CallerDescriptor[] = [\n ...BASE_CALLERS,\n ...COMPAT_CALLERS,\n];\n\n/**\n * Descriptors indexed by caller name. A name can map to several descriptors\n * (e.g. `Trans` exists in both react-i18next and lingui with different\n * attributes); matchers try them in registry order.\n */\nexport const CALLERS_BY_NAME: Map<string, CallerDescriptor[]> = (() => {\n const byName = new Map<string, CallerDescriptor[]>();\n\n for (const descriptor of ALL_CALLERS) {\n const existing = byName.get(descriptor.callerName);\n\n if (existing) {\n existing.push(descriptor);\n } else {\n byName.set(descriptor.callerName, [descriptor]);\n }\n }\n\n return byName;\n})();\n\n/**\n * Caller names whose dictionary key can appear as a positional string literal\n * argument (`caller('key', …)` / `caller(locale, 'key', …)`). Used to build\n * text-search regexes over project source files (find-references) and the\n * completion trigger pattern. Callers whose key never appears positionally\n * (fixed namespace, options object, JSX-only) are excluded on purpose.\n */\nexport const getPositionalKeyCallerNames = (): string[] => {\n const names = new Set<string>();\n\n for (const descriptor of ALL_CALLERS) {\n const hasPositionalNamespace = descriptor.namespaceSources.some(\n (source) => source.from === 'argument'\n );\n\n if (hasPositionalNamespace) names.add(descriptor.callerName);\n }\n\n return [...names];\n};\n\n/**\n * Returns `true` when the descriptor may participate in matching for a file\n * importing from `importSources`. Descriptors flagged `requiresImport` only\n * activate when the file imports from one of their declared modules;\n * everything else is always active (results are still validated against the\n * project's dictionaries downstream).\n *\n * @param descriptor - The caller descriptor to gate.\n * @param fileImportSources - Module specifiers imported by the analysed file.\n */\nexport const isCallerActive = (\n descriptor: CallerDescriptor,\n fileImportSources: ReadonlySet<string>\n): boolean => {\n if (!descriptor.requiresImport) return true;\n\n return descriptor.importSources.some((source) =>\n fileImportSources.has(source)\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAmCA,MAAa,iBAAqC;CAChD,GAAGA;CACH,GAAGC;CACH,GAAGC;CACH,GAAGC;CACH,GAAGC;CACH,GAAGC;CACH,GAAGC;AACL;;AAGA,MAAa,cAAkC,CAC7C,GAAGC,mCACH,GAAG,cACL;;;;;;AAOA,MAAa,yBAA0D;CACrE,MAAM,yBAAS,IAAI,IAAgC;CAEnD,KAAK,MAAM,cAAc,aAAa;EACpC,MAAM,WAAW,OAAO,IAAI,WAAW,UAAU;EAEjD,IAAI,UACF,SAAS,KAAK,UAAU;OAExB,OAAO,IAAI,WAAW,YAAY,CAAC,UAAU,CAAC;CAElD;CAEA,OAAO;AACT,EAAC,CAAE;;;;;;;;AASH,MAAa,oCAA8C;CACzD,MAAM,wBAAQ,IAAI,IAAY;CAE9B,KAAK,MAAM,cAAc,aAKvB,IAJ+B,WAAW,iBAAiB,MACxD,WAAW,OAAO,SAAS,UAGL,GAAG,MAAM,IAAI,WAAW,UAAU;CAG7D,OAAO,CAAC,GAAG,KAAK;AAClB;;;;;;;;;;;AAYA,MAAa,kBACX,YACA,sBACY;CACZ,IAAI,CAAC,WAAW,gBAAgB,OAAO;CAEvC,OAAO,WAAW,cAAc,MAAM,WACpC,kBAAkB,IAAI,MAAM,CAC9B;AACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"transform.cjs","names":[],"sources":["../../../src/callers/transform.ts"],"sourcesContent":["import type { CallerDescriptor, CallerValueSource } from './types';\n\n/**\n * Wire format of an extra caller forwarded to the `@intlayer/swc` plugin.\n *\n * Field names mirror the serde attributes of `ExtraCallerConfig` in\n * `packages/@intlayer/swc/src/lib.rs` — both sides must stay in sync.\n */\nexport type SwcExtraCallerConfig = {\n /** The function name the user calls, e.g. `\"useTranslation\"`. */\n callerName: string;\n /** Module specifiers exporting the function (original + `@intlayer/*`). */\n importSources: string[];\n /**\n * Zero-based index of the positional argument holding the namespace string.\n * Omitted for fixed/option namespace callers.\n */\n namespaceArgIndex?: number;\n /**\n * Compile-time constant namespace — the dictionary ident is inserted as a\n * new first argument (lingui's `useLingui()`).\n */\n fixedNamespace?: string;\n /**\n * Namespace read from a property of an options-object argument — the\n * dictionary ident is inserted as a new first argument and the property is\n * rewritten to the key-prefix remainder (vue-i18n's `useI18n({ namespace })`).\n */\n namespaceOption?: { argumentIndex: number; property: string };\n /** Replacement function name for static import mode, e.g. `\"useDictionary\"`. */\n staticReplacement: string;\n /** Replacement function name for dynamic/fetch mode, e.g. `\"useDictionaryDynamic\"`. */\n dynamicReplacement: string;\n};\n\n/**\n * Returns the callers of a registry slice that the optimize pass can rewrite\n * at build time: plain imported functions carrying both replacement names.\n *\n * Method-matched callers (`i18n.getFixedT`) and JSX components are excluded —\n * their call sites cannot be re-pointed through an import specifier rename.\n */\nexport const getRewritableCallers = (\n descriptors: CallerDescriptor[]\n): CallerDescriptor[] =>\n descriptors.filter(\n (descriptor) =>\n descriptor.staticReplacement !== undefined &&\n descriptor.dynamicReplacement !== undefined &&\n descriptor.matchAsMethod !== true &&\n descriptor.jsxIdAttribute === undefined\n );\n\nconst findSource = <F extends CallerValueSource['from']>(\n sources: CallerValueSource[],\n from: F\n): Extract<CallerValueSource, { from: F }> | undefined =>\n sources.find(\n (source): source is Extract<CallerValueSource, { from: F }> =>\n source.from === from\n );\n\n/**\n * Serialises the rewritable callers of a registry slice into the\n * `@intlayer/swc` plugin wire format (`extraCallers` option).\n *\n * Callers whose namespace can only be derived per-message id\n * (`path-first-segment`) are skipped: the transform cannot bind a single\n * dictionary to the call site.\n *\n * @param descriptors - Registry slice, e.g. `REACT_I18NEXT_CALLERS`.\n * @returns Configs ready to pass as `swcExtraCallers` / `extraCallers`.\n */\nexport const toSwcExtraCallers = (\n descriptors: CallerDescriptor[]\n): SwcExtraCallerConfig[] =>\n getRewritableCallers(descriptors).flatMap((descriptor) => {\n const argumentSource = findSource(descriptor.namespaceSources, 'argument');\n const optionSource = findSource(descriptor.namespaceSources, 'option');\n const fixedSource = findSource(descriptor.namespaceSources, 'fixed');\n\n if (!argumentSource && !optionSource && !fixedSource) return [];\n\n return [\n {\n callerName: descriptor.callerName,\n importSources: descriptor.importSources,\n ...(argumentSource ? { namespaceArgIndex: argumentSource.index } : {}),\n ...(fixedSource ? { fixedNamespace: fixedSource.value } : {}),\n ...(optionSource\n ? {\n namespaceOption: {\n argumentIndex: optionSource.argumentIndex,\n property: optionSource.property,\n },\n }\n : {}),\n staticReplacement: descriptor.staticReplacement!,\n dynamicReplacement: descriptor.dynamicReplacement!,\n },\n ];\n });\n"],"mappings":";;;;;;;;;;AA0CA,MAAa,wBACX,gBAEA,YAAY,QACT,eACC,WAAW,sBAAsB,UACjC,WAAW,uBAAuB,UAClC,WAAW,kBAAkB,QAC7B,WAAW,mBAAmB,OACjC;AAEH,MAAM,cACJ,SACA,SAEA,QAAQ,MACL,WACC,OAAO,SAAS,KACnB;;;;;;;;;;;;AAaH,MAAa,qBACX,gBAEA,qBAAqB,YAAY,CAAC,SAAS,eAAe;CACxD,MAAM,iBAAiB,WAAW,WAAW,kBAAkB,WAAW;CAC1E,MAAM,eAAe,WAAW,WAAW,kBAAkB,SAAS;CACtE,MAAM,cAAc,WAAW,WAAW,kBAAkB,QAAQ;AAEpE,KAAI,CAAC,kBAAkB,CAAC,gBAAgB,CAAC,YAAa,QAAO,EAAE;AAE/D,QAAO,CACL;EACE,YAAY,WAAW;EACvB,eAAe,WAAW;EAC1B,GAAI,iBAAiB,EAAE,mBAAmB,eAAe,OAAO,GAAG,EAAE;EACrE,GAAI,cAAc,EAAE,gBAAgB,YAAY,OAAO,GAAG,EAAE;EAC5D,GAAI,eACA,EACE,iBAAiB;GACf,eAAe,aAAa;GAC5B,UAAU,aAAa;GACxB,EACF,GACD,EAAE;EACN,mBAAmB,WAAW;EAC9B,oBAAoB,WAAW;EAChC,CACF;EACD"}
1
+ {"version":3,"file":"transform.cjs","names":[],"sources":["../../../src/callers/transform.ts"],"sourcesContent":["import type { CallerDescriptor, CallerValueSource } from './types';\n\n/**\n * Wire format of an extra caller forwarded to the `@intlayer/swc` plugin.\n *\n * Field names mirror the serde attributes of `ExtraCallerConfig` in\n * `packages/@intlayer/swc/src/lib.rs` — both sides must stay in sync.\n */\nexport type SwcExtraCallerConfig = {\n /** The function name the user calls, e.g. `\"useTranslation\"`. */\n callerName: string;\n /** Module specifiers exporting the function (original + `@intlayer/*`). */\n importSources: string[];\n /**\n * Zero-based index of the positional argument holding the namespace string.\n * Omitted for fixed/option namespace callers.\n */\n namespaceArgIndex?: number;\n /**\n * Compile-time constant namespace — the dictionary ident is inserted as a\n * new first argument (lingui's `useLingui()`).\n */\n fixedNamespace?: string;\n /**\n * Namespace read from a property of an options-object argument — the\n * dictionary ident is inserted as a new first argument and the property is\n * rewritten to the key-prefix remainder (vue-i18n's `useI18n({ namespace })`).\n */\n namespaceOption?: { argumentIndex: number; property: string };\n /** Replacement function name for static import mode, e.g. `\"useDictionary\"`. */\n staticReplacement: string;\n /** Replacement function name for dynamic/fetch mode, e.g. `\"useDictionaryDynamic\"`. */\n dynamicReplacement: string;\n};\n\n/**\n * Returns the callers of a registry slice that the optimize pass can rewrite\n * at build time: plain imported functions carrying both replacement names.\n *\n * Method-matched callers (`i18n.getFixedT`) and JSX components are excluded —\n * their call sites cannot be re-pointed through an import specifier rename.\n */\nexport const getRewritableCallers = (\n descriptors: CallerDescriptor[]\n): CallerDescriptor[] =>\n descriptors.filter(\n (descriptor) =>\n descriptor.staticReplacement !== undefined &&\n descriptor.dynamicReplacement !== undefined &&\n descriptor.matchAsMethod !== true &&\n descriptor.jsxIdAttribute === undefined\n );\n\nconst findSource = <F extends CallerValueSource['from']>(\n sources: CallerValueSource[],\n from: F\n): Extract<CallerValueSource, { from: F }> | undefined =>\n sources.find(\n (source): source is Extract<CallerValueSource, { from: F }> =>\n source.from === from\n );\n\n/**\n * Serialises the rewritable callers of a registry slice into the\n * `@intlayer/swc` plugin wire format (`extraCallers` option).\n *\n * Callers whose namespace can only be derived per-message id\n * (`path-first-segment`) are skipped: the transform cannot bind a single\n * dictionary to the call site.\n *\n * @param descriptors - Registry slice, e.g. `REACT_I18NEXT_CALLERS`.\n * @returns Configs ready to pass as `swcExtraCallers` / `extraCallers`.\n */\nexport const toSwcExtraCallers = (\n descriptors: CallerDescriptor[]\n): SwcExtraCallerConfig[] =>\n getRewritableCallers(descriptors).flatMap((descriptor) => {\n const argumentSource = findSource(descriptor.namespaceSources, 'argument');\n const optionSource = findSource(descriptor.namespaceSources, 'option');\n const fixedSource = findSource(descriptor.namespaceSources, 'fixed');\n\n if (!argumentSource && !optionSource && !fixedSource) return [];\n\n return [\n {\n callerName: descriptor.callerName,\n importSources: descriptor.importSources,\n ...(argumentSource ? { namespaceArgIndex: argumentSource.index } : {}),\n ...(fixedSource ? { fixedNamespace: fixedSource.value } : {}),\n ...(optionSource\n ? {\n namespaceOption: {\n argumentIndex: optionSource.argumentIndex,\n property: optionSource.property,\n },\n }\n : {}),\n staticReplacement: descriptor.staticReplacement!,\n dynamicReplacement: descriptor.dynamicReplacement!,\n },\n ];\n });\n"],"mappings":";;;;;;;;;;AA0CA,MAAa,wBACX,gBAEA,YAAY,QACT,eACC,WAAW,sBAAsB,UACjC,WAAW,uBAAuB,UAClC,WAAW,kBAAkB,QAC7B,WAAW,mBAAmB,MAClC;AAEF,MAAM,cACJ,SACA,SAEA,QAAQ,MACL,WACC,OAAO,SAAS,IACpB;;;;;;;;;;;;AAaF,MAAa,qBACX,gBAEA,qBAAqB,WAAW,CAAC,CAAC,SAAS,eAAe;CACxD,MAAM,iBAAiB,WAAW,WAAW,kBAAkB,UAAU;CACzE,MAAM,eAAe,WAAW,WAAW,kBAAkB,QAAQ;CACrE,MAAM,cAAc,WAAW,WAAW,kBAAkB,OAAO;CAEnE,IAAI,CAAC,kBAAkB,CAAC,gBAAgB,CAAC,aAAa,OAAO,CAAC;CAE9D,OAAO,CACL;EACE,YAAY,WAAW;EACvB,eAAe,WAAW;EAC1B,GAAI,iBAAiB,EAAE,mBAAmB,eAAe,MAAM,IAAI,CAAC;EACpE,GAAI,cAAc,EAAE,gBAAgB,YAAY,MAAM,IAAI,CAAC;EAC3D,GAAI,eACA,EACE,iBAAiB;GACf,eAAe,aAAa;GAC5B,UAAU,aAAa;EACzB,EACF,IACA,CAAC;EACL,mBAAmB,WAAW;EAC9B,oBAAoB,WAAW;CACjC,CACF;AACF,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"buildBrowserConfiguration.cjs","names":["LOCALES","REQUIRED_LOCALES","STORAGE","getStorageAttributes","PREFIX"],"sources":["../../../src/configFile/buildBrowserConfiguration.ts"],"sourcesContent":["import type {\n AnalyticsConfig,\n CustomIntlayerConfig,\n CustomRoutingConfig,\n EditorConfig,\n InternationalizationConfig,\n IntlayerConfig,\n LogConfig,\n LogFunctions,\n RoutingConfig,\n} from '@intlayer/types/config';\nimport {\n ANALYTICS_ENABLED,\n ANALYTICS_FLUSH_INTERVAL,\n ANALYTICS_SAMPLE_RATE,\n} from '../defaultValues/analytics';\nimport {\n APPLICATION_URL,\n BACKEND_URL,\n CMS_URL,\n DICTIONARY_PRIORITY_STRATEGY,\n EDITOR_URL,\n IS_ENABLED,\n LIVE_SYNC,\n LIVE_SYNC_PORT,\n PORT,\n} from '../defaultValues/editor';\nimport {\n DEFAULT_LOCALE,\n LOCALES,\n REQUIRED_LOCALES,\n STRICT_MODE,\n} from '../defaultValues/internationalization';\nimport { MODE, PREFIX } from '../defaultValues/log';\nimport {\n BASE_PATH,\n ENABLE_PROXY,\n ROUTING_MODE,\n STORAGE,\n} from '../defaultValues/routing';\nimport { getStorageAttributes } from '../utils/getStorageAttributes';\n\n// ---------------------------------------------------------------------------\n// Type\n// ---------------------------------------------------------------------------\n\n/**\n * Browser-safe subset of {@link IntlayerConfig}.\n *\n * Excludes server-only fields (`system`, `content`, `build`, `compiler`,\n * `dictionary`, `ai`) and sensitive editor credentials (`clientId`,\n * `clientSecret`) that must never be shipped to the browser.\n */\nexport type BrowserIntlayerConfig = {\n internationalization: Pick<\n InternationalizationConfig,\n 'locales' | 'defaultLocale'\n >;\n routing: RoutingConfig;\n editor: Omit<EditorConfig, 'clientId' | 'clientSecret'>;\n analytics: AnalyticsConfig;\n log: Pick<LogConfig, 'mode' | 'prefix'>;\n};\n\ndeclare global {\n interface Window {\n /** Browser-safe Intlayer configuration injected by a build plugin or `installIntlayer`. */\n INTLAYER_CONFIG?: BrowserIntlayerConfig;\n }\n}\n\n// ---------------------------------------------------------------------------\n// Shared field builders (browser-safe — no Node.js APIs)\n//\n// These functions are re-used by both `buildBrowserConfiguration` (browser)\n// and `buildConfigurationFields` (server) to avoid duplication.\n// ---------------------------------------------------------------------------\n\n/**\n * Build the internationalization section of the Intlayer configuration.\n *\n * @param customConfiguration - Partial user-supplied internationalization config.\n * @returns A fully-defaulted {@link InternationalizationConfig}.\n */\nexport const buildInternationalizationFields = (\n customConfiguration?: Partial<InternationalizationConfig>\n): InternationalizationConfig => ({\n /**\n * Locales available in the application\n *\n * Default: ['en']\n *\n */\n locales: customConfiguration?.locales ?? LOCALES,\n\n /**\n * Locales required by TypeScript to ensure strong implementations of internationalized content using typescript.\n *\n * Default: []\n *\n * If empty, all locales are required in `strict` mode.\n *\n * Ensure required locales are also defined in the `locales` field.\n */\n requiredLocales:\n customConfiguration?.requiredLocales ??\n customConfiguration?.locales ??\n REQUIRED_LOCALES,\n\n /**\n * Ensure strong implementations of internationalized content using typescript.\n * - If set to \"strict\", the translation `t` function will require each declared locales to be defined. If one locale is missing, or if a locale is not declared in your config, it will throw an error.\n * - If set to \"inclusive\", the translation `t` function will require each declared locales to be defined. If one locale is missing, it will throw a warning. But will accept if a locale is not declared in your config, but exist.\n * - If set to \"loose\", the translation `t` function will accept any existing locale.\n *\n * Default: \"inclusive\"\n */\n strictMode: customConfiguration?.strictMode ?? STRICT_MODE,\n\n /**\n * Default locale of the application for fallback\n *\n * Default: 'en'\n */\n defaultLocale: customConfiguration?.defaultLocale ?? DEFAULT_LOCALE,\n});\n\n/**\n * Build the routing section of the Intlayer configuration.\n *\n * @param customConfiguration - Partial user-supplied routing config.\n * @returns A fully-defaulted {@link RoutingConfig}.\n */\nexport const buildRoutingFields = (\n customConfiguration?: Partial<CustomRoutingConfig>\n): RoutingConfig => {\n const storage = customConfiguration?.storage ?? STORAGE;\n\n return {\n /**\n * URL routing mode for locale handling\n *\n * Controls how locales are represented in application URLs:\n * - 'prefix-no-default': Prefix all locales except the default locale (default)\n * - en → /dashboard\n * - fr → /fr/dashboard\n *\n * - 'prefix-all': Prefix all locales including the default locale\n * - en → /en/dashboard\n * - fr → /fr/dashboard\n *\n * - 'search-params': Use search parameters for locale handling\n * - en → /dashboard?locale=en\n * - fr → /fr/dashboard?locale=fr\n *\n * - 'no-prefix': No locale prefixing in URLs\n * - en → /dashboard\n * - fr → /dashboard\n *\n * Default: 'prefix-no-default'\n */\n mode: customConfiguration?.mode ?? ROUTING_MODE,\n\n /**\n * Enables the Intlayer locale-routing proxy (middleware).\n *\n * When enabled, the build-tool integration (e.g. the `intlayer()` Vite plugin)\n * automatically wires the locale-detection / redirect / rewrite middleware in\n * development, preview, and production SSR.\n *\n * Default: true\n */\n enableProxy: customConfiguration?.enableProxy ?? ENABLE_PROXY,\n\n /**\n * Configuration for storing the locale in the client (localStorage or sessionStorage)\n *\n * If false, the locale will not be stored by the middleware.\n * If true, the locale storage will consider all default values. (cookie and header)\n *\n * Default: ['cookie', 'header']\n *\n */\n storage: getStorageAttributes(storage),\n\n /**\n * Base path of the application URL\n *\n * Default: ''\n *\n * Example:\n * - If the application is hosted at https://example.com/my-app\n * - The base path is '/my-app'\n * - The URL will be https://example.com/my-app/en\n * - If the base path is not set, the URL will be https://example.com/en\n */\n basePath: customConfiguration?.basePath ?? BASE_PATH,\n\n /**\n * Custom URL rewriting rules that override the default routing mode for specific paths.\n * Allows you to define locale-specific paths that differ from the standard routing behavior.\n * Supports dynamic route parameters using `[param]` syntax.\n *\n * Default: undefined\n *\n * Example:\n * ```typescript\n * rewrite: {\n * \"/about\": {\n * en: \"/about\",\n * fr: \"/a-propos\",\n * },\n * \"/product/[slug]\": {\n * en: \"/product/[slug]\",\n * fr: \"/produit/[slug]\",\n * },\n * }\n * ```\n *\n * Note:\n * - The rewrite rules take precedence over the default `mode` behavior.\n * - If a path matches a rewrite rule, the localized path from the rewrite configuration will be used.\n * - Dynamic route parameters are supported using bracket notation (e.g., `[slug]`, `[id]`).\n * - Works with both Next.js and Vite applications.\n */\n rewrite: customConfiguration?.rewrite,\n\n /**\n * Maps locales to specific domain hostnames for domain-based routing.\n *\n * Default: undefined\n */\n domains: customConfiguration?.domains,\n };\n};\n\n/**\n * Build the editor section of the Intlayer configuration.\n *\n * Returns the **full** {@link EditorConfig} including sensitive fields\n * (`clientId`, `clientSecret`). The browser-safe {@link BrowserIntlayerConfig}\n * omits those fields when exposing config to the client.\n *\n * When the user does not explicitly set `clientId` / `clientSecret` in the\n * configuration file, they fall back to the `INTLAYER_CLIENT_ID` /\n * `INTLAYER_CLIENT_SECRET` environment variables read from `env`. This lets\n * users authenticate purely through their `.env` file (including files passed\n * via the CLI `--env-file` flag) without having to wire `process.env` into the\n * configuration manually.\n *\n * @param customConfiguration - Partial user-supplied editor config.\n * @param env - Environment variables used to resolve credential fallbacks.\n * Defaults to `process.env`.\n * @returns A fully-defaulted {@link EditorConfig}.\n */\nexport const buildEditorFields = (\n customConfiguration?: Partial<EditorConfig>,\n env: NodeJS.ProcessEnv = process.env\n): EditorConfig => {\n const liveSyncPort = customConfiguration?.liveSyncPort ?? LIVE_SYNC_PORT;\n return {\n /**\n * URL of the application. Used to restrict the origin of the editor for security reasons.\n *\n * > '*' means that the editor is accessible from any origin\n *\n * Default: '*'\n */\n applicationURL: customConfiguration?.applicationURL || APPLICATION_URL,\n\n /**\n * URL of the editor server. Used to restrict the origin of the editor for security reasons.\n *\n * > '*' means that the editor is accessible from any origin\n *\n * Default: '*'\n */\n editorURL: customConfiguration?.editorURL || EDITOR_URL,\n\n /**\n * URL of the CMS server. Used to restrict the origin of the editor for security reasons.\n */\n cmsURL: customConfiguration?.cmsURL || CMS_URL,\n\n /**\n * URL of the editor server\n *\n * Default: 'https://back.intlayer.org'\n */\n backendURL: customConfiguration?.backendURL || BACKEND_URL,\n\n /** Port of the editor server\n *\n * Default: 8000\n */\n port: customConfiguration?.port ?? PORT,\n\n /**\n * Indicates if the application interact with the visual editor\n *\n * Default: false;\n *\n * If true, the editor will be able to interact with the application.\n * If false, the editor will not be able to interact with the application.\n * In any case, the editor can only be enabled by the visual editor.\n * Disabling the editor for specific environments is a way to enforce the security.\n *\n * Usage:\n * ```js\n * {\n * // Other configurations\n * editor: {\n * enabled: process.env.NODE_ENV !== 'production',\n * }\n * };\n * ```\n */\n enabled: customConfiguration?.enabled ?? IS_ENABLED,\n\n /**\n * clientId and clientSecret allow the intlayer packages to authenticate with the backend using oAuth2 authentication.\n * An access token is use to authenticate the user related to the project.\n * To get an access token, go to https://app.intlayer.org/project and create an account.\n *\n * Default: undefined\n *\n * > Important: The clientId and clientSecret should be kept secret and not shared publicly. Please ensure to keep them in a secure location, such as environment variables.\n */\n clientId: customConfiguration?.clientId ?? env.INTLAYER_CLIENT_ID,\n\n /**\n * clientId and clientSecret allow the intlayer packages to authenticate with the backend using oAuth2 authentication.\n * An access token is use to authenticate the user related to the project.\n * To get an access token, go to https://app.intlayer.org/project and create an account.\n *\n * Default: undefined\n *\n * > Important: The clientId and clientSecret should be kept secret and not shared publicly. Please ensure to keep them in a secure location, such as environment variables.\n */\n clientSecret:\n customConfiguration?.clientSecret ?? env.INTLAYER_CLIENT_SECRET,\n\n /**\n * Strategy for prioritizing dictionaries. If a dictionary is both present online and locally, the content will be merge.\n * However, is a field is defined in both dictionary, this setting determines which fields takes the priority over the other.\n *\n * Default: 'local_first'\n *\n * The strategy for prioritizing dictionaries. It can be either 'local_first' or 'distant_first'.\n * - 'local_first': The first dictionary found in the locale is used.\n * - 'distant_first': The first dictionary found in the distant locales is used.\n */\n dictionaryPriorityStrategy:\n customConfiguration?.dictionaryPriorityStrategy ??\n DICTIONARY_PRIORITY_STRATEGY,\n\n /**\n * Indicates if the application should hot reload the locale configurations when a change is detected.\n * For example, when a new dictionary is added or updated, the application will update the content tu display in the page.\n *\n * The hot reload is only available for clients of the `enterprise` plan.\n *\n * Default: false\n */\n liveSync: customConfiguration?.liveSync ?? LIVE_SYNC,\n\n /**\n * Port of the live sync server\n *\n * Default: 4000\n */\n liveSyncPort,\n\n /**\n * URL of the live sync server in case of remote live sync server\n *\n * Default: `http://localhost:${LIVE_SYNC_PORT}`\n */\n liveSyncURL:\n customConfiguration?.liveSyncURL ?? `http://localhost:${liveSyncPort}`,\n };\n};\n\n/**\n * Build the analytics section of the Intlayer configuration.\n *\n * Analytics is strictly opt-in: `enabled` defaults to `false` and, even when\n * enabled, the runtime additionally requires a project key (`editor.clientId`)\n * for attribution before collecting anything.\n *\n * @param customConfiguration - Partial user-supplied analytics config.\n * @returns A fully-defaulted {@link AnalyticsConfig}.\n */\nexport const buildAnalyticsFields = (\n customConfiguration?: Partial<AnalyticsConfig>\n): AnalyticsConfig => ({\n /**\n * Enables analytics collection (page views, content exposures, A/B events).\n *\n * Default: false\n */\n enabled: customConfiguration?.enabled ?? ANALYTICS_ENABLED,\n\n /**\n * Milliseconds between automatic batched flushes to the backend.\n *\n * Default: 20000\n */\n flushInterval: customConfiguration?.flushInterval ?? ANALYTICS_FLUSH_INTERVAL,\n\n /**\n * Fraction of sessions to record, from 0 (none) to 1 (all).\n *\n * Default: 1\n */\n sampleRate: customConfiguration?.sampleRate ?? ANALYTICS_SAMPLE_RATE,\n});\n\n/**\n * Build the log section of the Intlayer configuration.\n *\n * @param customConfiguration - Partial user-supplied log config.\n * @param logFunctions - Optional custom log function overrides (server-only).\n * @returns A fully-defaulted {@link LogConfig}.\n */\nexport const buildLogFields = (\n customConfiguration?: Partial<LogConfig>,\n logFunctions?: LogFunctions\n): LogConfig => ({\n /**\n * Indicates if the logger is enabled\n *\n * Default: 'prefix-no-default'\n *\n * If 'default', the logger is enabled and can be used.\n * If 'verbose', the logger will be enabled and can be used, but will log more information.\n * If 'disabled', the logger is disabled and cannot be used.\n */\n mode: customConfiguration?.mode ?? MODE,\n\n /**\n * Prefix of the logger\n *\n * Default: '[intlayer]'\n *\n * The prefix of the logger.\n */\n prefix: customConfiguration?.prefix ?? PREFIX,\n\n /**\n * Functions to log\n */\n error: logFunctions?.error,\n log: logFunctions?.log,\n info: logFunctions?.info,\n warn: logFunctions?.warn,\n});\n\n// ---------------------------------------------------------------------------\n// Browser configuration builders\n// ---------------------------------------------------------------------------\n\n/**\n * Build a browser-safe {@link BrowserIntlayerConfig} from a raw user config.\n *\n * Applies defaults for every field and strips all server-only or sensitive\n * information (`system`, `content`, `build`, `compiler`, `dictionary`, `ai`,\n * `editor.clientId`, `editor.clientSecret`).\n *\n * This is the browser counterpart of `buildConfigurationFields`. It is safe\n * to call in browser environments because it has no Node.js dependencies.\n *\n * @param customConfig - Optional partial user-supplied Intlayer config.\n * @returns A browser-safe configuration object ready for `window.INTLAYER_CONFIG`.\n *\n * @example\n * ```ts\n * import { buildBrowserConfiguration } from '@intlayer/config/client';\n *\n * window.INTLAYER_CONFIG = buildBrowserConfiguration({\n * internationalization: { locales: ['en', 'fr'], defaultLocale: 'en' },\n * });\n * ```\n */\nexport const buildBrowserConfiguration = (\n customConfig?: CustomIntlayerConfig\n): BrowserIntlayerConfig => {\n const { locales, defaultLocale } = buildInternationalizationFields(\n customConfig?.internationalization\n );\n const routing = buildRoutingFields(customConfig?.routing);\n const {\n clientId: _clientId,\n clientSecret: _clientSecret,\n ...editorPublic\n } = buildEditorFields(customConfig?.editor);\n const analytics = buildAnalyticsFields(customConfig?.analytics);\n const { mode, prefix } = buildLogFields(customConfig?.log);\n\n return {\n internationalization: { locales, defaultLocale },\n routing,\n editor: editorPublic,\n analytics,\n log: { mode, prefix },\n };\n};\n\n/**\n * Extract a {@link BrowserIntlayerConfig} from an already-built full\n * {@link IntlayerConfig}.\n *\n * Used by build plugins (`vite-intlayer`, `withIntlayer`) which already hold\n * the full server-side config and need to inject the browser-safe subset at\n * compile time via a bundler `define`.\n *\n * @param config - A fully-built server-side Intlayer configuration.\n * @returns The browser-safe subset of that configuration.\n */\nexport const extractBrowserConfiguration = (\n config: IntlayerConfig\n): BrowserIntlayerConfig => ({\n internationalization: {\n locales: config.internationalization.locales,\n defaultLocale: config.internationalization.defaultLocale,\n },\n routing: {\n mode: config.routing.mode,\n enableProxy: config.routing.enableProxy,\n storage: config.routing.storage,\n basePath: config.routing.basePath,\n rewrite: config.routing.rewrite,\n },\n editor: {\n applicationURL: config.editor.applicationURL,\n editorURL: config.editor.editorURL,\n cmsURL: config.editor.cmsURL,\n backendURL: config.editor.backendURL,\n port: config.editor.port,\n enabled: config.editor.enabled,\n dictionaryPriorityStrategy: config.editor.dictionaryPriorityStrategy,\n liveSync: config.editor.liveSync,\n liveSyncPort: config.editor.liveSyncPort,\n liveSyncURL: config.editor.liveSyncURL,\n },\n analytics: buildAnalyticsFields(config.analytics),\n log: {\n mode: config.log.mode,\n prefix: config.log.prefix,\n },\n});\n"],"mappings":";;;;;;;;;;;;;;;AAoFA,MAAa,mCACX,yBACgC;;;;;;;CAOhC,SAAS,qBAAqB,WAAWA;;;;;;;;;;CAWzC,iBACE,qBAAqB,mBACrB,qBAAqB,WACrBC;;;;;;;;;CAUF,YAAY,qBAAqB;;;;;;CAOjC,eAAe,qBAAqB;CACrC;;;;;;;AAQD,MAAa,sBACX,wBACkB;CAClB,MAAM,UAAU,qBAAqB,WAAWC;AAEhD,QAAO;;;;;;;;;;;;;;;;;;;;;;;EAuBL,MAAM,qBAAqB;;;;;;;;;;EAW3B,aAAa,qBAAqB;;;;;;;;;;EAWlC,SAASC,wDAAqB,QAAQ;;;;;;;;;;;;EAatC,UAAU,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA6B/B,SAAS,qBAAqB;;;;;;EAO9B,SAAS,qBAAqB;EAC/B;;;;;;;;;;;;;;;;;;;;;AAsBH,MAAa,qBACX,qBACA,MAAyB,QAAQ,QAChB;CACjB,MAAM,eAAe,qBAAqB;AAC1C,QAAO;;;;;;;;EAQL,gBAAgB,qBAAqB;;;;;;;;EASrC,WAAW,qBAAqB;;;;EAKhC,QAAQ,qBAAqB;;;;;;EAO7B,YAAY,qBAAqB;;;;;EAMjC,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;EAsB3B,SAAS,qBAAqB;;;;;;;;;;EAW9B,UAAU,qBAAqB,YAAY,IAAI;;;;;;;;;;EAW/C,cACE,qBAAqB,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OAAO;EAC1B,MAAM,OAAO,OAAO;EACpB,SAAS,OAAO,OAAO;EACvB,4BAA4B,OAAO,OAAO;EAC1C,UAAU,OAAO,OAAO;EACxB,cAAc,OAAO,OAAO;EAC5B,aAAa,OAAO,OAAO;EAC5B;CACD,WAAW,qBAAqB,OAAO,UAAU;CACjD,KAAK;EACH,MAAM,OAAO,IAAI;EACjB,QAAQ,OAAO,IAAI;EACpB;CACF"}
1
+ {"version":3,"file":"buildBrowserConfiguration.cjs","names":["LOCALES","REQUIRED_LOCALES","STORAGE","getStorageAttributes","PREFIX"],"sources":["../../../src/configFile/buildBrowserConfiguration.ts"],"sourcesContent":["import type {\n AnalyticsConfig,\n CustomIntlayerConfig,\n CustomRoutingConfig,\n EditorConfig,\n InternationalizationConfig,\n IntlayerConfig,\n LogConfig,\n LogFunctions,\n RoutingConfig,\n} from '@intlayer/types/config';\nimport {\n ANALYTICS_ENABLED,\n ANALYTICS_FLUSH_INTERVAL,\n ANALYTICS_SAMPLE_RATE,\n} from '../defaultValues/analytics';\nimport {\n APPLICATION_URL,\n BACKEND_URL,\n CMS_URL,\n DICTIONARY_PRIORITY_STRATEGY,\n EDITOR_URL,\n IS_ENABLED,\n LIVE_SYNC,\n LIVE_SYNC_PORT,\n PORT,\n} from '../defaultValues/editor';\nimport {\n DEFAULT_LOCALE,\n LOCALES,\n REQUIRED_LOCALES,\n STRICT_MODE,\n} from '../defaultValues/internationalization';\nimport { MODE, PREFIX } from '../defaultValues/log';\nimport {\n BASE_PATH,\n ENABLE_PROXY,\n ROUTING_MODE,\n STORAGE,\n} from '../defaultValues/routing';\nimport { getStorageAttributes } from '../utils/getStorageAttributes';\n\n// ---------------------------------------------------------------------------\n// Type\n// ---------------------------------------------------------------------------\n\n/**\n * Browser-safe subset of {@link IntlayerConfig}.\n *\n * Excludes server-only fields (`system`, `content`, `build`, `compiler`,\n * `dictionary`, `ai`) and sensitive editor credentials (`clientId`,\n * `clientSecret`) that must never be shipped to the browser.\n */\nexport type BrowserIntlayerConfig = {\n internationalization: Pick<\n InternationalizationConfig,\n 'locales' | 'defaultLocale'\n >;\n routing: RoutingConfig;\n editor: Omit<EditorConfig, 'clientId' | 'clientSecret'>;\n analytics: AnalyticsConfig;\n log: Pick<LogConfig, 'mode' | 'prefix'>;\n};\n\ndeclare global {\n interface Window {\n /** Browser-safe Intlayer configuration injected by a build plugin or `installIntlayer`. */\n INTLAYER_CONFIG?: BrowserIntlayerConfig;\n }\n}\n\n// ---------------------------------------------------------------------------\n// Shared field builders (browser-safe — no Node.js APIs)\n//\n// These functions are re-used by both `buildBrowserConfiguration` (browser)\n// and `buildConfigurationFields` (server) to avoid duplication.\n// ---------------------------------------------------------------------------\n\n/**\n * Build the internationalization section of the Intlayer configuration.\n *\n * @param customConfiguration - Partial user-supplied internationalization config.\n * @returns A fully-defaulted {@link InternationalizationConfig}.\n */\nexport const buildInternationalizationFields = (\n customConfiguration?: Partial<InternationalizationConfig>\n): InternationalizationConfig => ({\n /**\n * Locales available in the application\n *\n * Default: ['en']\n *\n */\n locales: customConfiguration?.locales ?? LOCALES,\n\n /**\n * Locales required by TypeScript to ensure strong implementations of internationalized content using typescript.\n *\n * Default: []\n *\n * If empty, all locales are required in `strict` mode.\n *\n * Ensure required locales are also defined in the `locales` field.\n */\n requiredLocales:\n customConfiguration?.requiredLocales ??\n customConfiguration?.locales ??\n REQUIRED_LOCALES,\n\n /**\n * Ensure strong implementations of internationalized content using typescript.\n * - If set to \"strict\", the translation `t` function will require each declared locales to be defined. If one locale is missing, or if a locale is not declared in your config, it will throw an error.\n * - If set to \"inclusive\", the translation `t` function will require each declared locales to be defined. If one locale is missing, it will throw a warning. But will accept if a locale is not declared in your config, but exist.\n * - If set to \"loose\", the translation `t` function will accept any existing locale.\n *\n * Default: \"inclusive\"\n */\n strictMode: customConfiguration?.strictMode ?? STRICT_MODE,\n\n /**\n * Default locale of the application for fallback\n *\n * Default: 'en'\n */\n defaultLocale: customConfiguration?.defaultLocale ?? DEFAULT_LOCALE,\n});\n\n/**\n * Build the routing section of the Intlayer configuration.\n *\n * @param customConfiguration - Partial user-supplied routing config.\n * @returns A fully-defaulted {@link RoutingConfig}.\n */\nexport const buildRoutingFields = (\n customConfiguration?: Partial<CustomRoutingConfig>\n): RoutingConfig => {\n const storage = customConfiguration?.storage ?? STORAGE;\n\n return {\n /**\n * URL routing mode for locale handling\n *\n * Controls how locales are represented in application URLs:\n * - 'prefix-no-default': Prefix all locales except the default locale (default)\n * - en → /dashboard\n * - fr → /fr/dashboard\n *\n * - 'prefix-all': Prefix all locales including the default locale\n * - en → /en/dashboard\n * - fr → /fr/dashboard\n *\n * - 'search-params': Use search parameters for locale handling\n * - en → /dashboard?locale=en\n * - fr → /fr/dashboard?locale=fr\n *\n * - 'no-prefix': No locale prefixing in URLs\n * - en → /dashboard\n * - fr → /dashboard\n *\n * Default: 'prefix-no-default'\n */\n mode: customConfiguration?.mode ?? ROUTING_MODE,\n\n /**\n * Enables the Intlayer locale-routing proxy (middleware).\n *\n * When enabled, the build-tool integration (e.g. the `intlayer()` Vite plugin)\n * automatically wires the locale-detection / redirect / rewrite middleware in\n * development, preview, and production SSR.\n *\n * Default: true\n */\n enableProxy: customConfiguration?.enableProxy ?? ENABLE_PROXY,\n\n /**\n * Configuration for storing the locale in the client (localStorage or sessionStorage)\n *\n * If false, the locale will not be stored by the middleware.\n * If true, the locale storage will consider all default values. (cookie and header)\n *\n * Default: ['cookie', 'header']\n *\n */\n storage: getStorageAttributes(storage),\n\n /**\n * Base path of the application URL\n *\n * Default: ''\n *\n * Example:\n * - If the application is hosted at https://example.com/my-app\n * - The base path is '/my-app'\n * - The URL will be https://example.com/my-app/en\n * - If the base path is not set, the URL will be https://example.com/en\n */\n basePath: customConfiguration?.basePath ?? BASE_PATH,\n\n /**\n * Custom URL rewriting rules that override the default routing mode for specific paths.\n * Allows you to define locale-specific paths that differ from the standard routing behavior.\n * Supports dynamic route parameters using `[param]` syntax.\n *\n * Default: undefined\n *\n * Example:\n * ```typescript\n * rewrite: {\n * \"/about\": {\n * en: \"/about\",\n * fr: \"/a-propos\",\n * },\n * \"/product/[slug]\": {\n * en: \"/product/[slug]\",\n * fr: \"/produit/[slug]\",\n * },\n * }\n * ```\n *\n * Note:\n * - The rewrite rules take precedence over the default `mode` behavior.\n * - If a path matches a rewrite rule, the localized path from the rewrite configuration will be used.\n * - Dynamic route parameters are supported using bracket notation (e.g., `[slug]`, `[id]`).\n * - Works with both Next.js and Vite applications.\n */\n rewrite: customConfiguration?.rewrite,\n\n /**\n * Maps locales to specific domain hostnames for domain-based routing.\n *\n * Default: undefined\n */\n domains: customConfiguration?.domains,\n };\n};\n\n/**\n * Build the editor section of the Intlayer configuration.\n *\n * Returns the **full** {@link EditorConfig} including sensitive fields\n * (`clientId`, `clientSecret`). The browser-safe {@link BrowserIntlayerConfig}\n * omits those fields when exposing config to the client.\n *\n * When the user does not explicitly set `clientId` / `clientSecret` in the\n * configuration file, they fall back to the `INTLAYER_CLIENT_ID` /\n * `INTLAYER_CLIENT_SECRET` environment variables read from `env`. This lets\n * users authenticate purely through their `.env` file (including files passed\n * via the CLI `--env-file` flag) without having to wire `process.env` into the\n * configuration manually.\n *\n * @param customConfiguration - Partial user-supplied editor config.\n * @param env - Environment variables used to resolve credential fallbacks.\n * Defaults to `process.env`.\n * @returns A fully-defaulted {@link EditorConfig}.\n */\nexport const buildEditorFields = (\n customConfiguration?: Partial<EditorConfig>,\n env: NodeJS.ProcessEnv = process.env\n): EditorConfig => {\n const liveSyncPort = customConfiguration?.liveSyncPort ?? LIVE_SYNC_PORT;\n return {\n /**\n * URL of the application. Used to restrict the origin of the editor for security reasons.\n *\n * > '*' means that the editor is accessible from any origin\n *\n * Default: '*'\n */\n applicationURL: customConfiguration?.applicationURL || APPLICATION_URL,\n\n /**\n * URL of the editor server. Used to restrict the origin of the editor for security reasons.\n *\n * > '*' means that the editor is accessible from any origin\n *\n * Default: '*'\n */\n editorURL: customConfiguration?.editorURL || EDITOR_URL,\n\n /**\n * URL of the CMS server. Used to restrict the origin of the editor for security reasons.\n */\n cmsURL: customConfiguration?.cmsURL || CMS_URL,\n\n /**\n * URL of the editor server\n *\n * Default: 'https://back.intlayer.org'\n */\n backendURL: customConfiguration?.backendURL || BACKEND_URL,\n\n /** Port of the editor server\n *\n * Default: 8000\n */\n port: customConfiguration?.port ?? PORT,\n\n /**\n * Indicates if the application interact with the visual editor\n *\n * Default: false;\n *\n * If true, the editor will be able to interact with the application.\n * If false, the editor will not be able to interact with the application.\n * In any case, the editor can only be enabled by the visual editor.\n * Disabling the editor for specific environments is a way to enforce the security.\n *\n * Usage:\n * ```js\n * {\n * // Other configurations\n * editor: {\n * enabled: process.env.NODE_ENV !== 'production',\n * }\n * };\n * ```\n */\n enabled: customConfiguration?.enabled ?? IS_ENABLED,\n\n /**\n * clientId and clientSecret allow the intlayer packages to authenticate with the backend using oAuth2 authentication.\n * An access token is use to authenticate the user related to the project.\n * To get an access token, go to https://app.intlayer.org/project and create an account.\n *\n * Default: undefined\n *\n * > Important: The clientId and clientSecret should be kept secret and not shared publicly. Please ensure to keep them in a secure location, such as environment variables.\n */\n clientId: customConfiguration?.clientId ?? env.INTLAYER_CLIENT_ID,\n\n /**\n * clientId and clientSecret allow the intlayer packages to authenticate with the backend using oAuth2 authentication.\n * An access token is use to authenticate the user related to the project.\n * To get an access token, go to https://app.intlayer.org/project and create an account.\n *\n * Default: undefined\n *\n * > Important: The clientId and clientSecret should be kept secret and not shared publicly. Please ensure to keep them in a secure location, such as environment variables.\n */\n clientSecret:\n customConfiguration?.clientSecret ?? env.INTLAYER_CLIENT_SECRET,\n\n /**\n * Strategy for prioritizing dictionaries. If a dictionary is both present online and locally, the content will be merge.\n * However, is a field is defined in both dictionary, this setting determines which fields takes the priority over the other.\n *\n * Default: 'local_first'\n *\n * The strategy for prioritizing dictionaries. It can be either 'local_first' or 'distant_first'.\n * - 'local_first': The first dictionary found in the locale is used.\n * - 'distant_first': The first dictionary found in the distant locales is used.\n */\n dictionaryPriorityStrategy:\n customConfiguration?.dictionaryPriorityStrategy ??\n DICTIONARY_PRIORITY_STRATEGY,\n\n /**\n * Indicates if the application should hot reload the locale configurations when a change is detected.\n * For example, when a new dictionary is added or updated, the application will update the content tu display in the page.\n *\n * The hot reload is only available for clients of the `enterprise` plan.\n *\n * Default: false\n */\n liveSync: customConfiguration?.liveSync ?? LIVE_SYNC,\n\n /**\n * Port of the live sync server\n *\n * Default: 4000\n */\n liveSyncPort,\n\n /**\n * URL of the live sync server in case of remote live sync server\n *\n * Default: `http://localhost:${LIVE_SYNC_PORT}`\n */\n liveSyncURL:\n customConfiguration?.liveSyncURL ?? `http://localhost:${liveSyncPort}`,\n };\n};\n\n/**\n * Build the analytics section of the Intlayer configuration.\n *\n * Analytics is strictly opt-in: `enabled` defaults to `false` and, even when\n * enabled, the runtime additionally requires a project key (`editor.clientId`)\n * for attribution before collecting anything.\n *\n * @param customConfiguration - Partial user-supplied analytics config.\n * @returns A fully-defaulted {@link AnalyticsConfig}.\n */\nexport const buildAnalyticsFields = (\n customConfiguration?: Partial<AnalyticsConfig>\n): AnalyticsConfig => ({\n /**\n * Enables analytics collection (page views, content exposures, A/B events).\n *\n * Default: false\n */\n enabled: customConfiguration?.enabled ?? ANALYTICS_ENABLED,\n\n /**\n * Milliseconds between automatic batched flushes to the backend.\n *\n * Default: 20000\n */\n flushInterval: customConfiguration?.flushInterval ?? ANALYTICS_FLUSH_INTERVAL,\n\n /**\n * Fraction of sessions to record, from 0 (none) to 1 (all).\n *\n * Default: 1\n */\n sampleRate: customConfiguration?.sampleRate ?? ANALYTICS_SAMPLE_RATE,\n});\n\n/**\n * Build the log section of the Intlayer configuration.\n *\n * @param customConfiguration - Partial user-supplied log config.\n * @param logFunctions - Optional custom log function overrides (server-only).\n * @returns A fully-defaulted {@link LogConfig}.\n */\nexport const buildLogFields = (\n customConfiguration?: Partial<LogConfig>,\n logFunctions?: LogFunctions\n): LogConfig => ({\n /**\n * Indicates if the logger is enabled\n *\n * Default: 'prefix-no-default'\n *\n * If 'default', the logger is enabled and can be used.\n * If 'verbose', the logger will be enabled and can be used, but will log more information.\n * If 'disabled', the logger is disabled and cannot be used.\n */\n mode: customConfiguration?.mode ?? MODE,\n\n /**\n * Prefix of the logger\n *\n * Default: '[intlayer]'\n *\n * The prefix of the logger.\n */\n prefix: customConfiguration?.prefix ?? PREFIX,\n\n /**\n * Functions to log\n */\n error: logFunctions?.error,\n log: logFunctions?.log,\n info: logFunctions?.info,\n warn: logFunctions?.warn,\n});\n\n// ---------------------------------------------------------------------------\n// Browser configuration builders\n// ---------------------------------------------------------------------------\n\n/**\n * Build a browser-safe {@link BrowserIntlayerConfig} from a raw user config.\n *\n * Applies defaults for every field and strips all server-only or sensitive\n * information (`system`, `content`, `build`, `compiler`, `dictionary`, `ai`,\n * `editor.clientId`, `editor.clientSecret`).\n *\n * This is the browser counterpart of `buildConfigurationFields`. It is safe\n * to call in browser environments because it has no Node.js dependencies.\n *\n * @param customConfig - Optional partial user-supplied Intlayer config.\n * @returns A browser-safe configuration object ready for `window.INTLAYER_CONFIG`.\n *\n * @example\n * ```ts\n * import { buildBrowserConfiguration } from '@intlayer/config/client';\n *\n * window.INTLAYER_CONFIG = buildBrowserConfiguration({\n * internationalization: { locales: ['en', 'fr'], defaultLocale: 'en' },\n * });\n * ```\n */\nexport const buildBrowserConfiguration = (\n customConfig?: CustomIntlayerConfig\n): BrowserIntlayerConfig => {\n const { locales, defaultLocale } = buildInternationalizationFields(\n customConfig?.internationalization\n );\n const routing = buildRoutingFields(customConfig?.routing);\n const {\n clientId: _clientId,\n clientSecret: _clientSecret,\n ...editorPublic\n } = buildEditorFields(customConfig?.editor);\n const analytics = buildAnalyticsFields(customConfig?.analytics);\n const { mode, prefix } = buildLogFields(customConfig?.log);\n\n return {\n internationalization: { locales, defaultLocale },\n routing,\n editor: editorPublic,\n analytics,\n log: { mode, prefix },\n };\n};\n\n/**\n * Extract a {@link BrowserIntlayerConfig} from an already-built full\n * {@link IntlayerConfig}.\n *\n * Used by build plugins (`vite-intlayer`, `withIntlayer`) which already hold\n * the full server-side config and need to inject the browser-safe subset at\n * compile time via a bundler `define`.\n *\n * @param config - A fully-built server-side Intlayer configuration.\n * @returns The browser-safe subset of that configuration.\n */\nexport const extractBrowserConfiguration = (\n config: IntlayerConfig\n): BrowserIntlayerConfig => ({\n internationalization: {\n locales: config.internationalization.locales,\n defaultLocale: config.internationalization.defaultLocale,\n },\n routing: {\n mode: config.routing.mode,\n enableProxy: config.routing.enableProxy,\n storage: config.routing.storage,\n basePath: config.routing.basePath,\n rewrite: config.routing.rewrite,\n },\n editor: {\n applicationURL: config.editor.applicationURL,\n editorURL: config.editor.editorURL,\n cmsURL: config.editor.cmsURL,\n backendURL: config.editor.backendURL,\n port: config.editor.port,\n enabled: config.editor.enabled,\n dictionaryPriorityStrategy: config.editor.dictionaryPriorityStrategy,\n liveSync: config.editor.liveSync,\n liveSyncPort: config.editor.liveSyncPort,\n liveSyncURL: config.editor.liveSyncURL,\n },\n analytics: buildAnalyticsFields(config.analytics),\n log: {\n mode: config.log.mode,\n prefix: config.log.prefix,\n },\n});\n"],"mappings":";;;;;;;;;;;;;;;AAoFA,MAAa,mCACX,yBACgC;;;;;;;CAOhC,SAAS,qBAAqB,WAAWA;;;;;;;;;;CAWzC,iBACE,qBAAqB,mBACrB,qBAAqB,WACrBC;;;;;;;;;CAUF,YAAY,qBAAqB;;;;;;CAOjC,eAAe,qBAAqB;AACtC;;;;;;;AAQA,MAAa,sBACX,wBACkB;CAClB,MAAM,UAAU,qBAAqB,WAAWC;CAEhD,OAAO;;;;;;;;;;;;;;;;;;;;;;;EAuBL,MAAM,qBAAqB;;;;;;;;;;EAW3B,aAAa,qBAAqB;;;;;;;;;;EAWlC,SAASC,wDAAqB,OAAO;;;;;;;;;;;;EAarC,UAAU,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA6B/B,SAAS,qBAAqB;;;;;;EAO9B,SAAS,qBAAqB;CAChC;AAC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;EAAO;CACtB;AACF;;;;;;;;;;;;AAaA,MAAa,+BACX,YAC2B;CAC3B,sBAAsB;EACpB,SAAS,OAAO,qBAAqB;EACrC,eAAe,OAAO,qBAAqB;CAC7C;CACA,SAAS;EACP,MAAM,OAAO,QAAQ;EACrB,aAAa,OAAO,QAAQ;EAC5B,SAAS,OAAO,QAAQ;EACxB,UAAU,OAAO,QAAQ;EACzB,SAAS,OAAO,QAAQ;CAC1B;CACA,QAAQ;EACN,gBAAgB,OAAO,OAAO;EAC9B,WAAW,OAAO,OAAO;EACzB,QAAQ,OAAO,OAAO;EACtB,YAAY,OAAO,OAAO;EAC1B,MAAM,OAAO,OAAO;EACpB,SAAS,OAAO,OAAO;EACvB,4BAA4B,OAAO,OAAO;EAC1C,UAAU,OAAO,OAAO;EACxB,cAAc,OAAO,OAAO;EAC5B,aAAa,OAAO,OAAO;CAC7B;CACA,WAAW,qBAAqB,OAAO,SAAS;CAChD,KAAK;EACH,MAAM,OAAO,IAAI;EACjB,QAAQ,OAAO,IAAI;CACrB;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
  const require_defaultValues_build = require('../defaultValues/build.cjs');
4
3
  const require_defaultValues_compiler = require('../defaultValues/compiler.cjs');
5
4
  const require_defaultValues_content = require('../defaultValues/content.cjs');
@@ -1 +1 @@
1
- {"version":3,"file":"buildConfigurationFields.cjs","names":["getProjectRequire","FILE_EXTENSIONS","CONTENT_DIR","CODE_DIR","EXCLUDED_PATHS","TRAVERSE_PATTERN","OUTPUT_FORMAT","intlayerConfigSchema","buildBrowserConfiguration","buildInternationalizationFields","buildEditorFields","buildLogFields","buildAnalyticsFields"],"sources":["../../../src/configFile/buildConfigurationFields.ts"],"sourcesContent":["import { statSync } from 'node:fs';\nimport { dirname, isAbsolute, join } from 'node:path';\nimport type {\n AiConfig,\n BuildConfig,\n CompilerConfig,\n ContentConfig,\n CustomIntlayerConfig,\n DictionaryConfig,\n IntlayerConfig,\n LogFunctions,\n SystemConfig,\n} from '@intlayer/types/config';\nimport {\n BUILD_MODE,\n CACHE,\n MINIFY,\n OUTPUT_FORMAT,\n PURGE,\n TRAVERSE_PATTERN,\n TYPE_CHECKING,\n} from '../defaultValues/build';\nimport {\n COMPILER_DICTIONARY_KEY_PREFIX,\n COMPILER_ENABLED,\n COMPILER_NO_METADATA,\n COMPILER_SAVE_COMPONENTS,\n} from '../defaultValues/compiler';\nimport {\n CODE_DIR,\n CONTENT_DIR,\n EXCLUDED_PATHS,\n FILE_EXTENSIONS,\n WATCH,\n} from '../defaultValues/content';\nimport {\n CONTENT_AUTO_TRANSFORMATION,\n FILL,\n IMPORT_MODE,\n LOCATION,\n} from '../defaultValues/dictionary';\nimport {\n CACHE_DIR,\n CONFIG_DIR,\n DICTIONARIES_DIR,\n DYNAMIC_DICTIONARIES_DIR,\n FETCH_DICTIONARIES_DIR,\n MAIN_DIR,\n MODULE_AUGMENTATION_DIR,\n REMOTE_DICTIONARIES_DIR,\n TEMP_DIR,\n TYPES_DIR,\n UNMERGED_DICTIONARIES_DIR,\n} from '../defaultValues/system';\nimport { getProjectRequire } from '../utils';\nimport {\n buildAnalyticsFields,\n buildBrowserConfiguration,\n buildEditorFields,\n buildInternationalizationFields,\n buildLogFields,\n} from './buildBrowserConfiguration';\nimport { intlayerConfigSchema } from './configurationSchema';\n\nexport {\n type BrowserIntlayerConfig,\n buildAnalyticsFields,\n buildBrowserConfiguration,\n buildEditorFields,\n buildInternationalizationFields,\n buildLogFields,\n buildRoutingFields,\n extractBrowserConfiguration,\n} from './buildBrowserConfiguration';\n\nlet storedConfiguration: IntlayerConfig;\n\n// ---------------------------------------------------------------------------\n// Server-only field builders (Node.js — not browser-safe)\n// ---------------------------------------------------------------------------\n\n/**\n * Build the `system` section of the Intlayer configuration.\n *\n * Resolves all directory paths (dictionaries, types, cache, …) relative to\n * the project base directory, using Node.js `require.resolve` where available\n * and falling back to `path.join` otherwise.\n *\n * @param baseDir - Project root directory. Defaults to `process.cwd()`.\n * @param customConfiguration - Partial user-supplied system config.\n * @returns A fully-resolved {@link SystemConfig}.\n */\nconst buildSystemFields = (\n baseDir?: string,\n customConfiguration?: Partial<SystemConfig>\n): SystemConfig => {\n const projectBaseDir = baseDir ?? process.cwd();\n\n const optionalJoinBaseDir = (pathInput: string) => {\n let absolutePath: string;\n\n try {\n const requireFunction = getProjectRequire(projectBaseDir);\n try {\n absolutePath = requireFunction.resolve(pathInput, {\n paths: [projectBaseDir],\n });\n } catch (err) {\n if (!pathInput.startsWith('.') && !isAbsolute(pathInput)) {\n absolutePath = requireFunction.resolve(`${pathInput}/package.json`, {\n paths: [projectBaseDir],\n });\n } else {\n throw err;\n }\n }\n } catch {\n absolutePath = isAbsolute(pathInput)\n ? pathInput\n : join(projectBaseDir, pathInput);\n }\n\n try {\n const stats = statSync(absolutePath);\n if (stats.isFile()) {\n return dirname(absolutePath);\n }\n } catch {\n if (/\\.[a-z0-9]+$/i.test(absolutePath)) {\n return dirname(absolutePath);\n }\n }\n\n return absolutePath;\n };\n\n const dictionariesDir = optionalJoinBaseDir(\n customConfiguration?.dictionariesDir ?? DICTIONARIES_DIR\n );\n\n return {\n baseDir: projectBaseDir,\n moduleAugmentationDir: optionalJoinBaseDir(\n customConfiguration?.moduleAugmentationDir ?? MODULE_AUGMENTATION_DIR\n ),\n unmergedDictionariesDir: optionalJoinBaseDir(\n customConfiguration?.unmergedDictionariesDir ?? UNMERGED_DICTIONARIES_DIR\n ),\n remoteDictionariesDir: optionalJoinBaseDir(\n customConfiguration?.remoteDictionariesDir ?? REMOTE_DICTIONARIES_DIR\n ),\n dictionariesDir,\n dynamicDictionariesDir: optionalJoinBaseDir(\n customConfiguration?.dynamicDictionariesDir ?? DYNAMIC_DICTIONARIES_DIR\n ),\n fetchDictionariesDir: optionalJoinBaseDir(\n customConfiguration?.fetchDictionariesDir ?? FETCH_DICTIONARIES_DIR\n ),\n typesDir: optionalJoinBaseDir(customConfiguration?.typesDir ?? TYPES_DIR),\n mainDir: optionalJoinBaseDir(customConfiguration?.mainDir ?? MAIN_DIR),\n configDir: optionalJoinBaseDir(\n customConfiguration?.configDir ?? CONFIG_DIR\n ),\n cacheDir: optionalJoinBaseDir(customConfiguration?.cacheDir ?? CACHE_DIR),\n tempDir: optionalJoinBaseDir(customConfiguration?.tempDir ?? TEMP_DIR),\n };\n};\n\n/**\n * Build the `content` section of the Intlayer configuration.\n *\n * Resolves content and code directories relative to the project base using\n * `require.resolve`, falling back to `path.join`.\n *\n * @param systemConfig - Already-built system configuration (provides `baseDir`).\n * @param customConfiguration - Partial user-supplied content config.\n * @returns A fully-resolved {@link ContentConfig}.\n */\nconst buildContentFields = (\n systemConfig: SystemConfig,\n customConfiguration?: Partial<ContentConfig>\n): ContentConfig => {\n const fileExtensions = customConfiguration?.fileExtensions ?? FILE_EXTENSIONS;\n\n const optionalJoinBaseDir = (pathInput: string) => {\n let absolutePath: string;\n\n try {\n const requireFunction = getProjectRequire(systemConfig.baseDir);\n try {\n absolutePath = requireFunction.resolve(pathInput, {\n paths: [systemConfig.baseDir],\n });\n } catch (err) {\n if (!pathInput.startsWith('.') && !isAbsolute(pathInput)) {\n absolutePath = requireFunction.resolve(`${pathInput}/package.json`, {\n paths: [systemConfig.baseDir],\n });\n } else {\n throw err;\n }\n }\n } catch {\n try {\n try {\n absolutePath = require.resolve(pathInput, {\n paths: [systemConfig.baseDir],\n });\n } catch (err) {\n if (!pathInput.startsWith('.') && !isAbsolute(pathInput)) {\n absolutePath = require.resolve(`${pathInput}/package.json`, {\n paths: [systemConfig.baseDir],\n });\n } else {\n throw err;\n }\n }\n } catch {\n absolutePath = isAbsolute(pathInput)\n ? pathInput\n : join(systemConfig.baseDir, pathInput);\n }\n }\n\n try {\n const stats = statSync(absolutePath);\n if (stats.isFile()) {\n return dirname(absolutePath);\n }\n } catch {\n if (/\\.[a-z0-9]+$/i.test(absolutePath)) {\n return dirname(absolutePath);\n }\n }\n\n return absolutePath;\n };\n\n const contentDir = (customConfiguration?.contentDir ?? CONTENT_DIR).map(\n optionalJoinBaseDir\n );\n const codeDir = (customConfiguration?.codeDir ?? CODE_DIR).map(\n optionalJoinBaseDir\n );\n\n return {\n fileExtensions,\n contentDir,\n codeDir,\n excludedPath: customConfiguration?.excludedPath ?? EXCLUDED_PATHS,\n watch: customConfiguration?.watch ?? WATCH,\n formatCommand: customConfiguration?.formatCommand,\n };\n};\n\n/**\n * Build the `ai` section of the Intlayer configuration.\n *\n * @param customConfiguration - Partial user-supplied AI config.\n * @returns A fully-defaulted {@link AiConfig}.\n */\nconst buildAiFields = (customConfiguration?: Partial<AiConfig>): AiConfig => ({\n /**\n * AI configuration\n */\n provider: customConfiguration?.provider,\n\n /**\n * API key\n */\n apiKey: customConfiguration?.apiKey,\n\n /**\n * API model\n */\n model: customConfiguration?.model,\n\n /**\n * Temperature\n */\n temperature: customConfiguration?.temperature,\n\n /**\n * Application context\n *\n * Default: undefined\n *\n * The application context.\n *\n * Example: `'My application context'`\n *\n * Note: Can be used to provide additional context about the application to the AI model. You can add more rules (e.g. \"You should not transform urls\").\n */\n applicationContext: customConfiguration?.applicationContext,\n\n /**\n * Base URL for the AI API\n *\n * Default: undefined\n *\n * The base URL for the AI API.\n *\n * Example: `'http://localhost:5000'`\n *\n * Note: Can be used to point to a local, or custom AI API endpoint.\n */\n baseURL: customConfiguration?.baseURL,\n\n /**\n * Data serialization\n *\n * Options:\n * - \"json\": The industry standard. Highly reliable and structured, but consumes more tokens.\n * - \"toon\": An optimized format designed to reduce token consumption (cost-effective). However, it may slightly increase the risk of output inconsistency compared to standard JSON\n *\n * Default: `\"json\"`\n */\n dataSerialization: customConfiguration?.dataSerialization,\n});\n\n/**\n * Build the `build` section of the Intlayer configuration.\n *\n * @param customConfiguration - Partial user-supplied build config.\n * @returns A fully-defaulted {@link BuildConfig}.\n */\nconst buildBuildFields = (\n customConfiguration?: Partial<BuildConfig>\n): BuildConfig => ({\n /**\n * Indicates the mode of the build\n *\n * Default: 'auto'\n *\n * If 'auto', the build will be enabled automatically when the application is built.\n * If 'manual', the build will be set only when the build command is executed.\n *\n * Can be used to disable dictionaries build, for instance when execution on Node.js environment should be avoided.\n */\n mode: customConfiguration?.mode ?? BUILD_MODE,\n\n /**\n * Indicates if the build should be optimized\n *\n * Default: process.env.NODE_ENV === 'production'\n *\n * If true, the build will be optimized.\n * If false, the build will not be optimized.\n *\n * Intlayer will replace all calls of dictionaries to optimize chunking. That way the final bundle will import only the dictionaries that are used.\n * All imports will stay as static import to avoid async processing when loading the dictionaries.\n *\n * Note:\n * - Intlayer will replace all call of `useIntlayer` with the defined mode by the `importMode` option.\n * - Intlayer will replace all call of `getIntlayer` with `getDictionary`.\n * - This option relies on the `@intlayer/babel` and `@intlayer/swc` plugins.\n * - In most cases, \"dynamic\" will be used for React applications, \"async\" for Vue.js applications.\n * - Ensure all keys are declared statically in the `useIntlayer` calls. e.g. `useIntlayer('navbar')`.\n */\n optimize: customConfiguration?.optimize,\n\n /**\n * Indicates the mode of import to use for the dictionaries.\n *\n * Available modes:\n * - \"static\": The dictionaries are imported statically.\n * In that case, Intlayer will replace all calls to `useIntlayer` with `useDictionary`.\n * - \"dynamic\": The dictionaries are imported dynamically in a synchronous component using the suspense API.\n * In that case, Intlayer will replace all calls to `useIntlayer` with `useDictionaryDynamic`.\n * - \"live\": The dictionaries are imported dynamically using the live sync API.\n * In that case, Intlayer will replace all calls to `useIntlayer` with `useDictionaryDynamic`.\n * Live mode will use the live sync API to fetch the dictionaries. If the API call fails, the dictionaries will be imported dynamically as \"dynamic\" mode.\n *\n * Default: \"static\"\n *\n * By default, when a dictionary is loaded, it imports content for all locales as it's imported statically.\n *\n * Note:\n * - Dynamic imports rely on Suspense and may slightly impact rendering performance.\n * - If disabled all locales will be loaded at once, even if they are not used.\n * - This option relies on the `@intlayer/babel` and `@intlayer/swc` plugins.\n * - Ensure all keys are declared statically in the `useIntlayer` calls. e.g. `useIntlayer('navbar')`.\n * - This option will be ignored if `optimize` is disabled.\n * - This option will not impact the `getIntlayer`, `getDictionary`, `useDictionary`, `useDictionaryAsync` and `useDictionaryDynamic` functions. You can still use them to refine you code on manual optimization.\n * - The \"live\" allows to sync the dictionaries to the live sync server.\n *\n * @deprecated Use `dictionary.importMode` instead.\n */\n importMode: customConfiguration?.importMode,\n\n /**\n * Minify the dictionaries to reduce the bundle size.\n *\n * Default: false\n *\n * Note:\n * - This option will be ignored if `optimize` is disabled.\n * - This option will be ignore if `editor.enabled` is true.\n * - If there is edge cases where the minification is not working properly, the dictionary will be not minified.\n */\n minify: customConfiguration?.minify ?? MINIFY,\n\n /**\n * Purge the unused keys in a dictionaries\n *\n * Default: false\n *\n * Note:\n * - This option will be ignored if `optimize` is disabled.\n * - This option will be ignored if `editor.enabled` is true.\n */\n purge: customConfiguration?.purge ?? PURGE,\n\n /**\n * Pattern to traverse the code to optimize.\n *\n * Allows to avoid to traverse the code that is not relevant to the optimization.\n * Improve build performance.\n *\n * Default: ['**\\/*.{js,ts,mjs,cjs,jsx,tsx}', '!**\\/node_modules/**']\n *\n * Example: `['src/**\\/*.{ts,tsx}', '../ui-library/**\\/*.{ts,tsx}']`\n *\n * Note:\n * - This option will be ignored if `optimize` is disabled.\n * - Use glob pattern.\n */\n traversePattern: customConfiguration?.traversePattern ?? TRAVERSE_PATTERN,\n\n /**\n * Output format of the dictionaries\n *\n * Can be set on large projects to improve build performance.\n *\n * Default: ['cjs', 'esm']\n *\n * The output format of the dictionaries. It can be either 'cjs' or 'esm'.\n * - 'cjs': The dictionaries are outputted as CommonJS modules.\n * - 'esm': The dictionaries are outputted as ES modules.\n */\n outputFormat: customConfiguration?.outputFormat ?? OUTPUT_FORMAT,\n\n /**\n * Cache\n */\n cache: customConfiguration?.cache ?? CACHE,\n\n /**\n * Require function\n */\n require: customConfiguration?.require,\n\n /**\n * Indicates if the build should check TypeScript types\n *\n * Default: `false`\n *\n * If true, the build will check TypeScript types and log errors.\n * Note: This can slow down the build.\n */\n checkTypes: customConfiguration?.checkTypes ?? TYPE_CHECKING,\n});\n\n/**\n * Build the `compiler` section of the Intlayer configuration.\n *\n * @param customConfiguration - Partial user-supplied compiler config.\n * @returns A fully-defaulted {@link CompilerConfig}.\n */\nconst buildCompilerFields = (\n customConfiguration?: Partial<CompilerConfig>\n): CompilerConfig => ({\n /**\n * Indicates if the compiler should be enabled\n */\n enabled: customConfiguration?.enabled ?? COMPILER_ENABLED,\n\n /**\n * Prefix for the extracted dictionary keys\n */\n dictionaryKeyPrefix:\n customConfiguration?.dictionaryKeyPrefix ?? COMPILER_DICTIONARY_KEY_PREFIX,\n\n /**\n * Pattern to traverse the code to optimize.\n *\n * @deprecated use `build.traversePattern` instead\n */\n transformPattern: customConfiguration?.transformPattern,\n\n /**\n * Pattern to exclude from the optimization.\n *\n * @deprecated use `build.traversePattern` instead\n */\n excludePattern: customConfiguration?.excludePattern,\n\n /**\n * Defines the output files path. Replaces `outputDir`.\n *\n * - `./` paths are resolved relative to the component directory.\n * - `/` paths are resolved relative to the project root (`baseDir`).\n *\n * - Including the `{{locale}}` variable in the path will trigger the generation of separate dictionaries per locale.\n *\n * @example:\n * ```ts\n * {\n * // Create Multilingual .content.ts files close to the component\n * output: ({ fileName, extension }) => `./${fileName}${extension}`,\n *\n * // output: './{{fileName}}{{extension}}', // Equivalent using template string\n * }\n * ```\n *\n * ```ts\n * {\n * // Create centralize per-locale JSON at the root of the project\n * output: ({ key, locale }) => `/locales/${locale}/${key}.content.json`,\n *\n * // output: '/locales/{{locale}}/{{key}}.content.json', // Equivalent using template string\n * }\n * ```\n *\n * ```ts\n * {\n * // Create per-locale JSON files with locale-specific output paths\n * output: {\n * en: ({ fileName, locale }) => `${fileName}.${locale}.content.json`,\n * fr: '{{fileName}}.{{locale}}.content.json',\n * es: false, // skip this locale\n * },\n * }\n * ```\n *\n * Variable list:\n * - `fileName`: The name of the file.\n * - `key`: The key of the content.\n * - `locale`: The locale of the content.\n * - `extension`: The extension of the file.\n * - `componentFileName`: The name of the component file.\n * - `componentExtension`: The extension of the component file.\n * - `format`: The format of the dictionary.\n * - `componentFormat`: The format of the component dictionary.\n * - `componentDirPath`: The directory path of the component.\n */\n output: customConfiguration?.output,\n\n /**\n * Indicates if the metadata should be saved in the file.\n *\n * If true, the compiler will not save the metadata of the dictionaries.\n *\n * If `true`:\n *\n * ```json\n * {\n * \"key\": \"value\"\n * }\n * ```\n *\n * If `false`:\n *\n * ```json\n * {\n * \"key\": \"value\",\n * \"content\": {\n * \"key\": \"value\"\n * }\n * }\n * ```\n *\n * Default: `false`\n *\n * Note: Useful if used with loadJSON plugin\n */\n noMetadata: customConfiguration?.noMetadata ?? COMPILER_NO_METADATA,\n\n /**\n * Indicates if the components should be saved after being transformed.\n */\n saveComponents:\n customConfiguration?.saveComponents ?? COMPILER_SAVE_COMPONENTS,\n});\n\n/**\n * Build the `dictionary` section of the Intlayer configuration.\n *\n * @param customConfiguration - Partial user-supplied dictionary config.\n * @returns A fully-defaulted {@link DictionaryConfig}.\n */\nconst buildDictionaryFields = (\n customConfiguration?: Partial<DictionaryConfig>\n): DictionaryConfig => {\n const contentAutoTransformation =\n customConfiguration?.contentAutoTransformation ??\n CONTENT_AUTO_TRANSFORMATION;\n\n return {\n /**\n * Indicate how the dictionary should be filled using AI.\n *\n * Default: `true`\n *\n * - If `true`, will consider the `compiler.output` field.\n * - If `false`, will skip the fill process.\n *\n * - `./` paths are resolved relative to the component directory.\n * - `/` paths are resolved relative to the project root (`baseDir`).\n *\n * - If includes `{{locale}}` variable in the path, will trigger the generation of separate dictionaries per locale.\n *\n * Example:\n * ```ts\n * {\n * // Create Multilingual .content.ts files close to the component\n * fill: ({ fileName, extension }) => `./${fileName}${extension}`,\n *\n * // fill: './{{fileName}}{{extension}}', // Equivalent using template string\n * }\n * ```\n *\n * ```ts\n * {\n * // Create centralize per-locale JSON at the root of the project\n * fill: ({ key, locale }) => `/locales/${locale}/${key}.content.json`,\n *\n * // fill: '/locales/{{locale}}/{{key}}.content.json', // Equivalent using template string\n * }\n * ```\n *\n * ```ts\n * {\n * // Create custom output based on the locale\n * fill: {\n * en: ({ key }) => `/locales/en/${key}.content.json`,\n * fr: '/locales/fr/{{key}}.content.json',\n * es: false,\n * de: true,\n * },\n * }\n * ```\n *\n *\n * Variable list:\n * - `fileName`: The name of the file.\n * - `key`: The key of the content.\n * - `locale`: The locale of the content.\n * - `extension`: The extension of the file.\n * - `componentFileName`: The name of the component file.\n * - `componentExtension`: The extension of the component file.\n * - `format`: The format of the dictionary.\n * - `componentFormat`: The format of the component dictionary.\n * - `componentDirPath`: The directory path of the component.\n */\n fill: customConfiguration?.fill ?? FILL,\n\n /**\n * Indicates if the content of the dictionary should be automatically transformed.\n *\n * Default: `false`\n */\n contentAutoTransformation:\n typeof contentAutoTransformation === 'object'\n ? {\n markdown: contentAutoTransformation.markdown ?? false,\n html: contentAutoTransformation.html ?? false,\n insertion: contentAutoTransformation.insertion ?? false,\n }\n : contentAutoTransformation,\n\n /**\n * The location of the dictionary.\n *\n * Default: `\"local\"`\n */\n location: customConfiguration?.location ?? LOCATION,\n\n /**\n * Transform the dictionary in a per-locale dictionary.\n * Each field declared in a per-locale dictionary will be transformed in a translation node.\n * If missing, the dictionary will be treated as a multilingual dictionary.\n */\n locale: customConfiguration?.locale,\n\n /**\n * The title of the dictionary.\n */\n title: customConfiguration?.title,\n\n /**\n * The description of the dictionary.\n */\n description: customConfiguration?.description,\n\n /**\n * Tags to categorize the dictionaries.\n */\n tags: customConfiguration?.tags,\n\n /**\n * The priority of the dictionary.\n */\n priority: customConfiguration?.priority,\n\n /**\n * Indicates the mode of import to use for the dictionary.\n *\n * Available modes:\n * - \"static\": The dictionaries are imported statically.\n * - \"dynamic\": The dictionaries are imported dynamically in a synchronous component using the suspense API.\n * - \"live\": The dictionaries are imported dynamically using the live sync API.\n *\n * Default: `\"static\"`\n */\n importMode: customConfiguration?.importMode ?? IMPORT_MODE,\n\n /**\n * The default message format for all dictionaries in the project.\n *\n * Default: 'intlayer'\n */\n format: customConfiguration?.format,\n };\n};\n\n// ---------------------------------------------------------------------------\n// Main export\n// ---------------------------------------------------------------------------\n\n/**\n * Build the complete Intlayer configuration by merging user-supplied values\n * with defaults.\n *\n * Internally this function:\n * 1. Calls {@link buildBrowserConfiguration} to produce the browser-safe\n * subset (internationalization, routing, editor public fields, log, metadata).\n * 2. Extends the result with full server-side fields:\n * - `internationalization` — adds `requiredLocales` and `strictMode`.\n * - `editor` — adds `clientId` and `clientSecret`.\n * - `log` — adds custom log functions.\n * - `system`, `content`, `ai`, `build`, `compiler`, `dictionary`.\n *\n * @param customConfiguration - Optional user-supplied configuration object.\n * @param baseDir - Project root directory. Defaults to `process.cwd()`.\n * @param logFunctions - Optional custom logging functions.\n * @param env - Environment variables used to resolve credential fallbacks\n * (e.g. `INTLAYER_CLIENT_ID` / `INTLAYER_CLIENT_SECRET`). Defaults to\n * `process.env`. Callers loading a custom env file (such as the CLI\n * `--env-file` flag) should pass the merged env so credentials defined there\n * are picked up without polluting `process.env`.\n * @returns A fully-built {@link IntlayerConfig}.\n */\nexport const buildConfigurationFields = (\n customConfiguration?: CustomIntlayerConfig,\n baseDir?: string,\n logFunctions?: LogFunctions,\n env: NodeJS.ProcessEnv = process.env\n): IntlayerConfig => {\n if (customConfiguration) {\n const result = intlayerConfigSchema.safeParse(customConfiguration);\n\n if (!result.success) {\n const logError = logFunctions?.error ?? console.error;\n\n for (const issue of result.error.issues) {\n logError(`${issue.path.join('.')}: ${issue.message}`);\n }\n }\n }\n\n // build browser-safe config (shared defaults, no Node.js deps)\n const browserConfig = buildBrowserConfiguration(customConfiguration);\n\n // extend shared fields with server-only additions\n const internationalizationConfig = buildInternationalizationFields(\n customConfiguration?.internationalization\n );\n\n const editorConfig = buildEditorFields(customConfiguration?.editor, env);\n\n const logConfig = buildLogFields(customConfiguration?.log, logFunctions);\n\n // build server-only fields\n const systemConfig = buildSystemFields(baseDir, customConfiguration?.system);\n\n const contentConfig = buildContentFields(\n systemConfig,\n customConfiguration?.content\n );\n\n storedConfiguration = {\n // Shared browser fields\n routing: browserConfig.routing,\n // Full (extended) shared fields\n internationalization: internationalizationConfig,\n editor: editorConfig,\n analytics: buildAnalyticsFields(customConfiguration?.analytics),\n log: logConfig,\n // Server-only fields\n system: systemConfig,\n content: contentConfig,\n ai: buildAiFields(customConfiguration?.ai),\n build: buildBuildFields(customConfiguration?.build),\n compiler: buildCompilerFields(customConfiguration?.compiler),\n dictionary: buildDictionaryFields(customConfiguration?.dictionary),\n plugins: customConfiguration?.plugins,\n schemas: customConfiguration?.schemas,\n } as IntlayerConfig;\n\n return storedConfiguration;\n};\n"],"mappings":";;;;;;;;;;;;;;AA2EA,IAAI;;;;;;;;;;;;AAiBJ,MAAM,qBACJ,SACA,wBACiB;CACjB,MAAM,iBAAiB,WAAW,QAAQ,KAAK;CAE/C,MAAM,uBAAuB,cAAsB;EACjD,IAAI;AAEJ,MAAI;GACF,MAAM,kBAAkBA,+CAAkB,eAAe;AACzD,OAAI;AACF,mBAAe,gBAAgB,QAAQ,WAAW,EAChD,OAAO,CAAC,eAAe,EACxB,CAAC;YACK,KAAK;AACZ,QAAI,CAAC,UAAU,WAAW,IAAI,IAAI,2BAAY,UAAU,CACtD,gBAAe,gBAAgB,QAAQ,GAAG,UAAU,gBAAgB,EAClE,OAAO,CAAC,eAAe,EACxB,CAAC;QAEF,OAAM;;UAGJ;AACN,4CAA0B,UAAU,GAChC,gCACK,gBAAgB,UAAU;;AAGrC,MAAI;AAEF,6BADuB,aACd,CAAC,QAAQ,CAChB,+BAAe,aAAa;UAExB;AACN,OAAI,gBAAgB,KAAK,aAAa,CACpC,+BAAe,aAAa;;AAIhC,SAAO;;CAGT,MAAM,kBAAkB,oBACtB,qBAAqB,0CACtB;AAED,QAAO;EACL,SAAS;EACT,uBAAuB,oBACrB,qBAAqB,2CACtB;EACD,yBAAyB,oBACvB,qBAAqB,2DACtB;EACD,uBAAuB,oBACrB,qBAA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,qBAAqB,SAAS;EAC5D,YAAY,sBAAsB,qBAAqB,WAAW;EAClE,SAAS,qBAAqB;EAC9B,SAAS,qBAAqB;EAC/B;AAED,QAAO"}
1
+ {"version":3,"file":"buildConfigurationFields.cjs","names":["getProjectRequire","FILE_EXTENSIONS","CONTENT_DIR","CODE_DIR","EXCLUDED_PATHS","TRAVERSE_PATTERN","OUTPUT_FORMAT","intlayerConfigSchema","buildBrowserConfiguration","buildInternationalizationFields","buildEditorFields","buildLogFields","buildAnalyticsFields"],"sources":["../../../src/configFile/buildConfigurationFields.ts"],"sourcesContent":["import { statSync } from 'node:fs';\nimport { dirname, isAbsolute, join } from 'node:path';\nimport type {\n AiConfig,\n BuildConfig,\n CompilerConfig,\n ContentConfig,\n CustomIntlayerConfig,\n DictionaryConfig,\n IntlayerConfig,\n LogFunctions,\n SystemConfig,\n} from '@intlayer/types/config';\nimport {\n BUILD_MODE,\n CACHE,\n MINIFY,\n OUTPUT_FORMAT,\n PURGE,\n TRAVERSE_PATTERN,\n TYPE_CHECKING,\n} from '../defaultValues/build';\nimport {\n COMPILER_DICTIONARY_KEY_PREFIX,\n COMPILER_ENABLED,\n COMPILER_NO_METADATA,\n COMPILER_SAVE_COMPONENTS,\n} from '../defaultValues/compiler';\nimport {\n CODE_DIR,\n CONTENT_DIR,\n EXCLUDED_PATHS,\n FILE_EXTENSIONS,\n WATCH,\n} from '../defaultValues/content';\nimport {\n CONTENT_AUTO_TRANSFORMATION,\n FILL,\n IMPORT_MODE,\n LOCATION,\n} from '../defaultValues/dictionary';\nimport {\n CACHE_DIR,\n CONFIG_DIR,\n DICTIONARIES_DIR,\n DYNAMIC_DICTIONARIES_DIR,\n FETCH_DICTIONARIES_DIR,\n MAIN_DIR,\n MODULE_AUGMENTATION_DIR,\n REMOTE_DICTIONARIES_DIR,\n TEMP_DIR,\n TYPES_DIR,\n UNMERGED_DICTIONARIES_DIR,\n} from '../defaultValues/system';\nimport { getProjectRequire } from '../utils';\nimport {\n buildAnalyticsFields,\n buildBrowserConfiguration,\n buildEditorFields,\n buildInternationalizationFields,\n buildLogFields,\n} from './buildBrowserConfiguration';\nimport { intlayerConfigSchema } from './configurationSchema';\n\nexport {\n type BrowserIntlayerConfig,\n buildAnalyticsFields,\n buildBrowserConfiguration,\n buildEditorFields,\n buildInternationalizationFields,\n buildLogFields,\n buildRoutingFields,\n extractBrowserConfiguration,\n} from './buildBrowserConfiguration';\n\nlet storedConfiguration: IntlayerConfig;\n\n// ---------------------------------------------------------------------------\n// Server-only field builders (Node.js — not browser-safe)\n// ---------------------------------------------------------------------------\n\n/**\n * Build the `system` section of the Intlayer configuration.\n *\n * Resolves all directory paths (dictionaries, types, cache, …) relative to\n * the project base directory, using Node.js `require.resolve` where available\n * and falling back to `path.join` otherwise.\n *\n * @param baseDir - Project root directory. Defaults to `process.cwd()`.\n * @param customConfiguration - Partial user-supplied system config.\n * @returns A fully-resolved {@link SystemConfig}.\n */\nconst buildSystemFields = (\n baseDir?: string,\n customConfiguration?: Partial<SystemConfig>\n): SystemConfig => {\n const projectBaseDir = baseDir ?? process.cwd();\n\n const optionalJoinBaseDir = (pathInput: string) => {\n let absolutePath: string;\n\n try {\n const requireFunction = getProjectRequire(projectBaseDir);\n try {\n absolutePath = requireFunction.resolve(pathInput, {\n paths: [projectBaseDir],\n });\n } catch (err) {\n if (!pathInput.startsWith('.') && !isAbsolute(pathInput)) {\n absolutePath = requireFunction.resolve(`${pathInput}/package.json`, {\n paths: [projectBaseDir],\n });\n } else {\n throw err;\n }\n }\n } catch {\n absolutePath = isAbsolute(pathInput)\n ? pathInput\n : join(projectBaseDir, pathInput);\n }\n\n try {\n const stats = statSync(absolutePath);\n if (stats.isFile()) {\n return dirname(absolutePath);\n }\n } catch {\n if (/\\.[a-z0-9]+$/i.test(absolutePath)) {\n return dirname(absolutePath);\n }\n }\n\n return absolutePath;\n };\n\n const dictionariesDir = optionalJoinBaseDir(\n customConfiguration?.dictionariesDir ?? DICTIONARIES_DIR\n );\n\n return {\n baseDir: projectBaseDir,\n moduleAugmentationDir: optionalJoinBaseDir(\n customConfiguration?.moduleAugmentationDir ?? MODULE_AUGMENTATION_DIR\n ),\n unmergedDictionariesDir: optionalJoinBaseDir(\n customConfiguration?.unmergedDictionariesDir ?? UNMERGED_DICTIONARIES_DIR\n ),\n remoteDictionariesDir: optionalJoinBaseDir(\n customConfiguration?.remoteDictionariesDir ?? REMOTE_DICTIONARIES_DIR\n ),\n dictionariesDir,\n dynamicDictionariesDir: optionalJoinBaseDir(\n customConfiguration?.dynamicDictionariesDir ?? DYNAMIC_DICTIONARIES_DIR\n ),\n fetchDictionariesDir: optionalJoinBaseDir(\n customConfiguration?.fetchDictionariesDir ?? FETCH_DICTIONARIES_DIR\n ),\n typesDir: optionalJoinBaseDir(customConfiguration?.typesDir ?? TYPES_DIR),\n mainDir: optionalJoinBaseDir(customConfiguration?.mainDir ?? MAIN_DIR),\n configDir: optionalJoinBaseDir(\n customConfiguration?.configDir ?? CONFIG_DIR\n ),\n cacheDir: optionalJoinBaseDir(customConfiguration?.cacheDir ?? CACHE_DIR),\n tempDir: optionalJoinBaseDir(customConfiguration?.tempDir ?? TEMP_DIR),\n };\n};\n\n/**\n * Build the `content` section of the Intlayer configuration.\n *\n * Resolves content and code directories relative to the project base using\n * `require.resolve`, falling back to `path.join`.\n *\n * @param systemConfig - Already-built system configuration (provides `baseDir`).\n * @param customConfiguration - Partial user-supplied content config.\n * @returns A fully-resolved {@link ContentConfig}.\n */\nconst buildContentFields = (\n systemConfig: SystemConfig,\n customConfiguration?: Partial<ContentConfig>\n): ContentConfig => {\n const fileExtensions = customConfiguration?.fileExtensions ?? FILE_EXTENSIONS;\n\n const optionalJoinBaseDir = (pathInput: string) => {\n let absolutePath: string;\n\n try {\n const requireFunction = getProjectRequire(systemConfig.baseDir);\n try {\n absolutePath = requireFunction.resolve(pathInput, {\n paths: [systemConfig.baseDir],\n });\n } catch (err) {\n if (!pathInput.startsWith('.') && !isAbsolute(pathInput)) {\n absolutePath = requireFunction.resolve(`${pathInput}/package.json`, {\n paths: [systemConfig.baseDir],\n });\n } else {\n throw err;\n }\n }\n } catch {\n try {\n try {\n absolutePath = require.resolve(pathInput, {\n paths: [systemConfig.baseDir],\n });\n } catch (err) {\n if (!pathInput.startsWith('.') && !isAbsolute(pathInput)) {\n absolutePath = require.resolve(`${pathInput}/package.json`, {\n paths: [systemConfig.baseDir],\n });\n } else {\n throw err;\n }\n }\n } catch {\n absolutePath = isAbsolute(pathInput)\n ? pathInput\n : join(systemConfig.baseDir, pathInput);\n }\n }\n\n try {\n const stats = statSync(absolutePath);\n if (stats.isFile()) {\n return dirname(absolutePath);\n }\n } catch {\n if (/\\.[a-z0-9]+$/i.test(absolutePath)) {\n return dirname(absolutePath);\n }\n }\n\n return absolutePath;\n };\n\n const contentDir = (customConfiguration?.contentDir ?? CONTENT_DIR).map(\n optionalJoinBaseDir\n );\n const codeDir = (customConfiguration?.codeDir ?? CODE_DIR).map(\n optionalJoinBaseDir\n );\n\n return {\n fileExtensions,\n contentDir,\n codeDir,\n excludedPath: customConfiguration?.excludedPath ?? EXCLUDED_PATHS,\n watch: customConfiguration?.watch ?? WATCH,\n formatCommand: customConfiguration?.formatCommand,\n };\n};\n\n/**\n * Build the `ai` section of the Intlayer configuration.\n *\n * @param customConfiguration - Partial user-supplied AI config.\n * @returns A fully-defaulted {@link AiConfig}.\n */\nconst buildAiFields = (customConfiguration?: Partial<AiConfig>): AiConfig => ({\n /**\n * AI configuration\n */\n provider: customConfiguration?.provider,\n\n /**\n * API key\n */\n apiKey: customConfiguration?.apiKey,\n\n /**\n * API model\n */\n model: customConfiguration?.model,\n\n /**\n * Temperature\n */\n temperature: customConfiguration?.temperature,\n\n /**\n * Application context\n *\n * Default: undefined\n *\n * The application context.\n *\n * Example: `'My application context'`\n *\n * Note: Can be used to provide additional context about the application to the AI model. You can add more rules (e.g. \"You should not transform urls\").\n */\n applicationContext: customConfiguration?.applicationContext,\n\n /**\n * Base URL for the AI API\n *\n * Default: undefined\n *\n * The base URL for the AI API.\n *\n * Example: `'http://localhost:5000'`\n *\n * Note: Can be used to point to a local, or custom AI API endpoint.\n */\n baseURL: customConfiguration?.baseURL,\n\n /**\n * Data serialization\n *\n * Options:\n * - \"json\": The industry standard. Highly reliable and structured, but consumes more tokens.\n * - \"toon\": An optimized format designed to reduce token consumption (cost-effective). However, it may slightly increase the risk of output inconsistency compared to standard JSON\n *\n * Default: `\"json\"`\n */\n dataSerialization: customConfiguration?.dataSerialization,\n});\n\n/**\n * Build the `build` section of the Intlayer configuration.\n *\n * @param customConfiguration - Partial user-supplied build config.\n * @returns A fully-defaulted {@link BuildConfig}.\n */\nconst buildBuildFields = (\n customConfiguration?: Partial<BuildConfig>\n): BuildConfig => ({\n /**\n * Indicates the mode of the build\n *\n * Default: 'auto'\n *\n * If 'auto', the build will be enabled automatically when the application is built.\n * If 'manual', the build will be set only when the build command is executed.\n *\n * Can be used to disable dictionaries build, for instance when execution on Node.js environment should be avoided.\n */\n mode: customConfiguration?.mode ?? BUILD_MODE,\n\n /**\n * Indicates if the build should be optimized\n *\n * Default: process.env.NODE_ENV === 'production'\n *\n * If true, the build will be optimized.\n * If false, the build will not be optimized.\n *\n * Intlayer will replace all calls of dictionaries to optimize chunking. That way the final bundle will import only the dictionaries that are used.\n * All imports will stay as static import to avoid async processing when loading the dictionaries.\n *\n * Note:\n * - Intlayer will replace all call of `useIntlayer` with the defined mode by the `importMode` option.\n * - Intlayer will replace all call of `getIntlayer` with `getDictionary`.\n * - This option relies on the `@intlayer/babel` and `@intlayer/swc` plugins.\n * - In most cases, \"dynamic\" will be used for React applications, \"async\" for Vue.js applications.\n * - Ensure all keys are declared statically in the `useIntlayer` calls. e.g. `useIntlayer('navbar')`.\n */\n optimize: customConfiguration?.optimize,\n\n /**\n * Indicates the mode of import to use for the dictionaries.\n *\n * Available modes:\n * - \"static\": The dictionaries are imported statically.\n * In that case, Intlayer will replace all calls to `useIntlayer` with `useDictionary`.\n * - \"dynamic\": The dictionaries are imported dynamically in a synchronous component using the suspense API.\n * In that case, Intlayer will replace all calls to `useIntlayer` with `useDictionaryDynamic`.\n * - \"live\": The dictionaries are imported dynamically using the live sync API.\n * In that case, Intlayer will replace all calls to `useIntlayer` with `useDictionaryDynamic`.\n * Live mode will use the live sync API to fetch the dictionaries. If the API call fails, the dictionaries will be imported dynamically as \"dynamic\" mode.\n *\n * Default: \"static\"\n *\n * By default, when a dictionary is loaded, it imports content for all locales as it's imported statically.\n *\n * Note:\n * - Dynamic imports rely on Suspense and may slightly impact rendering performance.\n * - If disabled all locales will be loaded at once, even if they are not used.\n * - This option relies on the `@intlayer/babel` and `@intlayer/swc` plugins.\n * - Ensure all keys are declared statically in the `useIntlayer` calls. e.g. `useIntlayer('navbar')`.\n * - This option will be ignored if `optimize` is disabled.\n * - This option will not impact the `getIntlayer`, `getDictionary`, `useDictionary`, `useDictionaryAsync` and `useDictionaryDynamic` functions. You can still use them to refine you code on manual optimization.\n * - The \"live\" allows to sync the dictionaries to the live sync server.\n *\n * @deprecated Use `dictionary.importMode` instead.\n */\n importMode: customConfiguration?.importMode,\n\n /**\n * Minify the dictionaries to reduce the bundle size.\n *\n * Default: false\n *\n * Note:\n * - This option will be ignored if `optimize` is disabled.\n * - This option will be ignore if `editor.enabled` is true.\n * - If there is edge cases where the minification is not working properly, the dictionary will be not minified.\n */\n minify: customConfiguration?.minify ?? MINIFY,\n\n /**\n * Purge the unused keys in a dictionaries\n *\n * Default: false\n *\n * Note:\n * - This option will be ignored if `optimize` is disabled.\n * - This option will be ignored if `editor.enabled` is true.\n */\n purge: customConfiguration?.purge ?? PURGE,\n\n /**\n * Pattern to traverse the code to optimize.\n *\n * Allows to avoid to traverse the code that is not relevant to the optimization.\n * Improve build performance.\n *\n * Default: ['**\\/*.{js,ts,mjs,cjs,jsx,tsx}', '!**\\/node_modules/**']\n *\n * Example: `['src/**\\/*.{ts,tsx}', '../ui-library/**\\/*.{ts,tsx}']`\n *\n * Note:\n * - This option will be ignored if `optimize` is disabled.\n * - Use glob pattern.\n */\n traversePattern: customConfiguration?.traversePattern ?? TRAVERSE_PATTERN,\n\n /**\n * Output format of the dictionaries\n *\n * Can be set on large projects to improve build performance.\n *\n * Default: ['cjs', 'esm']\n *\n * The output format of the dictionaries. It can be either 'cjs' or 'esm'.\n * - 'cjs': The dictionaries are outputted as CommonJS modules.\n * - 'esm': The dictionaries are outputted as ES modules.\n */\n outputFormat: customConfiguration?.outputFormat ?? OUTPUT_FORMAT,\n\n /**\n * Cache\n */\n cache: customConfiguration?.cache ?? CACHE,\n\n /**\n * Require function\n */\n require: customConfiguration?.require,\n\n /**\n * Indicates if the build should check TypeScript types\n *\n * Default: `false`\n *\n * If true, the build will check TypeScript types and log errors.\n * Note: This can slow down the build.\n */\n checkTypes: customConfiguration?.checkTypes ?? TYPE_CHECKING,\n});\n\n/**\n * Build the `compiler` section of the Intlayer configuration.\n *\n * @param customConfiguration - Partial user-supplied compiler config.\n * @returns A fully-defaulted {@link CompilerConfig}.\n */\nconst buildCompilerFields = (\n customConfiguration?: Partial<CompilerConfig>\n): CompilerConfig => ({\n /**\n * Indicates if the compiler should be enabled\n */\n enabled: customConfiguration?.enabled ?? COMPILER_ENABLED,\n\n /**\n * Prefix for the extracted dictionary keys\n */\n dictionaryKeyPrefix:\n customConfiguration?.dictionaryKeyPrefix ?? COMPILER_DICTIONARY_KEY_PREFIX,\n\n /**\n * Pattern to traverse the code to optimize.\n *\n * @deprecated use `build.traversePattern` instead\n */\n transformPattern: customConfiguration?.transformPattern,\n\n /**\n * Pattern to exclude from the optimization.\n *\n * @deprecated use `build.traversePattern` instead\n */\n excludePattern: customConfiguration?.excludePattern,\n\n /**\n * Defines the output files path. Replaces `outputDir`.\n *\n * - `./` paths are resolved relative to the component directory.\n * - `/` paths are resolved relative to the project root (`baseDir`).\n *\n * - Including the `{{locale}}` variable in the path will trigger the generation of separate dictionaries per locale.\n *\n * @example:\n * ```ts\n * {\n * // Create Multilingual .content.ts files close to the component\n * output: ({ fileName, extension }) => `./${fileName}${extension}`,\n *\n * // output: './{{fileName}}{{extension}}', // Equivalent using template string\n * }\n * ```\n *\n * ```ts\n * {\n * // Create centralize per-locale JSON at the root of the project\n * output: ({ key, locale }) => `/locales/${locale}/${key}.content.json`,\n *\n * // output: '/locales/{{locale}}/{{key}}.content.json', // Equivalent using template string\n * }\n * ```\n *\n * ```ts\n * {\n * // Create per-locale JSON files with locale-specific output paths\n * output: {\n * en: ({ fileName, locale }) => `${fileName}.${locale}.content.json`,\n * fr: '{{fileName}}.{{locale}}.content.json',\n * es: false, // skip this locale\n * },\n * }\n * ```\n *\n * Variable list:\n * - `fileName`: The name of the file.\n * - `key`: The key of the content.\n * - `locale`: The locale of the content.\n * - `extension`: The extension of the file.\n * - `componentFileName`: The name of the component file.\n * - `componentExtension`: The extension of the component file.\n * - `format`: The format of the dictionary.\n * - `componentFormat`: The format of the component dictionary.\n * - `componentDirPath`: The directory path of the component.\n */\n output: customConfiguration?.output,\n\n /**\n * Indicates if the metadata should be saved in the file.\n *\n * If true, the compiler will not save the metadata of the dictionaries.\n *\n * If `true`:\n *\n * ```json\n * {\n * \"key\": \"value\"\n * }\n * ```\n *\n * If `false`:\n *\n * ```json\n * {\n * \"key\": \"value\",\n * \"content\": {\n * \"key\": \"value\"\n * }\n * }\n * ```\n *\n * Default: `false`\n *\n * Note: Useful if used with loadJSON plugin\n */\n noMetadata: customConfiguration?.noMetadata ?? COMPILER_NO_METADATA,\n\n /**\n * Indicates if the components should be saved after being transformed.\n */\n saveComponents:\n customConfiguration?.saveComponents ?? COMPILER_SAVE_COMPONENTS,\n});\n\n/**\n * Build the `dictionary` section of the Intlayer configuration.\n *\n * @param customConfiguration - Partial user-supplied dictionary config.\n * @returns A fully-defaulted {@link DictionaryConfig}.\n */\nconst buildDictionaryFields = (\n customConfiguration?: Partial<DictionaryConfig>\n): DictionaryConfig => {\n const contentAutoTransformation =\n customConfiguration?.contentAutoTransformation ??\n CONTENT_AUTO_TRANSFORMATION;\n\n return {\n /**\n * Indicate how the dictionary should be filled using AI.\n *\n * Default: `true`\n *\n * - If `true`, will consider the `compiler.output` field.\n * - If `false`, will skip the fill process.\n *\n * - `./` paths are resolved relative to the component directory.\n * - `/` paths are resolved relative to the project root (`baseDir`).\n *\n * - If includes `{{locale}}` variable in the path, will trigger the generation of separate dictionaries per locale.\n *\n * Example:\n * ```ts\n * {\n * // Create Multilingual .content.ts files close to the component\n * fill: ({ fileName, extension }) => `./${fileName}${extension}`,\n *\n * // fill: './{{fileName}}{{extension}}', // Equivalent using template string\n * }\n * ```\n *\n * ```ts\n * {\n * // Create centralize per-locale JSON at the root of the project\n * fill: ({ key, locale }) => `/locales/${locale}/${key}.content.json`,\n *\n * // fill: '/locales/{{locale}}/{{key}}.content.json', // Equivalent using template string\n * }\n * ```\n *\n * ```ts\n * {\n * // Create custom output based on the locale\n * fill: {\n * en: ({ key }) => `/locales/en/${key}.content.json`,\n * fr: '/locales/fr/{{key}}.content.json',\n * es: false,\n * de: true,\n * },\n * }\n * ```\n *\n *\n * Variable list:\n * - `fileName`: The name of the file.\n * - `key`: The key of the content.\n * - `locale`: The locale of the content.\n * - `extension`: The extension of the file.\n * - `componentFileName`: The name of the component file.\n * - `componentExtension`: The extension of the component file.\n * - `format`: The format of the dictionary.\n * - `componentFormat`: The format of the component dictionary.\n * - `componentDirPath`: The directory path of the component.\n */\n fill: customConfiguration?.fill ?? FILL,\n\n /**\n * Indicates if the content of the dictionary should be automatically transformed.\n *\n * Default: `false`\n */\n contentAutoTransformation:\n typeof contentAutoTransformation === 'object'\n ? {\n markdown: contentAutoTransformation.markdown ?? false,\n html: contentAutoTransformation.html ?? false,\n insertion: contentAutoTransformation.insertion ?? false,\n }\n : contentAutoTransformation,\n\n /**\n * The location of the dictionary.\n *\n * Default: `\"local\"`\n */\n location: customConfiguration?.location ?? LOCATION,\n\n /**\n * Transform the dictionary in a per-locale dictionary.\n * Each field declared in a per-locale dictionary will be transformed in a translation node.\n * If missing, the dictionary will be treated as a multilingual dictionary.\n */\n locale: customConfiguration?.locale,\n\n /**\n * The title of the dictionary.\n */\n title: customConfiguration?.title,\n\n /**\n * The description of the dictionary.\n */\n description: customConfiguration?.description,\n\n /**\n * Tags to categorize the dictionaries.\n */\n tags: customConfiguration?.tags,\n\n /**\n * The priority of the dictionary.\n */\n priority: customConfiguration?.priority,\n\n /**\n * Indicates the mode of import to use for the dictionary.\n *\n * Available modes:\n * - \"static\": The dictionaries are imported statically.\n * - \"dynamic\": The dictionaries are imported dynamically in a synchronous component using the suspense API.\n * - \"live\": The dictionaries are imported dynamically using the live sync API.\n *\n * Default: `\"static\"`\n */\n importMode: customConfiguration?.importMode ?? IMPORT_MODE,\n\n /**\n * The default message format for all dictionaries in the project.\n *\n * Default: 'intlayer'\n */\n format: customConfiguration?.format,\n };\n};\n\n// ---------------------------------------------------------------------------\n// Main export\n// ---------------------------------------------------------------------------\n\n/**\n * Build the complete Intlayer configuration by merging user-supplied values\n * with defaults.\n *\n * Internally this function:\n * 1. Calls {@link buildBrowserConfiguration} to produce the browser-safe\n * subset (internationalization, routing, editor public fields, log, metadata).\n * 2. Extends the result with full server-side fields:\n * - `internationalization` — adds `requiredLocales` and `strictMode`.\n * - `editor` — adds `clientId` and `clientSecret`.\n * - `log` — adds custom log functions.\n * - `system`, `content`, `ai`, `build`, `compiler`, `dictionary`.\n *\n * @param customConfiguration - Optional user-supplied configuration object.\n * @param baseDir - Project root directory. Defaults to `process.cwd()`.\n * @param logFunctions - Optional custom logging functions.\n * @param env - Environment variables used to resolve credential fallbacks\n * (e.g. `INTLAYER_CLIENT_ID` / `INTLAYER_CLIENT_SECRET`). Defaults to\n * `process.env`. Callers loading a custom env file (such as the CLI\n * `--env-file` flag) should pass the merged env so credentials defined there\n * are picked up without polluting `process.env`.\n * @returns A fully-built {@link IntlayerConfig}.\n */\nexport const buildConfigurationFields = (\n customConfiguration?: CustomIntlayerConfig,\n baseDir?: string,\n logFunctions?: LogFunctions,\n env: NodeJS.ProcessEnv = process.env\n): IntlayerConfig => {\n if (customConfiguration) {\n const result = intlayerConfigSchema.safeParse(customConfiguration);\n\n if (!result.success) {\n const logError = logFunctions?.error ?? console.error;\n\n for (const issue of result.error.issues) {\n logError(`${issue.path.join('.')}: ${issue.message}`);\n }\n }\n }\n\n // build browser-safe config (shared defaults, no Node.js deps)\n const browserConfig = buildBrowserConfiguration(customConfiguration);\n\n // extend shared fields with server-only additions\n const internationalizationConfig = buildInternationalizationFields(\n customConfiguration?.internationalization\n );\n\n const editorConfig = buildEditorFields(customConfiguration?.editor, env);\n\n const logConfig = buildLogFields(customConfiguration?.log, logFunctions);\n\n // build server-only fields\n const systemConfig = buildSystemFields(baseDir, customConfiguration?.system);\n\n const contentConfig = buildContentFields(\n systemConfig,\n customConfiguration?.content\n );\n\n storedConfiguration = {\n // Shared browser fields\n routing: browserConfig.routing,\n // Full (extended) shared fields\n internationalization: internationalizationConfig,\n editor: editorConfig,\n analytics: buildAnalyticsFields(customConfiguration?.analytics),\n log: logConfig,\n // Server-only fields\n system: systemConfig,\n content: contentConfig,\n ai: buildAiFields(customConfiguration?.ai),\n build: buildBuildFields(customConfiguration?.build),\n compiler: buildCompilerFields(customConfiguration?.compiler),\n dictionary: buildDictionaryFields(customConfiguration?.dictionary),\n plugins: customConfiguration?.plugins,\n schemas: customConfiguration?.schemas,\n } as IntlayerConfig;\n\n return storedConfiguration;\n};\n"],"mappings":";;;;;;;;;;;;;AA2EA,IAAI;;;;;;;;;;;;AAiBJ,MAAM,qBACJ,SACA,wBACiB;CACjB,MAAM,iBAAiB,WAAW,QAAQ,IAAI;CAE9C,MAAM,uBAAuB,cAAsB;EACjD,IAAI;EAEJ,IAAI;GACF,MAAM,kBAAkBA,+CAAkB,cAAc;GACxD,IAAI;IACF,eAAe,gBAAgB,QAAQ,WAAW,EAChD,OAAO,CAAC,cAAc,EACxB,CAAC;GACH,SAAS,KAAK;IACZ,IAAI,CAAC,UAAU,WAAW,GAAG,KAAK,2BA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