@intlayer/config 8.4.1 → 8.4.3

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 (192) hide show
  1. package/dist/cjs/chunk-Bmb41Sf3.cjs +1 -0
  2. package/dist/cjs/client.cjs +1 -1
  3. package/dist/cjs/colors.cjs +2 -0
  4. package/dist/cjs/colors.cjs.map +1 -0
  5. package/dist/cjs/configFile/buildConfigurationFields.cjs +1 -1
  6. package/dist/cjs/configFile/buildConfigurationFields.cjs.map +1 -1
  7. package/dist/cjs/configFile/configurationSchema.cjs +1 -1
  8. package/dist/cjs/configFile/configurationSchema.cjs.map +1 -1
  9. package/dist/cjs/configFile/getConfiguration.cjs +1 -1
  10. package/dist/cjs/configFile/getConfiguration.cjs.map +1 -1
  11. package/dist/cjs/configFile/searchConfigurationFile.cjs +1 -1
  12. package/dist/cjs/configFile/searchConfigurationFile.cjs.map +1 -1
  13. package/dist/cjs/defaultValues/build.cjs +1 -1
  14. package/dist/cjs/defaultValues/build.cjs.map +1 -1
  15. package/dist/cjs/defaultValues/compiler.cjs +1 -1
  16. package/dist/cjs/defaultValues/content.cjs +1 -1
  17. package/dist/cjs/defaultValues/content.cjs.map +1 -1
  18. package/dist/cjs/defaultValues/dictionary.cjs +1 -1
  19. package/dist/cjs/defaultValues/dictionary.cjs.map +1 -1
  20. package/dist/cjs/defaultValues/editor.cjs +1 -1
  21. package/dist/cjs/defaultValues/editor.cjs.map +1 -1
  22. package/dist/cjs/defaultValues/index.cjs +1 -2
  23. package/dist/cjs/defaultValues/internationalization.cjs +1 -1
  24. package/dist/cjs/defaultValues/internationalization.cjs.map +1 -1
  25. package/dist/cjs/defaultValues/log.cjs +1 -1
  26. package/dist/cjs/defaultValues/log.cjs.map +1 -1
  27. package/dist/cjs/defaultValues/routing.cjs +1 -1
  28. package/dist/cjs/defaultValues/routing.cjs.map +1 -1
  29. package/dist/cjs/defaultValues/system.cjs +1 -1
  30. package/dist/cjs/defaultValues/system.cjs.map +1 -1
  31. package/dist/cjs/loadEnvFile.cjs +1 -1
  32. package/dist/cjs/loadExternalFile/bundleFile.cjs +1 -1
  33. package/dist/cjs/loadExternalFile/bundleJSFile.cjs +1 -1
  34. package/dist/cjs/loadExternalFile/loadExternalFile.cjs +1 -1
  35. package/dist/cjs/loadExternalFile/loadExternalFile.cjs.map +1 -1
  36. package/dist/cjs/loadExternalFile/parseFileContent.cjs +1 -1
  37. package/dist/cjs/loadExternalFile/transpileTSToCJS.cjs +1 -1
  38. package/dist/cjs/loadExternalFile/transpileTSToCJS.cjs.map +1 -1
  39. package/dist/cjs/logger.cjs +1 -1
  40. package/dist/cjs/logger.cjs.map +1 -1
  41. package/dist/cjs/node.cjs +1 -1
  42. package/dist/cjs/utils/ESMxCJSHelpers.cjs +1 -1
  43. package/dist/cjs/utils/alias.cjs +1 -1
  44. package/dist/cjs/utils/cacheDisk.cjs +1 -1
  45. package/dist/cjs/utils/cacheMemory.cjs +1 -1
  46. package/dist/cjs/utils/getPackageJsonPath.cjs +1 -1
  47. package/dist/cjs/utils/logStack.cjs +1 -1
  48. package/dist/cjs/utils/logStack.cjs.map +1 -1
  49. package/dist/cjs/utils/retryManager.cjs +1 -1
  50. package/dist/esm/ESMxCJSHelpers-BAuqwNXV.mjs +2 -0
  51. package/dist/esm/ESMxCJSHelpers-BAuqwNXV.mjs.map +1 -0
  52. package/dist/esm/client.mjs +1 -1
  53. package/dist/esm/colors.mjs +2 -0
  54. package/dist/esm/colors.mjs.map +1 -0
  55. package/dist/esm/configFile/buildConfigurationFields.mjs +1 -1
  56. package/dist/esm/configFile/buildConfigurationFields.mjs.map +1 -1
  57. package/dist/esm/configFile/configurationSchema.mjs +1 -1
  58. package/dist/esm/configFile/configurationSchema.mjs.map +1 -1
  59. package/dist/esm/configFile/getConfiguration.mjs +1 -1
  60. package/dist/esm/configFile/getConfiguration.mjs.map +1 -1
  61. package/dist/esm/configFile/loadConfigurationFile.mjs +1 -1
  62. package/dist/esm/configFile/loadConfigurationFile.mjs.map +1 -1
  63. package/dist/esm/configFile/searchConfigurationFile.mjs +1 -1
  64. package/dist/esm/configFile/searchConfigurationFile.mjs.map +1 -1
  65. package/dist/esm/defaultValues/build.mjs +1 -1
  66. package/dist/esm/defaultValues/build.mjs.map +1 -1
  67. package/dist/esm/defaultValues/compiler.mjs +1 -1
  68. package/dist/esm/defaultValues/compiler.mjs.map +1 -1
  69. package/dist/esm/defaultValues/content.mjs +1 -1
  70. package/dist/esm/defaultValues/content.mjs.map +1 -1
  71. package/dist/esm/defaultValues/dictionary.mjs +1 -1
  72. package/dist/esm/defaultValues/dictionary.mjs.map +1 -1
  73. package/dist/esm/defaultValues/editor.mjs +1 -1
  74. package/dist/esm/defaultValues/editor.mjs.map +1 -1
  75. package/dist/esm/defaultValues/index.mjs +1 -2
  76. package/dist/esm/defaultValues/internationalization.mjs +1 -1
  77. package/dist/esm/defaultValues/internationalization.mjs.map +1 -1
  78. package/dist/esm/defaultValues/log.mjs +1 -1
  79. package/dist/esm/defaultValues/log.mjs.map +1 -1
  80. package/dist/esm/defaultValues/routing.mjs +1 -1
  81. package/dist/esm/defaultValues/routing.mjs.map +1 -1
  82. package/dist/esm/defaultValues/system.mjs +1 -1
  83. package/dist/esm/defaultValues/system.mjs.map +1 -1
  84. package/dist/esm/loadExternalFile/loadExternalFile.mjs +1 -1
  85. package/dist/esm/loadExternalFile/loadExternalFile.mjs.map +1 -1
  86. package/dist/esm/loadExternalFile/parseFileContent.mjs +1 -1
  87. package/dist/esm/loadExternalFile/parseFileContent.mjs.map +1 -1
  88. package/dist/esm/loadExternalFile/transpileTSToCJS.mjs +1 -1
  89. package/dist/esm/loadExternalFile/transpileTSToCJS.mjs.map +1 -1
  90. package/dist/esm/logger.mjs +1 -1
  91. package/dist/esm/logger.mjs.map +1 -1
  92. package/dist/esm/node.mjs +1 -1
  93. package/dist/esm/utils/ESMxCJSHelpers.mjs +1 -2
  94. package/dist/esm/utils/clearModuleCache.mjs +1 -1
  95. package/dist/esm/utils/clearModuleCache.mjs.map +1 -1
  96. package/dist/esm/utils/index.mjs +1 -1
  97. package/dist/esm/utils/logStack.mjs +1 -1
  98. package/dist/esm/utils/logStack.mjs.map +1 -1
  99. package/dist/esm/utils/retryManager.mjs +1 -1
  100. package/dist/types/{camelCaseToKebabCase-91HKVxf2.d.ts → camelCaseToKebabCase-BV_lLJHR.d.ts} +1 -1
  101. package/dist/types/camelCaseToKebabCase-BV_lLJHR.d.ts.map +1 -0
  102. package/dist/types/{camelCaseToSentence-LKuKkD3M.d.ts → camelCaseToSentence-DAbbkwe6.d.ts} +1 -1
  103. package/dist/types/camelCaseToSentence-DAbbkwe6.d.ts.map +1 -0
  104. package/dist/types/client.d.ts +5 -6
  105. package/dist/types/colors-BbZeGWYU.d.ts +20 -0
  106. package/dist/types/colors-BbZeGWYU.d.ts.map +1 -0
  107. package/dist/types/colors.d.ts +2 -0
  108. package/dist/types/configFile/buildConfigurationFields.d.ts.map +1 -1
  109. package/dist/types/configFile/configurationSchema.d.ts +0 -6
  110. package/dist/types/configFile/configurationSchema.d.ts.map +1 -1
  111. package/dist/types/configFile/getConfiguration.d.ts +3 -1
  112. package/dist/types/configFile/getConfiguration.d.ts.map +1 -1
  113. package/dist/types/configFile/loadConfigurationFile.d.ts +1 -1
  114. package/dist/types/configFile/loadConfigurationFile.d.ts.map +1 -1
  115. package/dist/types/configFile/searchConfigurationFile.d.ts.map +1 -1
  116. package/dist/types/defaultValues/build.d.ts +10 -2
  117. package/dist/types/defaultValues/build.d.ts.map +1 -0
  118. package/dist/types/defaultValues/compiler.d.ts +8 -2
  119. package/dist/types/defaultValues/compiler.d.ts.map +1 -0
  120. package/dist/types/defaultValues/content.d.ts +11 -2
  121. package/dist/types/defaultValues/content.d.ts.map +1 -0
  122. package/dist/types/defaultValues/dictionary.d.ts +10 -2
  123. package/dist/types/defaultValues/dictionary.d.ts.map +1 -0
  124. package/dist/types/defaultValues/editor.d.ts +13 -2
  125. package/dist/types/defaultValues/editor.d.ts.map +1 -0
  126. package/dist/types/defaultValues/index.d.ts +10 -17
  127. package/dist/types/defaultValues/internationalization.d.ts +11 -2
  128. package/dist/types/defaultValues/internationalization.d.ts.map +1 -0
  129. package/dist/types/defaultValues/log.d.ts +6 -2
  130. package/dist/types/defaultValues/log.d.ts.map +1 -0
  131. package/dist/types/defaultValues/routing.d.ts +13 -2
  132. package/dist/types/defaultValues/routing.d.ts.map +1 -0
  133. package/dist/types/defaultValues/system.d.ts +16 -2
  134. package/dist/types/defaultValues/system.d.ts.map +1 -0
  135. package/dist/types/{kebabCaseToCamelCase-BR4yfbUC.d.ts → kebabCaseToCamelCase-h9PkNVuO.d.ts} +1 -1
  136. package/dist/types/kebabCaseToCamelCase-h9PkNVuO.d.ts.map +1 -0
  137. package/dist/types/{loadEnvFile-Dk80Swa9.d.ts → loadEnvFile-BiTBX4fe.d.ts} +1 -1
  138. package/dist/types/{loadEnvFile-Dk80Swa9.d.ts.map → loadEnvFile-BiTBX4fe.d.ts.map} +1 -1
  139. package/dist/types/loadEnvFile.d.ts +1 -1
  140. package/dist/types/loadExternalFile/index.d.ts +4 -4
  141. package/dist/types/loadExternalFile/loadExternalFile.d.ts +2 -25
  142. package/dist/types/loadExternalFile/parseFileContent.d.ts +1 -1
  143. package/dist/types/loadExternalFile/transpileTSToCJS.d.ts +2 -8
  144. package/dist/types/loadExternalFile-DmM_TGcA.d.ts +25 -0
  145. package/dist/types/loadExternalFile-DmM_TGcA.d.ts.map +1 -0
  146. package/dist/types/logger.d.ts +8 -22
  147. package/dist/types/logger.d.ts.map +1 -1
  148. package/dist/types/node.d.ts +1 -2
  149. package/dist/types/{parseFileContent-CriV5Luv.d.ts → parseFileContent--o_QlW5j.d.ts} +2 -2
  150. package/dist/types/{parseFileContent-CriV5Luv.d.ts.map → parseFileContent--o_QlW5j.d.ts.map} +1 -1
  151. package/dist/types/{toLowerCamelCase-CfYCuChC.d.ts → toLowerCamelCase-DUdT00I1.d.ts} +1 -1
  152. package/dist/types/toLowerCamelCase-DUdT00I1.d.ts.map +1 -0
  153. package/dist/types/transpileTSToCJS-OifpV3zk.d.ts +19 -0
  154. package/dist/types/transpileTSToCJS-OifpV3zk.d.ts.map +1 -0
  155. package/dist/types/utils/index.d.ts +4 -4
  156. package/dist/types/utils/logStack.d.ts.map +1 -1
  157. package/dist/types/utils/stringFormatter/camelCaseToKebabCase.d.ts +1 -1
  158. package/dist/types/utils/stringFormatter/camelCaseToSentence.d.ts +1 -1
  159. package/dist/types/utils/stringFormatter/index.d.ts +4 -4
  160. package/dist/types/utils/stringFormatter/kebabCaseToCamelCase.d.ts +1 -1
  161. package/dist/types/utils/stringFormatter/toLowerCamelCase.d.ts +1 -1
  162. package/package.json +18 -2
  163. package/dist/cjs/chunk-D-qHiVGv.cjs +0 -1
  164. package/dist/cjs/defaultValues/index.cjs.map +0 -1
  165. package/dist/esm/chunk-DXQkyQJp.mjs +0 -1
  166. package/dist/esm/defaultValues/index.mjs.map +0 -1
  167. package/dist/esm/utils/ESMxCJSHelpers.mjs.map +0 -1
  168. package/dist/types/build-BGWWxAP2.d.ts +0 -12
  169. package/dist/types/build-BGWWxAP2.d.ts.map +0 -1
  170. package/dist/types/camelCaseToKebabCase-91HKVxf2.d.ts.map +0 -1
  171. package/dist/types/camelCaseToSentence-LKuKkD3M.d.ts.map +0 -1
  172. package/dist/types/compiler-BKn6YjPf.d.ts +0 -10
  173. package/dist/types/compiler-BKn6YjPf.d.ts.map +0 -1
  174. package/dist/types/content-CEqOvNcs.d.ts +0 -13
  175. package/dist/types/content-CEqOvNcs.d.ts.map +0 -1
  176. package/dist/types/defaultValues/index.d.ts.map +0 -1
  177. package/dist/types/dictionary-n4jBpRU_.d.ts +0 -13
  178. package/dist/types/dictionary-n4jBpRU_.d.ts.map +0 -1
  179. package/dist/types/editor-Bhh3J_sb.d.ts +0 -15
  180. package/dist/types/editor-Bhh3J_sb.d.ts.map +0 -1
  181. package/dist/types/internationalization-0cqNGQ-O.d.ts +0 -14
  182. package/dist/types/internationalization-0cqNGQ-O.d.ts.map +0 -1
  183. package/dist/types/kebabCaseToCamelCase-BR4yfbUC.d.ts.map +0 -1
  184. package/dist/types/loadExternalFile/loadExternalFile.d.ts.map +0 -1
  185. package/dist/types/loadExternalFile/transpileTSToCJS.d.ts.map +0 -1
  186. package/dist/types/log-C5gSYuVB.d.ts +0 -8
  187. package/dist/types/log-C5gSYuVB.d.ts.map +0 -1
  188. package/dist/types/routing-DlVdUHPZ.d.ts +0 -16
  189. package/dist/types/routing-DlVdUHPZ.d.ts.map +0 -1
  190. package/dist/types/system-BFYob741.d.ts +0 -18
  191. package/dist/types/system-BFYob741.d.ts.map +0 -1
  192. package/dist/types/toLowerCamelCase-CfYCuChC.d.ts.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"loadExternalFile.cjs","names":["JSON5","transpileTSToCJSSync","parseFileContent","transpileTSToCJS","colorizePath"],"sources":["../../../src/loadExternalFile/loadExternalFile.ts"],"sourcesContent":["import { readFileSync } from 'node:fs';\nimport { readFile } from 'node:fs/promises';\nimport { extname } from 'node:path';\nimport type { IntlayerConfig } from '@intlayer/types/config';\nimport type { BuildOptions } from 'esbuild';\nimport * as JSON5 from 'json5';\nimport { colorizePath, logger } from '../logger';\nimport {\n parseFileContent,\n type SandBoxContextOptions,\n} from './parseFileContent';\nimport { transpileTSToCJS, transpileTSToCJSSync } from './transpileTSToCJS';\n\n// CJS MJS cross usage\nconst parseJSON5 = JSON5.parse || (JSON5 as any).default?.parse;\n\nexport type LoadExternalFileOptions = {\n configuration?: IntlayerConfig;\n buildOptions?: BuildOptions;\n logError?: boolean;\n} & SandBoxContextOptions;\n\n/**\n * Load the content declaration from the given path\n *\n * Accepts JSON, JS, MJS and TS files as configuration\n */\nexport const loadExternalFileSync = (\n filePath: string,\n options?: LoadExternalFileOptions\n): any | undefined => {\n const fileExtension = extname(filePath) || '.json';\n\n try {\n if (\n fileExtension === '.json' ||\n fileExtension === '.json5' ||\n fileExtension === '.jsonc'\n ) {\n // Assume JSON\n return parseJSON5(readFileSync(filePath, 'utf-8'));\n }\n\n // Rest is JS, MJS or TS\n const code = readFileSync(filePath, 'utf-8');\n\n const moduleResultString: string | undefined = transpileTSToCJSSync(\n code,\n filePath\n );\n\n if (!moduleResultString) {\n logger('File could not be loaded.', { level: 'error' });\n return undefined;\n }\n\n const fileContent = parseFileContent(moduleResultString, {\n projectRequire: options?.projectRequire,\n envVarOptions: options?.envVarOptions,\n additionalEnvVars: options?.additionalEnvVars,\n mocks: options?.mocks,\n aliases: options?.aliases,\n });\n\n if (typeof fileContent === 'undefined') {\n logger(`File could not be loaded. Path : ${filePath}`);\n return undefined;\n }\n\n return fileContent;\n } catch (error) {\n logger(\n [\n `Error: ${(error as Error).message} - `,\n JSON.stringify((error as Error).stack, null, 2),\n ],\n {\n level: 'error',\n }\n );\n }\n};\n\n/**\n * Load the content declaration from the given path\n *\n * Accepts JSON, JS, MJS and TS files as configuration\n */\nexport const loadExternalFile = async (\n filePath: string,\n options?: LoadExternalFileOptions\n): Promise<any | undefined> => {\n const fileExtension = extname(filePath);\n\n try {\n if (\n fileExtension === '.json' ||\n fileExtension === '.json5' ||\n fileExtension === '.jsonc'\n ) {\n // Remove cache to force getting fresh content\n const fileContent = await readFile(filePath, 'utf-8');\n return parseJSON5(fileContent);\n }\n\n // Rest is JS, MJS or TS\n const code = await readFile(filePath, 'utf-8');\n\n const moduleResultString: string | undefined = await transpileTSToCJS(\n code,\n filePath,\n options?.buildOptions\n );\n\n if (!moduleResultString) {\n logger('File could not be loaded.', { level: 'error' });\n return undefined;\n }\n\n const fileContent = parseFileContent(moduleResultString, {\n projectRequire: options?.projectRequire,\n envVarOptions: options?.envVarOptions,\n additionalEnvVars: options?.additionalEnvVars,\n mocks: options?.mocks,\n aliases: options?.aliases,\n });\n\n if (typeof fileContent === 'undefined') {\n logger(`File could not be loaded. Path : ${colorizePath(filePath)}`);\n return undefined;\n }\n\n return fileContent;\n } catch (error) {\n if (options?.logError ?? true) {\n logger(\n [\n `Error: ${(error as Error).message} - `,\n JSON.stringify((error as Error).stack, null, 2),\n ],\n {\n level: 'error',\n }\n );\n }\n }\n};\n"],"mappings":"yTAcA,MAAM,EAAaA,EAAM,OAAUA,EAAc,SAAS,MAa7C,GACX,EACA,IACoB,CACpB,IAAM,GAAA,EAAA,EAAA,SAAwB,EAAS,EAAI,QAE3C,GAAI,CACF,GACE,IAAkB,SAClB,IAAkB,UAClB,IAAkB,SAGlB,OAAO,GAAA,EAAA,EAAA,cAAwB,EAAU,QAAQ,CAAC,CAMpD,IAAM,EAAyCC,EAAAA,sBAAAA,EAAAA,EAAAA,cAFrB,EAAU,QAAQ,CAI1C,EACD,CAED,GAAI,CAAC,EAAoB,CACvB,EAAA,OAAO,4BAA6B,CAAE,MAAO,QAAS,CAAC,CACvD,OAGF,IAAM,EAAcC,EAAAA,iBAAiB,EAAoB,CACvD,eAAgB,GAAS,eACzB,cAAe,GAAS,cACxB,kBAAmB,GAAS,kBAC5B,MAAO,GAAS,MAChB,QAAS,GAAS,QACnB,CAAC,CAEF,GAAW,IAAgB,OAAa,CACtC,EAAA,OAAO,oCAAoC,IAAW,CACtD,OAGF,OAAO,QACA,EAAO,CACd,EAAA,OACE,CACE,UAAW,EAAgB,QAAQ,KACnC,KAAK,UAAW,EAAgB,MAAO,KAAM,EAAE,CAChD,CACD,CACE,MAAO,QACR,CACF,GASQ,EAAmB,MAC9B,EACA,IAC6B,CAC7B,IAAM,GAAA,EAAA,EAAA,SAAwB,EAAS,CAEvC,GAAI,CACF,GACE,IAAkB,SAClB,IAAkB,UAClB,IAAkB,SAIlB,OAAO,EADa,MAAA,EAAA,EAAA,UAAe,EAAU,QAAQ,CACvB,CAMhC,IAAM,EAAyC,MAAMC,EAAAA,iBAFxC,MAAA,EAAA,EAAA,UAAe,EAAU,QAAQ,CAI5C,EACA,GAAS,aACV,CAED,GAAI,CAAC,EAAoB,CACvB,EAAA,OAAO,4BAA6B,CAAE,MAAO,QAAS,CAAC,CACvD,OAGF,IAAM,EAAcD,EAAAA,iBAAiB,EAAoB,CACvD,eAAgB,GAAS,eACzB,cAAe,GAAS,cACxB,kBAAmB,GAAS,kBAC5B,MAAO,GAAS,MAChB,QAAS,GAAS,QACnB,CAAC,CAEF,GAAW,IAAgB,OAAa,CACtC,EAAA,OAAO,oCAAoCE,EAAAA,aAAa,EAAS,GAAG,CACpE,OAGF,OAAO,QACA,EAAO,EACV,GAAS,UAAY,KACvB,EAAA,OACE,CACE,UAAW,EAAgB,QAAQ,KACnC,KAAK,UAAW,EAAgB,MAAO,KAAM,EAAE,CAChD,CACD,CACE,MAAO,QACR,CACF"}
