gt 2.14.35 → 2.14.36

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 (429) hide show
  1. package/CHANGELOG.md +16 -1
  2. package/dist/api/collectUserEditDiffs.js +112 -155
  3. package/dist/api/collectUserEditDiffs.js.map +1 -0
  4. package/dist/api/downloadFileBatch.js +164 -241
  5. package/dist/api/downloadFileBatch.js.map +1 -0
  6. package/dist/api/saveLocalEdits.js +37 -41
  7. package/dist/api/saveLocalEdits.js.map +1 -0
  8. package/dist/bin/bin-entry.js +17 -7
  9. package/dist/bin/bin-entry.js.map +1 -0
  10. package/dist/bin/bin-main.js +43 -61
  11. package/dist/bin/bin-main.js.map +1 -0
  12. package/dist/cli/base.js +382 -497
  13. package/dist/cli/base.js.map +1 -0
  14. package/dist/cli/commands/download.js +41 -49
  15. package/dist/cli/commands/download.js.map +1 -0
  16. package/dist/cli/commands/enqueue.js +26 -25
  17. package/dist/cli/commands/enqueue.js.map +1 -0
  18. package/dist/cli/commands/setupProject.js +33 -36
  19. package/dist/cli/commands/setupProject.js.map +1 -0
  20. package/dist/cli/commands/stage.js +53 -61
  21. package/dist/cli/commands/stage.js.map +1 -0
  22. package/dist/cli/commands/translate.js +75 -112
  23. package/dist/cli/commands/translate.js.map +1 -0
  24. package/dist/cli/commands/upload.js +185 -213
  25. package/dist/cli/commands/upload.js.map +1 -0
  26. package/dist/cli/commands/utils/validation.js +39 -34
  27. package/dist/cli/commands/utils/validation.js.map +1 -0
  28. package/dist/cli/flags.js +35 -62
  29. package/dist/cli/flags.js.map +1 -0
  30. package/dist/cli/inline.js +112 -137
  31. package/dist/cli/inline.js.map +1 -0
  32. package/dist/cli/next.js +17 -12
  33. package/dist/cli/next.js.map +1 -0
  34. package/dist/cli/node.js +19 -15
  35. package/dist/cli/node.js.map +1 -0
  36. package/dist/cli/python.js +13 -8
  37. package/dist/cli/python.js.map +1 -0
  38. package/dist/cli/react.js +61 -78
  39. package/dist/cli/react.js.map +1 -0
  40. package/dist/config/defaults.js +16 -11
  41. package/dist/config/defaults.js.map +1 -0
  42. package/dist/config/generateSettings.js +167 -269
  43. package/dist/config/generateSettings.js.map +1 -0
  44. package/dist/config/optionPresets.js +78 -96
  45. package/dist/config/optionPresets.js.map +1 -0
  46. package/dist/config/resolveConfig.js +27 -32
  47. package/dist/config/resolveConfig.js.map +1 -0
  48. package/dist/config/utils.js +7 -3
  49. package/dist/config/utils.js.map +1 -0
  50. package/dist/config/validateSettings.js +19 -30
  51. package/dist/config/validateSettings.js.map +1 -0
  52. package/dist/console/colors.js +18 -13
  53. package/dist/console/colors.js.map +1 -0
  54. package/dist/console/displayTranslateSummary.js +40 -37
  55. package/dist/console/displayTranslateSummary.js.map +1 -0
  56. package/dist/console/formatting.js +8 -5
  57. package/dist/console/formatting.js.map +1 -0
  58. package/dist/console/index.d.ts +11 -9
  59. package/dist/console/index.js +53 -50
  60. package/dist/console/index.js.map +1 -0
  61. package/dist/console/inkFields.d.ts +23 -0
  62. package/dist/console/inkFields.js +87 -0
  63. package/dist/console/inkFields.js.map +1 -0
  64. package/dist/console/inkLayout.d.ts +7 -0
  65. package/dist/console/inkLayout.js +139 -0
  66. package/dist/console/inkLayout.js.map +1 -0
  67. package/dist/console/inkLocaleData.d.ts +4 -0
  68. package/dist/console/inkLocaleData.js +32 -0
  69. package/dist/console/inkLocaleData.js.map +1 -0
  70. package/dist/console/inkPrompts.d.ts +8 -0
  71. package/dist/console/inkPrompts.js +496 -0
  72. package/dist/console/inkPrompts.js.map +1 -0
  73. package/dist/console/inkSession.d.ts +3 -0
  74. package/dist/console/inkSession.js +42 -0
  75. package/dist/console/inkSession.js.map +1 -0
  76. package/dist/console/inkTerminal.d.ts +4 -0
  77. package/dist/console/inkTerminal.js +15 -0
  78. package/dist/console/inkTerminal.js.map +1 -0
  79. package/dist/console/inkTypes.d.ts +66 -0
  80. package/dist/console/inkTypes.js +1 -0
  81. package/dist/console/inkUtils.d.ts +24 -0
  82. package/dist/console/inkUtils.js +87 -0
  83. package/dist/console/inkUtils.js.map +1 -0
  84. package/dist/console/logger.js +209 -249
  85. package/dist/console/logger.js.map +1 -0
  86. package/dist/console/logging.d.ts +14 -0
  87. package/dist/console/logging.js +203 -162
  88. package/dist/console/logging.js.map +1 -0
  89. package/dist/console/promptParsing.d.ts +5 -0
  90. package/dist/console/promptParsing.js +28 -0
  91. package/dist/console/promptParsing.js.map +1 -0
  92. package/dist/console/terminalSession.d.ts +5 -0
  93. package/dist/console/terminalSession.js +38 -0
  94. package/dist/console/terminalSession.js.map +1 -0
  95. package/dist/extraction/index.js +3 -2
  96. package/dist/extraction/mapToUpdates.js +19 -18
  97. package/dist/extraction/mapToUpdates.js.map +1 -0
  98. package/dist/extraction/postProcess.js +68 -86
  99. package/dist/extraction/postProcess.js.map +1 -0
  100. package/dist/formats/files/aggregateFiles.js +223 -304
  101. package/dist/formats/files/aggregateFiles.js.map +1 -0
  102. package/dist/formats/files/collectFiles.js +53 -54
  103. package/dist/formats/files/collectFiles.js.map +1 -0
  104. package/dist/formats/files/convertToFileTranslationData.js +21 -19
  105. package/dist/formats/files/convertToFileTranslationData.js.map +1 -0
  106. package/dist/formats/files/fileMapping.js +82 -119
  107. package/dist/formats/files/fileMapping.js.map +1 -0
  108. package/dist/formats/files/preprocess/mdx.js +15 -12
  109. package/dist/formats/files/preprocess/mdx.js.map +1 -0
  110. package/dist/formats/files/preprocess/mintlify.js +15 -13
  111. package/dist/formats/files/preprocess/mintlify.js.map +1 -0
  112. package/dist/formats/files/preprocessContent.js +20 -21
  113. package/dist/formats/files/preprocessContent.js.map +1 -0
  114. package/dist/formats/files/save.js +18 -15
  115. package/dist/formats/files/save.js.map +1 -0
  116. package/dist/formats/files/supportedFiles.js +27 -22
  117. package/dist/formats/files/supportedFiles.js.map +1 -0
  118. package/dist/formats/files/transformFormat.js +93 -100
  119. package/dist/formats/files/transformFormat.js.map +1 -0
  120. package/dist/formats/json/extractJson.js +83 -110
  121. package/dist/formats/json/extractJson.js.map +1 -0
  122. package/dist/formats/json/flattenJson.js +41 -48
  123. package/dist/formats/json/flattenJson.js.map +1 -0
  124. package/dist/formats/json/jsonPath.js +20 -15
  125. package/dist/formats/json/jsonPath.js.map +1 -0
  126. package/dist/formats/json/jsonPointer.js +17 -17
  127. package/dist/formats/json/jsonPointer.js.map +1 -0
  128. package/dist/formats/json/mergeJson.js +230 -371
  129. package/dist/formats/json/mergeJson.js.map +1 -0
  130. package/dist/formats/json/parseJson.js +74 -111
  131. package/dist/formats/json/parseJson.js.map +1 -0
  132. package/dist/formats/json/transformJson.js +53 -61
  133. package/dist/formats/json/transformJson.js.map +1 -0
  134. package/dist/formats/json/utils.js +158 -187
  135. package/dist/formats/json/utils.js.map +1 -0
  136. package/dist/formats/parseKeyedMetadata.js +85 -106
  137. package/dist/formats/parseKeyedMetadata.js.map +1 -0
  138. package/dist/formats/utils.js +13 -23
  139. package/dist/formats/utils.js.map +1 -0
  140. package/dist/formats/yaml/extractYaml.js +32 -31
  141. package/dist/formats/yaml/extractYaml.js.map +1 -0
  142. package/dist/formats/yaml/mergeYaml.js +43 -60
  143. package/dist/formats/yaml/mergeYaml.js.map +1 -0
  144. package/dist/formats/yaml/parseYaml.js +34 -23
  145. package/dist/formats/yaml/parseYaml.js.map +1 -0
  146. package/dist/formats/yaml/utils.js +19 -21
  147. package/dist/formats/yaml/utils.js.map +1 -0
  148. package/dist/fs/clearLocaleDirs.js +82 -114
  149. package/dist/fs/clearLocaleDirs.js.map +1 -0
  150. package/dist/fs/config/downloadedVersions.js +174 -188
  151. package/dist/fs/config/downloadedVersions.js.map +1 -0
  152. package/dist/fs/config/loadConfig.js +12 -8
  153. package/dist/fs/config/loadConfig.js.map +1 -0
  154. package/dist/fs/config/parseFilesConfig.js +166 -227
  155. package/dist/fs/config/parseFilesConfig.js.map +1 -0
  156. package/dist/fs/config/setupConfig.js +43 -52
  157. package/dist/fs/config/setupConfig.js.map +1 -0
  158. package/dist/fs/config/updateConfig.js +44 -56
  159. package/dist/fs/config/updateConfig.js.map +1 -0
  160. package/dist/fs/config/updateVersions.js +27 -28
  161. package/dist/fs/config/updateVersions.js.map +1 -0
  162. package/dist/fs/copyFile.js +33 -37
  163. package/dist/fs/copyFile.js.map +1 -0
  164. package/dist/fs/createLoadTranslationsFile.js +32 -48
  165. package/dist/fs/createLoadTranslationsFile.js.map +1 -0
  166. package/dist/fs/determineFramework/detectPythonLibrary.js +30 -34
  167. package/dist/fs/determineFramework/detectPythonLibrary.js.map +1 -0
  168. package/dist/fs/determineFramework/index.js +46 -64
  169. package/dist/fs/determineFramework/index.js.map +1 -0
  170. package/dist/fs/determineFramework/matchPyprojectDependency.js +65 -78
  171. package/dist/fs/determineFramework/matchPyprojectDependency.js.map +1 -0
  172. package/dist/fs/determineFramework/matchRequirementsTxtDependency.js +21 -19
  173. package/dist/fs/determineFramework/matchRequirementsTxtDependency.js.map +1 -0
  174. package/dist/fs/determineFramework/matchSetupPyDependency.js +60 -81
  175. package/dist/fs/determineFramework/matchSetupPyDependency.js.map +1 -0
  176. package/dist/fs/determineFramework/resolveGtDependency.js +15 -15
  177. package/dist/fs/determineFramework/resolveGtDependency.js.map +1 -0
  178. package/dist/fs/findFilepath.js +63 -78
  179. package/dist/fs/findFilepath.js.map +1 -0
  180. package/dist/fs/loadJSON.js +18 -15
  181. package/dist/fs/loadJSON.js.map +1 -0
  182. package/dist/fs/matchFiles.js +12 -7
  183. package/dist/fs/matchFiles.js.map +1 -0
  184. package/dist/fs/saveJSON.js +10 -6
  185. package/dist/fs/saveJSON.js.map +1 -0
  186. package/dist/fs/utils.js +19 -15
  187. package/dist/fs/utils.js.map +1 -0
  188. package/dist/functions.d.ts +2 -1
  189. package/dist/functions.js +3 -6
  190. package/dist/generated/version.d.ts +1 -1
  191. package/dist/generated/version.js +6 -2
  192. package/dist/generated/version.js.map +1 -0
  193. package/dist/git/branches.js +77 -83
  194. package/dist/git/branches.js.map +1 -0
  195. package/dist/hooks/postProcess.js +97 -114
  196. package/dist/hooks/postProcess.js.map +1 -0
  197. package/dist/index.js +23 -31
  198. package/dist/index.js.map +1 -0
  199. package/dist/locadex/setupFlow.js +11 -8
  200. package/dist/locadex/setupFlow.js.map +1 -0
  201. package/dist/main.js +17 -7
  202. package/dist/main.js.map +1 -0
  203. package/dist/next/config/parseNextConfig.js +32 -51
  204. package/dist/next/config/parseNextConfig.js.map +1 -0
  205. package/dist/next/jsx/utils.js +25 -37
  206. package/dist/next/jsx/utils.js.map +1 -0
  207. package/dist/next/parse/handleInitGT.js +87 -154
  208. package/dist/next/parse/handleInitGT.js.map +1 -0
  209. package/dist/next/parse/wrapContent.js +136 -158
  210. package/dist/next/parse/wrapContent.js.map +1 -0
  211. package/dist/python/parse/createPythonInlineUpdates.js +36 -33
  212. package/dist/python/parse/createPythonInlineUpdates.js.map +1 -0
  213. package/dist/react/config/createESBuildConfig.js +115 -115
  214. package/dist/react/config/createESBuildConfig.js.map +1 -0
  215. package/dist/react/jsx/evaluateJsx.js +90 -124
  216. package/dist/react/jsx/evaluateJsx.js.map +1 -0
  217. package/dist/react/jsx/utils/buildImportMap.js +24 -28
  218. package/dist/react/jsx/utils/buildImportMap.js.map +1 -0
  219. package/dist/react/jsx/utils/constants.js +79 -87
  220. package/dist/react/jsx/utils/constants.js.map +1 -0
  221. package/dist/react/jsx/utils/extractSourceCode.js +36 -37
  222. package/dist/react/jsx/utils/extractSourceCode.js.map +1 -0
  223. package/dist/react/jsx/utils/getCalleeNameFromExpression.js +30 -30
  224. package/dist/react/jsx/utils/getCalleeNameFromExpression.js.map +1 -0
  225. package/dist/react/jsx/utils/getPathsAndAliases.js +70 -105
  226. package/dist/react/jsx/utils/getPathsAndAliases.js.map +1 -0
  227. package/dist/react/jsx/utils/isNumberLiteral.js +13 -11
  228. package/dist/react/jsx/utils/isNumberLiteral.js.map +1 -0
  229. package/dist/react/jsx/utils/jsxParsing/addGTIdentifierToSyntaxTree.js +103 -148
  230. package/dist/react/jsx/utils/jsxParsing/addGTIdentifierToSyntaxTree.js.map +1 -0
  231. package/dist/react/jsx/utils/jsxParsing/autoInsertion.js +305 -389
  232. package/dist/react/jsx/utils/jsxParsing/autoInsertion.js.map +1 -0
  233. package/dist/react/jsx/utils/jsxParsing/handleChildrenWhitespace.js +122 -193
  234. package/dist/react/jsx/utils/jsxParsing/handleChildrenWhitespace.js.map +1 -0
  235. package/dist/react/jsx/utils/jsxParsing/multiplication/findMultiplicationNode.js +50 -64
  236. package/dist/react/jsx/utils/jsxParsing/multiplication/findMultiplicationNode.js.map +1 -0
  237. package/dist/react/jsx/utils/jsxParsing/multiplication/multiplyJsxTree.js +41 -68
  238. package/dist/react/jsx/utils/jsxParsing/multiplication/multiplyJsxTree.js.map +1 -0
  239. package/dist/react/jsx/utils/jsxParsing/parseJsx.js +760 -1107
  240. package/dist/react/jsx/utils/jsxParsing/parseJsx.js.map +1 -0
  241. package/dist/react/jsx/utils/jsxParsing/parseTProps.js +35 -71
  242. package/dist/react/jsx/utils/jsxParsing/parseTProps.js.map +1 -0
  243. package/dist/react/jsx/utils/jsxParsing/removeNullChildrenFields.js +39 -58
  244. package/dist/react/jsx/utils/jsxParsing/removeNullChildrenFields.js.map +1 -0
  245. package/dist/react/jsx/utils/jsxParsing/types.js +10 -24
  246. package/dist/react/jsx/utils/jsxParsing/types.js.map +1 -0
  247. package/dist/react/jsx/utils/mapAttributeName.js +13 -13
  248. package/dist/react/jsx/utils/mapAttributeName.js.map +1 -0
  249. package/dist/react/jsx/utils/parseAst.js +142 -272
  250. package/dist/react/jsx/utils/parseAst.js.map +1 -0
  251. package/dist/react/jsx/utils/parseString.js +726 -1090
  252. package/dist/react/jsx/utils/parseString.js.map +1 -0
  253. package/dist/react/jsx/utils/parseStringFunction.js +274 -401
  254. package/dist/react/jsx/utils/parseStringFunction.js.map +1 -0
  255. package/dist/react/jsx/utils/resolveImportPath.js +104 -108
  256. package/dist/react/jsx/utils/resolveImportPath.js.map +1 -0
  257. package/dist/react/jsx/utils/stringParsing/derivation/containsDeriveCall.js +18 -24
  258. package/dist/react/jsx/utils/stringParsing/derivation/containsDeriveCall.js.map +1 -0
  259. package/dist/react/jsx/utils/stringParsing/derivation/handleDerivation.js +412 -579
  260. package/dist/react/jsx/utils/stringParsing/derivation/handleDerivation.js.map +1 -0
  261. package/dist/react/jsx/utils/stringParsing/derivation/index.js +57 -67
  262. package/dist/react/jsx/utils/stringParsing/derivation/index.js.map +1 -0
  263. package/dist/react/jsx/utils/stringParsing/derivation/isDeriveCall.js +26 -36
  264. package/dist/react/jsx/utils/stringParsing/derivation/isDeriveCall.js.map +1 -0
  265. package/dist/react/jsx/utils/stringParsing/processTaggedTemplateCall/handleTaggedTemplateTranslationCall.js +29 -24
  266. package/dist/react/jsx/utils/stringParsing/processTaggedTemplateCall/handleTaggedTemplateTranslationCall.js.map +1 -0
  267. package/dist/react/jsx/utils/stringParsing/processTaggedTemplateCall/index.js +34 -32
  268. package/dist/react/jsx/utils/stringParsing/processTaggedTemplateCall/index.js.map +1 -0
  269. package/dist/react/jsx/utils/stringParsing/processTranslationCall/extractStringEntryMetadata.js +80 -117
  270. package/dist/react/jsx/utils/stringParsing/processTranslationCall/extractStringEntryMetadata.js.map +1 -0
  271. package/dist/react/jsx/utils/stringParsing/processTranslationCall/handleDeriveTranslationCall.js +24 -19
  272. package/dist/react/jsx/utils/stringParsing/processTranslationCall/handleDeriveTranslationCall.js.map +1 -0
  273. package/dist/react/jsx/utils/stringParsing/processTranslationCall/handleInvalidTranslationCall.js +18 -21
  274. package/dist/react/jsx/utils/stringParsing/processTranslationCall/handleInvalidTranslationCall.js.map +1 -0
  275. package/dist/react/jsx/utils/stringParsing/processTranslationCall/handleLiteralTranslationCall.js +45 -50
  276. package/dist/react/jsx/utils/stringParsing/processTranslationCall/handleLiteralTranslationCall.js.map +1 -0
  277. package/dist/react/jsx/utils/stringParsing/processTranslationCall/index.js +54 -59
  278. package/dist/react/jsx/utils/stringParsing/processTranslationCall/index.js.map +1 -0
  279. package/dist/react/jsx/utils/stringParsing/processTranslationCall/routeTranslationCall.js +56 -69
  280. package/dist/react/jsx/utils/stringParsing/processTranslationCall/routeTranslationCall.js.map +1 -0
  281. package/dist/react/jsx/utils/validateStringFunction.js +21 -29
  282. package/dist/react/jsx/utils/validateStringFunction.js.map +1 -0
  283. package/dist/react/jsx/wrapJsx.js +192 -375
  284. package/dist/react/jsx/wrapJsx.js.map +1 -0
  285. package/dist/react/parse/addVitePlugin/index.js +40 -34
  286. package/dist/react/parse/addVitePlugin/index.js.map +1 -0
  287. package/dist/react/parse/addVitePlugin/installCompiler.js +18 -20
  288. package/dist/react/parse/addVitePlugin/installCompiler.js.map +1 -0
  289. package/dist/react/parse/addVitePlugin/updateViteConfig.js +107 -111
  290. package/dist/react/parse/addVitePlugin/updateViteConfig.js.map +1 -0
  291. package/dist/react/parse/addVitePlugin/utils/addCompilerImport.js +23 -26
  292. package/dist/react/parse/addVitePlugin/utils/addCompilerImport.js.map +1 -0
  293. package/dist/react/parse/addVitePlugin/utils/addPluginInvocation.js +29 -43
  294. package/dist/react/parse/addVitePlugin/utils/addPluginInvocation.js.map +1 -0
  295. package/dist/react/parse/addVitePlugin/utils/checkCompilerImport.js +70 -104
  296. package/dist/react/parse/addVitePlugin/utils/checkCompilerImport.js.map +1 -0
  297. package/dist/react/parse/addVitePlugin/utils/checkPluginInvocation.js +23 -29
  298. package/dist/react/parse/addVitePlugin/utils/checkPluginInvocation.js.map +1 -0
  299. package/dist/react/parse/createDictionaryUpdates.js +121 -185
  300. package/dist/react/parse/createDictionaryUpdates.js.map +1 -0
  301. package/dist/react/parse/createInlineUpdates.js +123 -139
  302. package/dist/react/parse/createInlineUpdates.js.map +1 -0
  303. package/dist/react/parse/wrapContent.js +131 -156
  304. package/dist/react/parse/wrapContent.js.map +1 -0
  305. package/dist/react/utils/flattenDictionary.js +55 -70
  306. package/dist/react/utils/flattenDictionary.js.map +1 -0
  307. package/dist/react/utils/getEntryAndMetadata.js +14 -10
  308. package/dist/react/utils/getEntryAndMetadata.js.map +1 -0
  309. package/dist/react/utils/getVariableName.js +36 -33
  310. package/dist/react/utils/getVariableName.js.map +1 -0
  311. package/dist/setup/detectFramework.js +85 -102
  312. package/dist/setup/detectFramework.js.map +1 -0
  313. package/dist/setup/frameworkUtils.js +17 -28
  314. package/dist/setup/frameworkUtils.js.map +1 -0
  315. package/dist/setup/userInput.js +24 -31
  316. package/dist/setup/userInput.js.map +1 -0
  317. package/dist/setup/wizard.js +141 -143
  318. package/dist/setup/wizard.js.map +1 -0
  319. package/dist/state/mintlifyRefMap.js +12 -9
  320. package/dist/state/mintlifyRefMap.js.map +1 -0
  321. package/dist/state/recentDownloads.js +26 -23
  322. package/dist/state/recentDownloads.js.map +1 -0
  323. package/dist/state/translateWarnings.js +17 -8
  324. package/dist/state/translateWarnings.js.map +1 -0
  325. package/dist/translation/parse.js +77 -98
  326. package/dist/translation/parse.js.map +1 -0
  327. package/dist/translation/stage.js +28 -43
  328. package/dist/translation/stage.js.map +1 -0
  329. package/dist/translation/validate.js +68 -91
  330. package/dist/translation/validate.js.map +1 -0
  331. package/dist/types/libraries.js +93 -91
  332. package/dist/types/libraries.js.map +1 -0
  333. package/dist/types/parsing.js +19 -10
  334. package/dist/types/parsing.js.map +1 -0
  335. package/dist/utils/addExplicitAnchorIds.js +270 -389
  336. package/dist/utils/addExplicitAnchorIds.js.map +1 -0
  337. package/dist/utils/calculateTimeoutMs.js +11 -6
  338. package/dist/utils/calculateTimeoutMs.js.map +1 -0
  339. package/dist/utils/constants.js +15 -12
  340. package/dist/utils/constants.js.map +1 -0
  341. package/dist/utils/credentials.js +67 -114
  342. package/dist/utils/credentials.js.map +1 -0
  343. package/dist/utils/fetch.js +22 -20
  344. package/dist/utils/fetch.js.map +1 -0
  345. package/dist/utils/flattenJsonFiles.js +27 -34
  346. package/dist/utils/flattenJsonFiles.js.map +1 -0
  347. package/dist/utils/gitDiff.js +30 -32
  348. package/dist/utils/gitDiff.js.map +1 -0
  349. package/dist/utils/gt.js +7 -2
  350. package/dist/utils/gt.js.map +1 -0
  351. package/dist/utils/hash.js +14 -9
  352. package/dist/utils/hash.js.map +1 -0
  353. package/dist/utils/headers.js +10 -13
  354. package/dist/utils/headers.js.map +1 -0
  355. package/dist/utils/installPackage.js +70 -75
  356. package/dist/utils/installPackage.js.map +1 -0
  357. package/dist/utils/localizeRelativeAssets.js +114 -157
  358. package/dist/utils/localizeRelativeAssets.js.map +1 -0
  359. package/dist/utils/localizeStaticImports.js +229 -371
  360. package/dist/utils/localizeStaticImports.js.map +1 -0
  361. package/dist/utils/localizeStaticUrls.js +241 -424
  362. package/dist/utils/localizeStaticUrls.js.map +1 -0
  363. package/dist/utils/mintlifyTitleFallback.js +64 -72
  364. package/dist/utils/mintlifyTitleFallback.js.map +1 -0
  365. package/dist/utils/monorepoVersionCheck.js +177 -215
  366. package/dist/utils/monorepoVersionCheck.js.map +1 -0
  367. package/dist/utils/packageInfo.js +17 -16
  368. package/dist/utils/packageInfo.js.map +1 -0
  369. package/dist/utils/packageJson.js +51 -66
  370. package/dist/utils/packageJson.js.map +1 -0
  371. package/dist/utils/packageManager.js +237 -260
  372. package/dist/utils/packageManager.js.map +1 -0
  373. package/dist/utils/parse/needsCJS.js +36 -69
  374. package/dist/utils/parse/needsCJS.js.map +1 -0
  375. package/dist/utils/persistPostprocessHashes.js +30 -32
  376. package/dist/utils/persistPostprocessHashes.js.map +1 -0
  377. package/dist/utils/processAnchorIds.js +32 -54
  378. package/dist/utils/processAnchorIds.js.map +1 -0
  379. package/dist/utils/processOpenApi.js +469 -578
  380. package/dist/utils/processOpenApi.js.map +1 -0
  381. package/dist/utils/resolveMintlifyRefs.js +89 -105
  382. package/dist/utils/resolveMintlifyRefs.js.map +1 -0
  383. package/dist/utils/resolvePublish.js +46 -54
  384. package/dist/utils/resolvePublish.js.map +1 -0
  385. package/dist/utils/sanitizeFileContent.js +20 -27
  386. package/dist/utils/sanitizeFileContent.js.map +1 -0
  387. package/dist/utils/sharedStaticAssets.js +248 -366
  388. package/dist/utils/sharedStaticAssets.js.map +1 -0
  389. package/dist/utils/splitMintlifyLanguageRefs.js +208 -282
  390. package/dist/utils/splitMintlifyLanguageRefs.js.map +1 -0
  391. package/dist/utils/validateMdx.js +26 -23
  392. package/dist/utils/validateMdx.js.map +1 -0
  393. package/dist/utils/wrapPlainUrls.js +58 -70
  394. package/dist/utils/wrapPlainUrls.js.map +1 -0
  395. package/dist/workflows/download.js +92 -126
  396. package/dist/workflows/download.js.map +1 -0
  397. package/dist/workflows/enqueue.js +47 -54
  398. package/dist/workflows/enqueue.js.map +1 -0
  399. package/dist/workflows/publish.js +29 -29
  400. package/dist/workflows/publish.js.map +1 -0
  401. package/dist/workflows/setupProject.js +39 -40
  402. package/dist/workflows/setupProject.js.map +1 -0
  403. package/dist/workflows/stage.js +61 -65
  404. package/dist/workflows/stage.js.map +1 -0
  405. package/dist/workflows/steps/BranchStep.js +118 -163
  406. package/dist/workflows/steps/BranchStep.js.map +1 -0
  407. package/dist/workflows/steps/DownloadStep.js +107 -137
  408. package/dist/workflows/steps/DownloadStep.js.map +1 -0
  409. package/dist/workflows/steps/EnqueueStep.js +32 -32
  410. package/dist/workflows/steps/EnqueueStep.js.map +1 -0
  411. package/dist/workflows/steps/PollJobsStep.js +208 -292
  412. package/dist/workflows/steps/PollJobsStep.js.map +1 -0
  413. package/dist/workflows/steps/PublishStep.js +33 -38
  414. package/dist/workflows/steps/PublishStep.js.map +1 -0
  415. package/dist/workflows/steps/SetupStep.js +71 -72
  416. package/dist/workflows/steps/SetupStep.js.map +1 -0
  417. package/dist/workflows/steps/TagStep.js +39 -44
  418. package/dist/workflows/steps/TagStep.js.map +1 -0
  419. package/dist/workflows/steps/UploadSourcesStep.js +108 -140
  420. package/dist/workflows/steps/UploadSourcesStep.js.map +1 -0
  421. package/dist/workflows/steps/UploadTranslationsStep.js +61 -71
  422. package/dist/workflows/steps/UploadTranslationsStep.js.map +1 -0
  423. package/dist/workflows/steps/UserEditDiffsStep.js +32 -34
  424. package/dist/workflows/steps/UserEditDiffsStep.js.map +1 -0
  425. package/dist/workflows/steps/WorkflowStep.js +6 -2
  426. package/dist/workflows/steps/WorkflowStep.js.map +1 -0
  427. package/dist/workflows/upload.js +45 -46
  428. package/dist/workflows/upload.js.map +1 -0
  429. package/package.json +14 -7
