gt 2.14.35 → 2.14.37

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 (430) hide show
  1. package/CHANGELOG.md +22 -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.d.ts +1 -1
  256. package/dist/react/jsx/utils/resolveImportPath.js +125 -108
  257. package/dist/react/jsx/utils/resolveImportPath.js.map +1 -0
  258. package/dist/react/jsx/utils/stringParsing/derivation/containsDeriveCall.js +18 -24
  259. package/dist/react/jsx/utils/stringParsing/derivation/containsDeriveCall.js.map +1 -0
  260. package/dist/react/jsx/utils/stringParsing/derivation/handleDerivation.js +412 -579
  261. package/dist/react/jsx/utils/stringParsing/derivation/handleDerivation.js.map +1 -0
  262. package/dist/react/jsx/utils/stringParsing/derivation/index.js +57 -67
  263. package/dist/react/jsx/utils/stringParsing/derivation/index.js.map +1 -0
  264. package/dist/react/jsx/utils/stringParsing/derivation/isDeriveCall.js +26 -36
  265. package/dist/react/jsx/utils/stringParsing/derivation/isDeriveCall.js.map +1 -0
  266. package/dist/react/jsx/utils/stringParsing/processTaggedTemplateCall/handleTaggedTemplateTranslationCall.js +29 -24
  267. package/dist/react/jsx/utils/stringParsing/processTaggedTemplateCall/handleTaggedTemplateTranslationCall.js.map +1 -0
  268. package/dist/react/jsx/utils/stringParsing/processTaggedTemplateCall/index.js +34 -32
  269. package/dist/react/jsx/utils/stringParsing/processTaggedTemplateCall/index.js.map +1 -0
  270. package/dist/react/jsx/utils/stringParsing/processTranslationCall/extractStringEntryMetadata.js +80 -117
  271. package/dist/react/jsx/utils/stringParsing/processTranslationCall/extractStringEntryMetadata.js.map +1 -0
  272. package/dist/react/jsx/utils/stringParsing/processTranslationCall/handleDeriveTranslationCall.js +24 -19
  273. package/dist/react/jsx/utils/stringParsing/processTranslationCall/handleDeriveTranslationCall.js.map +1 -0
  274. package/dist/react/jsx/utils/stringParsing/processTranslationCall/handleInvalidTranslationCall.js +18 -21
  275. package/dist/react/jsx/utils/stringParsing/processTranslationCall/handleInvalidTranslationCall.js.map +1 -0
  276. package/dist/react/jsx/utils/stringParsing/processTranslationCall/handleLiteralTranslationCall.js +45 -50
  277. package/dist/react/jsx/utils/stringParsing/processTranslationCall/handleLiteralTranslationCall.js.map +1 -0
  278. package/dist/react/jsx/utils/stringParsing/processTranslationCall/index.js +54 -59
  279. package/dist/react/jsx/utils/stringParsing/processTranslationCall/index.js.map +1 -0
  280. package/dist/react/jsx/utils/stringParsing/processTranslationCall/routeTranslationCall.js +56 -69
  281. package/dist/react/jsx/utils/stringParsing/processTranslationCall/routeTranslationCall.js.map +1 -0
  282. package/dist/react/jsx/utils/validateStringFunction.js +21 -29
  283. package/dist/react/jsx/utils/validateStringFunction.js.map +1 -0
  284. package/dist/react/jsx/wrapJsx.js +192 -375
  285. package/dist/react/jsx/wrapJsx.js.map +1 -0
  286. package/dist/react/parse/addVitePlugin/index.js +40 -34
  287. package/dist/react/parse/addVitePlugin/index.js.map +1 -0
  288. package/dist/react/parse/addVitePlugin/installCompiler.js +18 -20
  289. package/dist/react/parse/addVitePlugin/installCompiler.js.map +1 -0
  290. package/dist/react/parse/addVitePlugin/updateViteConfig.js +107 -111
  291. package/dist/react/parse/addVitePlugin/updateViteConfig.js.map +1 -0
  292. package/dist/react/parse/addVitePlugin/utils/addCompilerImport.js +23 -26
  293. package/dist/react/parse/addVitePlugin/utils/addCompilerImport.js.map +1 -0
  294. package/dist/react/parse/addVitePlugin/utils/addPluginInvocation.js +29 -43
  295. package/dist/react/parse/addVitePlugin/utils/addPluginInvocation.js.map +1 -0
  296. package/dist/react/parse/addVitePlugin/utils/checkCompilerImport.js +70 -104
  297. package/dist/react/parse/addVitePlugin/utils/checkCompilerImport.js.map +1 -0
  298. package/dist/react/parse/addVitePlugin/utils/checkPluginInvocation.js +23 -29
  299. package/dist/react/parse/addVitePlugin/utils/checkPluginInvocation.js.map +1 -0
  300. package/dist/react/parse/createDictionaryUpdates.js +121 -185
  301. package/dist/react/parse/createDictionaryUpdates.js.map +1 -0
  302. package/dist/react/parse/createInlineUpdates.js +123 -139
  303. package/dist/react/parse/createInlineUpdates.js.map +1 -0
  304. package/dist/react/parse/wrapContent.js +131 -156
  305. package/dist/react/parse/wrapContent.js.map +1 -0
  306. package/dist/react/utils/flattenDictionary.js +55 -70
  307. package/dist/react/utils/flattenDictionary.js.map +1 -0
  308. package/dist/react/utils/getEntryAndMetadata.js +14 -10
  309. package/dist/react/utils/getEntryAndMetadata.js.map +1 -0
  310. package/dist/react/utils/getVariableName.js +36 -33
  311. package/dist/react/utils/getVariableName.js.map +1 -0
  312. package/dist/setup/detectFramework.js +85 -102
  313. package/dist/setup/detectFramework.js.map +1 -0
  314. package/dist/setup/frameworkUtils.js +17 -28
  315. package/dist/setup/frameworkUtils.js.map +1 -0
  316. package/dist/setup/userInput.js +24 -31
  317. package/dist/setup/userInput.js.map +1 -0
  318. package/dist/setup/wizard.js +141 -143
  319. package/dist/setup/wizard.js.map +1 -0
  320. package/dist/state/mintlifyRefMap.js +12 -9
  321. package/dist/state/mintlifyRefMap.js.map +1 -0
  322. package/dist/state/recentDownloads.js +26 -23
  323. package/dist/state/recentDownloads.js.map +1 -0
  324. package/dist/state/translateWarnings.js +17 -8
  325. package/dist/state/translateWarnings.js.map +1 -0
  326. package/dist/translation/parse.js +77 -98
  327. package/dist/translation/parse.js.map +1 -0
  328. package/dist/translation/stage.js +28 -43
  329. package/dist/translation/stage.js.map +1 -0
  330. package/dist/translation/validate.js +68 -91
  331. package/dist/translation/validate.js.map +1 -0
  332. package/dist/types/libraries.js +93 -91
  333. package/dist/types/libraries.js.map +1 -0
  334. package/dist/types/parsing.js +19 -10
  335. package/dist/types/parsing.js.map +1 -0
  336. package/dist/utils/addExplicitAnchorIds.js +270 -389
  337. package/dist/utils/addExplicitAnchorIds.js.map +1 -0
  338. package/dist/utils/calculateTimeoutMs.js +11 -6
  339. package/dist/utils/calculateTimeoutMs.js.map +1 -0
  340. package/dist/utils/constants.js +15 -12
  341. package/dist/utils/constants.js.map +1 -0
  342. package/dist/utils/credentials.js +67 -114
  343. package/dist/utils/credentials.js.map +1 -0
  344. package/dist/utils/fetch.js +22 -20
  345. package/dist/utils/fetch.js.map +1 -0
  346. package/dist/utils/flattenJsonFiles.js +27 -34
  347. package/dist/utils/flattenJsonFiles.js.map +1 -0
  348. package/dist/utils/gitDiff.js +30 -32
  349. package/dist/utils/gitDiff.js.map +1 -0
  350. package/dist/utils/gt.js +7 -2
  351. package/dist/utils/gt.js.map +1 -0
  352. package/dist/utils/hash.js +14 -9
  353. package/dist/utils/hash.js.map +1 -0
  354. package/dist/utils/headers.js +10 -13
  355. package/dist/utils/headers.js.map +1 -0
  356. package/dist/utils/installPackage.js +70 -75
  357. package/dist/utils/installPackage.js.map +1 -0
  358. package/dist/utils/localizeRelativeAssets.js +114 -157
  359. package/dist/utils/localizeRelativeAssets.js.map +1 -0
  360. package/dist/utils/localizeStaticImports.js +229 -371
  361. package/dist/utils/localizeStaticImports.js.map +1 -0
  362. package/dist/utils/localizeStaticUrls.js +241 -424
  363. package/dist/utils/localizeStaticUrls.js.map +1 -0
  364. package/dist/utils/mintlifyTitleFallback.js +64 -72
  365. package/dist/utils/mintlifyTitleFallback.js.map +1 -0
  366. package/dist/utils/monorepoVersionCheck.js +177 -215
  367. package/dist/utils/monorepoVersionCheck.js.map +1 -0
  368. package/dist/utils/packageInfo.js +17 -16
  369. package/dist/utils/packageInfo.js.map +1 -0
  370. package/dist/utils/packageJson.js +51 -66
  371. package/dist/utils/packageJson.js.map +1 -0
  372. package/dist/utils/packageManager.js +237 -260
  373. package/dist/utils/packageManager.js.map +1 -0
  374. package/dist/utils/parse/needsCJS.js +36 -69
  375. package/dist/utils/parse/needsCJS.js.map +1 -0
  376. package/dist/utils/persistPostprocessHashes.js +30 -32
  377. package/dist/utils/persistPostprocessHashes.js.map +1 -0
  378. package/dist/utils/processAnchorIds.js +32 -54
  379. package/dist/utils/processAnchorIds.js.map +1 -0
  380. package/dist/utils/processOpenApi.js +469 -578
  381. package/dist/utils/processOpenApi.js.map +1 -0
  382. package/dist/utils/resolveMintlifyRefs.js +89 -105
  383. package/dist/utils/resolveMintlifyRefs.js.map +1 -0
  384. package/dist/utils/resolvePublish.js +46 -54
  385. package/dist/utils/resolvePublish.js.map +1 -0
  386. package/dist/utils/sanitizeFileContent.js +20 -27
  387. package/dist/utils/sanitizeFileContent.js.map +1 -0
  388. package/dist/utils/sharedStaticAssets.js +248 -366
  389. package/dist/utils/sharedStaticAssets.js.map +1 -0
  390. package/dist/utils/splitMintlifyLanguageRefs.js +208 -282
  391. package/dist/utils/splitMintlifyLanguageRefs.js.map +1 -0
  392. package/dist/utils/validateMdx.js +26 -23
  393. package/dist/utils/validateMdx.js.map +1 -0
  394. package/dist/utils/wrapPlainUrls.js +58 -70
  395. package/dist/utils/wrapPlainUrls.js.map +1 -0
  396. package/dist/workflows/download.js +92 -126
  397. package/dist/workflows/download.js.map +1 -0
  398. package/dist/workflows/enqueue.js +47 -54
  399. package/dist/workflows/enqueue.js.map +1 -0
  400. package/dist/workflows/publish.js +29 -29
  401. package/dist/workflows/publish.js.map +1 -0
  402. package/dist/workflows/setupProject.js +39 -40
  403. package/dist/workflows/setupProject.js.map +1 -0
  404. package/dist/workflows/stage.js +61 -65
  405. package/dist/workflows/stage.js.map +1 -0
  406. package/dist/workflows/steps/BranchStep.js +118 -163
  407. package/dist/workflows/steps/BranchStep.js.map +1 -0
  408. package/dist/workflows/steps/DownloadStep.js +107 -137
  409. package/dist/workflows/steps/DownloadStep.js.map +1 -0
  410. package/dist/workflows/steps/EnqueueStep.js +32 -32
  411. package/dist/workflows/steps/EnqueueStep.js.map +1 -0
  412. package/dist/workflows/steps/PollJobsStep.js +208 -292
  413. package/dist/workflows/steps/PollJobsStep.js.map +1 -0
  414. package/dist/workflows/steps/PublishStep.js +33 -38
  415. package/dist/workflows/steps/PublishStep.js.map +1 -0
  416. package/dist/workflows/steps/SetupStep.js +71 -72
  417. package/dist/workflows/steps/SetupStep.js.map +1 -0
  418. package/dist/workflows/steps/TagStep.js +39 -44
  419. package/dist/workflows/steps/TagStep.js.map +1 -0
  420. package/dist/workflows/steps/UploadSourcesStep.js +108 -140
  421. package/dist/workflows/steps/UploadSourcesStep.js.map +1 -0
  422. package/dist/workflows/steps/UploadTranslationsStep.js +61 -71
  423. package/dist/workflows/steps/UploadTranslationsStep.js.map +1 -0
  424. package/dist/workflows/steps/UserEditDiffsStep.js +32 -34
  425. package/dist/workflows/steps/UserEditDiffsStep.js.map +1 -0
  426. package/dist/workflows/steps/WorkflowStep.js +6 -2
  427. package/dist/workflows/steps/WorkflowStep.js.map +1 -0
  428. package/dist/workflows/upload.js +45 -46
  429. package/dist/workflows/upload.js.map +1 -0
  430. package/package.json +14 -7
