@intlayer/cli 8.1.2 → 8.1.3-canary.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (301) hide show
  1. package/dist/cjs/IntlayerEventListener.cjs +1 -186
  2. package/dist/cjs/IntlayerEventListener.cjs.map +1 -1
  3. package/dist/cjs/_virtual/_rolldown/runtime.cjs +1 -29
  4. package/dist/cjs/_virtual/_utils_asset.cjs +2 -98
  5. package/dist/cjs/auth/login.cjs +2 -85
  6. package/dist/cjs/auth/login.cjs.map +1 -1
  7. package/dist/cjs/build.cjs +1 -27
  8. package/dist/cjs/build.cjs.map +1 -1
  9. package/dist/cjs/ci.cjs +1 -73
  10. package/dist/cjs/ci.cjs.map +1 -1
  11. package/dist/cjs/cli.cjs +1 -476
  12. package/dist/cjs/cli.cjs.map +1 -1
  13. package/dist/cjs/config.cjs +1 -12
  14. package/dist/cjs/config.cjs.map +1 -1
  15. package/dist/cjs/editor.cjs +1 -50
  16. package/dist/cjs/editor.cjs.map +1 -1
  17. package/dist/cjs/extract.cjs +1 -96
  18. package/dist/cjs/extract.cjs.map +1 -1
  19. package/dist/cjs/fill/deepMergeContent.cjs +1 -27
  20. package/dist/cjs/fill/deepMergeContent.cjs.map +1 -1
  21. package/dist/cjs/fill/fill.cjs +1 -78
  22. package/dist/cjs/fill/fill.cjs.map +1 -1
  23. package/dist/cjs/fill/formatAutoFilledFilePath.cjs +1 -29
  24. package/dist/cjs/fill/formatAutoFilledFilePath.cjs.map +1 -1
  25. package/dist/cjs/fill/formatFillData.cjs +1 -50
  26. package/dist/cjs/fill/formatFillData.cjs.map +1 -1
  27. package/dist/cjs/fill/getAvailableLocalesInDictionary.cjs +1 -26
  28. package/dist/cjs/fill/getAvailableLocalesInDictionary.cjs.map +1 -1
  29. package/dist/cjs/fill/getFilterMissingContentPerLocale.cjs +1 -50
  30. package/dist/cjs/fill/getFilterMissingContentPerLocale.cjs.map +1 -1
  31. package/dist/cjs/fill/index.cjs +1 -6
  32. package/dist/cjs/fill/listTranslationsTasks.cjs +1 -70
  33. package/dist/cjs/fill/listTranslationsTasks.cjs.map +1 -1
  34. package/dist/cjs/fill/mergeChunks.cjs +1 -28
  35. package/dist/cjs/fill/mergeChunks.cjs.map +1 -1
  36. package/dist/cjs/fill/translateDictionary.cjs +1 -205
  37. package/dist/cjs/fill/translateDictionary.cjs.map +1 -1
  38. package/dist/cjs/fill/writeFill.cjs +1 -54
  39. package/dist/cjs/fill/writeFill.cjs.map +1 -1
  40. package/dist/cjs/getTargetDictionary.cjs +1 -36
  41. package/dist/cjs/getTargetDictionary.cjs.map +1 -1
  42. package/dist/cjs/index.cjs +1 -39
  43. package/dist/cjs/init.cjs +1 -322
  44. package/dist/cjs/init.cjs.map +1 -1
  45. package/dist/cjs/listContentDeclaration.cjs +1 -41
  46. package/dist/cjs/listContentDeclaration.cjs.map +1 -1
  47. package/dist/cjs/listProjects.cjs +1 -28
  48. package/dist/cjs/listProjects.cjs.map +1 -1
  49. package/dist/cjs/liveSync.cjs +8 -151
  50. package/dist/cjs/liveSync.cjs.map +1 -1
  51. package/dist/cjs/pull.cjs +1 -146
  52. package/dist/cjs/pull.cjs.map +1 -1
  53. package/dist/cjs/push/pullLog.cjs +3 -102
  54. package/dist/cjs/push/pullLog.cjs.map +1 -1
  55. package/dist/cjs/push/push.cjs +1 -206
  56. package/dist/cjs/push/push.cjs.map +1 -1
  57. package/dist/cjs/pushConfig.cjs +1 -19
  58. package/dist/cjs/pushConfig.cjs.map +1 -1
  59. package/dist/cjs/pushLog.cjs +3 -84
  60. package/dist/cjs/pushLog.cjs.map +1 -1
  61. package/dist/cjs/reviewDoc/reviewDoc.cjs +1 -68
  62. package/dist/cjs/reviewDoc/reviewDoc.cjs.map +1 -1
  63. package/dist/cjs/reviewDoc/reviewDocBlockAware.cjs +1 -94
  64. package/dist/cjs/reviewDoc/reviewDocBlockAware.cjs.map +1 -1
  65. package/dist/cjs/searchDoc.cjs +1 -38
  66. package/dist/cjs/searchDoc.cjs.map +1 -1
  67. package/dist/cjs/test/index.cjs +1 -7
  68. package/dist/cjs/test/listMissingTranslations.cjs +1 -49
  69. package/dist/cjs/test/listMissingTranslations.cjs.map +1 -1
  70. package/dist/cjs/test/test.cjs +1 -53
  71. package/dist/cjs/test/test.cjs.map +1 -1
  72. package/dist/cjs/translateDoc/index.cjs +1 -9
  73. package/dist/cjs/translateDoc/translateDoc.cjs +1 -74
  74. package/dist/cjs/translateDoc/translateDoc.cjs.map +1 -1
  75. package/dist/cjs/translateDoc/translateFile.cjs +2 -103
  76. package/dist/cjs/translateDoc/translateFile.cjs.map +1 -1
  77. package/dist/cjs/translateDoc/validation.cjs +5 -49
  78. package/dist/cjs/translateDoc/validation.cjs.map +1 -1
  79. package/dist/cjs/translation-alignment/alignBlocks.cjs +1 -67
  80. package/dist/cjs/translation-alignment/alignBlocks.cjs.map +1 -1
  81. package/dist/cjs/translation-alignment/computeSimilarity.cjs +1 -25
  82. package/dist/cjs/translation-alignment/computeSimilarity.cjs.map +1 -1
  83. package/dist/cjs/translation-alignment/fingerprintBlock.cjs +1 -23
  84. package/dist/cjs/translation-alignment/fingerprintBlock.cjs.map +1 -1
  85. package/dist/cjs/translation-alignment/index.cjs +1 -22
  86. package/dist/cjs/translation-alignment/mapChangedLinesToBlocks.cjs +1 -18
  87. package/dist/cjs/translation-alignment/mapChangedLinesToBlocks.cjs.map +1 -1
  88. package/dist/cjs/translation-alignment/normalizeBlock.cjs +1 -22
  89. package/dist/cjs/translation-alignment/normalizeBlock.cjs.map +1 -1
  90. package/dist/cjs/translation-alignment/pipeline.cjs +1 -37
  91. package/dist/cjs/translation-alignment/pipeline.cjs.map +1 -1
  92. package/dist/cjs/translation-alignment/planActions.cjs +1 -46
  93. package/dist/cjs/translation-alignment/planActions.cjs.map +1 -1
  94. package/dist/cjs/translation-alignment/rebuildDocument.cjs +2 -49
  95. package/dist/cjs/translation-alignment/rebuildDocument.cjs.map +1 -1
  96. package/dist/cjs/translation-alignment/segmentDocument.cjs +5 -66
  97. package/dist/cjs/translation-alignment/segmentDocument.cjs.map +1 -1
  98. package/dist/cjs/utils/calculateChunks.cjs +2 -89
  99. package/dist/cjs/utils/calculateChunks.cjs.map +1 -1
  100. package/dist/cjs/utils/checkAccess.cjs +1 -81
  101. package/dist/cjs/utils/checkAccess.cjs.map +1 -1
  102. package/dist/cjs/utils/checkConfigConsistency.cjs +1 -16
  103. package/dist/cjs/utils/checkConfigConsistency.cjs.map +1 -1
  104. package/dist/cjs/utils/checkFileModifiedRange.cjs +1 -81
  105. package/dist/cjs/utils/checkFileModifiedRange.cjs.map +1 -1
  106. package/dist/cjs/utils/checkLastUpdateTime.cjs +1 -19
  107. package/dist/cjs/utils/checkLastUpdateTime.cjs.map +1 -1
  108. package/dist/cjs/utils/chunkInference.cjs +1 -45
  109. package/dist/cjs/utils/chunkInference.cjs.map +1 -1
  110. package/dist/cjs/utils/fixChunkStartEndChars.cjs +3 -27
  111. package/dist/cjs/utils/fixChunkStartEndChars.cjs.map +1 -1
  112. package/dist/cjs/utils/formatTimeDiff.cjs +1 -20
  113. package/dist/cjs/utils/formatTimeDiff.cjs.map +1 -1
  114. package/dist/cjs/utils/getIsFileUpdatedRecently.cjs +1 -16
  115. package/dist/cjs/utils/getIsFileUpdatedRecently.cjs.map +1 -1
  116. package/dist/cjs/utils/getOutputFilePath.cjs +1 -74
  117. package/dist/cjs/utils/getOutputFilePath.cjs.map +1 -1
  118. package/dist/cjs/utils/getParentPackageJSON.cjs +1 -20
  119. package/dist/cjs/utils/getParentPackageJSON.cjs.map +1 -1
  120. package/dist/cjs/utils/listSpecialChars.cjs +2 -54
  121. package/dist/cjs/utils/listSpecialChars.cjs.map +1 -1
  122. package/dist/cjs/utils/mapChunksBetweenFiles.cjs +1 -102
  123. package/dist/cjs/utils/mapChunksBetweenFiles.cjs.map +1 -1
  124. package/dist/cjs/utils/openBrowser.cjs +1 -19
  125. package/dist/cjs/utils/openBrowser.cjs.map +1 -1
  126. package/dist/cjs/utils/reorderParagraphs.cjs +3 -91
  127. package/dist/cjs/utils/reorderParagraphs.cjs.map +1 -1
  128. package/dist/cjs/utils/setupAI.cjs +1 -64
  129. package/dist/cjs/utils/setupAI.cjs.map +1 -1
  130. package/dist/cjs/watch.cjs +1 -43
  131. package/dist/cjs/watch.cjs.map +1 -1
  132. package/dist/esm/IntlayerEventListener.mjs +1 -183
  133. package/dist/esm/IntlayerEventListener.mjs.map +1 -1
  134. package/dist/esm/_virtual/_rolldown/runtime.mjs +1 -8
  135. package/dist/esm/_virtual/_utils_asset.mjs +2 -97
  136. package/dist/esm/auth/login.mjs +2 -82
  137. package/dist/esm/auth/login.mjs.map +1 -1
  138. package/dist/esm/build.mjs +1 -25
  139. package/dist/esm/build.mjs.map +1 -1
  140. package/dist/esm/ci.mjs +1 -71
  141. package/dist/esm/ci.mjs.map +1 -1
  142. package/dist/esm/cli.mjs +1 -473
  143. package/dist/esm/cli.mjs.map +1 -1
  144. package/dist/esm/config.mjs +1 -10
  145. package/dist/esm/config.mjs.map +1 -1
  146. package/dist/esm/editor.mjs +1 -49
  147. package/dist/esm/editor.mjs.map +1 -1
  148. package/dist/esm/extract.mjs +1 -93
  149. package/dist/esm/extract.mjs.map +1 -1
  150. package/dist/esm/fill/deepMergeContent.mjs +1 -25
  151. package/dist/esm/fill/deepMergeContent.mjs.map +1 -1
  152. package/dist/esm/fill/fill.mjs +1 -76
  153. package/dist/esm/fill/fill.mjs.map +1 -1
  154. package/dist/esm/fill/formatAutoFilledFilePath.mjs +1 -27
  155. package/dist/esm/fill/formatAutoFilledFilePath.mjs.map +1 -1
  156. package/dist/esm/fill/formatFillData.mjs +1 -49
  157. package/dist/esm/fill/formatFillData.mjs.map +1 -1
  158. package/dist/esm/fill/getAvailableLocalesInDictionary.mjs +1 -24
  159. package/dist/esm/fill/getAvailableLocalesInDictionary.mjs.map +1 -1
  160. package/dist/esm/fill/getFilterMissingContentPerLocale.mjs +1 -48
  161. package/dist/esm/fill/getFilterMissingContentPerLocale.mjs.map +1 -1
  162. package/dist/esm/fill/index.mjs +1 -4
  163. package/dist/esm/fill/listTranslationsTasks.mjs +1 -68
  164. package/dist/esm/fill/listTranslationsTasks.mjs.map +1 -1
  165. package/dist/esm/fill/mergeChunks.mjs +1 -26
  166. package/dist/esm/fill/mergeChunks.mjs.map +1 -1
  167. package/dist/esm/fill/translateDictionary.mjs +1 -203
  168. package/dist/esm/fill/translateDictionary.mjs.map +1 -1
  169. package/dist/esm/fill/writeFill.mjs +1 -52
  170. package/dist/esm/fill/writeFill.mjs.map +1 -1
  171. package/dist/esm/getTargetDictionary.mjs +1 -33
  172. package/dist/esm/getTargetDictionary.mjs.map +1 -1
  173. package/dist/esm/index.mjs +1 -18
  174. package/dist/esm/init.mjs +1 -317
  175. package/dist/esm/init.mjs.map +1 -1
  176. package/dist/esm/listContentDeclaration.mjs +1 -38
  177. package/dist/esm/listContentDeclaration.mjs.map +1 -1
  178. package/dist/esm/listProjects.mjs +1 -26
  179. package/dist/esm/listProjects.mjs.map +1 -1
  180. package/dist/esm/liveSync.mjs +8 -148
  181. package/dist/esm/liveSync.mjs.map +1 -1
  182. package/dist/esm/pull.mjs +1 -144
  183. package/dist/esm/pull.mjs.map +1 -1
  184. package/dist/esm/push/pullLog.mjs +3 -100
  185. package/dist/esm/push/pullLog.mjs.map +1 -1
  186. package/dist/esm/push/push.mjs +1 -203
  187. package/dist/esm/push/push.mjs.map +1 -1
  188. package/dist/esm/pushConfig.mjs +1 -17
  189. package/dist/esm/pushConfig.mjs.map +1 -1
  190. package/dist/esm/pushLog.mjs +3 -82
  191. package/dist/esm/pushLog.mjs.map +1 -1
  192. package/dist/esm/reviewDoc/reviewDoc.mjs +1 -65
  193. package/dist/esm/reviewDoc/reviewDoc.mjs.map +1 -1
  194. package/dist/esm/reviewDoc/reviewDocBlockAware.mjs +1 -92
  195. package/dist/esm/reviewDoc/reviewDocBlockAware.mjs.map +1 -1
  196. package/dist/esm/searchDoc.mjs +1 -36
  197. package/dist/esm/searchDoc.mjs.map +1 -1
  198. package/dist/esm/test/index.mjs +1 -4
  199. package/dist/esm/test/listMissingTranslations.mjs +1 -46
  200. package/dist/esm/test/listMissingTranslations.mjs.map +1 -1
  201. package/dist/esm/test/test.mjs +1 -51
  202. package/dist/esm/test/test.mjs.map +1 -1
  203. package/dist/esm/translateDoc/index.mjs +1 -5
  204. package/dist/esm/translateDoc/translateDoc.mjs +1 -71
  205. package/dist/esm/translateDoc/translateDoc.mjs.map +1 -1
  206. package/dist/esm/translateDoc/translateFile.mjs +2 -101
  207. package/dist/esm/translateDoc/translateFile.mjs.map +1 -1
  208. package/dist/esm/translateDoc/validation.mjs +5 -46
  209. package/dist/esm/translateDoc/validation.mjs.map +1 -1
  210. package/dist/esm/translation-alignment/alignBlocks.mjs +1 -66
  211. package/dist/esm/translation-alignment/alignBlocks.mjs.map +1 -1
  212. package/dist/esm/translation-alignment/computeSimilarity.mjs +1 -22
  213. package/dist/esm/translation-alignment/computeSimilarity.mjs.map +1 -1
  214. package/dist/esm/translation-alignment/fingerprintBlock.mjs +1 -20
  215. package/dist/esm/translation-alignment/fingerprintBlock.mjs.map +1 -1
  216. package/dist/esm/translation-alignment/index.mjs +1 -11
  217. package/dist/esm/translation-alignment/mapChangedLinesToBlocks.mjs +1 -16
  218. package/dist/esm/translation-alignment/mapChangedLinesToBlocks.mjs.map +1 -1
  219. package/dist/esm/translation-alignment/normalizeBlock.mjs +1 -20
  220. package/dist/esm/translation-alignment/normalizeBlock.mjs.map +1 -1
  221. package/dist/esm/translation-alignment/pipeline.mjs +1 -35
  222. package/dist/esm/translation-alignment/pipeline.mjs.map +1 -1
  223. package/dist/esm/translation-alignment/planActions.mjs +1 -44
  224. package/dist/esm/translation-alignment/planActions.mjs.map +1 -1
  225. package/dist/esm/translation-alignment/rebuildDocument.mjs +2 -46
  226. package/dist/esm/translation-alignment/rebuildDocument.mjs.map +1 -1
  227. package/dist/esm/translation-alignment/segmentDocument.mjs +5 -64
  228. package/dist/esm/translation-alignment/segmentDocument.mjs.map +1 -1
  229. package/dist/esm/utils/calculateChunks.mjs +2 -87
  230. package/dist/esm/utils/calculateChunks.mjs.map +1 -1
  231. package/dist/esm/utils/checkAccess.mjs +1 -78
  232. package/dist/esm/utils/checkAccess.mjs.map +1 -1
  233. package/dist/esm/utils/checkConfigConsistency.mjs +1 -14
  234. package/dist/esm/utils/checkConfigConsistency.mjs.map +1 -1
  235. package/dist/esm/utils/checkFileModifiedRange.mjs +1 -80
  236. package/dist/esm/utils/checkFileModifiedRange.mjs.map +1 -1
  237. package/dist/esm/utils/checkLastUpdateTime.mjs +1 -17
  238. package/dist/esm/utils/checkLastUpdateTime.mjs.map +1 -1
  239. package/dist/esm/utils/chunkInference.mjs +1 -43
  240. package/dist/esm/utils/chunkInference.mjs.map +1 -1
  241. package/dist/esm/utils/fixChunkStartEndChars.mjs +3 -25
  242. package/dist/esm/utils/fixChunkStartEndChars.mjs.map +1 -1
  243. package/dist/esm/utils/formatTimeDiff.mjs +1 -18
  244. package/dist/esm/utils/formatTimeDiff.mjs.map +1 -1
  245. package/dist/esm/utils/getIsFileUpdatedRecently.mjs +1 -14
  246. package/dist/esm/utils/getIsFileUpdatedRecently.mjs.map +1 -1
  247. package/dist/esm/utils/getOutputFilePath.mjs +1 -72
  248. package/dist/esm/utils/getOutputFilePath.mjs.map +1 -1
  249. package/dist/esm/utils/getParentPackageJSON.mjs +1 -18
  250. package/dist/esm/utils/getParentPackageJSON.mjs.map +1 -1
  251. package/dist/esm/utils/listSpecialChars.mjs +2 -52
  252. package/dist/esm/utils/listSpecialChars.mjs.map +1 -1
  253. package/dist/esm/utils/mapChunksBetweenFiles.mjs +1 -100
  254. package/dist/esm/utils/mapChunksBetweenFiles.mjs.map +1 -1
  255. package/dist/esm/utils/openBrowser.mjs +1 -17
  256. package/dist/esm/utils/openBrowser.mjs.map +1 -1
  257. package/dist/esm/utils/reorderParagraphs.mjs +3 -90
  258. package/dist/esm/utils/reorderParagraphs.mjs.map +1 -1
  259. package/dist/esm/utils/setupAI.mjs +1 -62
  260. package/dist/esm/utils/setupAI.mjs.map +1 -1
  261. package/dist/esm/watch.mjs +1 -41
  262. package/dist/esm/watch.mjs.map +1 -1
  263. package/dist/types/auth/login.d.ts +1 -1
  264. package/dist/types/auth/login.d.ts.map +1 -1
  265. package/dist/types/build.d.ts +1 -1
  266. package/dist/types/build.d.ts.map +1 -1
  267. package/dist/types/config.d.ts +1 -1
  268. package/dist/types/extract.d.ts +1 -1
  269. package/dist/types/extract.d.ts.map +1 -1
  270. package/dist/types/fill/fill.d.ts +1 -1
  271. package/dist/types/fill/fill.d.ts.map +1 -1
  272. package/dist/types/fill/translateDictionary.d.ts +2 -2
  273. package/dist/types/fill/translateDictionary.d.ts.map +1 -1
  274. package/dist/types/fill/writeFill.d.ts.map +1 -1
  275. package/dist/types/getTargetDictionary.d.ts +2 -2
  276. package/dist/types/index.d.ts +4 -1
  277. package/dist/types/listContentDeclaration.d.ts +1 -1
  278. package/dist/types/listContentDeclaration.d.ts.map +1 -1
  279. package/dist/types/liveSync.d.ts +1 -1
  280. package/dist/types/pull.d.ts +1 -1
  281. package/dist/types/pull.d.ts.map +1 -1
  282. package/dist/types/push/pullLog.d.ts +1 -1
  283. package/dist/types/push/pullLog.d.ts.map +1 -1
  284. package/dist/types/push/push.d.ts +2 -2
  285. package/dist/types/pushConfig.d.ts +1 -1
  286. package/dist/types/reviewDoc/reviewDoc.d.ts +2 -2
  287. package/dist/types/reviewDoc/reviewDoc.d.ts.map +1 -1
  288. package/dist/types/reviewDoc/reviewDocBlockAware.d.ts +1 -1
  289. package/dist/types/reviewDoc/reviewDocBlockAware.d.ts.map +1 -1
  290. package/dist/types/searchDoc.d.ts +1 -1
  291. package/dist/types/searchDoc.d.ts.map +1 -1
  292. package/dist/types/test/listMissingTranslations.d.ts +1 -1
  293. package/dist/types/test/test.d.ts +1 -1
  294. package/dist/types/test/test.d.ts.map +1 -1
  295. package/dist/types/translateDoc/translateDoc.d.ts.map +1 -1
  296. package/dist/types/translateDoc/types.d.ts +2 -2
  297. package/dist/types/translateDoc/validation.d.ts +1 -1
  298. package/dist/types/utils/checkAccess.d.ts.map +1 -1
  299. package/dist/types/watch.d.ts +1 -1
  300. package/dist/types/watch.d.ts.map +1 -1
  301. package/package.json +11 -11
