@intlayer/cli 9.0.0-canary.17 → 9.0.0-canary.19

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 (272) hide show
  1. package/dist/cjs/IntlayerEventListener.cjs +1 -1
  2. package/dist/cjs/IntlayerEventListener.cjs.map +1 -1
  3. package/dist/cjs/_virtual/_utils_asset.cjs +4 -3
  4. package/dist/cjs/auth/login.cjs.map +1 -1
  5. package/dist/cjs/auth/sessionToken.cjs +0 -1
  6. package/dist/cjs/auth/sessionToken.cjs.map +1 -1
  7. package/dist/cjs/build.cjs +0 -1
  8. package/dist/cjs/build.cjs.map +1 -1
  9. package/dist/cjs/bundle.cjs.map +1 -1
  10. package/dist/cjs/ci.cjs +0 -1
  11. package/dist/cjs/ci.cjs.map +1 -1
  12. package/dist/cjs/cli.cjs +13 -9
  13. package/dist/cjs/cli.cjs.map +1 -1
  14. package/dist/cjs/config.cjs +0 -1
  15. package/dist/cjs/config.cjs.map +1 -1
  16. package/dist/cjs/editor.cjs +0 -1
  17. package/dist/cjs/editor.cjs.map +1 -1
  18. package/dist/cjs/extract.cjs.map +1 -1
  19. package/dist/cjs/fill/deepMergeContent.cjs.map +1 -1
  20. package/dist/cjs/fill/extractTranslatableContent.cjs.map +1 -1
  21. package/dist/cjs/fill/fill.cjs.map +1 -1
  22. package/dist/cjs/fill/formatAutoFilledFilePath.cjs +0 -1
  23. package/dist/cjs/fill/formatAutoFilledFilePath.cjs.map +1 -1
  24. package/dist/cjs/fill/formatFillData.cjs +0 -1
  25. package/dist/cjs/fill/formatFillData.cjs.map +1 -1
  26. package/dist/cjs/fill/getAvailableLocalesInDictionary.cjs.map +1 -1
  27. package/dist/cjs/fill/getFilterMissingContentPerLocale.cjs.map +1 -1
  28. package/dist/cjs/fill/listTranslationsTasks.cjs.map +1 -1
  29. package/dist/cjs/fill/translateDictionary.cjs.map +1 -1
  30. package/dist/cjs/fill/writeFill.cjs +0 -1
  31. package/dist/cjs/fill/writeFill.cjs.map +1 -1
  32. package/dist/cjs/getTargetDictionary.cjs +0 -1
  33. package/dist/cjs/getTargetDictionary.cjs.map +1 -1
  34. package/dist/cjs/init.cjs.map +1 -1
  35. package/dist/cjs/initBuildOptimization.cjs.map +1 -1
  36. package/dist/cjs/initCompiler.cjs.map +1 -1
  37. package/dist/cjs/initMCP.cjs.map +1 -1
  38. package/dist/cjs/initSkills.cjs.map +1 -1
  39. package/dist/cjs/listContentDeclaration.cjs +0 -1
  40. package/dist/cjs/listContentDeclaration.cjs.map +1 -1
  41. package/dist/cjs/listProjects.cjs +0 -1
  42. package/dist/cjs/listProjects.cjs.map +1 -1
  43. package/dist/cjs/liveSync.cjs.map +1 -1
  44. package/dist/cjs/pull.cjs.map +1 -1
  45. package/dist/cjs/push/pullLog.cjs +2 -2
  46. package/dist/cjs/push/pullLog.cjs.map +1 -1
  47. package/dist/cjs/push/push.cjs.map +1 -1
  48. package/dist/cjs/pushConfig.cjs +0 -1
  49. package/dist/cjs/pushConfig.cjs.map +1 -1
  50. package/dist/cjs/pushLog.cjs.map +1 -1
  51. package/dist/cjs/reviewDoc/reviewDoc.cjs.map +1 -1
  52. package/dist/cjs/reviewDoc/reviewDocBlockAware.cjs.map +1 -1
  53. package/dist/cjs/reviewDoc/reviewDocLog.cjs +0 -1
  54. package/dist/cjs/reviewDoc/reviewDocLog.cjs.map +1 -1
  55. package/dist/cjs/scan.cjs.map +1 -1
  56. package/dist/cjs/searchDoc.cjs +0 -1
  57. package/dist/cjs/searchDoc.cjs.map +1 -1
  58. package/dist/cjs/test/listMissingTranslations.cjs +1 -2
  59. package/dist/cjs/test/listMissingTranslations.cjs.map +1 -1
  60. package/dist/cjs/test/test.cjs.map +1 -1
  61. package/dist/cjs/translateDoc/translateDoc.cjs.map +1 -1
  62. package/dist/cjs/translateDoc/translateFile.cjs.map +1 -1
  63. package/dist/cjs/translateDoc/validation.cjs.map +1 -1
  64. package/dist/cjs/utils/calculateChunks.cjs +0 -1
  65. package/dist/cjs/utils/calculateChunks.cjs.map +1 -1
  66. package/dist/cjs/utils/checkAccess.cjs.map +1 -1
  67. package/dist/cjs/utils/checkConfigConsistency.cjs.map +1 -1
  68. package/dist/cjs/utils/checkFileModifiedRange.cjs.map +1 -1
  69. package/dist/cjs/utils/checkLastUpdateTime.cjs +0 -1
  70. package/dist/cjs/utils/checkLastUpdateTime.cjs.map +1 -1
  71. package/dist/cjs/utils/chunkInference.cjs +0 -1
  72. package/dist/cjs/utils/chunkInference.cjs.map +1 -1
  73. package/dist/cjs/utils/fixChunkStartEndChars.cjs.map +1 -1
  74. package/dist/cjs/utils/formatLineRanges.cjs.map +1 -1
  75. package/dist/cjs/utils/formatTimeDiff.cjs.map +1 -1
  76. package/dist/cjs/utils/getIsFileUpdatedRecently.cjs +1 -2
  77. package/dist/cjs/utils/getIsFileUpdatedRecently.cjs.map +1 -1
  78. package/dist/cjs/utils/getOutputFilePath.cjs +0 -1
  79. package/dist/cjs/utils/getOutputFilePath.cjs.map +1 -1
  80. package/dist/cjs/utils/getParentPackageJSON.cjs +0 -1
  81. package/dist/cjs/utils/getParentPackageJSON.cjs.map +1 -1
  82. package/dist/cjs/utils/listSpecialChars.cjs.map +1 -1
  83. package/dist/cjs/utils/mapChunksBetweenFiles.cjs +0 -1
  84. package/dist/cjs/utils/mapChunksBetweenFiles.cjs.map +1 -1
  85. package/dist/cjs/utils/openBrowser.cjs +0 -1
  86. package/dist/cjs/utils/openBrowser.cjs.map +1 -1
  87. package/dist/cjs/utils/reorderParagraphs.cjs.map +1 -1
  88. package/dist/cjs/utils/selectCmsEnvironment.cjs.map +1 -1
  89. package/dist/cjs/utils/setupAI.cjs.map +1 -1
  90. package/dist/cjs/watch.cjs +0 -1
  91. package/dist/cjs/watch.cjs.map +1 -1
  92. package/dist/esm/IntlayerEventListener.mjs +1 -0
  93. package/dist/esm/IntlayerEventListener.mjs.map +1 -1
  94. package/dist/esm/_virtual/_utils_asset.mjs +4 -2
  95. package/dist/esm/auth/login.mjs.map +1 -1
  96. package/dist/esm/auth/sessionToken.mjs.map +1 -1
  97. package/dist/esm/build.mjs.map +1 -1
  98. package/dist/esm/bundle.mjs.map +1 -1
  99. package/dist/esm/ci.mjs.map +1 -1
  100. package/dist/esm/cli.mjs +13 -8
  101. package/dist/esm/cli.mjs.map +1 -1
  102. package/dist/esm/config.mjs.map +1 -1
  103. package/dist/esm/editor.mjs.map +1 -1
  104. package/dist/esm/extract.mjs.map +1 -1
  105. package/dist/esm/fill/deepMergeContent.mjs.map +1 -1
  106. package/dist/esm/fill/extractTranslatableContent.mjs.map +1 -1
  107. package/dist/esm/fill/fill.mjs.map +1 -1
  108. package/dist/esm/fill/formatAutoFilledFilePath.mjs.map +1 -1
  109. package/dist/esm/fill/formatFillData.mjs.map +1 -1
  110. package/dist/esm/fill/getAvailableLocalesInDictionary.mjs.map +1 -1
  111. package/dist/esm/fill/getFilterMissingContentPerLocale.mjs.map +1 -1
  112. package/dist/esm/fill/listTranslationsTasks.mjs.map +1 -1
  113. package/dist/esm/fill/translateDictionary.mjs.map +1 -1
  114. package/dist/esm/fill/writeFill.mjs.map +1 -1
  115. package/dist/esm/getTargetDictionary.mjs.map +1 -1
  116. package/dist/esm/init.mjs.map +1 -1
  117. package/dist/esm/initBuildOptimization.mjs.map +1 -1
  118. package/dist/esm/initCompiler.mjs.map +1 -1
  119. package/dist/esm/initMCP.mjs.map +1 -1
  120. package/dist/esm/initSkills.mjs.map +1 -1
  121. package/dist/esm/listContentDeclaration.mjs.map +1 -1
  122. package/dist/esm/listProjects.mjs.map +1 -1
  123. package/dist/esm/liveSync.mjs.map +1 -1
  124. package/dist/esm/pull.mjs.map +1 -1
  125. package/dist/esm/push/pullLog.mjs +2 -2
  126. package/dist/esm/push/pullLog.mjs.map +1 -1
  127. package/dist/esm/push/push.mjs.map +1 -1
  128. package/dist/esm/pushConfig.mjs.map +1 -1
  129. package/dist/esm/pushLog.mjs.map +1 -1
  130. package/dist/esm/reviewDoc/reviewDoc.mjs.map +1 -1
  131. package/dist/esm/reviewDoc/reviewDocBlockAware.mjs.map +1 -1
  132. package/dist/esm/reviewDoc/reviewDocLog.mjs.map +1 -1
  133. package/dist/esm/scan.mjs.map +1 -1
  134. package/dist/esm/searchDoc.mjs.map +1 -1
  135. package/dist/esm/test/listMissingTranslations.mjs +1 -1
  136. package/dist/esm/test/listMissingTranslations.mjs.map +1 -1
  137. package/dist/esm/test/test.mjs.map +1 -1
  138. package/dist/esm/translateDoc/translateDoc.mjs.map +1 -1
  139. package/dist/esm/translateDoc/translateFile.mjs.map +1 -1
  140. package/dist/esm/translateDoc/validation.mjs.map +1 -1
  141. package/dist/esm/utils/calculateChunks.mjs.map +1 -1
  142. package/dist/esm/utils/checkAccess.mjs.map +1 -1
  143. package/dist/esm/utils/checkConfigConsistency.mjs.map +1 -1
  144. package/dist/esm/utils/checkFileModifiedRange.mjs.map +1 -1
  145. package/dist/esm/utils/checkLastUpdateTime.mjs.map +1 -1
  146. package/dist/esm/utils/chunkInference.mjs.map +1 -1
  147. package/dist/esm/utils/fixChunkStartEndChars.mjs.map +1 -1
  148. package/dist/esm/utils/formatLineRanges.mjs.map +1 -1
  149. package/dist/esm/utils/formatTimeDiff.mjs.map +1 -1
  150. package/dist/esm/utils/getIsFileUpdatedRecently.mjs +1 -1
  151. package/dist/esm/utils/getIsFileUpdatedRecently.mjs.map +1 -1
  152. package/dist/esm/utils/getOutputFilePath.mjs.map +1 -1
  153. package/dist/esm/utils/getParentPackageJSON.mjs.map +1 -1
  154. package/dist/esm/utils/listSpecialChars.mjs.map +1 -1
  155. package/dist/esm/utils/mapChunksBetweenFiles.mjs.map +1 -1
  156. package/dist/esm/utils/openBrowser.mjs.map +1 -1
  157. package/dist/esm/utils/reorderParagraphs.mjs.map +1 -1
  158. package/dist/esm/utils/selectCmsEnvironment.mjs.map +1 -1
  159. package/dist/esm/utils/setupAI.mjs.map +1 -1
  160. package/dist/esm/watch.mjs.map +1 -1
  161. package/dist/types/IntlayerEventListener.d.ts +0 -1
  162. package/dist/types/IntlayerEventListener.d.ts.map +1 -1
  163. package/dist/types/auth/login.d.ts +0 -1
  164. package/dist/types/auth/login.d.ts.map +1 -1
  165. package/dist/types/auth/sessionToken.d.ts +0 -1
  166. package/dist/types/auth/sessionToken.d.ts.map +1 -1
  167. package/dist/types/build.d.ts +0 -1
  168. package/dist/types/build.d.ts.map +1 -1
  169. package/dist/types/bundle.d.ts +0 -1
  170. package/dist/types/bundle.d.ts.map +1 -1
  171. package/dist/types/ci.d.ts.map +1 -1
  172. package/dist/types/cli.d.ts +0 -1
  173. package/dist/types/cli.d.ts.map +1 -1
  174. package/dist/types/config.d.ts +0 -1
  175. package/dist/types/config.d.ts.map +1 -1
  176. package/dist/types/editor.d.ts.map +1 -1
  177. package/dist/types/extract.d.ts +0 -1
  178. package/dist/types/extract.d.ts.map +1 -1
  179. package/dist/types/fill/deepMergeContent.d.ts.map +1 -1
  180. package/dist/types/fill/extractTranslatableContent.d.ts.map +1 -1
  181. package/dist/types/fill/fill.d.ts +0 -1
  182. package/dist/types/fill/fill.d.ts.map +1 -1
  183. package/dist/types/fill/formatAutoFilledFilePath.d.ts +0 -1
  184. package/dist/types/fill/formatAutoFilledFilePath.d.ts.map +1 -1
  185. package/dist/types/fill/formatFillData.d.ts +0 -1
  186. package/dist/types/fill/formatFillData.d.ts.map +1 -1
  187. package/dist/types/fill/getAvailableLocalesInDictionary.d.ts +0 -1
  188. package/dist/types/fill/getAvailableLocalesInDictionary.d.ts.map +1 -1
  189. package/dist/types/fill/getFilterMissingContentPerLocale.d.ts +0 -1
  190. package/dist/types/fill/getFilterMissingContentPerLocale.d.ts.map +1 -1
  191. package/dist/types/fill/listTranslationsTasks.d.ts +1 -2
  192. package/dist/types/fill/listTranslationsTasks.d.ts.map +1 -1
  193. package/dist/types/fill/translateDictionary.d.ts +1 -3
  194. package/dist/types/fill/translateDictionary.d.ts.map +1 -1
  195. package/dist/types/fill/writeFill.d.ts +0 -1
  196. package/dist/types/fill/writeFill.d.ts.map +1 -1
  197. package/dist/types/getTargetDictionary.d.ts +0 -1
  198. package/dist/types/getTargetDictionary.d.ts.map +1 -1
  199. package/dist/types/index.d.ts +5 -4
  200. package/dist/types/init.d.ts +0 -1
  201. package/dist/types/init.d.ts.map +1 -1
  202. package/dist/types/initBuildOptimization.d.ts.map +1 -1
  203. package/dist/types/initCompiler.d.ts.map +1 -1
  204. package/dist/types/initMCP.d.ts +0 -1
  205. package/dist/types/initMCP.d.ts.map +1 -1
  206. package/dist/types/initSkills.d.ts +0 -1
  207. package/dist/types/initSkills.d.ts.map +1 -1
  208. package/dist/types/listContentDeclaration.d.ts +0 -1
  209. package/dist/types/listContentDeclaration.d.ts.map +1 -1
  210. package/dist/types/listProjects.d.ts +0 -1
  211. package/dist/types/listProjects.d.ts.map +1 -1
  212. package/dist/types/liveSync.d.ts +0 -1
  213. package/dist/types/liveSync.d.ts.map +1 -1
  214. package/dist/types/pull.d.ts +0 -1
  215. package/dist/types/pull.d.ts.map +1 -1
  216. package/dist/types/push/pullLog.d.ts +0 -1
  217. package/dist/types/push/pullLog.d.ts.map +1 -1
  218. package/dist/types/push/push.d.ts +0 -1
  219. package/dist/types/push/push.d.ts.map +1 -1
  220. package/dist/types/pushConfig.d.ts +0 -1
  221. package/dist/types/pushConfig.d.ts.map +1 -1
  222. package/dist/types/pushLog.d.ts.map +1 -1
  223. package/dist/types/reviewDoc/reviewDoc.d.ts +1 -16
  224. package/dist/types/reviewDoc/reviewDoc.d.ts.map +1 -1
  225. package/dist/types/reviewDoc/reviewDocBlockAware.d.ts +0 -1
  226. package/dist/types/reviewDoc/reviewDocBlockAware.d.ts.map +1 -1
  227. package/dist/types/reviewDoc/reviewDocLog.d.ts +0 -1
  228. package/dist/types/reviewDoc/reviewDocLog.d.ts.map +1 -1
  229. package/dist/types/scan.d.ts +3 -2
  230. package/dist/types/scan.d.ts.map +1 -1
  231. package/dist/types/searchDoc.d.ts +1 -6
  232. package/dist/types/searchDoc.d.ts.map +1 -1
  233. package/dist/types/test/listMissingTranslations.d.ts +0 -1
  234. package/dist/types/test/listMissingTranslations.d.ts.map +1 -1
  235. package/dist/types/test/test.d.ts +0 -1
  236. package/dist/types/test/test.d.ts.map +1 -1
  237. package/dist/types/translateDoc/translateDoc.d.ts +1 -16
  238. package/dist/types/translateDoc/translateDoc.d.ts.map +1 -1
  239. package/dist/types/translateDoc/translateFile.d.ts +1 -16
  240. package/dist/types/translateDoc/translateFile.d.ts.map +1 -1
  241. package/dist/types/translateDoc/types.d.ts +0 -1
  242. package/dist/types/translateDoc/types.d.ts.map +1 -1
  243. package/dist/types/translateDoc/validation.d.ts +0 -1
  244. package/dist/types/translateDoc/validation.d.ts.map +1 -1
  245. package/dist/types/utils/calculateChunks.d.ts.map +1 -1
  246. package/dist/types/utils/checkAccess.d.ts +0 -1
  247. package/dist/types/utils/checkAccess.d.ts.map +1 -1
  248. package/dist/types/utils/checkConfigConsistency.d.ts.map +1 -1
  249. package/dist/types/utils/checkFileModifiedRange.d.ts.map +1 -1
  250. package/dist/types/utils/checkLastUpdateTime.d.ts.map +1 -1
  251. package/dist/types/utils/chunkInference.d.ts +0 -1
  252. package/dist/types/utils/chunkInference.d.ts.map +1 -1
  253. package/dist/types/utils/fixChunkStartEndChars.d.ts.map +1 -1
  254. package/dist/types/utils/formatLineRanges.d.ts.map +1 -1
  255. package/dist/types/utils/formatTimeDiff.d.ts.map +1 -1
  256. package/dist/types/utils/getIsFileUpdatedRecently.d.ts.map +1 -1
  257. package/dist/types/utils/getOutputFilePath.d.ts +0 -1
  258. package/dist/types/utils/getOutputFilePath.d.ts.map +1 -1
  259. package/dist/types/utils/getParentPackageJSON.d.ts.map +1 -1
  260. package/dist/types/utils/listSpecialChars.d.ts +4 -2
  261. package/dist/types/utils/listSpecialChars.d.ts.map +1 -1
  262. package/dist/types/utils/mapChunksBetweenFiles.d.ts +0 -1
  263. package/dist/types/utils/mapChunksBetweenFiles.d.ts.map +1 -1
  264. package/dist/types/utils/openBrowser.d.ts.map +1 -1
  265. package/dist/types/utils/reorderParagraphs.d.ts.map +1 -1
  266. package/dist/types/utils/selectCmsEnvironment.d.ts +0 -1
  267. package/dist/types/utils/selectCmsEnvironment.d.ts.map +1 -1
  268. package/dist/types/utils/setupAI.d.ts +1 -3
  269. package/dist/types/utils/setupAI.d.ts.map +1 -1
  270. package/dist/types/watch.d.ts +0 -1
  271. package/dist/types/watch.d.ts.map +1 -1
  272. package/package.json +15 -15
@@ -1,5 +1,4 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_runtime = require('./_virtual/_rolldown/runtime.cjs');
3
2
  let _intlayer_config_logger = require("@intlayer/config/logger");
4
3
  let _intlayer_api = require("@intlayer/api");
5
4
  let _intlayer_config_built = require("@intlayer/config/built");
@@ -31,6 +30,7 @@ let eventsource = require("eventsource");
31
30
  * };
32
31
  */