@@ -1,75 +1,60 @@
1
- import { logErrorAndExit } from '../../console/logging.js';
1
+ import { logErrorAndExit } from "../../console/logging.js";
2
+ //#region src/react/utils/flattenDictionary.ts
2
3
  const createDuplicateKeyError = (key) => `Duplicate key found in dictionary: "${key}"`;
3
4
  /**
4
- * Flattens a nested dictionary by concatenating nested keys.
5
- * Throws an error if two keys result in the same flattened key.
6
- * @param {Record<string, any>} dictionary - The dictionary to flatten.
7
- * @param {string} [prefix=''] - The prefix for nested keys.
8
- * @returns {Record<string, React.ReactNode>} The flattened dictionary object.
9
- * @throws {Error} If two keys result in the same flattened key.
10
- */
11
- export default function flattenDictionary(dictionary, prefix = '') {
12
- const flattened = {};
13
- for (const key in dictionary) {
14
- if (dictionary.hasOwnProperty(key)) {
15
- const newKey = prefix ? `${prefix}.${key}` : key;
16
- if (typeof dictionary[key] === 'object' &&
17
- dictionary[key] !== null &&
18
- !Array.isArray(dictionary[key])) {
19
- const nestedFlattened = flattenDictionary(dictionary[key], newKey);
20
- for (const flatKey in nestedFlattened) {
21
- if (flattened.hasOwnProperty(flatKey)) {
22
- logErrorAndExit(createDuplicateKeyError(flatKey));
23
- }
24
- flattened[flatKey] = nestedFlattened[flatKey];
25
- }
26
- }
27
- else {
28
- if (flattened.hasOwnProperty(newKey)) {
29
- logErrorAndExit(createDuplicateKeyError(newKey));
30
- }
31
- flattened[newKey] = dictionary[key];
32
- }
33
- }
34
- }
35
- return flattened;
5
+ * Flattens a nested dictionary by concatenating nested keys.
6
+ * Throws an error if two keys result in the same flattened key.
7
+ * @param {Record<string, any>} dictionary - The dictionary to flatten.
8
+ * @param {string} [prefix=''] - The prefix for nested keys.
9
+ * @returns {Record<string, React.ReactNode>} The flattened dictionary object.
10
+ * @throws {Error} If two keys result in the same flattened key.
11
+ */
12
+ function flattenDictionary(dictionary, prefix = "") {
13
+ const flattened = {};
14
+ for (const key in dictionary) if (dictionary.hasOwnProperty(key)) {
15
+ const newKey = prefix ? `${prefix}.${key}` : key;
16
+ if (typeof dictionary[key] === "object" && dictionary[key] !== null && !Array.isArray(dictionary[key])) {
17
+ const nestedFlattened = flattenDictionary(dictionary[key], newKey);
18
+ for (const flatKey in nestedFlattened) {
19
+ if (flattened.hasOwnProperty(flatKey)) logErrorAndExit(createDuplicateKeyError(flatKey));
20
+ flattened[flatKey] = nestedFlattened[flatKey];
21
+ }
22
+ } else {
23
+ if (flattened.hasOwnProperty(newKey)) logErrorAndExit(createDuplicateKeyError(newKey));
24
+ flattened[newKey] = dictionary[key];
25
+ }
26
+ }
27
+ return flattened;
36
28
  }
37
29
  /**
38
- * Flattens a nested dictionary containing only string values
39
- * Throws an error if two keys result in the same flattened key.
40
- * @param {JSONDictionary} dictionary - The dictionary to flatten.
41
- * @param {string} [prefix=''] - The prefix for nested keys.
42
- * @returns {FlattenedJSONDictionary} The flattened dictionary with string values.
43
- * @throws {Error} If two keys result in the same flattened key.
44
- * @throws {Error} If a value is an array.
45
- */
46
- export function flattenJsonDictionary(dictionary, prefix = '') {
47
- const flattened = {};
48
- for (const key in dictionary) {
49
- if (dictionary.hasOwnProperty(key)) {
50
- const newKey = prefix ? `${prefix}.${key}` : key;
51
- const value = dictionary[key];
52
- if (Array.isArray(value)) {
53
- logErrorAndExit(`Arrays are not supported in JSON dictionary at key: "${newKey}"`);
54
- }
55
- else if (typeof value === 'object' && value !== null) {
56
- // Recursively flatten nested objects
57
- const nestedFlattened = flattenJsonDictionary(value, newKey);
58
- for (const flatKey in nestedFlattened) {
59
- if (flattened.hasOwnProperty(flatKey)) {
60
- logErrorAndExit(createDuplicateKeyError(flatKey));
61
- }
62
- flattened[flatKey] = nestedFlattened[flatKey];
63
- }
64
- }
65
- else if (typeof value === 'string') {
66
- // Handle string values
67
- if (flattened.hasOwnProperty(newKey)) {
68
- logErrorAndExit(createDuplicateKeyError(newKey));
69
- }
70
- flattened[newKey] = value;
71
- }
72
- }
73
- }
74
- return flattened;
30
+ * Flattens a nested dictionary containing only string values
31
+ * Throws an error if two keys result in the same flattened key.
32
+ * @param {JSONDictionary} dictionary - The dictionary to flatten.
33
+ * @param {string} [prefix=''] - The prefix for nested keys.
34
+ * @returns {FlattenedJSONDictionary} The flattened dictionary with string values.
35
+ * @throws {Error} If two keys result in the same flattened key.
36
+ * @throws {Error} If a value is an array.
37
+ */
38
+ function flattenJsonDictionary(dictionary, prefix = "") {
39
+ const flattened = {};
40
+ for (const key in dictionary) if (dictionary.hasOwnProperty(key)) {
41
+ const newKey = prefix ? `${prefix}.${key}` : key;
42
+ const value = dictionary[key];
43
+ if (Array.isArray(value)) logErrorAndExit(`Arrays are not supported in JSON dictionary at key: "${newKey}"`);
44
+ else if (typeof value === "object" && value !== null) {
45
+ const nestedFlattened = flattenJsonDictionary(value, newKey);
46
+ for (const flatKey in nestedFlattened) {
47
+ if (flattened.hasOwnProperty(flatKey)) logErrorAndExit(createDuplicateKeyError(flatKey));
48
+ flattened[flatKey] = nestedFlattened[flatKey];
49
+ }
50
+ } else if (typeof value === "string") {
51
+ if (flattened.hasOwnProperty(newKey)) logErrorAndExit(createDuplicateKeyError(newKey));
52
+ flattened[newKey] = value;
53
+ }
54
+ }
55
+ return flattened;
75
56
  }
57
+ //#endregion
58
+ export { flattenDictionary as default, flattenJsonDictionary };
59
+
60
+ //# sourceMappingURL=flattenDictionary.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"flattenDictionary.js","names":[],"sources":["../../../src/react/utils/flattenDictionary.ts"],"sourcesContent":["import {\n Dictionary,\n FlattenedDictionary,\n FlattenedJSONDictionary,\n JSONDictionary,\n} from '../../types/data.js';\nimport { logErrorAndExit } from '../../console/logging.js';\n\nconst createDuplicateKeyError = (key: string) =>\n `Duplicate key found in dictionary: \"${key}\"`;\n\n/**\n * Flattens a nested dictionary by concatenating nested keys.\n * Throws an error if two keys result in the same flattened key.\n * @param {Record<string, any>} dictionary - The dictionary to flatten.\n * @param {string} [prefix=''] - The prefix for nested keys.\n * @returns {Record<string, React.ReactNode>} The flattened dictionary object.\n * @throws {Error} If two keys result in the same flattened key.\n */\nexport default function flattenDictionary(\n dictionary: Dictionary,\n prefix: string = ''\n): FlattenedDictionary {\n const flattened: FlattenedDictionary = {};\n for (const key in dictionary) {\n if (dictionary.hasOwnProperty(key)) {\n const newKey = prefix ? `${prefix}.${key}` : key;\n if (\n typeof dictionary[key] === 'object' &&\n dictionary[key] !== null &&\n !Array.isArray(dictionary[key])\n ) {\n const nestedFlattened = flattenDictionary(dictionary[key], newKey);\n for (const flatKey in nestedFlattened) {\n if (flattened.hasOwnProperty(flatKey)) {\n logErrorAndExit(createDuplicateKeyError(flatKey));\n }\n flattened[flatKey] = nestedFlattened[flatKey];\n }\n } else {\n if (flattened.hasOwnProperty(newKey)) {\n logErrorAndExit(createDuplicateKeyError(newKey));\n }\n flattened[newKey] = dictionary[key];\n }\n }\n }\n return flattened;\n}\n\n/**\n * Flattens a nested dictionary containing only string values\n * Throws an error if two keys result in the same flattened key.\n * @param {JSONDictionary} dictionary - The dictionary to flatten.\n * @param {string} [prefix=''] - The prefix for nested keys.\n * @returns {FlattenedJSONDictionary} The flattened dictionary with string values.\n * @throws {Error} If two keys result in the same flattened key.\n * @throws {Error} If a value is an array.\n */\nexport function flattenJsonDictionary(\n dictionary: JSONDictionary,\n prefix: string = ''\n): FlattenedJSONDictionary {\n const flattened: FlattenedJSONDictionary = {};\n for (const key in dictionary) {\n if (dictionary.hasOwnProperty(key)) {\n const newKey = prefix ? `${prefix}.${key}` : key;\n const value = dictionary[key];\n\n if (Array.isArray(value)) {\n logErrorAndExit(\n `Arrays are not supported in JSON dictionary at key: \"${newKey}\"`\n );\n } else if (typeof value === 'object' && value !== null) {\n // Recursively flatten nested objects\n const nestedFlattened = flattenJsonDictionary(value, newKey);\n for (const flatKey in nestedFlattened) {\n if (flattened.hasOwnProperty(flatKey)) {\n logErrorAndExit(createDuplicateKeyError(flatKey));\n }\n flattened[flatKey] = nestedFlattened[flatKey];\n }\n } else if (typeof value === 'string') {\n // Handle string values\n if (flattened.hasOwnProperty(newKey)) {\n logErrorAndExit(createDuplicateKeyError(newKey));\n }\n flattened[newKey] = value;\n }\n }\n }\n return flattened;\n}\n"],"mappings":";;AAQA,MAAM,2BAA2B,QAC/B,uCAAuC,IAAI;;;;;;;;;AAU7C,SAAwB,kBACtB,YACA,SAAiB,IACI;CACrB,MAAM,YAAiC,EAAE;AACzC,MAAK,MAAM,OAAO,WAChB,KAAI,WAAW,eAAe,IAAI,EAAE;EAClC,MAAM,SAAS,SAAS,GAAG,OAAO,GAAG,QAAQ;AAC7C,MACE,OAAO,WAAW,SAAS,YAC3B,WAAW,SAAS,QACpB,CAAC,MAAM,QAAQ,WAAW,KAAK,EAC/B;GACA,MAAM,kBAAkB,kBAAkB,WAAW,MAAM,OAAO;AAClE,QAAK,MAAM,WAAW,iBAAiB;AACrC,QAAI,UAAU,eAAe,QAAQ,CACnC,iBAAgB,wBAAwB,QAAQ,CAAC;AAEnD,cAAU,WAAW,gBAAgB;;SAElC;AACL,OAAI,UAAU,eAAe,OAAO,CAClC,iBAAgB,wBAAwB,OAAO,CAAC;AAElD,aAAU,UAAU,WAAW;;;AAIrC,QAAO;;;;;;;;;;;AAYT,SAAgB,sBACd,YACA,SAAiB,IACQ;CACzB,MAAM,YAAqC,EAAE;AAC7C,MAAK,MAAM,OAAO,WAChB,KAAI,WAAW,eAAe,IAAI,EAAE;EAClC,MAAM,SAAS,SAAS,GAAG,OAAO,GAAG,QAAQ;EAC7C,MAAM,QAAQ,WAAW;AAEzB,MAAI,MAAM,QAAQ,MAAM,CACtB,iBACE,wDAAwD,OAAO,GAChE;WACQ,OAAO,UAAU,YAAY,UAAU,MAAM;GAEtD,MAAM,kBAAkB,sBAAsB,OAAO,OAAO;AAC5D,QAAK,MAAM,WAAW,iBAAiB;AACrC,QAAI,UAAU,eAAe,QAAQ,CACnC,iBAAgB,wBAAwB,QAAQ,CAAC;AAEnD,cAAU,WAAW,gBAAgB;;aAE9B,OAAO,UAAU,UAAU;AAEpC,OAAI,UAAU,eAAe,OAAO,CAClC,iBAAgB,wBAAwB,OAAO,CAAC;AAElD,aAAU,UAAU;;;AAI1B,QAAO"}
@@ -1,11 +1,15 @@
1
- export default function getEntryAndMetadata(value) {
2
- if (Array.isArray(value)) {
3
- if (value.length === 1) {
4
- return { entry: value[0] };
5
- }
6
- if (value.length === 2) {
7
- return { entry: value[0], metadata: value[1] };
8
- }
9
- }
10
- return { entry: value };
1
+ //#region src/react/utils/getEntryAndMetadata.ts
2
+ function getEntryAndMetadata(value) {
3
+ if (Array.isArray(value)) {
4
+ if (value.length === 1) return { entry: value[0] };
5
+ if (value.length === 2) return {
6
+ entry: value[0],
7
+ metadata: value[1]
8
+ };
9
+ }
10
+ return { entry: value };
11
11
  }
12
+ //#endregion
13
+ export { getEntryAndMetadata as default };
14
+
15
+ //# sourceMappingURL=getEntryAndMetadata.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getEntryAndMetadata.js","names":[],"sources":["../../../src/react/utils/getEntryAndMetadata.ts"],"sourcesContent":["import { DictionaryEntry, DictionaryMetadata } from '../../types/data.js';\n\nexport default function getEntryAndMetadata(value: DictionaryEntry): {\n entry: string;\n metadata?: DictionaryMetadata;\n} {\n if (Array.isArray(value)) {\n if (value.length === 1) {\n return { entry: value[0] };\n }\n if (value.length === 2) {\n return { entry: value[0], metadata: value[1] as DictionaryMetadata };\n }\n }\n return { entry: value };\n}\n"],"mappings":";AAEA,SAAwB,oBAAoB,OAG1C;AACA,KAAI,MAAM,QAAQ,MAAM,EAAE;AACxB,MAAI,MAAM,WAAW,EACnB,QAAO,EAAE,OAAO,MAAM,IAAI;AAE5B,MAAI,MAAM,WAAW,EACnB,QAAO;GAAE,OAAO,MAAM;GAAI,UAAU,MAAM;GAA0B;;AAGxE,QAAO,EAAE,OAAO,OAAO"}
@@ -1,41 +1,44 @@
1
+ //#region src/react/utils/getVariableName.ts
1
2
  /**
2
- * These are the names of the variable components as they appear in gt-next and gt-react
3
- */
4
- export const defaultVariableNames = {
5
- Var: 'value',
6
- GtInternalVar: 'value',
7
- Num: 'n',
8
- DateTime: 'date',
9
- RelativeTime: 'time',
10
- Currency: 'cost',
3
+ * These are the names of the variable components as they appear in gt-next and gt-react
4
+ */
5
+ const defaultVariableNames = {
6
+ Var: "value",
7
+ GtInternalVar: "value",
8
+ Num: "n",
9
+ DateTime: "date",
10
+ RelativeTime: "time",
11
+ Currency: "cost"
11
12
  };
12
13
  const minifyVariableTypeMap = {
13
- Var: 'v',
14
- GtInternalVar: 'v',
15
- Num: 'n',
16
- DateTime: 'd',
17
- RelativeTime: 'rt',
18
- Currency: 'c',
14
+ Var: "v",
15
+ GtInternalVar: "v",
16
+ Num: "n",
17
+ DateTime: "d",
18
+ RelativeTime: "rt",
19
+ Currency: "c"
19
20
  };
20
21
  /**
21
- * Minify the variable type from the name of the variable component (from gt-next and gt-react)
22
- * @param variableType - The type of the variable (Var, Num, DateTime, Currency)
23
- * @returns The minified variable type
24
- */
25
- export const minifyVariableType = (variableType) => {
26
- return minifyVariableTypeMap[variableType];
22
+ * Minify the variable type from the name of the variable component (from gt-next and gt-react)
23
+ * @param variableType - The type of the variable (Var, Num, DateTime, Currency)
24
+ * @returns The minified variable type
25
+ */
26
+ const minifyVariableType = (variableType) => {
27
+ return minifyVariableTypeMap[variableType];
27
28
  };
28
- export const baseVariablePrefix = '_gt_';
29
+ const baseVariablePrefix = "_gt_";
29
30
  /**
30
- * Get the name of a variable
31
- * @param props - The props of the variable
32
- * @param variableType - The type of the variable (Var, Num, DateTime, Currency)
33
- * @param id - The id of the variable
34
- * @returns The name of the variable
35
- */
36
- export function getVariableName(props = {}, variableType, id) {
37
- if (typeof props.name === 'string')
38
- return props.name;
39
- const baseVariableName = defaultVariableNames[variableType] || 'value';
40
- return `${baseVariablePrefix}${baseVariableName}_${id}`;
31
+ * Get the name of a variable
32
+ * @param props - The props of the variable
33
+ * @param variableType - The type of the variable (Var, Num, DateTime, Currency)
34
+ * @param id - The id of the variable
35
+ * @returns The name of the variable
36
+ */
37
+ function getVariableName(props = {}, variableType, id) {
38
+ if (typeof props.name === "string") return props.name;
39
+ return `${baseVariablePrefix}${defaultVariableNames[variableType] || "value"}_${id}`;
41
40
  }
41
+ //#endregion
42
+ export { baseVariablePrefix, defaultVariableNames, getVariableName, minifyVariableType };
43
+
44
+ //# sourceMappingURL=getVariableName.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getVariableName.js","names":[],"sources":["../../../src/react/utils/getVariableName.ts"],"sourcesContent":["import type { VariableType } from '@generaltranslation/format/types';\n\n/**\n * These are the names of the variable components as they appear in gt-next and gt-react\n */\nexport const defaultVariableNames = {\n Var: 'value',\n GtInternalVar: 'value',\n Num: 'n',\n DateTime: 'date',\n RelativeTime: 'time',\n Currency: 'cost',\n} as const;\n\nconst minifyVariableTypeMap = {\n Var: 'v',\n GtInternalVar: 'v',\n Num: 'n',\n DateTime: 'd',\n RelativeTime: 'rt',\n Currency: 'c',\n} as const;\n\n/**\n * Minify the variable type from the name of the variable component (from gt-next and gt-react)\n * @param variableType - The type of the variable (Var, Num, DateTime, Currency)\n * @returns The minified variable type\n */\nexport const minifyVariableType = (\n variableType: keyof typeof defaultVariableNames\n): VariableType => {\n return minifyVariableTypeMap[variableType] as VariableType;\n};\n\nexport const baseVariablePrefix = '_gt_';\n\n/**\n * Get the name of a variable\n * @param props - The props of the variable\n * @param variableType - The type of the variable (Var, Num, DateTime, Currency)\n * @param id - The id of the variable\n * @returns The name of the variable\n */\nexport function getVariableName(\n props: Record<string, unknown> = {},\n variableType: keyof typeof defaultVariableNames,\n id: number\n): string {\n if (typeof props.name === 'string') return props.name;\n const baseVariableName =\n (defaultVariableNames as Record<string, string>)[variableType] || 'value';\n return `${baseVariablePrefix}${baseVariableName}_${id}`;\n}\n"],"mappings":";;;;AAKA,MAAa,uBAAuB;CAClC,KAAK;CACL,eAAe;CACf,KAAK;CACL,UAAU;CACV,cAAc;CACd,UAAU;CACX;AAED,MAAM,wBAAwB;CAC5B,KAAK;CACL,eAAe;CACf,KAAK;CACL,UAAU;CACV,cAAc;CACd,UAAU;CACX;;;;;;AAOD,MAAa,sBACX,iBACiB;AACjB,QAAO,sBAAsB;;AAG/B,MAAa,qBAAqB;;;;;;;;AASlC,SAAgB,gBACd,QAAiC,EAAE,EACnC,cACA,IACQ;AACR,KAAI,OAAO,MAAM,SAAS,SAAU,QAAO,MAAM;AAGjD,QAAO,GAAG,qBADP,qBAAgD,iBAAiB,QACpB,GAAG"}
@@ -1,106 +1,89 @@
1
- import { isPackageInstalled } from '../utils/packageJson.js';
2
- import { searchForPackageJson } from '../utils/packageJson.js';
3
- import fs from 'node:fs';
4
- import path from 'node:path';
5
- /* ----- MAIN ----- */
1
+ import { isPackageInstalled, searchForPackageJson } from "../utils/packageJson.js";
2
+ import path from "node:path";
3
+ import fs from "node:fs";
4
+ //#region src/setup/detectFramework.ts
6
5
  /**
7
- * Detects the frontend framework used in the current project.
8
- *
9
- * Analyzes the project structure and dependencies to identify the framework.
10
- * Detection order: Mintlify → Next.js (App/Pages Router) → Gatsby → RedwoodJS → Vite → React.
11
- *
12
- * For Next.js projects, further determines whether it uses App Router or Pages Router
13
- * by checking for the presence of `app/` or `pages/` directories.
14
- *
15
- * @returns A promise resolving to a FrameworkObject containing:
16
- * - `name`: The detected framework identifier (e.g., 'next-app', 'gatsby', 'react')
17
- * or undefined if no framework is detected
18
- * - `type`: The framework category (currently only 'react' for React-based frameworks)
19
- */
20
- export async function detectFramework() {
21
- const packageJson = await searchForPackageJson();
22
- if (isMintlifyProject(packageJson)) {
23
- return { name: 'mintlify' };
24
- }
25
- if (!packageJson) {
26
- return { name: undefined };
27
- }
28
- // Check for Next.js first
29
- if (isPackageInstalled('next', packageJson, false, true)) {
30
- // Determine if it's App Router or Pages Router
31
- const cwd = process.cwd();
32
- const hasAppDir = fs.existsSync(path.join(cwd, 'app')) ||
33
- fs.existsSync(path.join(cwd, 'src', 'app'));
34
- const hasPagesDir = fs.existsSync(path.join(cwd, 'pages')) ||
35
- fs.existsSync(path.join(cwd, 'src', 'pages'));
36
- // App Router takes precedence if both exist
37
- if (hasAppDir) {
38
- return { name: 'next-app', type: 'react' };
39
- }
40
- if (hasPagesDir) {
41
- return { name: 'next-pages', type: 'react' };
42
- }
43
- // Default to app router for new Next.js projects
44
- return { name: 'next-app', type: 'react' };
45
- }
46
- // Check for Gatsby
47
- if (isPackageInstalled('gatsby', packageJson, false, true)) {
48
- return { name: 'gatsby', type: 'react' };
49
- }
50
- // Check for RedwoodJS
51
- if (isPackageInstalled('@redwoodjs/core', packageJson, false, true)) {
52
- return { name: 'redwood', type: 'react' };
53
- }
54
- // Check for Vite
55
- if (isPackageInstalled('vite', packageJson, false, true)) {
56
- return { name: 'vite', type: 'react' };
57
- }
58
- // Check for React (generic)
59
- if (isPackageInstalled('react', packageJson, false, true)) {
60
- return { name: 'react', type: 'react' };
61
- }
62
- return { name: undefined };
6
+ * Detects the frontend framework used in the current project.
7
+ *
8
+ * Analyzes the project structure and dependencies to identify the framework.
9
+ * Detection order: Mintlify → Next.js (App/Pages Router) → Gatsby → RedwoodJS → Vite → React.
10
+ *
11
+ * For Next.js projects, further determines whether it uses App Router or Pages Router
12
+ * by checking for the presence of `app/` or `pages/` directories.
13
+ *
14
+ * @returns A promise resolving to a FrameworkObject containing:
15
+ * - `name`: The detected framework identifier (e.g., 'next-app', 'gatsby', 'react')
16
+ * or undefined if no framework is detected
17
+ * - `type`: The framework category (currently only 'react' for React-based frameworks)
18
+ */
19
+ async function detectFramework() {
20
+ const packageJson = await searchForPackageJson();
21
+ if (isMintlifyProject(packageJson)) return { name: "mintlify" };
22
+ if (!packageJson) return { name: void 0 };
23
+ if (isPackageInstalled("next", packageJson, false, true)) {
24
+ const cwd = process.cwd();
25
+ const hasAppDir = fs.existsSync(path.join(cwd, "app")) || fs.existsSync(path.join(cwd, "src", "app"));
26
+ const hasPagesDir = fs.existsSync(path.join(cwd, "pages")) || fs.existsSync(path.join(cwd, "src", "pages"));
27
+ if (hasAppDir) return {
28
+ name: "next-app",
29
+ type: "react"
30
+ };
31
+ if (hasPagesDir) return {
32
+ name: "next-pages",
33
+ type: "react"
34
+ };
35
+ return {
36
+ name: "next-app",
37
+ type: "react"
38
+ };
39
+ }
40
+ if (isPackageInstalled("gatsby", packageJson, false, true)) return {
41
+ name: "gatsby",
42
+ type: "react"
43
+ };
44
+ if (isPackageInstalled("@redwoodjs/core", packageJson, false, true)) return {
45
+ name: "redwood",
46
+ type: "react"
47
+ };
48
+ if (isPackageInstalled("vite", packageJson, false, true)) return {
49
+ name: "vite",
50
+ type: "react"
51
+ };
52
+ if (isPackageInstalled("react", packageJson, false, true)) return {
53
+ name: "react",
54
+ type: "react"
55
+ };
56
+ return { name: void 0 };
63
57
  }
64
- // ----- HELPER FUNCTIONS ----- //
65
58
  /**
66
- * Detects if the current project is a Mintlify documentation project.
67
- *
68
- * Checks for the presence of docs.json (preferred) or mint.json (legacy) files.
69
- * For docs.json, validates that the $schema field contains "mintlify.com/docs.json".
70
- * Rejects projects with Next.js config files to avoid misclassification.
71
- *
72
- * @param _packageJson - The parsed package.json object (not used for Mintlify detection,
73
- * but kept for API consistency with other detection functions)
74
- * @returns True if the project is identified as a Mintlify project, false otherwise
75
- */
76
- export function isMintlifyProject(_packageJson) {
77
- const cwd = process.cwd();
78
- // Check for Next.js config files - if present, this is not a Mintlify project
79
- const nextConfigFiles = [
80
- 'next.config.js',
81
- 'next.config.ts',
82
- 'next.config.mjs',
83
- 'next.config.cjs',
84
- ];
85
- for (const configFile of nextConfigFiles) {
86
- if (fs.existsSync(path.join(cwd, configFile))) {
87
- return false;
88
- }
89
- }
90
- // Check for docs.json (preferred format)
91
- const docsJsonPath = path.join(cwd, 'docs.json');
92
- if (fs.existsSync(docsJsonPath)) {
93
- try {
94
- const docsJson = JSON.parse(fs.readFileSync(docsJsonPath, 'utf-8'));
95
- // Validate the $schema field contains mintlify.com/docs.json
96
- if (docsJson.$schema &&
97
- docsJson.$schema.includes('mintlify.com/docs.json')) {
98
- return true;
99
- }
100
- }
101
- catch {
102
- return false;
103
- }
104
- }
105
- return false;
59
+ * Detects if the current project is a Mintlify documentation project.
60
+ *
61
+ * Checks for the presence of docs.json (preferred) or mint.json (legacy) files.
62
+ * For docs.json, validates that the $schema field contains "mintlify.com/docs.json".
63
+ * Rejects projects with Next.js config files to avoid misclassification.
64
+ *
65
+ * @param _packageJson - The parsed package.json object (not used for Mintlify detection,
66
+ * but kept for API consistency with other detection functions)
67
+ * @returns True if the project is identified as a Mintlify project, false otherwise
68
+ */
69
+ function isMintlifyProject(_packageJson) {
70
+ const cwd = process.cwd();
71
+ for (const configFile of [
72
+ "next.config.js",
73
+ "next.config.ts",
74
+ "next.config.mjs",
75
+ "next.config.cjs"
76
+ ]) if (fs.existsSync(path.join(cwd, configFile))) return false;
77
+ const docsJsonPath = path.join(cwd, "docs.json");
78
+ if (fs.existsSync(docsJsonPath)) try {
79
+ const docsJson = JSON.parse(fs.readFileSync(docsJsonPath, "utf-8"));
80
+ if (docsJson.$schema && docsJson.$schema.includes("mintlify.com/docs.json")) return true;
81
+ } catch {
82
+ return false;
83
+ }
84
+ return false;
106
85
  }
86
+ //#endregion
87
+ export { detectFramework, isMintlifyProject };
88
+
89
+ //# sourceMappingURL=detectFramework.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"detectFramework.js","names":[],"sources":["../../src/setup/detectFramework.ts"],"sourcesContent":["import { FrameworkObject } from '../types/index.js';\nimport { isPackageInstalled } from '../utils/packageJson.js';\nimport { searchForPackageJson } from '../utils/packageJson.js';\nimport fs from 'node:fs';\nimport path from 'node:path';\n\n/* ----- MAIN ----- */\n\n/**\n * Detects the frontend framework used in the current project.\n *\n * Analyzes the project structure and dependencies to identify the framework.\n * Detection order: Mintlify → Next.js (App/Pages Router) → Gatsby → RedwoodJS → Vite → React.\n *\n * For Next.js projects, further determines whether it uses App Router or Pages Router\n * by checking for the presence of `app/` or `pages/` directories.\n *\n * @returns A promise resolving to a FrameworkObject containing:\n * - `name`: The detected framework identifier (e.g., 'next-app', 'gatsby', 'react')\n * or undefined if no framework is detected\n * - `type`: The framework category (currently only 'react' for React-based frameworks)\n */\nexport async function detectFramework(): Promise<\n FrameworkObject | { name: undefined; type?: undefined }\n> {\n const packageJson = await searchForPackageJson();\n\n if (isMintlifyProject(packageJson)) {\n return { name: 'mintlify' };\n }\n\n if (!packageJson) {\n return { name: undefined };\n }\n\n // Check for Next.js first\n if (isPackageInstalled('next', packageJson, false, true)) {\n // Determine if it's App Router or Pages Router\n const cwd = process.cwd();\n const hasAppDir =\n fs.existsSync(path.join(cwd, 'app')) ||\n fs.existsSync(path.join(cwd, 'src', 'app'));\n const hasPagesDir =\n fs.existsSync(path.join(cwd, 'pages')) ||\n fs.existsSync(path.join(cwd, 'src', 'pages'));\n\n // App Router takes precedence if both exist\n if (hasAppDir) {\n return { name: 'next-app', type: 'react' };\n }\n if (hasPagesDir) {\n return { name: 'next-pages', type: 'react' };\n }\n // Default to app router for new Next.js projects\n return { name: 'next-app', type: 'react' };\n }\n\n // Check for Gatsby\n if (isPackageInstalled('gatsby', packageJson, false, true)) {\n return { name: 'gatsby', type: 'react' };\n }\n\n // Check for RedwoodJS\n if (isPackageInstalled('@redwoodjs/core', packageJson, false, true)) {\n return { name: 'redwood', type: 'react' };\n }\n\n // Check for Vite\n if (isPackageInstalled('vite', packageJson, false, true)) {\n return { name: 'vite', type: 'react' };\n }\n\n // Check for React (generic)\n if (isPackageInstalled('react', packageJson, false, true)) {\n return { name: 'react', type: 'react' };\n }\n\n return { name: undefined };\n}\n\n// ----- HELPER FUNCTIONS ----- //\n\n/**\n * Detects if the current project is a Mintlify documentation project.\n *\n * Checks for the presence of docs.json (preferred) or mint.json (legacy) files.\n * For docs.json, validates that the $schema field contains \"mintlify.com/docs.json\".\n * Rejects projects with Next.js config files to avoid misclassification.\n *\n * @param _packageJson - The parsed package.json object (not used for Mintlify detection,\n * but kept for API consistency with other detection functions)\n * @returns True if the project is identified as a Mintlify project, false otherwise\n */\nexport function isMintlifyProject(\n _packageJson: Record<string, unknown> | null\n): boolean {\n const cwd = process.cwd();\n\n // Check for Next.js config files - if present, this is not a Mintlify project\n const nextConfigFiles = [\n 'next.config.js',\n 'next.config.ts',\n 'next.config.mjs',\n 'next.config.cjs',\n ];\n\n for (const configFile of nextConfigFiles) {\n if (fs.existsSync(path.join(cwd, configFile))) {\n return false;\n }\n }\n\n // Check for docs.json (preferred format)\n const docsJsonPath = path.join(cwd, 'docs.json');\n if (fs.existsSync(docsJsonPath)) {\n try {\n const docsJson = JSON.parse(fs.readFileSync(docsJsonPath, 'utf-8'));\n // Validate the $schema field contains mintlify.com/docs.json\n if (\n docsJson.$schema &&\n docsJson.$schema.includes('mintlify.com/docs.json')\n ) {\n return true;\n }\n } catch {\n return false;\n }\n }\n\n return false;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAsBA,eAAsB,kBAEpB;CACA,MAAM,cAAc,MAAM,sBAAsB;AAEhD,KAAI,kBAAkB,YAAY,CAChC,QAAO,EAAE,MAAM,YAAY;AAG7B,KAAI,CAAC,YACH,QAAO,EAAE,MAAM,KAAA,GAAW;AAI5B,KAAI,mBAAmB,QAAQ,aAAa,OAAO,KAAK,EAAE;EAExD,MAAM,MAAM,QAAQ,KAAK;EACzB,MAAM,YACJ,GAAG,WAAW,KAAK,KAAK,KAAK,MAAM,CAAC,IACpC,GAAG,WAAW,KAAK,KAAK,KAAK,OAAO,MAAM,CAAC;EAC7C,MAAM,cACJ,GAAG,WAAW,KAAK,KAAK,KAAK,QAAQ,CAAC,IACtC,GAAG,WAAW,KAAK,KAAK,KAAK,OAAO,QAAQ,CAAC;AAG/C,MAAI,UACF,QAAO;GAAE,MAAM;GAAY,MAAM;GAAS;AAE5C,MAAI,YACF,QAAO;GAAE,MAAM;GAAc,MAAM;GAAS;AAG9C,SAAO;GAAE,MAAM;GAAY,MAAM;GAAS;;AAI5C,KAAI,mBAAmB,UAAU,aAAa,OAAO,KAAK,CACxD,QAAO;EAAE,MAAM;EAAU,MAAM;EAAS;AAI1C,KAAI,mBAAmB,mBAAmB,aAAa,OAAO,KAAK,CACjE,QAAO;EAAE,MAAM;EAAW,MAAM;EAAS;AAI3C,KAAI,mBAAmB,QAAQ,aAAa,OAAO,KAAK,CACtD,QAAO;EAAE,MAAM;EAAQ,MAAM;EAAS;AAIxC,KAAI,mBAAmB,SAAS,aAAa,OAAO,KAAK,CACvD,QAAO;EAAE,MAAM;EAAS,MAAM;EAAS;AAGzC,QAAO,EAAE,MAAM,KAAA,GAAW;;;;;;;;;;;;;AAgB5B,SAAgB,kBACd,cACS;CACT,MAAM,MAAM,QAAQ,KAAK;AAUzB,MAAK,MAAM,cAAc;EANvB;EACA;EACA;EACA;EAGsC,CACtC,KAAI,GAAG,WAAW,KAAK,KAAK,KAAK,WAAW,CAAC,CAC3C,QAAO;CAKX,MAAM,eAAe,KAAK,KAAK,KAAK,YAAY;AAChD,KAAI,GAAG,WAAW,aAAa,CAC7B,KAAI;EACF,MAAM,WAAW,KAAK,MAAM,GAAG,aAAa,cAAc,QAAQ,CAAC;AAEnE,MACE,SAAS,WACT,SAAS,QAAQ,SAAS,yBAAyB,CAEnD,QAAO;SAEH;AACN,SAAO;;AAIX,QAAO"}
@@ -1,30 +1,19 @@
1
- import { Libraries } from '../types/libraries.js';
2
- export function getFrameworkDisplayName(frameworkObject) {
3
- if (frameworkObject.name === 'mintlify') {
4
- return 'Mintlify';
5
- }
6
- if (frameworkObject.name === 'next-app') {
7
- return 'Next.js App Router';
8
- }
9
- if (frameworkObject.name === 'next-pages') {
10
- return 'Next.js Pages Router';
11
- }
12
- if (frameworkObject.name === 'vite') {
13
- return 'Vite + React';
14
- }
15
- if (frameworkObject.name === 'gatsby') {
16
- return 'Gatsby';
17
- }
18
- if (frameworkObject.name === 'redwood') {
19
- return 'RedwoodJS';
20
- }
21
- if (frameworkObject.type === 'react') {
22
- return 'React';
23
- }
24
- return 'another framework';
1
+ import "../types/libraries.js";
2
+ //#region src/setup/frameworkUtils.ts
3
+ function getFrameworkDisplayName(frameworkObject) {
4
+ if (frameworkObject.name === "mintlify") return "Mintlify";
5
+ if (frameworkObject.name === "next-app") return "Next.js App Router";
6
+ if (frameworkObject.name === "next-pages") return "Next.js Pages Router";
7
+ if (frameworkObject.name === "vite") return "Vite + React";
8
+ if (frameworkObject.name === "gatsby") return "Gatsby";
9
+ if (frameworkObject.name === "redwood") return "RedwoodJS";
10
+ if (frameworkObject.type === "react") return "React";
11
+ return "another framework";
25
12
  }
26
- export function getReactFrameworkLibrary(frameworkObject) {
27
- return frameworkObject.name === 'next-app'
28
- ? Libraries.GT_NEXT
29
- : Libraries.GT_REACT;
13
+ function getReactFrameworkLibrary(frameworkObject) {
14
+ return frameworkObject.name === "next-app" ? "gt-next" : "gt-react";
30
15
  }
16
+ //#endregion
17
+ export { getFrameworkDisplayName, getReactFrameworkLibrary };
18
+
19
+ //# sourceMappingURL=frameworkUtils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"frameworkUtils.js","names":[],"sources":["../../src/setup/frameworkUtils.ts"],"sourcesContent":["import { FrameworkObject, ReactFrameworkObject } from '../types/index.js';\nimport { Libraries } from '../types/libraries.js';\n\nexport function getFrameworkDisplayName(\n frameworkObject: FrameworkObject\n): string {\n if (frameworkObject.name === 'mintlify') {\n return 'Mintlify';\n }\n if (frameworkObject.name === 'next-app') {\n return 'Next.js App Router';\n }\n if (frameworkObject.name === 'next-pages') {\n return 'Next.js Pages Router';\n }\n if (frameworkObject.name === 'vite') {\n return 'Vite + React';\n }\n if (frameworkObject.name === 'gatsby') {\n return 'Gatsby';\n }\n if (frameworkObject.name === 'redwood') {\n return 'RedwoodJS';\n }\n if (frameworkObject.type === 'react') {\n return 'React';\n }\n return 'another framework';\n}\n\nexport function getReactFrameworkLibrary(\n frameworkObject: ReactFrameworkObject\n): string {\n return frameworkObject.name === 'next-app'\n ? Libraries.GT_NEXT\n : Libraries.GT_REACT;\n}\n"],"mappings":";;AAGA,SAAgB,wBACd,iBACQ;AACR,KAAI,gBAAgB,SAAS,WAC3B,QAAO;AAET,KAAI,gBAAgB,SAAS,WAC3B,QAAO;AAET,KAAI,gBAAgB,SAAS,aAC3B,QAAO;AAET,KAAI,gBAAgB,SAAS,OAC3B,QAAO;AAET,KAAI,gBAAgB,SAAS,SAC3B,QAAO;AAET,KAAI,gBAAgB,SAAS,UAC3B,QAAO;AAET,KAAI,gBAAgB,SAAS,QAC3B,QAAO;AAET,QAAO;;AAGT,SAAgB,yBACd,iBACQ;AACR,QAAO,gBAAgB,SAAS,aAAA,YAAA"}
@@ -1,32 +1,25 @@
1
- import { libraryDefaultLocale } from 'generaltranslation/internal';
2
- import { promptText } from '../console/logging.js';
3
- import chalk from 'chalk';
4
- import { gt } from '../utils/gt.js';
5
- export async function getDesiredLocales() {
6
- // Ask for the default locale
7
- const defaultLocale = await promptText({
8
- message: 'What is the default locale for your project?',
9
- defaultValue: libraryDefaultLocale,
10
- });
11
- // Ask for the locales
12
- const locales = await promptText({
13
- message: `Which languages would you like to translate your project into? Enter your response as a list of BCP-47 locale tags. ${chalk.dim('(space-separated list)')}`,
14
- defaultValue: 'es fr de ja zh',
15
- validate: (input) => {
16
- const localeList = input.split(' ');
17
- if (localeList.length === 0) {
18
- return 'Enter at least one locale';
19
- }
20
- if (localeList.some((locale) => !locale.trim())) {
21
- return 'Enter a valid locale (e.g., es fr de)';
22
- }
23
- for (const locale of localeList) {
24
- if (!gt.isValidLocale(locale)) {
25
- return 'Enter a valid locale (e.g., es fr de)';
26
- }
27
- }
28
- return true;
29
- },
30
- });
31
- return { defaultLocale, locales: locales.split(' ') };
1
+ import { promptLocale, promptLocaleList } from "../console/logging.js";
2
+ import { libraryDefaultLocale } from "generaltranslation/internal";
3
+ //#region src/setup/userInput.ts
4
+ async function getDesiredLocales() {
5
+ return {
6
+ defaultLocale: await promptLocale({
7
+ message: "What is the default locale for your project?",
8
+ defaultValue: libraryDefaultLocale
9
+ }),
10
+ locales: await promptLocaleList({
11
+ message: "Which languages would you like to translate your project into?",
12
+ defaultValue: [
13
+ "es",
14
+ "fr",
15
+ "de",
16
+ "ja",
17
+ "zh"
18
+ ]
19
+ })
20
+ };
32
21
  }
22
+ //#endregion
23
+ export { getDesiredLocales };
24
+
25
+ //# sourceMappingURL=userInput.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"userInput.js","names":[],"sources":["../../src/setup/userInput.ts"],"sourcesContent":["import { libraryDefaultLocale } from 'generaltranslation/internal';\nimport { promptLocale, promptLocaleList } from '../console/logging.js';\n\nexport async function getDesiredLocales(): Promise<{\n defaultLocale: string;\n locales: string[];\n}> {\n // Ask for the default locale\n const defaultLocale = await promptLocale({\n message: 'What is the default locale for your project?',\n defaultValue: libraryDefaultLocale,\n });\n\n // Ask for the locales\n const locales = await promptLocaleList({\n message: 'Which languages would you like to translate your project into?',\n defaultValue: ['es', 'fr', 'de', 'ja', 'zh'],\n });\n return { defaultLocale, locales };\n}\n"],"mappings":";;;AAGA,eAAsB,oBAGnB;AAYD,QAAO;EAAE,eAAA,MAVmB,aAAa;GACvC,SAAS;GACT,cAAc;GACf,CAAC;EAOsB,SAAA,MAJF,iBAAiB;GACrC,SAAS;GACT,cAAc;IAAC;IAAM;IAAM;IAAM;IAAM;IAAK;GAC7C,CAAC;EAC+B"}