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,427 +1,343 @@
1
+ import { isStaticExpression } from "../../evaluateJsx.js";
2
+ import { BRANCH_CONTROL_PROPS, DEFAULT_GT_IMPORT_SOURCE, INTERNAL_TRANSLATION_COMPONENT, INTERNAL_VAR_COMPONENT, PLURAL_CONTROL_PROPS, VARIABLE_COMPONENTS } from "../constants.js";
3
+ import * as t from "@babel/types";
4
+ import traverseModule from "@babel/traverse";
5
+ //#region src/react/jsx/utils/jsxParsing/autoInsertion.ts
1
6
  /**
2
- * Auto JSX Insertion for CLI extraction.
3
- *
4
- * Inserts <T> and <Var> JSX elements into the AST so the extraction pipeline
5
- * can process them as if the user wrote them. This operates on raw JSX syntax
6
- * (JSXElement, JSXText, JSXExpressionContainer) — NOT compiled jsx() calls.
7
- *
8
- * Rules follow JSX_INSERTION_RULES.md from the compiler package.
9
- */
10
- import * as t from '@babel/types';
11
- import traverseModule from '@babel/traverse';
7
+ * Auto JSX Insertion for CLI extraction.
8
+ *
9
+ * Inserts <T> and <Var> JSX elements into the AST so the extraction pipeline
10
+ * can process them as if the user wrote them. This operates on raw JSX syntax
11
+ * (JSXElement, JSXText, JSXExpressionContainer) — NOT compiled jsx() calls.
12
+ *
13
+ * Rules follow JSX_INSERTION_RULES.md from the compiler package.
14
+ */
12
15
  const traverse = traverseModule.default || traverseModule;
13
- import { isStaticExpression } from '../../evaluateJsx.js';
14
- import { TRANSLATION_COMPONENT, INTERNAL_TRANSLATION_COMPONENT, INTERNAL_VAR_COMPONENT, VARIABLE_COMPONENTS, BRANCH_COMPONENT, PLURAL_COMPONENT, DEFAULT_GT_IMPORT_SOURCE, DERIVE_COMPONENT, STATIC_COMPONENT, BRANCH_CONTROL_PROPS, PLURAL_CONTROL_PROPS, } from '../constants.js';
15
16
  /** Tracks which AST nodes were auto-inserted by this module */
16
- const autoInsertedNodes = new WeakSet();
17
+ const autoInsertedNodes = /* @__PURE__ */ new WeakSet();
17
18
  /** Check if a node was auto-inserted */