@@ -1,82 +1,2 @@
1
- Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_utils_checkLastUpdateTime = require('./checkLastUpdateTime.cjs');
3
- const require_utils_formatTimeDiff = require('./formatTimeDiff.cjs');
4
-
5
- //#region src/utils/checkFileModifiedRange.ts
6
- /**
7
- * Threshold that helps us differentiate between a numeric *timestamp* (ms from epoch)
8
- * and a numeric *duration* (ms ago).
9
- * 50 years expressed in milliseconds is far greater than any reasonable
10
- * "relative" duration we expect the helper to receive (e.g. a couple of years).
11
- */
12
- const TIMESTAMP_THRESHOLD_MS = 50 * 365 * 24 * 60 * 60 * 1e3;
13
- /**
14
- * Normalises the input date representation into a pair:
15
- * 1. `relativeTime` – a Date instance whose epoch-time equals the duration
16
- * between `now` and the absolute date.
17
- * 2. `absoluteTime` – the concrete point in time represented as a Date.
18
- *
19
- * Rules for interpreting the input:
20
- * • Date => treated as an absolute time.
21
- * • string => parsed via the Date constructor => absolute time.
22
- * • number:
23
- * – if the value is larger than the TIMESTAMP_THRESHOLD_MS we assume it
24
- * is a unix timestamp (absolute time).
25
- * – otherwise we treat it as a *relative* duration expressed in
26
- * milliseconds.
27
- */
28
- const normaliseInputDate = (date, now = /* @__PURE__ */ new Date()) => {
29
- if (date instanceof Date) return {
30
- absoluteTime: date,
31
- relativeTime: new Date(now.getTime() - date.getTime())
32
- };
33
- if (typeof date === "number") {
34
- if (date > TIMESTAMP_THRESHOLD_MS) {
35
- const absoluteTime = new Date(date);
36
- return {
37
- absoluteTime,
38
- relativeTime: new Date(now.getTime() - absoluteTime.getTime())
39
- };
40
- }
41
- const relativeMs = date;
42
- return {
43
- relativeTime: new Date(relativeMs),
44
- absoluteTime: new Date(now.getTime() - relativeMs)
45
- };
46
- }
47
- if (typeof date === "string") {
48
- const absoluteTime = new Date(date);
49
- if (Number.isNaN(absoluteTime.getTime())) throw new Error(`Invalid date string provided: ${date}`);
50
- return {
51
- absoluteTime,
52
- relativeTime: new Date(now.getTime() - absoluteTime.getTime())
53
- };
54
- }
55
- throw new Error(`Unsupported date format: ${date}`);
56
- };
57
- const checkFileModifiedRange = (filePath, options) => {
58
- const fileLastUpdateTime = require_utils_checkLastUpdateTime.checkLastUpdateTime(filePath);
59
- const { skipIfModifiedBefore, skipIfModifiedAfter } = options;
60
- const now = /* @__PURE__ */ new Date();
61
- const minDate = skipIfModifiedBefore ? normaliseInputDate(skipIfModifiedBefore, now).absoluteTime : void 0;
62
- const maxDate = skipIfModifiedAfter ? normaliseInputDate(skipIfModifiedAfter, now).absoluteTime : void 0;
63
- let shouldSkip = false;
64
- if (minDate instanceof Date && maxDate instanceof Date) shouldSkip = fileLastUpdateTime >= minDate && fileLastUpdateTime <= maxDate;
65
- else if (minDate instanceof Date) shouldSkip = fileLastUpdateTime >= minDate;
66
- else if (maxDate) shouldSkip = fileLastUpdateTime >= maxDate;
67
- if (shouldSkip) {
68
- const referenceDate = minDate && maxDate ? new Date(Math.abs(maxDate.getTime() - minDate.getTime())) : minDate ?? maxDate;
69
- return {
70
- isSkipped: true,
71
- message: `Skipping file because it has been modified within the last ${require_utils_formatTimeDiff.formatTimeDiff(new Date(now.getTime() - referenceDate.getTime()))} - ${filePath}`
72
- };
73
- }
74
- return {
75
- isSkipped: false,
76
- message: `File ${filePath} can be processed - ${filePath}`
77
- };
78
- };
79
-
80
- //#endregion
81
- exports.checkFileModifiedRange = checkFileModifiedRange;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./checkLastUpdateTime.cjs`),t=require(`./formatTimeDiff.cjs`),n=(e,t=new Date)=>{if(e instanceof Date)return{absoluteTime:e,relativeTime:new Date(t.getTime()-e.getTime())};if(typeof e==`number`){if(e>15768e8){let n=new Date(e);return{absoluteTime:n,relativeTime:new Date(t.getTime()-n.getTime())}}let n=e;return{relativeTime:new Date(n),absoluteTime:new Date(t.getTime()-n)}}if(typeof e==`string`){let n=new Date(e);if(Number.isNaN(n.getTime()))throw Error(`Invalid date string provided: ${e}`);return{absoluteTime:n,relativeTime:new Date(t.getTime()-n.getTime())}}throw Error(`Unsupported date format: ${e}`)},r=(r,i)=>{let a=e.checkLastUpdateTime(r),{skipIfModifiedBefore:o,skipIfModifiedAfter:s}=i,c=new Date,l=o?n(o,c).absoluteTime:void 0,u=s?n(s,c).absoluteTime:void 0,d=!1;if(l instanceof Date&&u instanceof Date?d=a>=l&&a<=u:l instanceof Date?d=a>=l:u&&(d=a>=u),d){let e=l&&u?new Date(Math.abs(u.getTime()-l.getTime())):l??u;return{isSkipped:!0,message:`Skipping file because it has been modified within the last ${t.formatTimeDiff(new Date(c.getTime()-e.getTime()))} - ${r}`}}return{isSkipped:!1,message:`File ${r} can be processed - ${r}`}};exports.checkFileModifiedRange=r;
82
2
  //# sourceMappingURL=checkFileModifiedRange.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"checkFileModifiedRange.cjs","names":["checkLastUpdateTime","formatTimeDiff"],"sources":["../../../src/utils/checkFileModifiedRange.ts"],"sourcesContent":["import { checkLastUpdateTime } from './checkLastUpdateTime';\nimport { formatTimeDiff } from './formatTimeDiff';\n\ntype GetTimeRangeResult = {\n relativeTime: Date;\n absoluteTime: Date;\n};\n\n/**\n * Threshold that helps us differentiate between a numeric *timestamp* (ms from epoch)\n * and a numeric *duration* (ms ago).\n * 50 years expressed in milliseconds is far greater than any reasonable\n * \"relative\" duration we expect the helper to receive (e.g. a couple of years).\n */\nconst TIMESTAMP_THRESHOLD_MS = 50 * 365 * 24 * 60 * 60 * 1000; // 50 years\n\n/**\n * Normalises the input date representation into a pair:\n * 1. `relativeTime` – a Date instance whose epoch-time equals the duration\n * between `now` and the absolute date.\n * 2. `absoluteTime` – the concrete point in time represented as a Date.\n *\n * Rules for interpreting the input:\n * • Date => treated as an absolute time.\n * • string => parsed via the Date constructor => absolute time.\n * • number:\n * – if the value is larger than the TIMESTAMP_THRESHOLD_MS we assume it\n * is a unix timestamp (absolute time).\n * – otherwise we treat it as a *relative* duration expressed in\n * milliseconds.\n */\nconst normaliseInputDate = (\n date: Date | number | string,\n now: Date = new Date()\n): GetTimeRangeResult => {\n // Case 1: Already a Date instance\n if (date instanceof Date) {\n return {\n absoluteTime: date,\n relativeTime: new Date(now.getTime() - date.getTime()),\n };\n }\n\n // Case 2: Numeric value – decide between timestamp vs relative ms.\n if (typeof date === 'number') {\n if (date > TIMESTAMP_THRESHOLD_MS) {\n // Treat as *unix timestamp* (absolute)\n const absoluteTime = new Date(date);\n return {\n absoluteTime,\n relativeTime: new Date(now.getTime() - absoluteTime.getTime()),\n };\n }\n\n // Treat as a *relative* duration (milliseconds in the past)\n const relativeMs = date;\n return {\n // Relative duration expressed as a Date object starting at the epoch\n relativeTime: new Date(relativeMs),\n // The concrete date obtained by subtracting the duration from *now*\n absoluteTime: new Date(now.getTime() - relativeMs),\n };\n }\n\n // Case 3: String representation – let Date parse it.\n if (typeof date === 'string') {\n const absoluteTime = new Date(date);\n if (Number.isNaN(absoluteTime.getTime())) {\n throw new Error(`Invalid date string provided: ${date}`);\n }\n\n return {\n absoluteTime,\n relativeTime: new Date(now.getTime() - absoluteTime.getTime()),\n };\n }\n\n throw new Error(`Unsupported date format: ${date}`);\n};\n\ntype CheckFileModifiedRangeResult = {\n isSkipped: boolean;\n message: string;\n};\n\ntype CheckFileModifiedRangeOptions = {\n skipIfModifiedBefore?: Date | number | string;\n skipIfModifiedAfter?: Date | number | string;\n};\n\nexport const checkFileModifiedRange = (\n filePath: string,\n options: CheckFileModifiedRangeOptions\n): CheckFileModifiedRangeResult => {\n const fileLastUpdateTime = checkLastUpdateTime(filePath);\n const { skipIfModifiedBefore, skipIfModifiedAfter } = options;\n\n // Normalise the provided thresholds to concrete dates.\n const now = new Date();\n const minDate = skipIfModifiedBefore\n ? normaliseInputDate(skipIfModifiedBefore, now).absoluteTime\n : undefined;\n const maxDate = skipIfModifiedAfter\n ? normaliseInputDate(skipIfModifiedAfter, now).absoluteTime\n : undefined;\n\n // Determine if the file should be skipped.\n let shouldSkip = false;\n\n if (minDate instanceof Date && maxDate instanceof Date) {\n // Skip when the modification time falls *within* the range [minDate, maxDate]\n shouldSkip = fileLastUpdateTime >= minDate && fileLastUpdateTime <= maxDate;\n } else if (minDate instanceof Date) {\n // Only lower bound – skip when the file was modified *after* minDate\n shouldSkip = fileLastUpdateTime >= minDate;\n } else if (maxDate) {\n // Only upper bound – skip when the file was modified *after* maxDate\n shouldSkip = fileLastUpdateTime >= maxDate;\n }\n\n if (shouldSkip) {\n // For the sake of the message we compute the relative time to *now* using\n // whichever bound was responsible for the skip logic.\n const referenceDate = (\n minDate && maxDate\n ? // When both bounds are present, the *range* caused the skip so we use\n // the distance between the two bounds as the relative duration.\n new Date(Math.abs(maxDate.getTime() - minDate.getTime()))\n : (minDate ?? maxDate)\n )!;\n\n const relativeTime = new Date(now.getTime() - referenceDate.getTime());\n\n return {\n isSkipped: true,\n message: `Skipping file because it has been modified within the last ${formatTimeDiff(relativeTime)} - ${filePath}`,\n };\n }\n\n return {\n isSkipped: false,\n message: `File ${filePath} can be processed - ${filePath}`,\n };\n};\n"],"mappings":";;;;;;;;;;;AAcA,MAAM,yBAAyB,KAAK,MAAM,KAAK,KAAK,KAAK;;;;;;;;;;;;;;;;AAiBzD,MAAM,sBACJ,MACA,sBAAY,IAAI,MAAM,KACC;AAEvB,KAAI,gBAAgB,KAClB,QAAO;EACL,cAAc;EACd,cAAc,IAAI,KAAK,IAAI,SAAS,GAAG,KAAK,SAAS,CAAC;EACvD;AAIH,KAAI,OAAO,SAAS,UAAU;AAC5B,MAAI,OAAO,wBAAwB;GAEjC,MAAM,eAAe,IAAI,KAAK,KAAK;AACnC,UAAO;IACL;IACA,cAAc,IAAI,KAAK,IAAI,SAAS,GAAG,aAAa,SAAS,CAAC;IAC/D;;EAIH,MAAM,aAAa;AACnB,SAAO;GAEL,cAAc,IAAI,KAAK,WAAW;GAElC,cAAc,IAAI,KAAK,IAAI,SAAS,GAAG,WAAW;GACnD;;AAIH,KAAI,OAAO,SAAS,UAAU;EAC5B,MAAM,eAAe,IAAI,KAAK,KAAK;AACnC,MAAI,OAAO,MAAM,aAAa,SAAS,CAAC,CACtC,OAAM,IAAI,MAAM,iCAAiC,OAAO;AAG1D,SAAO;GACL;GACA,cAAc,IAAI,KAAK,IAAI,SAAS,GAAG,aAAa,SAAS,CAAC;GAC/D;;AAGH,OAAM,IAAI,MAAM,4BAA4B,OAAO;;AAarD,MAAa,0BACX,UACA,YACiC;CACjC,MAAM,qBAAqBA,sDAAoB,SAAS;CACxD,MAAM,EAAE,sBAAsB,wBAAwB;CAGtD,MAAM,sBAAM,IAAI,MAAM;CACtB,MAAM,UAAU,uBACZ,mBAAmB,sBAAsB,IAAI,CAAC,eAC9C;CACJ,MAAM,UAAU,sBACZ,mBAAmB,qBAAqB,IAAI,CAAC,eAC7C;CAGJ,IAAI,aAAa;AAEjB,KAAI,mBAAmB,QAAQ,mBAAmB,KAEhD,cAAa,sBAAsB,WAAW,sBAAsB;UAC3D,mBAAmB,KAE5B,cAAa,sBAAsB;UAC1B,QAET,cAAa,sBAAsB;AAGrC,KAAI,YAAY;EAGd,MAAM,gBACJ,WAAW,UAGP,IAAI,KAAK,KAAK,IAAI,QAAQ,SAAS,GAAG,QAAQ,SAAS,CAAC,CAAC,GACxD,WAAW;AAKlB,SAAO;GACL,WAAW;GACX,SAAS,8DAA8DC,4CAJpD,IAAI,KAAK,IAAI,SAAS,GAAG,cAAc,SAAS,CAAC,CAI+B,CAAC,KAAK;GAC1G;;AAGH,QAAO;EACL,WAAW;EACX,SAAS,QAAQ,SAAS,sBAAsB;EACjD"}
1
+ {"version":3,"file":"checkFileModifiedRange.cjs","names":["checkLastUpdateTime","formatTimeDiff"],"sources":["../../../src/utils/checkFileModifiedRange.ts"],"sourcesContent":["import { checkLastUpdateTime } from './checkLastUpdateTime';\nimport { formatTimeDiff } from './formatTimeDiff';\n\ntype GetTimeRangeResult = {\n relativeTime: Date;\n absoluteTime: Date;\n};\n\n/**\n * Threshold that helps us differentiate between a numeric *timestamp* (ms from epoch)\n * and a numeric *duration* (ms ago).\n * 50 years expressed in milliseconds is far greater than any reasonable\n * \"relative\" duration we expect the helper to receive (e.g. a couple of years).\n */\nconst TIMESTAMP_THRESHOLD_MS = 50 * 365 * 24 * 60 * 60 * 1000; // 50 years\n\n/**\n * Normalises the input date representation into a pair:\n * 1. `relativeTime` – a Date instance whose epoch-time equals the duration\n * between `now` and the absolute date.\n * 2. `absoluteTime` – the concrete point in time represented as a Date.\n *\n * Rules for interpreting the input:\n * • Date => treated as an absolute time.\n * • string => parsed via the Date constructor => absolute time.\n * • number:\n * – if the value is larger than the TIMESTAMP_THRESHOLD_MS we assume it\n * is a unix timestamp (absolute time).\n * – otherwise we treat it as a *relative* duration expressed in\n * milliseconds.\n */\nconst normaliseInputDate = (\n date: Date | number | string,\n now: Date = new Date()\n): GetTimeRangeResult => {\n // Case 1: Already a Date instance\n if (date instanceof Date) {\n return {\n absoluteTime: date,\n relativeTime: new Date(now.getTime() - date.getTime()),\n };\n }\n\n // Case 2: Numeric value – decide between timestamp vs relative ms.\n if (typeof date === 'number') {\n if (date > TIMESTAMP_THRESHOLD_MS) {\n // Treat as *unix timestamp* (absolute)\n const absoluteTime = new Date(date);\n return {\n absoluteTime,\n relativeTime: new Date(now.getTime() - absoluteTime.getTime()),\n };\n }\n\n // Treat as a *relative* duration (milliseconds in the past)\n const relativeMs = date;\n return {\n // Relative duration expressed as a Date object starting at the epoch\n relativeTime: new Date(relativeMs),\n // The concrete date obtained by subtracting the duration from *now*\n absoluteTime: new Date(now.getTime() - relativeMs),\n };\n }\n\n // Case 3: String representation – let Date parse it.\n if (typeof date === 'string') {\n const absoluteTime = new Date(date);\n if (Number.isNaN(absoluteTime.getTime())) {\n throw new Error(`Invalid date string provided: ${date}`);\n }\n\n return {\n absoluteTime,\n relativeTime: new Date(now.getTime() - absoluteTime.getTime()),\n };\n }\n\n throw new Error(`Unsupported date format: ${date}`);\n};\n\ntype CheckFileModifiedRangeResult = {\n isSkipped: boolean;\n message: string;\n};\n\ntype CheckFileModifiedRangeOptions = {\n skipIfModifiedBefore?: Date | number | string;\n skipIfModifiedAfter?: Date | number | string;\n};\n\nexport const checkFileModifiedRange = (\n filePath: string,\n options: CheckFileModifiedRangeOptions\n): CheckFileModifiedRangeResult => {\n const fileLastUpdateTime = checkLastUpdateTime(filePath);\n const { skipIfModifiedBefore, skipIfModifiedAfter } = options;\n\n // Normalise the provided thresholds to concrete dates.\n const now = new Date();\n const minDate = skipIfModifiedBefore\n ? normaliseInputDate(skipIfModifiedBefore, now).absoluteTime\n : undefined;\n const maxDate = skipIfModifiedAfter\n ? normaliseInputDate(skipIfModifiedAfter, now).absoluteTime\n : undefined;\n\n // Determine if the file should be skipped.\n let shouldSkip = false;\n\n if (minDate instanceof Date && maxDate instanceof Date) {\n // Skip when the modification time falls *within* the range [minDate, maxDate]\n shouldSkip = fileLastUpdateTime >= minDate && fileLastUpdateTime <= maxDate;\n } else if (minDate instanceof Date) {\n // Only lower bound – skip when the file was modified *after* minDate\n shouldSkip = fileLastUpdateTime >= minDate;\n } else if (maxDate) {\n // Only upper bound – skip when the file was modified *after* maxDate\n shouldSkip = fileLastUpdateTime >= maxDate;\n }\n\n if (shouldSkip) {\n // For the sake of the message we compute the relative time to *now* using\n // whichever bound was responsible for the skip logic.\n const referenceDate = (\n minDate && maxDate\n ? // When both bounds are present, the *range* caused the skip so we use\n // the distance between the two bounds as the relative duration.\n new Date(Math.abs(maxDate.getTime() - minDate.getTime()))\n : (minDate ?? maxDate)\n )!;\n\n const relativeTime = new Date(now.getTime() - referenceDate.getTime());\n\n return {\n isSkipped: true,\n message: `Skipping file because it has been modified within the last ${formatTimeDiff(relativeTime)} - ${filePath}`,\n };\n }\n\n return {\n isSkipped: false,\n message: `File ${filePath} can be processed - ${filePath}`,\n };\n};\n"],"mappings":"kJA+BM,GACJ,EACA,EAAY,IAAI,OACO,CAEvB,GAAI,aAAgB,KAClB,MAAO,CACL,aAAc,EACd,aAAc,IAAI,KAAK,EAAI,SAAS,CAAG,EAAK,SAAS,CAAC,CACvD,CAIH,GAAI,OAAO,GAAS,SAAU,CAC5B,GAAI,EAAO,QAAwB,CAEjC,IAAM,EAAe,IAAI,KAAK,EAAK,CACnC,MAAO,CACL,eACA,aAAc,IAAI,KAAK,EAAI,SAAS,CAAG,EAAa,SAAS,CAAC,CAC/D,CAIH,IAAM,EAAa,EACnB,MAAO,CAEL,aAAc,IAAI,KAAK,EAAW,CAElC,aAAc,IAAI,KAAK,EAAI,SAAS,CAAG,EAAW,CACnD,CAIH,GAAI,OAAO,GAAS,SAAU,CAC5B,IAAM,EAAe,IAAI,KAAK,EAAK,CACnC,GAAI,OAAO,MAAM,EAAa,SAAS,CAAC,CACtC,MAAU,MAAM,iCAAiC,IAAO,CAG1D,MAAO,CACL,eACA,aAAc,IAAI,KAAK,EAAI,SAAS,CAAG,EAAa,SAAS,CAAC,CAC/D,CAGH,MAAU,MAAM,4BAA4B,IAAO,EAaxC,GACX,EACA,IACiC,CACjC,IAAM,EAAqBA,EAAAA,oBAAoB,EAAS,CAClD,CAAE,uBAAsB,uBAAwB,EAGhD,EAAM,IAAI,KACV,EAAU,EACZ,EAAmB,EAAsB,EAAI,CAAC,aAC9C,IAAA,GACE,EAAU,EACZ,EAAmB,EAAqB,EAAI,CAAC,aAC7C,IAAA,GAGA,EAAa,GAajB,GAXI,aAAmB,MAAQ,aAAmB,KAEhD,EAAa,GAAsB,GAAW,GAAsB,EAC3D,aAAmB,KAE5B,EAAa,GAAsB,EAC1B,IAET,EAAa,GAAsB,GAGjC,EAAY,CAGd,IAAM,EACJ,GAAW,EAGP,IAAI,KAAK,KAAK,IAAI,EAAQ,SAAS,CAAG,EAAQ,SAAS,CAAC,CAAC,CACxD,GAAW,EAKlB,MAAO,CACL,UAAW,GACX,QAAS,8DAA8DC,EAAAA,eAJpD,IAAI,KAAK,EAAI,SAAS,CAAG,EAAc,SAAS,CAAC,CAI+B,CAAC,KAAK,IAC1G,CAGH,MAAO,CACL,UAAW,GACX,QAAS,QAAQ,EAAS,sBAAsB,IACjD"}
@@ -1,20 +1,2 @@
1
- Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
3
- let node_fs = require("node:fs");
4
-
5
- //#region src/utils/checkLastUpdateTime.ts
6
- /**
7
- * Returns the last modification date of a file.
8
- *
9
- * @param filePath - Absolute or relative path to the file to inspect.
10
- * @returns Date instance representing the file's last modified time (mtime).
11
- * @throws Will propagate any error thrown by fs.statSync (e.g., file not found).
12
- */
13
- const checkLastUpdateTime = (filePath) => {
14
- const stats = (0, node_fs.statSync)(filePath);
15
- return new Date(stats.mtime);
16
- };
17
-
18
- //#endregion
19
- exports.checkLastUpdateTime = checkLastUpdateTime;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`../_virtual/_rolldown/runtime.cjs`);let e=require(`node:fs`);const t=t=>{let n=(0,e.statSync)(t);return new Date(n.mtime)};exports.checkLastUpdateTime=t;
20
2
  //# sourceMappingURL=checkLastUpdateTime.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"checkLastUpdateTime.cjs","names":[],"sources":["../../../src/utils/checkLastUpdateTime.ts"],"sourcesContent":["import { statSync } from 'node:fs';\n\n/**\n * Returns the last modification date of a file.\n *\n * @param filePath - Absolute or relative path to the file to inspect.\n * @returns Date instance representing the file's last modified time (mtime).\n * @throws Will propagate any error thrown by fs.statSync (e.g., file not found).\n */\nexport const checkLastUpdateTime = (filePath: string): Date => {\n const stats = statSync(filePath);\n return new Date(stats.mtime);\n};\n"],"mappings":";;;;;;;;;;;;AASA,MAAa,uBAAuB,aAA2B;CAC7D,MAAM,8BAAiB,SAAS;AAChC,QAAO,IAAI,KAAK,MAAM,MAAM"}
1
+ {"version":3,"file":"checkLastUpdateTime.cjs","names":[],"sources":["../../../src/utils/checkLastUpdateTime.ts"],"sourcesContent":["import { statSync } from 'node:fs';\n\n/**\n * Returns the last modification date of a file.\n *\n * @param filePath - Absolute or relative path to the file to inspect.\n * @returns Date instance representing the file's last modified time (mtime).\n * @throws Will propagate any error thrown by fs.statSync (e.g., file not found).\n */\nexport const checkLastUpdateTime = (filePath: string): Date => {\n const stats = statSync(filePath);\n return new Date(stats.mtime);\n};\n"],"mappings":"yIASA,MAAa,EAAuB,GAA2B,CAC7D,IAAM,GAAA,EAAA,EAAA,UAAiB,EAAS,CAChC,OAAO,IAAI,KAAK,EAAM,MAAM"}
@@ -1,46 +1,2 @@
1
- Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
3
- let _intlayer_api = require("@intlayer/api");
4
- let _intlayer_config = require("@intlayer/config");
5
-
6
- //#region src/utils/chunkInference.ts
7
- /**
8
- * Translates a single chunk via the OpenAI API.
9
- * Includes retry logic if the call fails.
10
- */
11
- const chunkInference = async (messages, aiOptions, configuration, aiClient, aiConfig) => {
12
- let lastResult;
13
- await (0, _intlayer_config.retryManager)(async () => {
14
- if (aiClient && aiConfig) {
15
- const response = await aiClient.customQuery({
16
- aiConfig,
17
- messages
18
- });
19
- if (!response) throw new Error("No response from AI API");
20
- const { fileContent, tokenUsed } = response;
21
- lastResult = {
22
- fileContent: processContent(fileContent),
23
- tokenUsed
24
- };
25
- return;
26
- }
27
- const response = await (0, _intlayer_api.getIntlayerAPIProxy)(void 0, configuration).ai.customQuery({
28
- aiOptions,
29
- messages
30
- });
31
- if (!response.data) throw new Error("No response from AI API");
32
- const { fileContent, tokenUsed } = response.data;
33
- lastResult = {
34
- fileContent: processContent(fileContent),
35
- tokenUsed
36
- };
37
- })();
38
- return lastResult;
39
- };
40
- const processContent = (content) => {
41
- return content.replaceAll("///chunksStart///", "").replaceAll("///chunkStart///", "").replaceAll("///chunksEnd///", "").replaceAll("///chunkEnd///", "").replaceAll("///chunksStart///", "").replaceAll("chunkStart///", "").replaceAll("chunksEnd///", "").replaceAll("chunkEnd///", "").replaceAll("///chunksStart", "").replaceAll("///chunkStart", "").replaceAll("///chunksEnd", "").replaceAll("///chunkEnd", "").replaceAll("chunksStart", "").replaceAll("chunkStart", "").replaceAll("chunksEnd", "").replaceAll("chunkEnd", "");
42
- };
43
-
44
- //#endregion
45
- exports.chunkInference = chunkInference;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`../_virtual/_rolldown/runtime.cjs`);let e=require(`@intlayer/api`),t=require(`@intlayer/config/utils`);const n=async(n,i,a,o,s)=>{let c;return await(0,t.retryManager)(async()=>{if(o&&s){let e=await o.customQuery({aiConfig:s,messages:n});if(!e)throw Error(`No response from AI API`);let{fileContent:t,tokenUsed:i}=e;c={fileContent:r(t),tokenUsed:i};return}let t=await(0,e.getIntlayerAPIProxy)(void 0,a).ai.customQuery({aiOptions:i,messages:n});if(!t.data)throw Error(`No response from AI API`);let{fileContent:l,tokenUsed:u}=t.data;c={fileContent:r(l),tokenUsed:u}})(),c},r=e=>e.replaceAll(`///chunksStart///`,``).replaceAll(`///chunkStart///`,``).replaceAll(`///chunksEnd///`,``).replaceAll(`///chunkEnd///`,``).replaceAll(`///chunksStart///`,``).replaceAll(`chunkStart///`,``).replaceAll(`chunksEnd///`,``).replaceAll(`chunkEnd///`,``).replaceAll(`///chunksStart`,``).replaceAll(`///chunkStart`,``).replaceAll(`///chunksEnd`,``).replaceAll(`///chunkEnd`,``).replaceAll(`chunksStart`,``).replaceAll(`chunkStart`,``).replaceAll(`chunksEnd`,``).replaceAll(`chunkEnd`,``);exports.chunkInference=n;
46
2
  //# sourceMappingURL=chunkInference.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"chunkInference.cjs","names":[],"sources":["../../../src/utils/chunkInference.ts"],"sourcesContent":["import type { AIConfig, AIOptions } from '@intlayer/ai';\nimport { getIntlayerAPIProxy, type Messages } from '@intlayer/api';\nimport { retryManager } from '@intlayer/config';\nimport type { IntlayerConfig } from '@intlayer/types';\nimport type { AIClient } from './setupAI';\n\ntype ChunkInferenceResult = {\n fileContent: string;\n tokenUsed: number;\n};\n\n/**\n * Translates a single chunk via the OpenAI API.\n * Includes retry logic if the call fails.\n */\nexport const chunkInference = async (\n messages: Messages,\n aiOptions?: AIOptions,\n configuration?: IntlayerConfig,\n aiClient?: AIClient,\n aiConfig?: AIConfig\n): Promise<ChunkInferenceResult> => {\n let lastResult: ChunkInferenceResult;\n\n await retryManager(async () => {\n if (aiClient && aiConfig) {\n const response = await aiClient.customQuery({\n aiConfig,\n messages,\n });\n\n if (!response) {\n throw new Error('No response from AI API');\n }\n\n const { fileContent, tokenUsed } = response;\n\n lastResult = {\n fileContent: processContent(fileContent),\n tokenUsed,\n };\n\n return;\n }\n\n const api = getIntlayerAPIProxy(undefined, configuration);\n\n const response = await api.ai.customQuery({\n aiOptions,\n messages,\n });\n\n if (!response.data) {\n throw new Error('No response from AI API');\n }\n\n const { fileContent, tokenUsed } = response.data;\n\n lastResult = {\n fileContent: processContent(fileContent),\n tokenUsed,\n };\n })();\n\n return lastResult!;\n};\n\nconst processContent = (content: string) => {\n return content\n .replaceAll('///chunksStart///', '')\n .replaceAll('///chunkStart///', '')\n .replaceAll('///chunksEnd///', '')\n .replaceAll('///chunkEnd///', '')\n .replaceAll('///chunksStart///', '')\n .replaceAll('chunkStart///', '')\n .replaceAll('chunksEnd///', '')\n .replaceAll('chunkEnd///', '')\n .replaceAll('///chunksStart', '')\n .replaceAll('///chunkStart', '')\n .replaceAll('///chunksEnd', '')\n .replaceAll('///chunkEnd', '')\n .replaceAll('chunksStart', '')\n .replaceAll('chunkStart', '')\n .replaceAll('chunksEnd', '')\n .replaceAll('chunkEnd', '');\n};\n"],"mappings":";;;;;;;;;;AAeA,MAAa,iBAAiB,OAC5B,UACA,WACA,eACA,UACA,aACkC;CAClC,IAAI;AAEJ,0CAAmB,YAAY;AAC7B,MAAI,YAAY,UAAU;GACxB,MAAM,WAAW,MAAM,SAAS,YAAY;IAC1C;IACA;IACD,CAAC;AAEF,OAAI,CAAC,SACH,OAAM,IAAI,MAAM,0BAA0B;GAG5C,MAAM,EAAE,aAAa,cAAc;AAEnC,gBAAa;IACX,aAAa,eAAe,YAAY;IACxC;IACD;AAED;;EAKF,MAAM,WAAW,6CAFe,QAAW,cAAc,CAE9B,GAAG,YAAY;GACxC;GACA;GACD,CAAC;AAEF,MAAI,CAAC,SAAS,KACZ,OAAM,IAAI,MAAM,0BAA0B;EAG5C,MAAM,EAAE,aAAa,cAAc,SAAS;AAE5C,eAAa;GACX,aAAa,eAAe,YAAY;GACxC;GACD;GACD,EAAE;AAEJ,QAAO;;AAGT,MAAM,kBAAkB,YAAoB;AAC1C,QAAO,QACJ,WAAW,qBAAqB,GAAG,CACnC,WAAW,oBAAoB,GAAG,CAClC,WAAW,mBAAmB,GAAG,CACjC,WAAW,kBAAkB,GAAG,CAChC,WAAW,qBAAqB,GAAG,CACnC,WAAW,iBAAiB,GAAG,CAC/B,WAAW,gBAAgB,GAAG,CAC9B,WAAW,eAAe,GAAG,CAC7B,WAAW,kBAAkB,GAAG,CAChC,WAAW,iBAAiB,GAAG,CAC/B,WAAW,gBAAgB,GAAG,CAC9B,WAAW,eAAe,GAAG,CAC7B,WAAW,eAAe,GAAG,CAC7B,WAAW,cAAc,GAAG,CAC5B,WAAW,aAAa,GAAG,CAC3B,WAAW,YAAY,GAAG"}