1
+ {"version":3,"file":"loadExternalFile.cjs","names":["JSON5","transpileTSToCJSSync","parseFileContent","transpileTSToCJS","colorizePath"],"sources":["../../../src/loadExternalFile/loadExternalFile.ts"],"sourcesContent":["import { readFileSync } from 'node:fs';\nimport { readFile } from 'node:fs/promises';\nimport { extname } from 'node:path';\nimport type { IntlayerConfig } from '@intlayer/types/config';\nimport JSON5 from 'json5';\nimport { colorizePath, logger } from '../logger';\nimport {\n parseFileContent,\n type SandBoxContextOptions,\n} from './parseFileContent';\nimport {\n type TranspileOptions,\n transpileTSToCJS,\n transpileTSToCJSSync,\n} from './transpileTSToCJS';\n\n// CJS MJS cross usage\nconst parseJSON5 = JSON5.parse || (JSON5 as any).default?.parse;\n\nexport type LoadExternalFileOptions = {\n configuration?: IntlayerConfig;\n buildOptions?: TranspileOptions;\n logError?: boolean;\n} & SandBoxContextOptions;\n\n/**\n * Load the content declaration from the given path\n *\n * Accepts JSON, JS, MJS and TS files as configuration\n */\nexport const loadExternalFileSync = (\n filePath: string,\n options?: LoadExternalFileOptions\n): any | undefined => {\n const fileExtension = extname(filePath) || '.json';\n\n try {\n if (\n fileExtension === '.json' ||\n fileExtension === '.json5' ||\n fileExtension === '.jsonc'\n ) {\n // Assume JSON\n return parseJSON5(readFileSync(filePath, 'utf-8'));\n }\n\n // Rest is JS, MJS or TS\n const code = readFileSync(filePath, 'utf-8');\n\n const moduleResultString: string | undefined = transpileTSToCJSSync(\n code,\n filePath,\n options?.buildOptions\n );\n\n if (!moduleResultString) {\n logger('File could not be loaded.', { level: 'error' });\n return undefined;\n }\n\n const fileContent = parseFileContent(moduleResultString, {\n projectRequire: options?.projectRequire,\n envVarOptions: options?.envVarOptions,\n additionalEnvVars: options?.additionalEnvVars,\n mocks: options?.mocks,\n aliases: options?.aliases,\n });\n\n if (typeof fileContent === 'undefined') {\n logger(`File could not be loaded. Path : ${filePath}`);\n return undefined;\n }\n\n return fileContent;\n } catch (error) {\n logger(\n [\n `Error: ${(error as Error).message} - `,\n JSON.stringify((error as Error).stack, null, 2),\n ],\n {\n level: 'error',\n }\n );\n }\n};\n\n/**\n * Load the content declaration from the given path\n *\n * Accepts JSON, JS, MJS and TS files as configuration\n */\nexport const loadExternalFile = async (\n filePath: string,\n options?: LoadExternalFileOptions\n): Promise<any | undefined> => {\n const fileExtension = extname(filePath);\n\n try {\n if (\n fileExtension === '.json' ||\n fileExtension === '.json5' ||\n fileExtension === '.jsonc'\n ) {\n // Remove cache to force getting fresh content\n const fileContent = await readFile(filePath, 'utf-8');\n return parseJSON5(fileContent);\n }\n\n // Rest is JS, MJS or TS\n const code = await readFile(filePath, 'utf-8');\n\n const moduleResultString: string | undefined = await transpileTSToCJS(\n code,\n filePath,\n options?.buildOptions\n );\n\n if (!moduleResultString) {\n logger('File could not be loaded.', { level: 'error' });\n return undefined;\n }\n\n const fileContent = parseFileContent(moduleResultString, {\n projectRequire: options?.projectRequire,\n envVarOptions: options?.envVarOptions,\n additionalEnvVars: options?.additionalEnvVars,\n mocks: options?.mocks,\n aliases: options?.aliases,\n });\n\n if (typeof fileContent === 'undefined') {\n logger(`File could not be loaded. Path : ${colorizePath(filePath)}`);\n return undefined;\n }\n\n return fileContent;\n } catch (error) {\n if (options?.logError ?? true) {\n logger(\n [\n `Error: ${(error as Error).message} - `,\n JSON.stringify((error as Error).stack, null,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,iBAAiB,EAAoB,CACvD,eAAgB,GAAS,eACzB,cAAe,GAAS,cACxB,kBAAmB,GAAS,kBAC5B,MAAO,GAAS,MAChB,QAAS,GAAS,QACnB,CAAC,CAEF,GAAW,IAAgB,OAAa,CACtC,EAAA,OAAO,oCAAoCE,EAAAA,aAAa,EAAS,GAAG,CACpE,OAGF,OAAO,QACA,EAAO,EACV,GAAS,UAAY,KACvB,EAAA,OACE,CACE,UAAW,EAAgB,QAAQ,KACnC,KAAK,UAAW,EAAgB,MAAO,KAAM,EAAE,CAChD,CACD,CACE,MAAO,QACR,CACF"}
@@ -1,2 +1,2 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`../chunk-D-qHiVGv.cjs`),t=require(`../utils/ESMxCJSHelpers.cjs`),n=require(`../loadEnvFile.cjs`);let r=require(`node:vm`),i=require(`esbuild`);i=e.n(i);const a=e=>{let{envVarOptions:r,projectRequire:a,additionalEnvVars:o,mocks:s,aliases:c}=e??{},l={},u=typeof a==`function`?a:t.getProjectRequire(),d=(()=>{let e=Object.assign({esbuild:i},s),t=Object.assign({},c),n=function(n){let r=t?.[n]?t[n]:n;return e&&Object.hasOwn(e,r)?e[r]:r!==n&&e&&Object.hasOwn(e,n)?e[n]:u(r)};return n.resolve=u.resolve.bind(u),n.main=u.main,n.extensions=u.extensions,n.cache=u.cache,n})();try{l={React:u(`react`)}}catch{l={React:{createElement:(e,t,...n)=>({type:e,props:{...t,children:n.length<=1?n[0]:n}}),Fragment:Symbol.for(`react.fragment`)}}}let f={exports:{default:{}},module:{exports:{}},process:{...process,env:{...process.env,...n.loadEnvFile(r),...o}},console,require:d,...l};return Object.getOwnPropertyNames(globalThis).forEach(e=>{e in f||(f[e]=globalThis[e])}),f},o=(e,t)=>{let n=a(t);(0,r.runInNewContext)(`"use strict";\n${e}`,n);let i=[n.exports?.default,n.module?.exports?.defaults,n.module?.exports?.default,n.module?.exports];for(let e of i)if(e&&typeof e==`object`&&Object.keys(e).length>0)return e};exports.getSandBoxContext=a,exports.parseFileContent=o;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`../chunk-Bmb41Sf3.cjs`),t=require(`../utils/ESMxCJSHelpers.cjs`),n=require(`../loadEnvFile.cjs`);let r=require(`node:vm`),i=require(`esbuild`);i=e.t(i);const a=e=>{let{envVarOptions:r,projectRequire:a,additionalEnvVars:o,mocks:s,aliases:c}=e??{},l={},u=typeof a==`function`?a:t.getProjectRequire(),d=(()=>{let e=Object.assign({esbuild:i},s),t=Object.assign({},c),n=function(n){let r=t?.[n]?t[n]:n;return e&&Object.hasOwn(e,r)?e[r]:r!==n&&e&&Object.hasOwn(e,n)?e[n]:u(r)};return n.resolve=u.resolve.bind(u),n.main=u.main,n.extensions=u.extensions,n.cache=u.cache,n})();try{l={React:u(`react`)}}catch{l={React:{createElement:(e,t,...n)=>({type:e,props:{...t,children:n.length<=1?n[0]:n}}),Fragment:Symbol.for(`react.fragment`)}}}let f={exports:{default:{}},module:{exports:{}},process:{...process,env:{...process.env,...n.loadEnvFile(r),...o}},console,require:d,...l};return Object.getOwnPropertyNames(globalThis).forEach(e=>{e in f||(f[e]=globalThis[e])}),f},o=(e,t)=>{let n=a(t);(0,r.runInNewContext)(`"use strict";\n${e}`,n);let i=[n.exports?.default,n.module?.exports?.defaults,n.module?.exports?.default,n.module?.exports];for(let e of i)if(e&&typeof e==`object`&&Object.keys(e).length>0)return e};exports.getSandBoxContext=a,exports.parseFileContent=o;
2
2
  //# sourceMappingURL=parseFileContent.cjs.map
@@ -1,2 +1,2 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`../chunk-D-qHiVGv.cjs`);const e=require(`../utils/getPackageJsonPath.cjs`),t=require(`./bundleFile.cjs`);let n=require(`node:fs`),r=require(`node:path`),i=require(`esbuild`),a=require(`node:url`);const o=t=>{let i=(0,r.join)(e.getPackageJsonPath((0,r.dirname)(t)).baseDir,`tsconfig.json`);return(0,n.existsSync)(i)?i:void 0},s=e=>({loader:{".js":`js`,".jsx":`jsx`,".mjs":`js`,".ts":`ts`,".tsx":`tsx`,".cjs":`js`,".json":`json`,".md":`text`,".mdx":`text`},format:`cjs`,target:`node20`,platform:`node`,write:!1,packages:`external`,bundle:!0,tsconfig:o(e),define:{"import.meta.url":JSON.stringify((0,a.pathToFileURL)(e).href)}}),c=(e,n,a)=>(0,i.buildSync)({stdin:{contents:e,loader:t.getLoader((0,r.extname)(n)),resolveDir:(0,r.dirname)(n),sourcefile:n},...s(n),...a}).outputFiles?.[0].text,l=async(e,n,a)=>(await(0,i.build)({stdin:{contents:e,loader:t.getLoader((0,r.extname)(n)),resolveDir:(0,r.dirname)(n),sourcefile:n},...s(n),...a})).outputFiles?.[0].text;exports.transpileTSToCJS=l,exports.transpileTSToCJSSync=c;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`../chunk-Bmb41Sf3.cjs`);const e=require(`../utils/getPackageJsonPath.cjs`),t=require(`./bundleFile.cjs`);let n=require(`node:fs`),r=require(`node:path`),i=require(`esbuild`),a=require(`node:url`);const o=t=>{let i=(0,r.join)(e.getPackageJsonPath((0,r.dirname)(t)).baseDir,`tsconfig.json`);return(0,n.existsSync)(i)?i:void 0},s=e=>({loader:{".js":`js`,".jsx":`jsx`,".mjs":`js`,".ts":`ts`,".tsx":`tsx`,".cjs":`js`,".json":`json`,".md":`text`,".mdx":`text`},format:`cjs`,target:`node20`,platform:`node`,write:!1,packages:`external`,bundle:!0,tsconfig:o(e),define:{"import.meta.url":JSON.stringify((0,a.pathToFileURL)(e).href)}}),c=(e,n,a)=>{let o=t.getLoader((0,r.extname)(n)),{esbuildInstance:c,...l}=a??{};return(c?.buildSync??i.buildSync)({stdin:{contents:e,loader:o,resolveDir:(0,r.dirname)(n),sourcefile:n},...s(n),...l}).outputFiles?.[0].text},l=async(e,n,a)=>{let o=t.getLoader((0,r.extname)(n)),{esbuildInstance:c,...l}=a??{};return(await(c?.build??i.build)({stdin:{contents:e,loader:o,resolveDir:(0,r.dirname)(n),sourcefile:n},...s(n),...l})).outputFiles?.[0].text};exports.transpileTSToCJS=l,exports.transpileTSToCJSSync=c;
2
2
  //# sourceMappingURL=transpileTSToCJS.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"transpileTSToCJS.cjs","names":["getPackageJsonPath","getLoader"],"sources":["../../../src/loadExternalFile/transpileTSToCJS.ts"],"sourcesContent":["import { existsSync } from 'node:fs';\nimport { dirname, extname, join } from 'node:path';\nimport { pathToFileURL } from 'node:url';\nimport { type BuildOptions, type BuildResult, build, buildSync } from 'esbuild';\nimport { getPackageJsonPath } from '../utils/getPackageJsonPath';\nimport { getLoader } from './bundleFile';\n\nconst getTsConfigPath = (filePath: string): string | undefined => {\n const tsconfigPath = join(\n getPackageJsonPath(dirname(filePath)).baseDir,\n 'tsconfig.json'\n );\n\n // Only return the tsconfig path if it exists\n return existsSync(tsconfigPath) ? tsconfigPath : undefined;\n};\n\nconst getTransformationOptions = (filePath: string): BuildOptions => ({\n loader: {\n '.js': 'js',\n '.jsx': 'jsx',\n '.mjs': 'js',\n '.ts': 'ts',\n '.tsx': 'tsx',\n '.cjs': 'js',\n '.json': 'json',\n '.md': 'text',\n '.mdx': 'text',\n },\n format: 'cjs',\n target: 'node20',\n platform: 'node',\n write: false,\n packages: 'external',\n bundle: true,\n tsconfig: getTsConfigPath(filePath),\n define: {\n 'import.meta.url': JSON.stringify(pathToFileURL(filePath).href),\n },\n});\n\nexport const transpileTSToCJSSync = (\n code: string,\n filePath: string,\n options?: BuildOptions\n): string | undefined => {\n const extension = extname(filePath);\n const loader = getLoader(extension);\n\n const moduleResult: BuildResult = buildSync({\n stdin: {\n contents: code,\n loader,\n resolveDir: dirname(filePath), // Add resolveDir to resolve imports relative to the file's location\n sourcefile: filePath, // Add sourcefile for better error messages\n },\n ...getTransformationOptions(filePath),\n ...options,\n });\n\n const moduleResultString = moduleResult.outputFiles?.[0].text;\n\n return moduleResultString;\n};\n\nexport const transpileTSToCJS = async (\n code: string,\n filePath: string,\n options?: BuildOptions\n): Promise<string | undefined> => {\n const extension = extname(filePath);\n const loader = getLoader(extension);\n\n const moduleResult: BuildResult = await build({\n stdin: {\n contents: code,\n loader,\n resolveDir: dirname(filePath), // Add resolveDir to resolve imports relative to the file's location\n sourcefile: filePath, // Add sourcefile for better error messages\n },\n ...getTransformationOptions(filePath),\n ...options,\n });\n\n const moduleResultString = moduleResult.outputFiles?.[0].text;\n\n return moduleResultString;\n};\n"],"mappings":"gRAOA,MAAM,EAAmB,GAAyC,CAChE,IAAM,GAAA,EAAA,EAAA,MACJA,EAAAA,oBAAAA,EAAAA,EAAAA,SAA2B,EAAS,CAAC,CAAC,QACtC,gBACD,CAGD,OAAA,EAAA,EAAA,YAAkB,EAAa,CAAG,EAAe,IAAA,IAG7C,EAA4B,IAAoC,CACpE,OAAQ,CACN,MAAO,KACP,OAAQ,MACR,OAAQ,KACR,MAAO,KACP,OAAQ,MACR,OAAQ,KACR,QAAS,OACT,MAAO,OACP,OAAQ,OACT,CACD,OAAQ,MACR,OAAQ,SACR,SAAU,OACV,MAAO,GACP,SAAU,WACV,OAAQ,GACR,SAAU,EAAgB,EAAS,CACnC,OAAQ,CACN,kBAAmB,KAAK,WAAA,EAAA,EAAA,eAAwB,EAAS,CAAC,KAAK,CAChE,CACF,EAEY,GACX,EACA,EACA,KAkBA,EAAA,EAAA,WAb4C,CAC1C,MAAO,CACL,SAAU,EACV,OALWC,EAAAA,WAAAA,EAAAA,EAAAA,SADW,EAAS,CACA,CAM/B,YAAA,EAAA,EAAA,SAAoB,EAAS,CAC7B,WAAY,EACb,CACD,GAAG,EAAyB,EAAS,CACrC,GAAG,EACJ,CAAC,CAEsC,cAAc,GAAG,KAK9C,EAAmB,MAC9B,EACA,EACA,KAKkC,MAAA,EAAA,EAAA,OAAY,CAC5C,MAAO,CACL,SAAU,EACV,OALWA,EAAAA,WAAAA,EAAAA,EAAAA,SADW,EAAS,CACA,CAM/B,YAAA,EAAA,EAAA,SAAoB,EAAS,CAC7B,WAAY,EACb,CACD,GAAG,EAAyB,EAAS,CACrC,GAAG,EACJ,CAAC,EAEsC,cAAc,GAAG"}