@@ -1,55 +1,54 @@
1
- import { logErrorAndExit } from '../../console/logging.js';
2
- import { invalidConfigurationError } from '../../console/index.js';
3
- import { aggregateFiles } from './aggregateFiles.js';
4
- import { aggregateInlineTranslations } from '../../translation/stage.js';
5
- import { hashStringSync } from '../../utils/hash.js';
6
- import { TEMPLATE_FILE_NAME, TEMPLATE_FILE_ID } from '../../utils/constants.js';
7
- import { isInlineLibrary } from '../../types/libraries.js';
8
- import { shouldPublishGt } from '../../utils/resolvePublish.js';
9
- export async function collectFiles(options, settings, library) {
10
- // Aggregate files
11
- const { files, publishMap } = await aggregateFiles(settings);
12
- // Parse for React components
13
- let reactComponents = 0;
14
- if (isInlineLibrary(library)) {
15
- const updates = await aggregateInlineTranslations(options, settings, library);
16
- if (updates.length > 0) {
17
- if (!settings.publish && !settings.files?.placeholderPaths.gt) {
18
- logErrorAndExit(invalidConfigurationError);
19
- }
20
- // Convert updates to a file object
21
- const fileData = {};
22
- const fileMetadata = {};
23
- // Convert updates to the proper data format
24
- for (const update of updates) {
25
- const { source, metadata, dataFormat } = update;
26
- metadata.dataFormat = dataFormat; // add the data format to the metadata
27
- const { hash, id } = metadata;
28
- if (id) {
29
- fileData[id] = source;
30
- fileMetadata[id] = metadata;
31
- }
32
- else if (hash) {
33
- fileData[hash] = source;
34
- fileMetadata[hash] = metadata;
35
- }
36
- }
37
- reactComponents = updates.length;
38
- files.push({
39
- fileName: TEMPLATE_FILE_NAME,
40
- content: JSON.stringify(fileData),
41
- fileFormat: 'GTJSON',
42
- formatMetadata: fileMetadata,
43
- fileId: TEMPLATE_FILE_ID,
44
- versionId: hashStringSync(JSON.stringify(Object.keys(fileData).sort())),
45
- locale: settings.defaultLocale,
46
- });
47
- // Only add GT JSON to publishMap if there's an explicit publish config
48
- const gtPublishValue = shouldPublishGt(settings);
49
- if (gtPublishValue !== undefined) {
50
- publishMap.set(TEMPLATE_FILE_ID, gtPublishValue);
51
- }
52
- }
53
- }
54
- return { files, reactComponents, publishMap };
1
+ import { hashStringSync } from "../../utils/hash.js";
2
+ import { TEMPLATE_FILE_ID, TEMPLATE_FILE_NAME } from "../../utils/constants.js";
3
+ import { logErrorAndExit } from "../../console/logging.js";
4
+ import { invalidConfigurationError } from "../../console/index.js";
5
+ import { isInlineLibrary } from "../../types/libraries.js";
6
+ import { shouldPublishGt } from "../../utils/resolvePublish.js";
7
+ import { aggregateFiles } from "./aggregateFiles.js";
8
+ import { aggregateInlineTranslations } from "../../translation/stage.js";
9
+ //#region src/formats/files/collectFiles.ts
10
+ async function collectFiles(options, settings, library) {
11
+ const { files, publishMap } = await aggregateFiles(settings);
12
+ let reactComponents = 0;
13
+ if (isInlineLibrary(library)) {
14
+ const updates = await aggregateInlineTranslations(options, settings, library);
15
+ if (updates.length > 0) {
16
+ if (!settings.publish && !settings.files?.placeholderPaths.gt) logErrorAndExit(invalidConfigurationError);
17
+ const fileData = {};
18
+ const fileMetadata = {};
19
+ for (const update of updates) {
20
+ const { source, metadata, dataFormat } = update;
21
+ metadata.dataFormat = dataFormat;
22
+ const { hash, id } = metadata;
23
+ if (id) {
24
+ fileData[id] = source;
25
+ fileMetadata[id] = metadata;
26
+ } else if (hash) {
27
+ fileData[hash] = source;
28
+ fileMetadata[hash] = metadata;
29
+ }
30
+ }
31
+ reactComponents = updates.length;
32
+ files.push({
33
+ fileName: TEMPLATE_FILE_NAME,
34
+ content: JSON.stringify(fileData),
35
+ fileFormat: "GTJSON",
36
+ formatMetadata: fileMetadata,
37
+ fileId: TEMPLATE_FILE_ID,
38
+ versionId: hashStringSync(JSON.stringify(Object.keys(fileData).sort())),
39
+ locale: settings.defaultLocale
40
+ });
41
+ const gtPublishValue = shouldPublishGt(settings);
42
+ if (gtPublishValue !== void 0) publishMap.set(TEMPLATE_FILE_ID, gtPublishValue);
43
+ }
44
+ }
45
+ return {
46
+ files,
47
+ reactComponents,
48
+ publishMap
49
+ };
55
50
  }
51
+ //#endregion
52
+ export { collectFiles };
53
+
54
+ //# sourceMappingURL=collectFiles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"collectFiles.js","names":[],"sources":["../../../src/formats/files/collectFiles.ts"],"sourcesContent":["import { logErrorAndExit } from '../../console/logging.js';\nimport {\n Settings,\n SupportedLibraries,\n TranslateFlags,\n} from '../../types/index.js';\nimport { invalidConfigurationError } from '../../console/index.js';\nimport { aggregateFiles } from './aggregateFiles.js';\nimport { aggregateInlineTranslations } from '../../translation/stage.js';\nimport type { JsxChildren } from '@generaltranslation/format/types';\nimport type { FileToUpload } from 'generaltranslation/types';\nimport { hashStringSync } from '../../utils/hash.js';\nimport { TEMPLATE_FILE_NAME, TEMPLATE_FILE_ID } from '../../utils/constants.js';\nimport { isInlineLibrary } from '../../types/libraries.js';\nimport { shouldPublishGt } from '../../utils/resolvePublish.js';\n\nexport async function collectFiles(\n options: TranslateFlags,\n settings: Settings,\n library: SupportedLibraries\n): Promise<{\n files: FileToUpload[];\n reactComponents: number;\n publishMap: Map<string, boolean>;\n}> {\n // Aggregate files\n const { files, publishMap } = await aggregateFiles(settings);\n\n // Parse for React components\n let reactComponents = 0;\n if (isInlineLibrary(library)) {\n const updates = await aggregateInlineTranslations(\n options,\n settings,\n library\n );\n if (updates.length > 0) {\n if (!settings.publish && !settings.files?.placeholderPaths.gt) {\n logErrorAndExit(invalidConfigurationError);\n }\n // Convert updates to a file object\n const fileData: Record<string, JsxChildren> = {};\n const fileMetadata: Record<string, unknown> = {};\n // Convert updates to the proper data format\n for (const update of updates) {\n const { source, metadata, dataFormat } = update;\n metadata.dataFormat = dataFormat; // add the data format to the metadata\n const { hash, id } = metadata;\n if (id) {\n fileData[id] = source;\n fileMetadata[id] = metadata;\n } else if (hash) {\n fileData[hash] = source;\n fileMetadata[hash] = metadata;\n }\n }\n reactComponents = updates.length;\n files.push({\n fileName: TEMPLATE_FILE_NAME,\n content: JSON.stringify(fileData),\n fileFormat: 'GTJSON',\n formatMetadata: fileMetadata,\n fileId: TEMPLATE_FILE_ID,\n versionId: hashStringSync(JSON.stringify(Object.keys(fileData).sort())),\n locale: settings.defaultLocale,\n } satisfies FileToUpload);\n // Only add GT JSON to publishMap if there's an explicit publish config\n const gtPublishValue = shouldPublishGt(settings);\n if (gtPublishValue !== undefined) {\n publishMap.set(TEMPLATE_FILE_ID, gtPublishValue);\n }\n }\n }\n return { files, reactComponents, publishMap };\n}\n"],"mappings":";;;;;;;;;AAgBA,eAAsB,aACpB,SACA,UACA,SAKC;CAED,MAAM,EAAE,OAAO,eAAe,MAAM,eAAe,SAAS;CAG5D,IAAI,kBAAkB;AACtB,KAAI,gBAAgB,QAAQ,EAAE;EAC5B,MAAM,UAAU,MAAM,4BACpB,SACA,UACA,QACD;AACD,MAAI,QAAQ,SAAS,GAAG;AACtB,OAAI,CAAC,SAAS,WAAW,CAAC,SAAS,OAAO,iBAAiB,GACzD,iBAAgB,0BAA0B;GAG5C,MAAM,WAAwC,EAAE;GAChD,MAAM,eAAwC,EAAE;AAEhD,QAAK,MAAM,UAAU,SAAS;IAC5B,MAAM,EAAE,QAAQ,UAAU,eAAe;AACzC,aAAS,aAAa;IACtB,MAAM,EAAE,MAAM,OAAO;AACrB,QAAI,IAAI;AACN,cAAS,MAAM;AACf,kBAAa,MAAM;eACV,MAAM;AACf,cAAS,QAAQ;AACjB,kBAAa,QAAQ;;;AAGzB,qBAAkB,QAAQ;AAC1B,SAAM,KAAK;IACT,UAAU;IACV,SAAS,KAAK,UAAU,SAAS;IACjC,YAAY;IACZ,gBAAgB;IAChB,QAAQ;IACR,WAAW,eAAe,KAAK,UAAU,OAAO,KAAK,SAAS,CAAC,MAAM,CAAC,CAAC;IACvE,QAAQ,SAAS;IAClB,CAAwB;GAEzB,MAAM,iBAAiB,gBAAgB,SAAS;AAChD,OAAI,mBAAmB,KAAA,EACrB,YAAW,IAAI,kBAAkB,eAAe;;;AAItD,QAAO;EAAE;EAAO;EAAiB;EAAY"}
@@ -1,21 +1,23 @@
1
+ //#region src/formats/files/convertToFileTranslationData.ts
1
2
  /**
2
- * Convert files to a file version data object
3
- * @param files - The files to get the version data for
4
- * @returns The version data for each file
5
- *
6
- * @example
7
- * const { allFiles } = await collectFiles(options, settings, library);
8
- * if (allFiles.length > 0) {
9
- * const fileVersionData = getFileVersionData(allFiles);
10
- * console.log(fileVersionData);
11
- * }
12
- */
13
- export function convertToFileTranslationData(files) {
14
- return Object.fromEntries(files.map((file) => [
15
- file.fileId,
16
- {
17
- versionId: file.versionId,
18
- fileName: file.fileName,
19
- },
20
- ]));
3
+ * Convert files to a file version data object
4
+ * @param files - The files to get the version data for
5
+ * @returns The version data for each file
6
+ *
7
+ * @example
8
+ * const { allFiles } = await collectFiles(options, settings, library);
9
+ * if (allFiles.length > 0) {
10
+ * const fileVersionData = getFileVersionData(allFiles);
11
+ * console.log(fileVersionData);
12
+ * }
13
+ */
14
+ function convertToFileTranslationData(files) {
15
+ return Object.fromEntries(files.map((file) => [file.fileId, {
16
+ versionId: file.versionId,
17
+ fileName: file.fileName
18
+ }]));
21
19
  }
20
+ //#endregion
21
+ export { convertToFileTranslationData };
22
+
23
+ //# sourceMappingURL=convertToFileTranslationData.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"convertToFileTranslationData.js","names":[],"sources":["../../../src/formats/files/convertToFileTranslationData.ts"],"sourcesContent":["import { FileToUpload } from 'generaltranslation/types';\nimport { FileTranslationData } from '../../workflows/download.js';\n\n/**\n * Convert files to a file version data object\n * @param files - The files to get the version data for\n * @returns The version data for each file\n *\n * @example\n * const { allFiles } = await collectFiles(options, settings, library);\n * if (allFiles.length > 0) {\n * const fileVersionData = getFileVersionData(allFiles);\n * console.log(fileVersionData);\n * }\n */\nexport function convertToFileTranslationData(\n files: FileToUpload[]\n): FileTranslationData {\n return Object.fromEntries(\n files.map((file) => [\n file.fileId,\n {\n versionId: file.versionId,\n fileName: file.fileName,\n },\n ])\n );\n}\n"],"mappings":";;;;;;;;;;;;;AAeA,SAAgB,6BACd,OACqB;AACrB,QAAO,OAAO,YACZ,MAAM,KAAK,SAAS,CAClB,KAAK,QACL;EACE,WAAW,KAAK;EAChB,UAAU,KAAK;EAChB,CACF,CAAC,CACH"}
@@ -1,121 +1,84 @@
1
- import { SUPPORTED_FILE_EXTENSIONS } from '../files/supportedFiles.js';
2
- import { resolveLocaleFiles } from '../../fs/config/parseFilesConfig.js';
3
- import path from 'node:path';
4
- import { getRelative } from '../../fs/findFilepath.js';
5
- import { getLocaleProperties } from '@generaltranslation/format';
6
- import { replaceLocalePlaceholders } from '../utils.js';
7
- import { TEMPLATE_FILE_NAME } from '../../utils/constants.js';
8
- import { replaceFileExtensionForFormat } from './transformFormat.js';
1
+ import { TEMPLATE_FILE_NAME } from "../../utils/constants.js";
2
+ import { getRelative } from "../../fs/findFilepath.js";
3
+ import { SUPPORTED_FILE_EXTENSIONS } from "./supportedFiles.js";
4
+ import { replaceFileExtensionForFormat } from "./transformFormat.js";
5
+ import { resolveLocaleFiles } from "../../fs/config/parseFilesConfig.js";
6
+ import { replaceLocalePlaceholders } from "../utils.js";
7
+ import path from "node:path";
8
+ import { getLocaleProperties } from "@generaltranslation/format";
9
+ //#region src/formats/files/fileMapping.ts
9
10
  /**
10
- * Creates a mapping between source files and their translated counterparts for each locale
11
- * @param filePaths - Resolved file paths for different file types
12
- * @param placeholderPaths - Placeholder paths for translated files
13
- * @param transformPaths - Transform paths for file naming
14
- * @param transformFormats - Output file format transforms for translated files
15
- * @param locales - List of locales to create a mapping for
16
- * @returns A mapping between source files and their translated counterparts for each locale, in the form of relative paths
17
- */
18
- export function createFileMapping(filePaths, placeholderPaths, transformPaths, transformFormats, targetLocales, defaultLocale) {
19
- const fileMapping = {};
20
- for (const locale of targetLocales) {
21
- const translatedPaths = resolveLocaleFiles(placeholderPaths, locale);
22
- const localeMapping = {};
23
- // Process each file type
24
- // Start with GTJSON Template files
25
- if (translatedPaths.gt) {
26
- const filepath = translatedPaths.gt;
27
- localeMapping[TEMPLATE_FILE_NAME] = filepath;
28
- }
29
- for (const typeIndex of SUPPORTED_FILE_EXTENSIONS) {
30
- if (!filePaths[typeIndex] || !translatedPaths[typeIndex])
31
- continue;
32
- const sourcePaths = filePaths[typeIndex];
33
- let translatedFiles = translatedPaths[typeIndex];
34
- if (!translatedFiles)
35
- continue;
36
- const transformPath = transformPaths[typeIndex];
37
- const transformFormat = transformFormats?.[typeIndex];
38
- if (transformPath) {
39
- if (typeof transformPath === 'string') {
40
- translatedFiles = translatedFiles.map((filePath) => {
41
- const directory = path.dirname(filePath);
42
- const fileName = path.basename(filePath);
43
- const baseName = fileName.split('.')[0];
44
- const transformedFileName = transformPath
45
- .replace('*', baseName)
46
- .replace('[locale]', locale);
47
- return path.join(directory, transformedFileName);
48
- });
49
- }
50
- else if (Array.isArray(transformPath)) {
51
- // transformPath is an array of TransformOption objects
52
- const targetLocaleProperties = getLocaleProperties(locale);
53
- const defaultLocaleProperties = getLocaleProperties(defaultLocale);
54
- translatedFiles = translatedFiles.map((filePath) => {
55
- const relativePath = getRelative(filePath);
56
- // Try each transform in order until one matches
57
- for (const transform of transformPath) {
58
- if (!transform.replace || typeof transform.replace !== 'string') {
59
- continue;
60
- }
61
- // Replace all locale property placeholders in the replace string
62
- const replaceString = replaceLocalePlaceholders(transform.replace, targetLocaleProperties);
63
- if (transform.match && typeof transform.match === 'string') {
64
- // Replace locale placeholders in the match string using defaultLocale properties
65
- let matchString = transform.match;
66
- matchString = replaceLocalePlaceholders(matchString, defaultLocaleProperties);
67
- const regex = new RegExp(matchString);
68
- if (regex.test(relativePath)) {
69
- // This transform matches, apply it and break
70
- const transformedPath = relativePath.replace(new RegExp(matchString, 'g'), replaceString);
71
- return path.resolve(transformedPath);
72
- }
73
- }
74
- else {
75
- // No match provided: treat as a direct replacement (override)
76
- return path.resolve(replaceString);
77
- }
78
- }
79
- // If no transforms matched, return the original path
80
- return filePath;
81
- });
82
- }
83
- else {
84
- // transformPath is an object
85
- const targetLocaleProperties = getLocaleProperties(locale);
86
- const defaultLocaleProperties = getLocaleProperties(defaultLocale);
87
- if (!transformPath.replace ||
88
- typeof transformPath.replace !== 'string') {
89
- continue;
90
- }
91
- // Replace all locale property placeholders
92
- const replaceString = replaceLocalePlaceholders(transformPath.replace, targetLocaleProperties);
93
- translatedFiles = translatedFiles.map((filePath) => {
94
- let relativePath = getRelative(filePath);
95
- if (transformPath.match &&
96
- typeof transformPath.match === 'string') {
97
- // Replace locale placeholders in the match string using defaultLocale properties
98
- let matchString = transformPath.match;
99
- matchString = replaceLocalePlaceholders(matchString, defaultLocaleProperties);
100
- relativePath = relativePath.replace(new RegExp(matchString, 'g'), replaceString);
101
- }
102
- else {
103
- relativePath = replaceString;
104
- }
105
- return path.resolve(relativePath);
106
- });
107
- }
108
- }
109
- for (let i = 0; i < sourcePaths.length; i++) {
110
- const sourceFile = getRelative(sourcePaths[i]);
111
- // Format transforms keep the mapped path but rewrite the output suffix.
112
- const translatedFile = getRelative(transformFormat
113
- ? replaceFileExtensionForFormat(translatedFiles[i], transformFormat)
114
- : translatedFiles[i]);
115
- localeMapping[sourceFile] = translatedFile;
116
- }
117
- }
118
- fileMapping[locale] = localeMapping;
119
- }
120
- return fileMapping;
11
+ * Creates a mapping between source files and their translated counterparts for each locale
12
+ * @param filePaths - Resolved file paths for different file types
13
+ * @param placeholderPaths - Placeholder paths for translated files
14
+ * @param transformPaths - Transform paths for file naming
15
+ * @param transformFormats - Output file format transforms for translated files
16
+ * @param locales - List of locales to create a mapping for
17
+ * @returns A mapping between source files and their translated counterparts for each locale, in the form of relative paths
18
+ */
19
+ function createFileMapping(filePaths, placeholderPaths, transformPaths, transformFormats, targetLocales, defaultLocale) {
20
+ const fileMapping = {};
21
+ for (const locale of targetLocales) {
22
+ const translatedPaths = resolveLocaleFiles(placeholderPaths, locale);
23
+ const localeMapping = {};
24
+ if (translatedPaths.gt) localeMapping[TEMPLATE_FILE_NAME] = translatedPaths.gt;
25
+ for (const typeIndex of SUPPORTED_FILE_EXTENSIONS) {
26
+ if (!filePaths[typeIndex] || !translatedPaths[typeIndex]) continue;
27
+ const sourcePaths = filePaths[typeIndex];
28
+ let translatedFiles = translatedPaths[typeIndex];
29
+ if (!translatedFiles) continue;
30
+ const transformPath = transformPaths[typeIndex];
31
+ const transformFormat = transformFormats?.[typeIndex];
32
+ if (transformPath) if (typeof transformPath === "string") translatedFiles = translatedFiles.map((filePath) => {
33
+ const directory = path.dirname(filePath);
34
+ const baseName = path.basename(filePath).split(".")[0];
35
+ const transformedFileName = transformPath.replace("*", baseName).replace("[locale]", locale);
36
+ return path.join(directory, transformedFileName);
37
+ });
38
+ else if (Array.isArray(transformPath)) {
39
+ const targetLocaleProperties = getLocaleProperties(locale);
40
+ const defaultLocaleProperties = getLocaleProperties(defaultLocale);
41
+ translatedFiles = translatedFiles.map((filePath) => {
42
+ const relativePath = getRelative(filePath);
43
+ for (const transform of transformPath) {
44
+ if (!transform.replace || typeof transform.replace !== "string") continue;
45
+ const replaceString = replaceLocalePlaceholders(transform.replace, targetLocaleProperties);
46
+ if (transform.match && typeof transform.match === "string") {
47
+ let matchString = transform.match;
48
+ matchString = replaceLocalePlaceholders(matchString, defaultLocaleProperties);
49
+ if (new RegExp(matchString).test(relativePath)) {
50
+ const transformedPath = relativePath.replace(new RegExp(matchString, "g"), replaceString);
51
+ return path.resolve(transformedPath);
52
+ }
53
+ } else return path.resolve(replaceString);
54
+ }
55
+ return filePath;
56
+ });
57
+ } else {
58
+ const targetLocaleProperties = getLocaleProperties(locale);
59
+ const defaultLocaleProperties = getLocaleProperties(defaultLocale);
60
+ if (!transformPath.replace || typeof transformPath.replace !== "string") continue;
61
+ const replaceString = replaceLocalePlaceholders(transformPath.replace, targetLocaleProperties);
62
+ translatedFiles = translatedFiles.map((filePath) => {
63
+ let relativePath = getRelative(filePath);
64
+ if (transformPath.match && typeof transformPath.match === "string") {
65
+ let matchString = transformPath.match;
66
+ matchString = replaceLocalePlaceholders(matchString, defaultLocaleProperties);
67
+ relativePath = relativePath.replace(new RegExp(matchString, "g"), replaceString);
68
+ } else relativePath = replaceString;
69
+ return path.resolve(relativePath);
70
+ });
71
+ }
72
+ for (let i = 0; i < sourcePaths.length; i++) {
73
+ const sourceFile = getRelative(sourcePaths[i]);
74
+ localeMapping[sourceFile] = getRelative(transformFormat ? replaceFileExtensionForFormat(translatedFiles[i], transformFormat) : translatedFiles[i]);
75
+ }
76
+ }
77
+ fileMapping[locale] = localeMapping;
78
+ }
79
+ return fileMapping;
121
80
  }
81
+ //#endregion
82
+ export { createFileMapping };
83
+
84
+ //# sourceMappingURL=fileMapping.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fileMapping.js","names":[],"sources":["../../../src/formats/files/fileMapping.ts"],"sourcesContent":["import {\n ResolvedFiles,\n TransformFiles,\n TransformFormats,\n} from '../../types/index.js';\nimport { SUPPORTED_FILE_EXTENSIONS } from '../files/supportedFiles.js';\nimport { resolveLocaleFiles } from '../../fs/config/parseFilesConfig.js';\nimport path from 'node:path';\nimport { getRelative } from '../../fs/findFilepath.js';\nimport { getLocaleProperties } from '@generaltranslation/format';\nimport { replaceLocalePlaceholders } from '../utils.js';\nimport { FileMapping } from '../../types/files.js';\nimport { TEMPLATE_FILE_NAME } from '../../utils/constants.js';\nimport { replaceFileExtensionForFormat } from './transformFormat.js';\n\n/**\n * Creates a mapping between source files and their translated counterparts for each locale\n * @param filePaths - Resolved file paths for different file types\n * @param placeholderPaths - Placeholder paths for translated files\n * @param transformPaths - Transform paths for file naming\n * @param transformFormats - Output file format transforms for translated files\n * @param locales - List of locales to create a mapping for\n * @returns A mapping between source files and their translated counterparts for each locale, in the form of relative paths\n */\nexport function createFileMapping(\n filePaths: ResolvedFiles,\n placeholderPaths: ResolvedFiles,\n transformPaths: TransformFiles,\n transformFormats: TransformFormats,\n targetLocales: string[],\n defaultLocale: string\n): FileMapping {\n const fileMapping: FileMapping = {};\n\n for (const locale of targetLocales) {\n const translatedPaths = resolveLocaleFiles(placeholderPaths, locale);\n const localeMapping: FileMapping[string] = {};\n\n // Process each file type\n\n // Start with GTJSON Template files\n if (translatedPaths.gt) {\n const filepath = translatedPaths.gt;\n localeMapping[TEMPLATE_FILE_NAME] = filepath;\n }\n\n for (const typeIndex of SUPPORTED_FILE_EXTENSIONS) {\n if (!filePaths[typeIndex] || !translatedPaths[typeIndex]) continue;\n\n const sourcePaths = filePaths[typeIndex];\n let translatedFiles = translatedPaths[typeIndex];\n if (!translatedFiles) continue;\n\n const transformPath = transformPaths[typeIndex];\n const transformFormat = transformFormats?.[typeIndex];\n\n if (transformPath) {\n if (typeof transformPath === 'string') {\n translatedFiles = translatedFiles.map((filePath) => {\n const directory = path.dirname(filePath);\n const fileName = path.basename(filePath);\n const baseName = fileName.split('.')[0];\n const transformedFileName = transformPath\n .replace('*', baseName)\n .replace('[locale]', locale);\n return path.join(directory, transformedFileName);\n });\n } else if (Array.isArray(transformPath)) {\n // transformPath is an array of TransformOption objects\n const targetLocaleProperties = getLocaleProperties(locale);\n const defaultLocaleProperties = getLocaleProperties(defaultLocale);\n\n translatedFiles = translatedFiles.map((filePath) => {\n const relativePath = getRelative(filePath);\n\n // Try each transform in order until one matches\n for (const transform of transformPath) {\n if (!transform.replace || typeof transform.replace !== 'string') {\n continue;\n }\n\n // Replace all locale property placeholders in the replace string\n const replaceString = replaceLocalePlaceholders(\n transform.replace,\n targetLocaleProperties\n );\n\n if (transform.match && typeof transform.match === 'string') {\n // Replace locale placeholders in the match string using defaultLocale properties\n let matchString = transform.match;\n matchString = replaceLocalePlaceholders(\n matchString,\n defaultLocaleProperties\n );\n\n const regex = new RegExp(matchString);\n if (regex.test(relativePath)) {\n // This transform matches, apply it and break\n const transformedPath = relativePath.replace(\n new RegExp(matchString, 'g'),\n replaceString\n );\n return path.resolve(transformedPath);\n }\n } else {\n // No match provided: treat as a direct replacement (override)\n return path.resolve(replaceString);\n }\n }\n\n // If no transforms matched, return the original path\n return filePath;\n });\n } else {\n // transformPath is an object\n const targetLocaleProperties = getLocaleProperties(locale);\n const defaultLocaleProperties = getLocaleProperties(defaultLocale);\n if (\n !transformPath.replace ||\n typeof transformPath.replace !== 'string'\n ) {\n continue;\n }\n // Replace all locale property placeholders\n const replaceString = replaceLocalePlaceholders(\n transformPath.replace,\n targetLocaleProperties\n );\n translatedFiles = translatedFiles.map((filePath) => {\n let relativePath = getRelative(filePath);\n if (\n transformPath.match &&\n typeof transformPath.match === 'string'\n ) {\n // Replace locale placeholders in the match string using defaultLocale properties\n let matchString = transformPath.match;\n matchString = replaceLocalePlaceholders(\n matchString,\n defaultLocaleProperties\n );\n\n relativePath = relativePath.replace(\n new RegExp(matchString, 'g'),\n replaceString\n );\n } else {\n relativePath = replaceString;\n }\n return path.resolve(relativePath);\n });\n }\n }\n\n for (let i = 0; i < sourcePaths.length; i++) {\n const sourceFile = getRelative(sourcePaths[i]);\n // Format transforms keep the mapped path but rewrite the output suffix.\n const translatedFile = getRelative(\n transformFormat\n ? replaceFileExtensionForFormat(translatedFiles[i], transformFormat)\n : translatedFiles[i]\n );\n localeMapping[sourceFile] = translatedFile;\n }\n }\n\n fileMapping[locale] = localeMapping;\n }\n\n return fileMapping;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAwBA,SAAgB,kBACd,WACA,kBACA,gBACA,kBACA,eACA,eACa;CACb,MAAM,cAA2B,EAAE;AAEnC,MAAK,MAAM,UAAU,eAAe;EAClC,MAAM,kBAAkB,mBAAmB,kBAAkB,OAAO;EACpE,MAAM,gBAAqC,EAAE;AAK7C,MAAI,gBAAgB,GAElB,eAAc,sBADG,gBAAgB;AAInC,OAAK,MAAM,aAAa,2BAA2B;AACjD,OAAI,CAAC,UAAU,cAAc,CAAC,gBAAgB,WAAY;GAE1D,MAAM,cAAc,UAAU;GAC9B,IAAI,kBAAkB,gBAAgB;AACtC,OAAI,CAAC,gBAAiB;GAEtB,MAAM,gBAAgB,eAAe;GACrC,MAAM,kBAAkB,mBAAmB;AAE3C,OAAI,cACF,KAAI,OAAO,kBAAkB,SAC3B,mBAAkB,gBAAgB,KAAK,aAAa;IAClD,MAAM,YAAY,KAAK,QAAQ,SAAS;IAExC,MAAM,WADW,KAAK,SAAS,SACN,CAAC,MAAM,IAAI,CAAC;IACrC,MAAM,sBAAsB,cACzB,QAAQ,KAAK,SAAS,CACtB,QAAQ,YAAY,OAAO;AAC9B,WAAO,KAAK,KAAK,WAAW,oBAAoB;KAChD;YACO,MAAM,QAAQ,cAAc,EAAE;IAEvC,MAAM,yBAAyB,oBAAoB,OAAO;IAC1D,MAAM,0BAA0B,oBAAoB,cAAc;AAElE,sBAAkB,gBAAgB,KAAK,aAAa;KAClD,MAAM,eAAe,YAAY,SAAS;AAG1C,UAAK,MAAM,aAAa,eAAe;AACrC,UAAI,CAAC,UAAU,WAAW,OAAO,UAAU,YAAY,SACrD;MAIF,MAAM,gBAAgB,0BACpB,UAAU,SACV,uBACD;AAED,UAAI,UAAU,SAAS,OAAO,UAAU,UAAU,UAAU;OAE1D,IAAI,cAAc,UAAU;AAC5B,qBAAc,0BACZ,aACA,wBACD;AAGD,WAAI,IADc,OAAO,YAChB,CAAC,KAAK,aAAa,EAAE;QAE5B,MAAM,kBAAkB,aAAa,QACnC,IAAI,OAAO,aAAa,IAAI,EAC5B,cACD;AACD,eAAO,KAAK,QAAQ,gBAAgB;;YAItC,QAAO,KAAK,QAAQ,cAAc;;AAKtC,YAAO;MACP;UACG;IAEL,MAAM,yBAAyB,oBAAoB,OAAO;IAC1D,MAAM,0BAA0B,oBAAoB,cAAc;AAClE,QACE,CAAC,cAAc,WACf,OAAO,cAAc,YAAY,SAEjC;IAGF,MAAM,gBAAgB,0BACpB,cAAc,SACd,uBACD;AACD,sBAAkB,gBAAgB,KAAK,aAAa;KAClD,IAAI,eAAe,YAAY,SAAS;AACxC,SACE,cAAc,SACd,OAAO,cAAc,UAAU,UAC/B;MAEA,IAAI,cAAc,cAAc;AAChC,oBAAc,0BACZ,aACA,wBACD;AAED,qBAAe,aAAa,QAC1B,IAAI,OAAO,aAAa,IAAI,EAC5B,cACD;WAED,gBAAe;AAEjB,YAAO,KAAK,QAAQ,aAAa;MACjC;;AAIN,QAAK,IAAI,IAAI,GAAG,IAAI,YAAY,QAAQ,KAAK;IAC3C,MAAM,aAAa,YAAY,YAAY,GAAG;AAO9C,kBAAc,cALS,YACrB,kBACI,8BAA8B,gBAAgB,IAAI,gBAAgB,GAClE,gBAAgB,GAEoB;;;AAI9C,cAAY,UAAU;;AAGxB,QAAO"}
@@ -1,14 +1,17 @@
1
- import { isValidMdx } from '../../../utils/validateMdx.js';
1
+ import { isValidMdx } from "../../../utils/validateMdx.js";
2
+ //#region src/formats/files/preprocess/mdx.ts
2
3
  /**
3
- * Runs MDX-specific preprocessing. Returns a skip reason if the file
4
- * should be skipped, or null if validation passed.
5
- */
6
- export function preprocessMdx(content, filePath, settings) {
7
- if (!settings.options?.skipFileValidation?.mdx) {
8
- const validation = isValidMdx(content, filePath);
9
- if (!validation.isValid) {
10
- return `MDX file is not AST parsable${validation.error ? `: ${validation.error}` : ''}`;
11
- }
12
- }
13
- return null;
4
+ * Runs MDX-specific preprocessing. Returns a skip reason if the file
5
+ * should be skipped, or null if validation passed.
6
+ */
7
+ function preprocessMdx(content, filePath, settings) {
8
+ if (!settings.options?.skipFileValidation?.mdx) {
9
+ const validation = isValidMdx(content, filePath);
10
+ if (!validation.isValid) return `MDX file is not AST parsable${validation.error ? `: ${validation.error}` : ""}`;
11
+ }
12
+ return null;
14
13
  }
14
+ //#endregion
15
+ export { preprocessMdx };
16
+
17
+ //# sourceMappingURL=mdx.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mdx.js","names":[],"sources":["../../../../src/formats/files/preprocess/mdx.ts"],"sourcesContent":["import { Settings } from '../../../types/index.js';\nimport { isValidMdx } from '../../../utils/validateMdx.js';\n\n/**\n * Runs MDX-specific preprocessing. Returns a skip reason if the file\n * should be skipped, or null if validation passed.\n */\nexport function preprocessMdx(\n content: string,\n filePath: string,\n settings: Settings\n): string | null {\n if (!settings.options?.skipFileValidation?.mdx) {\n const validation = isValidMdx(content, filePath);\n if (!validation.isValid) {\n return `MDX file is not AST parsable${validation.error ? `: ${validation.error}` : ''}`;\n }\n }\n return null;\n}\n"],"mappings":";;;;;;AAOA,SAAgB,cACd,SACA,UACA,UACe;AACf,KAAI,CAAC,SAAS,SAAS,oBAAoB,KAAK;EAC9C,MAAM,aAAa,WAAW,SAAS,SAAS;AAChD,MAAI,CAAC,WAAW,QACd,QAAO,+BAA+B,WAAW,QAAQ,KAAK,WAAW,UAAU;;AAGvF,QAAO"}
@@ -1,15 +1,17 @@
1
- import { applyMintlifyTitleFallback } from '../../../utils/mintlifyTitleFallback.js';
2
- import wrapPlainUrls from '../../../utils/wrapPlainUrls.js';
1
+ import { applyMintlifyTitleFallback } from "../../../utils/mintlifyTitleFallback.js";
2
+ import wrapPlainUrls from "../../../utils/wrapPlainUrls.js";
3
+ //#region src/formats/files/preprocess/mintlify.ts
3
4
  /**
4
- * Runs all Mintlify-specific preprocessing on file content.
5
- */
6
- export function preprocessMintlify(content, filePath, fileType, settings) {
7
- if (fileType !== 'mdx')
8
- return content;
9
- let result = content;
10
- if (settings.options?.mintlify?.inferTitleFromFilename) {
11
- result = applyMintlifyTitleFallback(result, filePath, settings.defaultLocale).content;
12
- }
13
- result = wrapPlainUrls(result);
14
- return result;
5
+ * Runs all Mintlify-specific preprocessing on file content.
6
+ */
7
+ function preprocessMintlify(content, filePath, fileType, settings) {
8
+ if (fileType !== "mdx") return content;
9
+ let result = content;
10
+ if (settings.options?.mintlify?.inferTitleFromFilename) result = applyMintlifyTitleFallback(result, filePath, settings.defaultLocale).content;
11
+ result = wrapPlainUrls(result);
12
+ return result;
15
13
  }
14
+ //#endregion
15
+ export { preprocessMintlify };
16
+
17
+ //# sourceMappingURL=mintlify.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mintlify.js","names":[],"sources":["../../../../src/formats/files/preprocess/mintlify.ts"],"sourcesContent":["import { Settings } from '../../../types/index.js';\nimport { applyMintlifyTitleFallback } from '../../../utils/mintlifyTitleFallback.js';\nimport wrapPlainUrls from '../../../utils/wrapPlainUrls.js';\n\n/**\n * Runs all Mintlify-specific preprocessing on file content.\n */\nexport function preprocessMintlify(\n content: string,\n filePath: string,\n fileType: string,\n settings: Settings\n): string {\n if (fileType !== 'mdx') return content;\n\n let result = content;\n\n if (settings.options?.mintlify?.inferTitleFromFilename) {\n result = applyMintlifyTitleFallback(\n result,\n filePath,\n settings.defaultLocale\n ).content;\n }\n\n result = wrapPlainUrls(result);\n\n return result;\n}\n"],"mappings":";;;;;;AAOA,SAAgB,mBACd,SACA,UACA,UACA,UACQ;AACR,KAAI,aAAa,MAAO,QAAO;CAE/B,IAAI,SAAS;AAEb,KAAI,SAAS,SAAS,UAAU,uBAC9B,UAAS,2BACP,QACA,UACA,SAAS,cACV,CAAC;AAGJ,UAAS,cAAc,OAAO;AAE9B,QAAO"}
@@ -1,23 +1,22 @@
1
- import { preprocessMdx } from './preprocess/mdx.js';
2
- import { preprocessMintlify } from './preprocess/mintlify.js';
3
- import sanitizeFileContent from '../../utils/sanitizeFileContent.js';
1
+ import sanitizeFileContent from "../../utils/sanitizeFileContent.js";
2
+ import { preprocessMdx } from "./preprocess/mdx.js";
3
+ import { preprocessMintlify } from "./preprocess/mintlify.js";
4
+ //#region src/formats/files/preprocessContent.ts
4
5
  /**
5
- * Preprocesses file content before upload. Returns the processed content,
6
- * or { skip: reason } if the file should be skipped.
7
- */
8
- export function preprocessContent(content, filePath, fileType, settings) {
9
- let result = content;
10
- // File-type-specific
11
- if (fileType === 'mdx') {
12
- const skipReason = preprocessMdx(result, filePath, settings);
13
- if (skipReason)
14
- return { skip: skipReason };
15
- }
16
- // Framework-specific
17
- if (settings.framework === 'mintlify') {
18
- result = preprocessMintlify(result, filePath, fileType, settings);
19
- }
20
- // Universal
21
- result = sanitizeFileContent(result);
22
- return result;
6
+ * Preprocesses file content before upload. Returns the processed content,
7
+ * or { skip: reason } if the file should be skipped.
8
+ */
9
+ function preprocessContent(content, filePath, fileType, settings) {
10
+ let result = content;
11
+ if (fileType === "mdx") {
12
+ const skipReason = preprocessMdx(result, filePath, settings);
13
+ if (skipReason) return { skip: skipReason };
14
+ }
15
+ if (settings.framework === "mintlify") result = preprocessMintlify(result, filePath, fileType, settings);
16
+ result = sanitizeFileContent(result);
17
+ return result;
23
18
  }
19
+ //#endregion
20
+ export { preprocessContent };
21
+
22
+ //# sourceMappingURL=preprocessContent.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"preprocessContent.js","names":[],"sources":["../../../src/formats/files/preprocessContent.ts"],"sourcesContent":["import { Settings } from '../../types/index.js';\nimport { preprocessMdx } from './preprocess/mdx.js';\nimport { preprocessMintlify } from './preprocess/mintlify.js';\nimport sanitizeFileContent from '../../utils/sanitizeFileContent.js';\n\n/**\n * Preprocesses file content before upload. Returns the processed content,\n * or { skip: reason } if the file should be skipped.\n */\nexport function preprocessContent(\n content: string,\n filePath: string,\n fileType: string,\n settings: Settings\n): string | { skip: string } {\n let result = content;\n\n // File-type-specific\n if (fileType === 'mdx') {\n const skipReason = preprocessMdx(result, filePath, settings);\n if (skipReason) return { skip: skipReason };\n }\n\n // Framework-specific\n if (settings.framework === 'mintlify') {\n result = preprocessMintlify(result, filePath, fileType, settings);\n }\n\n // Universal\n result = sanitizeFileContent(result);\n\n return result;\n}\n"],"mappings":";;;;;;;;AASA,SAAgB,kBACd,SACA,UACA,UACA,UAC2B;CAC3B,IAAI,SAAS;AAGb,KAAI,aAAa,OAAO;EACtB,MAAM,aAAa,cAAc,QAAQ,UAAU,SAAS;AAC5D,MAAI,WAAY,QAAO,EAAE,MAAM,YAAY;;AAI7C,KAAI,SAAS,cAAc,WACzB,UAAS,mBAAmB,QAAQ,UAAU,UAAU,SAAS;AAInE,UAAS,oBAAoB,OAAO;AAEpC,QAAO"}
@@ -1,17 +1,20 @@
1
- import fs from 'fs/promises';
2
- import path from 'node:path';
3
- import { logger } from '../../console/logger.js';
1
+ import { logger } from "../../console/logger.js";
2
+ import path from "node:path";
3
+ import fs from "fs/promises";
4
+ //#region src/formats/files/save.ts
4
5
  /**
5
- * Saves translated MDX/MD file content to the appropriate location
6
- */
7
- export async function saveTranslatedFile(translatedContent, outputDir, fileName, dataFormat, locales) {
8
- // Create locale-specific directories if they don't exist
9
- for (const locale of locales) {
10
- const localeDir = path.join(outputDir, locale);
11
- await fs.mkdir(localeDir, { recursive: true });
12
- // Save the translated file with the appropriate extension
13
- const outputPath = path.join(localeDir, fileName);
14
- await fs.writeFile(outputPath, translatedContent);
15
- logger.success(`Saved translated ${dataFormat} file to: ${outputPath}`);
16
- }
6
+ * Saves translated MDX/MD file content to the appropriate location
7
+ */
8
+ async function saveTranslatedFile(translatedContent, outputDir, fileName, dataFormat, locales) {
9
+ for (const locale of locales) {
10
+ const localeDir = path.join(outputDir, locale);
11
+ await fs.mkdir(localeDir, { recursive: true });
12
+ const outputPath = path.join(localeDir, fileName);
13
+ await fs.writeFile(outputPath, translatedContent);
14
+ logger.success(`Saved translated ${dataFormat} file to: ${outputPath}`);
15
+ }
17
16
  }
17
+ //#endregion
18
+ export { saveTranslatedFile };
19
+
20
+ //# sourceMappingURL=save.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"save.js","names":[],"sources":["../../../src/formats/files/save.ts"],"sourcesContent":["import fs from 'fs/promises';\nimport path from 'node:path';\nimport { DataFormat } from '../../types/data.js';\nimport { logger } from '../../console/logger.js';\n\n/**\n * Saves translated MDX/MD file content to the appropriate location\n */\nexport async function saveTranslatedFile(\n translatedContent: string,\n outputDir: string,\n fileName: string,\n dataFormat: DataFormat,\n locales: string[]\n): Promise<void> {\n // Create locale-specific directories if they don't exist\n for (const locale of locales) {\n const localeDir = path.join(outputDir, locale);\n await fs.mkdir(localeDir, { recursive: true });\n\n // Save the translated file with the appropriate extension\n const outputPath = path.join(localeDir, fileName);\n await fs.writeFile(outputPath, translatedContent);\n logger.success(`Saved translated ${dataFormat} file to: ${outputPath}`);\n }\n}\n"],"mappings":";;;;;;;AAQA,eAAsB,mBACpB,mBACA,WACA,UACA,YACA,SACe;AAEf,MAAK,MAAM,UAAU,SAAS;EAC5B,MAAM,YAAY,KAAK,KAAK,WAAW,OAAO;AAC9C,QAAM,GAAG,MAAM,WAAW,EAAE,WAAW,MAAM,CAAC;EAG9C,MAAM,aAAa,KAAK,KAAK,WAAW,SAAS;AACjD,QAAM,GAAG,UAAU,YAAY,kBAAkB;AACjD,SAAO,QAAQ,oBAAoB,WAAW,YAAY,aAAa"}