1
+ {"version":3,"file":"chunkInference.cjs","names":[],"sources":["../../../src/utils/chunkInference.ts"],"sourcesContent":["import type { AIConfig, AIOptions } from '@intlayer/ai';\nimport { getIntlayerAPIProxy, type Messages } from '@intlayer/api';\nimport { retryManager } from '@intlayer/config/utils';\nimport type { IntlayerConfig } from '@intlayer/types';\nimport type { AIClient } from './setupAI';\n\ntype ChunkInferenceResult = {\n fileContent: string;\n tokenUsed: number;\n};\n\n/**\n * Translates a single chunk via the OpenAI API.\n * Includes retry logic if the call fails.\n */\nexport const chunkInference = async (\n messages: Messages,\n aiOptions?: AIOptions,\n configuration?: IntlayerConfig,\n aiClient?: AIClient,\n aiConfig?: AIConfig\n): Promise<ChunkInferenceResult> => {\n let lastResult: ChunkInferenceResult;\n\n await retryManager(async () => {\n if (aiClient && aiConfig) {\n const response = await aiClient.customQuery({\n aiConfig,\n messages,\n });\n\n if (!response) {\n throw new Error('No response from AI API');\n }\n\n const { fileContent, tokenUsed } = response;\n\n lastResult = {\n fileContent: processContent(fileContent),\n tokenUsed,\n };\n\n return;\n }\n\n const api = getIntlayerAPIProxy(undefined, configuration);\n\n const response = await api.ai.customQuery({\n aiOptions,\n messages,\n });\n\n if (!response.data) {\n throw new Error('No response from AI API');\n }\n\n const { fileContent, tokenUsed } = response.data;\n\n lastResult = {\n fileContent: processContent(fileContent),\n tokenUsed,\n };\n })();\n\n return lastResult!;\n};\n\nconst processContent = (content: string) => {\n return content\n .replaceAll('///chunksStart///', '')\n .replaceAll('///chunkStart///', '')\n .replaceAll('///chunksEnd///', '')\n .replaceAll('///chunkEnd///', '')\n .replaceAll('///chunksStart///', '')\n .replaceAll('chunkStart///', '')\n .replaceAll('chunksEnd///', '')\n .replaceAll('chunkEnd///', '')\n .replaceAll('///chunksStart', '')\n .replaceAll('///chunkStart', '')\n .replaceAll('///chunksEnd', '')\n .replaceAll('///chunkEnd', '')\n .replaceAll('chunksStart', '')\n .replaceAll('chunkStart', '')\n .replaceAll('chunksEnd', '')\n .replaceAll('chunkEnd', '');\n};\n"],"mappings":"mLAeA,MAAa,EAAiB,MAC5B,EACA,EACA,EACA,EACA,IACkC,CAClC,IAAI,EA0CJ,OAxCA,MAAA,EAAA,EAAA,cAAmB,SAAY,CAC7B,GAAI,GAAY,EAAU,CACxB,IAAM,EAAW,MAAM,EAAS,YAAY,CAC1C,WACA,WACD,CAAC,CAEF,GAAI,CAAC,EACH,MAAU,MAAM,0BAA0B,CAG5C,GAAM,CAAE,cAAa,aAAc,EAEnC,EAAa,CACX,YAAa,EAAe,EAAY,CACxC,YACD,CAED,OAKF,IAAM,EAAW,MAAA,EAAA,EAAA,qBAFe,IAAA,GAAW,EAAc,CAE9B,GAAG,YAAY,CACxC,YACA,WACD,CAAC,CAEF,GAAI,CAAC,EAAS,KACZ,MAAU,MAAM,0BAA0B,CAG5C,GAAM,CAAE,cAAa,aAAc,EAAS,KAE5C,EAAa,CACX,YAAa,EAAe,EAAY,CACxC,YACD,EACD,EAAE,CAEG,GAGH,EAAkB,GACf,EACJ,WAAW,oBAAqB,GAAG,CACnC,WAAW,mBAAoB,GAAG,CAClC,WAAW,kBAAmB,GAAG,CACjC,WAAW,iBAAkB,GAAG,CAChC,WAAW,oBAAqB,GAAG,CACnC,WAAW,gBAAiB,GAAG,CAC/B,WAAW,eAAgB,GAAG,CAC9B,WAAW,cAAe,GAAG,CAC7B,WAAW,iBAAkB,GAAG,CAChC,WAAW,gBAAiB,GAAG,CAC/B,WAAW,eAAgB,GAAG,CAC9B,WAAW,cAAe,GAAG,CAC7B,WAAW,cAAe,GAAG,CAC7B,WAAW,aAAc,GAAG,CAC5B,WAAW,YAAa,GAAG,CAC3B,WAAW,WAAY,GAAG"}
@@ -1,29 +1,5 @@
1
- Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=`(?:${["```",`
2
2
 