1
+ {"version":3,"file":"transpileTSToCJS.cjs","names":["getPackageJsonPath","getLoader","buildSync","build"],"sources":["../../../src/loadExternalFile/transpileTSToCJS.ts"],"sourcesContent":["import { existsSync } from 'node:fs';\nimport { dirname, extname, join } from 'node:path';\nimport { pathToFileURL } from 'node:url';\nimport { type BuildOptions, type BuildResult, build, buildSync } from 'esbuild';\nimport { getPackageJsonPath } from '../utils/getPackageJsonPath';\nimport { getLoader } from './bundleFile';\n\nexport type TranspileOptions = BuildOptions & {\n /**\n * Optional custom esbuild instance to use for transpilation.\n * Useful in environments (e.g. VS Code extensions) where the bundled\n * esbuild binary may not match the host platform.\n * When provided, its `buildSync`/`build` methods are used instead of\n * the ones imported from the `esbuild` package.\n */\n esbuildInstance?: typeof import('esbuild');\n};\n\nconst getTsConfigPath = (filePath: string): string | undefined => {\n const tsconfigPath = join(\n getPackageJsonPath(dirname(filePath)).baseDir,\n 'tsconfig.json'\n );\n\n // Only return the tsconfig path if it exists\n return existsSync(tsconfigPath) ? tsconfigPath : undefined;\n};\n\nconst getTransformationOptions = (filePath: string): BuildOptions => ({\n loader: {\n '.js': 'js',\n '.jsx': 'jsx',\n '.mjs': 'js',\n '.ts': 'ts',\n '.tsx': 'tsx',\n '.cjs': 'js',\n '.json': 'json',\n '.md': 'text',\n '.mdx': 'text',\n },\n format: 'cjs',\n target: 'node20',\n platform: 'node',\n write: false,\n packages: 'external',\n bundle: true,\n tsconfig: getTsConfigPath(filePath),\n define: {\n 'import.meta.url': JSON.stringify(pathToFileURL(filePath).href),\n },\n});\n\nexport const transpileTSToCJSSync = (\n code: string,\n filePath: string,\n options?: TranspileOptions\n): string | undefined => {\n const extension = extname(filePath);\n const loader = getLoader(extension);\n\n const { esbuildInstance, ...buildOptions } = options ?? {};\n const esbuildBuildSync = esbuildInstance?.buildSync ?? buildSync;\n\n const moduleResult: BuildResult = esbuildBuildSync({\n stdin: {\n contents: code,\n loader,\n resolveDir: dirname(filePath), // Add resolveDir to resolve imports relative to the file's location\n sourcefile: filePath, // Add sourcefile for better error messages\n },\n ...getTransformationOptions(filePath),\n ...buildOptions,\n });\n\n const moduleResultString = moduleResult.outputFiles?.[0].text;\n\n return moduleResultString;\n};\n\nexport const transpileTSToCJS = async (\n code: string,\n filePath: string,\n options?: TranspileOptions\n): Promise<string | undefined> => {\n const extension = extname(filePath);\n const loader = getLoader(extension);\n\n const { esbuildInstance, ...buildOptions } = options ?? {};\n const esbuildBuild = esbuildInstance?.build ?? build;\n\n const moduleResult: BuildResult = await esbuildBuild({\n stdin: {\n contents: code,\n loader,\n resolveDir: dirname(filePath), // Add resolveDir to resolve imports relative to the file's location\n sourcefile: filePath, // Add sourcefile for better error messages\n },\n ...getTransformationOptions(filePath),\n ...buildOptions,\n });\n\n const moduleResultString = moduleResult.outputFiles?.[0].text;\n\n return moduleResultString;\n};\n"],"mappings":"gRAkBA,MAAM,EAAmB,GAAyC,CAChE,IAAM,GAAA,EAAA,EAAA,MACJA,EAAAA,oBAAAA,EAAAA,EAAAA,SAA2B,EAAS,CAAC,CAAC,QACtC,gBACD,CAGD,OAAA,EAAA,EAAA,YAAkB,EAAa,CAAG,EAAe,IAAA,IAG7C,EAA4B,IAAoC,CACpE,OAAQ,CACN,MAAO,KACP,OAAQ,MACR,OAAQ,KACR,MAAO,KACP,OAAQ,MACR,OAAQ,KACR,QAAS,OACT,MAAO,OACP,OAAQ,OACT,CACD,OAAQ,MACR,OAAQ,SACR,SAAU,OACV,MAAO,GACP,SAAU,WACV,OAAQ,GACR,SAAU,EAAgB,EAAS,CACnC,OAAQ,CACN,kBAAmB,KAAK,WAAA,EAAA,EAAA,eAAwB,EAAS,CAAC,KAAK,CAChE,CACF,EAEY,GACX,EACA,EACA,IACuB,CAEvB,IAAM,EAASC,EAAAA,WAAAA,EAAAA,EAAAA,SADW,EAAS,CACA,CAE7B,CAAE,kBAAiB,GAAG,GAAiB,GAAW,EAAE,CAgB1D,OAfyB,GAAiB,WAAaC,EAAAA,WAEJ,CACjD,MAAO,CACL,SAAU,EACV,SACA,YAAA,EAAA,EAAA,SAAoB,EAAS,CAC7B,WAAY,EACb,CACD,GAAG,EAAyB,EAAS,CACrC,GAAG,EACJ,CAAC,CAEsC,cAAc,GAAG,MAK9C,EAAmB,MAC9B,EACA,EACA,IACgC,CAEhC,IAAM,EAASD,EAAAA,WAAAA,EAAAA,EAAAA,SADW,EAAS,CACA,CAE7B,CAAE,kBAAiB,GAAG,GAAiB,GAAW,EAAE,CAgB1D,OAbkC,MAFb,GAAiB,OAASE,EAAAA,OAEM,CACnD,MAAO,CACL,SAAU,EACV,SACA,YAAA,EAAA,EAAA,SAAoB,EAAS,CAC7B,WAAY,EACb,CACD,GAAG,EAAyB,EAAS,CACrC,GAAG,EACJ,CAAC,EAEsC,cAAc,GAAG"}
@@ -1,2 +1,2 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});let e;const t=t=>{e=t},n=t=>e===void 0?t:e,r=(e,t)=>{let r=t?.isVerbose??!1,i=t?.config?.mode??`default`,a=t?.level??`info`,o=n(t?.config?.prefix),s=t?.config?.log??console.log,c=t?.config?.info??console.info,l=t?.config?.warn??console.warn,u=t?.config?.error??console.error,d=t?.config?.debug??console.debug;if(i===`disabled`||r&&i!==`verbose`)return;let f=o?[o,...[e].flat()]:[e].flat();if(a===`debug`)return d(...f);if(a===`info`)return c(...f);if(a===`warn`)return l(...f);if(a===`error`)return u(...f);s(...f)};let i=function(e){return e.RESET=`\x1B[0m`,e.GREY=`\x1B[90m`,e.GREY_DARK=`\x1B[38;5;239m`,e.GREY_LIGHT=`\x1B[38;5;252m`,e.BLUE=`\x1B[34m`,e.RED=`\x1B[31m`,e.GREEN=`\x1B[32m`,e.YELLOW=`\x1B[38;5;226m`,e.MAGENTA=`\x1B[35m`,e.BEIGE=`\x1B[38;5;3m`,e.ORANGE=`\x1B[38;5;208m`,e.CYAN=`\x1B[36m`,e.WHITE=`\x1B[37m`,e.BOLD=`\x1B[1m`,e}({});const a=[`⠋`,`⠙`,`⠹`,`⠸`,`⠼`,`⠴`,`⠦`,`⠧`,`⠇`,`⠏`],o=(e,t)=>(n,i)=>r(n,{...i??{},config:{...e?.log,...t?.config,...i?.config??{}}}),s=(e,t,n)=>t?`${t}${e}${n?typeof n==`boolean`?i.RESET:n:i.RESET}`:e,c=(e,t=i.GREEN,n=i.RESET)=>[e].flat().map(e=>s(e,t,n)).join(`, `),l=(e,t=i.BEIGE,n=i.RESET)=>[e].flat().map(e=>s(e,t,n)).join(`, `),u=(e,t=i.GREY,n=i.RESET)=>[e].flat().map(e=>s(e,t,n)).join(`, `),d=(e,t={zero:i.BLUE,one:i.BLUE,two:i.BLUE,few:i.BLUE,many:i.BLUE,other:i.BLUE})=>{if(e===0){let n=t.zero??i.GREEN;return s(e.toString(),n)}let n=t[new Intl.PluralRules(`en`).select(Number(e))];return s(e.toString(),n)},f=e=>e.replace(/\x1b\[[0-9;]*m/g,``),p=e=>{let t=0;return typeof e==`number`&&(t=e),typeof e==`string`&&(t=e.length),Array.isArray(e)&&e.every(e=>typeof e==`string`)&&(t=Math.max(...e.map(e=>e.length))),Array.isArray(e)&&e.every(e=>typeof e==`number`)&&(t=Math.max(...e)),Math.max(t,0)},m={colSize:0,minSize:0,maxSize:1/0,pad:`right`,padChar:`0`},h=(e,t)=>[e].flat().map(e=>{let{colSize:n,minSize:r,maxSize:i,pad:a}={...m,...t??{}},o=p(n),s=Math.max(r,Math.min(i,o-f(e).length));return a===`left`?`${` `.repeat(s)}${e}`:`${e}${` `.repeat(s)}`}).join(``),g=s(`✗`,i.RED),_=s(`✓`,i.GREEN),v=s(`⏲`,i.BLUE);exports.ANSIColors=i,exports.clock=v,exports.colon=h,exports.colorize=s,exports.colorizeKey=l,exports.colorizeLocales=c,exports.colorizeNumber=d,exports.colorizePath=u,exports.getAppLogger=o,exports.getPrefix=n,exports.logger=r,exports.removeColor=f,exports.setPrefix=t,exports.spinnerFrames=a,exports.v=_,exports.x=g;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./colors.cjs`);let t;const n=e=>{t=e},r=e=>t===void 0?e:t,i=(e,t)=>{let n=t?.isVerbose??!1,i=t?.config?.mode??`default`,a=t?.level??`info`,o=r(t?.config?.prefix),s=t?.config?.log??console.log,c=t?.config?.info??console.info,l=t?.config?.warn??console.warn,u=t?.config?.error??console.error,d=t?.config?.debug??console.debug;if(i===`disabled`||n&&i!==`verbose`)return;let f=o?[o,...[e].flat()]:[e].flat();if(a===`debug`)return d(...f);if(a===`info`)return c(...f);if(a===`warn`)return l(...f);if(a===`error`)return u(...f);s(...f)},a=[`⠋`,`⠙`,`⠹`,`⠸`,`⠼`,`⠴`,`⠦`,`⠧`,`⠇`,`⠏`],o=(e,t)=>(n,r)=>i(n,{...r??{},config:{...e?.log,...t?.config,...r?.config??{}}}),s=(t,n,r)=>n?`${n}${t}${r?typeof r==`boolean`?e.RESET:r:e.RESET}`:t,c=(t,n=e.GREEN,r=e.RESET)=>[t].flat().map(e=>s(e,n,r)).join(`, `),l=(t,n=e.BEIGE,r=e.RESET)=>[t].flat().map(e=>s(e,n,r)).join(`, `),u=(t,n=e.GREY,r=e.RESET)=>[t].flat().map(e=>s(e,n,r)).join(`, `),d=(t,n={zero:e.BLUE,one:e.BLUE,two:e.BLUE,few:e.BLUE,many:e.BLUE,other:e.BLUE})=>{if(t===0){let e=n.zero??`\x1B[32m`;return s(t.toString(),e)}let r=n[new Intl.PluralRules(`en`).select(Number(t))];return s(t.toString(),r)},f=e=>e.replace(/\x1b\[[0-9;]*m/g,``),p=e=>{let t=0;return typeof e==`number`&&(t=e),typeof e==`string`&&(t=e.length),Array.isArray(e)&&e.every(e=>typeof e==`string`)&&(t=Math.max(...e.map(e=>e.length))),Array.isArray(e)&&e.every(e=>typeof e==`number`)&&(t=Math.max(...e)),Math.max(t,0)},m={colSize:0,minSize:0,maxSize:1/0,pad:`right`,padChar:`0`},h=(e,t)=>[e].flat().map(e=>{let{colSize:n,minSize:r,maxSize:i,pad:a}={...m,...t??{}},o=p(n),s=Math.max(r,Math.min(i,o-f(e).length));return a===`left`?`${` `.repeat(s)}${e}`:`${e}${` `.repeat(s)}`}).join(``),g=s(`✗`,e.RED),_=s(`✓`,e.GREEN),v=s(`⏲`,e.BLUE);exports.clock=v,exports.colon=h,exports.colorize=s,exports.colorizeKey=l,exports.colorizeLocales=c,exports.colorizeNumber=d,exports.colorizePath=u,exports.getAppLogger=o,exports.getPrefix=r,exports.logger=i,exports.removeColor=f,exports.setPrefix=n,exports.spinnerFrames=a,exports.v=_,exports.x=g;
2
2
  //# sourceMappingURL=logger.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"logger.cjs","names":[],"sources":["../../src/logger.ts"],"sourcesContent":["import type { Locale } from '@intlayer/types/allLocales';\nimport type { CustomIntlayerConfig } from '@intlayer/types/config';\n\nexport type Details = {\n isVerbose?: boolean;\n level?: 'info' | 'warn' | 'error' | 'debug';\n config?: CustomIntlayerConfig['log'];\n};\n\nexport type Logger = (content: any, details?: Details) => void;\n\nlet loggerPrefix: string | undefined;\n\nexport const setPrefix = (prefix: string | undefined) => {\n loggerPrefix = prefix;\n};\n\nexport const getPrefix = (configPrefix?: string): string | undefined => {\n if (typeof loggerPrefix !== 'undefined') {\n return loggerPrefix;\n }\n\n return configPrefix;\n};\n\nexport const logger: Logger = (content, details) => {\n const isVerbose = details?.isVerbose ?? false;\n const mode = details?.config?.mode ?? 'default';\n const level = details?.level ?? 'info';\n const prefix = getPrefix(details?.config?.prefix);\n const log = details?.config?.log ?? console.log;\n const info = details?.config?.info ?? console.info;\n const warn = details?.config?.warn ?? console.warn;\n const error = details?.config?.error ?? console.error;\n const debug = details?.config?.debug ?? console.debug;\n\n if (mode === 'disabled') return;\n\n if (isVerbose && mode !== 'verbose') return;\n\n const flatContent = prefix ? [prefix, ...[content].flat()] : [content].flat();\n\n if (level === 'debug') {\n return debug(...flatContent);\n }\n\n if (level === 'info') {\n return info(...flatContent);\n }\n\n if (level === 'warn') {\n return warn(...flatContent);\n }\n\n if (level === 'error') {\n return error(...flatContent);\n }\n\n log(...flatContent);\n};\n\nexport enum ANSIColors {\n RESET = '\\x1b[0m',\n GREY = '\\x1b[90m',\n GREY_DARK = '\\x1b[38;5;239m',\n GREY_LIGHT = '\\x1b[38;5;252m',\n BLUE = '\\x1b[34m',\n RED = '\\x1b[31m',\n GREEN = '\\x1b[32m',\n YELLOW = '\\x1b[38;5;226m',\n MAGENTA = '\\x1b[35m',\n BEIGE = '\\x1b[38;5;3m',\n ORANGE = '\\x1b[38;5;208m',\n CYAN = '\\x1b[36m',\n WHITE = '\\x1b[37m',\n BOLD = '\\x1b[1m',\n}\n\nexport const spinnerFrames = ['⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏'];\n\n/**\n * The appLogger function takes the logger and merges it with the configuration from the intlayer config file.\n * It allows overriding the default configuration by passing a config object in the details parameter.\n * The configuration is merged with the default configuration from the intlayer config file.\n */\nexport const getAppLogger =\n (configuration?: CustomIntlayerConfig, globalDetails?: Details) =>\n (content: any, details?: Details) =>\n logger(content, {\n ...(details ?? {}),\n config: {\n ...configuration?.log,\n ...globalDetails?.config,\n ...(details?.config ?? {}),\n },\n });\n\nexport const colorize = (\n s: string,\n color?: ANSIColors,\n reset?: boolean | ANSIColors\n): string =>\n color\n ? `${color}${s}${reset ? (typeof reset === 'boolean' ? ANSIColors.RESET : reset) : ANSIColors.RESET}`\n : s;\n\nexport const colorizeLocales = (\n locales: Locale | Locale[],\n color = ANSIColors.GREEN,\n reset: boolean | ANSIColors = ANSIColors.RESET\n) =>\n [locales]\n .flat()\n .map((locale) => colorize(locale, color, reset))\n .join(`, `);\n\nexport const colorizeKey = (\n keyPath: string | string[],\n color = ANSIColors.BEIGE,\n reset: boolean | ANSIColors = ANSIColors.RESET\n) =>\n [keyPath]\n .flat()\n .map((key) => colorize(key, color, reset))\n .join(`, `);\n\nexport const colorizePath = (\n path: string | string[],\n color = ANSIColors.GREY,\n reset: boolean | ANSIColors = ANSIColors.RESET\n) =>\n [path]\n .flat()\n .map((p) => colorize(p, color, reset))\n .join(`, `);\n\n/**\n * Colorize numeric value using Intl.NumberFormat and optional ANSI colors.\n *\n * Examples:\n * colorizeNumber(2, [{ pluralRule: 'one' , color: ANSIColors.GREEN}, { pluralRule: 'other' , color: ANSIColors.RED}]) // \"'\\x1b[31m2\\x1b[0m\"\n */\nexport const colorizeNumber = (\n number: number | string,\n options: Partial<Record<Intl.LDMLPluralRule, ANSIColors>> = {\n zero: ANSIColors.BLUE,\n one: ANSIColors.BLUE,\n two: ANSIColors.BLUE,\n few: ANSIColors.BLUE,\n many: ANSIColors.BLUE,\n other: ANSIColors.BLUE,\n }\n): string => {\n if (number === 0) {\n const color = options.zero ?? ANSIColors.GREEN;\n return colorize(number.toString(), color);\n }\n\n const rule = new Intl.PluralRules('en').select(Number(number));\n const color = options[rule];\n return colorize(number.toString(), color);\n};\n\nexport const removeColor = (text: string) =>\n // biome-ignore lint/suspicious/noControlCharactersInRegex: we need to remove the color codes\n text.replace(/\\x1b\\[[0-9;]*m/g, '');\n\nconst getLength = (length: number | number[] | string | string[]): number => {\n let value: number = 0;\n if (typeof length === 'number') {\n value = length;\n }\n if (typeof length === 'string') {\n value = length.length;\n }\n if (Array.isArray(length) && length.every((l) => typeof l === 'string')) {\n value = Math.max(...length.map((str) => str.length));\n }\n if (Array.isArray(length) && length.every((l) => typeof l === 'number')) {\n value = Math.max(...length);\n }\n return Math.max(value, 0);\n};\n\nconst defaultColonOptions = {\n colSize: 0,\n minSize: 0,\n maxSize: Infinity,\n pad: 'right',\n padChar: '0',\n};\n\n/**\n * Create a string of spaces of a given length.\n *\n * @param colSize - The length of the string to create.\n * @returns A string of spaces.\n */\nexport const colon = (\n text: string | string[],\n options?: {\n colSize?: number | number[] | string | string[];\n minSize?: number;\n maxSize?: number;\n pad?: 'left' | 'right';\n padChar?: string;\n }\n): string =>\n [text]\n .flat()\n .map((text) => {\n const { colSize, minSize, maxSize, pad } = {\n ...defaultColonOptions,\n ...(options ?? {}),\n };\n\n const length = getLength(colSize);\n const spacesLength = Math.max(\n minSize!,\n Math.min(maxSize!, length - removeColor(text).length)\n );\n\n if (pad === 'left') {\n return `${' '.repeat(spacesLength)}${text}`;\n }\n\n return `${text}${' '.repeat(spacesLength)}`;\n })\n .join('');\n\nexport const x = colorize('✗', ANSIColors.RED);\nexport const v = colorize('✓', ANSIColors.GREEN);\nexport const clock = colorize('⏲', ANSIColors.BLUE);\n"],"mappings":"mEAWA,IAAI,EAEJ,MAAa,EAAa,GAA+B,CACvD,EAAe,GAGJ,EAAa,GACb,IAAiB,OAIrB,EAHE,EAME,GAAkB,EAAS,IAAY,CAClD,IAAM,EAAY,GAAS,WAAa,GAClC,EAAO,GAAS,QAAQ,MAAQ,UAChC,EAAQ,GAAS,OAAS,OAC1B,EAAS,EAAU,GAAS,QAAQ,OAAO,CAC3C,EAAM,GAAS,QAAQ,KAAO,QAAQ,IACtC,EAAO,GAAS,QAAQ,MAAQ,QAAQ,KACxC,EAAO,GAAS,QAAQ,MAAQ,QAAQ,KACxC,EAAQ,GAAS,QAAQ,OAAS,QAAQ,MAC1C,EAAQ,GAAS,QAAQ,OAAS,QAAQ,MAIhD,GAFI,IAAS,YAET,GAAa,IAAS,UAAW,OAErC,IAAM,EAAc,EAAS,CAAC,EAAQ,GAAG,CAAC,EAAQ,CAAC,MAAM,CAAC,CAAG,CAAC,EAAQ,CAAC,MAAM,CAE7E,GAAI,IAAU,QACZ,OAAO,EAAM,GAAG,EAAY,CAG9B,GAAI,IAAU,OACZ,OAAO,EAAK,GAAG,EAAY,CAG7B,GAAI,IAAU,OACZ,OAAO,EAAK,GAAG,EAAY,CAG7B,GAAI,IAAU,QACZ,OAAO,EAAM,GAAG,EAAY,CAG9B,EAAI,GAA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js","names":[],"sources":["../../src/logger.ts"],"sourcesContent":["import type { Locale } from '@intlayer/types/allLocales';\nimport type { CustomIntlayerConfig } from '@intlayer/types/config';\nimport * as ANSIColors from './colors';\n\nexport type ANSIColorsType = (typeof ANSIColors)[keyof typeof ANSIColors];\n\nexport type Details = {\n isVerbose?: boolean;\n level?: 'info' | 'warn' | 'error' | 'debug';\n config?: CustomIntlayerConfig['log'];\n};\n\nexport type Logger = (content: any, details?: Details) => void;\n\nlet loggerPrefix: string | undefined;\n\nexport const setPrefix = (prefix: string | undefined) => {\n loggerPrefix = prefix;\n};\n\nexport const getPrefix = (configPrefix?: string): string | undefined => {\n if (typeof loggerPrefix !== 'undefined') {\n return loggerPrefix;\n }\n\n return configPrefix;\n};\n\nexport const logger: Logger = (content, details) => {\n const isVerbose = details?.isVerbose ?? false;\n const mode = details?.config?.mode ?? 'default';\n const level = details?.level ?? 'info';\n const prefix = getPrefix(details?.config?.prefix);\n const log = details?.config?.log ?? console.log;\n const info = details?.config?.info ?? console.info;\n const warn = details?.config?.warn ?? console.warn;\n const error = details?.config?.error ?? console.error;\n const debug = details?.config?.debug ?? console.debug;\n\n if (mode === 'disabled') return;\n\n if (isVerbose && mode !== 'verbose') return;\n\n const flatContent = prefix ? [prefix, ...[content].flat()] : [content].flat();\n\n if (level === 'debug') {\n return debug(...flatContent);\n }\n\n if (level === 'info') {\n return info(...flatContent);\n }\n\n if (level === 'warn') {\n return warn(...flatContent);\n }\n\n if (level === 'error') {\n return error(...flatContent);\n }\n\n log(...flatContent);\n};\n\nexport const spinnerFrames = ['⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏'];\n\n/**\n * The appLogger function takes the logger and merges it with the configuration from the intlayer config file.\n * It allows overriding the default configuration by passing a config object in the details parameter.\n * The configuration is merged with the default configuration from the intlayer config file.\n */\nexport const getAppLogger =\n (configuration?: CustomIntlayerConfig, globalDetails?: Details) =>\n (content: any, details?: Details) =>\n logger(content, {\n ...(details ?? {}),\n config: {\n ...configuration?.log,\n ...globalDetails?.config,\n ...(details?.config ?? {}),\n },\n });\n\nexport const colorize = (\n s: string,\n color?: ANSIColorsType,\n reset?: boolean | ANSIColorsType\n): string =>\n color\n ? `${color}${s}${reset ? (typeof reset === 'boolean' ? ANSIColors.RESET : reset) : ANSIColors.RESET}`\n : s;\n\nexport const colorizeLocales = (\n locales: Locale | Locale[],\n color = ANSIColors.GREEN,\n reset: boolean | ANSIColorsType = ANSIColors.RESET\n) =>\n [locales]\n .flat()\n .map((locale) => colorize(locale, color, reset))\n .join(`, `);\n\nexport const colorizeKey = (\n keyPath: string | string[],\n color = ANSIColors.BEIGE,\n reset: boolean | ANSIColorsType = ANSIColors.RESET\n) =>\n [keyPath]\n .flat()\n .map((key) => colorize(key, color, reset))\n .join(`, `);\n\nexport const colorizePath = (\n path: string | string[],\n color = ANSIColors.GREY,\n reset: boolean | ANSIColorsType = ANSIColors.RESET\n) =>\n [path]\n .flat()\n .map((path) => colorize(path, color, reset))\n .join(`, `);\n\n/**\n * Colorize numeric value using Intl.NumberFormat and optional ANSI colors.\n *\n * Examples:\n * colorizeNumber(2, [{ pluralRule: 'one' , color: ANSIColors.GREEN}, { pluralRule: 'other' , color: ANSIColors.RED}]) // \"'\\x1b[31m2\\x1b[0m\"\n */\nexport const colorizeNumber = (\n number: number | string,\n options: Partial<Record<Intl.LDMLPluralRule, ANSIColorsType>> = {\n zero: ANSIColors.BLUE,\n one: ANSIColors.BLUE,\n two: ANSIColors.BLUE,\n few: ANSIColors.BLUE,\n many: ANSIColors.BLUE,\n other: ANSIColors.BLUE,\n }\n): string => {\n if (number === 0) {\n const color = options.zero ?? ANSIColors.GREEN;\n return colorize(number.toString(), color);\n }\n\n const rule = new Intl.PluralRules('en').select(Number(number));\n const color = options[rule];\n return colorize(number.toString(), color);\n};\n\nexport const removeColor = (text: string) =>\n // biome-ignore lint/suspicious/noControlCharactersInRegex: we need to remove the color codes\n text.replace(/\\x1b\\[[0-9;]*m/g, '');\n\nconst getLength = (length: number | number[] | string | string[]): number => {\n let value: number = 0;\n if (typeof length === 'number') {\n value = length;\n }\n if (typeof length === 'string') {\n value = length.length;\n }\n if (Array.isArray(length) && length.every((l) => typeof l === 'string')) {\n value = Math.max(...length.map((str) => str.length));\n }\n if (Array.isArray(length) && length.every((l) => typeof l === 'number')) {\n value = Math.max(...length);\n }\n return Math.max(value, 0);\n};\n\nconst defaultColonOptions = {\n colSize: 0,\n minSize: 0,\n maxSize: Infinity,\n pad: 'right',\n padChar: '0',\n};\n\n/**\n * Create a string of spaces of a given length.\n *\n * @param colSize - The length of the string to create.\n * @returns A string of spaces.\n */\nexport const colon = (\n text: string | string[],\n options?: {\n colSize?: number | number[] | string | string[];\n minSize?: number;\n maxSize?: number;\n pad?: 'left' | 'right';\n padChar?: string;\n }\n): string =>\n [text]\n .flat()\n .map((text) => {\n const { colSize, minSize, maxSize, pad } = {\n ...defaultColonOptions,\n ...(options ?? {}),\n };\n\n const length = getLength(colSize);\n const spacesLength = Math.max(\n minSize!,\n Math.min(maxSize!, length - removeColor(text).length)\n );\n\n if (pad === 'left') {\n return `${' '.repeat(spacesLength)}${text}`;\n }\n\n return `${text}${' '.repeat(spacesLength)}`;\n })\n .join('');\n\nexport const x = colorize('✗', ANSIColors.RED);\nexport const v = colorize('✓', ANSIColors.GREEN);\nexport const clock = colorize('⏲', ANSIColors.BLUE);\n"],"mappings":"mGAcA,IAAI,EAEJ,MAAa,EAAa,GAA+B,CACvD,EAAe,GAGJ,EAAa,GACb,IAAiB,OAIrB,EAHE,EAME,GAAkB,EAAS,IAAY,CAClD,IAAM,EAAY,GAAS,WAAa,GAClC,EAAO,GAAS,QAAQ,MAAQ,UAChC,EAAQ,GAAS,OAAS,OAC1B,EAAS,EAAU,GAAS,QAAQ,OAAO,CAC3C,EAAM,GAAS,QAAQ,KAAO,QAAQ,IACtC,EAAO,GAAS,QAAQ,MAAQ,QAAQ,KACxC,EAAO,GAAS,QAAQ,MAAQ,QA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AAG,CAEA,EAAI,EAAS,IAAA,EAAA,IAAoB,CACjC,EAAI,EAAS,IAAA,EAAA,MAAsB,CACnC,EAAQ,EAAS,IAAA,EAAA,KAAqB"}
package/dist/cjs/node.cjs CHANGED
@@ -1 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./configFile/buildConfigurationFields.cjs`),t=require(`./configFile/configurationSchema.cjs`),n=require(`./configFile/searchConfigurationFile.cjs`),r=require(`./configFile/getConfiguration.cjs`),i=require(`./defaultValues/index.cjs`);Object.defineProperty(exports,`DefaultValues`,{enumerable:!0,get:function(){return i.t}}),exports.aiSchema=t.aiSchema,exports.buildConfigurationFields=e.buildConfigurationFields,exports.buildSchema=t.buildSchema,exports.compilerSchema=t.compilerSchema,exports.configurationFilesCandidates=n.configurationFilesCandidates,exports.contentSchema=t.contentSchema,exports.cookiesAttributesSchema=t.cookiesAttributesSchema,exports.dictionarySchema=t.dictionarySchema,exports.editorSchema=t.editorSchema,exports.getConfiguration=r.getConfiguration,exports.getConfigurationAndFilePath=r.getConfigurationAndFilePath,exports.internationalizationSchema=t.internationalizationSchema,exports.intlayerConfigSchema=t.intlayerConfigSchema,exports.logSchema=t.logSchema,exports.rewriteObjectSchema=t.rewriteObjectSchema,exports.rewriteRuleSchema=t.rewriteRuleSchema,exports.rewriteRulesSchema=t.rewriteRulesSchema,exports.routingSchema=t.routingSchema,exports.searchConfigurationFile=n.searchConfigurationFile,exports.storageAttributesSchema=t.storageAttributesSchema,exports.storageSchema=t.storageSchema,exports.systemSchema=t.systemSchema;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./configFile/buildConfigurationFields.cjs`),t=require(`./configFile/configurationSchema.cjs`),n=require(`./configFile/searchConfigurationFile.cjs`),r=require(`./configFile/getConfiguration.cjs`);exports.aiSchema=t.aiSchema,exports.buildConfigurationFields=e.buildConfigurationFields,exports.buildSchema=t.buildSchema,exports.compilerSchema=t.compilerSchema,exports.configurationFilesCandidates=n.configurationFilesCandidates,exports.contentSchema=t.contentSchema,exports.cookiesAttributesSchema=t.cookiesAttributesSchema,exports.dictionarySchema=t.dictionarySchema,exports.editorSchema=t.editorSchema,exports.getConfiguration=r.getConfiguration,exports.getConfigurationAndFilePath=r.getConfigurationAndFilePath,exports.internationalizationSchema=t.internationalizationSchema,exports.intlayerConfigSchema=t.intlayerConfigSchema,exports.logSchema=t.logSchema,exports.rewriteObjectSchema=t.rewriteObjectSchema,exports.rewriteRuleSchema=t.rewriteRuleSchema,exports.rewriteRulesSchema=t.rewriteRulesSchema,exports.routingSchema=t.routingSchema,exports.searchConfigurationFile=n.searchConfigurationFile,exports.storageAttributesSchema=t.storageAttributesSchema,exports.storageSchema=t.storageSchema,exports.systemSchema=t.systemSchema;
@@ -1,2 +1,2 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`../chunk-D-qHiVGv.cjs`);const e=require(`./getPackageJsonPath.cjs`);let t=require(`node:module`);const n=typeof require(`url`).pathToFileURL(__filename).href==`string`,r=n=>{let{packageJsonPath:r}=e.getPackageJsonPath(n);return(0,t.createRequire)(r)},i=n?(0,t.createRequire)(require(`url`).pathToFileURL(__filename).href):require;exports.configESMxCJSRequire=i,exports.getProjectRequire=r,exports.isESModule=n;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`../chunk-Bmb41Sf3.cjs`);const e=require(`./getPackageJsonPath.cjs`);let t=require(`node:module`);const n=typeof require(`url`).pathToFileURL(__filename).href==`string`,r=n=>{let{packageJsonPath:r}=e.getPackageJsonPath(n);return(0,t.createRequire)(r)},i=n?(0,t.createRequire)(require(`url`).pathToFileURL(__filename).href):require;exports.configESMxCJSRequire=i,exports.getProjectRequire=r,exports.isESModule=n;
2
2
  //# sourceMappingURL=ESMxCJSHelpers.cjs.map
@@ -1,2 +1,2 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`../chunk-D-qHiVGv.cjs`);const e=require(`./getExtension.cjs`),t=require(`./normalizePath.cjs`);let n=require(`node:path`);const r=({configuration:r,format:i,formatter:a=e=>e})=>{let o=e.getExtension(r,i??r.build.outputFormat[0]??`esm`),{baseDir:s}=r.system,{mainDir:c,configDir:l}=r.system,u=a(t.normalizePath((0,n.relative)(s,(0,n.join)(c,`dictionaries.${o}`)))),d=a(t.normalizePath((0,n.relative)(s,(0,n.join)(c,`unmerged_dictionaries.${o}`)))),f=a(t.normalizePath((0,n.relative)(s,(0,n.join)(c,`remote_dictionaries.${o}`)))),p=a(t.normalizePath((0,n.relative)(s,(0,n.join)(c,`dynamic_dictionaries.${o}`)))),m=a(t.normalizePath((0,n.relative)(s,(0,n.join)(c,`fetch_dictionaries.${o}`)))),h=a(t.normalizePath((0,n.relative)(s,(0,n.join)(l,`configuration.json`))));return{"@intlayer/dictionaries-entry":u,"@intlayer/unmerged-dictionaries-entry":d,"@intlayer/remote-dictionaries-entry":f,"@intlayer/dynamic-dictionaries-entry":p,"@intlayer/fetch-dictionaries-entry":m,"@intlayer/config/built":h}};exports.getAlias=r;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`../chunk-Bmb41Sf3.cjs`);const e=require(`./getExtension.cjs`),t=require(`./normalizePath.cjs`);let n=require(`node:path`);const r=({configuration:r,format:i,formatter:a=e=>e})=>{let o=e.getExtension(r,i??r.build.outputFormat[0]??`esm`),{baseDir:s}=r.system,{mainDir:c,configDir:l}=r.system,u=a(t.normalizePath((0,n.relative)(s,(0,n.join)(c,`dictionaries.${o}`)))),d=a(t.normalizePath((0,n.relative)(s,(0,n.join)(c,`unmerged_dictionaries.${o}`)))),f=a(t.normalizePath((0,n.relative)(s,(0,n.join)(c,`remote_dictionaries.${o}`)))),p=a(t.normalizePath((0,n.relative)(s,(0,n.join)(c,`dynamic_dictionaries.${o}`)))),m=a(t.normalizePath((0,n.relative)(s,(0,n.join)(c,`fetch_dictionaries.${o}`)))),h=a(t.normalizePath((0,n.relative)(s,(0,n.join)(l,`configuration.json`))));return{"@intlayer/dictionaries-entry":u,"@intlayer/unmerged-dictionaries-entry":d,"@intlayer/remote-dictionaries-entry":f,"@intlayer/dynamic-dictionaries-entry":p,"@intlayer/fetch-dictionaries-entry":m,"@intlayer/config/built":h}};exports.getAlias=r;
2
2
  //# sourceMappingURL=alias.cjs.map
@@ -1,2 +1,2 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`../chunk-D-qHiVGv.cjs`),t=require(`./cacheMemory.cjs`);let n=require(`node:path`),r=require(`@intlayer/types/package.json`);r=e.n(r);let i=require(`node:fs/promises`),a=require(`node:v8`),o=require(`node:zlib`);const s={compress:!0},c=async e=>{await(0,i.mkdir)(e,{recursive:!0})},l=async(e,t,r)=>{if(r)try{await c(r)}catch{}let a=`${(0,n.basename)(e)}.tmp-${process.pid}-${Math.random().toString(36).slice(2)}`,o=r?(0,n.join)(r,a):`${e}.tmp-${process.pid}-${Math.random().toString(36).slice(2)}`;try{await(0,i.writeFile)(o,t),await(0,i.rename)(o,e)}catch(e){try{await(0,i.rm)(o,{force:!0})}catch{}throw e}},u=(e,t)=>t===!0||t!==!1&&e.byteLength>1024,d=(e,t,r)=>(0,n.join)(e,r?(0,n.join)(r,t):t),f=new Map,p=(e,p,m)=>{let{cacheDir:h,tempDir:g}=e.system,_=e.build.cache??!0,v=m?.persistent===!0||m?.persistent===void 0&&_,{compress:y,ttlMs:b,maxTimeMs:x,namespace:S}={...s,...m},C=t.computeKeyId(p),w=d(h,C,S),T=async()=>{try{let e=await(0,i.stat)(w).catch(()=>void 0);if(!e||typeof b==`number`&&b>0&&Date.now()-e.mtimeMs>b)return;let t=await(0,i.readFile)(w),n=t[0];t=t.subarray(1);let s=(0,a.deserialize)(n===1?(0,o.gunzipSync)(t):t),c,l=s;if(l&&typeof l==`object`&&typeof l.version==`string`&&typeof l.timestamp==`number`&&Object.hasOwn(l,`data`)){let e=l;if(e.version!==r.default.version){try{await(0,i.unlink)(w)}catch{}return}if(typeof x==`number`&&x>0&&Date.now()-e.timestamp>x){try{await(0,i.unlink)(w)}catch{}return}c=e.data}else{if(typeof x==`number`&&x>0&&Date.now()-e.mtimeMs>x){try{await(0,i.unlink)(w)}catch{}return}c=s}return f.set(C,c),c}catch{return}},E=async e=>{try{await c((0,n.dirname)(w));let t={version:r.default.version,timestamp:Date.now(),data:e},i=Buffer.from((0,a.serialize)(t)),s=u(i,y)?(0,o.gzipSync)(i):i;await l(w,Buffer.concat([Buffer.from([s===i?0:1]),s]),g)}catch{}};return{get:async()=>{let e=f.get(C);if(e!==void 0)return e;if(v&&_)return await T()},set:async e=>{f.set(C,e),v&&_&&await E(e)},clear:async()=>{f.delete(C);try{await(0,i.unlink)(w)}catch{}},clearAll:async()=>{if(t.clearAllCache(),v&&_){let e=S?(0,n.join)(h,S):h;try{await(0,i.rm)(e,{recursive:!0,force:!0})}catch{}try{await(0,i.mkdir)(e,{recursive:!0})}catch{}}},isValid:async()=>{if(f.get(C)!==void 0)return!0;if(!v||!_)return!1;try{let e=await(0,i.stat)(w).catch(()=>void 0);if(!e||typeof b==`number`&&b>0&&Date.now()-e.mtimeMs>b)return!1;let t=await(0,i.readFile)(w),n=t[0];t=t.subarray(1);let s=(0,a.deserialize)(n===1?(0,o.gunzipSync)(t):t);if(s&&typeof s==`object`&&typeof s.version==`string`&&typeof s.timestamp==`number`&&Object.hasOwn(s,`data`)){let e=s;return!(e.version!==r.default.version||typeof x==`number`&&x>0&&Date.now()-e.timestamp>x)}return!(typeof x==`number`&&x>0&&Date.now()-e.mtimeMs>x)}catch{return!1}},id:C,filePath:w}};exports.cacheDisk=p;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`../chunk-Bmb41Sf3.cjs`),t=require(`./cacheMemory.cjs`);let n=require(`node:path`),r=require(`@intlayer/types/package.json`);r=e.t(r);let i=require(`node:fs/promises`),a=require(`node:v8`),o=require(`node:zlib`);const s={compress:!0},c=async e=>{await(0,i.mkdir)(e,{recursive:!0})},l=async(e,t,r)=>{if(r)try{await c(r)}catch{}let a=`${(0,n.basename)(e)}.tmp-${process.pid}-${Math.random().toString(36).slice(2)}`,o=r?(0,n.join)(r,a):`${e}.tmp-${process.pid}-${Math.random().toString(36).slice(2)}`;try{await(0,i.writeFile)(o,t),await(0,i.rename)(o,e)}catch(e){try{await(0,i.rm)(o,{force:!0})}catch{}throw e}},u=(e,t)=>t===!0||t!==!1&&e.byteLength>1024,d=(e,t,r)=>(0,n.join)(e,r?(0,n.join)(r,t):t),f=new Map,p=(e,p,m)=>{let{cacheDir:h,tempDir:g}=e.system,_=e.build.cache??!0,v=m?.persistent===!0||m?.persistent===void 0&&_,{compress:y,ttlMs:b,maxTimeMs:x,namespace:S}={...s,...m},C=t.computeKeyId(p),w=d(h,C,S),T=async()=>{try{let e=await(0,i.stat)(w).catch(()=>void 0);if(!e||typeof b==`number`&&b>0&&Date.now()-e.mtimeMs>b)return;let t=await(0,i.readFile)(w),n=t[0];t=t.subarray(1);let s=(0,a.deserialize)(n===1?(0,o.gunzipSync)(t):t),c,l=s;if(l&&typeof l==`object`&&typeof l.version==`string`&&typeof l.timestamp==`number`&&Object.hasOwn(l,`data`)){let e=l;if(e.version!==r.default.version){try{await(0,i.unlink)(w)}catch{}return}if(typeof x==`number`&&x>0&&Date.now()-e.timestamp>x){try{await(0,i.unlink)(w)}catch{}return}c=e.data}else{if(typeof x==`number`&&x>0&&Date.now()-e.mtimeMs>x){try{await(0,i.unlink)(w)}catch{}return}c=s}return f.set(C,c),c}catch{return}},E=async e=>{try{await c((0,n.dirname)(w));let t={version:r.default.version,timestamp:Date.now(),data:e},i=Buffer.from((0,a.serialize)(t)),s=u(i,y)?(0,o.gzipSync)(i):i;await l(w,Buffer.concat([Buffer.from([s===i?0:1]),s]),g)}catch{}};return{get:async()=>{let e=f.get(C);if(e!==void 0)return e;if(v&&_)return await T()},set:async e=>{f.set(C,e),v&&_&&await E(e)},clear:async()=>{f.delete(C);try{await(0,i.unlink)(w)}catch{}},clearAll:async()=>{if(t.clearAllCache(),v&&_){let e=S?(0,n.join)(h,S):h;try{await(0,i.rm)(e,{recursive:!0,force:!0})}catch{}try{await(0,i.mkdir)(e,{recursive:!0})}catch{}}},isValid:async()=>{if(f.get(C)!==void 0)return!0;if(!v||!_)return!1;try{let e=await(0,i.stat)(w).catch(()=>void 0);if(!e||typeof b==`number`&&b>0&&Date.now()-e.mtimeMs>b)return!1;let t=await(0,i.readFile)(w),n=t[0];t=t.subarray(1);let s=(0,a.deserialize)(n===1?(0,o.gunzipSync)(t):t);if(s&&typeof s==`object`&&typeof s.version==`string`&&typeof s.timestamp==`number`&&Object.hasOwn(s,`data`)){let e=s;return!(e.version!==r.default.version||typeof x==`number`&&x>0&&Date.now()-e.timestamp>x)}return!(typeof x==`number`&&x>0&&Date.now()-e.mtimeMs>x)}catch{return!1}},id:C,filePath:w}};exports.cacheDisk=p;
2
2
  //# sourceMappingURL=cacheDisk.cjs.map
@@ -1,2 +1,2 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`../chunk-D-qHiVGv.cjs`);let e=require(`node:crypto`);const t=(()=>{try{return(0,e.createHash)(`xxhash64`).update(`test`).digest(),`xxhash64`}catch{}try{return(0,e.createHash)(`sha1`).update(`test`).digest(),`sha1`}catch{}return`sha256`})(),n=e=>e.toString(`base64`).replace(/\+/g,`-`).replace(/\//g,`_`).replace(/=+$/g,``),r={start:(e,t)=>e.update(`<${t}>`),sep:e=>e.update(`|`),end:(e,t)=>e.update(`</${t}>`),str:(e,t)=>{e.update(`${t.length}#`),e.update(t)},num:(e,t)=>e.update(Number.isNaN(t)?`NaN`:t===1/0?`Inf`:t===-1/0?`-Inf`:String(t)),big:(e,t)=>e.update(t.toString(10)),bool:(e,t)=>e.update(t?`1`:`0`)},i=(e,t,n)=>{let o=typeof t;if(t===null){r.start(e,`null`),r.end(e,`null`);return}if(o===`undefined`){r.start(e,`undef`),r.end(e,`undef`);return}if(o===`number`){r.start(e,`num`),r.num(e,t),r.end(e,`num`);return}if(o===`bigint`){r.start(e,`big`),r.big(e,t),r.end(e,`big`);return}if(o===`boolean`){r.start(e,`bool`),r.bool(e,t),r.end(e,`bool`);return}if(o===`string`){r.start(e,`str`),r.str(e,t),r.end(e,`str`);return}if(o===`symbol`){r.start(e,`sym`),r.str(e,String(t)),r.end(e,`sym`);return}if(o===`function`){let n=t;r.start(e,`fn`),r.str(e,n.name??``),r.sep(e),r.num(e,n.length),r.end(e,`fn`);return}if(Array.isArray(t)){if(n.has(t)){r.start(e,`arr`),r.str(e,`Circular`),r.end(e,`arr`);return}n.add(t),r.start(e,`arr`);for(let a=0;a<t.length;a++)r.sep(e),i(e,t[a],n);r.end(e,`arr`),n.delete(t);return}if(t instanceof Date){r.start(e,`date`),r.str(e,t.toISOString()),r.end(e,`date`);return}if(t instanceof RegExp){let n=t;r.start(e,`re`),r.str(e,n.source),r.sep(e),r.str(e,n.flags),r.end(e,`re`);return}if(t instanceof Set){let i=t;if(n.has(i)){r.start(e,`set`),r.str(e,`Circular`),r.end(e,`set`);return}n.add(i);let o=[];for(let e of i)o.push(a(e));o.sort(),r.start(e,`set`);for(let t of o)r.sep(e),r.str(e,t);r.end(e,`set`),n.delete(i);return}if(t instanceof Map){let o=t;if(n.has(o)){r.start(e,`map`),r.str(e,`Circular`),r.end(e,`map`);return}n.add(o);let s=[];for(let[e,t]of o.entries())s.push([a(e),t]);s.sort((e,t)=>e[0]<t[0]?-1:e[0]>t[0]?1:0),r.start(e,`map`);for(let[t,a]of s)r.sep(e),r.str(e,t),r.sep(e),i(e,a,n);r.end(e,`map`),n.delete(o);return}if(ArrayBuffer.isView(t)){let n=t;r.start(e,`typed`),r.str(e,Object.getPrototypeOf(n).constructor.name),r.sep(e),e.update(Buffer.from(n.buffer,n.byteOffset,n.byteLength)),r.end(e,`typed`);return}if(t instanceof ArrayBuffer){let n=Buffer.from(t);r.start(e,`ab`),e.update(n),r.end(e,`ab`);return}if(typeof URL<`u`&&t instanceof URL){r.start(e,`url`),r.str(e,t.toString()),r.end(e,`url`);return}if(t instanceof Error){let n=t;r.start(e,`err`),r.str(e,n.name||``),r.sep(e),r.str(e,n.message||``),r.sep(e),r.str(e,n.stack||``),r.end(e,`err`);return}if(o===`object`){let a=t;if(n.has(a)){r.start(e,`obj`),r.str(e,`Circular`),r.end(e,`obj`);return}n.add(a);let o=Object.keys(a).sort();r.start(e,`obj`);for(let t of o)r.sep(e),r.str(e,t),r.sep(e),i(e,a[t],n);r.end(e,`obj`),n.delete(a);return}r.start(e,`other`),r.str(e,String(t)),r.end(e,`other`)},a=(r,a=new WeakSet)=>{let o=(0,e.createHash)(t);return i(o,r,a),n(o.digest())},o=a=>{let o=(0,e.createHash)(t);r.start(o,`keys`);for(let e=0;e<a.length;e++)r.sep(o),i(o,a[e],new WeakSet);return r.end(o,`keys`),n(o.digest())},s=new Map,c=(...e)=>s.get(o(e)),l=(...e)=>{let t=e[e.length-1],n=e.slice(0,-1);s.set(o(n),t)},u=e=>{s.delete(e)},d=()=>{s.clear()},f={get:c,set:l,clear:u};exports.cacheMemory=f,exports.clearAllCache=d,exports.clearCache=u,exports.computeKeyId=o,exports.getCache=c,exports.setCache=l,exports.stableStringify=a;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`../chunk-Bmb41Sf3.cjs`);let e=require(`node:crypto`);const t=(()=>{try{return(0,e.createHash)(`xxhash64`).update(`test`).digest(),`xxhash64`}catch{}try{return(0,e.createHash)(`sha1`).update(`test`).digest(),`sha1`}catch{}return`sha256`})(),n=e=>e.toString(`base64`).replace(/\+/g,`-`).replace(/\//g,`_`).replace(/=+$/g,``),r={start:(e,t)=>e.update(`<${t}>`),sep:e=>e.update(`|`),end:(e,t)=>e.update(`</${t}>`),str:(e,t)=>{e.update(`${t.length}#`),e.update(t)},num:(e,t)=>e.update(Number.isNaN(t)?`NaN`:t===1/0?`Inf`:t===-1/0?`-Inf`:String(t)),big:(e,t)=>e.update(t.toString(10)),bool:(e,t)=>e.update(t?`1`:`0`)},i=(e,t,n)=>{let o=typeof t;if(t===null){r.start(e,`null`),r.end(e,`null`);return}if(o===`undefined`){r.start(e,`undef`),r.end(e,`undef`);return}if(o===`number`){r.start(e,`num`),r.num(e,t),r.end(e,`num`);return}if(o===`bigint`){r.start(e,`big`),r.big(e,t),r.end(e,`big`);return}if(o===`boolean`){r.start(e,`bool`),r.bool(e,t),r.end(e,`bool`);return}if(o===`string`){r.start(e,`str`),r.str(e,t),r.end(e,`str`);return}if(o===`symbol`){r.start(e,`sym`),r.str(e,String(t)),r.end(e,`sym`);return}if(o===`function`){let n=t;r.start(e,`fn`),r.str(e,n.name??``),r.sep(e),r.num(e,n.length),r.end(e,`fn`);return}if(Array.isArray(t)){if(n.has(t)){r.start(e,`arr`),r.str(e,`Circular`),r.end(e,`arr`);return}n.add(t),r.start(e,`arr`);for(let a=0;a<t.length;a++)r.sep(e),i(e,t[a],n);r.end(e,`arr`),n.delete(t);return}if(t instanceof Date){r.start(e,`date`),r.str(e,t.toISOString()),r.end(e,`date`);return}if(t instanceof RegExp){let n=t;r.start(e,`re`),r.str(e,n.source),r.sep(e),r.str(e,n.flags),r.end(e,`re`);return}if(t instanceof Set){let i=t;if(n.has(i)){r.start(e,`set`),r.str(e,`Circular`),r.end(e,`set`);return}n.add(i);let o=[];for(let e of i)o.push(a(e));o.sort(),r.start(e,`set`);for(let t of o)r.sep(e),r.str(e,t);r.end(e,`set`),n.delete(i);return}if(t instanceof Map){let o=t;if(n.has(o)){r.start(e,`map`),r.str(e,`Circular`),r.end(e,`map`);return}n.add(o);let s=[];for(let[e,t]of o.entries())s.push([a(e),t]);s.sort((e,t)=>e[0]<t[0]?-1:e[0]>t[0]?1:0),r.start(e,`map`);for(let[t,a]of s)r.sep(e),r.str(e,t),r.sep(e),i(e,a,n);r.end(e,`map`),n.delete(o);return}if(ArrayBuffer.isView(t)){let n=t;r.start(e,`typed`),r.str(e,Object.getPrototypeOf(n).constructor.name),r.sep(e),e.update(Buffer.from(n.buffer,n.byteOffset,n.byteLength)),r.end(e,`typed`);return}if(t instanceof ArrayBuffer){let n=Buffer.from(t);r.start(e,`ab`),e.update(n),r.end(e,`ab`);return}if(typeof URL<`u`&&t instanceof URL){r.start(e,`url`),r.str(e,t.toString()),r.end(e,`url`);return}if(t instanceof Error){let n=t;r.start(e,`err`),r.str(e,n.name||``),r.sep(e),r.str(e,n.message||``),r.sep(e),r.str(e,n.stack||``),r.end(e,`err`);return}if(o===`object`){let a=t;if(n.has(a)){r.start(e,`obj`),r.str(e,`Circular`),r.end(e,`obj`);return}n.add(a);let o=Object.keys(a).sort();r.start(e,`obj`);for(let t of o)r.sep(e),r.str(e,t),r.sep(e),i(e,a[t],n);r.end(e,`obj`),n.delete(a);return}r.start(e,`other`),r.str(e,String(t)),r.end(e,`other`)},a=(r,a=new WeakSet)=>{let o=(0,e.createHash)(t);return i(o,r,a),n(o.digest())},o=a=>{let o=(0,e.createHash)(t);r.start(o,`keys`);for(let e=0;e<a.length;e++)r.sep(o),i(o,a[e],new WeakSet);return r.end(o,`keys`),n(o.digest())},s=new Map,c=(...e)=>s.get(o(e)),l=(...e)=>{let t=e[e.length-1],n=e.slice(0,-1);s.set(o(n),t)},u=e=>{s.delete(e)},d=()=>{s.clear()},f={get:c,set:l,clear:u};exports.cacheMemory=f,exports.clearAllCache=d,exports.clearCache=u,exports.computeKeyId=o,exports.getCache=c,exports.setCache=l,exports.stableStringify=a;
2
2
  //# sourceMappingURL=cacheMemory.cjs.map
@@ -1,2 +1,2 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`../chunk-D-qHiVGv.cjs`);const e=require(`./cacheMemory.cjs`);let t=require(`node:fs`),n=require(`node:path`);const r=(r=process.cwd())=>{let i=e.cacheMemory.get(`packageJsonPath`,r);if(i)return i;let a=r;for(let i=0;i<15;i++){let i=(0,n.join)(a,`package.json`);if((0,t.existsSync)(i))return e.cacheMemory.set(`packageJsonPath`,r,{packageJsonPath:i,baseDir:a}),{packageJsonPath:i,baseDir:a};let o=(0,n.dirname)(a);if(o===a)break;a=o}throw Error(`Could not find package.json in current directory or any of the 15 parent directories. Searched from: ${r}`)};exports.getPackageJsonPath=r;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`../chunk-Bmb41Sf3.cjs`);const e=require(`./cacheMemory.cjs`);let t=require(`node:fs`),n=require(`node:path`);const r=(r=process.cwd())=>{let i=e.cacheMemory.get(`packageJsonPath`,r);if(i)return i;let a=r;for(let i=0;i<15;i++){let i=(0,n.join)(a,`package.json`);if((0,t.existsSync)(i))return e.cacheMemory.set(`packageJsonPath`,r,{packageJsonPath:i,baseDir:a}),{packageJsonPath:i,baseDir:a};let o=(0,n.dirname)(a);if(o===a)break;a=o}throw Error(`Could not find package.json in current directory or any of the 15 parent directories. Searched from: ${r}`)};exports.getPackageJsonPath=r;
2
2
  //# sourceMappingURL=getPackageJsonPath.cjs.map