18
- export function isAutoInserted(node) {
19
- return autoInsertedNodes.has(node);
19
+ function isAutoInserted(node) {
20
+ return autoInsertedNodes.has(node);
20
21
  }
21
- // ===== Public API ===== //
22
22
  /**
23
- * Ensure GtInternalTranslateJsx and GtInternalVar are imported in the AST.
24
- * Always adds: import { GtInternalTranslateJsx, GtInternalVar } from 'gt-react/browser';
25
- * These are distinct from user T/Var so there's no ambiguity.
26
- *
27
- * Updates importAliases in-place.
28
- */
29
- export function ensureTAndVarImported(ast, importAliases) {
30
- // Check if internal components are already imported
31
- const hasInternalT = Object.values(importAliases).includes(INTERNAL_TRANSLATION_COMPONENT);
32
- const hasInternalVar = Object.values(importAliases).includes(INTERNAL_VAR_COMPONENT);
33
- if (hasInternalT && hasInternalVar)
34
- return;
35
- const specifiers = [];
36
- if (!hasInternalT) {
37
- specifiers.push(t.importSpecifier(t.identifier(INTERNAL_TRANSLATION_COMPONENT), t.identifier(INTERNAL_TRANSLATION_COMPONENT)));
38
- importAliases[INTERNAL_TRANSLATION_COMPONENT] =
39
- INTERNAL_TRANSLATION_COMPONENT;
40
- }
41
- if (!hasInternalVar) {
42
- specifiers.push(t.importSpecifier(t.identifier(INTERNAL_VAR_COMPONENT), t.identifier(INTERNAL_VAR_COMPONENT)));
43
- importAliases[INTERNAL_VAR_COMPONENT] = INTERNAL_VAR_COMPONENT;
44
- }
45
- const importDecl = t.importDeclaration(specifiers, t.stringLiteral(DEFAULT_GT_IMPORT_SOURCE));
46
- traverse(ast, {
47
- Program(path) {
48
- path.unshiftContainer('body', importDecl);
49
- path.stop();
50
- },
51
- });
23
+ * Ensure GtInternalTranslateJsx and GtInternalVar are imported in the AST.
24
+ * Always adds: import { GtInternalTranslateJsx, GtInternalVar } from 'gt-react/browser';
25
+ * These are distinct from user T/Var so there's no ambiguity.
26
+ *
27
+ * Updates importAliases in-place.
28
+ */
29
+ function ensureTAndVarImported(ast, importAliases) {
30
+ const hasInternalT = Object.values(importAliases).includes(INTERNAL_TRANSLATION_COMPONENT);
31
+ const hasInternalVar = Object.values(importAliases).includes(INTERNAL_VAR_COMPONENT);
32
+ if (hasInternalT && hasInternalVar) return;
33
+ const specifiers = [];
34
+ if (!hasInternalT) {
35
+ specifiers.push(t.importSpecifier(t.identifier(INTERNAL_TRANSLATION_COMPONENT), t.identifier(INTERNAL_TRANSLATION_COMPONENT)));
36
+ importAliases[INTERNAL_TRANSLATION_COMPONENT] = INTERNAL_TRANSLATION_COMPONENT;
37
+ }
38
+ if (!hasInternalVar) {
39
+ specifiers.push(t.importSpecifier(t.identifier(INTERNAL_VAR_COMPONENT), t.identifier(INTERNAL_VAR_COMPONENT)));
40
+ importAliases[INTERNAL_VAR_COMPONENT] = INTERNAL_VAR_COMPONENT;
41
+ }
42
+ const importDecl = t.importDeclaration(specifiers, t.stringLiteral(DEFAULT_GT_IMPORT_SOURCE));
43
+ traverse(ast, { Program(path) {
44
+ path.unshiftContainer("body", importDecl);
45
+ path.stop();
46
+ } });
52
47
  }
53
48
  /**
54
- * Traverse the AST and insert GtInternalTranslateJsx and GtInternalVar JSX elements following
55
- * the insertion rules. Uses deliberate children traversal.
56
- *
57
- * Every inserted node gets node._autoInserted = true.
58
- */
59
- export function autoInsertJsxComponents(ast, importAliases) {
60
- const processedNodes = new WeakSet();
61
- const tLocalName = getLocalName(importAliases, INTERNAL_TRANSLATION_COMPONENT);
62
- const varLocalName = getLocalName(importAliases, INTERNAL_VAR_COMPONENT);
63
- traverse(ast, {
64
- JSXElement(path) {
65
- if (processedNodes.has(path.node))
66
- return;
67
- processJsxElement({
68
- path,
69
- insideAutoT: false,
70
- importAliases,
71
- processedNodes,
72
- tLocalName,
73
- varLocalName,
74
- });
75
- },
76
- JSXFragment(path) {
77
- if (processedNodes.has(path.node))
78
- return;
79
- processJsxFragment({
80
- path,
81
- insideAutoT: false,
82
- importAliases,
83
- processedNodes,
84
- tLocalName,
85
- varLocalName,
86
- });
87
- },
88
- });
49
+ * Traverse the AST and insert GtInternalTranslateJsx and GtInternalVar JSX elements following
50
+ * the insertion rules. Uses deliberate children traversal.
51
+ *
52
+ * Every inserted node gets node._autoInserted = true.
53
+ */
54
+ function autoInsertJsxComponents(ast, importAliases) {
55
+ const processedNodes = /* @__PURE__ */ new WeakSet();
56
+ const tLocalName = getLocalName(importAliases, INTERNAL_TRANSLATION_COMPONENT);
57
+ const varLocalName = getLocalName(importAliases, INTERNAL_VAR_COMPONENT);
58
+ traverse(ast, {
59
+ JSXElement(path) {
60
+ if (processedNodes.has(path.node)) return;
61
+ processJsxElement({
62
+ path,
63
+ insideAutoT: false,
64
+ importAliases,
65
+ processedNodes,
66
+ tLocalName,
67
+ varLocalName
68
+ });
69
+ },
70
+ JSXFragment(path) {
71
+ if (processedNodes.has(path.node)) return;
72
+ processJsxFragment({
73
+ path,
74
+ insideAutoT: false,
75
+ importAliases,
76
+ processedNodes,
77
+ tLocalName,
78
+ varLocalName
79
+ });
80
+ }
81
+ });
89
82
  }
90
- function processJsxElement({ path, insideAutoT, importAliases, processedNodes, tLocalName, varLocalName, }) {
91
- processedNodes.add(path.node);
92
- // Get component type
93
- const typeName = getElementTypeName(path.node);
94
- const canonicalName = typeName ? importAliases[typeName] : undefined;
95
- // User T → mark all descendants, hands off
96
- if (canonicalName === TRANSLATION_COMPONENT) {
97
- markDescendantJsx(path, processedNodes);
98
- return;
99
- }
100
- // Branch/Plural/Derive/Static opaque, process props for dynamic Var
101
- // Must be checked BEFORE user variable check because Derive/Static are in VARIABLE_COMPONENTS
102
- if (canonicalName === BRANCH_COMPONENT ||
103
- canonicalName === PLURAL_COMPONENT ||
104
- canonicalName === DERIVE_COMPONENT ||
105
- canonicalName === STATIC_COMPONENT) {
106
- if (!insideAutoT) {
107
- // Root-level opaque component — wrap in _T
108
- const tWrapper = createTWrapper([path.node], tLocalName);
109
- processedNodes.add(tWrapper);
110
- path.replaceWith(tWrapper);
111
- }
112
- processOpaqueComponentProps({
113
- path,
114
- insideAutoT: true,
115
- importAliases,
116
- processedNodes,
117
- tLocalName,
118
- varLocalName,
119
- canonicalName,
120
- });
121
- return;
122
- }
123
- // User Var/Num/Currency/DateTime → mark descendants, hands off
124
- if (canonicalName && VARIABLE_COMPONENTS.includes(canonicalName)) {
125
- markDescendantJsx(path, processedNodes);
126
- return;
127
- }
128
- // Process children
129
- processElementChildren({
130
- path,
131
- insideAutoT,
132
- importAliases,
133
- processedNodes,
134
- tLocalName,
135
- varLocalName,
136
- });
83
+ function processJsxElement({ path, insideAutoT, importAliases, processedNodes, tLocalName, varLocalName }) {
84
+ processedNodes.add(path.node);
85
+ const typeName = getElementTypeName(path.node);
86
+ const canonicalName = typeName ? importAliases[typeName] : void 0;
87
+ if (canonicalName === "T") {
88
+ markDescendantJsx(path, processedNodes);
89
+ return;
90
+ }
91
+ if (canonicalName === "Branch" || canonicalName === "Plural" || canonicalName === "Derive" || canonicalName === "Static") {
92
+ if (!insideAutoT) {
93
+ const tWrapper = createTWrapper([path.node], tLocalName);
94
+ processedNodes.add(tWrapper);
95
+ path.replaceWith(tWrapper);
96
+ }
97
+ processOpaqueComponentProps({
98
+ path,
99
+ insideAutoT: true,
100
+ importAliases,
101
+ processedNodes,
102
+ tLocalName,
103
+ varLocalName,
104
+ canonicalName
105
+ });
106
+ return;
107
+ }
108
+ if (canonicalName && VARIABLE_COMPONENTS.includes(canonicalName)) {
109
+ markDescendantJsx(path, processedNodes);
110
+ return;
111
+ }
112
+ processElementChildren({
113
+ path,
114
+ insideAutoT,
115
+ importAliases,
116
+ processedNodes,
117
+ tLocalName,
118
+ varLocalName
119
+ });
137
120
  }
138
- function processJsxFragment({ path, insideAutoT, importAliases, processedNodes, tLocalName, varLocalName, }) {
139
- processedNodes.add(path.node);
140
- // Fragments are treated like regular elements
141
- processFragmentChildren({
142
- path,
143
- insideAutoT,
144
- importAliases,
145
- processedNodes,
146
- tLocalName,
147
- varLocalName,
148
- });
121
+ function processJsxFragment({ path, insideAutoT, importAliases, processedNodes, tLocalName, varLocalName }) {
122
+ processedNodes.add(path.node);
123
+ processFragmentChildren({
124
+ path,
125
+ insideAutoT,
126
+ importAliases,
127
+ processedNodes,
128
+ tLocalName,
129
+ varLocalName
130
+ });
149
131
  }
150
- // ===== Children processing ===== //
151
- function processElementChildren({ path, insideAutoT, importAliases, processedNodes, tLocalName, varLocalName, }) {
152
- const children = path.node.children;
153
- const ctx = {
154
- insideAutoT,
155
- importAliases,
156
- processedNodes,
157
- tLocalName,
158
- varLocalName,
159
- };
160
- const hasText = hasTranslatableText(children);
161
- const hasOpaque = hasOpaqueGTChild(children, importAliases);
162
- const shouldClaimT = !insideAutoT && (hasText || hasOpaque);
163
- if (shouldClaimT) {
164
- // Process children: wrap dynamic expressions in Var, recurse into child elements
165
- const childPaths = path.get('children');
166
- for (const childPath of childPaths) {
167
- processChild(childPath, { ...ctx, insideAutoT: true });
168
- }
169
- // Wrap all children in <T>
170
- wrapChildrenInT(path, tLocalName, processedNodes);
171
- }
172
- else if (insideAutoT) {
173
- // Inside a T region: wrap dynamic expressions, recurse
174
- const childPaths = path.get('children');
175
- for (const childPath of childPaths) {
176
- processChild(childPath, ctx);
177
- }
178
- }
179
- else {
180
- // No text, no opaque, not inside T: just recurse into child elements
181
- const childPaths = path.get('children');
182
- for (const childPath of childPaths) {
183
- if (childPath.isJSXElement() && !processedNodes.has(childPath.node)) {
184
- processJsxElement({ path: childPath, ...ctx });
185
- }
186
- else if (childPath.isJSXFragment() &&
187
- !processedNodes.has(childPath.node)) {
188
- processJsxFragment({ path: childPath, ...ctx });
189
- }
190
- }
191
- }
132
+ function processElementChildren({ path, insideAutoT, importAliases, processedNodes, tLocalName, varLocalName }) {
133
+ const children = path.node.children;
134
+ const ctx = {
135
+ insideAutoT,
136
+ importAliases,
137
+ processedNodes,
138
+ tLocalName,
139
+ varLocalName
140
+ };
141
+ const hasText = hasTranslatableText(children);
142
+ const hasOpaque = hasOpaqueGTChild(children, importAliases);
143
+ if (!insideAutoT && (hasText || hasOpaque)) {
144
+ const childPaths = path.get("children");
145
+ for (const childPath of childPaths) processChild(childPath, {
146
+ ...ctx,
147
+ insideAutoT: true
148
+ });
149
+ wrapChildrenInT(path, tLocalName, processedNodes);
150
+ } else if (insideAutoT) {
151
+ const childPaths = path.get("children");
152
+ for (const childPath of childPaths) processChild(childPath, ctx);
153
+ } else {
154
+ const childPaths = path.get("children");
155
+ for (const childPath of childPaths) if (childPath.isJSXElement() && !processedNodes.has(childPath.node)) processJsxElement({
156
+ path: childPath,
157
+ ...ctx
158
+ });
159
+ else if (childPath.isJSXFragment() && !processedNodes.has(childPath.node)) processJsxFragment({
160
+ path: childPath,
161
+ ...ctx
162
+ });
163
+ }
192
164
  }
193
- function processFragmentChildren({ path, insideAutoT, importAliases, processedNodes, tLocalName, varLocalName, }) {
194
- const children = path.node.children;
195
- const ctx = {
196
- insideAutoT,
197
- importAliases,
198
- processedNodes,
199
- tLocalName,
200
- varLocalName,
201
- };
202
- const hasText = hasTranslatableText(children);
203
- const hasOpaque = hasOpaqueGTChild(children, importAliases);
204
- const shouldClaimT = !insideAutoT && (hasText || hasOpaque);
205
- if (shouldClaimT) {
206
- const childPaths = path.get('children');
207
- for (const childPath of childPaths) {
208
- processChild(childPath, { ...ctx, insideAutoT: true });
209
- }
210
- wrapFragmentChildrenInT(path, tLocalName, processedNodes);
211
- }
212
- else if (insideAutoT) {
213
- const childPaths = path.get('children');
214
- for (const childPath of childPaths) {
215
- processChild(childPath, ctx);
216
- }
217
- }
218
- else {
219
- const childPaths = path.get('children');
220
- for (const childPath of childPaths) {
221
- if (childPath.isJSXElement() && !processedNodes.has(childPath.node)) {
222
- processJsxElement({ path: childPath, ...ctx });
223
- }
224
- else if (childPath.isJSXFragment() &&
225
- !processedNodes.has(childPath.node)) {
226
- processJsxFragment({ path: childPath, ...ctx });
227
- }
228
- }
229
- }
165
+ function processFragmentChildren({ path, insideAutoT, importAliases, processedNodes, tLocalName, varLocalName }) {
166
+ const children = path.node.children;
167
+ const ctx = {
168
+ insideAutoT,
169
+ importAliases,
170
+ processedNodes,
171
+ tLocalName,
172
+ varLocalName
173
+ };
174
+ const hasText = hasTranslatableText(children);
175
+ const hasOpaque = hasOpaqueGTChild(children, importAliases);
176
+ if (!insideAutoT && (hasText || hasOpaque)) {
177
+ const childPaths = path.get("children");
178
+ for (const childPath of childPaths) processChild(childPath, {
179
+ ...ctx,
180
+ insideAutoT: true
181
+ });
182
+ wrapFragmentChildrenInT(path, tLocalName, processedNodes);
183
+ } else if (insideAutoT) {
184
+ const childPaths = path.get("children");
185
+ for (const childPath of childPaths) processChild(childPath, ctx);
186
+ } else {
187
+ const childPaths = path.get("children");
188
+ for (const childPath of childPaths) if (childPath.isJSXElement() && !processedNodes.has(childPath.node)) processJsxElement({
189
+ path: childPath,
190
+ ...ctx
191
+ });
192
+ else if (childPath.isJSXFragment() && !processedNodes.has(childPath.node)) processJsxFragment({
193
+ path: childPath,
194
+ ...ctx
195
+ });
196
+ }
230
197
  }
231
198
  function processChild(childPath, ctx) {
232
- if (childPath.isJSXElement() && !ctx.processedNodes.has(childPath.node)) {
233
- processJsxElement({ path: childPath, ...ctx });
234
- }
235
- else if (childPath.isJSXFragment() &&
236
- !ctx.processedNodes.has(childPath.node)) {
237
- processJsxFragment({ path: childPath, ...ctx });
238
- }
239
- else if (childPath.isJSXExpressionContainer() &&
240
- ctx.insideAutoT &&
241
- needsVarWrapping(childPath.node)) {
242
- // Wrap dynamic expression in <Var>
243
- const varWrapper = createVarWrapper(childPath.node, ctx.varLocalName, ctx.processedNodes);
244
- childPath.replaceWith(varWrapper);
245
- ctx.processedNodes.add(varWrapper);
246
- }
199
+ if (childPath.isJSXElement() && !ctx.processedNodes.has(childPath.node)) processJsxElement({
200
+ path: childPath,
201
+ ...ctx
202
+ });
203
+ else if (childPath.isJSXFragment() && !ctx.processedNodes.has(childPath.node)) processJsxFragment({
204
+ path: childPath,
205
+ ...ctx
206
+ });
207
+ else if (childPath.isJSXExpressionContainer() && ctx.insideAutoT && needsVarWrapping(childPath.node)) {
208
+ const varWrapper = createVarWrapper(childPath.node, ctx.varLocalName, ctx.processedNodes);
209
+ childPath.replaceWith(varWrapper);
210
+ ctx.processedNodes.add(varWrapper);
211
+ }
247
212
  }
248
- // ===== Opaque component props ===== //
249
- function processOpaqueComponentProps({ path, insideAutoT, importAliases, processedNodes, tLocalName, varLocalName, canonicalName, }) {
250
- // Branch/Plural children (fallback content) — process element-by-element before marking
251
- if (insideAutoT &&
252
- (canonicalName === BRANCH_COMPONENT || canonicalName === PLURAL_COMPONENT)) {
253
- const childPaths = path.get('children');
254
- for (const childPath of childPaths) {
255
- processChild(childPath, {
256
- insideAutoT: true,
257
- importAliases,
258
- processedNodes,
259
- tLocalName,
260
- varLocalName,
261
- });
262
- }
263
- }
264
- if (!insideAutoT) {
265
- markDescendantJsx(path, processedNodes);
266
- return;
267
- }
268
- const ctx = {
269
- insideAutoT: true,
270
- importAliases,
271
- processedNodes,
272
- tLocalName,
273
- varLocalName,
274
- };
275
- // Wrap dynamic prop values in <Var>, skipping control props.
276
- // This must happen BEFORE markDescendantJsx so that JSX inside auto-inserted
277
- // _Var wrappers stays unmarked for the top-level visitor to process independently.
278
- const attrs = path.get('openingElement').get('attributes');
279
- for (const attrPath of attrs) {
280
- if (!attrPath.isJSXAttribute())
281
- continue;
282
- // Determine prop name and skip control props
283
- const nameNode = attrPath.node.name;
284
- const propName = t.isJSXIdentifier(nameNode) ? nameNode.name : null;
285
- if (isControlProp(canonicalName, propName))
286
- continue;
287
- const valuePath = attrPath.get('value');
288
- if (!valuePath.isJSXExpressionContainer())
289
- continue;
290
- const expr = valuePath.node.expression;
291
- // Content prop with JSX value — recurse into children for Var-wrapping
292
- if (t.isJSXElement(expr) || t.isJSXFragment(expr)) {
293
- const exprPath = valuePath.get('expression');
294
- if (exprPath.isJSXElement() || exprPath.isJSXFragment()) {
295
- const childPaths = exprPath.get('children');
296
- for (const childPath of childPaths) {
297
- processChild(childPath, ctx);
298
- }
299
- }
300
- continue;
301
- }
302
- // Non-JSX dynamic value — wrap in Var
303
- if (needsVarWrapping(valuePath.node)) {
304
- const varWrapper = createVarWrapper(valuePath.node, varLocalName, processedNodes);
305
- valuePath.replaceWith(varWrapper);
306
- processedNodes.add(varWrapper);
307
- }
308
- }
309
- // Mark remaining descendant JSX as processed, but skip auto-inserted nodes
310
- // so the top-level visitor can still discover JSX inside _Var wrappers.
311
- // For Derive/Static, only mark props — leave children unmarked so the
312
- // top-level visitor can independently process them (e.g. Branch/Plural
313
- // inside Derive should get their own _T, matching compiler behavior).
314
- if (canonicalName === DERIVE_COMPONENT ||
315
- canonicalName === STATIC_COMPONENT) {
316
- for (const attrPath of path.get('openingElement').get('attributes')) {
317
- attrPath.traverse({
318
- JSXElement(childPath) {
319
- processedNodes.add(childPath.node);
320
- },
321
- JSXFragment(childPath) {
322
- processedNodes.add(childPath.node);
323
- },
324
- });
325
- }
326
- }
327
- else {
328
- markDescendantJsx(path, processedNodes);
329
- }
213
+ function processOpaqueComponentProps({ path, insideAutoT, importAliases, processedNodes, tLocalName, varLocalName, canonicalName }) {
214
+ if (insideAutoT && (canonicalName === "Branch" || canonicalName === "Plural")) {
215
+ const childPaths = path.get("children");
216
+ for (const childPath of childPaths) processChild(childPath, {
217
+ insideAutoT: true,
218
+ importAliases,
219
+ processedNodes,
220
+ tLocalName,
221
+ varLocalName
222
+ });
223
+ }
224
+ if (!insideAutoT) {
225
+ markDescendantJsx(path, processedNodes);
226
+ return;
227
+ }
228
+ const ctx = {
229
+ insideAutoT: true,
230
+ importAliases,
231
+ processedNodes,
232
+ tLocalName,
233
+ varLocalName
234
+ };
235
+ const attrs = path.get("openingElement").get("attributes");
236
+ for (const attrPath of attrs) {
237
+ if (!attrPath.isJSXAttribute()) continue;
238
+ const nameNode = attrPath.node.name;
239
+ if (isControlProp(canonicalName, t.isJSXIdentifier(nameNode) ? nameNode.name : null)) continue;
240
+ const valuePath = attrPath.get("value");
241
+ if (!valuePath.isJSXExpressionContainer()) continue;
242
+ const expr = valuePath.node.expression;
243
+ if (t.isJSXElement(expr) || t.isJSXFragment(expr)) {
244
+ const exprPath = valuePath.get("expression");
245
+ if (exprPath.isJSXElement() || exprPath.isJSXFragment()) {
246
+ const childPaths = exprPath.get("children");
247
+ for (const childPath of childPaths) processChild(childPath, ctx);
248
+ }
249
+ continue;
250
+ }
251
+ if (needsVarWrapping(valuePath.node)) {
252
+ const varWrapper = createVarWrapper(valuePath.node, varLocalName, processedNodes);
253
+ valuePath.replaceWith(varWrapper);
254
+ processedNodes.add(varWrapper);
255
+ }
256
+ }
257
+ if (canonicalName === "Derive" || canonicalName === "Static") for (const attrPath of path.get("openingElement").get("attributes")) attrPath.traverse({
258
+ JSXElement(childPath) {
259
+ processedNodes.add(childPath.node);
260
+ },
261
+ JSXFragment(childPath) {
262
+ processedNodes.add(childPath.node);
263
+ }
264
+ });
265
+ else markDescendantJsx(path, processedNodes);
330
266
  }
331
267
  function isControlProp(canonicalName, propName) {
332
- if (!propName)
333
- return false;
334
- if (canonicalName === BRANCH_COMPONENT) {
335
- return BRANCH_CONTROL_PROPS.has(propName) || propName.startsWith('data-');
336
- }
337
- if (canonicalName === PLURAL_COMPONENT) {
338
- return PLURAL_CONTROL_PROPS.has(propName);
339
- }
340
- return false;
268
+ if (!propName) return false;
269
+ if (canonicalName === "Branch") return BRANCH_CONTROL_PROPS.has(propName) || propName.startsWith("data-");
270
+ if (canonicalName === "Plural") return PLURAL_CONTROL_PROPS.has(propName);
271
+ return false;
341
272
  }
342
- // ===== Helper functions ===== //
343
273
  function getElementTypeName(element) {
344
- const name = element.openingElement.name;
345
- if (t.isJSXIdentifier(name))
346
- return name.name;
347
- return null;
274
+ const name = element.openingElement.name;
275
+ if (t.isJSXIdentifier(name)) return name.name;
276
+ return null;
348
277
  }
349
278
  function getLocalName(importAliases, canonicalName) {
350
- const entry = Object.entries(importAliases).find(([, v]) => v === canonicalName);
351
- return entry ? entry[0] : canonicalName;
279
+ const entry = Object.entries(importAliases).find(([, v]) => v === canonicalName);
280
+ return entry ? entry[0] : canonicalName;
352
281
  }
353
282
  function hasTranslatableText(children) {
354
- return children.some((child) => t.isJSXText(child) && child.value.trim().length > 0);
283
+ return children.some((child) => t.isJSXText(child) && child.value.trim().length > 0);
355
284
  }
356
285
  function hasOpaqueGTChild(children, importAliases) {
357
- return children.some((child) => {
358
- if (!t.isJSXElement(child))
359
- return false;
360
- const typeName = getElementTypeName(child);
361
- if (!typeName)
362
- return false;
363
- const canonical = importAliases[typeName];
364
- return (canonical === BRANCH_COMPONENT ||
365
- canonical === PLURAL_COMPONENT ||
366
- canonical === DERIVE_COMPONENT ||
367
- canonical === STATIC_COMPONENT);
368
- });
286
+ return children.some((child) => {
287
+ if (!t.isJSXElement(child)) return false;
288
+ const typeName = getElementTypeName(child);
289
+ if (!typeName) return false;
290
+ const canonical = importAliases[typeName];
291
+ return canonical === "Branch" || canonical === "Plural" || canonical === "Derive" || canonical === "Static";
292
+ });
369
293
  }
370
294
  function needsVarWrapping(container) {
371
- const expr = container.expression;
372
- if (t.isJSXEmptyExpression(expr))
373
- return false;
374
- // Use isStaticExpression to check — if static, no wrapping needed
375
- const analysis = isStaticExpression(expr, true);
376
- if (analysis.isStatic)
377
- return false;
378
- // JSX elements/fragments inside expressions are not dynamic — they're valid children
379
- if (t.isJSXElement(expr) || t.isJSXFragment(expr))
380
- return false;
381
- return true;
295
+ const expr = container.expression;
296
+ if (t.isJSXEmptyExpression(expr)) return false;
297
+ if (isStaticExpression(expr, true).isStatic) return false;
298
+ if (t.isJSXElement(expr) || t.isJSXFragment(expr)) return false;
299
+ return true;
382
300
  }
383
- // ===== AST construction ===== //
384
301
  function createTWrapper(children, tName) {
385
- const element = t.jsxElement(t.jsxOpeningElement(t.jsxIdentifier(tName), []), t.jsxClosingElement(t.jsxIdentifier(tName)), children);
386
- autoInsertedNodes.add(element);
387
- return element;
302
+ const element = t.jsxElement(t.jsxOpeningElement(t.jsxIdentifier(tName), []), t.jsxClosingElement(t.jsxIdentifier(tName)), children);
303
+ autoInsertedNodes.add(element);
304
+ return element;
388
305
  }
389
306
  function createVarWrapper(child, varName, processedNodes) {
390
- const varElement = t.jsxElement(t.jsxOpeningElement(t.jsxIdentifier(varName), []), t.jsxClosingElement(t.jsxIdentifier(varName)), [child]);
391
- autoInsertedNodes.add(varElement);
392
- processedNodes.add(varElement);
393
- return t.jsxExpressionContainer(varElement);
307
+ const varElement = t.jsxElement(t.jsxOpeningElement(t.jsxIdentifier(varName), []), t.jsxClosingElement(t.jsxIdentifier(varName)), [child]);
308
+ autoInsertedNodes.add(varElement);
309
+ processedNodes.add(varElement);
310
+ return t.jsxExpressionContainer(varElement);
394
311
  }
395
312
  function wrapChildrenInT(elementPath, tName, processedNodes) {
396
- const children = [...elementPath.node.children];
397
- const tWrapper = createTWrapper(children, tName);
398
- processedNodes.add(tWrapper);
399
- elementPath.node.children = [tWrapper];
313
+ const tWrapper = createTWrapper([...elementPath.node.children], tName);
314
+ processedNodes.add(tWrapper);
315
+ elementPath.node.children = [tWrapper];
400
316
  }
401
317
  function wrapFragmentChildrenInT(fragmentPath, tName, processedNodes) {
402
- const children = [...fragmentPath.node.children];
403
- const tWrapper = createTWrapper(children, tName);
404
- processedNodes.add(tWrapper);
405
- fragmentPath.node.children = [tWrapper];
318
+ const tWrapper = createTWrapper([...fragmentPath.node.children], tName);
319
+ processedNodes.add(tWrapper);
320
+ fragmentPath.node.children = [tWrapper];
406
321
  }
407
- // ===== Marking descendants as processed ===== //
408
322
  function markDescendantJsx(path, processedNodes) {
409
- path.traverse({
410
- JSXElement(childPath) {
411
- // Don't mark JSX inside auto-inserted _Var — the top-level visitor
412
- // needs to find and process those independently
413
- if (autoInsertedNodes.has(childPath.node)) {
414
- childPath.skip();
415
- return;
416
- }
417
- processedNodes.add(childPath.node);
418
- },
419
- JSXFragment(childPath) {
420
- if (autoInsertedNodes.has(childPath.node)) {
421
- childPath.skip();
422
- return;
423
- }
424
- processedNodes.add(childPath.node);
425
- },
426
- });
323
+ path.traverse({
324
+ JSXElement(childPath) {
325
+ if (autoInsertedNodes.has(childPath.node)) {
326
+ childPath.skip();
327
+ return;
328
+ }
329
+ processedNodes.add(childPath.node);
330
+ },
331
+ JSXFragment(childPath) {
332
+ if (autoInsertedNodes.has(childPath.node)) {
333
+ childPath.skip();
334
+ return;
335
+ }
336
+ processedNodes.add(childPath.node);
337
+ }
338
+ });
427
339
  }
340
+ //#endregion
341
+ export { autoInsertJsxComponents, ensureTAndVarImported, isAutoInserted };
342
+
343
+ //# sourceMappingURL=autoInsertion.js.map