3
- //#region src/utils/fixChunkStartEndChars.ts
4
- const CHAR_TO_CHECK_FORMATTING = [
5
- "```",
6
- "\n\n",
7
- "\n",
8
- "---",
9
- "{{",
10
- "}}"
11
- ];
12
- const escapeForRegExp = (str) => str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&").replace(/\n/g, "\\n");
13
- const FORMATTING_REGEX_SOURCE = `(?:${CHAR_TO_CHECK_FORMATTING.map(escapeForRegExp).join("|")})+`;
14
- const LEADING_FORMATTING_REGEX = new RegExp(`^${FORMATTING_REGEX_SOURCE}`);
15
- const TRAILING_FORMATTING_REGEX = new RegExp(`${FORMATTING_REGEX_SOURCE}$`);
16
- const fixChunkStartEndChars = (reviewedChunkResult, baseChunkContext) => {
17
- let result = reviewedChunkResult;
18
- const baseLeading = baseChunkContext.match(LEADING_FORMATTING_REGEX)?.[0] ?? "";
19
- const baseTrailing = baseChunkContext.match(TRAILING_FORMATTING_REGEX)?.[0] ?? "";
20
- const resultLeading = result.match(LEADING_FORMATTING_REGEX)?.[0] ?? "";
21
- const resultTrailing = result.match(TRAILING_FORMATTING_REGEX)?.[0] ?? "";
22
- if (baseLeading !== resultLeading) result = baseLeading + result.slice(resultLeading.length);
23
- if (baseTrailing !== resultTrailing) result = result.slice(0, result.length - resultTrailing.length) + baseTrailing;
24
- return result;
25
- };
26
-
27
- //#endregion
28
- exports.fixChunkStartEndChars = fixChunkStartEndChars;
3
+ `,`
4
+ `,`---`,`{{`,`}}`].map(e=>e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`).replace(/\n/g,`\\n`)).join(`|`)})+`,t=RegExp(`^${e}`),n=RegExp(`${e}$`),r=(e,r)=>{let i=e,a=r.match(t)?.[0]??``,o=r.match(n)?.[0]??``,s=i.match(t)?.[0]??``,c=i.match(n)?.[0]??``;return a!==s&&(i=a+i.slice(s.length)),o!==c&&(i=i.slice(0,i.length-c.length)+o),i};exports.fixChunkStartEndChars=r;
29
5
  //# sourceMappingURL=fixChunkStartEndChars.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"fixChunkStartEndChars.cjs","names":[],"sources":["../../../src/utils/fixChunkStartEndChars.ts"],"sourcesContent":["const CHAR_TO_CHECK_FORMATTING = ['```', '\\n\\n', '\\n', '---', '{{', '}}'];\n\n// Escape a string for use in RegExp\nconst escapeForRegExp = (str: string) =>\n str.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&').replace(/\\n/g, '\\\\n');\n\n// Build once the regex that matches any combination of the formatting chars appearing\n// sequentially at the beginning or at the end of a string.\nconst FORMATTING_REGEX_SOURCE = `(?:${CHAR_TO_CHECK_FORMATTING.map(escapeForRegExp).join('|')})+`;\nconst LEADING_FORMATTING_REGEX = new RegExp(`^${FORMATTING_REGEX_SOURCE}`);\nconst TRAILING_FORMATTING_REGEX = new RegExp(`${FORMATTING_REGEX_SOURCE}$`);\n\nexport const fixChunkStartEndChars = (\n reviewedChunkResult: string,\n baseChunkContext: string\n) => {\n let result = reviewedChunkResult;\n\n const baseLeading =\n baseChunkContext.match(LEADING_FORMATTING_REGEX)?.[0] ?? '';\n const baseTrailing =\n baseChunkContext.match(TRAILING_FORMATTING_REGEX)?.[0] ?? '';\n\n const resultLeading = result.match(LEADING_FORMATTING_REGEX)?.[0] ?? '';\n const resultTrailing = result.match(TRAILING_FORMATTING_REGEX)?.[0] ?? '';\n\n // Fix leading formatting\n if (baseLeading !== resultLeading) {\n // Remove current leading formatting found in result and prepend the correct one\n result = baseLeading + result.slice(resultLeading.length);\n }\n\n // Fix trailing formatting\n if (baseTrailing !== resultTrailing) {\n // Remove current trailing formatting found in result and append the correct one\n result =\n result.slice(0, result.length - resultTrailing.length) + baseTrailing;\n }\n\n return result;\n};\n"],"mappings":";;;AAAA,MAAM,2BAA2B;CAAC;CAAO;CAAQ;CAAM;CAAO;CAAM;CAAK;AAGzE,MAAM,mBAAmB,QACvB,IAAI,QAAQ,uBAAuB,OAAO,CAAC,QAAQ,OAAO,MAAM;AAIlE,MAAM,0BAA0B,MAAM,yBAAyB,IAAI,gBAAgB,CAAC,KAAK,IAAI,CAAC;AAC9F,MAAM,2BAA2B,IAAI,OAAO,IAAI,0BAA0B;AAC1E,MAAM,4BAA4B,IAAI,OAAO,GAAG,wBAAwB,GAAG;AAE3E,MAAa,yBACX,qBACA,qBACG;CACH,IAAI,SAAS;CAEb,MAAM,cACJ,iBAAiB,MAAM,yBAAyB,GAAG,MAAM;CAC3D,MAAM,eACJ,iBAAiB,MAAM,0BAA0B,GAAG,MAAM;CAE5D,MAAM,gBAAgB,OAAO,MAAM,yBAAyB,GAAG,MAAM;CACrE,MAAM,iBAAiB,OAAO,MAAM,0BAA0B,GAAG,MAAM;AAGvE,KAAI,gBAAgB,cAElB,UAAS,cAAc,OAAO,MAAM,cAAc,OAAO;AAI3D,KAAI,iBAAiB,eAEnB,UACE,OAAO,MAAM,GAAG,OAAO,SAAS,eAAe,OAAO,GAAG;AAG7D,QAAO"}