@@ -1,2 +1,2 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`../logger.cjs`),t=(t,n={limit:50})=>{Error.stackTraceLimit=n.limit;try{throw Error(`test`)}catch(n){console.log(e.colorize(t,e.ANSIColors.YELLOW)),console.log(e.colorize(n.stack??``,e.ANSIColors.BLUE))}};exports.logStack=t;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`../colors.cjs`),t=require(`../logger.cjs`),n=(n,r={limit:50})=>{Error.stackTraceLimit=r.limit;try{throw Error(`test`)}catch(r){console.log(t.colorize(n,e.YELLOW)),console.log(t.colorize(r.stack??``,e.BLUE))}};exports.logStack=n;
2
2
  //# sourceMappingURL=logStack.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"logStack.cjs","names":["colorize","ANSIColors"],"sources":["../../../src/utils/logStack.ts"],"sourcesContent":["import { ANSIColors, colorize } from '../logger';\n\nexport const logStack = (\n message: string,\n options: { limit: number } = { limit: 50 }\n) => {\n Error.stackTraceLimit = options.limit;\n\n try {\n throw new Error('test');\n } catch (error) {\n console.log(colorize(message, ANSIColors.YELLOW));\n console.log(colorize((error as Error).stack ?? '', ANSIColors.BLUE));\n }\n};\n"],"mappings":"oGAEa,GACX,EACA,EAA6B,CAAE,MAAO,GAAI,GACvC,CACH,MAAM,gBAAkB,EAAQ,MAEhC,GAAI,CACF,MAAU,MAAM,OAAO,OAChB,EAAO,CACd,QAAQ,IAAIA,EAAAA,SAAS,EAASC,EAAAA,WAAW,OAAO,CAAC,CACjD,QAAQ,IAAID,EAAAA,SAAU,EAAgB,OAAS,GAAIC,EAAAA,WAAW,KAAK,CAAC"}