33
32
  var IntlayerEventListener = class {
33
+ intlayerConfig;
34
34
  appLogger = (0, _intlayer_config_logger.getAppLogger)({ log: _intlayer_config_built.log });
35
35
  eventSource = null;
36
36
  reconnectAttempts = 0;
@@ -1 +1 @@
1
- {"version":3,"file":"IntlayerEventListener.cjs","names":["EventSource"],"sources":["../../src/IntlayerEventListener.ts"],"sourcesContent":["import { getIntlayerAPIProxy } from '@intlayer/api';\n// @ts-ignore: @intlayer/backend is not built yet\nimport type { DictionaryAPI, MessageEventData } from '@intlayer/backend';\nimport { editor, log } from '@intlayer/config/built';\nimport { getAppLogger } from '@intlayer/config/logger';\nimport type { IntlayerConfig } from '@intlayer/types/config';\nimport { EventSource } from 'eventsource';\n\nexport type IntlayerMessageEvent = MessageEvent;\n\n/**\n * IntlayerEventListener class to listen for dictionary changes via SSE (Server-Sent Events).\n *\n * Usage example:\n *\n * import { buildIntlayerDictionary } from './transpiler/declaration_file_to_dictionary/intlayer_dictionary';\n * import { IntlayerEventListener } from '@intlayer/api';\n *\n * export const checkDictionaryChanges = async () => {\n * // Instantiate the listener\n * const eventListener = new IntlayerEventListener();\n *\n * // Set up your callbacks\n * eventListener.onDictionaryChange = async (dictionary) => {\n * await buildIntlayerDictionary(dictionary);\n * };\n *\n * // Initialize the listener\n * await eventListener.initialize();\n *\n * // Optionally, clean up later when you’re done\n * // eventListener.cleanup();\n * };\n */\nexport class IntlayerEventListener {\n private appLogger = getAppLogger({ log });\n\n private eventSource: EventSource | null = null;\n private reconnectAttempts = 0;\n private maxReconnectAttempts = 5;\n private reconnectDelay = 1000; // Start with 1 second\n private isManuallyDisconnected = false;\n private reconnectTimeout: NodeJS.Timeout | null = null;\n\n /**\n * Callback triggered when a Dictionary is ADDED.\n */\n public onDictionaryAdded?: (dictionary: DictionaryAPI) => any;\n\n /**\n * Callback triggered when a Dictionary is UPDATED.\n */\n public onDictionaryChange?: (dictionary: DictionaryAPI) => any;\n\n /**\n * Callback triggered when a Dictionary is DELETED.\n */\n public onDictionaryDeleted?: (dictionary: DictionaryAPI) => any;\n\n /**\n * Callback triggered when connection is established or re-established.\n */\n public onConnectionOpen?: () => any;\n\n /**\n * Callback triggered when connection encounters an error.\n */\n public onConnectionError?: (error: Event) => any;\n\n constructor(\n private intlayerConfig: Pick<IntlayerConfig, 'log' | 'editor'> = {\n log,\n editor,\n }\n ) {\n this.appLogger = getAppLogger(this.intlayerConfig);\n }\n\n /**\n * Initializes the EventSource connection using the given intlayerConfig\n * (or the default config if none was provided).\n */\n public async initialize(): Promise<void> {\n this.isManuallyDisconnected = false;\n await this.connect();\n }\n\n /**\n * Establishes the EventSource connection with automatic reconnection support.\n */\n private async connect(): Promise<void> {\n try {\n const backendURL = this.intlayerConfig.editor.backendURL;\n\n // Retrieve the access token via proxy\n const accessToken = await getIntlayerAPIProxy(\n undefined,\n this.intlayerConfig\n ).oAuth.getOAuth2AccessToken();\n\n if (!accessToken) {\n throw new Error('Failed to retrieve access token');\n }\n\n const API_ROUTE = `${backendURL}/api/event-listener`;\n\n // Close existing connection if any\n if (this.eventSource) {\n this.eventSource.close();\n }\n\n this.eventSource = new EventSource(API_ROUTE, {\n fetch: (input, init) =>\n fetch(input, {\n ...init,\n headers: {\n ...(init?.headers ?? {}),\n Authorization: `Bearer ${accessToken.data?.accessToken}`,\n },\n }),\n });\n\n this.eventSource.onopen = () => {\n this.reconnectAttempts = 0;\n this.reconnectDelay = 1000; // Reset delay\n this.onConnectionOpen?.();\n };\n\n this.eventSource.onmessage = (event) => this.handleMessage(event);\n this.eventSource.onerror = (event) => this.handleError(event);\n } catch (_error) {\n this.appLogger('Failed to establish EventSource connection:', {\n level: 'error',\n });\n this.scheduleReconnect();\n }\n }\n\n /**\n * Cleans up (closes) the EventSource connection.\n */\n public cleanup(): void {\n this.isManuallyDisconnected = true;\n\n if (this.reconnectTimeout) {\n clearTimeout(this.reconnectTimeout);\n this.reconnectTimeout = null;\n }\n\n if (this.eventSource) {\n this.eventSource.close();\n this.eventSource = null;\n }\n }\n\n /**\n * Schedules a reconnection attempt with exponential backoff.\n */\n private scheduleReconnect(): void {\n if (\n this.isManuallyDisconnected ||\n this.reconnectAttempts >= this.maxReconnectAttempts\n ) {\n if (this.reconnectAttempts >= this.maxReconnectAttempts) {\n this.appLogger(\n [\n `Max reconnection attempts (${this.maxReconnectAttempts}) reached. Giving up.`,\n ],\n {\n level: 'error',\n }\n );\n }\n return;\n }\n\n this.reconnectAttempts++;\n const delay = this.reconnectDelay * 2 ** (this.reconnectAttempts - 1); // Exponential backoff\n\n this.appLogger(\n `Scheduling reconnection attempt ${this.reconnectAttempts}/${this.maxReconnectAttempts} in ${delay}ms`\n );\n\n this.reconnectTimeout = setTimeout(async () => {\n if (!this.isManuallyDisconnected) {\n await this.connect();\n }\n }, delay);\n }\n\n /**\n * Handles incoming SSE messages, parses the event data,\n * and invokes the appropriate callback.\n */\n private async handleMessage(event: IntlayerMessageEvent): Promise<void> {\n try {\n const { data } = event;\n\n const dataJSON: MessageEventData[] = JSON.parse(data);\n\n for (const dataEl of dataJSON) {\n switch (dataEl.object) {\n case 'DICTIONARY':\n switch (dataEl.status) {\n case 'ADDED':\n await this.onDictionaryAdded?.(dataEl.data);\n break;\n case 'UPDATED':\n await this.onDictionaryChange?.(dataEl.data);\n break;\n case 'DELETED':\n await this.onDictionaryDeleted?.(dataEl.data);\n break;\n default:\n this.appLogger(\n ['Unhandled dictionary status:', dataEl.status],\n {\n level: 'error',\n }\n );\n break;\n }\n break;\n default:\n this.appLogger(['Unknown object type:', dataEl.object], {\n level: 'error',\n });\n break;\n }\n }\n } catch (error) {\n this.appLogger(['Error processing dictionary update:', error], {\n level: 'error',\n });\n }\n }\n\n /**\n * Handles any SSE errors and attempts reconnection if appropriate.\n */\n private handleError(event: Event): void {\n const errorEvent = event as any;\n\n // Log detailed error information\n this.appLogger(\n [\n 'EventSource error:',\n {\n type: errorEvent.type,\n message: errorEvent.message,\n code: errorEvent.code,\n readyState: this.eventSource?.readyState,\n url: this.eventSource?.url,\n },\n ],\n {\n level: 'error',\n }\n );\n\n // Notify error callback\n this.onConnectionError?.(event);\n\n // Check if this is a connection close error\n const isConnectionClosed =\n errorEvent.type === 'error' &&\n (errorEvent.message?.includes('terminated') ||\n errorEvent.message?.includes('closed') ||\n this.eventSource?.readyState === EventSource.CLOSED);\n\n if (isConnectionClosed && !this.isManuallyDisconnected) {\n this.appLogger(\n 'Connection was terminated by server, attempting to reconnect...'\n );\n this.scheduleReconnect();\n } else {\n // For other types of errors, close the connection\n this.cleanup();\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkCA,IAAa,wBAAb,MAAmC;CACjC,AAAQ,sDAAyB,EAAE,iCAAK,CAAC;CAEzC,AAAQ,cAAkC;CAC1C,AAAQ,oBAAoB;CAC5B,AAAQ,uBAAuB;CAC/B,AAAQ,iBAAiB;CACzB,AAAQ,yBAAyB;CACjC,AAAQ,mBAA0C;;;;CAKlD,AAAO;;;;CAKP,AAAO;;;;CAKP,AAAO;;;;CAKP,AAAO;;;;CAKP,AAAO;CAEP,YACE,AAAQ,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wBAAwB;AACtD,QAAK,UACH,kEACD;AACD,QAAK,mBAAmB;QAGxB,MAAK,SAAS"}
1
+ {"version":3,"file":"IntlayerEventListener.cjs","names":["EventSource"],"sources":["../../src/IntlayerEventListener.ts"],"sourcesContent":["import { getIntlayerAPIProxy } from '@intlayer/api';\n// @ts-ignore: @intlayer/backend is not built yet\nimport type { DictionaryAPI, MessageEventData } from '@intlayer/backend';\nimport { editor, log } from '@intlayer/config/built';\nimport { getAppLogger } from '@intlayer/config/logger';\nimport type { IntlayerConfig } from '@intlayer/types/config';\nimport { EventSource } from 'eventsource';\n\nexport type IntlayerMessageEvent = MessageEvent;\n\n/**\n * IntlayerEventListener class to listen for dictionary changes via SSE (Server-Sent Events).\n *\n * Usage example:\n *\n * import { buildIntlayerDictionary } from './transpiler/declaration_file_to_dictionary/intlayer_dictionary';\n * import { IntlayerEventListener } from '@intlayer/api';\n *\n * export const checkDictionaryChanges = async () => {\n * // Instantiate the listener\n * const eventListener = new IntlayerEventListener();\n *\n * // Set up your callbacks\n * eventListener.onDictionaryChange = async (dictionary) => {\n * await buildIntlayerDictionary(dictionary);\n * };\n *\n * // Initialize the listener\n * await eventListener.initialize();\n *\n * // Optionally, clean up later when you’re done\n * // eventListener.cleanup();\n * };\n */\nexport class IntlayerEventListener {\n private appLogger = getAppLogger({ log });\n\n private eventSource: EventSource | null = null;\n private reconnectAttempts = 0;\n private maxReconnectAttempts = 5;\n private reconnectDelay = 1000; // Start with 1 second\n private isManuallyDisconnected = false;\n private reconnectTimeout: NodeJS.Timeout | null = null;\n\n /**\n * Callback triggered when a Dictionary is ADDED.\n */\n public onDictionaryAdded?: (dictionary: DictionaryAPI) => any;\n\n /**\n * Callback triggered when a Dictionary is UPDATED.\n */\n public onDictionaryChange?: (dictionary: DictionaryAPI) => any;\n\n /**\n * Callback triggered when a Dictionary is DELETED.\n */\n public onDictionaryDeleted?: (dictionary: DictionaryAPI) => any;\n\n /**\n * Callback triggered when connection is established or re-established.\n */\n public onConnectionOpen?: () => any;\n\n /**\n * Callback triggered when connection encounters an error.\n */\n public onConnectionError?: (error: Event) => any;\n\n constructor(\n private intlayerConfig: Pick<IntlayerConfig, 'log' | 'editor'> = {\n log,\n editor,\n }\n ) {\n this.appLogger = getAppLogger(this.intlayerConfig);\n }\n\n /**\n * Initializes the EventSource connection using the given intlayerConfig\n * (or the default config if none was provided).\n */\n public async initialize(): Promise<void> {\n this.isManuallyDisconnected = false;\n await this.connect();\n }\n\n /**\n * Establishes the EventSource connection with automatic reconnection support.\n */\n private async connect(): Promise<void> {\n try {\n const backendURL = this.intlayerConfig.editor.backendURL;\n\n // Retrieve the access token via proxy\n const accessToken = await getIntlayerAPIProxy(\n undefined,\n this.intlayerConfig\n ).oAuth.getOAuth2AccessToken();\n\n if (!accessToken) {\n throw new Error('Failed to retrieve access token');\n }\n\n const API_ROUTE = `${backendURL}/api/event-listener`;\n\n // Close existing connection if any\n if (this.eventSource) {\n this.eventSource.close();\n }\n\n this.eventSource = new EventSource(API_ROUTE, {\n fetch: (input, init) =>\n fetch(input, {\n ...init,\n headers: {\n ...(init?.headers ?? {}),\n Authorization: `Bearer ${accessToken.data?.accessToken}`,\n },\n }),\n });\n\n this.eventSource.onopen = () => {\n this.reconnectAttempts = 0;\n this.reconnectDelay = 1000; // Reset delay\n this.onConnectionOpen?.();\n };\n\n this.eventSource.onmessage = (event) => this.handleMessage(event);\n this.eventSource.onerror = (event) => this.handleError(event);\n } catch (_error) {\n this.appLogger('Failed to establish EventSource connection:', {\n level: 'error',\n });\n this.scheduleReconnect();\n }\n }\n\n /**\n * Cleans up (closes) the EventSource connection.\n */\n public cleanup(): void {\n this.isManuallyDisconnected = true;\n\n if (this.reconnectTimeout) {\n clearTimeout(this.reconnectTimeout);\n this.reconnectTimeout = null;\n }\n\n if (this.eventSource) {\n this.eventSource.close();\n this.eventSource = null;\n }\n }\n\n /**\n * Schedules a reconnection attempt with exponential backoff.\n */\n private scheduleReconnect(): void {\n if (\n this.isManuallyDisconnected ||\n this.reconnectAttempts >= this.maxReconnectAttempts\n ) {\n if (this.reconnectAttempts >= this.maxReconnectAttempts) {\n this.appLogger(\n [\n `Max reconnection attempts (${this.maxReconnectAttempts}) reached. Giving up.`,\n ],\n {\n level: 'error',\n }\n );\n }\n return;\n }\n\n this.reconnectAttempts++;\n const delay = this.reconnectDelay * 2 ** (this.reconnectAttempts - 1); // Exponential backoff\n\n this.appLogger(\n `Scheduling reconnection attempt ${this.reconnectAttempts}/${this.maxReconnectAttempts} in ${delay}ms`\n );\n\n this.reconnectTimeout = setTimeout(async () => {\n if (!this.isManuallyDisconnected) {\n await this.connect();\n }\n }, delay);\n }\n\n /**\n * Handles incoming SSE messages, parses the event data,\n * and invokes the appropriate callback.\n */\n private async handleMessage(event: IntlayerMessageEvent): Promise<void> {\n try {\n const { data } = event;\n\n const dataJSON: MessageEventData[] = JSON.parse(data);\n\n for (const dataEl of dataJSON) {\n switch (dataEl.object) {\n case 'DICTIONARY':\n switch (dataEl.status) {\n case 'ADDED':\n await this.onDictionaryAdded?.(dataEl.data);\n break;\n case 'UPDATED':\n await this.onDictionaryChange?.(dataEl.data);\n break;\n case 'DELETED':\n await this.onDictionaryDeleted?.(dataEl.data);\n break;\n default:\n this.appLogger(\n ['Unhandled dictionary status:', dataEl.status],\n {\n level: 'error',\n }\n );\n break;\n }\n break;\n default:\n this.appLogger(['Unknown object type:', dataEl.object], {\n level: 'error',\n });\n break;\n }\n }\n } catch (error) {\n this.appLogger(['Error processing dictionary update:', error], {\n level: 'error',\n });\n }\n }\n\n /**\n * Handles any SSE errors and attempts reconnection if appropriate.\n */\n private handleError(event: Event): void {\n const errorEvent = event as any;\n\n // Log detailed error information\n this.appLogger(\n [\n 'EventSource error:',\n {\n type: errorEvent.type,\n message: errorEvent.message,\n code: errorEvent.code,\n readyState: this.eventSource?.readyState,\n url: this.eventSource?.url,\n },\n ],\n {\n level: 'error',\n }\n );\n\n // Notify error callback\n this.onConnectionError?.(event);\n\n // Check if this is a connection close error\n const isConnectionClosed =\n errorEvent.type === 'error' &&\n (errorEvent.message?.includes('terminated') ||\n errorEvent.message?.includes('closed') ||\n this.eventSource?.readyState === EventSource.CLOSED);\n\n if (isConnectionClosed && !this.isManuallyDisconnected) {\n this.appLogger(\n 'Connection was terminated by server, attempting to reconnect...'\n );\n this.scheduleReconnect();\n } else {\n // For other types of errors, close the connection\n this.cleanup();\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkCA,IAAa,wBAAb,MAAmC;CAoCvB;CAnCV,AAAQ,sDAAyB,EAAE,gCAAI,CAAC;CAExC,AAAQ,cAAkC;CAC1C,AAAQ,oBAAoB;CAC5B,AAAQ,uBAAuB;CAC/B,AAAQ,iBAAiB;CACzB,AAAQ,yBAAyB;CACjC,AAAQ,mBAA0C;;;;CAKlD,AAAO;;;;CAKP,AAAO;;;;CAKP,AAAO;;;;CAKP,AAAO;;;;CAKP,AAAO;CAEP,YACE,AAAQ,iBAAyD;EAC/D;EACA;CACF,GACA;EAJQ;EAKR,KAAK,sDAAyB,KAAK,cAAc;CACnD;;;;;CAMA,MAAa,aAA4B;EACvC,KAAK,yBAAyB;EAC9B,MAAM,KAAK,QAAQ;CACrB;;;;CAKA,MAAc,UAAyB;EACrC,IAAI;GACF,MAAM,aAAa,KAAK,eAAe,OAAO;GAG9C,MAAM,cAAc,6CAClB,QACA,KAAK,cACP,CAAC,CAAC,MAAM,qBAAqB;GAE7B,IAAI,CAAC,aACH,MAAM,IAAI,MAAM,iCAAiC;GAGnD,MAAM,YAAY,GAAG,WAAW;GAGhC,IAAI,KAAK,aACP,KAAK,YAAY,MAAM;GAGzB,KAAK,cAAc,IAAIA,wBAAY,WAAW,EAC5C,QAAQ,OAAO,SACb,MAAM,OAAO;IACX,GAAG;IACH,SAAS;KACP,GAAI,MAAM,WAAW,CAAC;KACtB,eAAe,UAAU,YAAY,MAAM;IAC7C;GACF,CAAC,EACL,CAAC;GAED,KAAK,YAAY,eAAe;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,MAAM,KAAK,sBAAsB,OAAO,IAAI;OAC5C;MACF;OACE,KAAK,UACH,CAAC,gCAAgC,OAAO,MAAM,GAC9C,EACE,OAAO,QACT,CACF;OACA;KACJ;KACA;IACF;KACE,KAAK,UAAU,CAAC,wBAAwB,OAAO,MAAM,GAAG,EACtD,OAAO,QACT,CAAC;KACD;GACJ;EAEJ,SAAS,OAAO;GACd,KAAK,UAAU,CAAC,uCAAuC,KAAK,GAAG,EAC7D,OAAO,QACT,CAAC;EACH;CACF;;;;CAKA,AAAQ,YAAY,OAAoB;EACtC,MAAM,aAAa;EAGnB,KAAK,UACH,CACE,sBACA;GACE,MAAM,WAAW;GACjB,SAAS,WAAW;GACpB,MAAM,WAAW;GACjB,YAAY,KAAK,aAAa;GAC9B,KAAK,KAAK,aAAa;EACzB,CACF,GACA,EACE,OAAO,QACT,CACF;EAGA,KAAK,oBAAoB,KAAK;EAS9B,IALE,WAAW,SAAS,YACnB,WAAW,SAAS,SAAS,YAAY,KACxC,WAAW,SAAS,SAAS,QAAQ,KACrC,KAAK,aAAa,eAAeA,wBAAY,WAEvB,CAAC,KAAK,wBAAwB;GACtD,KAAK,UACH,iEACF;GACA,KAAK,kBAAkB;EACzB,OAEE,KAAK,QAAQ;CAEjB;AACF"}
@@ -1,4 +1,3 @@
1
- const require_runtime = require('./_rolldown/runtime.cjs');
2
1
  let node_fs = require("node:fs");
3
2
  let node_path = require("node:path");
4
3
  let node_url = require("node:url");
@@ -42,13 +41,15 @@ const getCallerDir = () => {
42
41
  const frames = err.stack || [];
43
42
  const isVirtualPath = (p) => p.includes(`${node_path.sep}_virtual${node_path.sep}`) || p.includes("/_virtual/");
44
43
  for (const frame of frames) {
45
- const file = normalizeFrameFile(typeof frame.getFileName === "function" ? frame.getFileName() : null);
44
+ const raw = typeof frame.getFileName === "function" ? frame.getFileName() : null;
45
+ const file = normalizeFrameFile(raw);
46
46
  if (!file) continue;
47
47
  if (file.includes("node:internal") || file.includes(`${node_path.sep}internal${node_path.sep}modules${node_path.sep}`)) continue;
48
48
  if (!isVirtualPath(file)) return (0, node_path.dirname)(file);
49
49
  }
50
50
  for (const frame of frames) {
51
- const file = normalizeFrameFile(typeof frame.getFileName === "function" ? frame.getFileName() : null);
51
+ const raw = typeof frame.getFileName === "function" ? frame.getFileName() : null;
52
+ const file = normalizeFrameFile(raw);
52
53
  if (file) return (0, node_path.dirname)(file);
53
54
  }
54
55
  } catch {} finally {
@@ -1 +1 @@
1
- {"version":3,"file":"login.cjs","names":["http","URL","ANSIColors","writeCliSessionToken"],"sources":["../../../src/auth/login.ts"],"sourcesContent":["import http from 'node:http';\nimport { URL } from 'node:url';\nimport * as ANSIColors from '@intlayer/config/colors';\nimport { colorize, colorizePath, getAppLogger } from '@intlayer/config/logger';\nimport {\n type GetConfigurationOptions,\n getConfiguration,\n} from '@intlayer/config/node';\nimport { logConfigDetails } from '@intlayer/engine/cli';\nimport { openBrowser } from '../utils/openBrowser';\nimport { writeCliSessionToken } from './sessionToken';\n\nconst buildSuccessHtml = (message: string): string => `\n <!DOCTYPE html>\n <html lang=\"en\" data-theme=\"dark\">\n <head>\n <meta charset=\"UTF-8\">\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n <title>Intlayer CLI Login</title>\n <style>\n :root {\n --color-background: rgba(23, 23, 23);\n --color-card: rgba(39, 39, 39);\n --color-text: rgba(255, 245, 237);\n --color-neutral: rgba(93, 93, 93);\n --font-sans: \"Inter\", -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;\n }\n * { box-sizing: border-box; }\n body {\n font-family: var(--font-sans);\n display: flex;\n align-items: center;\n justify-content: center;\n min-height: 100vh;\n margin: 0;\n padding: 1rem;\n background-color: var(--color-background);\n color: var(--color-text);\n }\n .container {\n text-align: center;\n padding: 2rem;\n border-radius: 1rem;\n background-color: var(--color-card);\n box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);\n max-width: 400px;\n width: 100%;\n }\n h1 { margin: 0 0 1rem 0; font-size: 1.5rem; font-weight: 700; color: var(--color-text); }\n p { color: var(--color-neutral); font-size: 0.8rem; margin: 0 0 1.5rem 0; line-height: 1.5; }\n </style>\n </head>\n <body>\n <div class=\"container\">\n <h1>Login Successful</h1>\n <p>${message}</p>\n </div>\n <script>\n window.close();\n setTimeout(() => { window.close(); }, 1000);\n </script>\n </body>\n </html>\n`;\n\ntype LoginOptions = {\n cmsUrl?: string;\n configOptions?: GetConfigurationOptions;\n /**\n * When false, do not call process.exit(0) after a successful login so the\n * caller can continue (e.g. retry a command inline, or finish an interactive\n * setup). Defaults to true to preserve existing standalone-login behaviour.\n */\n exitAfter?: boolean;\n /**\n * Invoked with the access-key credentials when the login flow returns a\n * `clientId` / `clientSecret` pair. When provided, the caller takes ownership\n * of persisting the credentials (e.g. writing them to `.env` and enabling the\n * editor in the config), so the default manual-setup instructions are skipped.\n */\n onCredentials?: (credentials: {\n clientId: string;\n clientSecret: string;\n }) => void | Promise<void>;\n};\n\nexport const login = async (options: LoginOptions = {}) => {\n const configuration = getConfiguration(options.configOptions);\n logConfigDetails(options?.configOptions);\n\n const logger = getAppLogger(configuration);\n\n const cmsUrl = options.cmsUrl ?? configuration.editor.cmsURL;\n\n return new Promise<void>((resolve) => {\n const server = http.createServer(async (req, res) => {\n const url = new URL(req.url ?? '', `http://${req.headers.host}`);\n\n // Set CORS headers\n res.setHeader('Access-Control-Allow-Origin', '*');\n res.setHeader('Access-Control-Allow-Methods', 'GET, OPTIONS');\n res.setHeader('Access-Control-Allow-Headers', 'Content-Type');\n\n if (req.method === 'OPTIONS') {\n res.writeHead(204);\n res.end();\n return;\n }\n\n if (url.pathname === '/callback') {\n const sessionToken = url.searchParams.get('sessionToken');\n const sessionExpiresAt = url.searchParams.get('expiresAt');\n const clientId = url.searchParams.get('clientId');\n const clientSecret = url.searchParams.get('clientSecret');\n\n if (sessionToken && sessionExpiresAt) {\n logger('');\n logger(\n `Log in successful. ${colorize('2h', ANSIColors.BLUE)} session token received.`\n );\n logger('');\n\n logger(\n colorize(\n `Token expires at: ${new Date(sessionExpiresAt).toLocaleString()}`,\n ANSIColors.GREY\n )\n );\n\n await writeCliSessionToken(\n configuration,\n sessionToken,\n new Date(sessionExpiresAt)\n );\n\n res.writeHead(200, { 'Content-Type': 'text/html' });\n res.end(\n buildSuccessHtml(\n 'Your 2h session token has been stored. You can now close this tab and return to your terminal.'\n )\n );\n\n server.close(() => {\n resolve();\n if (options.exitAfter !== false) {\n process.exit(0);\n }\n });\n return;\n }\n\n if (clientId && clientSecret) {\n if (options.onCredentials) {\n // The caller persists the credentials itself (e.g. interactive\n // init writing `.env` and enabling the editor in the config).\n logger('');\n logger('Log in successful. Configuring Intlayer CMS...');\n\n try {\n await options.onCredentials({ clientId, clientSecret });\n } catch (error) {\n logger(\n `Failed to persist the CMS credentials automatically: ${\n error instanceof Error ? error.message : String(error)\n }`,\n { level: 'error' }\n );\n }\n } else {\n logger('');\n logger('Log in successful. Client ID and Client Secret received.');\n\n logger('');\n logger([\n '1. Insert the Client ID and Client Secret in your',\n colorizePath('.env'),\n 'file:',\n ]);\n logger(\n colorize('--------------------------------', ANSIColors.GREY_DARK)\n );\n logger(\n [\n colorize('INTLAYER_CLIENT_ID=', ANSIColors.GREY_LIGHT),\n colorize(clientId, ANSIColors.BLUE),\n ].join('')\n );\n logger(\n [\n colorize('INTLAYER_CLIENT_SECRET=', ANSIColors.GREY_LIGHT),\n colorize(clientSecret, ANSIColors.BLUE),\n ].join('')\n );\n logger(\n colorize('--------------------------------', ANSIColors.GREY_DARK)\n );\n logger('');\n logger('2. Insert in your Intlayer configuration file:');\n logger(\n colorize('--------------------------------', ANSIColors.GREY_DARK)\n );\n [\n `${ANSIColors.GREY_LIGHT}{`,\n ` editor: {`,\n ` enabled: true,`,\n ` cmsURL: '${colorizePath(cmsUrl!, undefined, ANSIColors.GREY_LIGHT)}',`,\n ` clientId: '${colorize('process.env.INTLAYER_CLIENT_ID', ANSIColors.BLUE, ANSIColors.GREY_LIGHT)}',`,\n ` clientSecret: '${colorize('process.env.INTLAYER_CLIENT_SECRET', ANSIColors.BLUE, ANSIColors.GREY_LIGHT)}',`,\n ` },`,\n `}`,\n ].forEach((line) => {\n logger(line);\n });\n logger(\n colorize('--------------------------------', ANSIColors.GREY_DARK)\n );\n }\n\n res.writeHead(200, { 'Content-Type': 'text/html' });\n res.end(\n buildSuccessHtml(\n 'You have successfully logged in to Intlayer CLI. You can now close this tab and return to your terminal.'\n )\n );\n\n server.close(() => {\n resolve();\n if (options.exitAfter !== false) {\n process.exit(0);\n }\n });\n } else {\n res.writeHead(400, { 'Content-Type': 'text/plain' });\n res.end('Missing parameters');\n }\n } else {\n res.writeHead(404, { 'Content-Type': 'text/plain' });\n res.end('Not found');\n }\n });\n\n server.listen(0, () => {\n const address = server.address();\n const port = typeof address === 'object' && address ? address.port : 0;\n const state = Math.random().toString(36).substring(7);\n\n const websiteUrl =\n cmsUrl ?? process.env.INTLAYER_SITE_URL ?? 'http://localhost:3000';\n const backendUrl = configuration.editor.backendURL ?? '';\n const loginUrl = `${websiteUrl}/auth/cli-login?port=${port}&state=${state}&backendUrl=${encodeURIComponent(backendUrl)}`;\n\n logger('Opening browser for login...');\n logger(`If browser does not open, visit: ${colorizePath(loginUrl)}`);\n\n openBrowser(loginUrl);\n });\n });\n};\n"],"mappings":";;;;;;;;;;;;;;AAYA,MAAM,oBAAoB,YAA4B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;aA2CzC,QAAQ;;;;;;;;;AA+BrB,MAAa,QAAQ,OAAO,UAAwB,EAAE,KAAK;CACzD,MAAM,4DAAiC,QAAQ,cAAc;AAC7D,4CAAiB,SAAS,cAAc;CAExC,MAAM,mDAAsB,cAAc;CAE1C,MAAM,SAAS,QAAQ,UAAU,cAAc,OAAO;AAEtD,QAAO,IAAI,SAAe,YAAY;EACpC,MAAM,SAASA,kBAAK,aAAa,OAAO,KAAK,QAAQ;GACnD,MAAM,MAAM,IAAI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Ac;GACtD,MAAM,WAAW,GAAG,WAAW,uBAAuB,KAAK,SAAS,MAAM,cAAc,mBAAmB,WAAW;AAEtH,UAAO,+BAA+B;AACtC,UAAO,8EAAiD,SAAS,GAAG;AAEpE,yCAAY,SAAS;IACrB;GACF"}
1
+ {"version":3,"file":"login.cjs","names":["http","URL","ANSIColors","writeCliSessionToken"],"sources":["../../../src/auth/login.ts"],"sourcesContent":["import http from 'node:http';\nimport { URL } from 'node:url';\nimport * as ANSIColors from '@intlayer/config/colors';\nimport { colorize, colorizePath, getAppLogger } from '@intlayer/config/logger';\nimport {\n type GetConfigurationOptions,\n getConfiguration,\n} from '@intlayer/config/node';\nimport { logConfigDetails } from '@intlayer/engine/cli';\nimport { openBrowser } from '../utils/openBrowser';\nimport { writeCliSessionToken } from './sessionToken';\n\nconst buildSuccessHtml = (message: string): string => `\n <!DOCTYPE html>\n <html lang=\"en\" data-theme=\"dark\">\n <head>\n <meta charset=\"UTF-8\">\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n <title>Intlayer CLI Login</title>\n <style>\n :root {\n --color-background: rgba(23, 23, 23);\n --color-card: rgba(39, 39, 39);\n --color-text: rgba(255, 245, 237);\n --color-neutral: rgba(93, 93, 93);\n --font-sans: \"Inter\", -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;\n }\n * { box-sizing: border-box; }\n body {\n font-family: var(--font-sans);\n display: flex;\n align-items: center;\n justify-content: center;\n min-height: 100vh;\n margin: 0;\n padding: 1rem;\n background-color: var(--color-background);\n color: var(--color-text);\n }\n .container {\n text-align: center;\n padding: 2rem;\n border-radius: 1rem;\n background-color: var(--color-card);\n box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);\n max-width: 400px;\n width: 100%;\n }\n h1 { margin: 0 0 1rem 0; font-size: 1.5rem; font-weight: 700; color: var(--color-text); }\n p { color: var(--color-neutral); font-size: 0.8rem; margin: 0 0 1.5rem 0; line-height: 1.5; }\n </style>\n </head>\n <body>\n <div class=\"container\">\n <h1>Login Successful</h1>\n <p>${message}</p>\n </div>\n <script>\n window.close();\n setTimeout(() => { window.close(); }, 1000);\n </script>\n </body>\n </html>\n`;\n\ntype LoginOptions = {\n cmsUrl?: string;\n configOptions?: GetConfigurationOptions;\n /**\n * When false, do not call process.exit(0) after a successful login so the\n * caller can continue (e.g. retry a command inline, or finish an interactive\n * setup). Defaults to true to preserve existing standalone-login behaviour.\n */\n exitAfter?: boolean;\n /**\n * Invoked with the access-key credentials when the login flow returns a\n * `clientId` / `clientSecret` pair. When provided, the caller takes ownership\n * of persisting the credentials (e.g. writing them to `.env` and enabling the\n * editor in the config), so the default manual-setup instructions are skipped.\n */\n onCredentials?: (credentials: {\n clientId: string;\n clientSecret: string;\n }) => void | Promise<void>;\n};\n\nexport const login = async (options: LoginOptions = {}) => {\n const configuration = getConfiguration(options.configOptions);\n logConfigDetails(options?.configOptions);\n\n const logger = getAppLogger(configuration);\n\n const cmsUrl = options.cmsUrl ?? configuration.editor.cmsURL;\n\n return new Promise<void>((resolve) => {\n const server = http.createServer(async (req, res) => {\n const url = new URL(req.url ?? '', `http://${req.headers.host}`);\n\n // Set CORS headers\n res.setHeader('Access-Control-Allow-Origin', '*');\n res.setHeader('Access-Control-Allow-Methods', 'GET, OPTIONS');\n res.setHeader('Access-Control-Allow-Headers', 'Content-Type');\n\n if (req.method === 'OPTIONS') {\n res.writeHead(204);\n res.end();\n return;\n }\n\n if (url.pathname === '/callback') {\n const sessionToken = url.searchParams.get('sessionToken');\n const sessionExpiresAt = url.searchParams.get('expiresAt');\n const clientId = url.searchParams.get('clientId');\n const clientSecret = url.searchParams.get('clientSecret');\n\n if (sessionToken && sessionExpiresAt) {\n logger('');\n logger(\n `Log in successful. ${colorize('2h', ANSIColors.BLUE)} session token received.`\n );\n logger('');\n\n logger(\n colorize(\n `Token expires at: ${new Date(sessionExpiresAt).toLocaleString()}`,\n ANSIColors.GREY\n )\n );\n\n await writeCliSessionToken(\n configuration,\n sessionToken,\n new Date(sessionExpiresAt)\n );\n\n res.writeHead(200, { 'Content-Type': 'text/html' });\n res.end(\n buildSuccessHtml(\n 'Your 2h session token has been stored. You can now close this tab and return to your terminal.'\n )\n );\n\n server.close(() => {\n resolve();\n if (options.exitAfter !== false) {\n process.exit(0);\n }\n });\n return;\n }\n\n if (clientId && clientSecret) {\n if (options.onCredentials) {\n // The caller persists the credentials itself (e.g. interactive\n // init writing `.env` and enabling the editor in the config).\n logger('');\n logger('Log in successful. Configuring Intlayer CMS...');\n\n try {\n await options.onCredentials({ clientId, clientSecret });\n } catch (error) {\n logger(\n `Failed to persist the CMS credentials automatically: ${\n error instanceof Error ? error.message : String(error)\n }`,\n { level: 'error' }\n );\n }\n } else {\n logger('');\n logger('Log in successful. Client ID and Client Secret received.');\n\n logger('');\n logger([\n '1. Insert the Client ID and Client Secret in your',\n colorizePath('.env'),\n 'file:',\n ]);\n logger(\n colorize('--------------------------------', ANSIColors.GREY_DARK)\n );\n logger(\n [\n colorize('INTLAYER_CLIENT_ID=', ANSIColors.GREY_LIGHT),\n colorize(clientId, ANSIColors.BLUE),\n ].join('')\n );\n logger(\n [\n colorize('INTLAYER_CLIENT_SECRET=', ANSIColors.GREY_LIGHT),\n colorize(clientSecret, ANSIColors.BLUE),\n ].join('')\n );\n logger(\n colorize('--------------------------------', ANSIColors.GREY_DARK)\n );\n logger('');\n logger('2. Insert in your Intlayer configuration file:');\n logger(\n colorize('--------------------------------', ANSIColors.GREY_DARK)\n );\n [\n `${ANSIColors.GREY_LIGHT}{`,\n ` editor: {`,\n ` enabled: true,`,\n ` cmsURL: '${colorizePath(cmsUrl!, undefined, ANSIColors.GREY_LIGHT)}',`,\n ` clientId: '${colorize('process.env.INTLAYER_CLIENT_ID', ANSIColors.BLUE, ANSIColors.GREY_LIGHT)}',`,\n ` clientSecret: '${colorize('process.env.INTLAYER_CLIENT_SECRET', ANSIColors.BLUE, ANSIColors.GREY_LIGHT)}',`,\n ` },`,\n `}`,\n ].forEach((line) => {\n logger(line);\n });\n logger(\n colorize('--------------------------------', ANSIColors.GREY_DARK)\n );\n }\n\n res.writeHead(200, { 'Content-Type': 'text/html' });\n res.end(\n buildSuccessHtml(\n 'You have successfully logged in to Intlayer CLI. You can now close this tab and return to your terminal.'\n )\n );\n\n server.close(() => {\n resolve();\n if (options.exitAfter !== false) {\n process.exit(0);\n }\n });\n } else {\n res.writeHead(400, { 'Content-Type': 'text/plain' });\n res.end('Missing parameters');\n }\n } else {\n res.writeHead(404, { 'Content-Type': 'text/plain' });\n res.end('Not found');\n }\n });\n\n server.listen(0, () => {\n const address = server.address();\n const port = typeof address === 'object' && address ? address.port : 0;\n const state = Math.random().toString(36).substring(7);\n\n const websiteUrl =\n cmsUrl ?? process.env.INTLAYER_SITE_URL ?? 'http://localhost:3000';\n const backendUrl = configuration.editor.backendURL ?? '';\n const loginUrl = `${websiteUrl}/auth/cli-login?port=${port}&state=${state}&backendUrl=${encodeURIComponent(backendUrl)}`;\n\n logger('Opening browser for login...');\n logger(`If browser does not open, visit: ${colorizePath(loginUrl)}`);\n\n openBrowser(loginUrl);\n });\n });\n};\n"],"mappings":";;;;;;;;;;;;;;AAYA,MAAM,oBAAoB,YAA4B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;aA2CzC,QAAQ;;;;;;;;;AA+BrB,MAAa,QAAQ,OAAO,UAAwB,CAAC,MAAM;CACzD,MAAM,4DAAiC,QAAQ,aAAa;CAC5D,2CAAiB,SAAS,aAAa;CAEvC,MAAM,mDAAsB,aAAa;CAEzC,MAAM,SAAS,QAAQ,UAAU,cAAc,OAAO;CAEtD,OAAO,IAAI,SAAe,YAAY;EACpC,MAAM,SAASA,kBAAK,aAAa,OAAO,KAAK,QAAQ;GACnD,MAAM,MAAM,IAAIC,aAAI,IAAI,OAAO,IAAI,UAAU,IAAI,QAAQ,MAAM;GAG/D,IAAI,UAAU,+BAA+B,GAAG;GAChD,IAAI,UAAU,gCAAgC,cA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D,MAAM,WAAW,GAAG,WAAW,uBAAuB,KAAK,SAAS,MAAM,cAAc,mBAAmB,UAAU;GAErH,OAAO,8BAA8B;GACrC,OAAO,8EAAiD,QAAQ,GAAG;GAEnE,sCAAY,QAAQ;EACtB,CAAC;CACH,CAAC;AACH"}
@@ -1,5 +1,4 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
3
2
  let node_path = require("node:path");
4
3
  let node_fs_promises = require("node:fs/promises");
5
4
 
@@ -1 +1 @@
1
- {"version":3,"file":"sessionToken.cjs","names":[],"sources":["../../../src/auth/sessionToken.ts"],"sourcesContent":["import { mkdir, readFile, unlink, writeFile } from 'node:fs/promises';\nimport { join } from 'node:path';\nimport type { IntlayerConfig } from '@intlayer/types/config';\n\nconst SESSION_FILE_NAME = 'cli-session.json';\n\nexport type CliSessionData = {\n token: string;\n expiresAt: string; // ISO date string\n};\n\nconst getSessionFilePath = (config: IntlayerConfig): string =>\n join(config.system.tempDir, SESSION_FILE_NAME);\n\nexport const writeCliSessionToken = async (\n config: IntlayerConfig,\n token: string,\n expiresAt: Date\n): Promise<void> => {\n const filePath = getSessionFilePath(config);\n\n await mkdir(config.system.tempDir, { recursive: true });\n\n const data: CliSessionData = { token, expiresAt: expiresAt.toISOString() };\n await writeFile(filePath, JSON.stringify(data, null, 2), { mode: 0o600 });\n};\n\nexport const readCliSessionToken = async (\n config: IntlayerConfig\n): Promise<CliSessionData | null> => {\n const filePath = getSessionFilePath(config);\n\n try {\n const raw = await readFile(filePath, 'utf8');\n const data: CliSessionData = JSON.parse(raw);\n\n if (!data.token || !data.expiresAt) {\n return null;\n }\n\n if (new Date() >= new Date(data.expiresAt)) {\n await clearCliSessionToken(config);\n return null;\n }\n\n return data;\n } catch {\n return null;\n }\n};\n\nexport const clearCliSessionToken = async (\n config: IntlayerConfig\n): Promise<void> => {\n try {\n await unlink(getSessionFilePath(config));\n } catch {\n // Ignore errors (file may not exist)\n }\n};\n"],"mappings":";;;;;;AAIA,MAAM,oBAAoB;AAO1B,MAAM,sBAAsB,+BACrB,OAAO,OAAO,SAAS,kBAAkB;AAEhD,MAAa,uBAAuB,OAClC,QACA,OACA,cACkB;CAClB,MAAM,WAAW,mBAAmB,OAAO;AAE3C,mCAAY,OAAO,OAAO,SAAS,EAAE,WAAW,MAAM,CAAC;CAEvD,MAAM,OAAuB;EAAE;EAAO,WAAW,UAAU,aAAa;EAAE;AAC1E,uCAAgB,UAAU,KAAK,UAAU,MAAM,MAAM,EAAE,EAAE,EAAE,MAAM,KAAO,CAAC;;AAG3E,MAAa,sBAAsB,OACjC,WACmC;CACnC,MAAM,WAAW,mBAAmB,OAAO;AAE3C,KAAI;EACF,MAAM,MAAM,qCAAe,UAAU,OAAO;EAC5C,MAAM,OAAuB,KAAK,MAAM,IAAI;AAE5C,MAAI,CAAC,KAAK,SAAS,CAAC,KAAK,UACvB,QAAO;AAGT,sBAAI,IAAI,MAAM,IAAI,IAAI,KAAK,KAAK,UAAU,EAAE;AAC1C,SAAM,qBAAqB,OAAO;AAClC,UAAO;;AAGT,SAAO;SACD;AACN,SAAO;;;AAIX,MAAa,uBAAuB,OAClC,WACkB;AAClB,KAAI;AACF,qCAAa,mBAAmB,OAAO,CAAC;SAClC"}
1
+ {"version":3,"file":"sessionToken.cjs","names":[],"sources":["../../../src/auth/sessionToken.ts"],"sourcesContent":["import { mkdir, readFile, unlink, writeFile } from 'node:fs/promises';\nimport { join } from 'node:path';\nimport type { IntlayerConfig } from '@intlayer/types/config';\n\nconst SESSION_FILE_NAME = 'cli-session.json';\n\nexport type CliSessionData = {\n token: string;\n expiresAt: string; // ISO date string\n};\n\nconst getSessionFilePath = (config: IntlayerConfig): string =>\n join(config.system.tempDir, SESSION_FILE_NAME);\n\nexport const writeCliSessionToken = async (\n config: IntlayerConfig,\n token: string,\n expiresAt: Date\n): Promise<void> => {\n const filePath = getSessionFilePath(config);\n\n await mkdir(config.system.tempDir, { recursive: true });\n\n const data: CliSessionData = { token, expiresAt: expiresAt.toISOString() };\n await writeFile(filePath, JSON.stringify(data, null, 2), { mode: 0o600 });\n};\n\nexport const readCliSessionToken = async (\n config: IntlayerConfig\n): Promise<CliSessionData | null> => {\n const filePath = getSessionFilePath(config);\n\n try {\n const raw = await readFile(filePath, 'utf8');\n const data: CliSessionData = JSON.parse(raw);\n\n if (!data.token || !data.expiresAt) {\n return null;\n }\n\n if (new Date() >= new Date(data.expiresAt)) {\n await clearCliSessionToken(config);\n return null;\n }\n\n return data;\n } catch {\n return null;\n }\n};\n\nexport const clearCliSessionToken = async (\n config: IntlayerConfig\n): Promise<void> => {\n try {\n await unlink(getSessionFilePath(config));\n } catch {\n // Ignore errors (file may not exist)\n }\n};\n"],"mappings":";;;;;AAIA,MAAM,oBAAoB;AAO1B,MAAM,sBAAsB,+BACrB,OAAO,OAAO,SAAS,iBAAiB;AAE/C,MAAa,uBAAuB,OAClC,QACA,OACA,cACkB;CAClB,MAAM,WAAW,mBAAmB,MAAM;CAE1C,kCAAY,OAAO,OAAO,SAAS,EAAE,WAAW,KAAK,CAAC;CAEtD,MAAM,OAAuB;EAAE;EAAO,WAAW,UAAU,YAAY;CAAE;CACzE,sCAAgB,UAAU,KAAK,UAAU,MAAM,MAAM,CAAC,GAAG,EAAE,MAAM,IAAM,CAAC;AAC1E;AAEA,MAAa,sBAAsB,OACjC,WACmC;CACnC,MAAM,WAAW,mBAAmB,MAAM;CAE1C,IAAI;EACF,MAAM,MAAM,qCAAe,UAAU,MAAM;EAC3C,MAAM,OAAuB,KAAK,MAAM,GAAG;EAE3C,IAAI,CAAC,KAAK,SAAS,CAAC,KAAK,WACvB,OAAO;EAGT,oBAAI,IAAI,KAAK,KAAK,IAAI,KAAK,KAAK,SAAS,GAAG;GAC1C,MAAM,qBAAqB,MAAM;GACjC,OAAO;EACT;EAEA,OAAO;CACT,QAAQ;EACN,OAAO;CACT;AACF;AAEA,MAAa,uBAAuB,OAClC,WACkB;CAClB,IAAI;EACF,mCAAa,mBAAmB,MAAM,CAAC;CACzC,QAAQ,CAER;AACF"}
@@ -1,5 +1,4 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_runtime = require('./_virtual/_rolldown/runtime.cjs');
3
2
  let _intlayer_config_node = require("@intlayer/config/node");
4
3
  let _intlayer_engine_cli = require("@intlayer/engine/cli");
5
4
  let _intlayer_engine_utils = require("@intlayer/engine/utils");
@@ -1 +1 @@
1
- {"version":3,"file":"build.cjs","names":[],"sources":["../../src/build.ts"],"sourcesContent":["import {\n type GetConfigurationOptions,\n getConfiguration,\n} from '@intlayer/config/node';\nimport { logConfigDetails } from '@intlayer/engine/cli';\nimport { type ParallelHandle, runParallel } from '@intlayer/engine/utils';\nimport { buildAndWatchIntlayer } from '@intlayer/engine/watcher';\n\ntype BuildOptions = {\n watch?: boolean;\n skipPrepare?: boolean;\n with?: string | string[];\n configOptions?: GetConfigurationOptions;\n};\n\n/**\n * Get locales dictionaries .content.{json|ts|tsx|js|jsx|mjs|cjs} and build the JSON dictionaries in the .intlayer directory.\n * Watch mode available to get the change in the .content.{json|ts|tsx|js|jsx|mjs|cjs}\n */\nexport const build = async (options?: BuildOptions) => {\n const config = getConfiguration(options?.configOptions);\n logConfigDetails(options?.configOptions);\n\n let parallelProcess: ParallelHandle | null = null;\n\n if (options?.with) {\n parallelProcess = runParallel(options.with);\n // Handle the promise to avoid unhandled rejection\n parallelProcess.result.catch(() => {\n // Parallel process failed or was terminated\n });\n }\n\n await buildAndWatchIntlayer({\n persistent: options?.watch ?? false,\n skipPrepare: options?.skipPrepare ?? false,\n configuration: config,\n });\n\n if (!options?.watch && parallelProcess) {\n parallelProcess.kill();\n }\n};\n"],"mappings":";;;;;;;;;;;;AAmBA,MAAa,QAAQ,OAAO,YAA2B;CACrD,MAAM,qDAA0B,SAAS,cAAc;AACvD,4CAAiB,SAAS,cAAc;CAExC,IAAI,kBAAyC;AAE7C,KAAI,SAAS,MAAM;AACjB,4DAA8B,QAAQ,KAAK;AAE3C,kBAAgB,OAAO,YAAY,GAEjC;;AAGJ,2DAA4B;EAC1B,YAAY,SAAS,SAAS;EAC9B,aAAa,SAAS,eAAe;EACrC,eAAe;EAChB,CAAC;AAEF,KAAI,CAAC,SAAS,SAAS,gBACrB,iBAAgB,MAAM"}
1
+ {"version":3,"file":"build.cjs","names":[],"sources":["../../src/build.ts"],"sourcesContent":["import {\n type GetConfigurationOptions,\n getConfiguration,\n} from '@intlayer/config/node';\nimport { logConfigDetails } from '@intlayer/engine/cli';\nimport { type ParallelHandle, runParallel } from '@intlayer/engine/utils';\nimport { buildAndWatchIntlayer } from '@intlayer/engine/watcher';\n\ntype BuildOptions = {\n watch?: boolean;\n skipPrepare?: boolean;\n with?: string | string[];\n configOptions?: GetConfigurationOptions;\n};\n\n/**\n * Get locales dictionaries .content.{json|ts|tsx|js|jsx|mjs|cjs} and build the JSON dictionaries in the .intlayer directory.\n * Watch mode available to get the change in the .content.{json|ts|tsx|js|jsx|mjs|cjs}\n */\nexport const build = async (options?: BuildOptions) => {\n const config = getConfiguration(options?.configOptions);\n logConfigDetails(options?.configOptions);\n\n let parallelProcess: ParallelHandle | null = null;\n\n if (options?.with) {\n parallelProcess = runParallel(options.with);\n // Handle the promise to avoid unhandled rejection\n parallelProcess.result.catch(() => {\n // Parallel process failed or was terminated\n });\n }\n\n await buildAndWatchIntlayer({\n persistent: options?.watch ?? false,\n skipPrepare: options?.skipPrepare ?? false,\n configuration: config,\n });\n\n if (!options?.watch && parallelProcess) {\n parallelProcess.kill();\n }\n};\n"],"mappings":";;;;;;;;;;;AAmBA,MAAa,QAAQ,OAAO,YAA2B;CACrD,MAAM,qDAA0B,SAAS,aAAa;CACtD,2CAAiB,SAAS,aAAa;CAEvC,IAAI,kBAAyC;CAE7C,IAAI,SAAS,MAAM;EACjB,0DAA8B,QAAQ,IAAI;EAE1C,gBAAgB,OAAO,YAAY,CAEnC,CAAC;CACH;CAEA,0DAA4B;EAC1B,YAAY,SAAS,SAAS;EAC9B,aAAa,SAAS,eAAe;EACrC,eAAe;CACjB,CAAC;CAED,IAAI,CAAC,SAAS,SAAS,iBACrB,gBAAgB,KAAK;AAEzB"}
@@ -1 +1 @@
1
- {"version":3,"file":"bundle.cjs","names":[],"sources":["../../src/bundle.ts"],"sourcesContent":["import type { BundleIntlayerOptions } from '@intlayer/config/bundle';\n\n/**\n * Computes the tree-shaking defines derived from the project's built\n * dictionaries (unused node types, dictionary selector usage) so the generated\n * bundle drops the corresponding runtime logic, mirroring what the bundler\n * plugins (vite / webpack / esbuild) inject at application build time.\n *\n * Returns an empty object when no dictionary has been built yet: shaking based\n * on an empty dictionary set would mark every node type as unused and strip\n * logic that the runtime content may require.\n */\nconst getDictionaryTreeShakingDefines = async (\n options: BundleIntlayerOptions\n): Promise<Record<string, string>> => {\n // Dynamic imports for performance reason\n const { formatDictionarySelectorEnvVar, formatNodeTypeToEnvVar } =\n await import('@intlayer/config/envVars');\n const { getConfiguration } = await import('@intlayer/config/node');\n const { getHasDictionarySelector, getUnusedNodeTypesAsync } = await import(\n '@intlayer/config/utils'\n );\n const { getDictionaries } = await import('@intlayer/dictionaries-entry');\n\n const configuration = getConfiguration(options.configOptions);\n const dictionaries = getDictionaries(configuration);\n\n if (Object.keys(dictionaries).length === 0) return {};\n\n const wrapKey = (key: string) => `process.env.${key}`;\n const wrapValue = (value: string) => `\"${value}\"`;\n\n const unusedNodeTypes = await getUnusedNodeTypesAsync(dictionaries);\n\n return {\n // Tree shaking based on unused node types\n ...formatNodeTypeToEnvVar(unusedNodeTypes, wrapKey, wrapValue),\n // Tree shaking the dictionary selector logic (collections / variants)\n ...formatDictionarySelectorEnvVar(\n getHasDictionarySelector(dictionaries),\n wrapKey,\n wrapValue\n ),\n };\n};\n\nexport const bundle = async (options: BundleIntlayerOptions): Promise<void> => {\n try {\n // Dynamic import for performance reason\n const { bundleIntlayer } = await import('@intlayer/config/bundle');\n\n const dictionaryDefines = await getDictionaryTreeShakingDefines(options);\n\n await bundleIntlayer({\n ...options,\n define: {\n ...dictionaryDefines,\n // Caller-supplied defines take precedence\n ...options.define,\n },\n });\n } catch (error) {\n console.error('Failed to create bundle:', error);\n process.exit(1);\n }\n};\n"],"mappings":";;;;;;;;;;;;;AAYA,MAAM,kCAAkC,OACtC,YACoC;CAEpC,MAAM,EAAE,gCAAgC,2BACtC,MAAM,OAAO;CACf,MAAM,EAAE,qBAAqB,MAAM,OAAO;CAC1C,MAAM,EAAE,0BAA0B,4BAA4B,MAAM,OAClE;CAEF,MAAM,EAAE,oBAAoB,MAAM,OAAO;CAGzC,MAAM,eAAe,gBADC,iBAAiB,QAAQ,cACG,CAAC;AAEnD,KAAI,OAAO,KAAK,aAAa,CAAC,WAAW,EAAG,QAAO,EAAE;CAErD,MAAM,WAAW,QAAgB,eAAe;CAChD,MAAM,aAAa,UAAkB,IAAI,MAAM;AAI/C,QAAO;EAEL,GAAG,uBAAuB,MAJE,wBAAwB,aAAa,EAItB,SAAS,UAAU;EAE9D,GAAG,+BACD,yBAAyB,aAAa,EACtC,SACA,UACD;EACF;;AAGH,MAAa,SAAS,OAAO,YAAkD;AAC7E,KAAI;EAEF,MAAM,EAAE,mBAAmB,MAAM,OAAO;EAExC,MAAM,oBAAoB,MAAM,gCAAgC,QAAQ;AAExE,QAAM,eAAe;GACnB,GAAG;GACH,QAAQ;IACN,GAAG;IAEH,GAAG,QAAQ;IACZ;GACF,CAAC;UACK,OAAO;AACd,UAAQ,MAAM,4BAA4B,MAAM;AAChD,UAAQ,KAAK,EAAE"}
1
+ {"version":3,"file":"bundle.cjs","names":[],"sources":["../../src/bundle.ts"],"sourcesContent":["import type { BundleIntlayerOptions } from '@intlayer/config/bundle';\n\n/**\n * Computes the tree-shaking defines derived from the project's built\n * dictionaries (unused node types, dictionary selector usage) so the generated\n * bundle drops the corresponding runtime logic, mirroring what the bundler\n * plugins (vite / webpack / esbuild) inject at application build time.\n *\n * Returns an empty object when no dictionary has been built yet: shaking based\n * on an empty dictionary set would mark every node type as unused and strip\n * logic that the runtime content may require.\n */\nconst getDictionaryTreeShakingDefines = async (\n options: BundleIntlayerOptions\n): Promise<Record<string, string>> => {\n // Dynamic imports for performance reason\n const { formatDictionarySelectorEnvVar, formatNodeTypeToEnvVar } =\n await import('@intlayer/config/envVars');\n const { getConfiguration } = await import('@intlayer/config/node');\n const { getHasDictionarySelector, getUnusedNodeTypesAsync } = await import(\n '@intlayer/config/utils'\n );\n const { getDictionaries } = await import('@intlayer/dictionaries-entry');\n\n const configuration = getConfiguration(options.configOptions);\n const dictionaries = getDictionaries(configuration);\n\n if (Object.keys(dictionaries).length === 0) return {};\n\n const wrapKey = (key: string) => `process.env.${key}`;\n const wrapValue = (value: string) => `\"${value}\"`;\n\n const unusedNodeTypes = await getUnusedNodeTypesAsync(dictionaries);\n\n return {\n // Tree shaking based on unused node types\n ...formatNodeTypeToEnvVar(unusedNodeTypes, wrapKey, wrapValue),\n // Tree shaking the dictionary selector logic (collections / variants)\n ...formatDictionarySelectorEnvVar(\n getHasDictionarySelector(dictionaries),\n wrapKey,\n wrapValue\n ),\n };\n};\n\nexport const bundle = async (options: BundleIntlayerOptions): Promise<void> => {\n try {\n // Dynamic import for performance reason\n const { bundleIntlayer } = await import('@intlayer/config/bundle');\n\n const dictionaryDefines = await getDictionaryTreeShakingDefines(options);\n\n await bundleIntlayer({\n ...options,\n define: {\n ...dictionaryDefines,\n // Caller-supplied defines take precedence\n ...options.define,\n },\n });\n } catch (error) {\n console.error('Failed to create bundle:', error);\n process.exit(1);\n }\n};\n"],"mappings":";;;;;;;;;;;;;AAYA,MAAM,kCAAkC,OACtC,YACoC;CAEpC,MAAM,EAAE,gCAAgC,2BACtC,MAAM,OAAO;CACf,MAAM,EAAE,qBAAqB,MAAM,OAAO;CAC1C,MAAM,EAAE,0BAA0B,4BAA4B,MAAM,OAClE;CAEF,MAAM,EAAE,oBAAoB,MAAM,OAAO;CAGzC,MAAM,eAAe,gBADC,iBAAiB,QAAQ,aACE,CAAC;CAElD,IAAI,OAAO,KAAK,YAAY,CAAC,CAAC,WAAW,GAAG,OAAO,CAAC;CAEpD,MAAM,WAAW,QAAgB,eAAe;CAChD,MAAM,aAAa,UAAkB,IAAI,MAAM;CAI/C,OAAO;EAEL,GAAG,uBAAuB,MAJE,wBAAwB,YAAY,GAIrB,SAAS,SAAS;EAE7D,GAAG,+BACD,yBAAyB,YAAY,GACrC,SACA,SACF;CACF;AACF;AAEA,MAAa,SAAS,OAAO,YAAkD;CAC7E,IAAI;EAEF,MAAM,EAAE,mBAAmB,MAAM,OAAO;EAExC,MAAM,oBAAoB,MAAM,gCAAgC,OAAO;EAEvE,MAAM,eAAe;GACnB,GAAG;GACH,QAAQ;IACN,GAAG;IAEH,GAAG,QAAQ;GACb;EACF,CAAC;CACH,SAAS,OAAO;EACd,QAAQ,MAAM,4BAA4B,KAAK;EAC/C,QAAQ,KAAK,CAAC;CAChB;AACF"}
package/dist/cjs/ci.cjs CHANGED
@@ -1,5 +1,4 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_runtime = require('./_virtual/_rolldown/runtime.cjs');
3
2
  let node_path = require("node:path");
4
3
  let _intlayer_config_logger = require("@intlayer/config/logger");
5
4
  let _intlayer_engine_cli = require("@intlayer/engine/cli");
@@ -1 +1 @@
1
- {"version":3,"file":"ci.cjs","names":["sep"],"sources":["../../src/ci.ts"],"sourcesContent":["import { spawnSync } from 'node:child_process';\nimport { resolve, sep } from 'node:path';\nimport { logger } from '@intlayer/config/logger';\nimport {\n detectPackageManager,\n listProjects,\n type PackageManager,\n} from '@intlayer/engine/cli';\n\n/** CMS access keys of a single project. */\ntype ProjectCredentials = {\n clientId: string;\n clientSecret: string;\n};\n\n/**\n * Shape of the `INTLAYER_PROJECT_CREDENTIALS` environment variable: a JSON map\n * of project path (absolute, or relative to the repository root) to its CMS\n * access keys.\n */\ntype CredentialsMap = Record<string, ProjectCredentials>;\n\n/** Command used to run the locally installed `intlayer` binary. */\ntype PackageManagerCommand = {\n command: string;\n args: string[];\n};\n\n/**\n * Detects the command used to run the local `intlayer` binary. Prefers the\n * package manager that launched the current process (`npm_config_user_agent`),\n * and falls back to lock file detection when the CLI was not started through a\n * package manager (e.g. a global install or a bare CI runner).\n */\nexport const getPackageManagerCommand = (\n lockFileSearchDir: string\n): PackageManagerCommand => {\n const userAgent = process.env.npm_config_user_agent;\n\n const commandByPackageManager: Record<PackageManager, PackageManagerCommand> =\n {\n bun: { command: 'bun', args: ['intlayer'] }, // Bun runs local bins natively\n pnpm: { command: 'pnpm', args: ['exec', 'intlayer'] }, // pnpm requires 'exec'\n yarn: { command: 'yarn', args: ['run', 'intlayer'] }, // yarn requires 'run' or 'exec'\n npm: { command: 'npx', args: ['intlayer'] },\n };\n\n const userAgentPackageManager = (\n Object.keys(commandByPackageManager) as PackageManager[]\n ).find((packageManager) => userAgent?.startsWith(packageManager));\n\n if (userAgentPackageManager) {\n return commandByPackageManager[userAgentPackageManager];\n }\n\n // No user agent — infer the package manager from the repository lock file.\n return commandByPackageManager[detectPackageManager(lockFileSearchDir)];\n};\n\n/**\n * Splits a path into segments, accepting both posix and windows separators so\n * credential keys written on any OS compare equal to local project paths.\n */\nconst toPathSegments = (path: string): string[] =>\n path.split(/[\\\\/]+/).filter((segment) => segment !== '' && segment !== '.');\n\n/**\n * Returns true when a credentials key designates the given project directory.\n * A key matches when it is:\n * - the absolute path of the project,\n * - a path relative to `searchDir` (the repository root), or\n * - a trailing sequence of full path segments of the project path (so the key\n * `\"apps/web\"` matches `/repo/apps/web`, but `\"app\"` never matches\n * `/repo/my-app`).\n */\nexport const credentialsKeyMatchesProject = (\n key: string,\n projectPath: string,\n searchDir: string\n): boolean => {\n if (resolve(key) === projectPath) return true;\n if (resolve(searchDir, key) === projectPath) return true;\n\n const keySegments = toPathSegments(key);\n const projectSegments = toPathSegments(projectPath);\n\n if (keySegments.length === 0 || keySegments.length > projectSegments.length) {\n return false;\n }\n\n const trailingProjectSegments = projectSegments.slice(-keySegments.length);\n\n return keySegments.every(\n (segment, index) => trailingProjectSegments[index] === segment\n );\n};\n\n/**\n * Selects the projects the CI command must run in:\n * - run from the repository root → every discovered project (monorepo mode);\n * - run from inside a project directory (or any of its subdirectories) → that\n * project only, the deepest match winning when projects are nested;\n * - run anywhere else → every discovered project.\n */\nexport const selectProjectsToRun = (\n currentWorkingDir: string,\n searchDir: string,\n projectsPath: string[]\n): { projectsToRun: string[]; currentProject: string | undefined } => {\n const cwd = resolve(currentWorkingDir);\n\n if (cwd === resolve(searchDir)) {\n return { projectsToRun: projectsPath, currentProject: undefined };\n }\n\n const currentProject = projectsPath\n .filter(\n (projectPath) => cwd === projectPath || cwd.startsWith(projectPath + sep)\n )\n .sort((a, b) => b.length - a.length)[0];\n\n return {\n projectsToRun: currentProject ? [currentProject] : projectsPath,\n currentProject,\n };\n};\n\n/**\n * Runs an intlayer command in every Intlayer project of the repository (or\n * only in the current one when invoked from inside a project directory),\n * injecting per-project CMS credentials from `INTLAYER_PROJECT_CREDENTIALS`.\n * Exits with code 1 when the command fails in at least one project.\n */\nexport const runCI = async (commands: string[]) => {\n const credentialsEnv = process.env.INTLAYER_PROJECT_CREDENTIALS;\n let credentials: CredentialsMap = {};\n\n // Parse Credentials (Optional now)\n if (credentialsEnv) {\n try {\n credentials = JSON.parse(credentialsEnv);\n } catch {\n logger(\n 'INTLAYER_PROJECT_CREDENTIALS is not valid JSON. Proceeding without credentials.',\n {\n level: 'warn',\n }\n );\n }\n }\n\n // Discover projects from the git root so every project of the repository is\n // found regardless of the directory the command is launched from.\n const { searchDir, projectsPath } = await listProjects({ gitRoot: true });\n const normalizedProjectsPath = projectsPath.map((projectPath) =>\n resolve(projectPath)\n );\n\n if (normalizedProjectsPath.length === 0) {\n logger('No Intlayer projects found.', { level: 'warn' });\n return;\n }\n\n // Determine Context: Single Project vs All Projects\n const { projectsToRun, currentProject } = selectProjectsToRun(\n process.cwd(),\n searchDir,\n normalizedProjectsPath\n );\n\n const { command, args: pmArgs } = getPackageManagerCommand(searchDir);\n const finalArgs = [...pmArgs, ...commands];\n\n logger(`CI: Using package manager: ${command}`, {\n level: 'info',\n isVerbose: true,\n });\n\n if (currentProject) {\n logger(`CI: Detected project context: ${currentProject}`, {\n level: 'info',\n });\n } else {\n logger(\n `CI: No specific project context detected. Iterating over ${projectsToRun.length} discovered projects...`,\n {\n level: 'info',\n }\n );\n }\n\n const failedProjects: string[] = [];\n\n // Iterate and Execute\n for (const projectPath of projectsToRun) {\n // Attempt to match credentials to the project path\n const credsEntry = Object.entries(credentials).find(([key]) =>\n credentialsKeyMatchesProject(key, projectPath, searchDir)\n );\n\n const creds = credsEntry?.[1];\n\n logger(`\\nCI: Executing for ${projectPath}...`, {\n level: 'info',\n });\n\n const envVars = { ...process.env };\n\n if (creds) {\n envVars.INTLAYER_CLIENT_ID = creds.clientId;\n envVars.INTLAYER_CLIENT_SECRET = creds.clientSecret;\n } else if (credentialsEnv) {\n logger(\n `CI: No matching credentials found for ${projectPath} in INTLAYER_PROJECT_CREDENTIALS.`,\n { isVerbose: true }\n );\n }\n\n const result = spawnSync(command, finalArgs, {\n cwd: projectPath,\n stdio: 'inherit',\n env: envVars,\n });\n\n if (result.error) {\n logger(\n `CI: Failed to launch \"${command}\" for ${projectPath}: ${result.error.message}`,\n { level: 'error' }\n );\n failedProjects.push(projectPath);\n continue;\n }\n\n if (result.status !== 0) {\n logger(`CI: Failed for ${projectPath}`, {\n level: 'error',\n });\n failedProjects.push(projectPath);\n }\n }\n\n if (failedProjects.length > 0) {\n logger(\n `\\nCI: ${failedProjects.length}/${projectsToRun.length} project(s) failed:\\n${failedProjects\n .map((projectPath) => ` - ${projectPath}`)\n .join('\\n')}`,\n { level: 'error' }\n );\n process.exit(1);\n }\n};\n"],"mappings":";;;;;;;;;;;;;;AAkCA,MAAa,4BACX,sBAC0B;CAC1B,MAAM,YAAY,QAAQ,IAAI;CAE9B,MAAM,0BACJ;EACE,KAAK;GAAE,SA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YAAY,IAAI,OAAO,MAAM,WACtE,EAAE,OAAO,SAAS,CACnB;AACD,kBAAe,KAAK,YAAY;AAChC;;AAGF,MAAI,OAAO,WAAW,GAAG;AACvB,uCAAO,kBAAkB,eAAe,EACtC,OAAO,SACR,CAAC;AACF,kBAAe,KAAK,YAAY;;;AAIpC,KAAI,eAAe,SAAS,GAAG;AAC7B,sCACE,SAAS,eAAe,OAAO,GAAG,cAAc,OAAO,uBAAuB,eAC3E,KAAK,gBAAgB,OAAO,cAAc,CAC1C,KAAK,KAAK,IACb,EAAE,OAAO,SAAS,CACnB;AACD,UAAQ,KAAK,EAAE"}
1
+ {"version":3,"file":"ci.cjs","names":["sep"],"sources":["../../src/ci.ts"],"sourcesContent":["import { spawnSync } from 'node:child_process';\nimport { resolve, sep } from 'node:path';\nimport { logger } from '@intlayer/config/logger';\nimport {\n detectPackageManager,\n listProjects,\n type PackageManager,\n} from '@intlayer/engine/cli';\n\n/** CMS access keys of a single project. */\ntype ProjectCredentials = {\n clientId: string;\n clientSecret: string;\n};\n\n/**\n * Shape of the `INTLAYER_PROJECT_CREDENTIALS` environment variable: a JSON map\n * of project path (absolute, or relative to the repository root) to its CMS\n * access keys.\n */\ntype CredentialsMap = Record<string, ProjectCredentials>;\n\n/** Command used to run the locally installed `intlayer` binary. */\ntype PackageManagerCommand = {\n command: string;\n args: string[];\n};\n\n/**\n * Detects the command used to run the local `intlayer` binary. Prefers the\n * package manager that launched the current process (`npm_config_user_agent`),\n * and falls back to lock file detection when the CLI was not started through a\n * package manager (e.g. a global install or a bare CI runner).\n */\nexport const getPackageManagerCommand = (\n lockFileSearchDir: string\n): PackageManagerCommand => {\n const userAgent = process.env.npm_config_user_agent;\n\n const commandByPackageManager: Record<PackageManager, PackageManagerCommand> =\n {\n bun: { command: 'bun', args: ['intlayer'] }, // Bun runs local bins natively\n pnpm: { command: 'pnpm', args: ['exec', 'intlayer'] }, // pnpm requires 'exec'\n yarn: { command: 'yarn', args: ['run', 'intlayer'] }, // yarn requires 'run' or 'exec'\n npm: { command: 'npx', args: ['intlayer'] },\n };\n\n const userAgentPackageManager = (\n Object.keys(commandByPackageManager) as PackageManager[]\n ).find((packageManager) => userAgent?.startsWith(packageManager));\n\n if (userAgentPackageManager) {\n return commandByPackageManager[userAgentPackageManager];\n }\n\n // No user agent — infer the package manager from the repository lock file.\n return commandByPackageManager[detectPackageManager(lockFileSearchDir)];\n};\n\n/**\n * Splits a path into segments, accepting both posix and windows separators so\n * credential keys written on any OS compare equal to local project paths.\n */\nconst toPathSegments = (path: string): string[] =>\n path.split(/[\\\\/]+/).filter((segment) => segment !== '' && segment !== '.');\n\n/**\n * Returns true when a credentials key designates the given project directory.\n * A key matches when it is:\n * - the absolute path of the project,\n * - a path relative to `searchDir` (the repository root), or\n * - a trailing sequence of full path segments of the project path (so the key\n * `\"apps/web\"` matches `/repo/apps/web`, but `\"app\"` never matches\n * `/repo/my-app`).\n */\nexport const credentialsKeyMatchesProject = (\n key: string,\n projectPath: string,\n searchDir: string\n): boolean => {\n if (resolve(key) === projectPath) return true;\n if (resolve(searchDir, key) === projectPath) return true;\n\n const keySegments = toPathSegments(key);\n const projectSegments = toPathSegments(projectPath);\n\n if (keySegments.length === 0 || keySegments.length > projectSegments.length) {\n return false;\n }\n\n const trailingProjectSegments = projectSegments.slice(-keySegments.length);\n\n return keySegments.every(\n (segment, index) => trailingProjectSegments[index] === segment\n );\n};\n\n/**\n * Selects the projects the CI command must run in:\n * - run from the repository root → every discovered project (monorepo mode);\n * - run from inside a project directory (or any of its subdirectories) → that\n * project only, the deepest match winning when projects are nested;\n * - run anywhere else → every discovered project.\n */\nexport const selectProjectsToRun = (\n currentWorkingDir: string,\n searchDir: string,\n projectsPath: string[]\n): { projectsToRun: string[]; currentProject: string | undefined } => {\n const cwd = resolve(currentWorkingDir);\n\n if (cwd === resolve(searchDir)) {\n return { projectsToRun: projectsPath, currentProject: undefined };\n }\n\n const currentProject = projectsPath\n .filter(\n (projectPath) => cwd === projectPath || cwd.startsWith(projectPath + sep)\n )\n .sort((a, b) => b.length - a.length)[0];\n\n return {\n projectsToRun: currentProject ? [currentProject] : projectsPath,\n currentProject,\n };\n};\n\n/**\n * Runs an intlayer command in every Intlayer project of the repository (or\n * only in the current one when invoked from inside a project directory),\n * injecting per-project CMS credentials from `INTLAYER_PROJECT_CREDENTIALS`.\n * Exits with code 1 when the command fails in at least one project.\n */\nexport const runCI = async (commands: string[]) => {\n const credentialsEnv = process.env.INTLAYER_PROJECT_CREDENTIALS;\n let credentials: CredentialsMap = {};\n\n // Parse Credentials (Optional now)\n if (credentialsEnv) {\n try {\n credentials = JSON.parse(credentialsEnv);\n } catch {\n logger(\n 'INTLAYER_PROJECT_CREDENTIALS is not valid JSON. Proceeding without credentials.',\n {\n level: 'warn',\n }\n );\n }\n }\n\n // Discover projects from the git root so every project of the repository is\n // found regardless of the directory the command is launched from.\n const { searchDir, projectsPath } = await listProjects({ gitRoot: true });\n const normalizedProjectsPath = projectsPath.map((projectPath) =>\n resolve(projectPath)\n );\n\n if (normalizedProjectsPath.length === 0) {\n logger('No Intlayer projects found.', { level: 'warn' });\n return;\n }\n\n // Determine Context: Single Project vs All Projects\n const { projectsToRun, currentProject } = selectProjectsToRun(\n process.cwd(),\n searchDir,\n normalizedProjectsPath\n );\n\n const { command, args: pmArgs } = getPackageManagerCommand(searchDir);\n const finalArgs = [...pmArgs, ...commands];\n\n logger(`CI: Using package manager: ${command}`, {\n level: 'info',\n isVerbose: true,\n });\n\n if (currentProject) {\n logger(`CI: Detected project context: ${currentProject}`, {\n level: 'info',\n });\n } else {\n logger(\n `CI: No specific project context detected. Iterating over ${projectsToRun.length} discovered projects...`,\n {\n level: 'info',\n }\n );\n }\n\n const failedProjects: string[] = [];\n\n // Iterate and Execute\n for (const projectPath of projectsToRun) {\n // Attempt to match credentials to the project path\n const credsEntry = Object.entries(credentials).find(([key]) =>\n credentialsKeyMatchesProject(key, projectPath, searchDir)\n );\n\n const creds = credsEntry?.[1];\n\n logger(`\\nCI: Executing for ${projectPath}...`, {\n level: 'info',\n });\n\n const envVars = { ...process.env };\n\n if (creds) {\n envVars.INTLAYER_CLIENT_ID = creds.clientId;\n envVars.INTLAYER_CLIENT_SECRET = creds.clientSecret;\n } else if (credentialsEnv) {\n logger(\n `CI: No matching credentials found for ${projectPath} in INTLAYER_PROJECT_CREDENTIALS.`,\n { isVerbose: true }\n );\n }\n\n const result = spawnSync(command, finalArgs, {\n cwd: projectPath,\n stdio: 'inherit',\n env: envVars,\n });\n\n if (result.error) {\n logger(\n `CI: Failed to launch \"${command}\" for ${projectPath}: ${result.error.message}`,\n { level: 'error' }\n );\n failedProjects.push(projectPath);\n continue;\n }\n\n if (result.status !== 0) {\n logger(`CI: Failed for ${projectPath}`, {\n level: 'error',\n });\n failedProjects.push(projectPath);\n }\n }\n\n if (failedProjects.length > 0) {\n logger(\n `\\nCI: ${failedProjects.length}/${projectsToRun.length} project(s) failed:\\n${failedProjects\n .map((projectPath) => ` - ${projectPath}`)\n .join('\\n')}`,\n { level: 'error' }\n );\n process.exit(1);\n }\n};\n"],"mappings":";;;;;;;;;;;;;AAkCA,MAAa,4BACX,sBAC0B;CAC1B,MAAM,YAAY,QAAQ,IAAI;CAE9B,MAAM,0BACJ;EACE,KAAK;GAAE,SAAS;GAAO,MAAM,CAAC,UAAU;EAAE;EAC1C,MAAM;GAAE,SAAS;GAAQ,MAAM,CAAC,QAAQ,UAAU;EAAE;EACpD,MAAM;GAAE,SAAS;GAAQ,MAAM,CAAC,OAAO,UAAU;EAAE;EACnD,KAAK;GAAE,SAAS;GAAO,MAAM,CAAC,UAAU;EAAE;CAC5C;CAEF,MAAM,0BACJ,OAAO,KAAK,uBAAuB,CAAC,CACpC,MAAM,mBAAmB,WAAW,WAAW,cAAc,CAAC;CAEhE,IAAI,yBACF,OAAO,wBAAwB;CAIjC,OAAO,uEAA6C,iBAAiB;AACvE;;;;;AAMA,MAAM,kBAAkB,SACtB,KAAK,MAAM,QAAQ,CAAC,CAA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O,QAAQ,CACnB;EACA,QAAQ,KAAK,CAAC;CAChB;AACF"}
package/dist/cjs/cli.cjs CHANGED
@@ -1,5 +1,4 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_runtime = require('./_virtual/_rolldown/runtime.cjs');
3
2
  const require_utils_getParentPackageJSON = require('./utils/getParentPackageJSON.cjs');
4
3
  let node_path = require("node:path");
5
4
  let _intlayer_config_logger = require("@intlayer/config/logger");
@@ -75,13 +74,14 @@ const gitOptionKeys = [
75
74
  const extractGitOptions = (options) => {
76
75
  if (extractKeysFromOptions(options, gitOptionKeys).length === 0) return void 0;
77
76
  const { gitDiff, gitDiffBase, gitDiffCurrent, uncommitted, unpushed, untracked } = options;
77
+ const mode = [
78
+ gitDiff && "gitDiff",
79
+ uncommitted && "uncommitted",
80
+ unpushed && "unpushed",
81
+ untracked && "untracked"
82
+ ].filter(Boolean);
78
83
  return removeUndefined({
79
- mode: [
80
- gitDiff && "gitDiff",
81
- uncommitted && "uncommitted",
82
- unpushed && "unpushed",
83
- untracked && "untracked"
84
- ].filter(Boolean),
84
+ mode,
85
85
  baseRef: gitDiffBase,
86
86
  currentRef: gitDiffCurrent,
87
87
  absolute: true
@@ -498,7 +498,10 @@ const setAPI = () => {
498
498
  declarationOnly: options.declarationOnly
499
499
  });
500
500
  });
501
- applyConfigOptions(program.command("standalone").description("Create a standalone bundle of the application content").option("-o, --outfile [outfile]", "Output file for the bundle", "intlayer-bundle.js").option("--packages [packages...]", "List of packages to bundle").option("--version [version]", "Version of the packages to bundle").option("--minify", "Minify the output").option("--platform [platform]", "Target platform", "browser").option("--format [format]", "Output format", "esm").action(async (options) => {
501
+ /**
502
+ * STANDALONE
503
+ */
504
+ const bundleCmd = program.command("standalone").description("Create a standalone bundle of the application content").option("-o, --outfile [outfile]", "Output file for the bundle", "intlayer-bundle.js").option("--packages [packages...]", "List of packages to bundle").option("--version [version]", "Version of the packages to bundle").option("--minify", "Minify the output").option("--platform [platform]", "Target platform", "browser").option("--format [format]", "Output format", "esm").action(async (options) => {
502
505
  const { bundle } = await Promise.resolve().then(() => require("./bundle.cjs"));
503
506
  bundle({
504
507
  outfile: options.outfile,
@@ -509,7 +512,8 @@ const setAPI = () => {
509
512
  format: options.format,
510
513
  configOptions: extractConfigOptions(options)
511
514
  });
512
- }));
515
+ });
516
+ applyConfigOptions(bundleCmd);
513
517
  /**
514
518
  * SCAN
515
519
  */
@@ -1 +1 @@
1
- {"version":3,"file":"cli.cjs","names":["getParentPackageJSON","Command"],"sources":["../../src/cli.ts"],"sourcesContent":["import { dirname as pathDirname } from 'node:path';\nimport { fileURLToPath } from 'node:url';\nimport type { AIOptions as BaseAIOptions } from '@intlayer/api';\nimport { setPrefix } from '@intlayer/config/logger';\nimport {\n type GetConfigurationOptions,\n getConfiguration,\n} from '@intlayer/config/node';\nimport type { DiffMode, ListGitFilesOptions } from '@intlayer/engine/cli';\nimport type { CustomIntlayerConfig } from '@intlayer/types/config';\nimport { Command } from 'commander';\nimport type { FillOptions } from './fill/fill';\nimport { getParentPackageJSON } from './utils/getParentPackageJSON';\n\n// Extended AI options to include customPrompt\ntype AIOptions = BaseAIOptions & {\n customPrompt?: string;\n};\n\nconst isESModule = typeof import.meta.url === 'string';\n\nexport const dirname = isESModule\n ? pathDirname(fileURLToPath(import.meta.url))\n : __dirname;\n\nconst packageJson = getParentPackageJSON(dirname);\n\nconst logOptions = [\n ['--verbose', 'Verbose (default to true using CLI)'],\n ['--prefix [prefix]', 'Prefix'],\n];\n\nconst configurationOptions = [\n ['--env-file [envFile]', 'Environment file'],\n ['-e, --env [env]', 'Environment'],\n ['--base-dir [baseDir]', 'Base directory'],\n ['--no-cache [noCache]', 'No cache'],\n ...logOptions,\n];\n\nconst aiOptions = [\n ['--provider [provider]', 'Provider'],\n ['--temperature [temperature]', 'Temperature'],\n ['--model [model]', 'Model'],\n ['--api-key [apiKey]', 'Provider API key'],\n ['--custom-prompt [prompt]', 'Custom prompt'],\n ['--application-context [applicationContext]', 'Application context'],\n ['--data-serialization [dataSerialization]', 'Data serialization'],\n];\n\nconst gitOptions = [\n ['--git-diff [gitDiff]', 'Git diff mode - Check git diff between two refs'],\n ['--git-diff-base [gitDiffBase]', 'Git diff base ref'],\n ['--git-diff-current [gitDiffCurrent]', 'Git diff current ref'],\n ['--uncommitted [uncommitted]', 'Uncommitted'],\n ['--unpushed [unpushed]', 'Unpushed'],\n ['--untracked [untracked]', 'Untracked'],\n];\n\nconst extractKeysFromOptions = (options: object, keys: string[]) =>\n keys.filter((key) => options[key as keyof typeof options] !== undefined);\n\n/**\n * Helper functions to apply common options to commands\n */\nconst applyOptions = (command: Command, options: string[][]) => {\n options.forEach(([flag, description]) => {\n command.option(flag, description);\n });\n return command;\n};\n\nconst removeUndefined = <T extends Record<string, any>>(obj: T): T =>\n Object.fromEntries(\n Object.entries(obj).filter(([_, value]) => value !== undefined)\n ) as T;\n\nconst applyConfigOptions = (command: Command) =>\n applyOptions(command, configurationOptions);\nconst applyAIOptions = (command: Command) => applyOptions(command, aiOptions);\nconst applyGitOptions = (command: Command) => applyOptions(command, gitOptions);\n\nconst extractAiOptions = (options: AIOptions): AIOptions | undefined => {\n const {\n apiKey,\n provider,\n model,\n temperature,\n applicationContext,\n customPrompt,\n dataSerialization,\n } = options;\n\n const configuration = getConfiguration();\n\n const { ai } = configuration;\n\n return removeUndefined({\n ...ai,\n apiKey: apiKey ?? configuration.ai?.apiKey,\n provider: provider ?? (configuration.ai?.provider as AIOptions['provider']),\n model: model ?? configuration.ai?.model,\n temperature: temperature ?? configuration.ai?.temperature,\n applicationContext:\n applicationContext ?? configuration.ai?.applicationContext,\n customPrompt: customPrompt ?? (configuration.ai as any)?.customPrompt,\n dataSerialization: dataSerialization ?? configuration.ai?.dataSerialization,\n });\n};\n\ntype GitOptions = {\n gitDiff?: boolean;\n gitDiffBase?: string;\n gitDiffCurrent?: string;\n uncommitted?: boolean;\n unpushed?: boolean;\n untracked?: boolean;\n};\n\nconst gitOptionKeys: (keyof GitOptions)[] = [\n 'gitDiff',\n 'gitDiffBase',\n 'gitDiffCurrent',\n 'uncommitted',\n 'unpushed',\n 'untracked',\n];\n\nconst extractGitOptions = (\n options: GitOptions\n): ListGitFilesOptions | undefined => {\n const filteredOptions = extractKeysFromOptions(options, gitOptionKeys);\n\n const isOptionEmpty = filteredOptions.length === 0;\n\n if (isOptionEmpty) return undefined;\n\n const {\n gitDiff,\n gitDiffBase,\n gitDiffCurrent,\n uncommitted,\n unpushed,\n untracked,\n } = options;\n\n const mode = [\n gitDiff && 'gitDiff',\n uncommitted && 'uncommitted',\n unpushed && 'unpushed',\n untracked && 'untracked',\n ].filter(Boolean) as DiffMode[];\n\n return removeUndefined({\n mode,\n baseRef: gitDiffBase,\n currentRef: gitDiffCurrent,\n absolute: true,\n });\n};\n\ntype LogOptions = {\n prefix?: string;\n verbose?: boolean;\n};\n\nexport type ConfigurationOptions = {\n baseDir?: string;\n env?: string;\n envFile?: string;\n noCache?: boolean;\n checkTypes?: boolean;\n} & LogOptions;\n\nconst configurationOptionKeys: (keyof ConfigurationOptions)[] = [\n 'baseDir',\n 'env',\n 'envFile',\n 'verbose',\n 'prefix',\n 'checkTypes',\n];\n\nconst extractConfigOptions = (\n options: ConfigurationOptions & { with?: string }\n): GetConfigurationOptions | undefined => {\n const filteredOptions = extractKeysFromOptions(\n options,\n configurationOptionKeys\n );\n\n const isOptionEmpty = filteredOptions.length === 0;\n\n if (isOptionEmpty) {\n return undefined;\n }\n\n const { baseDir, env, envFile, verbose, noCache, checkTypes } = options;\n\n const log = removeUndefined({\n mode:\n typeof verbose !== 'undefined'\n ? verbose\n ? 'verbose'\n : 'default'\n : undefined,\n });\n\n const build = removeUndefined({\n checkTypes,\n });\n\n const override: CustomIntlayerConfig = removeUndefined({\n log:\n Object.keys(log).length > 0\n ? (log as CustomIntlayerConfig['log'])\n : undefined,\n build: Object.keys(build).length > 0 ? build : undefined,\n });\n\n return removeUndefined({\n baseDir,\n env,\n envFile,\n override: Object.keys(override).length > 0 ? override : undefined,\n cache: typeof noCache !== 'undefined' ? !noCache : undefined,\n });\n};\n\n/**\n * Set the API for the CLI\n *\n * Example of commands:\n *\n * npm run intlayer build --watch\n * npm run intlayer push --dictionaries id1 id2 id3 --deleteLocaleDir\n */\nexport const setAPI = (): Command => {\n const isWithCommand = process.argv.includes('--with');\n\n if (!isWithCommand) {\n setPrefix('');\n }\n\n const program = new Command();\n\n program.version(packageJson.version!).description('Intlayer CLI');\n\n // Explicit version subcommand for convenience: `npx intlayer version`\n program\n .command('version')\n .description('Print the Intlayer CLI version')\n .action(() => {\n // Prefer the resolved package.json version; fallback to unknown\n // Keeping output minimal to align with common CLI behavior\n console.log(packageJson.version ?? 'unknown');\n });\n\n /**\n * AUTH\n */\n const loginCmd = program\n .command('login')\n .description('Login to Intlayer')\n .option('--cms-url [cmsUrl]', 'CMS URL');\n\n applyConfigOptions(loginCmd);\n\n loginCmd.action(async (options) => {\n const { login } = await import('./auth/login');\n const configOptions = extractConfigOptions(options) ?? {\n override: {\n log: {\n prefix: '',\n mode: 'verbose',\n },\n },\n };\n\n return login({\n cmsUrl: options.cmsUrl,\n configOptions,\n });\n });\n\n /**\n * INIT\n */\n const initCmd = program\n .command('init')\n .description('Initialize Intlayer in the project')\n .option('--project-root [projectRoot]', 'Project root directory')\n .option('--no-gitignore', 'Do not add .intlayer to .gitignore')\n .option(\n '--no-github-actions',\n 'Do not scaffold the fill and test GitHub Actions workflows'\n )\n .option(\n '--no-framework-setup',\n 'Do not scaffold framework middleware/proxy and providers in layout/page'\n )\n .option(\n '-i, --interactive',\n 'Interactively choose what to set up (packages, skills, MCP, VS Code extension, LSP, …)'\n )\n .action(async (options) => {\n const { init } = await import('./init');\n return init(\n options.projectRoot,\n {\n noGitignore: options.gitignore === false,\n noGithubActions: options.githubActions === false,\n noFrameworkSetup: options.frameworkSetup === false,\n upgradeToVersion: packageJson.version,\n },\n options.interactive === true\n );\n });\n\n initCmd\n .command('skills')\n .description('Initialize Intlayer skills in the project')\n .option('--project-root [projectRoot]', 'Project root directory')\n .action(async (options) => {\n const { initSkills } = await import('./initSkills');\n return initSkills(options.projectRoot);\n });\n\n initCmd\n .command('mcp')\n .description('Initialize Intlayer MCP server in the project')\n .option('--project-root [projectRoot]', 'Project root directory')\n .action(async (options) => {\n const { initMCP } = await import('./initMCP');\n return initMCP(options.projectRoot);\n });\n\n initCmd\n .command('build-optimization')\n .description(\n 'Configure build optimization for Next.js (@intlayer/swc or @intlayer/babel)'\n )\n .option('--project-root [projectRoot]', 'Project root directory')\n .action(async (options) => {\n const { initBuildOptimization } = await import('./initBuildOptimization');\n return initBuildOptimization(options.projectRoot);\n });\n\n /**\n * DICTIONARIES\n */\n\n const dictionariesProgram = program\n .command('dictionary')\n .alias('dictionaries')\n .alias('dic')\n .description('Dictionaries operations');\n\n // Dictionary build command\n const buildOptions = {\n description: 'Build the dictionaries',\n options: [\n ['-w, --watch', 'Watch for changes'],\n ['--skip-prepare', 'Skip the prepare step'],\n ['--with [with...]', 'Start command in parallel with the build'],\n ['--check-types', 'Check TypeScript type and log errors'],\n ],\n };\n\n // Add build command to dictionaries program\n const dictionariesBuildCmd = dictionariesProgram\n .command('build')\n .description(buildOptions.description);\n\n applyOptions(dictionariesBuildCmd, buildOptions.options);\n applyConfigOptions(dictionariesBuildCmd);\n dictionariesBuildCmd.action(async (options) => {\n const { build } = await import('./build');\n build({\n ...options,\n configOptions: extractConfigOptions(options),\n });\n });\n\n // Add build command to root program as well\n const rootBuildCmd = program\n .command('build')\n .description(buildOptions.description);\n\n applyOptions(rootBuildCmd, buildOptions.options);\n applyConfigOptions(rootBuildCmd);\n rootBuildCmd.action(async (options) => {\n const { build } = await import('./build');\n build({\n ...options,\n configOptions: extractConfigOptions(options),\n });\n });\n\n const watchOptions = {\n description: 'Watch the dictionaries changes',\n options: [['--with [with...]', 'Start command in parallel with the build']],\n };\n\n // Add build command to dictionaries program\n const dictionariesWatchCmd = dictionariesProgram\n .command('watch')\n .description(buildOptions.description);\n\n applyOptions(dictionariesWatchCmd, watchOptions.options);\n applyConfigOptions(dictionariesWatchCmd);\n dictionariesWatchCmd.action(async (options) => {\n const { watchContentDeclaration } = await import('./watch');\n watchContentDeclaration({\n ...options,\n configOptions: extractConfigOptions(options),\n });\n });\n\n // Add build command to root program as well\n const rootWatchCmd = program\n .command('watch')\n .description(buildOptions.description);\n\n applyOptions(rootWatchCmd, watchOptions.options);\n applyConfigOptions(rootWatchCmd);\n rootWatchCmd.action(async (options) => {\n const { watchContentDeclaration } = await import('./watch');\n watchContentDeclaration({\n ...options,\n configOptions: extractConfigOptions(options),\n });\n });\n\n // Dictionary pull command\n const pullOptions = {\n description: 'Pull dictionaries from the server',\n options: [\n ['-d, --dictionaries [ids...]', 'List of dictionary IDs to pull'],\n [\n '--dictionary [ids...]',\n 'List of dictionary IDs to pull (alias for --dictionaries)',\n ],\n ['--new-dictionaries-path [path]', 'Path to save the new dictionaries'],\n // Backward-compatibility for older tests/flags (camelCase)\n [\n '--newDictionariesPath [path]',\n '[alias] Path to save the new dictionaries',\n ],\n ],\n };\n\n // Add pull command to dictionaries program\n const dictionariesPullCmd = dictionariesProgram\n .command('pull')\n .description(pullOptions.description);\n\n applyOptions(dictionariesPullCmd, pullOptions.options);\n applyConfigOptions(dictionariesPullCmd);\n dictionariesPullCmd.action(async (options) => {\n const { pull } = await import('./pull');\n // Merge dictionary aliases\n const dictionaries = [\n ...(options.dictionaries ?? []),\n ...(options.dictionary ?? []),\n ];\n\n pull({\n ...options,\n dictionaries: dictionaries.length > 0 ? dictionaries : undefined,\n configOptions: extractConfigOptions(options),\n });\n });\n\n // Add pull command to root program as well\n const rootPullCmd = program\n .command('pull')\n .description(pullOptions.description);\n\n applyOptions(rootPullCmd, pullOptions.options);\n applyConfigOptions(rootPullCmd);\n rootPullCmd.action(async (options) => {\n const { pull } = await import('./pull');\n // Merge dictionary aliases\n const dictionaries = [\n ...(options.dictionaries ?? []),\n ...(options.dictionary ?? []),\n ];\n\n pull({\n ...options,\n dictionaries: dictionaries.length > 0 ? dictionaries : undefined,\n configOptions: extractConfigOptions(options),\n });\n });\n\n // Dictionary push command\n const pushOptions = {\n description:\n 'Push all dictionaries. Create or update the pushed dictionaries',\n options: [\n ['-d, --dictionaries [ids...]', 'List of dictionary IDs to push'],\n [\n '--dictionary [ids...]',\n 'List of dictionary IDs to push (alias for --dictionaries)',\n ],\n [\n '-r, --delete-locale-dictionary',\n 'Delete the local dictionaries after pushing',\n ],\n [\n '-k, --keep-locale-dictionary',\n 'Keep the local dictionaries after pushing',\n ],\n // Backward-compatibility for older tests/flags (camelCase)\n [\n '--deleteLocaleDictionary',\n '[alias] Delete the local dictionaries after pushing',\n ],\n [\n '--keepLocaleDictionary',\n '[alias] Keep the local dictionaries after pushing',\n ],\n [\n '--build [build]',\n 'Build the dictionaries before pushing to ensure the content is up to date. True will force the build, false will skip the build, undefined will allow using the cache of the build',\n ],\n ],\n };\n\n // Add push command to dictionaries program\n const dictionariesPushCmd = dictionariesProgram\n .command('push')\n .description(pushOptions.description);\n\n applyOptions(dictionariesPushCmd, pushOptions.options);\n applyConfigOptions(dictionariesPushCmd);\n applyGitOptions(dictionariesPushCmd);\n\n dictionariesPushCmd.action(async (options) => {\n const { push } = await import('./push/push');\n // Merge dictionary aliases\n const dictionaries = [\n ...(options.dictionaries || []),\n ...(options.dictionary || []),\n ];\n\n return push({\n ...options,\n dictionaries: dictionaries.length > 0 ? dictionaries : undefined,\n gitOptions: extractGitOptions(options),\n configOptions: extractConfigOptions(options),\n } as FillOptions);\n });\n\n // Add push command to root program as well\n const rootPushCmd = program\n .command('push')\n .description(pushOptions.description);\n\n applyOptions(rootPushCmd, pushOptions.options);\n applyConfigOptions(rootPushCmd);\n applyGitOptions(rootPushCmd);\n\n rootPushCmd.action(async (options) => {\n const { push } = await import('./push/push');\n // Merge dictionary aliases\n const dictionaries = [\n ...(options.dictionaries || []),\n ...(options.dictionary || []),\n ];\n\n return push({\n ...options,\n dictionaries: dictionaries.length > 0 ? dictionaries : undefined,\n gitOptions: extractGitOptions(options),\n configOptions: extractConfigOptions(options),\n } as FillOptions);\n });\n\n /**\n * CONFIGURATION\n */\n\n // Define the parent command\n const configurationProgram = program\n .command('configuration')\n .alias('config')\n .alias('conf')\n .description('Configuration operations');\n\n const configGetCmd = configurationProgram\n .command('get')\n .description('Get the configuration');\n\n applyConfigOptions(configGetCmd);\n configGetCmd.action(async (options) => {\n const { getConfig } = await import('./config');\n getConfig({\n ...options,\n configOptions: extractConfigOptions(options),\n });\n });\n\n // Define the `push config` subcommand and add it to the `push` command\n const configPushCmd = configurationProgram\n .command('push')\n .description('Push the configuration');\n\n applyConfigOptions(configPushCmd);\n configPushCmd.action(async (options) => {\n const { pushConfig } = await import('./pushConfig');\n pushConfig({\n ...options,\n configOptions: extractConfigOptions(options),\n });\n });\n\n /**\n * PROJECTS\n */\n\n const projectsProgram = program\n .command('projects')\n .alias('project')\n .description('List Intlayer projects');\n\n const projectsListCmd = projectsProgram\n .command('list')\n .description('List all Intlayer projects in the directory')\n .option('--base-dir [baseDir]', 'Base directory to search from')\n .option(\n '--git-root',\n 'Search from the git root directory instead of the base directory'\n )\n .option('--json', 'Output the results as JSON');\n\n projectsListCmd.action(async (options) => {\n const { listProjectsCommand } = await import('./listProjects');\n listProjectsCommand({\n baseDir: options.baseDir,\n gitRoot: options.gitRoot,\n json: options.json,\n });\n });\n\n // Add alias for projects list command at root level\n const rootProjectsListCmd = program\n .command('projects-list')\n .alias('pl')\n .description('List all Intlayer projects in the directory')\n .option('--base-dir [baseDir]', 'Base directory to search from')\n .option(\n '--git-root',\n 'Search from the git root directory instead of the base directory'\n )\n .option('--absolute', 'Output the results as absolute paths')\n .option('--json', 'Output the results as JSON');\n\n rootProjectsListCmd.action(async (options) => {\n const { listProjectsCommand } = await import('./listProjects');\n listProjectsCommand({\n baseDir: options.baseDir,\n gitRoot: options.gitRoot,\n json: options.json,\n absolute: options.absolute,\n });\n });\n\n /**\n * CONTENT DECLARATION\n */\n\n const contentProgram = program\n .command('content')\n .description('Content declaration operations');\n\n contentProgram\n .command('list')\n .description('List the content declaration files')\n .option('--json', 'Output the results as JSON')\n .option('--absolute', 'Output the results as absolute paths')\n .action(async (options) => {\n const { listContentDeclaration } = await import(\n './listContentDeclaration'\n );\n listContentDeclaration({\n json: options.json,\n absolute: options.absolute,\n });\n });\n\n // Add alias for content list command\n program\n .command('list')\n .description('List the content declaration files')\n .option('--json', 'Output the results as JSON')\n .option('--absolute', 'Output the results as absolute paths')\n .action(async (options) => {\n const { listContentDeclaration } = await import(\n './listContentDeclaration'\n );\n listContentDeclaration({\n json: options.json,\n absolute: options.absolute,\n });\n });\n\n const testProgram = contentProgram\n .command('test')\n .description('Test if there are missing translations')\n .option(\n '--build [build]',\n 'Build the dictionaries before testing to ensure the content is up to date. True will force the build, false will skip the build, undefined will allow using the cache of the build'\n );\n\n applyConfigOptions(testProgram);\n testProgram.action(async (options) => {\n const { testMissingTranslations } = await import('./test');\n testMissingTranslations({\n ...options,\n configOptions: extractConfigOptions(options),\n });\n });\n\n // Add alias for content test command\n const rootTestCmd = program\n .command('test')\n .description('Test if there are missing translations')\n .option(\n '--build [build]',\n 'Build the dictionaries before testing to ensure the content is up to date. True will force the build, false will skip the build, undefined will allow using the cache of the build'\n );\n\n applyConfigOptions(rootTestCmd);\n rootTestCmd.action(async (options) => {\n const { testMissingTranslations } = await import('./test');\n testMissingTranslations({\n ...options,\n configOptions: extractConfigOptions(options),\n });\n });\n\n const fillProgram = program\n .command('fill')\n .description('Fill the dictionaries')\n .option('-f, --file [files...]', 'List of Dictionary files to fill')\n .option('--source-locale [sourceLocale]', 'Source locale to translate from')\n .option(\n '--output-locales [outputLocales...]',\n 'Target locales to translate to'\n )\n .option(\n '--mode [mode]',\n 'Fill mode: complete, review. Complete will fill all missing content, review will fill missing content and review existing keys',\n 'complete'\n )\n .option('-k, --keys [keys...]', 'Filter dictionaries based on keys')\n .option(\n '--key [keys...]',\n 'Filter dictionaries based on keys (alias for --keys)'\n )\n .option(\n '--excluded-keys [excludedKeys...]',\n 'Filter out dictionaries based on keys'\n )\n .option(\n '--excluded-key [excludedKeys...]',\n 'Filter out dictionaries based on keys (alias for --excluded-keys)'\n )\n .option(\n '--path-filter [pathFilters...]',\n 'Filter dictionaries based on glob pattern'\n )\n .option(\n '--build [build]',\n 'Build the dictionaries before filling to ensure the content is up to date. True will force the build, false will skip the build, undefined will allow using the cache of the build'\n )\n .option(\n '--skip-metadata',\n 'Skip filling missing metadata (description, title, tags) for dictionaries'\n );\n\n applyConfigOptions(fillProgram);\n applyAIOptions(fillProgram);\n applyGitOptions(fillProgram);\n\n fillProgram.action(async (options) => {\n const { fill } = await import('./fill/fill');\n // Merge key aliases\n const keys = [...(options.keys ?? []), ...(options.key ?? [])];\n const excludedKeys = [\n ...(options.excludedKeys ?? []),\n ...(options.excludedKey ?? []),\n ];\n // Merge dictionary aliases\n const dictionaries = [\n ...(options.dictionaries ?? []),\n ...(options.dictionary ?? []),\n ];\n\n return fill({\n ...options,\n keys: keys.length > 0 ? keys : undefined,\n excludedKeys: excludedKeys.length > 0 ? excludedKeys : undefined,\n dictionaries: dictionaries.length > 0 ? dictionaries : undefined,\n aiOptions: extractAiOptions(options),\n gitOptions: extractGitOptions(options),\n configOptions: extractConfigOptions(options),\n } as FillOptions);\n });\n\n /**\n * DOCS\n */\n\n const docParams = [\n ['--doc-pattern [docPattern...]', 'Documentation pattern'],\n [\n '--excluded-glob-pattern [excludedGlobPattern...]',\n 'Excluded glob pattern',\n ],\n [\n '--nb-simultaneous-file-processed [nbSimultaneousFileProcessed]',\n 'Number of simultaneous file processed',\n ],\n ['--locales [locales...]', 'Locales'],\n ['--base-locale [baseLocale]', 'Base locale'],\n [\n '--custom-instructions [customInstructions]',\n 'Custom instructions added to the prompt. Usefull to apply specific rules regarding formatting, urls translation, etc.',\n ],\n [\n '--skip-if-modified-before [skipIfModifiedBefore]',\n 'Skip the file if it has been modified before the given time. Can be an absolute time as \"2025-12-05\" (string or Date) or a relative time in ms `1 * 60 * 60 * 1000` (1 hour). This option check update time of the file using the `fs.stat` method. So it could be impacted by Git or other tools that modify the file.',\n ],\n [\n '--skip-if-modified-after [skipIfModifiedAfter]',\n 'Skip the file if it has been modified within the given time. Can be an absolute time as \"2025-12-05\" (string or Date) or a relative time in ms `1 * 60 * 60 * 1000` (1 hour). This option check update time of the file using the `fs.stat` method. So it could be impacted by Git or other tools that modify the file.',\n ],\n ['--skip-if-exists', 'Skip the file if it already exists'],\n ];\n\n const docProgram = program\n .command('doc')\n .description('Documentation operations');\n\n const translateProgram = docProgram\n .command('translate')\n .description('Translate the documentation');\n\n applyConfigOptions(translateProgram);\n applyAIOptions(translateProgram);\n applyGitOptions(translateProgram);\n applyOptions(translateProgram, docParams);\n\n translateProgram.action(async (options) => {\n const { translateDoc } = await import('./translateDoc/translateDoc');\n return translateDoc({\n docPattern: options.docPattern,\n excludedGlobPattern: options.excludedGlobPattern,\n locales: options.locales,\n baseLocale: options.baseLocale,\n aiOptions: extractAiOptions(options),\n gitOptions: extractGitOptions(options),\n nbSimultaneousFileProcessed: options.nbSimultaneousFileProcessed,\n configOptions: extractConfigOptions(options),\n customInstructions: options.customInstructions,\n skipIfModifiedBefore: options.skipIfModifiedBefore,\n skipIfModifiedAfter: options.skipIfModifiedAfter,\n skipIfExists: options.skipIfExists,\n });\n });\n\n const reviewProgram = docProgram\n .command('review')\n .description('Review the documentation')\n .option(\n '--log',\n 'Log-only mode. Do not translate with AI; instead log the blocks that need attention (with line numbers and content) for the base and target locales, to help another agent generate the translations.'\n );\n\n applyConfigOptions(reviewProgram);\n applyAIOptions(reviewProgram);\n applyGitOptions(reviewProgram);\n applyOptions(reviewProgram, docParams);\n\n reviewProgram.action(async (options) => {\n const { reviewDoc } = await import('./reviewDoc/reviewDoc');\n return reviewDoc({\n docPattern: options.docPattern,\n excludedGlobPattern: options.excludedGlobPattern,\n locales: options.locales,\n baseLocale: options.baseLocale,\n aiOptions: extractAiOptions(options),\n gitOptions: extractGitOptions(options),\n nbSimultaneousFileProcessed: options.nbSimultaneousFileProcessed,\n configOptions: extractConfigOptions(options),\n customInstructions: options.customInstructions,\n skipIfModifiedBefore: options.skipIfModifiedBefore,\n skipIfModifiedAfter: options.skipIfModifiedAfter,\n skipIfExists: options.skipIfExists,\n log: options.log,\n });\n });\n\n const searchProgram = docProgram\n .command('search')\n .description('Search the documentation')\n .argument('<query>', 'Search query')\n .option('--limit [limit]', 'Limit the number of results', '10');\n\n applyConfigOptions(searchProgram);\n\n searchProgram.action(async (query, options) => {\n const { searchDoc } = await import('./searchDoc');\n return searchDoc({\n query,\n limit: options.limit ? parseInt(options.limit, 10) : 10,\n configOptions: extractConfigOptions(options),\n });\n });\n\n /**\n * LIVE SYNC\n */\n\n const liveOptions = [\n ['--with [with...]', 'Start command in parallel with the live sync'],\n ];\n\n const liveCmd = program\n .command('live')\n .description(\n 'Live sync - Watch for changes made on the CMS and update the application content accordingly'\n );\n\n applyOptions(liveCmd, liveOptions);\n applyConfigOptions(liveCmd);\n\n liveCmd.action(async (options) => {\n const { liveSync } = await import('./liveSync');\n return liveSync({\n ...options,\n configOptions: extractConfigOptions(options),\n });\n });\n\n /**\n * EDITOR\n */\n\n const editorProgram = program\n .command('editor')\n .description('Visual editor operations');\n\n const editorStartCmd = editorProgram\n .command('start')\n .description('Start the Intlayer visual editor');\n\n applyConfigOptions(editorStartCmd);\n\n editorStartCmd.action(async (options) => {\n const { startEditor } = await import('./editor');\n startEditor({\n env: options.env,\n envFile: options.envFile,\n });\n });\n\n /**\n * EXTRACT\n */\n const extractProgram = program\n .command('extract')\n .alias('ext')\n .description(\n 'Extract strings from components to be placed in a .content file close to the component'\n );\n\n applyConfigOptions(extractProgram);\n\n extractProgram\n .option('-f, --file [files...]', 'List of files to extract')\n .option('--code-only', 'Only extract the component code', false)\n .option('--declaration-only', 'Only generate content declaration', false)\n .action(async (options) => {\n const { extract } = await import('./extract');\n extract({\n files: options.file,\n configOptions: extractConfigOptions(options),\n codeOnly: options.codeOnly,\n declarationOnly: options.declarationOnly,\n });\n });\n\n /**\n * STANDALONE\n */\n const bundleCmd = program\n .command('standalone')\n .description('Create a standalone bundle of the application content')\n .option(\n '-o, --outfile [outfile]',\n 'Output file for the bundle',\n 'intlayer-bundle.js'\n )\n .option('--packages [packages...]', 'List of packages to bundle')\n .option('--version [version]', 'Version of the packages to bundle')\n .option('--minify', 'Minify the output')\n .option('--platform [platform]', 'Target platform', 'browser')\n .option('--format [format]', 'Output format', 'esm')\n .action(async (options) => {\n const { bundle } = await import('./bundle');\n bundle({\n outfile: options.outfile,\n bundlePackages: options.packages,\n version: options.version,\n minify: options.minify,\n platform: options.platform,\n format: options.format,\n configOptions: extractConfigOptions(options),\n });\n });\n\n applyConfigOptions(bundleCmd);\n\n /**\n * SCAN\n */\n const scanCmd = program\n .command('scan')\n .description(\n 'Scan a website to measure its page size and audit its i18n / SEO health'\n )\n .argument('<url>', 'URL of the website to scan')\n .option('--no-deep', 'Disable the deeper puppeteer-based render scan')\n .option('--json', 'Output the results as JSON');\n\n applyConfigOptions(scanCmd);\n\n scanCmd.action(async (url, options) => {\n const { scan } = await import('./scan');\n return scan(url, {\n deep: options.deep,\n json: options.json,\n configOptions: extractConfigOptions(options),\n });\n });\n\n program.parse(process.argv);\n\n /**\n * CI / AUTOMATION\n *\n * Used to iterate over all projects in a monorepo, and help to parse secrets\n */\n program\n .command('ci')\n .description(\n 'Run Intlayer commands with auto-injected credentials from INTLAYER_PROJECT_CREDENTIALS. Detects current project or iterates over all projects.'\n )\n .argument(\n '<command...>',\n 'The intlayer command to execute (e.g., \"fill\", \"push\")'\n )\n .allowUnknownOption() // Allows passing flags like --verbose to the subcommand\n .action(async (args) => {\n const { runCI } = await import('./ci');\n runCI(args);\n });\n\n return program;\n};\n"],"mappings":";;;;;;;;;;AAmBA,MAAM,aAAa,yDAA2B;AAE9C,MAAa,UAAU,8GACuB,CAAC,GAC3C;AAEJ,MAAM,cAAcA,wDA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AAQ,QAAQ;GAChB,eAAe,qBAAqB,QAAQ;GAC7C,CAAC;GAGsB,CAAC;;;;CAK7B,MAAM,UAAU,QACb,QAAQ,OAAO,CACf,YACC,0EACD,CACA,SAAS,SAAS,6BAA6B,CAC/C,OAAO,aAAa,iDAAiD,CACrE,OAAO,UAAU,6BAA6B;AAEjD,oBAAmB,QAAQ;AAE3B,SAAQ,OAAO,OAAO,KAAK,YAAY;EACrC,MAAM,EAAE,SAAS,2CAAM;AACvB,SAAO,KAAK,KAAK;GACf,MAAM,QAAQ;GACd,MAAM,QAAQ;GACd,eAAe,qBAAqB,QAAQ;GAC7C,CAAC;GACF;AAEF,SAAQ,MAAM,QAAQ,KAAK;;;;;;AAO3B,SACG,QAAQ,KAAK,CACb,YACC,iJACD,CACA,SACC,gBACA,6DACD,CACA,oBAAoB,CACpB,OAAO,OAAO,SAAS;EACtB,MAAM,EAAE,UAAU,2CAAM;AACxB,QAAM,KAAK;GACX;AAEJ,QAAO"}
1
+ {"version":3,"file":"cli.cjs","names":["getParentPackageJSON","Command"],"sources":["../../src/cli.ts"],"sourcesContent":["import { dirname as pathDirname } from 'node:path';\nimport { fileURLToPath } from 'node:url';\nimport type { AIOptions as BaseAIOptions } from '@intlayer/api';\nimport { setPrefix } from '@intlayer/config/logger';\nimport {\n type GetConfigurationOptions,\n getConfiguration,\n} from '@intlayer/config/node';\nimport type { DiffMode, ListGitFilesOptions } from '@intlayer/engine/cli';\nimport type { CustomIntlayerConfig } from '@intlayer/types/config';\nimport { Command } from 'commander';\nimport type { FillOptions } from './fill/fill';\nimport { getParentPackageJSON } from './utils/getParentPackageJSON';\n\n// Extended AI options to include customPrompt\ntype AIOptions = BaseAIOptions & {\n customPrompt?: string;\n};\n\nconst isESModule = typeof import.meta.url === 'string';\n\nexport const dirname = isESModule\n ? pathDirname(fileURLToPath(import.meta.url))\n : __dirname;\n\nconst packageJson = getParentPackageJSON(dirname);\n\nconst logOptions = [\n ['--verbose', 'Verbose (default to true using CLI)'],\n ['--prefix [prefix]', 'Prefix'],\n];\n\nconst configurationOptions = [\n ['--env-file [envFile]', 'Environment file'],\n ['-e, --env [env]', 'Environment'],\n ['--base-dir [baseDir]', 'Base directory'],\n ['--no-cache [noCache]', 'No cache'],\n ...logOptions,\n];\n\nconst aiOptions = [\n ['--provider [provider]', 'Provider'],\n ['--temperature [temperature]', 'Temperature'],\n ['--model [model]', 'Model'],\n ['--api-key [apiKey]', 'Provider API key'],\n ['--custom-prompt [prompt]', 'Custom prompt'],\n ['--application-context [applicationContext]', 'Application context'],\n ['--data-serialization [dataSerialization]', 'Data serialization'],\n];\n\nconst gitOptions = [\n ['--git-diff [gitDiff]', 'Git diff mode - Check git diff between two refs'],\n ['--git-diff-base [gitDiffBase]', 'Git diff base ref'],\n ['--git-diff-current [gitDiffCurrent]', 'Git diff current ref'],\n ['--uncommitted [uncommitted]', 'Uncommitted'],\n ['--unpushed [unpushed]', 'Unpushed'],\n ['--untracked [untracked]', 'Untracked'],\n];\n\nconst extractKeysFromOptions = (options: object, keys: string[]) =>\n keys.filter((key) => options[key as keyof typeof options] !== undefined);\n\n/**\n * Helper functions to apply common options to commands\n */\nconst applyOptions = (command: Command, options: string[][]) => {\n options.forEach(([flag, description]) => {\n command.option(flag, description);\n });\n return command;\n};\n\nconst removeUndefined = <T extends Record<string, any>>(obj: T): T =>\n Object.fromEntries(\n Object.entries(obj).filter(([_, value]) => value !== undefined)\n ) as T;\n\nconst applyConfigOptions = (command: Command) =>\n applyOptions(command, configurationOptions);\nconst applyAIOptions = (command: Command) => applyOptions(command, aiOptions);\nconst applyGitOptions = (command: Command) => applyOptions(command, gitOptions);\n\nconst extractAiOptions = (options: AIOptions): AIOptions | undefined => {\n const {\n apiKey,\n provider,\n model,\n temperature,\n applicationContext,\n customPrompt,\n dataSerialization,\n } = options;\n\n const configuration = getConfiguration();\n\n const { ai } = configuration;\n\n return removeUndefined({\n ...ai,\n apiKey: apiKey ?? configuration.ai?.apiKey,\n provider: provider ?? (configuration.ai?.provider as AIOptions['provider']),\n model: model ?? configuration.ai?.model,\n temperature: temperature ?? configuration.ai?.temperature,\n applicationContext:\n applicationContext ?? configuration.ai?.applicationContext,\n customPrompt: customPrompt ?? (configuration.ai as any)?.customPrompt,\n dataSerialization: dataSerialization ?? configuration.ai?.dataSerialization,\n });\n};\n\ntype GitOptions = {\n gitDiff?: boolean;\n gitDiffBase?: string;\n gitDiffCurrent?: string;\n uncommitted?: boolean;\n unpushed?: boolean;\n untracked?: boolean;\n};\n\nconst gitOptionKeys: (keyof GitOptions)[] = [\n 'gitDiff',\n 'gitDiffBase',\n 'gitDiffCurrent',\n 'uncommitted',\n 'unpushed',\n 'untracked',\n];\n\nconst extractGitOptions = (\n options: GitOptions\n): ListGitFilesOptions | undefined => {\n const filteredOptions = extractKeysFromOptions(options, gitOptionKeys);\n\n const isOptionEmpty = filteredOptions.length === 0;\n\n if (isOptionEmpty) return undefined;\n\n const {\n gitDiff,\n gitDiffBase,\n gitDiffCurrent,\n uncommitted,\n unpushed,\n untracked,\n } = options;\n\n const mode = [\n gitDiff && 'gitDiff',\n uncommitted && 'uncommitted',\n unpushed && 'unpushed',\n untracked && 'untracked',\n ].filter(Boolean) as DiffMode[];\n\n return removeUndefined({\n mode,\n baseRef: gitDiffBase,\n currentRef: gitDiffCurrent,\n absolute: true,\n });\n};\n\ntype LogOptions = {\n prefix?: string;\n verbose?: boolean;\n};\n\nexport type ConfigurationOptions = {\n baseDir?: string;\n env?: string;\n envFile?: string;\n noCache?: boolean;\n checkTypes?: boolean;\n} & LogOptions;\n\nconst configurationOptionKeys: (keyof ConfigurationOptions)[] = [\n 'baseDir',\n 'env',\n 'envFile',\n 'verbose',\n 'prefix',\n 'checkTypes',\n];\n\nconst extractConfigOptions = (\n options: ConfigurationOptions & { with?: string }\n): GetConfigurationOptions | undefined => {\n const filteredOptions = extractKeysFromOptions(\n options,\n configurationOptionKeys\n );\n\n const isOptionEmpty = filteredOptions.length === 0;\n\n if (isOptionEmpty) {\n return undefined;\n }\n\n const { baseDir, env, envFile, verbose, noCache, checkTypes } = options;\n\n const log = removeUndefined({\n mode:\n typeof verbose !== 'undefined'\n ? verbose\n ? 'verbose'\n : 'default'\n : undefined,\n });\n\n const build = removeUndefined({\n checkTypes,\n });\n\n const override: CustomIntlayerConfig = removeUndefined({\n log:\n Object.keys(log).length > 0\n ? (log as CustomIntlayerConfig['log'])\n : undefined,\n build: Object.keys(build).length > 0 ? build : undefined,\n });\n\n return removeUndefined({\n baseDir,\n env,\n envFile,\n override: Object.keys(override).length > 0 ? override : undefined,\n cache: typeof noCache !== 'undefined' ? !noCache : undefined,\n });\n};\n\n/**\n * Set the API for the CLI\n *\n * Example of commands:\n *\n * npm run intlayer build --watch\n * npm run intlayer push --dictionaries id1 id2 id3 --deleteLocaleDir\n */\nexport const setAPI = (): Command => {\n const isWithCommand = process.argv.includes('--with');\n\n if (!isWithCommand) {\n setPrefix('');\n }\n\n const program = new Command();\n\n program.version(packageJson.version!).description('Intlayer CLI');\n\n // Explicit version subcommand for convenience: `npx intlayer version`\n program\n .command('version')\n .description('Print the Intlayer CLI version')\n .action(() => {\n // Prefer the resolved package.json version; fallback to unknown\n // Keeping output minimal to align with common CLI behavior\n console.log(packageJson.version ?? 'unknown');\n });\n\n /**\n * AUTH\n */\n const loginCmd = program\n .command('login')\n .description('Login to Intlayer')\n .option('--cms-url [cmsUrl]', 'CMS URL');\n\n applyConfigOptions(loginCmd);\n\n loginCmd.action(async (options) => {\n const { login } = await import('./auth/login');\n const configOptions = extractConfigOptions(options) ?? {\n override: {\n log: {\n prefix: '',\n mode: 'verbose',\n },\n },\n };\n\n return login({\n cmsUrl: options.cmsUrl,\n configOptions,\n });\n });\n\n /**\n * INIT\n */\n const initCmd = program\n .command('init')\n .description('Initialize Intlayer in the project')\n .option('--project-root [projectRoot]', 'Project root directory')\n .option('--no-gitignore', 'Do not add .intlayer to .gitignore')\n .option(\n '--no-github-actions',\n 'Do not scaffold the fill and test GitHub Actions workflows'\n )\n .option(\n '--no-framework-setup',\n 'Do not scaffold framework middleware/proxy and providers in layout/page'\n )\n .option(\n '-i, --interactive',\n 'Interactively choose what to set up (packages, skills, MCP, VS Code extension, LSP, …)'\n )\n .action(async (options) => {\n const { init } = await import('./init');\n return init(\n options.projectRoot,\n {\n noGitignore: options.gitignore === false,\n noGithubActions: options.githubActions === false,\n noFrameworkSetup: options.frameworkSetup === false,\n upgradeToVersion: packageJson.version,\n },\n options.interactive === true\n );\n });\n\n initCmd\n .command('skills')\n .description('Initialize Intlayer skills in the project')\n .option('--project-root [projectRoot]', 'Project root directory')\n .action(async (options) => {\n const { initSkills } = await import('./initSkills');\n return initSkills(options.projectRoot);\n });\n\n initCmd\n .command('mcp')\n .description('Initialize Intlayer MCP server in the project')\n .option('--project-root [projectRoot]', 'Project root directory')\n .action(async (options) => {\n const { initMCP } = await import('./initMCP');\n return initMCP(options.projectRoot);\n });\n\n initCmd\n .command('build-optimization')\n .description(\n 'Configure build optimization for Next.js (@intlayer/swc or @intlayer/babel)'\n )\n .option('--project-root [projectRoot]', 'Project root directory')\n .action(async (options) => {\n const { initBuildOptimization } = await import('./initBuildOptimization');\n return initBuildOptimization(options.projectRoot);\n });\n\n /**\n * DICTIONARIES\n */\n\n const dictionariesProgram = program\n .command('dictionary')\n .alias('dictionaries')\n .alias('dic')\n .description('Dictionaries operations');\n\n // Dictionary build command\n const buildOptions = {\n description: 'Build the dictionaries',\n options: [\n ['-w, --watch', 'Watch for changes'],\n ['--skip-prepare', 'Skip the prepare step'],\n ['--with [with...]', 'Start command in parallel with the build'],\n ['--check-types', 'Check TypeScript type and log errors'],\n ],\n };\n\n // Add build command to dictionaries program\n const dictionariesBuildCmd = dictionariesProgram\n .command('build')\n .description(buildOptions.description);\n\n applyOptions(dictionariesBuildCmd, buildOptions.options);\n applyConfigOptions(dictionariesBuildCmd);\n dictionariesBuildCmd.action(async (options) => {\n const { build } = await import('./build');\n build({\n ...options,\n configOptions: extractConfigOptions(options),\n });\n });\n\n // Add build command to root program as well\n const rootBuildCmd = program\n .command('build')\n .description(buildOptions.description);\n\n applyOptions(rootBuildCmd, buildOptions.options);\n applyConfigOptions(rootBuildCmd);\n rootBuildCmd.action(async (options) => {\n const { build } = await import('./build');\n build({\n ...options,\n configOptions: extractConfigOptions(options),\n });\n });\n\n const watchOptions = {\n description: 'Watch the dictionaries changes',\n options: [['--with [with...]', 'Start command in parallel with the build']],\n };\n\n // Add build command to dictionaries program\n const dictionariesWatchCmd = dictionariesProgram\n .command('watch')\n .description(buildOptions.description);\n\n applyOptions(dictionariesWatchCmd, watchOptions.options);\n applyConfigOptions(dictionariesWatchCmd);\n dictionariesWatchCmd.action(async (options) => {\n const { watchContentDeclaration } = await import('./watch');\n watchContentDeclaration({\n ...options,\n configOptions: extractConfigOptions(options),\n });\n });\n\n // Add build command to root program as well\n const rootWatchCmd = program\n .command('watch')\n .description(buildOptions.description);\n\n applyOptions(rootWatchCmd, watchOptions.options);\n applyConfigOptions(rootWatchCmd);\n rootWatchCmd.action(async (options) => {\n const { watchContentDeclaration } = await import('./watch');\n watchContentDeclaration({\n ...options,\n configOptions: extractConfigOptions(options),\n });\n });\n\n // Dictionary pull command\n const pullOptions = {\n description: 'Pull dictionaries from the server',\n options: [\n ['-d, --dictionaries [ids...]', 'List of dictionary IDs to pull'],\n [\n '--dictionary [ids...]',\n 'List of dictionary IDs to pull (alias for --dictionaries)',\n ],\n ['--new-dictionaries-path [path]', 'Path to save the new dictionaries'],\n // Backward-compatibility for older tests/flags (camelCase)\n [\n '--newDictionariesPath [path]',\n '[alias] Path to save the new dictionaries',\n ],\n ],\n };\n\n // Add pull command to dictionaries program\n const dictionariesPullCmd = dictionariesProgram\n .command('pull')\n .description(pullOptions.description);\n\n applyOptions(dictionariesPullCmd, pullOptions.options);\n applyConfigOptions(dictionariesPullCmd);\n dictionariesPullCmd.action(async (options) => {\n const { pull } = await import('./pull');\n // Merge dictionary aliases\n const dictionaries = [\n ...(options.dictionaries ?? []),\n ...(options.dictionary ?? []),\n ];\n\n pull({\n ...options,\n dictionaries: dictionaries.length > 0 ? dictionaries : undefined,\n configOptions: extractConfigOptions(options),\n });\n });\n\n // Add pull command to root program as well\n const rootPullCmd = program\n .command('pull')\n .description(pullOptions.description);\n\n applyOptions(rootPullCmd, pullOptions.options);\n applyConfigOptions(rootPullCmd);\n rootPullCmd.action(async (options) => {\n const { pull } = await import('./pull');\n // Merge dictionary aliases\n const dictionaries = [\n ...(options.dictionaries ?? []),\n ...(options.dictionary ?? []),\n ];\n\n pull({\n ...options,\n dictionaries: dictionaries.length > 0 ? dictionaries : undefined,\n configOptions: extractConfigOptions(options),\n });\n });\n\n // Dictionary push command\n const pushOptions = {\n description:\n 'Push all dictionaries. Create or update the pushed dictionaries',\n options: [\n ['-d, --dictionaries [ids...]', 'List of dictionary IDs to push'],\n [\n '--dictionary [ids...]',\n 'List of dictionary IDs to push (alias for --dictionaries)',\n ],\n [\n '-r, --delete-locale-dictionary',\n 'Delete the local dictionaries after pushing',\n ],\n [\n '-k, --keep-locale-dictionary',\n 'Keep the local dictionaries after pushing',\n ],\n // Backward-compatibility for older tests/flags (camelCase)\n [\n '--deleteLocaleDictionary',\n '[alias] Delete the local dictionaries after pushing',\n ],\n [\n '--keepLocaleDictionary',\n '[alias] Keep the local dictionaries after pushing',\n ],\n [\n '--build [build]',\n 'Build the dictionaries before pushing to ensure the content is up to date. True will force the build, false will skip the build, undefined will allow using the cache of the build',\n ],\n ],\n };\n\n // Add push command to dictionaries program\n const dictionariesPushCmd = dictionariesProgram\n .command('push')\n .description(pushOptions.description);\n\n applyOptions(dictionariesPushCmd, pushOptions.options);\n applyConfigOptions(dictionariesPushCmd);\n applyGitOptions(dictionariesPushCmd);\n\n dictionariesPushCmd.action(async (options) => {\n const { push } = await import('./push/push');\n // Merge dictionary aliases\n const dictionaries = [\n ...(options.dictionaries || []),\n ...(options.dictionary || []),\n ];\n\n return push({\n ...options,\n dictionaries: dictionaries.length > 0 ? dictionaries : undefined,\n gitOptions: extractGitOptions(options),\n configOptions: extractConfigOptions(options),\n } as FillOptions);\n });\n\n // Add push command to root program as well\n const rootPushCmd = program\n .command('push')\n .description(pushOptions.description);\n\n applyOptions(rootPushCmd, pushOptions.options);\n applyConfigOptions(rootPushCmd);\n applyGitOptions(rootPushCmd);\n\n rootPushCmd.action(async (options) => {\n const { push } = await import('./push/push');\n // Merge dictionary aliases\n const dictionaries = [\n ...(options.dictionaries || []),\n ...(options.dictionary || []),\n ];\n\n return push({\n ...options,\n dictionaries: dictionaries.length > 0 ? dictionaries : undefined,\n gitOptions: extractGitOptions(options),\n configOptions: extractConfigOptions(options),\n } as FillOptions);\n });\n\n /**\n * CONFIGURATION\n */\n\n // Define the parent command\n const configurationProgram = program\n .command('configuration')\n .alias('config')\n .alias('conf')\n .description('Configuration operations');\n\n const configGetCmd = configurationProgram\n .command('get')\n .description('Get the configuration');\n\n applyConfigOptions(configGetCmd);\n configGetCmd.action(async (options) => {\n const { getConfig } = await import('./config');\n getConfig({\n ...options,\n configOptions: extractConfigOptions(options),\n });\n });\n\n // Define the `push config` subcommand and add it to the `push` command\n const configPushCmd = configurationProgram\n .command('push')\n .description('Push the configuration');\n\n applyConfigOptions(configPushCmd);\n configPushCmd.action(async (options) => {\n const { pushConfig } = await import('./pushConfig');\n pushConfig({\n ...options,\n configOptions: extractConfigOptions(options),\n });\n });\n\n /**\n * PROJECTS\n */\n\n const projectsProgram = program\n .command('projects')\n .alias('project')\n .description('List Intlayer projects');\n\n const projectsListCmd = projectsProgram\n .command('list')\n .description('List all Intlayer projects in the directory')\n .option('--base-dir [baseDir]', 'Base directory to search from')\n .option(\n '--git-root',\n 'Search from the git root directory instead of the base directory'\n )\n .option('--json', 'Output the results as JSON');\n\n projectsListCmd.action(async (options) => {\n const { listProjectsCommand } = await import('./listProjects');\n listProjectsCommand({\n baseDir: options.baseDir,\n gitRoot: options.gitRoot,\n json: options.json,\n });\n });\n\n // Add alias for projects list command at root level\n const rootProjectsListCmd = program\n .command('projects-list')\n .alias('pl')\n .description('List all Intlayer projects in the directory')\n .option('--base-dir [baseDir]', 'Base directory to search from')\n .option(\n '--git-root',\n 'Search from the git root directory instead of the base directory'\n )\n .option('--absolute', 'Output the results as absolute paths')\n .option('--json', 'Output the results as JSON');\n\n rootProjectsListCmd.action(async (options) => {\n const { listProjectsCommand } = await import('./listProjects');\n listProjectsCommand({\n baseDir: options.baseDir,\n gitRoot: options.gitRoot,\n json: options.json,\n absolute: options.absolute,\n });\n });\n\n /**\n * CONTENT DECLARATION\n */\n\n const contentProgram = program\n .command('content')\n .description('Content declaration operations');\n\n contentProgram\n .command('list')\n .description('List the content declaration files')\n .option('--json', 'Output the results as JSON')\n .option('--absolute', 'Output the results as absolute paths')\n .action(async (options) => {\n const { listContentDeclaration } = await import(\n './listContentDeclaration'\n );\n listContentDeclaration({\n json: options.json,\n absolute: options.absolute,\n });\n });\n\n // Add alias for content list command\n program\n .command('list')\n .description('List the content declaration files')\n .option('--json', 'Output the results as JSON')\n .option('--absolute', 'Output the results as absolute paths')\n .action(async (options) => {\n const { listContentDeclaration } = await import(\n './listContentDeclaration'\n );\n listContentDeclaration({\n json: options.json,\n absolute: options.absolute,\n });\n });\n\n const testProgram = contentProgram\n .command('test')\n .description('Test if there are missing translations')\n .option(\n '--build [build]',\n 'Build the dictionaries before testing to ensure the content is up to date. True will force the build, false will skip the build, undefined will allow using the cache of the build'\n );\n\n applyConfigOptions(testProgram);\n testProgram.action(async (options) => {\n const { testMissingTranslations } = await import('./test');\n testMissingTranslations({\n ...options,\n configOptions: extractConfigOptions(options),\n });\n });\n\n // Add alias for content test command\n const rootTestCmd = program\n .command('test')\n .description('Test if there are missing translations')\n .option(\n '--build [build]',\n 'Build the dictionaries before testing to ensure the content is up to date. True will force the build, false will skip the build, undefined will allow using the cache of the build'\n );\n\n applyConfigOptions(rootTestCmd);\n rootTestCmd.action(async (options) => {\n const { testMissingTranslations } = await import('./test');\n testMissingTranslations({\n ...options,\n configOptions: extractConfigOptions(options),\n });\n });\n\n const fillProgram = program\n .command('fill')\n .description('Fill the dictionaries')\n .option('-f, --file [files...]', 'List of Dictionary files to fill')\n .option('--source-locale [sourceLocale]', 'Source locale to translate from')\n .option(\n '--output-locales [outputLocales...]',\n 'Target locales to translate to'\n )\n .option(\n '--mode [mode]',\n 'Fill mode: complete, review. Complete will fill all missing content, review will fill missing content and review existing keys',\n 'complete'\n )\n .option('-k, --keys [keys...]', 'Filter dictionaries based on keys')\n .option(\n '--key [keys...]',\n 'Filter dictionaries based on keys (alias for --keys)'\n )\n .option(\n '--excluded-keys [excludedKeys...]',\n 'Filter out dictionaries based on keys'\n )\n .option(\n '--excluded-key [excludedKeys...]',\n 'Filter out dictionaries based on keys (alias for --excluded-keys)'\n )\n .option(\n '--path-filter [pathFilters...]',\n 'Filter dictionaries based on glob pattern'\n )\n .option(\n '--build [build]',\n 'Build the dictionaries before filling to ensure the content is up to date. True will force the build, false will skip the build, undefined will allow using the cache of the build'\n )\n .option(\n '--skip-metadata',\n 'Skip filling missing metadata (description, title, tags) for dictionaries'\n );\n\n applyConfigOptions(fillProgram);\n applyAIOptions(fillProgram);\n applyGitOptions(fillProgram);\n\n fillProgram.action(async (options) => {\n const { fill } = await import('./fill/fill');\n // Merge key aliases\n const keys = [...(options.keys ?? []), ...(options.key ?? [])];\n const excludedKeys = [\n ...(options.excludedKeys ?? []),\n ...(options.excludedKey ?? []),\n ];\n // Merge dictionary aliases\n const dictionaries = [\n ...(options.dictionaries ?? []),\n ...(options.dictionary ?? []),\n ];\n\n return fill({\n ...options,\n keys: keys.length > 0 ? keys : undefined,\n excludedKeys: excludedKeys.length > 0 ? excludedKeys : undefined,\n dictionaries: dictionaries.length > 0 ? dictionaries : undefined,\n aiOptions: extractAiOptions(options),\n gitOptions: extractGitOptions(options),\n configOptions: extractConfigOptions(options),\n } as FillOptions);\n });\n\n /**\n * DOCS\n */\n\n const docParams = [\n ['--doc-pattern [docPattern...]', 'Documentation pattern'],\n [\n '--excluded-glob-pattern [excludedGlobPattern...]',\n 'Excluded glob pattern',\n ],\n [\n '--nb-simultaneous-file-processed [nbSimultaneousFileProcessed]',\n 'Number of simultaneous file processed',\n ],\n ['--locales [locales...]', 'Locales'],\n ['--base-locale [baseLocale]', 'Base locale'],\n [\n '--custom-instructions [customInstructions]',\n 'Custom instructions added to the prompt. Usefull to apply specific rules regarding formatting, urls translation, etc.',\n ],\n [\n '--skip-if-modified-before [skipIfModifiedBefore]',\n 'Skip the file if it has been modified before the given time. Can be an absolute time as \"2025-12-05\" (string or Date) or a relative time in ms `1 * 60 * 60 * 1000` (1 hour). This option check update time of the file using the `fs.stat` method. So it could be impacted by Git or other tools that modify the file.',\n ],\n [\n '--skip-if-modified-after [skipIfModifiedAfter]',\n 'Skip the file if it has been modified within the given time. Can be an absolute time as \"2025-12-05\" (string or Date) or a relative time in ms `1 * 60 * 60 * 1000` (1 hour). This option check update time of the file using the `fs.stat` method. So it could be impacted by Git or other tools that modify the file.',\n ],\n ['--skip-if-exists', 'Skip the file if it already exists'],\n ];\n\n const docProgram = program\n .command('doc')\n .description('Documentation operations');\n\n const translateProgram = docProgram\n .command('translate')\n .description('Translate the documentation');\n\n applyConfigOptions(translateProgram);\n applyAIOptions(translateProgram);\n applyGitOptions(translateProgram);\n applyOptions(translateProgram, docParams);\n\n translateProgram.action(async (options) => {\n const { translateDoc } = await import('./translateDoc/translateDoc');\n return translateDoc({\n docPattern: options.docPattern,\n excludedGlobPattern: options.excludedGlobPattern,\n locales: options.locales,\n baseLocale: options.baseLocale,\n aiOptions: extractAiOptions(options),\n gitOptions: extractGitOptions(options),\n nbSimultaneousFileProcessed: options.nbSimultaneousFileProcessed,\n configOptions: extractConfigOptions(options),\n customInstructions: options.customInstructions,\n skipIfModifiedBefore: options.skipIfModifiedBefore,\n skipIfModifiedAfter: options.skipIfModifiedAfter,\n skipIfExists: options.skipIfExists,\n });\n });\n\n const reviewProgram = docProgram\n .command('review')\n .description('Review the documentation')\n .option(\n '--log',\n 'Log-only mode. Do not translate with AI; instead log the blocks that need attention (with line numbers and content) for the base and target locales, to help another agent generate the translations.'\n );\n\n applyConfigOptions(reviewProgram);\n applyAIOptions(reviewProgram);\n applyGitOptions(reviewProgram);\n applyOptions(reviewProgram, docParams);\n\n reviewProgram.action(async (options) => {\n const { reviewDoc } = await import('./reviewDoc/reviewDoc');\n return reviewDoc({\n docPattern: options.docPattern,\n excludedGlobPattern: options.excludedGlobPattern,\n locales: options.locales,\n baseLocale: options.baseLocale,\n aiOptions: extractAiOptions(options),\n gitOptions: extractGitOptions(options),\n nbSimultaneousFileProcessed: options.nbSimultaneousFileProcessed,\n configOptions: extractConfigOptions(options),\n customInstructions: options.customInstructions,\n skipIfModifiedBefore: options.skipIfModifiedBefore,\n skipIfModifiedAfter: options.skipIfModifiedAfter,\n skipIfExists: options.skipIfExists,\n log: options.log,\n });\n });\n\n const searchProgram = docProgram\n .command('search')\n .description('Search the documentation')\n .argument('<query>', 'Search query')\n .option('--limit [limit]', 'Limit the number of results', '10');\n\n applyConfigOptions(searchProgram);\n\n searchProgram.action(async (query, options) => {\n const { searchDoc } = await import('./searchDoc');\n return searchDoc({\n query,\n limit: options.limit ? parseInt(options.limit, 10) : 10,\n configOptions: extractConfigOptions(options),\n });\n });\n\n /**\n * LIVE SYNC\n */\n\n const liveOptions = [\n ['--with [with...]', 'Start command in parallel with the live sync'],\n ];\n\n const liveCmd = program\n .command('live')\n .description(\n 'Live sync - Watch for changes made on the CMS and update the application content accordingly'\n );\n\n applyOptions(liveCmd, liveOptions);\n applyConfigOptions(liveCmd);\n\n liveCmd.action(async (options) => {\n const { liveSync } = await import('./liveSync');\n return liveSync({\n ...options,\n configOptions: extractConfigOptions(options),\n });\n });\n\n /**\n * EDITOR\n */\n\n const editorProgram = program\n .command('editor')\n .description('Visual editor operations');\n\n const editorStartCmd = editorProgram\n .command('start')\n .description('Start the Intlayer visual editor');\n\n applyConfigOptions(editorStartCmd);\n\n editorStartCmd.action(async (options) => {\n const { startEditor } = await import('./editor');\n startEditor({\n env: options.env,\n envFile: options.envFile,\n });\n });\n\n /**\n * EXTRACT\n */\n const extractProgram = program\n .command('extract')\n .alias('ext')\n .description(\n 'Extract strings from components to be placed in a .content file close to the component'\n );\n\n applyConfigOptions(extractProgram);\n\n extractProgram\n .option('-f, --file [files...]', 'List of files to extract')\n .option('--code-only', 'Only extract the component code', false)\n .option('--declaration-only', 'Only generate content declaration', false)\n .action(async (options) => {\n const { extract } = await import('./extract');\n extract({\n files: options.file,\n configOptions: extractConfigOptions(options),\n codeOnly: options.codeOnly,\n declarationOnly: options.declarationOnly,\n });\n });\n\n /**\n * STANDALONE\n */\n const bundleCmd = program\n .command('standalone')\n .description('Create a standalone bundle of the application content')\n .option(\n '-o, --outfile [outfile]',\n 'Output file for the bundle',\n 'intlayer-bundle.js'\n )\n .option('--packages [packages...]', 'List of packages to bundle')\n .option('--version [version]', 'Version of the packages to bundle')\n .option('--minify', 'Minify the output')\n .option('--platform [platform]', 'Target platform', 'browser')\n .option('--format [format]', 'Output format', 'esm')\n .action(async (options) => {\n const { bundle } = await import('./bundle');\n bundle({\n outfile: options.outfile,\n bundlePackages: options.packages,\n version: options.version,\n minify: options.minify,\n platform: options.platform,\n format: options.format,\n configOptions: extractConfigOptions(options),\n });\n });\n\n applyConfigOptions(bundleCmd);\n\n /**\n * SCAN\n */\n const scanCmd = program\n .command('scan')\n .description(\n 'Scan a website to measure its page size and audit its i18n / SEO health'\n )\n .argument('<url>', 'URL of the website to scan')\n .option('--no-deep', 'Disable the deeper puppeteer-based render scan')\n .option('--json', 'Output the results as JSON');\n\n applyConfigOptions(scanCmd);\n\n scanCmd.action(async (url, options) => {\n const { scan } = await import('./scan');\n return scan(url, {\n deep: options.deep,\n json: options.json,\n configOptions: extractConfigOptions(options),\n });\n });\n\n program.parse(process.argv);\n\n /**\n * CI / AUTOMATION\n *\n * Used to iterate over all projects in a monorepo, and help to parse secrets\n */\n program\n .command('ci')\n .description(\n 'Run Intlayer commands with auto-injected credentials from INTLAYER_PROJECT_CREDENTIALS. Detects current project or iterates over all projects.'\n )\n .argument(\n '<command...>',\n 'The intlayer command to execute (e.g., \"fill\", \"push\")'\n )\n .allowUnknownOption() // Allows passing flags like --verbose to the subcommand\n .action(async (args) => {\n const { runCI } = await import('./ci');\n runCI(args);\n });\n\n return program;\n};\n"],"mappings":";;;;;;;;;AAmBA,MAAM,aAAa,yDAA2B;AAE9C,MAAa,UAAU,6GACsB,CAAC,IAC1C;AAEJ,MAAM,cAAcA,wDAAqB,OAAO;AAOhD,MAAM,uBAAuB;CAC3B,CAAC,wBAAwB,kBAAkB;CAC3C,CAAC,mBAAmB,aAAa;CACjC,CAAC,wBAAwB,gBAAgB;CACzC,CAAC,wBAAwB,UAAU;CACnC,GAAG,CATH,CAAC,aAAa,qCAAqC,GACnD,CAAC,qBAAqB,QAAQ,CAQlB;AACd;AAEA,MAAM,YAAY;CAChB,CAAC,yBAAyB,UAAU;CACpC,CAAC,+BAA+B,aAAa;CAC7C,CAAC,mBAAmB,OAAO;CAC3B,CAAC,sBAAsB,kBAAkB;CACzC,CAAC,4BAA4B,eAAe;CAC5C,CAAC,8CAA8C,qBAAqB;CACpE,CAAC,4CAA4C,oBAAoB;AACnE;AAEA,MAAM,aAAa;CACjB,CAAC,wBAAwB,iDAAiD;CAC1E,CAAC,iCAAiC,mBAAmB;CACrD,CAAC,uCAAuC,sBAAsB;CAC9D,CAAC,+BAA+B,aAAa;CAC7C,CAAC,yBAAyB,UAAU;CACpC,CAAC,2BAA2B,WAAW;AACzC;AAEA,MAAM,0BAA0B,SAAiB,SAC/C,KAAK,QAAQ,QAAQ,QAAQ,SAAiC,MAAS;;;;AAKzE,MAAM,gBAAgB,SAAkB,YAAwB;CAC9D,QAAQ,SAAS,CAAC,MAAM,iBAAiB;EACvC,QAAQ,OAAO,MAAM,WAAW;CAClC,CAAC;CACD,OAAO;AACT;AAEA,MAAM,mBAAkD,QACtD,OAAO,YACL,OAAO,QAAQ,GAAG,C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K5B,MAAM,UAAU,QACb,QAAQ,MAAM,CAAC,CACf,YACC,yEACF,CAAC,CACA,SAAS,SAAS,4BAA4B,CAAC,CAC/C,OAAO,aAAa,gDAAgD,CAAC,CACrE,OAAO,UAAU,4BAA4B;CAEhD,mBAAmB,OAAO;CAE1B,QAAQ,OAAO,OAAO,KAAK,YAAY;EACrC,MAAM,EAAE,SAAS,2CAAM;EACvB,OAAO,KAAK,KAAK;GACf,MAAM,QAAQ;GACd,MAAM,QAAQ;GACd,eAAe,qBAAqB,OAAO;EAC7C,CAAC;CACH,CAAC;CAED,QAAQ,MAAM,QAAQ,IAAI;;;;;;CAO1B,QACG,QAAQ,IAAI,CAAC,CACb,YACC,gJACF,CAAC,CACA,SACC,gBACA,4DACF,CAAC,CACA,mBAAmB,CAAC,CACpB,OAAO,OAAO,SAAS;EACtB,MAAM,EAAE,UAAU,2CAAM;EACxB,MAAM,IAAI;CACZ,CAAC;CAEH,OAAO;AACT"}
@@ -1,5 +1,4 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_runtime = require('./_virtual/_rolldown/runtime.cjs');
3
2
  let _intlayer_config_logger = require("@intlayer/config/logger");
4
3
  let _intlayer_config_node = require("@intlayer/config/node");
5
4
  let _intlayer_engine_cli = require("@intlayer/engine/cli");
@@ -1 +1 @@
1
- {"version":3,"file":"config.cjs","names":[],"sources":["../../src/config.ts"],"sourcesContent":["import { colorizeObject, getAppLogger } from '@intlayer/config/logger';\nimport {\n type GetConfigurationOptions,\n getConfiguration,\n} from '@intlayer/config/node';\nimport { logConfigDetails } from '@intlayer/engine/cli';\n\ntype ConfigOptions = {\n configOptions?: GetConfigurationOptions;\n};\n\nconst sanitize = (value: unknown): unknown => {\n if (typeof value === 'function' || typeof value === 'undefined') return null;\n if (Array.isArray(value)) return value.map(sanitize);\n if (value !== null && typeof value === 'object') {\n return Object.fromEntries(\n Object.entries(value as Record<string, unknown>)\n .filter(([, v]) => typeof v !== 'function' && typeof v !== 'undefined')\n .map(([k, v]) => [k, sanitize(v)])\n );\n }\n return value;\n};\n\nexport const getConfig = (options?: ConfigOptions) => {\n const config = getConfiguration(options?.configOptions);\n logConfigDetails(options?.configOptions);\n\n const appLogger = getAppLogger(config);\n\n appLogger(colorizeObject(sanitize(config) as typeof config));\n};\n"],"mappings":";;;;;;;AAWA,MAAM,YAAY,UAA4B;AAC5C,KAAI,OAAO,UAAU,cAAc,OAAO,UAAU,YAAa,QAAO;AACxE,KAAI,MAAM,QAAQ,MAAM,CAAE,QAAO,MAAM,IAAI,SAAS;AACpD,KAAI,UAAU,QAAQ,OAAO,UAAU,SACrC,QAAO,OAAO,YACZ,OAAO,QAAQ,MAAiC,CAC7C,QAAQ,GAAG,OAAO,OAAO,MAAM,cAAc,OAAO,MAAM,YAAY,CACtE,KAAK,CAAC,GAAG,OAAO,CAAC,GAAG,SAAS,EAAE,CAAC,CAAC,CACrC;AAEH,QAAO;;AAGT,MAAa,aAAa,YAA4B;CACpD,MAAM,qDAA0B,SAAS,cAAc;AACvD,4CAAiB,SAAS,cAAc;AAIxC,2CAF+B,OAEtB,6CAAgB,SAAS,OAAO,CAAkB,CAAC"}
1
+ {"version":3,"file":"config.cjs","names":[],"sources":["../../src/config.ts"],"sourcesContent":["import { colorizeObject, getAppLogger } from '@intlayer/config/logger';\nimport {\n type GetConfigurationOptions,\n getConfiguration,\n} from '@intlayer/config/node';\nimport { logConfigDetails } from '@intlayer/engine/cli';\n\ntype ConfigOptions = {\n configOptions?: GetConfigurationOptions;\n};\n\nconst sanitize = (value: unknown): unknown => {\n if (typeof value === 'function' || typeof value === 'undefined') return null;\n if (Array.isArray(value)) return value.map(sanitize);\n if (value !== null && typeof value === 'object') {\n return Object.fromEntries(\n Object.entries(value as Record<string, unknown>)\n .filter(([, v]) => typeof v !== 'function' && typeof v !== 'undefined')\n .map(([k, v]) => [k, sanitize(v)])\n );\n }\n return value;\n};\n\nexport const getConfig = (options?: ConfigOptions) => {\n const config = getConfiguration(options?.configOptions);\n logConfigDetails(options?.configOptions);\n\n const appLogger = getAppLogger(config);\n\n appLogger(colorizeObject(sanitize(config) as typeof config));\n};\n"],"mappings":";;;;;;AAWA,MAAM,YAAY,UAA4B;CAC5C,IAAI,OAAO,UAAU,cAAc,OAAO,UAAU,aAAa,OAAO;CACxE,IAAI,MAAM,QAAQ,KAAK,GAAG,OAAO,MAAM,IAAI,QAAQ;CACnD,IAAI,UAAU,QAAQ,OAAO,UAAU,UACrC,OAAO,OAAO,YACZ,OAAO,QAAQ,KAAgC,CAAC,CAC7C,QAAQ,GAAG,OAAO,OAAO,MAAM,cAAc,OAAO,MAAM,WAAW,CAAC,CACtE,KAAK,CAAC,GAAG,OAAO,CAAC,GAAG,SAAS,CAAC,CAAC,CAAC,CACrC;CAEF,OAAO;AACT;AAEA,MAAa,aAAa,YAA4B;CACpD,MAAM,qDAA0B,SAAS,aAAa;CACtD,2CAAiB,SAAS,aAAa;CAIvC,0CAF+B,MAEvB,CAAC,6CAAgB,SAAS,MAAM,CAAkB,CAAC;AAC7D"}