1
+ {"version":3,"file":"fixChunkStartEndChars.cjs","names":[],"sources":["../../../src/utils/fixChunkStartEndChars.ts"],"sourcesContent":["const CHAR_TO_CHECK_FORMATTING = ['```', '\\n\\n', '\\n', '---', '{{', '}}'];\n\n// Escape a string for use in RegExp\nconst escapeForRegExp = (str: string) =>\n str.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&').replace(/\\n/g, '\\\\n');\n\n// Build once the regex that matches any combination of the formatting chars appearing\n// sequentially at the beginning or at the end of a string.\nconst FORMATTING_REGEX_SOURCE = `(?:${CHAR_TO_CHECK_FORMATTING.map(escapeForRegExp).join('|')})+`;\nconst LEADING_FORMATTING_REGEX = new RegExp(`^${FORMATTING_REGEX_SOURCE}`);\nconst TRAILING_FORMATTING_REGEX = new RegExp(`${FORMATTING_REGEX_SOURCE}$`);\n\nexport const fixChunkStartEndChars = (\n reviewedChunkResult: string,\n baseChunkContext: string\n) => {\n let result = reviewedChunkResult;\n\n const baseLeading =\n baseChunkContext.match(LEADING_FORMATTING_REGEX)?.[0] ?? '';\n const baseTrailing =\n baseChunkContext.match(TRAILING_FORMATTING_REGEX)?.[0] ?? '';\n\n const resultLeading = result.match(LEADING_FORMATTING_REGEX)?.[0] ?? '';\n const resultTrailing = result.match(TRAILING_FORMATTING_REGEX)?.[0] ?? '';\n\n // Fix leading formatting\n if (baseLeading !== resultLeading) {\n // Remove current leading formatting found in result and prepend the correct one\n result = baseLeading + result.slice(resultLeading.length);\n }\n\n // Fix trailing formatting\n if (baseTrailing !== resultTrailing) {\n // Remove current trailing formatting found in result and append the correct one\n result =\n result.slice(0, result.length - resultTrailing.length) + baseTrailing;\n }\n\n return result;\n};\n"],"mappings":"mEAQA,MAAM,EAA0B,MARC,CAAC,MAAO;;EAAQ;EAAM,MAAO,KAAM,KAAK,CAQV,IALtC,GACvB,EAAI,QAAQ,sBAAuB,OAAO,CAAC,QAAQ,MAAO,MAAM,CAIiB,CAAC,KAAK,IAAI,CAAC,IACxF,EAA+B,OAAO,IAAI,IAA0B,CACpE,EAAgC,OAAO,GAAG,EAAwB,GAAG,CAE9D,GACX,EACA,IACG,CACH,IAAI,EAAS,EAEP,EACJ,EAAiB,MAAM,EAAyB,GAAG,IAAM,GACrD,EACJ,EAAiB,MAAM,EAA0B,GAAG,IAAM,GAEtD,EAAgB,EAAO,MAAM,EAAyB,GAAG,IAAM,GAC/D,EAAiB,EAAO,MAAM,EAA0B,GAAG,IAAM,GAevE,OAZI,IAAgB,IAElB,EAAS,EAAc,EAAO,MAAM,EAAc,OAAO,EAIvD,IAAiB,IAEnB,EACE,EAAO,MAAM,EAAG,EAAO,OAAS,EAAe,OAAO,CAAG,GAGtD"}
@@ -1,21 +1,2 @@
1
- Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
-
3
- //#region src/utils/formatTimeDiff.ts
4
- const formatTimeDiff = (realtiveTime) => {
5
- const diff = realtiveTime.getTime();
6
- const MS_IN_SECOND = 1e3;
7
- const MS_IN_MINUTE = 60 * MS_IN_SECOND;
8
- const MS_IN_HOUR = 60 * MS_IN_MINUTE;
9
- const MS_IN_DAY = 24 * MS_IN_HOUR;
10
- const days = Math.floor(diff / MS_IN_DAY);
11
- const hours = Math.floor(diff % MS_IN_DAY / MS_IN_HOUR);
12
- const minutes = Math.floor(diff % MS_IN_HOUR / MS_IN_MINUTE);
13
- const seconds = Math.floor(diff % MS_IN_MINUTE / MS_IN_SECOND);
14
- if (days > 0) return `${days}d ${hours}h ${minutes}m ${seconds}s`;
15
- if (hours > 0) return `${hours}h ${minutes}m ${seconds}s`;
16
- return `${minutes}m ${seconds}s`;
17
- };
18
-
19
- //#endregion
20
- exports.formatTimeDiff = formatTimeDiff;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=e=>{let t=e.getTime(),n=1e3,r=60*n,i=60*r,a=24*i,o=Math.floor(t/a),s=Math.floor(t%a/i),c=Math.floor(t%i/r),l=Math.floor(t%r/n);return o>0?`${o}d ${s}h ${c}m ${l}s`:s>0?`${s}h ${c}m ${l}s`:`${c}m ${l}s`};exports.formatTimeDiff=e;
21
2
  //# sourceMappingURL=formatTimeDiff.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"formatTimeDiff.cjs","names":[],"sources":["../../../src/utils/formatTimeDiff.ts"],"sourcesContent":["export const formatTimeDiff = (realtiveTime: Date): string => {\n const diff = realtiveTime.getTime();\n\n const MS_IN_SECOND = 1000;\n const MS_IN_MINUTE = 60 * MS_IN_SECOND;\n const MS_IN_HOUR = 60 * MS_IN_MINUTE;\n const MS_IN_DAY = 24 * MS_IN_HOUR;\n\n const days = Math.floor(diff / MS_IN_DAY);\n const hours = Math.floor((diff % MS_IN_DAY) / MS_IN_HOUR);\n const minutes = Math.floor((diff % MS_IN_HOUR) / MS_IN_MINUTE);\n const seconds = Math.floor((diff % MS_IN_MINUTE) / MS_IN_SECOND);\n\n if (days > 0) {\n return `${days}d ${hours}h ${minutes}m ${seconds}s`;\n }\n if (hours > 0) {\n return `${hours}h ${minutes}m ${seconds}s`;\n }\n\n return `${minutes}m ${seconds}s`;\n};\n"],"mappings":";;;AAAA,MAAa,kBAAkB,iBAA+B;CAC5D,MAAM,OAAO,aAAa,SAAS;CAEnC,MAAM,eAAe;CACrB,MAAM,eAAe,KAAK;CAC1B,MAAM,aAAa,KAAK;CACxB,MAAM,YAAY,KAAK;CAEvB,MAAM,OAAO,KAAK,MAAM,OAAO,UAAU;CACzC,MAAM,QAAQ,KAAK,MAAO,OAAO,YAAa,WAAW;CACzD,MAAM,UAAU,KAAK,MAAO,OAAO,aAAc,aAAa;CAC9D,MAAM,UAAU,KAAK,MAAO,OAAO,eAAgB,aAAa;AAEhE,KAAI,OAAO,EACT,QAAO,GAAG,KAAK,IAAI,MAAM,IAAI,QAAQ,IAAI,QAAQ;AAEnD,KAAI,QAAQ,EACV,QAAO,GAAG,MAAM,IAAI,QAAQ,IAAI,QAAQ;AAG1C,QAAO,GAAG,QAAQ,IAAI,QAAQ"}