1
+ {"version":3,"file":"logStack.cjs","names":["colorize"],"sources":["../../../src/utils/logStack.ts"],"sourcesContent":["import * as ANSIColors from '../colors';\nimport { colorize } from '../logger';\n\nexport const logStack = (\n message: string,\n options: { limit: number } = { limit: 50 }\n) => {\n Error.stackTraceLimit = options.limit;\n\n try {\n throw new Error('test');\n } catch (error) {\n console.log(colorize(message, ANSIColors.YELLOW));\n console.log(colorize((error as Error).stack ?? '', ANSIColors.BLUE));\n }\n};\n"],"mappings":"+HAGa,GACX,EACA,EAA6B,CAAE,MAAO,GAAI,GACvC,CACH,MAAM,gBAAkB,EAAQ,MAEhC,GAAI,CACF,MAAU,MAAM,OAAO,OAChB,EAAO,CACd,QAAQ,IAAIA,EAAAA,SAAS,EAAA,EAAA,OAA2B,CAAC,CACjD,QAAQ,IAAIA,EAAAA,SAAU,EAAgB,OAAS,GAAA,EAAA,KAAoB,CAAC"}
@@ -1,2 +1,2 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`../logger.cjs`),t=require(`./extractErrorMessage.cjs`),n=(n,{maxRetry:r=3,delay:i=0,onError:a,onMaxTryReached:o}={})=>async(...s)=>{let c;for(let l=0;l<=r;l++)try{return await n(...s)}catch(n){c=n;let s=t.extractErrorMessage(n);if(l>=r){if(o)return o?.({error:s,attempt:l,maxRetry:r}),null;throw n}a?a?.({error:s,attempt:l,maxRetry:r}):e.logger(s,{level:`error`}),i>0&&await new Promise(e=>setTimeout(e,i))}throw c??Error(`Unexpected: retry loop completed without result`)};exports.retryManager=n;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./extractErrorMessage.cjs`),t=require(`../logger.cjs`),n=(n,{maxRetry:r=3,delay:i=0,onError:a,onMaxTryReached:o}={})=>async(...s)=>{let c;for(let l=0;l<=r;l++)try{return await n(...s)}catch(n){c=n;let s=e.extractErrorMessage(n);if(l>=r){if(o)return o?.({error:s,attempt:l,maxRetry:r}),null;throw n}a?a?.({error:s,attempt:l,maxRetry:r}):t.logger(s,{level:`error`}),i>0&&await new Promise(e=>setTimeout(e,i))}throw c??Error(`Unexpected: retry loop completed without result`)};exports.retryManager=n;
2
2
  //# sourceMappingURL=retryManager.cjs.map
@@ -0,0 +1,2 @@
1
+ import{getPackageJsonPath as e}from"./utils/getPackageJsonPath.mjs";import{createRequire as t}from"node:module";var n=(e=>typeof require<`u`?require:typeof Proxy<`u`?new Proxy(e,{get:(e,t)=>(typeof require<`u`?require:e)[t]}):e)(function(e){if(typeof require<`u`)return require.apply(this,arguments);throw Error('Calling `require` for "'+e+"\" in an environment that doesn't expose the `require` function. See https://rolldown.rs/in-depth/bundling-cjs#require-external-modules for more details.")});const r=typeof import.meta.url==`string`,i=n=>{let{packageJsonPath:r}=e(n);return t(r)},a=r?t(import.meta.url):n;export{n as i,i as n,r,a as t};
2
+ //# sourceMappingURL=ESMxCJSHelpers-BAuqwNXV.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ESMxCJSHelpers-BAuqwNXV.mjs","names":[],"sources":["../../src/utils/ESMxCJSHelpers.ts"],"sourcesContent":["import { createRequire } from 'node:module';\nimport { getPackageJsonPath } from './getPackageJsonPath';\n\nexport const isESModule = typeof import.meta.url === 'string';\n\n/**\n * Require relative to the user project\n *\n * Note: Can resolve package that are installed in the user project, ex `'intlayer'`\n */\nexport const getProjectRequire = (startDir?: string): NodeJS.Require => {\n // Can fail on VSCode extensions\n const { packageJsonPath } = getPackageJsonPath(startDir);\n\n return createRequire(packageJsonPath);\n};\n\n/**\n * Require relative to the @intlayer/config package\n *\n * Note: Can resolve package that are installed in the config package, ex `'@intlayer/types'`\n */\nexport const configESMxCJSRequire: NodeJS.Require = isESModule\n ? createRequire(import.meta.url)\n : require;\n"],"mappings":"mfAGA,MAAa,EAAa,OAAO,OAAO,KAAK,KAAQ,SAOxC,EAAqB,GAAsC,CAEtE,GAAM,CAAE,mBAAoB,EAAmB,EAAS,CAExD,OAAO,EAAc,EAAgB,EAQ1B,EAAuC,EAChD,EAAc,OAAO,KAAK,IAAI,CAAA"}
@@ -1 +1 @@
1
- import{normalizePath as e}from"./utils/normalizePath.mjs";import{extractErrorMessage as t}from"./utils/extractErrorMessage.mjs";import{logStack as n}from"./utils/logStack.mjs";import{camelCaseToKebabCase as r}from"./utils/stringFormatter/camelCaseToKebabCase.mjs";import{camelCaseToSentence as i}from"./utils/stringFormatter/camelCaseToSentence.mjs";import{kebabCaseToCamelCase as a}from"./utils/stringFormatter/kebabCaseToCamelCase.mjs";import{toLowerCamelCase as o}from"./utils/stringFormatter/toLowerCamelCase.mjs";import{t as s}from"./defaultValues/index.mjs";export{s as DefaultValues,r as camelCaseToKebabCase,i as camelCaseToSentence,t as extractErrorMessage,a as kebabCaseToCamelCase,n as logStack,e as normalizePath,o as toLowerCamelCase};
1
+ import{normalizePath as e}from"./utils/normalizePath.mjs";import{extractErrorMessage as t}from"./utils/extractErrorMessage.mjs";import{logStack as n}from"./utils/logStack.mjs";import{camelCaseToKebabCase as r}from"./utils/stringFormatter/camelCaseToKebabCase.mjs";import{camelCaseToSentence as i}from"./utils/stringFormatter/camelCaseToSentence.mjs";import{kebabCaseToCamelCase as a}from"./utils/stringFormatter/kebabCaseToCamelCase.mjs";import{toLowerCamelCase as o}from"./utils/stringFormatter/toLowerCamelCase.mjs";export{r as camelCaseToKebabCase,i as camelCaseToSentence,t as extractErrorMessage,a as kebabCaseToCamelCase,n as logStack,e as normalizePath,o as toLowerCamelCase};
@@ -0,0 +1,2 @@
1
+ const e=`\x1B[0m`,t=`\x1B[90m`,n=`\x1B[38;5;239m`,r=`\x1B[38;5;252m`,i=`\x1B[34m`,a=`\x1B[31m`,o=`\x1B[32m`,s=`\x1B[38;5;226m`,c=`\x1B[35m`,l=`\x1B[38;5;3m`,u=`\x1B[38;5;208m`,d=`\x1B[36m`,f=`\x1B[37m`,p=`\x1B[1m`;export{l as BEIGE,i as BLUE,p as BOLD,d as CYAN,o as GREEN,t as GREY,n as GREY_DARK,r as GREY_LIGHT,c as MAGENTA,u as ORANGE,a as RED,e as RESET,f as WHITE,s as YELLOW};
2
+ //# sourceMappingURL=colors.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"colors.mjs","names":[],"sources":["../../src/colors.ts"],"sourcesContent":["export const RESET = '\\x1b[0m' as const;\nexport const GREY = '\\x1b[90m' as const;\nexport const GREY_DARK = '\\x1b[38;5;239m' as const;\nexport const GREY_LIGHT = '\\x1b[38;5;252m' as const;\nexport const BLUE = '\\x1b[34m' as const;\nexport const RED = '\\x1b[31m' as const;\nexport const GREEN = '\\x1b[32m' as const;\nexport const YELLOW = '\\x1b[38;5;226m' as const;\nexport const MAGENTA = '\\x1b[35m' as const;\nexport const BEIGE = '\\x1b[38;5;3m' as const;\nexport const ORANGE = '\\x1b[38;5;208m' as const;\nexport const CYAN = '\\x1b[36m' as const;\nexport const WHITE = '\\x1b[37m' as const;\nexport const BOLD = '\\x1b[1m' as const;\n"],"mappings":"AAAA,MAAa,EAAQ,UACR,EAAO,WACP,EAAY,iBACZ,EAAa,iBACb,EAAO,WACP,EAAM,WACN,EAAQ,WACR,EAAS,iBACT,EAAU,WACV,EAAQ,eACR,EAAS,iBACT,EAAO,WACP,EAAQ,WACR,EAAO"}
@@ -1,2 +1,2 @@
1
- import{n as e}from"../chunk-DXQkyQJp.mjs";import{OUTPUT_FORMAT as t,TRAVERSE_PATTERN as n}from"../defaultValues/build.mjs";import"../defaultValues/compiler.mjs";import{CODE_DIR as r,CONTENT_DIR as i,EXCLUDED_PATHS as a,FILE_EXTENSIONS as o}from"../defaultValues/content.mjs";import"../defaultValues/dictionary.mjs";import"../defaultValues/editor.mjs";import{DEFAULT_LOCALE as s,LOCALES as c,REQUIRED_LOCALES as l}from"../defaultValues/internationalization.mjs";import{PREFIX as u}from"../defaultValues/log.mjs";import{STORAGE as d}from"../defaultValues/routing.mjs";import"../defaultValues/system.mjs";import{normalizePath as f}from"../utils/normalizePath.mjs";import{getProjectRequire as p}from"../utils/ESMxCJSHelpers.mjs";import{statSync as m}from"node:fs";import{dirname as h,isAbsolute as g,join as _}from"node:path";import v from"@intlayer/types/package.json"with{type:"json"};let y;const b=e=>({locales:e?.locales??c,requiredLocales:e?.requiredLocales??e?.locales??l,strictMode:e?.strictMode??`inclusive`,defaultLocale:e?.defaultLocale??s}),x=e=>({mode:e?.mode??`prefix-no-default`,storage:e?.storage??d,basePath:e?.basePath??``,rewrite:e?.rewrite}),S=(e,t)=>{let n=e??process.cwd(),r=e=>{let t;try{t=p(n).resolve(e,{paths:[n]})}catch{t=g(e)?e:_(n,e)}try{if(m(t).isFile())return h(t)}catch{if(/\.[a-z0-9]+$/i.test(t))return h(t)}return t},i=r(t?.dictionariesDir??`.intlayer/dictionary`);return{baseDir:n,moduleAugmentationDir:r(t?.moduleAugmentationDir??`.intlayer/types`),unmergedDictionariesDir:r(t?.unmergedDictionariesDir??`.intlayer/unmerged_dictionary`),remoteDictionariesDir:r(t?.remoteDictionariesDir??`.intlayer/remote_dictionary`),dictionariesDir:i,dynamicDictionariesDir:r(t?.dynamicDictionariesDir??`.intlayer/dynamic_dictionary`),fetchDictionariesDir:r(t?.fetchDictionariesDir??`.intlayer/fetch_dictionary`),typesDir:r(t?.typesDir??`.intlayer/types`),mainDir:r(t?.mainDir??`.intlayer/main`),configDir:r(t?.configDir??`.intlayer/config`),cacheDir:r(t?.cacheDir??`.intlayer/cache`),tempDir:r(t?.tempDir??`.intlayer/tmp`),outputFilesPatternWithPath:`${f(i)}/**/*.json`}},C=(t,n)=>{let s=n?.fileExtensions??o,c=n=>{let r;try{r=p(t.baseDir).resolve(n,{paths:[t.baseDir]})}catch{try{r=e.resolve(n,{paths:[t.baseDir]})}catch{r=g(n)?n:_(t.baseDir,n)}}try{if(m(r).isFile())return h(r)}catch{if(/\.[a-z0-9]+$/i.test(r))return h(r)}return r},l=(n?.contentDir??i).map(c);return{fileExtensions:s,contentDir:l,codeDir:(n?.codeDir??r).map(c),excludedPath:n?.excludedPath??a,watch:n?.watch??!0,formatCommand:n?.formatCommand,watchedFilesPattern:s.map(e=>`/**/*${e}`),watchedFilesPatternWithPath:s.flatMap(e=>l.map(t=>`${f(t)}/**/*${e}`))}},w=e=>({applicationURL:e?.applicationURL||void 0,editorURL:e?.editorURL||`http://localhost:8000`,cmsURL:e?.cmsURL||`https://app.intlayer.org`,backendURL:e?.backendURL||`https://back.intlayer.org`,port:e?.port??8e3,enabled:e?.enabled??!1,clientId:e?.clientId??void 0,clientSecret:e?.clientSecret??void 0,dictionaryPriorityStrategy:e?.dictionaryPriorityStrategy??`local_first`,liveSync:e?.liveSync??!0,liveSyncPort:e?.liveSyncPort??4e3,liveSyncURL:e?.liveSyncURL??`http://localhost:${e?.liveSyncPort??4e3}`}),T=(e,t)=>({mode:e?.mode??`default`,prefix:e?.prefix??u,error:t?.error,log:t?.log,info:t?.info,warn:t?.warn}),E=e=>({provider:e?.provider,apiKey:e?.apiKey,model:e?.model,temperature:e?.temperature,applicationContext:e?.applicationContext,baseURL:e?.baseURL,dataSerialization:e?.dataSerialization}),D=e=>({mode:e?.mode??`auto`,optimize:e?.optimize,importMode:e?.importMode,traversePattern:e?.traversePattern??n,outputFormat:e?.outputFormat??t,cache:e?.cache??!0,require:e?.require,checkTypes:e?.checkTypes??!1}),O=e=>({enabled:e?.enabled??!0,dictionaryKeyPrefix:e?.dictionaryKeyPrefix??``,transformPattern:e?.transformPattern,excludePattern:e?.excludePattern,output:e?.output,noMetadata:e?.noMetadata??!1,saveComponents:e?.saveComponents??!1}),k=e=>{let t=e?.contentAutoTransformation??!1;return{fill:e?.fill??!0,contentAutoTransformation:typeof t==`object`?{markdown:t.markdown??!1,html:t.html??!1,insertion:t.insertion??!1}:t,location:e?.location??`local`,locale:e?.locale,title:e?.title,description:e?.description,tags:e?.tags,priority:e?.priority,importMode:e?.importMode??`static`}},A=(e,t,n)=>{let r=b(e?.internationalization),i=x(e?.routing),a=S(t,e?.system);return y={internationalization:r,routing:i,content:C(a,e?.content),system:a,editor:w(e?.editor),log:T(e?.log,n),ai:E(e?.ai),build:D(e?.build),compiler:O(e?.compiler),dictionary:k(e?.dictionary),plugins:e?.plugins,schemas:e?.schemas,metadata:{name:`Intlayer`,version:v.version,doc:`https://intlayer.org/docs`}},y};export{A as buildConfigurationFields};
1
+ import{i as e,n as t}from"../ESMxCJSHelpers-BAuqwNXV.mjs";import{OUTPUT_FORMAT as n,TRAVERSE_PATTERN as r}from"../defaultValues/build.mjs";import"../defaultValues/compiler.mjs";import{CODE_DIR as i,CONTENT_DIR as a,EXCLUDED_PATHS as o,FILE_EXTENSIONS as s}from"../defaultValues/content.mjs";import"../defaultValues/dictionary.mjs";import"../defaultValues/editor.mjs";import{DEFAULT_LOCALE as c,LOCALES as l,REQUIRED_LOCALES as u}from"../defaultValues/internationalization.mjs";import{PREFIX as d}from"../defaultValues/log.mjs";import{STORAGE as f}from"../defaultValues/routing.mjs";import"../defaultValues/system.mjs";import{statSync as p}from"node:fs";import{dirname as m,isAbsolute as h,join as g}from"node:path";import _ from"@intlayer/types/package.json"with{type:"json"};let v;const y=e=>({locales:e?.locales??l,requiredLocales:e?.requiredLocales??e?.locales??u,strictMode:e?.strictMode??`inclusive`,defaultLocale:e?.defaultLocale??c}),b=e=>({mode:e?.mode??`prefix-no-default`,storage:e?.storage??f,basePath:e?.basePath??``,rewrite:e?.rewrite}),x=(e,n)=>{let r=e??process.cwd(),i=e=>{let n;try{n=t(r).resolve(e,{paths:[r]})}catch{n=h(e)?e:g(r,e)}try{if(p(n).isFile())return m(n)}catch{if(/\.[a-z0-9]+$/i.test(n))return m(n)}return n},a=i(n?.dictionariesDir??`.intlayer/dictionary`);return{baseDir:r,moduleAugmentationDir:i(n?.moduleAugmentationDir??`.intlayer/types`),unmergedDictionariesDir:i(n?.unmergedDictionariesDir??`.intlayer/unmerged_dictionary`),remoteDictionariesDir:i(n?.remoteDictionariesDir??`.intlayer/remote_dictionary`),dictionariesDir:a,dynamicDictionariesDir:i(n?.dynamicDictionariesDir??`.intlayer/dynamic_dictionary`),fetchDictionariesDir:i(n?.fetchDictionariesDir??`.intlayer/fetch_dictionary`),typesDir:i(n?.typesDir??`.intlayer/types`),mainDir:i(n?.mainDir??`.intlayer/main`),configDir:i(n?.configDir??`.intlayer/config`),cacheDir:i(n?.cacheDir??`.intlayer/cache`),tempDir:i(n?.tempDir??`.intlayer/tmp`)}},S=(n,r)=>{let c=r?.fileExtensions??s,l=r=>{let i;try{i=t(n.baseDir).resolve(r,{paths:[n.baseDir]})}catch{try{i=e.resolve(r,{paths:[n.baseDir]})}catch{i=h(r)?r:g(n.baseDir,r)}}try{if(p(i).isFile())return m(i)}catch{if(/\.[a-z0-9]+$/i.test(i))return m(i)}return i};return{fileExtensions:c,contentDir:(r?.contentDir??a).map(l),codeDir:(r?.codeDir??i).map(l),excludedPath:r?.excludedPath??o,watch:r?.watch??!0,formatCommand:r?.formatCommand}},C=e=>({applicationURL:e?.applicationURL||void 0,editorURL:e?.editorURL||`http://localhost:8000`,cmsURL:e?.cmsURL||`https://app.intlayer.org`,backendURL:e?.backendURL||`https://back.intlayer.org`,port:e?.port??8e3,enabled:e?.enabled??!1,clientId:e?.clientId??void 0,clientSecret:e?.clientSecret??void 0,dictionaryPriorityStrategy:e?.dictionaryPriorityStrategy??`local_first`,liveSync:e?.liveSync??!0,liveSyncPort:e?.liveSyncPort??4e3,liveSyncURL:e?.liveSyncURL??`http://localhost:${e?.liveSyncPort??4e3}`}),w=(e,t)=>({mode:e?.mode??`default`,prefix:e?.prefix??d,error:t?.error,log:t?.log,info:t?.info,warn:t?.warn}),T=e=>({provider:e?.provider,apiKey:e?.apiKey,model:e?.model,temperature:e?.temperature,applicationContext:e?.applicationContext,baseURL:e?.baseURL,dataSerialization:e?.dataSerialization}),E=e=>({mode:e?.mode??`auto`,optimize:e?.optimize,importMode:e?.importMode,traversePattern:e?.traversePattern??r,outputFormat:e?.outputFormat??n,cache:e?.cache??!0,require:e?.require,checkTypes:e?.checkTypes??!1}),D=e=>({enabled:e?.enabled??!0,dictionaryKeyPrefix:e?.dictionaryKeyPrefix??``,transformPattern:e?.transformPattern,excludePattern:e?.excludePattern,output:e?.output,noMetadata:e?.noMetadata??!1,saveComponents:e?.saveComponents??!1}),O=e=>{let t=e?.contentAutoTransformation??!1;return{fill:e?.fill??!0,contentAutoTransformation:typeof t==`object`?{markdown:t.markdown??!1,html:t.html??!1,insertion:t.insertion??!1}:t,location:e?.location??`local`,locale:e?.locale,title:e?.title,description:e?.description,tags:e?.tags,priority:e?.priority,importMode:e?.importMode??`static`}},k=(e,t,n)=>{let r=y(e?.internationalization),i=b(e?.routing),a=x(t,e?.system);return v={internationalization:r,routing:i,content:S(a,e?.content),system:a,editor:C(e?.editor),log:w(e?.log,n),ai:T(e?.ai),build:E(e?.build),compiler:D(e?.compiler),dictionary:O(e?.dictionary),plugins:e?.plugins,schemas:e?.schemas,metadata:{name:`Intlayer`,version:_.version,doc:`https://intlayer.org/docs`}},v};export{k as buildConfigurationFields};
2
2
  //# sourceMappingURL=buildConfigurationFields.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"buildConfigurationFields.mjs","names":[],"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 EditorConfig,\n InternationalizationConfig,\n IntlayerConfig,\n LogConfig,\n LogFunctions,\n RoutingConfig,\n SystemConfig,\n} from '@intlayer/types/config';\nimport packageJson from '@intlayer/types/package.json' with { type: 'json' };\nimport {\n BUILD_MODE,\n CACHE,\n OUTPUT_FORMAT,\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 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 { BASE_PATH, ROUTING_MODE, STORAGE } from '../defaultValues/routing';\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 { normalizePath } from '../utils/normalizePath';\n\nlet storedConfiguration: IntlayerConfig;\n\nconst 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\nconst buildRoutingFields = (\n customConfiguration?: Partial<RoutingConfig>\n): RoutingConfig => ({\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 * 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: customConfiguration?.storage ?? 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\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\n absolutePath = requireFunction.resolve(pathInput, {\n paths: [projectBaseDir],\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 outputFilesPatternWithPath: `${normalizePath(dictionariesDir)}/**/*.json`,\n };\n};\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 // Try resolving as a Node module first\n const requireFunction = getProjectRequire(systemConfig.baseDir);\n absolutePath = requireFunction.resolve(pathInput, {\n paths: [systemConfig.baseDir],\n });\n } catch {\n try {\n // Fall back to native require.resolve if the custom require fails\n absolutePath = require.resolve(pathInput, {\n paths: [systemConfig.baseDir],\n });\n } catch {\n // If all resolution fails, fall back to standard path joining\n absolutePath = isAbsolute(pathInput)\n ? pathInput\n : join(systemConfig.baseDir, pathInput);\n }\n }\n\n try {\n // Smart Detection: File vs Directory\n const stats = statSync(absolutePath);\n\n // If it resolved to a file (like package.json \"main\" or index.js),\n // we want the FOLDER containing that file.\n if (stats.isFile()) {\n return dirname(absolutePath);\n }\n } catch {\n // Safety Fallback:\n // If statSync fails but it looks like a file (has an extension), strip it.\n if (/\\.[a-z0-9]+$/i.test(absolutePath)) {\n return dirname(absolutePath);\n }\n }\n\n // Return the calculated path (usually a directory)\n return absolutePath;\n };\n\n const contentDir = (customConfiguration?.contentDir ?? CONTENT_DIR).map(\n optionalJoinBaseDir\n );\n\n const codeDirInput = customConfiguration?.codeDir;\n\n const codeDir = (codeDirInput ?? CODE_DIR).map(optionalJoinBaseDir);\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 watchedFilesPattern: fileExtensions.map((ext) => `/**/*${ext}`),\n watchedFilesPatternWithPath: fileExtensions.flatMap((ext) =>\n contentDir.map((dir) => `${normalizePath(dir)}/**/*${ext}`)\n ),\n };\n};\n\nconst buildEditorFields = (\n customConfiguration?: Partial<EditorConfig>\n): EditorConfig => ({\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 ?? undefined,\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: customConfiguration?.clientSecret ?? undefined,\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: customConfiguration?.liveSyncPort ?? LIVE_SYNC_PORT,\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 ??\n `http://localhost:${customConfiguration?.liveSyncPort ?? LIVE_SYNC_PORT}`,\n});\n\nconst 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\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\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 * 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\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 * 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\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\n/**\n * Build the configuration fields by merging the default values with the custom configuration\n */\nexport const buildConfigurationFields = (\n customConfiguration?: CustomIntlayerConfig,\n baseDir?: string,\n logFunctions?: LogFunctions\n): IntlayerConfig => {\n const internationalizationConfig = buildInternationalizationFields(\n customConfiguration?.internationalization\n );\n\n const routingConfig = buildRoutingFields(customConfiguration?.routing);\n\n const systemConfig = buildSystemFields(baseDir, customConfiguration?.system);\n\n const contentConfig = buildContentFields(\n systemConfig,\n customConfiguration?.content\n );\n\n const editorConfig = buildEditorFields(customConfiguration?.editor);\n\n const logConfig = buildLogFields(customConfiguration?.log, logFunctions);\n\n const aiConfig = buildAiFields(customConfiguration?.ai);\n\n const buildConfig = buildBuildFields(customConfiguration?.build);\n\n const compilerConfig = buildCompilerFields(customConfiguration?.compiler);\n\n const dictionaryConfig = buildDictionaryFields(\n customConfiguration?.dictionary\n );\n\n storedConfiguration = {\n internationalization: internationalizationConfig,\n routing: routingConfig,\n content: contentConfig,\n system: systemConfig,\n editor: editorConfig,\n log: logConfig,\n ai: aiConfig,\n build: buildConfig,\n compiler: compilerConfig,\n dictionary: dictionaryConfig,\n plugins: customConfiguration?.plugins,\n schemas: customConfiguration?.schemas,\n metadata: {\n name: 'Intlayer',\n version: packageJson.version,\n doc: `https://intlayer.org/docs`,\n },\n } as IntlayerConfig;\n\n return storedConfiguration;\n};\n"],"mappings":"m3BA+EA,IAAI,EAEJ,MAAM,EACJ,IACgC,CAOhC,QAAS,GAAqB,SAAW,EAWzC,gBACE,GAAqB,iBACrB,GAAqB,SACrB,EAUF,WAAY,GAAqB,YAAA,YAOjC,cAAe,GAAqB,eAAiB,EACtD,EAEK,EACJ,IACmB,CAuBnB,KAAM,GAAqB,MAAA,oBAW3B,QAAS,GAAqB,SAAW,EAazC,SAAU,GAAqB,UAAA,GA6B/B,QAAS,GAAqB,QAC/B,EAEK,GACJ,EACA,IACiB,CACjB,IAAM,EAAiB,GAAW,QAAQ,KAAK,CAEzC,EAAuB,GAAsB,CACjD,IAAI,EAEJ,GAAI,CAGF,EAFwB,EAAkB,EAAe,CAE1B,QAAQ,EAAW,CAChD,MAAO,CAAC,EAAe,CACxB,CAAC,MACI,CACN,EAAe,EAAW,EAAU,CAChC,EACA,EAAK,EAAgB,EAAU,CAGrC,GAAI,CAEF,GADc,EAAS,EAAa,CAC1B,QAAQ,CAChB,OAAO,EAAQ,EAAa,MAExB,CACN,GAAI,gBAAgB,KAAK,EAAa,CACpC,OAAO,EAAQ,EAAa,CAIhC,OAAO,GAGH,EAAkB,EACtB,GAAqB,iBAAA,uBACtB,CAED,MAAO,CACL,QAAS,EACT,sBAAuB,EACrB,GAAqB,uBAAA,kBACtB,CACD,wBAAyB,EACvB,GAAqB,yBAAA,gCACtB,CACD,sBAAuB,EACrB,GAAqB,uBAAA,8BACtB,CACD,kBACA,uBAAwB,EACtB,GAAqB,wBAAA,+BACtB,CACD,qBAAsB,EACpB,GAAqB,sBAAA,6BAC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UAAA,QAO/B,OAAQ,GAAqB,OAK7B,MAAO,GAAqB,MAK5B,YAAa,GAAqB,YAKlC,KAAM,GAAqB,KAK3B,SAAU,GAAqB,SAY/B,WAAY,GAAqB,YAAA,SAClC,EAMU,GACX,EACA,EACA,IACmB,CACnB,IAAM,EAA6B,EACjC,GAAqB,qBACtB,CAEK,EAAgB,EAAmB,GAAqB,QAAQ,CAEhE,EAAe,EAAkB,EAAS,GAAqB,OAAO,CAyC5E,MApBA,GAAsB,CACpB,qBAAsB,EACtB,QAAS,EACT,QAtBoB,EACpB,EACA,GAAqB,QACtB,CAoBC,OAAQ,EACR,OAnBmB,EAAkB,GAAqB,OAAO,CAoBjE,IAlBgB,EAAe,GAAqB,IAAK,EAAa,CAmBtE,GAjBe,EAAc,GAAqB,GAAG,CAkBrD,MAhBkB,EAAiB,GAAqB,MAAM,CAiB9D,SAfqB,EAAoB,GAAqB,SAAS,CAgBvE,WAduB,EACvB,GAAqB,WACtB,CAaC,QAAS,GAAqB,QAC9B,QAAS,GAAqB,QAC9B,SAAU,CACR,KAAM,WACN,QAAS,EAAY,QACrB,IAAK,4BACN,CACF,CAEM"}
1
+ {"version":3,"file":"buildConfigurationFields.mjs","names":[],"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 EditorConfig,\n InternationalizationConfig,\n IntlayerConfig,\n LogConfig,\n LogFunctions,\n RoutingConfig,\n SystemConfig,\n} from '@intlayer/types/config';\nimport packageJson from '@intlayer/types/package.json' with { type: 'json' };\nimport {\n BUILD_MODE,\n CACHE,\n OUTPUT_FORMAT,\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 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 { BASE_PATH, ROUTING_MODE, STORAGE } from '../defaultValues/routing';\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';\n\nlet storedConfiguration: IntlayerConfig;\n\nconst 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\nconst buildRoutingFields = (\n customConfiguration?: Partial<RoutingConfig>\n): RoutingConfig => ({\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 * 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: customConfiguration?.storage ?? 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\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\n absolutePath = requireFunction.resolve(pathInput, {\n paths: [projectBaseDir],\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\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 // Try resolving as a Node module first\n const requireFunction = getProjectRequire(systemConfig.baseDir);\n absolutePath = requireFunction.resolve(pathInput, {\n paths: [systemConfig.baseDir],\n });\n } catch {\n try {\n // Fall back to native require.resolve if the custom require fails\n absolutePath = require.resolve(pathInput, {\n paths: [systemConfig.baseDir],\n });\n } catch {\n // If all resolution fails, fall back to standard path joining\n absolutePath = isAbsolute(pathInput)\n ? pathInput\n : join(systemConfig.baseDir, pathInput);\n }\n }\n\n try {\n // Smart Detection: File vs Directory\n const stats = statSync(absolutePath);\n\n // If it resolved to a file (like package.json \"main\" or index.js),\n // we want the FOLDER containing that file.\n if (stats.isFile()) {\n return dirname(absolutePath);\n }\n } catch {\n // Safety Fallback:\n // If statSync fails but it looks like a file (has an extension), strip it.\n if (/\\.[a-z0-9]+$/i.test(absolutePath)) {\n return dirname(absolutePath);\n }\n }\n\n // Return the calculated path (usually a directory)\n return absolutePath;\n };\n\n const contentDir = (customConfiguration?.contentDir ?? CONTENT_DIR).map(\n optionalJoinBaseDir\n );\n\n const codeDirInput = customConfiguration?.codeDir;\n\n const codeDir = (codeDirInput ?? CODE_DIR).map(optionalJoinBaseDir);\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\nconst buildEditorFields = (\n customConfiguration?: Partial<EditorConfig>\n): EditorConfig => ({\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 ?? undefined,\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: customConfiguration?.clientSecret ?? undefined,\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: customConfiguration?.liveSyncPort ?? LIVE_SYNC_PORT,\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 ??\n `http://localhost:${customConfiguration?.liveSyncPort ?? LIVE_SYNC_PORT}`,\n});\n\nconst 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\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\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 * 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\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 * 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\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\n/**\n * Build the configuration fields by merging the default values with the custom configuration\n */\nexport const buildConfigurationFields = (\n customConfiguration?: CustomIntlayerConfig,\n baseDir?: string,\n logFunctions?: LogFunctions\n): IntlayerConfig => {\n const internationalizationConfig = buildInternationalizationFields(\n customConfiguration?.internationalization\n );\n\n const routingConfig = buildRoutingFields(customConfiguration?.routing);\n\n const systemConfig = buildSystemFields(baseDir, customConfiguration?.system);\n\n const contentConfig = buildContentFields(\n systemConfig,\n customConfiguration?.content\n );\n\n const editorConfig = buildEditorFields(customConfiguration?.editor);\n\n const logConfig = buildLogFields(customConfiguration?.log, logFunctions);\n\n const aiConfig = buildAiFields(customConfiguration?.ai);\n\n const buildConfig = buildBuildFields(customConfiguration?.build);\n\n const compilerConfig = buildCompilerFields(customConfiguration?.compiler);\n\n const dictionaryConfig = buildDictionaryFields(\n customConfiguration?.dictionary\n );\n\n storedConfiguration = {\n internationalization: internationalizationConfig,\n routing: routingConfig,\n content: contentConfig,\n system: systemConfig,\n editor: editorConfig,\n log: logConfig,\n ai: aiConfig,\n build: buildConfig,\n compiler: compilerConfig,\n dictionary: dictionaryConfig,\n plugins: customConfiguration?.plugins,\n schemas: customConfiguration?.schemas,\n metadata: {\n name: 'Intlayer',\n version: packageJson.version,\n doc: `https://intlayer.org/docs`,\n },\n } as IntlayerConfig;\n\n return storedConfiguration;\n};\n"],"mappings":"wwBA8EA,IAAI,EAEJ,MAAM,EACJ,IACgC,CAOhC,QAAS,GAAqB,SAAW,EAWzC,gBACE,GAAqB,iBACrB,GAAqB,SACrB,EAUF,WAAY,GAAqB,YAAA,YAOjC,cAAe,GAAqB,eAAiB,EACtD,EAEK,EACJ,IACmB,CAuBnB,KAAM,GAAqB,MAAA,oBAW3B,QAAS,GAAqB,SAAW,EAazC,SAAU,GAAqB,UAAA,GA6B/B,QAAS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- import{AiProviders as e}from"@intlayer/types/config";import{z as t}from"zod";const n=t.object({locales:t.array(t.string()).min(1),requiredLocales:t.array(t.string()).optional(),strictMode:t.enum([`strict`,`inclusive`,`loose`]).optional(),defaultLocale:t.string().optional()}),r=t.object({type:t.literal(`cookie`),name:t.string().optional(),domain:t.string().optional(),path:t.string().optional(),secure:t.boolean().optional(),httpOnly:t.boolean().optional(),sameSite:t.enum([`strict`,`lax`,`none`]).optional(),expires:t.union([t.date(),t.number()]).optional()}),i=t.object({type:t.enum([`localStorage`,`sessionStorage`,`header`]),name:t.string().optional()}),a=t.union([t.literal(!1),t.enum([`cookie`,`localStorage`,`sessionStorage`,`header`]),r,i,t.array(t.union([t.enum([`cookie`,`localStorage`,`sessionStorage`,`header`]),r,i]))]),o=t.object({canonical:t.string(),localized:t.record(t.string(),t.string())}),s=t.object({rules:t.array(o)}),c=t.object({url:s,nextjs:s.optional(),vite:s.optional()}),l=t.object({rewrite:t.union([t.record(t.string(),t.record(t.string(),t.string())),c]).optional(),mode:t.enum([`prefix-no-default`,`prefix-all`,`no-prefix`,`search-params`]).optional(),storage:a.optional(),basePath:t.string().optional()}),u=t.object({baseDir:t.string().optional(),moduleAugmentationDir:t.string().optional(),unmergedDictionariesDir:t.string().optional(),remoteDictionariesDir:t.string().optional(),dictionariesDir:t.string().optional(),dynamicDictionariesDir:t.string().optional(),fetchDictionariesDir:t.string().optional(),typesDir:t.string().optional(),mainDir:t.string().optional(),configDir:t.string().optional(),cacheDir:t.string().optional(),tempDir:t.string().optional(),outputFilesPatternWithPath:t.string().optional()}),d=t.object({fileExtensions:t.array(t.string()).optional(),contentDir:t.array(t.string()).optional(),codeDir:t.array(t.string()).optional(),excludedPath:t.array(t.string()).optional(),watch:t.boolean().optional(),formatCommand:t.string().optional(),watchedFilesPattern:t.array(t.string()).optional(),watchedFilesPatternWithPath:t.array(t.string()).optional()}),f=t.object({applicationURL:t.union([t.url(),t.literal(``)]).optional(),editorURL:t.union([t.url(),t.literal(``)]).optional(),cmsURL:t.union([t.url(),t.literal(``)]).optional(),backendURL:t.union([t.url(),t.literal(``)]).optional(),port:t.number().int().positive().max(65535).optional(),enabled:t.boolean().optional(),clientId:t.string().optional(),clientSecret:t.string().optional(),dictionaryPriorityStrategy:t.enum([`local_first`,`distant_first`]).optional(),liveSync:t.boolean().optional(),liveSyncPort:t.number().int().positive().max(65535).optional(),liveSyncURL:t.union([t.url(),t.literal(``)]).optional()}),p=t.object({mode:t.enum([`default`,`verbose`,`disabled`]).optional(),prefix:t.string().optional(),error:t.function().optional(),log:t.function().optional(),info:t.function().optional(),warn:t.function().optional()}),m=t.object({provider:t.enum(e).optional(),apiKey:t.string().optional(),model:t.string().optional(),temperature:t.number().min(0).max(2).optional(),applicationContext:t.string().optional(),baseURL:t.url().optional(),dataSerialization:t.enum([`json`,`toon`]).optional()}),h=t.object({mode:t.enum([`auto`,`manual`]).optional(),optimize:t.boolean().optional(),importMode:t.enum([`static`,`dynamic`,`fetch`]).optional(),traversePattern:t.array(t.string()).optional(),outputFormat:t.array(t.enum([`cjs`,`esm`])).optional(),cache:t.boolean().optional(),require:t.unknown().optional(),checkTypes:t.boolean().optional()}),g=t.object({enabled:t.union([t.boolean(),t.literal(`build-only`)]).optional(),dictionaryKeyPrefix:t.string().optional(),transformPattern:t.union([t.string(),t.array(t.string())]).optional(),excludePattern:t.union([t.string(),t.array(t.string())]).optional(),output:t.unknown().optional(),noMetadata:t.boolean().optional(),saveComponents:t.boolean().optional()}),_=t.object({fill:t.unknown().optional(),contentAutoTransformation:t.union([t.boolean(),t.object({markdown:t.boolean().optional(),html:t.boolean().optional(),insertion:t.boolean().optional()})]).optional(),location:t.string().optional(),locale:t.string().optional(),title:t.string().optional()}),v=t.object({internationalization:n.optional(),routing:l.optional(),content:d.optional(),system:u.optional(),editor:f.optional(),log:p.optional(),ai:m.optional(),build:h.optional(),compiler:g.optional(),dictionary:_.optional(),plugins:t.array(t.unknown()).optional(),schemas:t.record(t.string(),t.unknown()).optional(),metadata:t.object({name:t.string().optional(),version:t.string().optional(),doc:t.string().optional()}).optional()});export{m as aiSchema,h as buildSchema,g as compilerSchema,d as contentSchema,r as cookiesAttributesSchema,_ as dictionarySchema,f as editorSchema,n as internationalizationSchema,v as intlayerConfigSchema,p as logSchema,c as rewriteObjectSchema,o as rewriteRuleSchema,s as rewriteRulesSchema,l as routingSchema,i as storageAttributesSchema,a as storageSchema,u as systemSchema};
1
+ import{AiProviders as e}from"@intlayer/types/config";import{z as t}from"zod";const n=t.object({locales:t.array(t.string()).min(1),requiredLocales:t.array(t.string()).optional(),strictMode:t.enum([`strict`,`inclusive`,`loose`]).optional(),defaultLocale:t.string().optional()}),r=t.object({type:t.literal(`cookie`),name:t.string().optional(),domain:t.string().optional(),path:t.string().optional(),secure:t.boolean().optional(),httpOnly:t.boolean().optional(),sameSite:t.enum([`strict`,`lax`,`none`]).optional(),expires:t.union([t.date(),t.number()]).optional()}),i=t.object({type:t.enum([`localStorage`,`sessionStorage`,`header`]),name:t.string().optional()}),a=t.union([t.literal(!1),t.enum([`cookie`,`localStorage`,`sessionStorage`,`header`]),r,i,t.array(t.union([t.enum([`cookie`,`localStorage`,`sessionStorage`,`header`]),r,i]))]),o=t.object({canonical:t.string(),localized:t.record(t.string(),t.string())}),s=t.object({rules:t.array(o)}),c=t.object({url:s,nextjs:s.optional(),vite:s.optional()}),l=t.object({rewrite:t.union([t.record(t.string(),t.record(t.string(),t.string())),c]).optional(),mode:t.enum([`prefix-no-default`,`prefix-all`,`no-prefix`,`search-params`]).optional(),storage:a.optional(),basePath:t.string().optional()}),u=t.object({baseDir:t.string().optional(),moduleAugmentationDir:t.string().optional(),unmergedDictionariesDir:t.string().optional(),remoteDictionariesDir:t.string().optional(),dictionariesDir:t.string().optional(),dynamicDictionariesDir:t.string().optional(),fetchDictionariesDir:t.string().optional(),typesDir:t.string().optional(),mainDir:t.string().optional(),configDir:t.string().optional(),cacheDir:t.string().optional(),tempDir:t.string().optional()}),d=t.object({fileExtensions:t.array(t.string()).optional(),contentDir:t.array(t.string()).optional(),codeDir:t.array(t.string()).optional(),excludedPath:t.array(t.string()).optional(),watch:t.boolean().optional(),formatCommand:t.string().optional()}),f=t.object({applicationURL:t.union([t.url(),t.literal(``)]).optional(),editorURL:t.union([t.url(),t.literal(``)]).optional(),cmsURL:t.union([t.url(),t.literal(``)]).optional(),backendURL:t.union([t.url(),t.literal(``)]).optional(),port:t.number().int().positive().max(65535).optional(),enabled:t.boolean().optional(),clientId:t.string().optional(),clientSecret:t.string().optional(),dictionaryPriorityStrategy:t.enum([`local_first`,`distant_first`]).optional(),liveSync:t.boolean().optional(),liveSyncPort:t.number().int().positive().max(65535).optional(),liveSyncURL:t.union([t.url(),t.literal(``)]).optional()}),p=t.object({mode:t.enum([`default`,`verbose`,`disabled`]).optional(),prefix:t.string().optional(),error:t.function().optional(),log:t.function().optional(),info:t.function().optional(),warn:t.function().optional()}),m=t.object({provider:t.enum(e).optional(),apiKey:t.string().optional(),model:t.string().optional(),temperature:t.number().min(0).max(2).optional(),applicationContext:t.string().optional(),baseURL:t.url().optional(),dataSerialization:t.enum([`json`,`toon`]).optional()}),h=t.object({mode:t.enum([`auto`,`manual`]).optional(),optimize:t.boolean().optional(),importMode:t.enum([`static`,`dynamic`,`fetch`]).optional(),traversePattern:t.array(t.string()).optional(),outputFormat:t.array(t.enum([`cjs`,`esm`])).optional(),cache:t.boolean().optional(),require:t.unknown().optional(),checkTypes:t.boolean().optional()}),g=t.object({enabled:t.union([t.boolean(),t.literal(`build-only`)]).optional(),dictionaryKeyPrefix:t.string().optional(),transformPattern:t.union([t.string(),t.array(t.string())]).optional(),excludePattern:t.union([t.string(),t.array(t.string())]).optional(),output:t.unknown().optional(),noMetadata:t.boolean().optional(),saveComponents:t.boolean().optional()}),_=t.object({fill:t.unknown().optional(),contentAutoTransformation:t.union([t.boolean(),t.object({markdown:t.boolean().optional(),html:t.boolean().optional(),insertion:t.boolean().optional()})]).optional(),location:t.string().optional(),locale:t.string().optional(),title:t.string().optional()}),v=t.object({internationalization:n.optional(),routing:l.optional(),content:d.optional(),system:u.optional(),editor:f.optional(),log:p.optional(),ai:m.optional(),build:h.optional(),compiler:g.optional(),dictionary:_.optional(),plugins:t.array(t.unknown()).optional(),schemas:t.record(t.string(),t.unknown()).optional(),metadata:t.object({name:t.string().optional(),version:t.string().optional(),doc:t.string().optional()}).optional()});export{m as aiSchema,h as buildSchema,g as compilerSchema,d as contentSchema,r as cookiesAttributesSchema,_ as dictionarySchema,f as editorSchema,n as internationalizationSchema,v as intlayerConfigSchema,p as logSchema,c as rewriteObjectSchema,o as rewriteRuleSchema,s as rewriteRulesSchema,l as routingSchema,i as storageAttributesSchema,a as storageSchema,u as systemSchema};
2
2
  //# sourceMappingURL=configurationSchema.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"configurationSchema.mjs","names":[],"sources":["../../../src/configFile/configurationSchema.ts"],"sourcesContent":["import { AiProviders } from '@intlayer/types/config';\nimport { z } from 'zod';\n\nexport const internationalizationSchema = z.object({\n locales: z.array(z.string()).min(1),\n requiredLocales: z.array(z.string()).optional(),\n strictMode: z.enum(['strict', 'inclusive', 'loose']).optional(),\n defaultLocale: z.string().optional(),\n});\n\nexport const cookiesAttributesSchema = z.object({\n type: z.literal('cookie'),\n name: z.string().optional(),\n domain: z.string().optional(),\n path: z.string().optional(),\n secure: z.boolean().optional(),\n httpOnly: z.boolean().optional(),\n sameSite: z.enum(['strict', 'lax', 'none']).optional(),\n expires: z.union([z.date(), z.number()]).optional(),\n});\n\nexport const storageAttributesSchema = z.object({\n type: z.enum(['localStorage', 'sessionStorage', 'header']),\n name: z.string().optional(),\n});\n\nexport const storageSchema = z.union([\n z.literal(false),\n z.enum(['cookie', 'localStorage', 'sessionStorage', 'header']),\n cookiesAttributesSchema,\n storageAttributesSchema,\n z.array(\n z.union([\n z.enum(['cookie', 'localStorage', 'sessionStorage', 'header']),\n cookiesAttributesSchema,\n storageAttributesSchema,\n ])\n ),\n]);\n\nexport const rewriteRuleSchema = z.object({\n canonical: z.string(),\n localized: z.record(z.string(), z.string()),\n});\n\nexport const rewriteRulesSchema = z.object({\n rules: z.array(rewriteRuleSchema),\n});\n\nexport const rewriteObjectSchema = z.object({\n url: rewriteRulesSchema,\n nextjs: rewriteRulesSchema.optional(),\n vite: rewriteRulesSchema.optional(),\n});\n\nexport const routingSchema = z.object({\n rewrite: z\n .union([\n z.record(z.string(), z.record(z.string(), z.string())),\n rewriteObjectSchema,\n ])\n .optional(),\n mode: z\n .enum(['prefix-no-default', 'prefix-all', 'no-prefix', 'search-params'])\n .optional(),\n storage: storageSchema.optional(),\n basePath: z.string().optional(),\n});\n\nexport const systemSchema = z.object({\n baseDir: z.string().optional(),\n moduleAugmentationDir: z.string().optional(),\n unmergedDictionariesDir: z.string().optional(),\n remoteDictionariesDir: z.string().optional(),\n dictionariesDir: z.string().optional(),\n dynamicDictionariesDir: z.string().optional(),\n fetchDictionariesDir: z.string().optional(),\n typesDir: z.string().optional(),\n mainDir: z.string().optional(),\n configDir: z.string().optional(),\n cacheDir: z.string().optional(),\n tempDir: z.string().optional(),\n outputFilesPatternWithPath: z.string().optional(),\n});\n\nexport const contentSchema = z.object({\n fileExtensions: z.array(z.string()).optional(),\n contentDir: z.array(z.string()).optional(),\n codeDir: z.array(z.string()).optional(),\n excludedPath: z.array(z.string()).optional(),\n watch: z.boolean().optional(),\n formatCommand: z.string().optional(),\n watchedFilesPattern: z.array(z.string()).optional(),\n watchedFilesPatternWithPath: z.array(z.string()).optional(),\n});\n\nexport const editorSchema = z.object({\n applicationURL: z.union([z.url(), z.literal('')]).optional(),\n editorURL: z.union([z.url(), z.literal('')]).optional(),\n cmsURL: z.union([z.url(), z.literal('')]).optional(),\n backendURL: z.union([z.url(), z.literal('')]).optional(),\n port: z.number().int().positive().max(65535).optional(),\n enabled: z.boolean().optional(),\n clientId: z.string().optional(),\n clientSecret: z.string().optional(),\n dictionaryPriorityStrategy: z\n .enum(['local_first', 'distant_first'])\n .optional(),\n liveSync: z.boolean().optional(),\n liveSyncPort: z.number().int().positive().max(65535).optional(),\n liveSyncURL: z.union([z.url(), z.literal('')]).optional(),\n});\n\nexport const logSchema = z.object({\n mode: z.enum(['default', 'verbose', 'disabled']).optional(),\n prefix: z.string().optional(),\n error: z.function().optional(),\n log: z.function().optional(),\n info: z.function().optional(),\n warn: z.function().optional(),\n});\n\nexport const aiSchema = z.object({\n provider: z.enum(AiProviders).optional(),\n apiKey: z.string().optional(),\n model: z.string().optional(),\n temperature: z.number().min(0).max(2).optional(),\n applicationContext: z.string().optional(),\n baseURL: z.url().optional(),\n dataSerialization: z.enum(['json', 'toon']).optional(),\n});\n\nexport const buildSchema = z.object({\n mode: z.enum(['auto', 'manual']).optional(),\n optimize: z.boolean().optional(),\n importMode: z.enum(['static', 'dynamic', 'fetch']).optional(),\n traversePattern: z.array(z.string()).optional(),\n outputFormat: z.array(z.enum(['cjs', 'esm'])).optional(),\n cache: z.boolean().optional(),\n require: z.unknown().optional(),\n checkTypes: z.boolean().optional(),\n});\n\nexport const compilerSchema = z.object({\n enabled: z.union([z.boolean(), z.literal('build-only')]).optional(),\n dictionaryKeyPrefix: z.string().optional(),\n transformPattern: z.union([z.string(), z.array(z.string())]).optional(),\n excludePattern: z.union([z.string(), z.array(z.string())]).optional(),\n output: z.unknown().optional(),\n noMetadata: z.boolean().optional(),\n saveComponents: z.boolean().optional(),\n});\n\nexport const dictionarySchema = z.object({\n fill: z.unknown().optional(),\n contentAutoTransformation: z\n .union([\n z.boolean(),\n z.object({\n markdown: z.boolean().optional(),\n html: z.boolean().optional(),\n insertion: z.boolean().optional(),\n }),\n ])\n .optional(),\n location: z.string().optional(),\n locale: z.string().optional(),\n title: z.string().optional(),\n});\n\nexport const intlayerConfigSchema = z.object({\n internationalization: internationalizationSchema.optional(),\n routing: routingSchema.optional(),\n content: contentSchema.optional(),\n system: systemSchema.optional(),\n editor: editorSchema.optional(),\n log: logSchema.optional(),\n ai: aiSchema.optional(),\n build: buildSchema.optional(),\n compiler: compilerSchema.optional(),\n dictionary: dictionarySchema.optional(),\n plugins: z.array(z.unknown()).optional(),\n schemas: z.record(z.string(), z.unknown()).optional(),\n metadata: z\n .object({\n name: z.string().optional(),\n version: z.string().optional(),\n doc: z.string().optional(),\n })\n .optional(),\n});\n"],"mappings":"6EAGA,MAAa,EAA6B,EAAE,OAAO,CACjD,QAAS,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC,IAAI,EAAE,CACnC,gBAAiB,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC,UAAU,CAC/C,WAAY,EAAE,KAAK,CAAC,SAAU,YAAa,QAAQ,CAAC,CAAC,UAAU,CAC/D,cAAe,EAAE,QAAQ,CAAC,UAAU,CACrC,CAAC,CAEW,EAA0B,EAAE,OAAO,CAC9C,KAAM,EAAE,QAAQ,SAAS,CACzB,KAAM,EAAE,QAAQ,CAAC,UAAU,CAC3B,OAAQ,EAAE,QAAQ,CAAC,UAAU,CAC7B,KAAM,EAAE,QAAQ,CAAC,UAAU,CAC3B,OAAQ,EAAE,SAAS,CAAC,UAAU,CAC9B,SAAU,EAAE,SAAS,CAAC,UAAU,CAChC,SAAU,EAAE,KAAK,CAAC,SAAU,MAAO,OAAO,CAAC,CAAC,UAAU,CACtD,QAAS,EAAE,MAAM,CAAC,EAAE,MAAM,CAAE,EAAE,QAAQ,CAAC,CAAC,CAAC,UAAU,CACpD,CAAC,CAEW,EAA0B,EAAE,OAAO,CAC9C,KAAM,EAAE,KAAK,CAAC,eAAgB,iBAAkB,SAAS,CAAC,CAC1D,KAAM,EAAE,QAAQ,CAAC,UAAU,CAC5B,CAAC,CAEW,EAAgB,EAAE,MAAM,CACnC,EAAE,QAAQ,GAAM,CAChB,EAAE,KAAK,CAAC,SAAU,eAAgB,iBAAkB,SAAS,CAAC,CAC9D,EACA,EACA,EAAE,MACA,EAAE,MAAM,CACN,EAAE,KAAK,CAAC,SAAU,eAAgB,iBAAkB,SAAS,CAAC,CAC9D,EACA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,SAAU,EACP,OAAO,CACN,KAAM,EAAE,QAAQ,CAAC,UAAU,CAC3B,QAAS,EAAE,QAAQ,CAAC,UAAU,CAC9B,IAAK,EAAE,QAAQ,CAAC,UAAU,CAC3B,CAAC,CACD,UAAU,CACd,CAAC"}
1
+ {"version":3,"file":"configurationSchema.mjs","names":[],"sources":["../../../src/configFile/configurationSchema.ts"],"sourcesContent":["import { AiProviders } from '@intlayer/types/config';\nimport { z } from 'zod';\n\nexport const internationalizationSchema = z.object({\n locales: z.array(z.string()).min(1),\n requiredLocales: z.array(z.string()).optional(),\n strictMode: z.enum(['strict', 'inclusive', 'loose']).optional(),\n defaultLocale: z.string().optional(),\n});\n\nexport const cookiesAttributesSchema = z.object({\n type: z.literal('cookie'),\n name: z.string().optional(),\n domain: z.string().optional(),\n path: z.string().optional(),\n secure: z.boolean().optional(),\n httpOnly: z.boolean().optional(),\n sameSite: z.enum(['strict', 'lax', 'none']).optional(),\n expires: z.union([z.date(), z.number()]).optional(),\n});\n\nexport const storageAttributesSchema = z.object({\n type: z.enum(['localStorage', 'sessionStorage', 'header']),\n name: z.string().optional(),\n});\n\nexport const storageSchema = z.union([\n z.literal(false),\n z.enum(['cookie', 'localStorage', 'sessionStorage', 'header']),\n cookiesAttributesSchema,\n storageAttributesSchema,\n z.array(\n z.union([\n z.enum(['cookie', 'localStorage', 'sessionStorage', 'header']),\n cookiesAttributesSchema,\n storageAttributesSchema,\n ])\n ),\n]);\n\nexport const rewriteRuleSchema = z.object({\n canonical: z.string(),\n localized: z.record(z.string(), z.string()),\n});\n\nexport const rewriteRulesSchema = z.object({\n rules: z.array(rewriteRuleSchema),\n});\n\nexport const rewriteObjectSchema = z.object({\n url: rewriteRulesSchema,\n nextjs: rewriteRulesSchema.optional(),\n vite: rewriteRulesSchema.optional(),\n});\n\nexport const routingSchema = z.object({\n rewrite: z\n .union([\n z.record(z.string(), z.record(z.string(), z.string())),\n rewriteObjectSchema,\n ])\n .optional(),\n mode: z\n .enum(['prefix-no-default', 'prefix-all', 'no-prefix', 'search-params'])\n .optional(),\n storage: storageSchema.optional(),\n basePath: z.string().optional(),\n});\n\nexport const systemSchema = z.object({\n baseDir: z.string().optional(),\n moduleAugmentationDir: z.string().optional(),\n unmergedDictionariesDir: z.string().optional(),\n remoteDictionariesDir: z.string().optional(),\n dictionariesDir: z.string().optional(),\n dynamicDictionariesDir: z.string().optional(),\n fetchDictionariesDir: z.string().optional(),\n typesDir: z.string().optional(),\n mainDir: z.string().optional(),\n configDir: z.string().optional(),\n cacheDir: z.string().optional(),\n tempDir: z.string().optional(),\n});\n\nexport const contentSchema = z.object({\n fileExtensions: z.array(z.string()).optional(),\n contentDir: z.array(z.string()).optional(),\n codeDir: z.array(z.string()).optional(),\n excludedPath: z.array(z.string()).optional(),\n watch: z.boolean().optional(),\n formatCommand: z.string().optional(),\n});\n\nexport const editorSchema = z.object({\n applicationURL: z.union([z.url(), z.literal('')]).optional(),\n editorURL: z.union([z.url(), z.literal('')]).optional(),\n cmsURL: z.union([z.url(), z.literal('')]).optional(),\n backendURL: z.union([z.url(), z.literal('')]).optional(),\n port: z.number().int().positive().max(65535).optional(),\n enabled: z.boolean().optional(),\n clientId: z.string().optional(),\n clientSecret: z.string().optional(),\n dictionaryPriorityStrategy: z\n .enum(['local_first', 'distant_first'])\n .optional(),\n liveSync: z.boolean().optional(),\n liveSyncPort: z.number().int().positive().max(65535).optional(),\n liveSyncURL: z.union([z.url(), z.literal('')]).optional(),\n});\n\nexport const logSchema = z.object({\n mode: z.enum(['default', 'verbose', 'disabled']).optional(),\n prefix: z.string().optional(),\n error: z.function().optional(),\n log: z.function().optional(),\n info: z.function().optional(),\n warn: z.function().optional(),\n});\n\nexport const aiSchema = z.object({\n provider: z.enum(AiProviders).optional(),\n apiKey: z.string().optional(),\n model: z.string().optional(),\n temperature: z.number().min(0).max(2).optional(),\n applicationContext: z.string().optional(),\n baseURL: z.url().optional(),\n dataSerialization: z.enum(['json', 'toon']).optional(),\n});\n\nexport const buildSchema = z.object({\n mode: z.enum(['auto', 'manual']).optional(),\n optimize: z.boolean().optional(),\n importMode: z.enum(['static', 'dynamic', 'fetch']).optional(),\n traversePattern: z.array(z.string()).optional(),\n outputFormat: z.array(z.enum(['cjs', 'esm'])).optional(),\n cache: z.boolean().optional(),\n require: z.unknown().optional(),\n checkTypes: z.boolean().optional(),\n});\n\nexport const compilerSchema = z.object({\n enabled: z.union([z.boolean(), z.literal('build-only')]).optional(),\n dictionaryKeyPrefix: z.string().optional(),\n transformPattern: z.union([z.string(), z.array(z.string())]).optional(),\n excludePattern: z.union([z.string(), z.array(z.string())]).optional(),\n output: z.unknown().optional(),\n noMetadata: z.boolean().optional(),\n saveComponents: z.boolean().optional(),\n});\n\nexport const dictionarySchema = z.object({\n fill: z.unknown().optional(),\n contentAutoTransformation: z\n .union([\n z.boolean(),\n z.object({\n markdown: z.boolean().optional(),\n html: z.boolean().optional(),\n insertion: z.boolean().optional(),\n }),\n ])\n .optional(),\n location: z.string().optional(),\n locale: z.string().optional(),\n title: z.string().optional(),\n});\n\nexport const intlayerConfigSchema = z.object({\n internationalization: internationalizationSchema.optional(),\n routing: routingSchema.optional(),\n content: contentSchema.optional(),\n system: systemSchema.optional(),\n editor: editorSchema.optional(),\n log: logSchema.optional(),\n ai: aiSchema.optional(),\n build: buildSchema.optional(),\n compiler: compilerSchema.optional(),\n dictionary: dictionarySchema.optional(),\n plugins: z.array(z.unknown()).optional(),\n schemas: z.record(z.string(), z.unknown()).optional(),\n metadata: z\n .object({\n name: z.string().optional(),\n version: z.string().optional(),\n doc: z.string().optional(),\n })\n .optional(),\n});\n"],"mappings":"6EAGA,MAAa,EAA6B,EAAE,OAAO,CACjD,QAAS,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC,IAAI,EAAE,CACnC,gBAAiB,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC,UAAU,CAC/C,WAAY,EAAE,KAAK,CAAC,SAAU,YAAa,QAAQ,CAAC,CAAC,UAAU,CAC/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