1
+ {"version":3,"file":"formatTimeDiff.cjs","names":[],"sources":["../../../src/utils/formatTimeDiff.ts"],"sourcesContent":["export const formatTimeDiff = (realtiveTime: Date): string => {\n const diff = realtiveTime.getTime();\n\n const MS_IN_SECOND = 1000;\n const MS_IN_MINUTE = 60 * MS_IN_SECOND;\n const MS_IN_HOUR = 60 * MS_IN_MINUTE;\n const MS_IN_DAY = 24 * MS_IN_HOUR;\n\n const days = Math.floor(diff / MS_IN_DAY);\n const hours = Math.floor((diff % MS_IN_DAY) / MS_IN_HOUR);\n const minutes = Math.floor((diff % MS_IN_HOUR) / MS_IN_MINUTE);\n const seconds = Math.floor((diff % MS_IN_MINUTE) / MS_IN_SECOND);\n\n if (days > 0) {\n return `${days}d ${hours}h ${minutes}m ${seconds}s`;\n }\n if (hours > 0) {\n return `${hours}h ${minutes}m ${seconds}s`;\n }\n\n return `${minutes}m ${seconds}s`;\n};\n"],"mappings":"mEAAA,MAAa,EAAkB,GAA+B,CAC5D,IAAM,EAAO,EAAa,SAAS,CAE7B,EAAe,IACf,EAAe,GAAK,EACpB,EAAa,GAAK,EAClB,EAAY,GAAK,EAEjB,EAAO,KAAK,MAAM,EAAO,EAAU,CACnC,EAAQ,KAAK,MAAO,EAAO,EAAa,EAAW,CACnD,EAAU,KAAK,MAAO,EAAO,EAAc,EAAa,CACxD,EAAU,KAAK,MAAO,EAAO,EAAgB,EAAa,CAShE,OAPI,EAAO,EACF,GAAG,EAAK,IAAI,EAAM,IAAI,EAAQ,IAAI,EAAQ,GAE/C,EAAQ,EACH,GAAG,EAAM,IAAI,EAAQ,IAAI,EAAQ,GAGnC,GAAG,EAAQ,IAAI,EAAQ"}
@@ -1,17 +1,2 @@
1
- Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
3
- let node_fs = require("node:fs");
4
-
5
- //#region src/utils/getIsFileUpdatedRecently.ts
6
- const SKIP_RANGE_OF_LAST_UPDATE_TIME = 0;
7
- /**
8
- * Check if file was updated recently, to skip re-translation
9
- */
10
- const getIsFileUpdatedRecently = (localeFilePath) => {
11
- const stats = (0, node_fs.statSync)(localeFilePath);
12
- return new Date(stats.mtime) > new Date(Date.now() - SKIP_RANGE_OF_LAST_UPDATE_TIME);
13
- };
14
-
15
- //#endregion
16
- exports.getIsFileUpdatedRecently = getIsFileUpdatedRecently;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`../_virtual/_rolldown/runtime.cjs`);let e=require(`node:fs`);const t=t=>{let n=(0,e.statSync)(t);return new Date(n.mtime)>new Date(Date.now()-0)};exports.getIsFileUpdatedRecently=t;
17
2
  //# sourceMappingURL=getIsFileUpdatedRecently.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"getIsFileUpdatedRecently.cjs","names":[],"sources":["../../../src/utils/getIsFileUpdatedRecently.ts"],"sourcesContent":["import { statSync } from 'node:fs';\n\nconst SKIP_RANGE_OF_LAST_UPDATE_TIME: number = 0; //2 * 60 * 60 * 1000; // 2 hours\n\n/**\n * Check if file was updated recently, to skip re-translation\n */\nexport const getIsFileUpdatedRecently = (localeFilePath: string): boolean => {\n const stats = statSync(localeFilePath);\n const lastModified = new Date(stats.mtime);\n const threshold = new Date(Date.now() - SKIP_RANGE_OF_LAST_UPDATE_TIME);\n\n return lastModified > threshold;\n};\n"],"mappings":";;;;;AAEA,MAAM,iCAAyC;;;;AAK/C,MAAa,4BAA4B,mBAAoC;CAC3E,MAAM,8BAAiB,eAAe;AAItC,QAHqB,IAAI,KAAK,MAAM,MAAM,GACxB,IAAI,KAAK,KAAK,KAAK,GAAG,+BAA+B"}
1
+ {"version":3,"file":"getIsFileUpdatedRecently.cjs","names":[],"sources":["../../../src/utils/getIsFileUpdatedRecently.ts"],"sourcesContent":["import { statSync } from 'node:fs';\n\nconst SKIP_RANGE_OF_LAST_UPDATE_TIME: number = 0; //2 * 60 * 60 * 1000; // 2 hours\n\n/**\n * Check if file was updated recently, to skip re-translation\n */\nexport const getIsFileUpdatedRecently = (localeFilePath: string): boolean => {\n const stats = statSync(localeFilePath);\n const lastModified = new Date(stats.mtime);\n const threshold = new Date(Date.now() - SKIP_RANGE_OF_LAST_UPDATE_TIME);\n\n return lastModified > threshold;\n};\n"],"mappings":"yIAEA,MAKa,EAA4B,GAAoC,CAC3E,IAAM,GAAA,EAAA,EAAA,UAAiB,EAAe,CAItC,OAHqB,IAAI,KAAK,EAAM,MAAM,CACxB,IAAI,KAAK,KAAK,KAAK,CAAG,EAA+B"}
@@ -1,75 +1,2 @@
1
- Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
-
3
- //#region src/utils/getOutputFilePath.ts
4
- /**
5
- * Get the output file path by replacing the base locale with the target locale
6
- *
7
- * This function handles two types of replacements:
8
- * 1. Actual locale values (e.g., `/en/` → `/fr/`)
9
- * 2. Template placeholders (e.g., `{{baseLocale}}` → `{{locale}}`, `{{baseLocaleName}}` → `{{localeName}}`)
10
- *
11
- * Replacement patterns:
12
- * - `/baseLocale/` → `/locale/`
13
- * - `\baseLocale\` → `\locale\`
14
- * - `_baseLocale.` → `_locale.`
15
- * - `baseLocale_` → `locale_`
16
- * - `.baseLocaleName.` → `.localeName.`
17
- * - `{{baseLocale}}` → `{{locale}}`
18
- * - `{{baseLocaleName}}` → `{{localeName}}`
19
- *
20
- * If no patterns match, appends `.locale` to the file extension.
21
- *
22
- * @param filePath - The input file path
23
- * @param locale - The target locale
24
- * @param baseLocale - The base locale to replace
25
- * @returns The output file path with locale replacements
26
- */
27
- const getOutputFilePath = (filePath, locale, baseLocale) => {
28
- if (!filePath || !locale || !baseLocale) throw new Error("filePath, locale, and baseLocale are required");
29
- let outputFilePath = filePath;
30
- const replacements = [
31
- {
32
- pattern: /\{\{baseLocale\}\}/g,
33
- replacement: "{{locale}}"
34
- },
35
- {
36
- pattern: /\{\{baseLocaleName\}\}/g,
37
- replacement: "{{localeName}}"
38
- },
39
- {
40
- pattern: new RegExp(`/${baseLocale}/`, "g"),
41
- replacement: `/${locale}/`
42
- },
43
- {
44
- pattern: new RegExp(`\\\\${baseLocale}\\\\`, "g"),
45
- replacement: `\\${locale}\\`
46
- },
47
- {
48
- pattern: new RegExp(`_${baseLocale}\\.`, "g"),
49
- replacement: `_${locale}.`
50
- },
51
- {
52
- pattern: new RegExp(`/${baseLocale}_`, "g"),
53
- replacement: `/${locale}_`
54
- },
55
- {
56
- pattern: new RegExp(`(^|[\\/])${baseLocale}_`, "g"),
57
- replacement: `$1${locale}_`
58
- },
59
- {
60
- pattern: new RegExp(`\\.${baseLocale}\\.`, "g"),
61
- replacement: `.${locale}.`
62
- }
63
- ];
64
- for (const { pattern, replacement } of replacements) outputFilePath = outputFilePath.replace(pattern, replacement);
65
- if (outputFilePath === filePath) {
66
- const lastDotIndex = filePath.lastIndexOf(".");
67
- if (lastDotIndex > 0) return `${filePath.slice(0, lastDotIndex)}.${locale}${filePath.slice(lastDotIndex)}`;
68
- else return `${filePath}.${locale}`;
69
- }
70
- return outputFilePath;
71
- };
72
-
73
- //#endregion
74
- exports.getOutputFilePath = getOutputFilePath;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=(e,t,n)=>{if(!e||!t||!n)throw Error(`filePath, locale, and baseLocale are required`);let r=e,i=[{pattern:/\{\{baseLocale\}\}/g,replacement:`{{locale}}`},{pattern:/\{\{baseLocaleName\}\}/g,replacement:`{{localeName}}`},{pattern:RegExp(`/${n}/`,`g`),replacement:`/${t}/`},{pattern:RegExp(`\\\\${n}\\\\`,`g`),replacement:`\\${t}\\`},{pattern:RegExp(`_${n}\\.`,`g`),replacement:`_${t}.`},{pattern:RegExp(`/${n}_`,`g`),replacement:`/${t}_`},{pattern:RegExp(`(^|[\\/])${n}_`,`g`),replacement:`$1${t}_`},{pattern:RegExp(`\\.${n}\\.`,`g`),replacement:`.${t}.`}];for(let{pattern:e,replacement:t}of i)r=r.replace(e,t);if(r===e){let n=e.lastIndexOf(`.`);return n>0?`${e.slice(0,n)}.${t}${e.slice(n)}`:`${e}.${t}`}return r};exports.getOutputFilePath=e;
75
2
  //# sourceMappingURL=getOutputFilePath.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"getOutputFilePath.cjs","names":[],"sources":["../../../src/utils/getOutputFilePath.ts"],"sourcesContent":["import type { LocalesValues } from '@intlayer/types';\n\n/**\n * Get the output file path by replacing the base locale with the target locale\n *\n * This function handles two types of replacements:\n * 1. Actual locale values (e.g., `/en/` → `/fr/`)\n * 2. Template placeholders (e.g., `{{baseLocale}}` → `{{locale}}`, `{{baseLocaleName}}` → `{{localeName}}`)\n *\n * Replacement patterns:\n * - `/baseLocale/` → `/locale/`\n * - `\\baseLocale\\` → `\\locale\\`\n * - `_baseLocale.` → `_locale.`\n * - `baseLocale_` → `locale_`\n * - `.baseLocaleName.` → `.localeName.`\n * - `{{baseLocale}}` → `{{locale}}`\n * - `{{baseLocaleName}}` → `{{localeName}}`\n *\n * If no patterns match, appends `.locale` to the file extension.\n *\n * @param filePath - The input file path\n * @param locale - The target locale\n * @param baseLocale - The base locale to replace\n * @returns The output file path with locale replacements\n */\nexport const getOutputFilePath = (\n filePath: string,\n locale: LocalesValues,\n baseLocale: LocalesValues\n): string => {\n if (!filePath || !locale || !baseLocale) {\n throw new Error('filePath, locale, and baseLocale are required');\n }\n\n let outputFilePath = filePath;\n\n // Define replacement patterns with global flag to replace all occurrences\n const replacements = [\n // Template placeholders (processed first)\n {\n pattern: /\\{\\{baseLocale\\}\\}/g,\n replacement: '{{locale}}',\n },\n {\n pattern: /\\{\\{baseLocaleName\\}\\}/g,\n replacement: '{{localeName}}',\n },\n\n // Path separators (most specific first)\n {\n // Unix path separators\n pattern: new RegExp(`/${baseLocale}/`, 'g'),\n replacement: `/${locale}/`,\n },\n {\n // Windows path separators\n pattern: new RegExp(`\\\\\\\\${baseLocale}\\\\\\\\`, 'g'),\n replacement: `\\\\${locale}\\\\`,\n },\n\n // File naming patterns\n {\n // file_en.md → file_fr.md\n pattern: new RegExp(`_${baseLocale}\\\\.`, 'g'),\n replacement: `_${locale}.`,\n },\n {\n // /file_en.md → /file_fr.md\n pattern: new RegExp(`/${baseLocale}_`, 'g'),\n replacement: `/${locale}_`,\n },\n {\n // Start of filename pattern en_guide.md → fr_guide.md (or after path separator)\n pattern: new RegExp(`(^|[\\\\/])${baseLocale}_`, 'g'),\n replacement: `$1${locale}_`,\n },\n {\n // Dot delimited pattern guide.en.md → guide.fr.md\n pattern: new RegExp(`\\\\.${baseLocale}\\\\.`, 'g'),\n replacement: `.${locale}.`,\n },\n ];\n\n // Apply all replacements\n for (const { pattern, replacement } of replacements) {\n outputFilePath = outputFilePath.replace(pattern, replacement);\n }\n\n // If no changes were made, append locale as extension\n if (outputFilePath === filePath) {\n const lastDotIndex = filePath.lastIndexOf('.');\n if (lastDotIndex > 0) {\n // Insert locale before the file extension\n return `${filePath.slice(0, lastDotIndex)}.${locale}${filePath.slice(lastDotIndex)}`;\n } else {\n // No extension found, just append\n return `${filePath}.${locale}`;\n }\n }\n\n return outputFilePath;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAyBA,MAAa,qBACX,UACA,QACA,eACW;AACX,KAAI,CAAC,YAAY,CAAC,UAAU,CAAC,WAC3B,OAAM,IAAI,MAAM,gDAAgD;CAGlE,IAAI,iBAAiB;CAGrB,MAAM,eAAe;EAEnB;GACE,SAAS;GACT,aAAa;GACd;EACD;GACE,SAAS;GACT,aAAa;GACd;EAGD;GAEE,SAAS,IAAI,OAAO,IAAI,WAAW,IAAI,IAAI;GAC3C,aAAa,IAAI,OAAO;GACzB;EACD;GAEE,SAAS,IAAI,OAAO,OAAO,WAAW,OAAO,IAAI;GACjD,aAAa,KAAK,OAAO;GAC1B;EAGD;GAEE,SAAS,IAAI,OAAO,IAAI,WAAW,MAAM,IAAI;GAC7C,aAAa,IAAI,OAAO;GACzB;EACD;GAEE,SAAS,IAAI,OAAO,IAAI,WAAW,IAAI,IAAI;GAC3C,aAAa,IAAI,OAAO;GACzB;EACD;GAEE,SAAS,IAAI,OAAO,YAAY,WAAW,IAAI,IAAI;GACnD,aAAa,KAAK,OAAO;GAC1B;EACD;GAEE,SAAS,IAAI,OAAO,MAAM,WAAW,MAAM,IAAI;GAC/C,aAAa,IAAI,OAAO;GACzB;EACF;AAGD,MAAK,MAAM,EAAE,SAAS,iBAAiB,aACrC,kBAAiB,eAAe,QAAQ,SAAS,YAAY;AAI/D,KAAI,mBAAmB,UAAU;EAC/B,MAAM,eAAe,SAAS,YAAY,IAAI;AAC9C,MAAI,eAAe,EAEjB,QAAO,GAAG,SAAS,MAAM,GAAG,aAAa,CAAC,GAAG,SAAS,SAAS,MAAM,aAAa;MAGlF,QAAO,GAAG,SAAS,GAAG;;AAI1B,QAAO"}
1
+ {"version":3,"file":"getOutputFilePath.cjs","names":[],"sources":["../../../src/utils/getOutputFilePath.ts"],"sourcesContent":["import type { LocalesValues } from '@intlayer/types';\n\n/**\n * Get the output file path by replacing the base locale with the target locale\n *\n * This function handles two types of replacements:\n * 1. Actual locale values (e.g., `/en/` → `/fr/`)\n * 2. Template placeholders (e.g., `{{baseLocale}}` → `{{locale}}`, `{{baseLocaleName}}` → `{{localeName}}`)\n *\n * Replacement patterns:\n * - `/baseLocale/` → `/locale/`\n * - `\\baseLocale\\` → `\\locale\\`\n * - `_baseLocale.` → `_locale.`\n * - `baseLocale_` → `locale_`\n * - `.baseLocaleName.` → `.localeName.`\n * - `{{baseLocale}}` → `{{locale}}`\n * - `{{baseLocaleName}}` → `{{localeName}}`\n *\n * If no patterns match, appends `.locale` to the file extension.\n *\n * @param filePath - The input file path\n * @param locale - The target locale\n * @param baseLocale - The base locale to replace\n * @returns The output file path with locale replacements\n */\nexport const getOutputFilePath = (\n filePath: string,\n locale: LocalesValues,\n baseLocale: LocalesValues\n): string => {\n if (!filePath || !locale || !baseLocale) {\n throw new Error('filePath, locale, and baseLocale are required');\n }\n\n let outputFilePath = filePath;\n\n // Define replacement patterns with global flag to replace all occurrences\n const replacements = [\n // Template placeholders (processed first)\n {\n pattern: /\\{\\{baseLocale\\}\\}/g,\n replacement: '{{locale}}',\n },\n {\n pattern: /\\{\\{baseLocaleName\\}\\}/g,\n replacement: '{{localeName}}',\n },\n\n // Path separators (most specific first)\n {\n // Unix path separators\n pattern: new RegExp(`/${baseLocale}/`, 'g'),\n replacement: `/${locale}/`,\n },\n {\n // Windows path separators\n pattern: new RegExp(`\\\\\\\\${baseLocale}\\\\\\\\`, 'g'),\n replacement: `\\\\${locale}\\\\`,\n },\n\n // File naming patterns\n {\n // file_en.md → file_fr.md\n pattern: new RegExp(`_${baseLocale}\\\\.`, 'g'),\n replacement: `_${locale}.`,\n },\n {\n // /file_en.md → /file_fr.md\n pattern: new RegExp(`/${baseLocale}_`, 'g'),\n replacement: `/${locale}_`,\n },\n {\n // Start of filename pattern en_guide.md → fr_guide.md (or after path separator)\n pattern: new RegExp(`(^|[\\\\/])${baseLocale}_`, 'g'),\n replacement: `$1${locale}_`,\n },\n {\n // Dot delimited pattern guide.en.md → guide.fr.md\n pattern: new RegExp(`\\\\.${baseLocale}\\\\.`, 'g'),\n replacement: `.${locale}.`,\n },\n ];\n\n // Apply all replacements\n for (const { pattern, replacement } of replacements) {\n outputFilePath = outputFilePath.replace(pattern, replacement);\n }\n\n // If no changes were made, append locale as extension\n if (outputFilePath === filePath) {\n const lastDotIndex = filePath.lastIndexOf('.');\n if (lastDotIndex > 0) {\n // Insert locale before the file extension\n return `${filePath.slice(0, lastDotIndex)}.${locale}${filePath.slice(lastDotIndex)}`;\n } else {\n // No extension found, just append\n return `${filePath}.${locale}`;\n }\n }\n\n return outputFilePath;\n};\n"],"mappings":"mEAyBA,MAAa,GACX,EACA,EACA,IACW,CACX,GAAI,CAAC,GAAY,CAAC,GAAU,CAAC,EAC3B,MAAU,MAAM,gDAAgD,CAGlE,IAAI,EAAiB,EAGf,EAAe,CAEnB,CACE,QAAS,sBACT,YAAa,aACd,CACD,CACE,QAAS,0BACT,YAAa,iBACd,CAGD,CAEE,QAAa,OAAO,IAAI,EAAW,GAAI,IAAI,CAC3C,YAAa,IAAI,EAAO,GACzB,CACD,CAEE,QAAa,OAAO,OAAO,EAAW,MAAO,IAAI,CACjD,YAAa,KAAK,EAAO,IAC1B,CAGD,CAEE,QAAa,OAAO,IAAI,EAAW,KAAM,IAAI,CAC7C,YAAa,IAAI,EAAO,GACzB,CACD,CAEE,QAAa,OAAO,IAAI,EAAW,GAAI,IAAI,CAC3C,YAAa,IAAI,EAAO,GACzB,CACD,CAEE,QAAa,OAAO,YAAY,EAAW,GAAI,IAAI,CACnD,YAAa,KAAK,EAAO,GAC1B,CACD,CAEE,QAAa,OAAO,MAAM,EAAW,KAAM,IAAI,CAC/C,YAAa,IAAI,EAAO,GACzB,CACF,CAGD,IAAK,GAAM,CAAE,UAAS,iBAAiB,EACrC,EAAiB,EAAe,QAAQ,EAAS,EAAY,CAI/D,GAAI,IAAmB,EAAU,CAC/B,IAAM,EAAe,EAAS,YAAY,IAAI,CAM5C,OALE,EAAe,EAEV,GAAG,EAAS,MAAM,EAAG,EAAa,CAAC,GAAG,IAAS,EAAS,MAAM,EAAa,GAG3E,GAAG,EAAS,GAAG,IAI1B,OAAO"}
@@ -1,21 +1,2 @@
1
- Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
3
- let node_path = require("node:path");
4
- let node_fs = require("node:fs");
5
-
6
- //#region src/utils/getParentPackageJSON.ts
7
- const getParentPackageJSON = (startDir) => {
8
- let currentDir = startDir;
9
- while (currentDir !== (0, node_path.dirname)(currentDir)) {
10
- const packageJsonPath = (0, node_path.resolve)(currentDir, "package.json");
11
- if ((0, node_fs.existsSync)(packageJsonPath)) return JSON.parse((0, node_fs.readFileSync)(packageJsonPath, "utf8"));
12
- currentDir = (0, node_path.dirname)(currentDir);
13
- }
14
- const rootPackageJsonPath = (0, node_path.resolve)(currentDir, "package.json");
15
- if ((0, node_fs.existsSync)(rootPackageJsonPath)) return JSON.parse((0, node_fs.readFileSync)(rootPackageJsonPath, "utf8"));
16
- throw new Error(`No package.json found in any parent directory of ${startDir}`);
17
- };
18
-
19
- //#endregion
20
- exports.getParentPackageJSON = getParentPackageJSON;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`../_virtual/_rolldown/runtime.cjs`);let e=require(`node:path`),t=require(`node:fs`);const n=n=>{let r=n;for(;r!==(0,e.dirname)(r);){let n=(0,e.resolve)(r,`package.json`);if((0,t.existsSync)(n))return JSON.parse((0,t.readFileSync)(n,`utf8`));r=(0,e.dirname)(r)}let i=(0,e.resolve)(r,`package.json`);if((0,t.existsSync)(i))return JSON.parse((0,t.readFileSync)(i,`utf8`));throw Error(`No package.json found in any parent directory of ${n}`)};exports.getParentPackageJSON=n;
21
2
  //# sourceMappingURL=getParentPackageJSON.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"getParentPackageJSON.cjs","names":[],"sources":["../../../src/utils/getParentPackageJSON.ts"],"sourcesContent":["import { existsSync, readFileSync } from 'node:fs';\nimport { dirname, resolve } from 'node:path';\n\ntype PackageJSON = {\n name?: string;\n version?: string;\n private: boolean;\n description?: string;\n homepage?: string;\n bugs: {\n url?: string;\n };\n repository: {\n type?: string;\n url?: string;\n };\n license?: string;\n author: {\n name?: string;\n url?: string;\n };\n contributors?: {\n name?: string;\n email?: string;\n url?: string;\n }[];\n type?: string;\n scripts: Record<string, string>;\n devDependencies: Record<string, string>;\n packageManager?: string;\n engines: Record<string, string>;\n};\n\nexport const getParentPackageJSON = (startDir: string): PackageJSON => {\n let currentDir = startDir;\n\n while (currentDir !== dirname(currentDir)) {\n // Stop when we reach the root\n const packageJsonPath = resolve(currentDir, 'package.json');\n\n if (existsSync(packageJsonPath)) {\n return JSON.parse(readFileSync(packageJsonPath, 'utf8'));\n }\n\n // Move up one directory level\n currentDir = dirname(currentDir);\n }\n\n // Check the root directory as well\n const rootPackageJsonPath = resolve(currentDir, 'package.json');\n if (existsSync(rootPackageJsonPath)) {\n return JSON.parse(readFileSync(rootPackageJsonPath, 'utf8'));\n }\n\n // If no package.json is found in any parent directory\n throw new Error(\n `No package.json found in any parent directory of ${startDir}`\n );\n};\n"],"mappings":";;;;;;AAiCA,MAAa,wBAAwB,aAAkC;CACrE,IAAI,aAAa;AAEjB,QAAO,sCAAuB,WAAW,EAAE;EAEzC,MAAM,yCAA0B,YAAY,eAAe;AAE3D,8BAAe,gBAAgB,CAC7B,QAAO,KAAK,gCAAmB,iBAAiB,OAAO,CAAC;AAI1D,sCAAqB,WAAW;;CAIlC,MAAM,6CAA8B,YAAY,eAAe;AAC/D,6BAAe,oBAAoB,CACjC,QAAO,KAAK,gCAAmB,qBAAqB,OAAO,CAAC;AAI9D,OAAM,IAAI,MACR,oDAAoD,WACrD"}
1
+ {"version":3,"file":"getParentPackageJSON.cjs","names":[],"sources":["../../../src/utils/getParentPackageJSON.ts"],"sourcesContent":["import { existsSync, readFileSync } from 'node:fs';\nimport { dirname, resolve } from 'node:path';\n\ntype PackageJSON = {\n name?: string;\n version?: string;\n private: boolean;\n description?: string;\n homepage?: string;\n bugs: {\n url?: string;\n };\n repository: {\n type?: string;\n url?: string;\n };\n license?: string;\n author: {\n name?: string;\n url?: string;\n };\n contributors?: {\n name?: string;\n email?: string;\n url?: string;\n }[];\n type?: string;\n scripts: Record<string, string>;\n devDependencies: Record<string, string>;\n packageManager?: string;\n engines: Record<string, string>;\n};\n\nexport const getParentPackageJSON = (startDir: string): PackageJSON => {\n let currentDir = startDir;\n\n while (currentDir !== dirname(currentDir)) {\n // Stop when we reach the root\n const packageJsonPath = resolve(currentDir, 'package.json');\n\n if (existsSync(packageJsonPath)) {\n return JSON.parse(readFileSync(packageJsonPath, 'utf8'));\n }\n\n // Move up one directory level\n currentDir = dirname(currentDir);\n }\n\n // Check the root directory as well\n const rootPackageJsonPath = resolve(currentDir, 'package.json');\n if (existsSync(rootPackageJsonPath)) {\n return JSON.parse(readFileSync(rootPackageJsonPath, 'utf8'));\n }\n\n // If no package.json is found in any parent directory\n throw new Error(\n `No package.json found in any parent directory of ${startDir}`\n );\n};\n"],"mappings":"gKAiCA,MAAa,EAAwB,GAAkC,CACrE,IAAI,EAAa,EAEjB,KAAO,KAAA,EAAA,EAAA,SAAuB,EAAW,EAAE,CAEzC,IAAM,GAAA,EAAA,EAAA,SAA0B,EAAY,eAAe,CAE3D,IAAA,EAAA,EAAA,YAAe,EAAgB,CAC7B,OAAO,KAAK,OAAA,EAAA,EAAA,cAAmB,EAAiB,OAAO,CAAC,CAI1D,GAAA,EAAA,EAAA,SAAqB,EAAW,CAIlC,IAAM,GAAA,EAAA,EAAA,SAA8B,EAAY,eAAe,CAC/D,IAAA,EAAA,EAAA,YAAe,EAAoB,CACjC,OAAO,KAAK,OAAA,EAAA,EAAA,cAAmB,EAAqB,OAAO,CAAC,CAI9D,MAAU,MACR,oDAAoD,IACrD"}
@@ -1,55 +1,3 @@
1
- Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
-
3
- //#region src/utils/listSpecialChars.ts
4
- const SPECIAL_CHARS = [
5
- " ",
6
- "\\",
7
- "|",
8
- "(",
9
- ")",
10
- "{",
11
- "}",
12
- "[",
13
- "]",
14
- "<",
15
- ">",
16
- "\"",
17
- "=",
18
- "+",
19
- "*",
20
- "&",
21
- "#",
22
- "%",
23
- "$",
24
- "!",
25
- "?",
26
- ":",
27
- ";",
28
- "~"
29
- ];
30
- const listSpecialChars = (text) => {
31
- const results = [];
32
- let lineIndex = 0;
33
- for (let i = 0; i < text.length; i++) {
34
- const currentChar = text[i];
35
- if (currentChar === "\n") {
36
- results.push({
37
- char: "\\",
38
- lineStart: lineIndex,
39
- charStart: i
40
- });
41
- lineIndex++;
42
- continue;
43
- }
44
- if (SPECIAL_CHARS.includes(currentChar)) results.push({
45
- char: currentChar,
46
- lineStart: lineIndex,
47
- charStart: i
48
- });
49
- }
50
- return results;
51
- };
52
-
53
- //#endregion
54
- exports.listSpecialChars = listSpecialChars;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=[` `,`\\`,`|`,`(`,`)`,`{`,`}`,`[`,`]`,`<`,`>`,`"`,`=`,`+`,`*`,`&`,`#`,`%`,`$`,`!`,`?`,`:`,`;`,`~`],t=t=>{let n=[],r=0;for(let i=0;i<t.length;i++){let a=t[i];if(a===`
2
+ `){n.push({char:`\\`,lineStart:r,charStart:i}),r++;continue}e.includes(a)&&n.push({char:a,lineStart:r,charStart:i})}return n};exports.listSpecialChars=t;
55
3
  //# sourceMappingURL=listSpecialChars.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"listSpecialChars.cjs","names":[],"sources":["../../../src/utils/listSpecialChars.ts"],"sourcesContent":["type ListCharResult = {\n char: string;\n /** First line index contained in this chunk (0-based) */\n lineStart: number;\n /** Start character index in the original text (0-based, inclusive)*/\n charStart: number;\n}[];\n\nconst SPECIAL_CHARS = [\n ' ',\n '\\\\',\n '|',\n '(',\n ')',\n '{',\n '}',\n '[',\n ']',\n '<',\n '>',\n '\"',\n '=',\n '+',\n '*',\n '&',\n '#',\n '%',\n '$',\n '!',\n '?',\n ':',\n ';',\n '~',\n];\n\nexport const listSpecialChars = (text: string): ListCharResult => {\n const results: ListCharResult = [];\n\n let lineIndex = 0;\n\n for (let i = 0; i < text.length; i++) {\n const currentChar = text[i];\n\n // Handle newline characters (\"\\n\"): treat them as a \"\\\\\" special char\n if (currentChar === '\\n') {\n results.push({\n char: '\\\\',\n lineStart: lineIndex,\n charStart: i,\n });\n\n // Move to the next line after recording the special char\n lineIndex++;\n continue;\n }\n\n // Check if the current character is one of the special characters\n if (SPECIAL_CHARS.includes(currentChar)) {\n results.push({\n char: currentChar,\n lineStart: lineIndex,\n charStart: i,\n });\n }\n }\n\n return results;\n};\n"],"mappings":";;;AAQA,MAAM,gBAAgB;CACpB;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACD;AAED,MAAa,oBAAoB,SAAiC;CAChE,MAAM,UAA0B,EAAE;CAElC,IAAI,YAAY;AAEhB,MAAK,IAAI,IAAI,GAAG,IAAI,KAAK,QAAQ,KAAK;EACpC,MAAM,cAAc,KAAK;AAGzB,MAAI,gBAAgB,MAAM;AACxB,WAAQ,KAAK;IACX,MAAM;IACN,WAAW;IACX,WAAW;IACZ,CAAC;AAGF;AACA;;AAIF,MAAI,cAAc,SAAS,YAAY,CACrC,SAAQ,KAAK;GACX,MAAM;GACN,WAAW;GACX,WAAW;GACZ,CAAC;;AAIN,QAAO"}
1
+ {"version":3,"file":"listSpecialChars.cjs","names":[],"sources":["../../../src/utils/listSpecialChars.ts"],"sourcesContent":["type ListCharResult = {\n char: string;\n /** First line index contained in this chunk (0-based) */\n lineStart: number;\n /** Start character index in the original text (0-based, inclusive)*/\n charStart: number;\n}[];\n\nconst SPECIAL_CHARS = [\n ' ',\n '\\\\',\n '|',\n '(',\n ')',\n '{',\n '}',\n '[',\n ']',\n '<',\n '>',\n '\"',\n '=',\n '+',\n '*',\n '&',\n '#',\n '%',\n '$',\n '!',\n '?',\n ':',\n ';',\n '~',\n];\n\nexport const listSpecialChars = (text: string): ListCharResult => {\n const results: ListCharResult = [];\n\n let lineIndex = 0;\n\n for (let i = 0; i < text.length; i++) {\n const currentChar = text[i];\n\n // Handle newline characters (\"\\n\"): treat them as a \"\\\\\" special char\n if (currentChar === '\\n') {\n results.push({\n char: '\\\\',\n lineStart: lineIndex,\n charStart: i,\n });\n\n // Move to the next line after recording the special char\n lineIndex++;\n continue;\n }\n\n // Check if the current character is one of the special characters\n if (SPECIAL_CHARS.includes(currentChar)) {\n results.push({\n char: currentChar,\n lineStart: lineIndex,\n charStart: i,\n });\n }\n }\n\n return results;\n};\n"],"mappings":"mEAQA,MAAM,EAAgB,CACpB,KACA,KACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACD,CAEY,EAAoB,GAAiC,CAChE,IAAM,EAA0B,EAAE,CAE9B,EAAY,EAEhB,IAAK,IAAI,EAAI,EAAG,EAAI,EAAK,OAAQ,IAAK,CACpC,IAAM,EAAc,EAAK,GAGzB,GAAI,IAAgB;EAAM,CACxB,EAAQ,KAAK,CACX,KAAM,KACN,UAAW,EACX,UAAW,EACZ,CAAC,CAGF,IACA,SAIE,EAAc,SAAS,EAAY,EACrC,EAAQ,KAAK,CACX,KAAM,EACN,UAAW,EACX,UAAW,EACZ,CAAC,CAIN,OAAO"}