@pierre/diffs 1.4.1 → 1.4.2

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 (477) hide show
  1. package/dist/components/CodeView.d.ts +4 -4
  2. package/dist/components/CodeView.d.ts.map +1 -1
  3. package/dist/components/CodeView.js +8 -6
  4. package/dist/components/CodeView.js.map +1 -1
  5. package/dist/components/File.d.ts +3 -15
  6. package/dist/components/File.d.ts.map +1 -1
  7. package/dist/components/FileDiff.d.ts +9 -37
  8. package/dist/components/FileDiff.d.ts.map +1 -1
  9. package/dist/components/FileDiff.js +15 -12
  10. package/dist/components/FileDiff.js.map +1 -1
  11. package/dist/components/FileStream.d.ts +1 -0
  12. package/dist/components/FileStream.d.ts.map +1 -1
  13. package/dist/components/UnresolvedFile.d.ts +1 -1
  14. package/dist/components/UnresolvedFile.d.ts.map +1 -1
  15. package/dist/components/UnresolvedFile.js +2 -1
  16. package/dist/components/UnresolvedFile.js.map +1 -1
  17. package/dist/components/VirtualizedFile.d.ts +2 -8
  18. package/dist/components/VirtualizedFile.d.ts.map +1 -1
  19. package/dist/components/VirtualizedFile.js +11 -9
  20. package/dist/components/VirtualizedFile.js.map +1 -1
  21. package/dist/components/VirtualizedFileDiff.d.ts +2 -8
  22. package/dist/components/VirtualizedFileDiff.d.ts.map +1 -1
  23. package/dist/components/VirtualizedFileDiff.js +11 -9
  24. package/dist/components/VirtualizedFileDiff.js.map +1 -1
  25. package/dist/components/Virtualizer.d.ts +1 -5
  26. package/dist/components/Virtualizer.d.ts.map +1 -1
  27. package/dist/components/Virtualizer.js.map +1 -1
  28. package/dist/components/VirtulizerDevelopment.d.ts +0 -1
  29. package/dist/components/VirtulizerDevelopment.d.ts.map +1 -1
  30. package/dist/components/web-components.d.ts.map +1 -1
  31. package/dist/components/web-components.js +2 -1
  32. package/dist/components/web-components.js.map +1 -1
  33. package/dist/constants.d.ts +0 -1
  34. package/dist/constants.d.ts.map +1 -1
  35. package/dist/editor/EditStateManager.d.ts +0 -1
  36. package/dist/editor/EditStateManager.d.ts.map +1 -1
  37. package/dist/editor/EditStateManager.js.map +1 -1
  38. package/dist/editor/cloneRetainedDiffSessionSnapshot.d.ts +0 -1
  39. package/dist/editor/cloneRetainedDiffSessionSnapshot.d.ts.map +1 -1
  40. package/dist/editor/command.d.ts +2 -1
  41. package/dist/editor/command.d.ts.map +1 -1
  42. package/dist/editor/editPrediction.d.ts +3 -2
  43. package/dist/editor/editPrediction.d.ts.map +1 -1
  44. package/dist/editor/editPrediction.js +11 -11
  45. package/dist/editor/editPrediction.js.map +1 -1
  46. package/dist/editor/editStack.d.ts +0 -1
  47. package/dist/editor/editStack.d.ts.map +1 -1
  48. package/dist/editor/editStack.js.map +1 -1
  49. package/dist/editor/editor.d.ts +1 -5
  50. package/dist/editor/editor.d.ts.map +1 -1
  51. package/dist/editor/editor.js +24 -19
  52. package/dist/editor/editor.js.map +1 -1
  53. package/dist/editor/editor2.js.map +1 -1
  54. package/dist/editor/languages.d.ts +0 -1
  55. package/dist/editor/languages.d.ts.map +1 -1
  56. package/dist/editor/languages.js +1 -1
  57. package/dist/editor/languages.js.map +1 -1
  58. package/dist/editor/lineAnnotations.d.ts +0 -1
  59. package/dist/editor/lineAnnotations.d.ts.map +1 -1
  60. package/dist/editor/lineAnnotations.js +2 -1
  61. package/dist/editor/lineAnnotations.js.map +1 -1
  62. package/dist/editor/marker.d.ts +0 -1
  63. package/dist/editor/marker.d.ts.map +1 -1
  64. package/dist/editor/marker.js +5 -3
  65. package/dist/editor/marker.js.map +1 -1
  66. package/dist/editor/matchBrackets.d.ts +0 -1
  67. package/dist/editor/matchBrackets.d.ts.map +1 -1
  68. package/dist/editor/pieceTable.d.ts +0 -1
  69. package/dist/editor/pieceTable.d.ts.map +1 -1
  70. package/dist/editor/pieceTable.js.map +1 -1
  71. package/dist/editor/platform.d.ts +1 -5
  72. package/dist/editor/platform.d.ts.map +1 -1
  73. package/dist/editor/platform.js.map +1 -1
  74. package/dist/editor/popover.d.ts +12 -12
  75. package/dist/editor/popover.d.ts.map +1 -1
  76. package/dist/editor/popover.js.map +1 -1
  77. package/dist/editor/searchPanel.d.ts +0 -1
  78. package/dist/editor/searchPanel.d.ts.map +1 -1
  79. package/dist/editor/searchPanel.js +16 -12
  80. package/dist/editor/searchPanel.js.map +1 -1
  81. package/dist/editor/selection.d.ts +0 -1
  82. package/dist/editor/selection.d.ts.map +1 -1
  83. package/dist/editor/selection.js.map +1 -1
  84. package/dist/editor/selectionAction.d.ts +0 -1
  85. package/dist/editor/selectionAction.d.ts.map +1 -1
  86. package/dist/editor/selectionAction.js.map +1 -1
  87. package/dist/editor/sprite.d.ts.map +1 -1
  88. package/dist/editor/textDocument.d.ts +0 -1
  89. package/dist/editor/textDocument.d.ts.map +1 -1
  90. package/dist/editor/textDocument.js.map +1 -1
  91. package/dist/editor/textDocumentChangeTransaction.d.ts +0 -1
  92. package/dist/editor/textDocumentChangeTransaction.d.ts.map +1 -1
  93. package/dist/editor/textMeasure.d.ts.map +1 -1
  94. package/dist/editor/textMeasure.js.map +1 -1
  95. package/dist/editor/tokenizer.d.ts +1 -11
  96. package/dist/editor/tokenizer.d.ts.map +1 -1
  97. package/dist/editor/tokenizer.js +8 -4
  98. package/dist/editor/tokenizer.js.map +1 -1
  99. package/dist/editor/types.d.ts +0 -1
  100. package/dist/editor/types.d.ts.map +1 -1
  101. package/dist/editor/utils.d.ts.map +1 -1
  102. package/dist/editor/utils.js +11 -7
  103. package/dist/editor/utils.js.map +1 -1
  104. package/dist/highlighter/languages/areLanguagesAttached.d.ts +0 -1
  105. package/dist/highlighter/languages/areLanguagesAttached.d.ts.map +1 -1
  106. package/dist/highlighter/languages/attachResolvedLanguages.d.ts +1 -0
  107. package/dist/highlighter/languages/attachResolvedLanguages.d.ts.map +1 -1
  108. package/dist/highlighter/languages/cleanUpResolvedLanguages.d.ts.map +1 -1
  109. package/dist/highlighter/languages/constants.d.ts +1 -1
  110. package/dist/highlighter/languages/constants.d.ts.map +1 -1
  111. package/dist/highlighter/languages/getResolvedLanguages.d.ts +1 -0
  112. package/dist/highlighter/languages/getResolvedLanguages.d.ts.map +1 -1
  113. package/dist/highlighter/languages/getResolvedOrResolveLanguage.d.ts +1 -0
  114. package/dist/highlighter/languages/getResolvedOrResolveLanguage.d.ts.map +1 -1
  115. package/dist/highlighter/languages/hasResolvedLanguages.d.ts +0 -1
  116. package/dist/highlighter/languages/hasResolvedLanguages.d.ts.map +1 -1
  117. package/dist/highlighter/languages/registerCustomLanguage.d.ts +0 -1
  118. package/dist/highlighter/languages/registerCustomLanguage.d.ts.map +1 -1
  119. package/dist/highlighter/languages/resolveLanguage.d.ts +1 -0
  120. package/dist/highlighter/languages/resolveLanguage.d.ts.map +1 -1
  121. package/dist/highlighter/languages/resolveLanguages.d.ts +1 -0
  122. package/dist/highlighter/languages/resolveLanguages.d.ts.map +1 -1
  123. package/dist/highlighter/shared_highlighter.d.ts +1 -6
  124. package/dist/highlighter/shared_highlighter.d.ts.map +1 -1
  125. package/dist/highlighter/themes/areThemesAttached.d.ts +0 -1
  126. package/dist/highlighter/themes/areThemesAttached.d.ts.map +1 -1
  127. package/dist/highlighter/themes/attachResolvedThemes.d.ts +0 -1
  128. package/dist/highlighter/themes/attachResolvedThemes.d.ts.map +1 -1
  129. package/dist/highlighter/themes/cleanUpResolvedThemes.d.ts.map +1 -1
  130. package/dist/highlighter/themes/constants.d.ts.map +1 -1
  131. package/dist/highlighter/themes/getResolvedOrResolveTheme.d.ts +0 -1
  132. package/dist/highlighter/themes/getResolvedOrResolveTheme.d.ts.map +1 -1
  133. package/dist/highlighter/themes/getResolvedThemes.d.ts +0 -1
  134. package/dist/highlighter/themes/getResolvedThemes.d.ts.map +1 -1
  135. package/dist/highlighter/themes/hasResolvedThemes.d.ts +0 -1
  136. package/dist/highlighter/themes/hasResolvedThemes.d.ts.map +1 -1
  137. package/dist/highlighter/themes/registerCustomCSSVariableTheme.d.ts.map +1 -1
  138. package/dist/highlighter/themes/registerCustomTheme.d.ts +0 -1
  139. package/dist/highlighter/themes/registerCustomTheme.d.ts.map +1 -1
  140. package/dist/highlighter/themes/resolveTheme.d.ts +0 -1
  141. package/dist/highlighter/themes/resolveTheme.d.ts.map +1 -1
  142. package/dist/highlighter/themes/resolveThemes.d.ts +0 -1
  143. package/dist/highlighter/themes/resolveThemes.d.ts.map +1 -1
  144. package/dist/highlighter/themes/themeResolution.d.ts +0 -1
  145. package/dist/highlighter/themes/themeResolution.d.ts.map +1 -1
  146. package/dist/highlighter/themes/themeResolver.d.ts +0 -1
  147. package/dist/highlighter/themes/themeResolver.d.ts.map +1 -1
  148. package/dist/index.d.ts +1 -0
  149. package/dist/managers/InteractionManager.d.ts +2 -26
  150. package/dist/managers/InteractionManager.d.ts.map +1 -1
  151. package/dist/managers/InteractionManager.js +1 -3
  152. package/dist/managers/InteractionManager.js.map +1 -1
  153. package/dist/managers/ResizeManager.d.ts +1 -4
  154. package/dist/managers/ResizeManager.d.ts.map +1 -1
  155. package/dist/managers/ScrollSyncManager.d.ts.map +1 -1
  156. package/dist/managers/UniversalRenderingManager.d.ts.map +1 -1
  157. package/dist/node_modules/.pnpm/@types_hast@3.0.4/node_modules/@types/hast/index.d.ts +0 -1
  158. package/dist/node_modules/.pnpm/@types_hast@3.0.4/node_modules/@types/hast/index.d.ts.map +1 -1
  159. package/dist/node_modules/.pnpm/@types_unist@3.0.3/node_modules/@types/unist/index.d.ts.map +1 -1
  160. package/dist/react/CodeView.d.ts +9 -1
  161. package/dist/react/CodeView.d.ts.map +1 -1
  162. package/dist/react/CodeView.js +39 -33
  163. package/dist/react/CodeView.js.map +1 -1
  164. package/dist/react/EditContext.d.ts +2 -5
  165. package/dist/react/EditContext.d.ts.map +1 -1
  166. package/dist/react/File.d.ts +1 -23
  167. package/dist/react/File.d.ts.map +1 -1
  168. package/dist/react/File.js +13 -12
  169. package/dist/react/File.js.map +1 -1
  170. package/dist/react/FileDiff.d.ts +1 -23
  171. package/dist/react/FileDiff.d.ts.map +1 -1
  172. package/dist/react/FileDiff.js +13 -12
  173. package/dist/react/FileDiff.js.map +1 -1
  174. package/dist/react/MultiFileDiff.d.ts +1 -24
  175. package/dist/react/MultiFileDiff.d.ts.map +1 -1
  176. package/dist/react/MultiFileDiff.js +13 -12
  177. package/dist/react/MultiFileDiff.js.map +1 -1
  178. package/dist/react/PatchDiff.d.ts +1 -23
  179. package/dist/react/PatchDiff.d.ts.map +1 -1
  180. package/dist/react/PatchDiff.js +13 -12
  181. package/dist/react/PatchDiff.js.map +1 -1
  182. package/dist/react/UnresolvedFile.d.ts +1 -18
  183. package/dist/react/UnresolvedFile.d.ts.map +1 -1
  184. package/dist/react/UnresolvedFile.js +15 -14
  185. package/dist/react/UnresolvedFile.js.map +1 -1
  186. package/dist/react/Virtualizer.d.ts +1 -9
  187. package/dist/react/Virtualizer.d.ts.map +1 -1
  188. package/dist/react/Virtualizer.js.map +1 -1
  189. package/dist/react/WorkerPoolContext.d.ts +2 -6
  190. package/dist/react/WorkerPoolContext.d.ts.map +1 -1
  191. package/dist/react/constants.d.ts +0 -1
  192. package/dist/react/constants.d.ts.map +1 -1
  193. package/dist/react/jsx.d.ts +1 -0
  194. package/dist/react/jsx.d.ts.map +1 -1
  195. package/dist/react/types.d.ts +1 -1
  196. package/dist/react/types.d.ts.map +1 -1
  197. package/dist/react/utils/assignRef.d.ts +6 -0
  198. package/dist/react/utils/assignRef.d.ts.map +1 -0
  199. package/dist/react/utils/assignRef.js +9 -0
  200. package/dist/react/utils/assignRef.js.map +1 -0
  201. package/dist/react/utils/renderDiffChildren.d.ts +1 -16
  202. package/dist/react/utils/renderDiffChildren.d.ts.map +1 -1
  203. package/dist/react/utils/renderDiffChildren.js.map +1 -1
  204. package/dist/react/utils/renderFileChildren.d.ts +1 -13
  205. package/dist/react/utils/renderFileChildren.d.ts.map +1 -1
  206. package/dist/react/utils/renderFileChildren.js.map +1 -1
  207. package/dist/react/utils/templateRender.d.ts +0 -1
  208. package/dist/react/utils/templateRender.d.ts.map +1 -1
  209. package/dist/react/utils/useFileDiffInstance.d.ts +2 -18
  210. package/dist/react/utils/useFileDiffInstance.d.ts.map +1 -1
  211. package/dist/react/utils/useFileDiffInstance.js +31 -17
  212. package/dist/react/utils/useFileDiffInstance.js.map +1 -1
  213. package/dist/react/utils/useFileInstance.d.ts +2 -16
  214. package/dist/react/utils/useFileInstance.d.ts.map +1 -1
  215. package/dist/react/utils/useFileInstance.js +8 -4
  216. package/dist/react/utils/useFileInstance.js.map +1 -1
  217. package/dist/react/utils/useStableCallback.d.ts.map +1 -1
  218. package/dist/react/utils/useUnresolvedFileInstance.d.ts +1 -12
  219. package/dist/react/utils/useUnresolvedFileInstance.d.ts.map +1 -1
  220. package/dist/renderers/DiffHunksRenderer.d.ts +4 -9
  221. package/dist/renderers/DiffHunksRenderer.d.ts.map +1 -1
  222. package/dist/renderers/DiffHunksRenderer.js +28 -21
  223. package/dist/renderers/DiffHunksRenderer.js.map +1 -1
  224. package/dist/renderers/FileRenderer.d.ts +1 -0
  225. package/dist/renderers/FileRenderer.d.ts.map +1 -1
  226. package/dist/renderers/FileRenderer.js.map +1 -1
  227. package/dist/renderers/UnresolvedFileHunksRenderer.d.ts +3 -9
  228. package/dist/renderers/UnresolvedFileHunksRenderer.d.ts.map +1 -1
  229. package/dist/shiki-stream/stream.d.ts +0 -1
  230. package/dist/shiki-stream/stream.d.ts.map +1 -1
  231. package/dist/shiki-stream/stream.js.map +1 -1
  232. package/dist/shiki-stream/tokenizer.d.ts +0 -1
  233. package/dist/shiki-stream/tokenizer.d.ts.map +1 -1
  234. package/dist/shiki-stream/types.d.ts +0 -1
  235. package/dist/shiki-stream/types.d.ts.map +1 -1
  236. package/dist/sprite.d.ts.map +1 -1
  237. package/dist/ssr/FileDiffReact.d.ts +1 -8
  238. package/dist/ssr/FileDiffReact.d.ts.map +1 -1
  239. package/dist/ssr/FileDiffReact.js +8 -3
  240. package/dist/ssr/FileDiffReact.js.map +1 -1
  241. package/dist/ssr/preloadDiffs.d.ts +6 -34
  242. package/dist/ssr/preloadDiffs.d.ts.map +1 -1
  243. package/dist/ssr/preloadFile.d.ts +1 -6
  244. package/dist/ssr/preloadFile.d.ts.map +1 -1
  245. package/dist/ssr/preloadPatchFile.d.ts +1 -5
  246. package/dist/ssr/preloadPatchFile.d.ts.map +1 -1
  247. package/dist/ssr/renderHTML.d.ts +0 -1
  248. package/dist/ssr/renderHTML.d.ts.map +1 -1
  249. package/dist/string-import.d.ts.map +1 -1
  250. package/dist/style.js.map +1 -1
  251. package/dist/types.d.ts +0 -1
  252. package/dist/types.d.ts.map +1 -1
  253. package/dist/utils/annotationHelpers.d.ts +0 -1
  254. package/dist/utils/annotationHelpers.d.ts.map +1 -1
  255. package/dist/utils/appendItems.d.ts.map +1 -1
  256. package/dist/utils/applyLineTextWithNewline.d.ts.map +1 -1
  257. package/dist/utils/areDiffLineAnnotationsEqual.d.ts +0 -1
  258. package/dist/utils/areDiffLineAnnotationsEqual.d.ts.map +1 -1
  259. package/dist/utils/areDiffRenderOptionsEqual.d.ts +0 -1
  260. package/dist/utils/areDiffRenderOptionsEqual.d.ts.map +1 -1
  261. package/dist/utils/areDiffTargetsEqual.d.ts +0 -1
  262. package/dist/utils/areDiffTargetsEqual.d.ts.map +1 -1
  263. package/dist/utils/areFileRenderOptionsEqual.d.ts +0 -1
  264. package/dist/utils/areFileRenderOptionsEqual.d.ts.map +1 -1
  265. package/dist/utils/areFileTargetsEqual.d.ts +0 -1
  266. package/dist/utils/areFileTargetsEqual.d.ts.map +1 -1
  267. package/dist/utils/areFilesEqual.d.ts +0 -1
  268. package/dist/utils/areFilesEqual.d.ts.map +1 -1
  269. package/dist/utils/areHunkDataEqual.d.ts +0 -1
  270. package/dist/utils/areHunkDataEqual.d.ts.map +1 -1
  271. package/dist/utils/areLineAnnotationsEqual.d.ts +0 -1
  272. package/dist/utils/areLineAnnotationsEqual.d.ts.map +1 -1
  273. package/dist/utils/areManagedSnapshotsEqual.d.ts +0 -1
  274. package/dist/utils/areManagedSnapshotsEqual.d.ts.map +1 -1
  275. package/dist/utils/areMergeConflictActionsEqual.d.ts +0 -1
  276. package/dist/utils/areMergeConflictActionsEqual.d.ts.map +1 -1
  277. package/dist/utils/areObjectsEqual.d.ts.map +1 -1
  278. package/dist/utils/areOptionsEqual.d.ts +1 -0
  279. package/dist/utils/areOptionsEqual.d.ts.map +1 -1
  280. package/dist/utils/arePrePropertiesEqual.d.ts +0 -1
  281. package/dist/utils/arePrePropertiesEqual.d.ts.map +1 -1
  282. package/dist/utils/areRenderRangesEqual.d.ts +0 -1
  283. package/dist/utils/areRenderRangesEqual.d.ts.map +1 -1
  284. package/dist/utils/areSelectionPointsEqual.d.ts +0 -1
  285. package/dist/utils/areSelectionPointsEqual.d.ts.map +1 -1
  286. package/dist/utils/areSelectionsEqual.d.ts +0 -1
  287. package/dist/utils/areSelectionsEqual.d.ts.map +1 -1
  288. package/dist/utils/areThemesEqual.d.ts +0 -1
  289. package/dist/utils/areThemesEqual.d.ts.map +1 -1
  290. package/dist/utils/areVirtualWindowSpecsEqual.d.ts +0 -1
  291. package/dist/utils/areVirtualWindowSpecsEqual.d.ts.map +1 -1
  292. package/dist/utils/areWorkerStatsEqual.d.ts +1 -0
  293. package/dist/utils/areWorkerStatsEqual.d.ts.map +1 -1
  294. package/dist/utils/awaitWithTimeout.d.ts.map +1 -1
  295. package/dist/utils/cleanLastNewline.d.ts.map +1 -1
  296. package/dist/utils/cloneFileDiffMetadata.d.ts +0 -1
  297. package/dist/utils/cloneFileDiffMetadata.d.ts.map +1 -1
  298. package/dist/utils/composeCacheKey.d.ts.map +1 -1
  299. package/dist/utils/computeEstimatedDiffHeights.d.ts +1 -11
  300. package/dist/utils/computeEstimatedDiffHeights.d.ts.map +1 -1
  301. package/dist/utils/computeFileOffsets.d.ts.map +1 -1
  302. package/dist/utils/computeFileOffsets.js +9 -8
  303. package/dist/utils/computeFileOffsets.js.map +1 -1
  304. package/dist/utils/computeVirtualFileMetrics.d.ts +0 -1
  305. package/dist/utils/computeVirtualFileMetrics.d.ts.map +1 -1
  306. package/dist/utils/createAnnotationElement.d.ts +0 -1
  307. package/dist/utils/createAnnotationElement.d.ts.map +1 -1
  308. package/dist/utils/createAnnotationWrapperNode.d.ts.map +1 -1
  309. package/dist/utils/createCodeViewHeaderFooterHostElement.d.ts.map +1 -1
  310. package/dist/utils/createContentColumn.d.ts +0 -1
  311. package/dist/utils/createContentColumn.d.ts.map +1 -1
  312. package/dist/utils/createEmptyRowBuffer.d.ts +0 -1
  313. package/dist/utils/createEmptyRowBuffer.d.ts.map +1 -1
  314. package/dist/utils/createFileHeaderElement.d.ts +1 -6
  315. package/dist/utils/createFileHeaderElement.d.ts.map +1 -1
  316. package/dist/utils/createGutterUtilityContentNode.d.ts.map +1 -1
  317. package/dist/utils/createGutterUtilityElement.d.ts +0 -1
  318. package/dist/utils/createGutterUtilityElement.d.ts.map +1 -1
  319. package/dist/utils/createNoNewlineElement.d.ts +0 -1
  320. package/dist/utils/createNoNewlineElement.d.ts.map +1 -1
  321. package/dist/utils/createPreElement.d.ts +1 -11
  322. package/dist/utils/createPreElement.d.ts.map +1 -1
  323. package/dist/utils/createRowNodes.d.ts.map +1 -1
  324. package/dist/utils/createSeparator.d.ts +1 -10
  325. package/dist/utils/createSeparator.d.ts.map +1 -1
  326. package/dist/utils/createSeparator.js +12 -10
  327. package/dist/utils/createSeparator.js.map +1 -1
  328. package/dist/utils/createSpanNodeFromToken.d.ts +0 -1
  329. package/dist/utils/createSpanNodeFromToken.d.ts.map +1 -1
  330. package/dist/utils/createSpanNodeFromToken.js +2 -1
  331. package/dist/utils/createSpanNodeFromToken.js.map +1 -1
  332. package/dist/utils/createStyleElement.d.ts +0 -1
  333. package/dist/utils/createStyleElement.d.ts.map +1 -1
  334. package/dist/utils/createTransformerWithState.d.ts +0 -1
  335. package/dist/utils/createTransformerWithState.d.ts.map +1 -1
  336. package/dist/utils/createUnsafeCSSStyleNode.d.ts.map +1 -1
  337. package/dist/utils/createWindowFromScrollPosition.d.ts +1 -9
  338. package/dist/utils/createWindowFromScrollPosition.d.ts.map +1 -1
  339. package/dist/utils/cssWrappers.d.ts +0 -1
  340. package/dist/utils/cssWrappers.d.ts.map +1 -1
  341. package/dist/utils/cssWrappers.js +5 -3
  342. package/dist/utils/cssWrappers.js.map +1 -1
  343. package/dist/utils/detachString.d.ts.map +1 -1
  344. package/dist/utils/diffAcceptRejectHunk.d.ts +0 -1
  345. package/dist/utils/diffAcceptRejectHunk.d.ts.map +1 -1
  346. package/dist/utils/editSessionAnnotations.d.ts +0 -1
  347. package/dist/utils/editSessionAnnotations.d.ts.map +1 -1
  348. package/dist/utils/editSessionHunks.d.ts +0 -1
  349. package/dist/utils/editSessionHunks.d.ts.map +1 -1
  350. package/dist/utils/formatCSSVariablePrefix.d.ts.map +1 -1
  351. package/dist/utils/getDiffFileInput.d.ts +1 -5
  352. package/dist/utils/getDiffFileInput.d.ts.map +1 -1
  353. package/dist/utils/getDiffHunksRendererOptions.d.ts +0 -1
  354. package/dist/utils/getDiffHunksRendererOptions.d.ts.map +1 -1
  355. package/dist/utils/getFileRendererOptions.d.ts +0 -1
  356. package/dist/utils/getFileRendererOptions.d.ts.map +1 -1
  357. package/dist/utils/getFiletypeFromFileName.d.ts +0 -1
  358. package/dist/utils/getFiletypeFromFileName.d.ts.map +1 -1
  359. package/dist/utils/getFiletypeFromFileName.js.map +1 -1
  360. package/dist/utils/getHighlighterOptions.d.ts +1 -5
  361. package/dist/utils/getHighlighterOptions.d.ts.map +1 -1
  362. package/dist/utils/getHighlighterOptions.js +1 -1
  363. package/dist/utils/getHighlighterOptions.js.map +1 -1
  364. package/dist/utils/getHighlighterThemeStyles.d.ts +1 -6
  365. package/dist/utils/getHighlighterThemeStyles.d.ts.map +1 -1
  366. package/dist/utils/getHunkSeparatorSlotName.d.ts +0 -1
  367. package/dist/utils/getHunkSeparatorSlotName.d.ts.map +1 -1
  368. package/dist/utils/getHunkSideBoundaries.d.ts.map +1 -1
  369. package/dist/utils/getIconForType.d.ts +0 -1
  370. package/dist/utils/getIconForType.d.ts.map +1 -1
  371. package/dist/utils/getLineAnnotationName.d.ts +0 -1
  372. package/dist/utils/getLineAnnotationName.d.ts.map +1 -1
  373. package/dist/utils/getLineEndingType.d.ts.map +1 -1
  374. package/dist/utils/getLineNodes.d.ts +0 -1
  375. package/dist/utils/getLineNodes.d.ts.map +1 -1
  376. package/dist/utils/getMergeConflictActionSlotName.d.ts +1 -5
  377. package/dist/utils/getMergeConflictActionSlotName.d.ts.map +1 -1
  378. package/dist/utils/getMergeConflictLineTypes.d.ts +0 -1
  379. package/dist/utils/getMergeConflictLineTypes.d.ts.map +1 -1
  380. package/dist/utils/getOrCreateCodeNode.d.ts +1 -7
  381. package/dist/utils/getOrCreateCodeNode.d.ts.map +1 -1
  382. package/dist/utils/getSingularPatch.d.ts +0 -1
  383. package/dist/utils/getSingularPatch.d.ts.map +1 -1
  384. package/dist/utils/getThemes.d.ts +0 -1
  385. package/dist/utils/getThemes.d.ts.map +1 -1
  386. package/dist/utils/getTotalLineCountFromHunks.d.ts +0 -1
  387. package/dist/utils/getTotalLineCountFromHunks.d.ts.map +1 -1
  388. package/dist/utils/guardWebKitScrollDuringRebuild.d.ts.map +1 -1
  389. package/dist/utils/hast_utils.d.ts +2 -12
  390. package/dist/utils/hast_utils.d.ts.map +1 -1
  391. package/dist/utils/hostTheme.d.ts +1 -5
  392. package/dist/utils/hostTheme.d.ts.map +1 -1
  393. package/dist/utils/hydratePartialDiff.d.ts +0 -1
  394. package/dist/utils/hydratePartialDiff.d.ts.map +1 -1
  395. package/dist/utils/includesFileAnnotations.d.ts +0 -1
  396. package/dist/utils/includesFileAnnotations.d.ts.map +1 -1
  397. package/dist/utils/isDefaultRenderRange.d.ts +0 -1
  398. package/dist/utils/isDefaultRenderRange.d.ts.map +1 -1
  399. package/dist/utils/isDiffPlainText.d.ts +0 -1
  400. package/dist/utils/isDiffPlainText.d.ts.map +1 -1
  401. package/dist/utils/isFilePlainText.d.ts +0 -1
  402. package/dist/utils/isFilePlainText.d.ts.map +1 -1
  403. package/dist/utils/isGutterUtilityPath.d.ts.map +1 -1
  404. package/dist/utils/isStyleNode.d.ts.map +1 -1
  405. package/dist/utils/isWorkerContext.d.ts.map +1 -1
  406. package/dist/utils/iterateOverDiff.d.ts +1 -10
  407. package/dist/utils/iterateOverDiff.d.ts.map +1 -1
  408. package/dist/utils/iterateOverDiff.js +5 -3
  409. package/dist/utils/iterateOverDiff.js.map +1 -1
  410. package/dist/utils/lineAnnotationIdentity.d.ts +0 -1
  411. package/dist/utils/lineAnnotationIdentity.d.ts.map +1 -1
  412. package/dist/utils/normalizeDiffResolution.d.ts +0 -1
  413. package/dist/utils/normalizeDiffResolution.d.ts.map +1 -1
  414. package/dist/utils/parseDiffDecorations.d.ts +2 -13
  415. package/dist/utils/parseDiffDecorations.d.ts.map +1 -1
  416. package/dist/utils/parseDiffFromFile.d.ts +0 -1
  417. package/dist/utils/parseDiffFromFile.d.ts.map +1 -1
  418. package/dist/utils/parseDiffFromFile.js +2 -1
  419. package/dist/utils/parseDiffFromFile.js.map +1 -1
  420. package/dist/utils/parseLineType.d.ts +0 -1
  421. package/dist/utils/parseLineType.d.ts.map +1 -1
  422. package/dist/utils/parseMergeConflictDiffFromFile.d.ts +0 -1
  423. package/dist/utils/parseMergeConflictDiffFromFile.d.ts.map +1 -1
  424. package/dist/utils/parsePatchFiles.d.ts +0 -1
  425. package/dist/utils/parsePatchFiles.d.ts.map +1 -1
  426. package/dist/utils/parsePatchFiles.js +8 -5
  427. package/dist/utils/parsePatchFiles.js.map +1 -1
  428. package/dist/utils/platform.d.ts.map +1 -1
  429. package/dist/utils/prefersReducedMotion.d.ts.map +1 -1
  430. package/dist/utils/prerenderHTMLIfNecessary.d.ts.map +1 -1
  431. package/dist/utils/processLine.d.ts +0 -1
  432. package/dist/utils/processLine.d.ts.map +1 -1
  433. package/dist/utils/realignChangeContent.d.ts +0 -1
  434. package/dist/utils/realignChangeContent.d.ts.map +1 -1
  435. package/dist/utils/renderDiffWithHighlighter.d.ts +1 -8
  436. package/dist/utils/renderDiffWithHighlighter.d.ts.map +1 -1
  437. package/dist/utils/renderFileWithHighlighter.d.ts +1 -11
  438. package/dist/utils/renderFileWithHighlighter.d.ts.map +1 -1
  439. package/dist/utils/resolveConflict.d.ts +0 -1
  440. package/dist/utils/resolveConflict.d.ts.map +1 -1
  441. package/dist/utils/resolveRegion.d.ts +0 -1
  442. package/dist/utils/resolveRegion.d.ts.map +1 -1
  443. package/dist/utils/roundToDevicePixel.d.ts.map +1 -1
  444. package/dist/utils/scrollbarGutter.d.ts.map +1 -1
  445. package/dist/utils/scrollbarGutter.js +2 -1
  446. package/dist/utils/scrollbarGutter.js.map +1 -1
  447. package/dist/utils/setLanguageOverride.d.ts +0 -1
  448. package/dist/utils/setLanguageOverride.d.ts.map +1 -1
  449. package/dist/utils/setWrapperNodeProps.d.ts +1 -11
  450. package/dist/utils/setWrapperNodeProps.d.ts.map +1 -1
  451. package/dist/utils/setWrapperNodeProps.js +1 -3
  452. package/dist/utils/setWrapperNodeProps.js.map +1 -1
  453. package/dist/utils/shouldUseTokenTransformer.d.ts +0 -1
  454. package/dist/utils/shouldUseTokenTransformer.d.ts.map +1 -1
  455. package/dist/utils/splitFileContents.d.ts.map +1 -1
  456. package/dist/utils/trimPatchContext.d.ts.map +1 -1
  457. package/dist/utils/updateDiffHunks.d.ts +0 -1
  458. package/dist/utils/updateDiffHunks.d.ts.map +1 -1
  459. package/dist/utils/virtualDiffLayout.d.ts +10 -55
  460. package/dist/utils/virtualDiffLayout.d.ts.map +1 -1
  461. package/dist/utils/wrapTokenFragments.d.ts +0 -1
  462. package/dist/utils/wrapTokenFragments.d.ts.map +1 -1
  463. package/dist/worker/WorkerPoolManager.d.ts +2 -17
  464. package/dist/worker/WorkerPoolManager.d.ts.map +1 -1
  465. package/dist/worker/WorkerPoolManager.js +8 -5
  466. package/dist/worker/WorkerPoolManager.js.map +1 -1
  467. package/dist/worker/getOrCreateWorkerPoolSingleton.d.ts +1 -5
  468. package/dist/worker/getOrCreateWorkerPoolSingleton.d.ts.map +1 -1
  469. package/dist/worker/types.d.ts +0 -1
  470. package/dist/worker/types.d.ts.map +1 -1
  471. package/dist/worker/worker-portable.d.ts +1 -1
  472. package/dist/worker/worker-portable.js +113 -354
  473. package/dist/worker/worker-portable.js.map +1 -1
  474. package/dist/worker/worker.d.ts +1 -1
  475. package/dist/worker/worker.js +14 -11
  476. package/dist/worker/worker.js.map +1 -1
  477. package/package.json +4 -5
@@ -1 +1 @@
1
- {"version":3,"file":"FileRenderer.js","names":[],"sources":["../../src/renderers/FileRenderer.ts"],"sourcesContent":["import type { ElementContent, Element as HASTElement } from 'hast';\nimport { toHtml } from 'hast-util-to-html';\n\nimport {\n DEFAULT_RENDER_RANGE,\n DEFAULT_THEMES,\n DEFAULT_TOKENIZE_MAX_LENGTH,\n} from '../constants';\nimport type { TextDocument } from '../editor/textDocument';\nimport { areLanguagesAttached } from '../highlighter/languages/areLanguagesAttached';\nimport {\n getHighlighterIfLoaded,\n getSharedHighlighter,\n} from '../highlighter/shared_highlighter';\nimport { areThemesAttached } from '../highlighter/themes/areThemesAttached';\nimport { hasResolvedThemes } from '../highlighter/themes/hasResolvedThemes';\nimport type {\n BaseCodeOptions,\n DiffsHighlighter,\n FileContents,\n FileHeaderRenderMode,\n HighlightedToken,\n LineAnnotation,\n RenderedFileASTCache,\n RenderFileOptions,\n RenderFileResult,\n RenderRange,\n SupportedLanguages,\n ThemedFileResult,\n} from '../types';\nimport { applyLineTextWithNewline } from '../utils/applyLineTextWithNewline';\nimport { areFileRenderOptionsEqual } from '../utils/areFileRenderOptionsEqual';\nimport { areFileTargetsEqual } from '../utils/areFileTargetsEqual';\nimport { areRenderRangesEqual } from '../utils/areRenderRangesEqual';\nimport { linesFromFileContents } from '../utils/computeFileOffsets';\nimport { createAnnotationElement } from '../utils/createAnnotationElement';\nimport { createContentColumn } from '../utils/createContentColumn';\nimport { createFileHeaderElement } from '../utils/createFileHeaderElement';\nimport { createPreElement } from '../utils/createPreElement';\nimport { getFiletypeFromFileName } from '../utils/getFiletypeFromFileName';\nimport { getHighlighterOptions } from '../utils/getHighlighterOptions';\nimport { getLineAnnotationName } from '../utils/getLineAnnotationName';\nimport { getThemes } from '../utils/getThemes';\nimport {\n createGutterGap,\n createGutterItem,\n createGutterWrapper,\n createHastElement,\n} from '../utils/hast_utils';\nimport {\n FILE_ANNOTATION_HUNK_INDEX,\n FILE_ANNOTATION_LINE_INDEX,\n getFileAnnotations,\n shouldRenderFileAnnotations,\n} from '../utils/includesFileAnnotations';\nimport { isDefaultRenderRange } from '../utils/isDefaultRenderRange';\nimport { isFilePlainText } from '../utils/isFilePlainText';\nimport { renderFileWithHighlighter } from '../utils/renderFileWithHighlighter';\nimport type { WorkerPoolManager } from '../worker';\n\ntype AnnotationLineMap<LAnnotation> = Record<\n number,\n LineAnnotation<LAnnotation>[] | undefined\n>;\n\ninterface GetRenderOptionsReturn {\n options: RenderFileOptions;\n forceHighlight: boolean;\n}\n\ninterface PendingHighlightResult extends RenderFileResult {\n file: FileContents;\n highlighted: boolean;\n}\n\ninterface FileRenderCache extends RenderedFileASTCache {\n // hydrate() describes DOM that already exists, even when no reusable AST\n // was available for that server-rendered content.\n hydrated?: boolean;\n}\n\nexport interface FileRenderResult {\n file: FileContents;\n gutterAST: ElementContent[];\n contentAST: ElementContent[];\n preAST: HASTElement;\n headerAST: HASTElement | undefined;\n css: string;\n totalLines: number;\n themeStyles: string;\n baseThemeType: 'light' | 'dark' | undefined;\n rowCount: number;\n bufferBefore: number;\n bufferAfter: number;\n}\n\ninterface LineCache {\n cacheKey: string | undefined;\n file: FileContents;\n sourceContents: string;\n lines: string[];\n}\n\n// Explicit keys may share cached lines across equivalent file objects. Unkeyed\n// files stay isolated by object identity while still supporting edit recycle.\nfunction isLineCacheForFile(lineCache: LineCache, file: FileContents): boolean {\n return file.cacheKey == null\n ? lineCache.file === file && lineCache.sourceContents === file.contents\n : lineCache.cacheKey === file.cacheKey;\n}\n\nexport interface FileRendererOptions extends BaseCodeOptions {\n headerRenderMode?: FileHeaderRenderMode;\n}\n\nlet instanceId = -1;\n\nexport class FileRenderer<LAnnotation = undefined> {\n readonly __id: string = `file-renderer:${++instanceId}`;\n\n private highlighter: DiffsHighlighter | undefined;\n // The latest file requested by the component. The render cache may\n // intentionally keep displaying an older highlighted file while this one\n // is highlighted in the background.\n private file: FileContents | undefined;\n\n private renderCache: FileRenderCache | undefined;\n // Completed background work waits here until the next render can update its\n // DOM and layout together.\n private pendingHighlightResult: PendingHighlightResult | undefined;\n\n private computedLang: SupportedLanguages = 'text';\n private lineAnnotations: AnnotationLineMap<LAnnotation> = {};\n private lineCache: LineCache | undefined;\n private pendingStructuralRows: Map<number, HASTElement> | undefined;\n private textDocumentCache = new WeakMap<\n FileContents,\n TextDocument<'file', LAnnotation>\n >();\n\n // Edit-session state: while active, this renderer stays on the main thread\n // with editor-compatible token markup — the editor's caret/selection\n // mapping needs the token transformer, and the pool's global options are\n // not guaranteed to produce it. The pool keeps serving every surface\n // without a session.\n private editSessionActive = false;\n\n public get fileCache(): FileContents | undefined {\n return this.renderCache?.file;\n }\n\n constructor(\n public options: FileRendererOptions = { theme: DEFAULT_THEMES },\n private annotationSlotName: (\n annotation: LineAnnotation<LAnnotation>\n ) => string = getLineAnnotationName,\n private onRenderUpdate?: () => unknown,\n private workerManager?: WorkerPoolManager | undefined\n ) {\n if (workerManager?.isWorkingPool() !== true) {\n this.highlighter = areThemesAttached(options.theme ?? DEFAULT_THEMES)\n ? getHighlighterIfLoaded()\n : undefined;\n }\n }\n\n public setOptions(options: FileRendererOptions): void {\n this.options = options;\n }\n\n public mergeOptions(options: Partial<FileRendererOptions>): void {\n this.options = { ...this.options, ...options };\n }\n\n public setLineAnnotations(\n lineAnnotations: LineAnnotation<LAnnotation>[]\n ): void {\n this.lineAnnotations = {};\n for (const annotation of lineAnnotations) {\n const arr = this.lineAnnotations[annotation.lineNumber] ?? [];\n this.lineAnnotations[annotation.lineNumber] = arr;\n arr.push(annotation);\n }\n }\n\n public cleanUp(): void {\n this.recycle();\n this.workerManager = undefined;\n this.onRenderUpdate = undefined;\n }\n\n /**\n * Enter edit-session mode: rendering happens locally with the token\n * transformer forced on, and worker-pool requests/results are suspended\n * for this renderer. Called on initial editor association and whenever its\n * rendering resumes after recycle.\n */\n public beginEditSession(\n file: FileContents,\n externalFile?: FileContents\n ): void {\n const { editSessionActive: wasAlreadyActive, renderCache } = this;\n this.editSessionActive = true;\n if (!wasAlreadyActive) {\n this.pendingHighlightResult = undefined;\n }\n\n this.file = file;\n if (renderCache == null) {\n return;\n }\n // Edit updates call this again before each write. That cache is already\n // private and must retain plain-text session results.\n if (wasAlreadyActive && renderCache.file === file) {\n return;\n }\n const { options } = this.getRenderOptions(file);\n const cacheBelongsToSession = renderCache.file === file;\n const cacheBelongsToExternal =\n externalFile != null &&\n areFileTargetsEqual(renderCache.file, externalFile);\n const { result } = renderCache;\n if (\n !renderCache.highlighted ||\n result == null ||\n !areFileRenderOptionsEqual(renderCache.options, options) ||\n (!cacheBelongsToSession && !cacheBelongsToExternal)\n ) {\n this.clearRenderCache();\n this.lineCache = undefined;\n this.textDocumentCache = new WeakMap();\n return;\n }\n if (cacheBelongsToSession) {\n return;\n }\n\n this.renderCache = {\n ...renderCache,\n file,\n result: {\n ...result,\n code: [...result.code],\n },\n };\n const { lineCache } = this;\n if (\n lineCache != null &&\n externalFile != null &&\n isLineCacheForFile(lineCache, externalFile)\n ) {\n this.lineCache = {\n cacheKey: undefined,\n file,\n sourceContents: file.contents,\n lines: lineCache.lines,\n };\n } else {\n this.lineCache = undefined;\n }\n }\n\n /**\n * Leave edit-session mode. Rendering returns to the pool when one works.\n * When `settledFile` has the content the cache already shows, the cache\n * adopts it as its identity so the next render treats it as current\n * instead of a new file.\n */\n public endEditSession(settledFile?: FileContents): void {\n this.editSessionActive = false;\n this.pendingHighlightResult = undefined;\n const { renderCache } = this;\n if (\n settledFile == null ||\n renderCache == null ||\n renderCache.file === settledFile ||\n !areFileTargetsEqual(renderCache.file, settledFile)\n ) {\n return;\n }\n renderCache.file = settledFile;\n }\n\n /**\n * Ensures that the DOM is compatible with editor render updates\n */\n public editorRenderReady(): boolean {\n return (\n this.renderCache?.options.useTokenTransformer === true &&\n this.renderCache.highlighted &&\n this.renderCache.result != null\n );\n }\n\n public recycle(): void {\n this.clearRenderCache();\n this.highlighter = undefined;\n this.workerManager?.cleanUpTasks(this);\n this.lineCache = undefined;\n this.file = undefined;\n // The session flag re-seeds on the next editor attach (beginEditSession).\n this.endEditSession();\n // The edited-document cache is only coherent alongside the render cache\n // it patched. Keeping it across a recycle would let getLineCount report\n // edit-session line counts (keyed by the long-lived file object) against\n // a result rebuilt from the file's own contents, which processFileResult\n // treats as a missing-line error.\n this.textDocumentCache = new WeakMap();\n }\n\n public clearRenderCache(): void {\n this.pendingStructuralRows = undefined;\n this.renderCache = undefined;\n this.pendingHighlightResult = undefined;\n }\n\n public hydrate(file: FileContents): void {\n this.file = file;\n const { options } = this.getRenderOptions(file);\n const lines = this.getOrCreateLineCache(file);\n const massiveFile = isFileMassive(\n lines.length,\n this.getTokenizeMaxLength()\n );\n let cache = this.workerManager?.getFileResultCache(file);\n if (cache != null && !areFileRenderOptionsEqual(options, cache.options)) {\n cache = undefined;\n }\n this.renderCache ??= {\n file,\n hydrated: true,\n options,\n highlighted: !massiveFile && !isFilePlainText(file),\n result: massiveFile ? undefined : cache?.result,\n // FIXME(amadeus): Add support for renderRanges\n renderRange: undefined,\n };\n if (\n !this.editSessionActive &&\n this.workerManager?.isWorkingPool() === true\n ) {\n if (this.renderCache.result == null && !massiveFile) {\n // We should only kick off a preload of the AST if we have a WorkerPool\n this.workerManager.highlightFileAST(this, file);\n }\n }\n // Lets attempt to get the highlighter/languages ready immediately\n else if (this.highlighter == null) {\n this.computedLang = file.lang ?? getFiletypeFromFileName(file.name);\n void this.initializeHighlighter();\n }\n }\n\n private getLocalHighlightTheme(): RenderFileOptions['theme'] {\n return (\n this.workerManager?.getFileRenderOptions().theme ??\n this.options.theme ??\n DEFAULT_THEMES\n );\n }\n\n public getEffectiveCodeOptions(): Pick<\n BaseCodeOptions,\n 'theme' | 'tokenizeMaxLineLength'\n > {\n const poolOptions =\n this.workerManager?.isWorkingPool() === true\n ? this.workerManager.getFileRenderOptions()\n : undefined;\n return {\n theme: this.getLocalHighlightTheme(),\n tokenizeMaxLineLength:\n poolOptions?.tokenizeMaxLineLength ??\n this.options.tokenizeMaxLineLength,\n };\n }\n\n private getRenderOptions(file: FileContents): GetRenderOptionsReturn {\n const options: RenderFileOptions = (() => {\n if (this.workerManager?.isWorkingPool() === true) {\n const poolOptions = this.workerManager.getFileRenderOptions();\n // Active edit sessions require `useTokenTransformer: true`\n if (\n this.editSessionActive &&\n poolOptions.useTokenTransformer !== true\n ) {\n return { ...poolOptions, useTokenTransformer: true };\n }\n return poolOptions;\n }\n const { tokenizeMaxLineLength = 1000 } = this.options;\n return {\n theme: this.getLocalHighlightTheme(),\n useTokenTransformer:\n this.editSessionActive || this.options.useTokenTransformer === true,\n tokenizeMaxLineLength,\n };\n })();\n const { renderCache } = this;\n if (renderCache?.result == null) {\n return { options, forceHighlight: true };\n }\n if (\n !areFileTargetsEqual(file, renderCache.file) ||\n !areFileRenderOptionsEqual(options, renderCache.options)\n ) {\n return { options, forceHighlight: true };\n }\n return { options, forceHighlight: false };\n }\n\n /**\n * Returns the file that the next synchronous render can commit without\n * changing the current render cache. Virtualized layouts use this to stay\n * aligned with the DOM while a replacement highlight is still pending.\n */\n public getFileForNextRender(file: FileContents): FileContents {\n const { options } = this.getRenderOptions(file);\n if (this.getReadyRenderResult(file, options) != null) {\n return file;\n }\n\n const { renderCache } = this;\n if (renderCache == null) {\n return file;\n }\n if (areFileTargetsEqual(renderCache.file, file)) {\n return renderCache.file;\n }\n\n const lines = linesFromFileContents(file.contents);\n const forcePlainText =\n file.contents.length === 0 ||\n isFilePlainText(file) ||\n isFileMassive(lines.length, this.getTokenizeMaxLength());\n\n return this.canRenderFile(file, options, forcePlainText)\n ? file\n : renderCache.file;\n }\n\n private canRenderFile(\n file: FileContents,\n options: RenderFileOptions,\n forcePlainText: boolean\n ): boolean {\n const { renderCache } = this;\n if (renderCache == null || areFileTargetsEqual(renderCache.file, file)) {\n return true;\n }\n if (forcePlainText) {\n return (\n (renderCache.result == null && renderCache.hydrated !== true) ||\n this.workerManager?.isWorkingPool() === true ||\n (this.highlighter != null && areThemesAttached(options.theme))\n );\n }\n // Hydration has highlighted DOM without a local AST. It is still active\n // rendered content and must remain visible while a non-plain replacement\n // is prepared.\n if (renderCache.result == null && renderCache.hydrated !== true) {\n return true;\n }\n\n if (\n !this.editSessionActive &&\n this.workerManager?.isWorkingPool() === true\n ) {\n return !renderCache.highlighted;\n }\n\n return this.highlighter != null && areThemesAttached(options.theme);\n }\n\n public getOrCreateLineCache(file: FileContents): string[] {\n let { lineCache } = this;\n if (lineCache == null || !isLineCacheForFile(lineCache, file)) {\n lineCache = {\n cacheKey: file.cacheKey,\n file,\n sourceContents: file.contents,\n lines: linesFromFileContents(file.contents),\n };\n }\n this.lineCache = lineCache;\n return lineCache.lines;\n }\n\n // when a emitLineCountChange is called,\n // calculate the line count using the cached text document\n public getLineCount(file: FileContents): number {\n const lines = this.getOrCreateLineCache(file);\n return this.textDocumentCache.get(file)?.lineCount ?? lines.length;\n }\n\n public updateRenderCache(\n dirtyLines: Map<number, Array<HighlightedToken>>,\n themeType: 'dark' | 'light',\n lineCountChangeInFlight = false\n ): void {\n this.pendingStructuralRows = undefined;\n const { renderCache } = this;\n if (renderCache == null) {\n return;\n }\n const { file, result } = renderCache;\n if (result == null) {\n return;\n }\n const pendingStructuralRows = lineCountChangeInFlight\n ? new Map<number, HASTElement>()\n : undefined;\n this.pendingStructuralRows = pendingStructuralRows;\n // Same-line edits can update the document cache immediately. Structural\n // rows use post-edit indexes, so hold them until applyDocumentChange has\n // shifted the old cache; writing now would overwrite rows that must move.\n const lineCache =\n this.lineCache != null && isLineCacheForFile(this.lineCache, file)\n ? this.lineCache\n : undefined;\n for (const [line, tokens] of dirtyLines) {\n if (\n pendingStructuralRows == null &&\n lineCache != null &&\n line < lineCache.lines.length\n ) {\n const lineText = tokens.map((token) => token[2]).join('');\n lineCache.lines[line] = applyLineTextWithNewline(\n lineCache.lines[line] ?? '',\n lineText\n );\n }\n const row: HASTElement = {\n type: 'element',\n tagName: 'div',\n properties: {\n 'data-line': line + 1,\n 'data-line-type': 'context',\n 'data-line-index': line,\n },\n children: tokens.map(([char, fg, text]) => {\n if (char === 0 && fg === '') {\n if (text === '') {\n return {\n type: 'element',\n tagName: 'br',\n properties: {},\n children: [],\n };\n }\n return { type: 'text', value: text };\n }\n return {\n type: 'element',\n tagName: 'span',\n properties: {\n 'data-char': char,\n style: `color:${fg};`,\n },\n children: [{ type: 'text', value: text }],\n };\n }),\n };\n if (pendingStructuralRows != null) {\n pendingStructuralRows.set(line, row);\n } else {\n result.code[line] = row;\n }\n }\n\n result.baseThemeType = themeType;\n renderCache.isDirty = true;\n if (pendingStructuralRows == null && lineCache != null) {\n file.contents = lineCache.lines.join('');\n lineCache.sourceContents = file.contents;\n }\n }\n\n // normally triggered by the host when the document line count changes\n public applyDocumentChange(\n textDocument: TextDocument<'file', LAnnotation>\n ): void {\n const { pendingStructuralRows, renderCache } = this;\n this.pendingStructuralRows = undefined;\n if (renderCache == null) {\n return;\n }\n const { file, result } = renderCache;\n // Without a result there is nothing to reconcile the document against, so\n // do not record it either: the document cache must never claim line\n // counts the (possibly still highlighting) result cannot back, or the\n // async highlight pass would process lines that do not exist.\n if (result == null) {\n return undefined;\n }\n // Structural edits renumber cached HAST rows. Keep the unchanged prefix\n // and suffix, and plain-fill only the window that still needs tokenizing.\n const previousLines =\n this.lineCache != null && isLineCacheForFile(this.lineCache, file)\n ? this.lineCache.lines\n : linesFromFileContents(file.contents);\n const nextLines = linesFromFileContents(textDocument.getText());\n if (previousLines.length !== nextLines.length) {\n const maxShared = Math.min(previousLines.length, nextLines.length);\n let prefix = 0;\n while (\n prefix < maxShared &&\n previousLines[prefix] === nextLines[prefix]\n ) {\n prefix++;\n }\n let suffix = 0;\n while (\n suffix < maxShared - prefix &&\n previousLines[previousLines.length - 1 - suffix] ===\n nextLines[nextLines.length - 1 - suffix]\n ) {\n suffix++;\n }\n\n const previousCode = result.code;\n result.code = new Array(nextLines.length);\n for (let i = 0; i < prefix; i++) {\n result.code[i] = previousCode[i];\n }\n for (let i = 0; i < suffix; i++) {\n result.code[nextLines.length - 1 - i] =\n previousCode[previousLines.length - 1 - i];\n }\n if (pendingStructuralRows !== undefined) {\n for (const [line, row] of pendingStructuralRows) {\n if (line < nextLines.length) {\n result.code[line] = row;\n }\n }\n }\n for (let i = prefix; i < nextLines.length - suffix; i++) {\n result.code[i] ??= {\n type: 'element',\n tagName: 'div',\n properties: {\n 'data-line': i + 1,\n 'data-line-type': 'context',\n 'data-line-index': i,\n },\n children: [\n {\n type: 'element',\n tagName: 'span',\n properties: {\n 'data-char': 0,\n },\n children: [\n {\n type: 'text',\n value: textDocument.getLineText(i),\n },\n ],\n },\n ],\n };\n }\n for (let i = 0; i < result.code.length; i++) {\n const line = result.code[i];\n if (line?.type === 'element') {\n line.properties['data-line'] = i + 1;\n line.properties['data-line-index'] = i;\n }\n }\n renderCache.isDirty = true;\n }\n // Replace the old split-line cache with the authoritative edited document.\n this.lineCache = {\n cacheKey: file.cacheKey,\n file,\n sourceContents: file.contents,\n lines: nextLines,\n };\n this.textDocumentCache.set(file, textDocument);\n file.contents = textDocument.getText();\n }\n\n public renderFile(\n file: FileContents | undefined = this.file,\n renderRange: RenderRange = DEFAULT_RENDER_RANGE\n ): FileRenderResult | undefined {\n this.file = file;\n if (file == null) {\n this.pendingHighlightResult = undefined;\n return undefined;\n }\n let { options, forceHighlight } = this.getRenderOptions(file);\n const readyResult = this.getReadyRenderResult(file, options);\n this.pendingHighlightResult = undefined;\n if (readyResult != null) {\n this.renderCache = {\n ...readyResult,\n file,\n renderRange: undefined,\n };\n forceHighlight = false;\n }\n this.renderCache ??= {\n file,\n highlighted: false,\n options,\n result: undefined,\n renderRange: undefined,\n };\n const lines = this.getOrCreateLineCache(file);\n const hasContent = file.contents.length > 0;\n const forcePlainText =\n !hasContent ||\n isFilePlainText(file) ||\n isFileMassive(lines.length, this.getTokenizeMaxLength());\n const canRenderFile = this.canRenderFile(file, options, forcePlainText);\n const newContent = !areFileTargetsEqual(file, this.renderCache.file);\n const newRenderRange = !areRenderRangesEqual(\n this.renderCache.renderRange,\n renderRange\n );\n if (\n !this.editSessionActive &&\n this.workerManager?.isWorkingPool() === true\n ) {\n // Hydration has highlighted DOM but no local AST. Keep that DOM until\n // its corresponding worker result is ready.\n const preserveHydratedContent =\n this.renderCache.result == null &&\n this.renderCache.highlighted &&\n !forcePlainText &&\n !newContent &&\n isDefaultRenderRange(renderRange);\n if (\n canRenderFile &&\n !preserveHydratedContent &&\n (forcePlainText ||\n this.renderCache.result == null ||\n (!this.renderCache.highlighted && (newContent || newRenderRange)))\n ) {\n this.renderCache.file = file;\n this.renderCache.options = options;\n this.renderCache.highlighted = false;\n if (\n this.renderCache.result == null ||\n newContent ||\n newRenderRange ||\n forceHighlight\n ) {\n this.renderCache.result = this.workerManager.getPlainFileAST(\n file,\n renderRange.startingLine,\n renderRange.totalLines,\n lines\n );\n }\n this.renderCache.renderRange = renderRange;\n }\n\n if (\n !forcePlainText &&\n hasContent &&\n (!this.renderCache.highlighted || forceHighlight)\n ) {\n this.workerManager.highlightFileAST(this, file);\n }\n } else {\n this.computedLang = file.lang ?? getFiletypeFromFileName(file.name);\n this.highlighter ??= getHighlighterIfLoaded();\n const hasThemes =\n this.highlighter != null && areThemesAttached(options.theme);\n const hasLangs =\n this.highlighter != null && areLanguagesAttached(this.computedLang);\n const canHighlight = !forcePlainText && hasLangs;\n\n // If we have any semblance of a highlighter with the correct theme(s)\n // attached, we can kick off some form of rendering. If we don't have\n // the correct language, then we can render plain text and after kick off\n // an async job to get the highlighted AST\n if (\n canRenderFile &&\n this.highlighter != null &&\n hasThemes &&\n (forceHighlight ||\n forcePlainText ||\n (!this.renderCache.highlighted && canHighlight) ||\n this.renderCache.result == null)\n ) {\n const { result, options } = this.renderFileWithHighlighter(\n file,\n this.highlighter,\n forcePlainText || !hasLangs\n );\n this.renderCache = {\n file,\n options,\n highlighted: canHighlight,\n result,\n renderRange: undefined,\n };\n }\n\n // If we get in here it means we'll have to kick off an async highlight\n // process which will involve initializing the highlighter with new themes\n // and languages\n if (!hasThemes || (!forcePlainText && !hasLangs)) {\n void this.asyncHighlight(file).then(({ result, options }) => {\n this.applyHighlightResult(file, result, options, !forcePlainText);\n });\n }\n }\n\n return this.renderCache.result != null\n ? this.processFileResult(\n this.renderCache.file,\n renderRange,\n this.renderCache.result\n )\n : undefined;\n }\n\n async asyncRender(\n file: FileContents,\n renderRange: RenderRange = DEFAULT_RENDER_RANGE\n ): Promise<FileRenderResult> {\n this.file = file;\n const { result } = await this.asyncHighlight(file);\n return this.processFileResult(file, renderRange, result);\n }\n\n private async asyncHighlight(file: FileContents): Promise<RenderFileResult> {\n const lines = this.getOrCreateLineCache(file);\n const forcePlainText = isFileMassive(\n lines.length,\n this.getTokenizeMaxLength()\n );\n this.computedLang = forcePlainText\n ? 'text'\n : (file.lang ?? getFiletypeFromFileName(file.name));\n const hasThemes =\n this.highlighter != null &&\n hasResolvedThemes(getThemes(this.getLocalHighlightTheme()));\n const hasLangs =\n forcePlainText ||\n (this.highlighter != null && areLanguagesAttached(this.computedLang));\n // If we don't have the required langs or themes, then we need to\n // initialize the highlighter to load the appropriate languages and themes\n if (this.highlighter == null || !hasThemes || !hasLangs) {\n this.highlighter = await this.initializeHighlighter();\n }\n return this.renderFileWithHighlighter(\n file,\n this.highlighter,\n forcePlainText\n );\n }\n\n private renderFileWithHighlighter(\n file: FileContents,\n highlighter: DiffsHighlighter,\n forcePlainText = false\n ): RenderFileResult {\n const { options } = this.getRenderOptions(file);\n const result = renderFileWithHighlighter(file, highlighter, options, {\n forcePlainText,\n });\n return { result, options };\n }\n\n private processFileResult(\n file: FileContents,\n renderRange: RenderRange,\n { code, themeStyles, baseThemeType }: ThemedFileResult\n ): FileRenderResult {\n const totalLines = this.getLineCount(file);\n const { disableFileHeader = false } = this.options;\n const contentArray: ElementContent[] = [];\n const gutter = createGutterWrapper();\n const endLine = Math.min(\n renderRange.startingLine + renderRange.totalLines,\n totalLines\n );\n let rowCount = 0;\n\n const fileLevelAnnotations = shouldRenderFileAnnotations(renderRange)\n ? getFileAnnotations(this.lineAnnotations)\n : undefined;\n if (fileLevelAnnotations != null) {\n gutter.children.push(createGutterGap('context', 'annotation', 1));\n contentArray.push(\n createAnnotationElement({\n type: 'annotation',\n hunkIndex: FILE_ANNOTATION_HUNK_INDEX,\n lineIndex: FILE_ANNOTATION_LINE_INDEX,\n annotations: fileLevelAnnotations.map((annotation) =>\n this.annotationSlotName(annotation)\n ),\n })\n );\n rowCount++;\n }\n\n for (\n let lineIndex = renderRange.startingLine;\n lineIndex < endLine;\n lineIndex++\n ) {\n const lineNumber = lineIndex + 1;\n\n // Sparse array - directly indexed by lineIndex\n const line = code[lineIndex];\n if (line == null) {\n const message = 'FileRenderer.processFileResult: Line doesnt exist';\n console.error(message, {\n name: file.name,\n lineIndex,\n lineNumber,\n });\n throw new Error(message);\n }\n\n // Add gutter line number\n gutter.children.push(\n createGutterItem('context', lineNumber, `${lineIndex}`)\n );\n contentArray.push(line);\n rowCount++;\n\n // Check annotations using ACTUAL line number from file\n const annotations = this.lineAnnotations[lineNumber];\n if (annotations != null) {\n gutter.children.push(createGutterGap('context', 'annotation', 1));\n contentArray.push(\n createAnnotationElement({\n type: 'annotation',\n hunkIndex: 0,\n lineIndex: lineNumber,\n annotations: annotations.map((annotation) =>\n this.annotationSlotName(annotation)\n ),\n })\n );\n rowCount++;\n }\n }\n\n // Finalize: wrap gutter and content\n gutter.properties.style = `grid-row: span ${rowCount}`;\n return {\n file,\n gutterAST: gutter.children ?? [],\n contentAST: contentArray,\n preAST: this.createPreElement(totalLines),\n headerAST: !disableFileHeader ? this.renderHeader(file) : undefined,\n totalLines: totalLines,\n rowCount,\n themeStyles: themeStyles,\n baseThemeType,\n bufferBefore: renderRange.bufferBefore,\n bufferAfter: renderRange.bufferAfter,\n css: '',\n };\n }\n\n private renderHeader(file: FileContents) {\n const { headerRenderMode = 'default', stickyHeader = false } = this.options;\n return createFileHeaderElement({\n fileOrDiff: file,\n mode: headerRenderMode,\n stickyHeader,\n });\n }\n\n public renderFullHTML(result: FileRenderResult): string {\n return toHtml(this.renderFullAST(result));\n }\n\n public renderFullAST(\n result: FileRenderResult,\n children: ElementContent[] = []\n ): HASTElement {\n children.push(\n createHastElement({\n tagName: 'code',\n children: this.renderCodeAST(result),\n properties: { 'data-code': '' },\n })\n );\n return { ...result.preAST, children };\n }\n\n public renderCodeAST(result: FileRenderResult): ElementContent[] {\n const gutter = createGutterWrapper();\n gutter.children = result.gutterAST;\n gutter.properties.style = `grid-row: span ${result.rowCount}`;\n const contentColumn = createContentColumn(\n result.contentAST,\n result.rowCount\n );\n return [gutter, contentColumn];\n }\n\n public renderPartialHTML(\n children: ElementContent[],\n includeCodeNode: boolean = false\n ): string {\n if (!includeCodeNode) {\n return toHtml(children);\n }\n return toHtml(\n createHastElement({\n tagName: 'code',\n children,\n properties: { 'data-code': '' },\n })\n );\n }\n\n public async initializeHighlighter(): Promise<DiffsHighlighter> {\n this.highlighter = await getSharedHighlighter(\n getHighlighterOptions(this.computedLang, {\n theme: this.getLocalHighlightTheme(),\n preferredHighlighter:\n this.workerManager?.getPreferredHighlighter() ??\n this.options.preferredHighlighter,\n })\n );\n return this.highlighter;\n }\n\n public onHighlightSuccess(\n file: FileContents,\n result: ThemedFileResult,\n options: RenderFileOptions,\n highlighted = true\n ): void {\n if (this.editSessionActive) {\n return;\n }\n this.applyHighlightResult(file, result, options, highlighted);\n }\n\n private applyHighlightResult(\n file: FileContents,\n result: ThemedFileResult,\n options: RenderFileOptions,\n highlighted = true\n ): void {\n const { file: currentFile, renderCache } = this;\n if (\n currentFile == null ||\n renderCache == null ||\n !areFileTargetsEqual(file, currentFile) ||\n !areFileRenderOptionsEqual(\n options,\n this.getRenderOptions(currentFile).options\n )\n ) {\n return;\n }\n\n const triggerRender =\n renderCache.result == null ||\n !renderCache.highlighted ||\n !areFileRenderOptionsEqual(renderCache.options, options) ||\n !areFileTargetsEqual(renderCache.file, currentFile);\n if (!triggerRender) {\n return;\n }\n\n this.pendingHighlightResult = {\n file: currentFile,\n options,\n highlighted,\n result,\n };\n this.onRenderUpdate?.();\n }\n\n private getMatchingWorkerResultCache(\n file: FileContents,\n options: RenderFileOptions\n ): RenderFileResult | undefined {\n if (this.editSessionActive) {\n return undefined;\n }\n const cache = this.workerManager?.getFileResultCache(file);\n if (cache == null || !areFileRenderOptionsEqual(options, cache.options)) {\n return undefined;\n }\n return cache;\n }\n\n // Returns completed background work that can replace the rendered AST on\n // the next render. Reading it does not promote or discard pending work.\n private getReadyRenderResult(\n file: FileContents,\n options: RenderFileOptions\n ): PendingHighlightResult | undefined {\n const { pendingHighlightResult } = this;\n if (\n pendingHighlightResult != null &&\n areFileTargetsEqual(pendingHighlightResult.file, file) &&\n areFileRenderOptionsEqual(pendingHighlightResult.options, options)\n ) {\n return pendingHighlightResult;\n }\n\n const workerCache = this.getMatchingWorkerResultCache(file, options);\n if (workerCache == null || this.hasHighlightedRenderCache(file, options)) {\n return undefined;\n }\n return { file, highlighted: true, ...workerCache };\n }\n\n private hasHighlightedRenderCache(\n file: FileContents,\n options: RenderFileOptions\n ): boolean {\n const { renderCache } = this;\n return (\n renderCache?.result != null &&\n renderCache.highlighted &&\n areFileTargetsEqual(file, renderCache.file) &&\n areFileRenderOptionsEqual(options, renderCache.options)\n );\n }\n\n public onHighlightError(error: unknown): void {\n console.error(error);\n }\n\n private getTokenizeMaxLength(): number {\n return this.options.tokenizeMaxLength ?? DEFAULT_TOKENIZE_MAX_LENGTH;\n }\n\n private createPreElement(totalLines: number): HASTElement {\n const { disableLineNumbers = false, overflow = 'scroll' } = this.options;\n return createPreElement({\n type: 'file',\n diffIndicators: 'none',\n disableBackground: true,\n disableLineNumbers,\n overflow,\n split: false,\n totalLines,\n });\n }\n}\n\nfunction isFileMassive(lineCount: number, tokenizeMaxLength: number): boolean {\n return lineCount > tokenizeMaxLength;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAyGA,SAAS,mBAAmB,WAAsB,MAA6B;CAC7E,OAAO,KAAK,YAAY,OACpB,UAAU,SAAS,QAAQ,UAAU,mBAAmB,KAAK,WAC7D,UAAU,aAAa,KAAK;AAClC;AAMA,IAAI,aAAa;AAEjB,IAAa,eAAb,MAAmD;CAmCxC;CACC;CAGA;CACA;CAvCV,OAAwB,iBAAiB,EAAE;CAE3C;CAIA;CAEA;CAGA;CAEA,eAA2C;CAC3C,kBAA0D,CAAC;CAC3D;CACA;CACA,oCAA4B,IAAI,QAG9B;CAOF,oBAA4B;CAE5B,IAAW,YAAsC;EAC/C,OAAO,KAAK,aAAa;CAC3B;CAEA,YACE,UAAsC,EAAE,OAAO,eAAe,GAC9D,qBAEc,uBACd,gBACA,eACA;EANO,KAAA,UAAA;EACC,KAAA,qBAAA;EAGA,KAAA,iBAAA;EACA,KAAA,gBAAA;EAER,IAAI,eAAe,cAAc,MAAM,MACrC,KAAK,cAAc,kBAAkB,QAAQ,SAAS,cAAc,IAChE,uBAAuB,IACvB,KAAA;CAER;CAEA,WAAkB,SAAoC;EACpD,KAAK,UAAU;CACjB;CAEA,aAAoB,SAA6C;EAC/D,KAAK,UAAU;GAAE,GAAG,KAAK;GAAS,GAAG;EAAQ;CAC/C;CAEA,mBACE,iBACM;EACN,KAAK,kBAAkB,CAAC;EACxB,KAAK,MAAM,cAAc,iBAAiB;GACxC,MAAM,MAAM,KAAK,gBAAgB,WAAW,eAAe,CAAC;GAC5D,KAAK,gBAAgB,WAAW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MAAM,OAAO;EACnE,IAAI,eAAe,QAAQ,KAAK,0BAA0B,MAAM,OAAO,GACrE;EAEF,OAAO;GAAE;GAAM,aAAa;GAAM,GAAG;EAAY;CACnD;CAEA,0BACE,MACA,SACS;EACT,MAAM,EAAE,gBAAgB;EACxB,OACE,aAAa,UAAU,QACvB,YAAY,eACZ,oBAAoB,MAAM,YAAY,IAAI,KAC1C,0BAA0B,SAAS,YAAY,OAAO;CAE1D;CAEA,iBAAwB,OAAsB;EAC5C,QAAQ,MAAM,KAAK;CACrB;CAEA,uBAAuC;EACrC,OAAO,KAAK,QAAQ,qBAAA;CACtB;CAEA,iBAAyB,YAAiC;EACxD,MAAM,EAAE,qBAAqB,OAAO,WAAW,aAAa,KAAK;EACjE,OAAO,iBAAiB;GACtB,MAAM;GACN,gBAAgB;GAChB,mBAAmB;GACnB;GACA;GACA,OAAO;GACP;EACF,CAAC;CACH;AACF;AAEA,SAAS,cAAc,WAAmB,mBAAoC;CAC5E,OAAO,YAAY;AACrB"}
1
+ {"version":3,"file":"FileRenderer.js","names":[],"sources":["../../src/renderers/FileRenderer.ts"],"sourcesContent":["import type { ElementContent, Element as HASTElement } from 'hast';\nimport { toHtml } from 'hast-util-to-html';\n\nimport {\n DEFAULT_RENDER_RANGE,\n DEFAULT_THEMES,\n DEFAULT_TOKENIZE_MAX_LENGTH,\n} from '../constants';\nimport type { TextDocument } from '../editor/textDocument';\nimport { areLanguagesAttached } from '../highlighter/languages/areLanguagesAttached';\nimport {\n getHighlighterIfLoaded,\n getSharedHighlighter,\n} from '../highlighter/shared_highlighter';\nimport { areThemesAttached } from '../highlighter/themes/areThemesAttached';\nimport { hasResolvedThemes } from '../highlighter/themes/hasResolvedThemes';\nimport type {\n BaseCodeOptions,\n DiffsHighlighter,\n FileContents,\n FileHeaderRenderMode,\n HighlightedToken,\n LineAnnotation,\n RenderedFileASTCache,\n RenderFileOptions,\n RenderFileResult,\n RenderRange,\n SupportedLanguages,\n ThemedFileResult,\n} from '../types';\nimport { applyLineTextWithNewline } from '../utils/applyLineTextWithNewline';\nimport { areFileRenderOptionsEqual } from '../utils/areFileRenderOptionsEqual';\nimport { areFileTargetsEqual } from '../utils/areFileTargetsEqual';\nimport { areRenderRangesEqual } from '../utils/areRenderRangesEqual';\nimport { linesFromFileContents } from '../utils/computeFileOffsets';\nimport { createAnnotationElement } from '../utils/createAnnotationElement';\nimport { createContentColumn } from '../utils/createContentColumn';\nimport { createFileHeaderElement } from '../utils/createFileHeaderElement';\nimport { createPreElement } from '../utils/createPreElement';\nimport { getFiletypeFromFileName } from '../utils/getFiletypeFromFileName';\nimport { getHighlighterOptions } from '../utils/getHighlighterOptions';\nimport { getLineAnnotationName } from '../utils/getLineAnnotationName';\nimport { getThemes } from '../utils/getThemes';\nimport {\n createGutterGap,\n createGutterItem,\n createGutterWrapper,\n createHastElement,\n} from '../utils/hast_utils';\nimport {\n FILE_ANNOTATION_HUNK_INDEX,\n FILE_ANNOTATION_LINE_INDEX,\n getFileAnnotations,\n shouldRenderFileAnnotations,\n} from '../utils/includesFileAnnotations';\nimport { isDefaultRenderRange } from '../utils/isDefaultRenderRange';\nimport { isFilePlainText } from '../utils/isFilePlainText';\nimport { renderFileWithHighlighter } from '../utils/renderFileWithHighlighter';\nimport type { WorkerPoolManager } from '../worker';\n\ntype AnnotationLineMap<LAnnotation> = Record<\n number,\n LineAnnotation<LAnnotation>[] | undefined\n>;\n\ninterface GetRenderOptionsReturn {\n options: RenderFileOptions;\n forceHighlight: boolean;\n}\n\ninterface PendingHighlightResult extends RenderFileResult {\n file: FileContents;\n highlighted: boolean;\n}\n\ninterface FileRenderCache extends RenderedFileASTCache {\n // hydrate() describes DOM that already exists, even when no reusable AST\n // was available for that server-rendered content.\n hydrated?: boolean;\n}\n\nexport interface FileRenderResult {\n file: FileContents;\n gutterAST: ElementContent[];\n contentAST: ElementContent[];\n preAST: HASTElement;\n headerAST: HASTElement | undefined;\n css: string;\n totalLines: number;\n themeStyles: string;\n baseThemeType: 'light' | 'dark' | undefined;\n rowCount: number;\n bufferBefore: number;\n bufferAfter: number;\n}\n\ninterface LineCache {\n cacheKey: string | undefined;\n file: FileContents;\n sourceContents: string;\n lines: string[];\n}\n\n// Explicit keys may share cached lines across equivalent file objects. Unkeyed\n// files stay isolated by object identity while still supporting edit recycle.\nfunction isLineCacheForFile(lineCache: LineCache, file: FileContents): boolean {\n return file.cacheKey == null\n ? lineCache.file === file && lineCache.sourceContents === file.contents\n : lineCache.cacheKey === file.cacheKey;\n}\n\nexport interface FileRendererOptions extends BaseCodeOptions {\n headerRenderMode?: FileHeaderRenderMode;\n}\n\nlet instanceId = -1;\n\nexport class FileRenderer<LAnnotation = undefined> {\n readonly __id: string = `file-renderer:${++instanceId}`;\n\n private highlighter: DiffsHighlighter | undefined;\n // The latest file requested by the component. The render cache may\n // intentionally keep displaying an older highlighted file while this one\n // is highlighted in the background.\n private file: FileContents | undefined;\n\n private renderCache: FileRenderCache | undefined;\n // Completed background work waits here until the next render can update its\n // DOM and layout together.\n private pendingHighlightResult: PendingHighlightResult | undefined;\n\n private computedLang: SupportedLanguages = 'text';\n private lineAnnotations: AnnotationLineMap<LAnnotation> = {};\n private lineCache: LineCache | undefined;\n private pendingStructuralRows: Map<number, HASTElement> | undefined;\n private textDocumentCache = new WeakMap<\n FileContents,\n TextDocument<'file', LAnnotation>\n >();\n\n // Edit-session state: while active, this renderer stays on the main thread\n // with editor-compatible token markup — the editor's caret/selection\n // mapping needs the token transformer, and the pool's global options are\n // not guaranteed to produce it. The pool keeps serving every surface\n // without a session.\n private editSessionActive = false;\n\n public get fileCache(): FileContents | undefined {\n return this.renderCache?.file;\n }\n\n constructor(\n public options: FileRendererOptions = { theme: DEFAULT_THEMES },\n private annotationSlotName: (\n annotation: LineAnnotation<LAnnotation>\n ) => string = getLineAnnotationName,\n private onRenderUpdate?: () => unknown,\n private workerManager?: WorkerPoolManager | undefined\n ) {\n if (workerManager?.isWorkingPool() !== true) {\n this.highlighter = areThemesAttached(options.theme ?? DEFAULT_THEMES)\n ? getHighlighterIfLoaded()\n : undefined;\n }\n }\n\n public setOptions(options: FileRendererOptions): void {\n this.options = options;\n }\n\n public mergeOptions(options: Partial<FileRendererOptions>): void {\n this.options = { ...this.options, ...options };\n }\n\n public setLineAnnotations(\n lineAnnotations: LineAnnotation<LAnnotation>[]\n ): void {\n this.lineAnnotations = {};\n for (const annotation of lineAnnotations) {\n const arr = this.lineAnnotations[annotation.lineNumber] ?? [];\n this.lineAnnotations[annotation.lineNumber] = arr;\n arr.push(annotation);\n }\n }\n\n public cleanUp(): void {\n this.recycle();\n this.workerManager = undefined;\n this.onRenderUpdate = undefined;\n }\n\n /**\n * Enter edit-session mode: rendering happens locally with the token\n * transformer forced on, and worker-pool requests/results are suspended\n * for this renderer. Called on initial editor association and whenever its\n * rendering resumes after recycle.\n */\n public beginEditSession(\n file: FileContents,\n externalFile?: FileContents\n ): void {\n const { editSessionActive: wasAlreadyActive, renderCache } = this;\n this.editSessionActive = true;\n if (!wasAlreadyActive) {\n this.pendingHighlightResult = undefined;\n }\n\n this.file = file;\n if (renderCache == null) {\n return;\n }\n // Edit updates call this again before each write. That cache is already\n // private and must retain plain-text session results.\n if (wasAlreadyActive && renderCache.file === file) {\n return;\n }\n const { options } = this.getRenderOptions(file);\n const cacheBelongsToSession = renderCache.file === file;\n const cacheBelongsToExternal =\n externalFile != null &&\n areFileTargetsEqual(renderCache.file, externalFile);\n const { result } = renderCache;\n if (\n !renderCache.highlighted ||\n result == null ||\n !areFileRenderOptionsEqual(renderCache.options, options) ||\n (!cacheBelongsToSession && !cacheBelongsToExternal)\n ) {\n this.clearRenderCache();\n this.lineCache = undefined;\n this.textDocumentCache = new WeakMap();\n return;\n }\n if (cacheBelongsToSession) {\n return;\n }\n\n this.renderCache = {\n ...renderCache,\n file,\n result: {\n ...result,\n code: [...result.code],\n },\n };\n const { lineCache } = this;\n if (\n lineCache != null &&\n externalFile != null &&\n isLineCacheForFile(lineCache, externalFile)\n ) {\n this.lineCache = {\n cacheKey: undefined,\n file,\n sourceContents: file.contents,\n lines: lineCache.lines,\n };\n } else {\n this.lineCache = undefined;\n }\n }\n\n /**\n * Leave edit-session mode. Rendering returns to the pool when one works.\n * When `settledFile` has the content the cache already shows, the cache\n * adopts it as its identity so the next render treats it as current\n * instead of a new file.\n */\n public endEditSession(settledFile?: FileContents): void {\n this.editSessionActive = false;\n this.pendingHighlightResult = undefined;\n const { renderCache } = this;\n if (\n settledFile == null ||\n renderCache == null ||\n renderCache.file === settledFile ||\n !areFileTargetsEqual(renderCache.file, settledFile)\n ) {\n return;\n }\n renderCache.file = settledFile;\n }\n\n /**\n * Ensures that the DOM is compatible with editor render updates\n */\n public editorRenderReady(): boolean {\n return (\n this.renderCache?.options.useTokenTransformer === true &&\n this.renderCache.highlighted &&\n this.renderCache.result != null\n );\n }\n\n public recycle(): void {\n this.clearRenderCache();\n this.highlighter = undefined;\n this.workerManager?.cleanUpTasks(this);\n this.lineCache = undefined;\n this.file = undefined;\n // The session flag re-seeds on the next editor attach (beginEditSession).\n this.endEditSession();\n // The edited-document cache is only coherent alongside the render cache\n // it patched. Keeping it across a recycle would let getLineCount report\n // edit-session line counts (keyed by the long-lived file object) against\n // a result rebuilt from the file's own contents, which processFileResult\n // treats as a missing-line error.\n this.textDocumentCache = new WeakMap();\n }\n\n public clearRenderCache(): void {\n this.pendingStructuralRows = undefined;\n this.renderCache = undefined;\n this.pendingHighlightResult = undefined;\n }\n\n public hydrate(file: FileContents): void {\n this.file = file;\n const { options } = this.getRenderOptions(file);\n const lines = this.getOrCreateLineCache(file);\n const massiveFile = isFileMassive(\n lines.length,\n this.getTokenizeMaxLength()\n );\n let cache = this.workerManager?.getFileResultCache(file);\n if (cache != null && !areFileRenderOptionsEqual(options, cache.options)) {\n cache = undefined;\n }\n this.renderCache ??= {\n file,\n hydrated: true,\n options,\n highlighted: !massiveFile && !isFilePlainText(file),\n result: massiveFile ? undefined : cache?.result,\n // FIXME(amadeus): Add support for renderRanges\n renderRange: undefined,\n };\n if (\n !this.editSessionActive &&\n this.workerManager?.isWorkingPool() === true\n ) {\n if (this.renderCache.result == null && !massiveFile) {\n // We should only kick off a preload of the AST if we have a WorkerPool\n this.workerManager.highlightFileAST(this, file);\n }\n }\n // Lets attempt to get the highlighter/languages ready immediately\n else if (this.highlighter == null) {\n this.computedLang = file.lang ?? getFiletypeFromFileName(file.name);\n void this.initializeHighlighter();\n }\n }\n\n private getLocalHighlightTheme(): RenderFileOptions['theme'] {\n return (\n this.workerManager?.getFileRenderOptions().theme ??\n this.options.theme ??\n DEFAULT_THEMES\n );\n }\n\n public getEffectiveCodeOptions(): Pick<\n BaseCodeOptions,\n 'theme' | 'tokenizeMaxLineLength'\n > {\n const poolOptions =\n this.workerManager?.isWorkingPool() === true\n ? this.workerManager.getFileRenderOptions()\n : undefined;\n return {\n theme: this.getLocalHighlightTheme(),\n tokenizeMaxLineLength:\n poolOptions?.tokenizeMaxLineLength ??\n this.options.tokenizeMaxLineLength,\n };\n }\n\n private getRenderOptions(file: FileContents): GetRenderOptionsReturn {\n const options: RenderFileOptions = (() => {\n if (this.workerManager?.isWorkingPool() === true) {\n const poolOptions = this.workerManager.getFileRenderOptions();\n // Active edit sessions require `useTokenTransformer: true`\n if (\n this.editSessionActive &&\n poolOptions.useTokenTransformer !== true\n ) {\n return { ...poolOptions, useTokenTransformer: true };\n }\n return poolOptions;\n }\n const { tokenizeMaxLineLength = 1000 } = this.options;\n return {\n theme: this.getLocalHighlightTheme(),\n useTokenTransformer:\n this.editSessionActive || this.options.useTokenTransformer === true,\n tokenizeMaxLineLength,\n };\n })();\n const { renderCache } = this;\n if (renderCache?.result == null) {\n return { options, forceHighlight: true };\n }\n if (\n !areFileTargetsEqual(file, renderCache.file) ||\n !areFileRenderOptionsEqual(options, renderCache.options)\n ) {\n return { options, forceHighlight: true };\n }\n return { options, forceHighlight: false };\n }\n\n /**\n * Returns the file that the next synchronous render can commit without\n * changing the current render cache. Virtualized layouts use this to stay\n * aligned with the DOM while a replacement highlight is still pending.\n */\n public getFileForNextRender(file: FileContents): FileContents {\n const { options } = this.getRenderOptions(file);\n if (this.getReadyRenderResult(file, options) != null) {\n return file;\n }\n\n const { renderCache } = this;\n if (renderCache == null) {\n return file;\n }\n if (areFileTargetsEqual(renderCache.file, file)) {\n return renderCache.file;\n }\n\n const lines = linesFromFileContents(file.contents);\n const forcePlainText =\n file.contents.length === 0 ||\n isFilePlainText(file) ||\n isFileMassive(lines.length, this.getTokenizeMaxLength());\n\n return this.canRenderFile(file, options, forcePlainText)\n ? file\n : renderCache.file;\n }\n\n private canRenderFile(\n file: FileContents,\n options: RenderFileOptions,\n forcePlainText: boolean\n ): boolean {\n const { renderCache } = this;\n if (renderCache == null || areFileTargetsEqual(renderCache.file, file)) {\n return true;\n }\n if (forcePlainText) {\n return (\n (renderCache.result == null && renderCache.hydrated !== true) ||\n this.workerManager?.isWorkingPool() === true ||\n (this.highlighter != null && areThemesAttached(options.theme))\n );\n }\n // Hydration has highlighted DOM without a local AST. It is still active\n // rendered content and must remain visible while a non-plain replacement\n // is prepared.\n if (renderCache.result == null && renderCache.hydrated !== true) {\n return true;\n }\n\n if (\n !this.editSessionActive &&\n this.workerManager?.isWorkingPool() === true\n ) {\n return !renderCache.highlighted;\n }\n\n return this.highlighter != null && areThemesAttached(options.theme);\n }\n\n public getOrCreateLineCache(file: FileContents): string[] {\n let { lineCache } = this;\n if (lineCache == null || !isLineCacheForFile(lineCache, file)) {\n lineCache = {\n cacheKey: file.cacheKey,\n file,\n sourceContents: file.contents,\n lines: linesFromFileContents(file.contents),\n };\n }\n this.lineCache = lineCache;\n return lineCache.lines;\n }\n\n // when a emitLineCountChange is called,\n // calculate the line count using the cached text document\n public getLineCount(file: FileContents): number {\n const lines = this.getOrCreateLineCache(file);\n return this.textDocumentCache.get(file)?.lineCount ?? lines.length;\n }\n\n public updateRenderCache(\n dirtyLines: Map<number, Array<HighlightedToken>>,\n themeType: 'dark' | 'light',\n lineCountChangeInFlight = false\n ): void {\n this.pendingStructuralRows = undefined;\n const { renderCache } = this;\n if (renderCache == null) {\n return;\n }\n const { file, result } = renderCache;\n if (result == null) {\n return;\n }\n const pendingStructuralRows = lineCountChangeInFlight\n ? new Map<number, HASTElement>()\n : undefined;\n this.pendingStructuralRows = pendingStructuralRows;\n // Same-line edits can update the document cache immediately. Structural\n // rows use post-edit indexes, so hold them until applyDocumentChange has\n // shifted the old cache; writing now would overwrite rows that must move.\n const lineCache =\n this.lineCache != null && isLineCacheForFile(this.lineCache, file)\n ? this.lineCache\n : undefined;\n for (const [line, tokens] of dirtyLines) {\n if (\n pendingStructuralRows == null &&\n lineCache != null &&\n line < lineCache.lines.length\n ) {\n const lineText = tokens.map((token) => token[2]).join('');\n lineCache.lines[line] = applyLineTextWithNewline(\n lineCache.lines[line] ?? '',\n lineText\n );\n }\n const row: HASTElement = {\n type: 'element',\n tagName: 'div',\n properties: {\n 'data-line': line + 1,\n 'data-line-type': 'context',\n 'data-line-index': line,\n },\n children: tokens.map(([char, fg, text]) => {\n if (char === 0 && fg === '') {\n if (text === '') {\n return {\n type: 'element',\n tagName: 'br',\n properties: {},\n children: [],\n };\n }\n return { type: 'text', value: text };\n }\n return {\n type: 'element',\n tagName: 'span',\n properties: {\n 'data-char': char,\n style: `color:${fg};`,\n },\n children: [{ type: 'text', value: text }],\n };\n }),\n };\n if (pendingStructuralRows != null) {\n pendingStructuralRows.set(line, row);\n } else {\n result.code[line] = row;\n }\n }\n\n result.baseThemeType = themeType;\n renderCache.isDirty = true;\n if (pendingStructuralRows == null && lineCache != null) {\n file.contents = lineCache.lines.join('');\n lineCache.sourceContents = file.contents;\n }\n }\n\n // normally triggered by the host when the document line count changes\n public applyDocumentChange(\n textDocument: TextDocument<'file', LAnnotation>\n ): void {\n const { pendingStructuralRows, renderCache } = this;\n this.pendingStructuralRows = undefined;\n if (renderCache == null) {\n return;\n }\n const { file, result } = renderCache;\n // Without a result there is nothing to reconcile the document against, so\n // do not record it either: the document cache must never claim line\n // counts the (possibly still highlighting) result cannot back, or the\n // async highlight pass would process lines that do not exist.\n if (result == null) {\n return undefined;\n }\n // Structural edits renumber cached HAST rows. Keep the unchanged prefix\n // and suffix, and plain-fill only the window that still needs tokenizing.\n const previousLines =\n this.lineCache != null && isLineCacheForFile(this.lineCache, file)\n ? this.lineCache.lines\n : linesFromFileContents(file.contents);\n const nextLines = linesFromFileContents(textDocument.getText());\n if (previousLines.length !== nextLines.length) {\n const maxShared = Math.min(previousLines.length, nextLines.length);\n let prefix = 0;\n while (\n prefix < maxShared &&\n previousLines[prefix] === nextLines[prefix]\n ) {\n prefix++;\n }\n let suffix = 0;\n while (\n suffix < maxShared - prefix &&\n previousLines[previousLines.length - 1 - suffix] ===\n nextLines[nextLines.length - 1 - suffix]\n ) {\n suffix++;\n }\n\n const previousCode = result.code;\n result.code = new Array(nextLines.length);\n for (let i = 0; i < prefix; i++) {\n result.code[i] = previousCode[i];\n }\n for (let i = 0; i < suffix; i++) {\n result.code[nextLines.length - 1 - i] =\n previousCode[previousLines.length - 1 - i];\n }\n if (pendingStructuralRows !== undefined) {\n for (const [line, row] of pendingStructuralRows) {\n if (line < nextLines.length) {\n result.code[line] = row;\n }\n }\n }\n for (let i = prefix; i < nextLines.length - suffix; i++) {\n result.code[i] ??= {\n type: 'element',\n tagName: 'div',\n properties: {\n 'data-line': i + 1,\n 'data-line-type': 'context',\n 'data-line-index': i,\n },\n children: [\n {\n type: 'element',\n tagName: 'span',\n properties: {\n 'data-char': 0,\n },\n children: [\n {\n type: 'text',\n value: textDocument.getLineText(i),\n },\n ],\n },\n ],\n };\n }\n for (let i = 0; i < result.code.length; i++) {\n const line = result.code[i];\n if (line?.type === 'element') {\n line.properties['data-line'] = i + 1;\n line.properties['data-line-index'] = i;\n }\n }\n renderCache.isDirty = true;\n }\n // Replace the old split-line cache with the authoritative edited document.\n this.lineCache = {\n cacheKey: file.cacheKey,\n file,\n sourceContents: file.contents,\n lines: nextLines,\n };\n this.textDocumentCache.set(file, textDocument);\n file.contents = textDocument.getText();\n }\n\n public renderFile(\n file: FileContents | undefined = this.file,\n renderRange: RenderRange = DEFAULT_RENDER_RANGE\n ): FileRenderResult | undefined {\n this.file = file;\n if (file == null) {\n this.pendingHighlightResult = undefined;\n return undefined;\n }\n let { options, forceHighlight } = this.getRenderOptions(file);\n const readyResult = this.getReadyRenderResult(file, options);\n this.pendingHighlightResult = undefined;\n if (readyResult != null) {\n this.renderCache = {\n ...readyResult,\n file,\n renderRange: undefined,\n };\n forceHighlight = false;\n }\n this.renderCache ??= {\n file,\n highlighted: false,\n options,\n result: undefined,\n renderRange: undefined,\n };\n const lines = this.getOrCreateLineCache(file);\n const hasContent = file.contents.length > 0;\n const forcePlainText =\n !hasContent ||\n isFilePlainText(file) ||\n isFileMassive(lines.length, this.getTokenizeMaxLength());\n const canRenderFile = this.canRenderFile(file, options, forcePlainText);\n const newContent = !areFileTargetsEqual(file, this.renderCache.file);\n const newRenderRange = !areRenderRangesEqual(\n this.renderCache.renderRange,\n renderRange\n );\n if (\n !this.editSessionActive &&\n this.workerManager?.isWorkingPool() === true\n ) {\n // Hydration has highlighted DOM but no local AST. Keep that DOM until\n // its corresponding worker result is ready.\n const preserveHydratedContent =\n this.renderCache.result == null &&\n this.renderCache.highlighted &&\n !forcePlainText &&\n !newContent &&\n isDefaultRenderRange(renderRange);\n if (\n canRenderFile &&\n !preserveHydratedContent &&\n (forcePlainText ||\n this.renderCache.result == null ||\n (!this.renderCache.highlighted && (newContent || newRenderRange)))\n ) {\n this.renderCache.file = file;\n this.renderCache.options = options;\n this.renderCache.highlighted = false;\n if (\n this.renderCache.result == null ||\n newContent ||\n newRenderRange ||\n forceHighlight\n ) {\n this.renderCache.result = this.workerManager.getPlainFileAST(\n file,\n renderRange.startingLine,\n renderRange.totalLines,\n lines\n );\n }\n this.renderCache.renderRange = renderRange;\n }\n\n if (\n !forcePlainText &&\n hasContent &&\n (!this.renderCache.highlighted || forceHighlight)\n ) {\n this.workerManager.highlightFileAST(this, file);\n }\n } else {\n this.computedLang = file.lang ?? getFiletypeFromFileName(file.name);\n this.highlighter ??= getHighlighterIfLoaded();\n const hasThemes =\n this.highlighter != null && areThemesAttached(options.theme);\n const hasLangs =\n this.highlighter != null && areLanguagesAttached(this.computedLang);\n const canHighlight = !forcePlainText && hasLangs;\n\n // If we have any semblance of a highlighter with the correct theme(s)\n // attached, we can kick off some form of rendering. If we don't have\n // the correct language, then we can render plain text and after kick off\n // an async job to get the highlighted AST\n if (\n canRenderFile &&\n this.highlighter != null &&\n hasThemes &&\n (forceHighlight ||\n forcePlainText ||\n (!this.renderCache.highlighted && canHighlight) ||\n this.renderCache.result == null)\n ) {\n const { result, options } = this.renderFileWithHighlighter(\n file,\n this.highlighter,\n forcePlainText || !hasLangs\n );\n this.renderCache = {\n file,\n options,\n highlighted: canHighlight,\n result,\n renderRange: undefined,\n };\n }\n\n // If we get in here it means we'll have to kick off an async highlight\n // process which will involve initializing the highlighter with new themes\n // and languages\n if (!hasThemes || (!forcePlainText && !hasLangs)) {\n void this.asyncHighlight(file).then(({ result, options }) => {\n this.applyHighlightResult(file, result, options, !forcePlainText);\n });\n }\n }\n\n return this.renderCache.result != null\n ? this.processFileResult(\n this.renderCache.file,\n renderRange,\n this.renderCache.result\n )\n : undefined;\n }\n\n async asyncRender(\n file: FileContents,\n renderRange: RenderRange = DEFAULT_RENDER_RANGE\n ): Promise<FileRenderResult> {\n this.file = file;\n const { result } = await this.asyncHighlight(file);\n return this.processFileResult(file, renderRange, result);\n }\n\n private async asyncHighlight(file: FileContents): Promise<RenderFileResult> {\n const lines = this.getOrCreateLineCache(file);\n const forcePlainText = isFileMassive(\n lines.length,\n this.getTokenizeMaxLength()\n );\n this.computedLang = forcePlainText\n ? 'text'\n : (file.lang ?? getFiletypeFromFileName(file.name));\n const hasThemes =\n this.highlighter != null &&\n hasResolvedThemes(getThemes(this.getLocalHighlightTheme()));\n const hasLangs =\n forcePlainText ||\n (this.highlighter != null && areLanguagesAttached(this.computedLang));\n // If we don't have the required langs or themes, then we need to\n // initialize the highlighter to load the appropriate languages and themes\n if (this.highlighter == null || !hasThemes || !hasLangs) {\n this.highlighter = await this.initializeHighlighter();\n }\n return this.renderFileWithHighlighter(\n file,\n this.highlighter,\n forcePlainText\n );\n }\n\n private renderFileWithHighlighter(\n file: FileContents,\n highlighter: DiffsHighlighter,\n forcePlainText = false\n ): RenderFileResult {\n const { options } = this.getRenderOptions(file);\n const result = renderFileWithHighlighter(file, highlighter, options, {\n forcePlainText,\n });\n return { result, options };\n }\n\n private processFileResult(\n file: FileContents,\n renderRange: RenderRange,\n { code, themeStyles, baseThemeType }: ThemedFileResult\n ): FileRenderResult {\n const totalLines = this.getLineCount(file);\n const { disableFileHeader = false } = this.options;\n const contentArray: ElementContent[] = [];\n const gutter = createGutterWrapper();\n const endLine = Math.min(\n renderRange.startingLine + renderRange.totalLines,\n totalLines\n );\n let rowCount = 0;\n\n const fileLevelAnnotations = shouldRenderFileAnnotations(renderRange)\n ? getFileAnnotations(this.lineAnnotations)\n : undefined;\n if (fileLevelAnnotations != null) {\n gutter.children.push(createGutterGap('context', 'annotation', 1));\n contentArray.push(\n createAnnotationElement({\n type: 'annotation',\n hunkIndex: FILE_ANNOTATION_HUNK_INDEX,\n lineIndex: FILE_ANNOTATION_LINE_INDEX,\n annotations: fileLevelAnnotations.map((annotation) =>\n this.annotationSlotName(annotation)\n ),\n })\n );\n rowCount++;\n }\n\n for (\n let lineIndex = renderRange.startingLine;\n lineIndex < endLine;\n lineIndex++\n ) {\n const lineNumber = lineIndex + 1;\n\n // Sparse array - directly indexed by lineIndex\n const line = code[lineIndex];\n if (line == null) {\n const message = 'FileRenderer.processFileResult: Line doesnt exist';\n console.error(message, {\n name: file.name,\n lineIndex,\n lineNumber,\n });\n throw new Error(message);\n }\n\n // Add gutter line number\n gutter.children.push(\n createGutterItem('context', lineNumber, `${lineIndex}`)\n );\n contentArray.push(line);\n rowCount++;\n\n // Check annotations using ACTUAL line number from file\n const annotations = this.lineAnnotations[lineNumber];\n if (annotations != null) {\n gutter.children.push(createGutterGap('context', 'annotation', 1));\n contentArray.push(\n createAnnotationElement({\n type: 'annotation',\n hunkIndex: 0,\n lineIndex: lineNumber,\n annotations: annotations.map((annotation) =>\n this.annotationSlotName(annotation)\n ),\n })\n );\n rowCount++;\n }\n }\n\n // Finalize: wrap gutter and content\n gutter.properties.style = `grid-row: span ${rowCount}`;\n return {\n file,\n gutterAST: gutter.children ?? [],\n contentAST: contentArray,\n preAST: this.createPreElement(totalLines),\n headerAST: !disableFileHeader ? this.renderHeader(file) : undefined,\n totalLines: totalLines,\n rowCount,\n themeStyles: themeStyles,\n baseThemeType,\n bufferBefore: renderRange.bufferBefore,\n bufferAfter: renderRange.bufferAfter,\n css: '',\n };\n }\n\n private renderHeader(file: FileContents) {\n const { headerRenderMode = 'default', stickyHeader = false } = this.options;\n return createFileHeaderElement({\n fileOrDiff: file,\n mode: headerRenderMode,\n stickyHeader,\n });\n }\n\n public renderFullHTML(result: FileRenderResult): string {\n return toHtml(this.renderFullAST(result));\n }\n\n public renderFullAST(\n result: FileRenderResult,\n children: ElementContent[] = []\n ): HASTElement {\n children.push(\n createHastElement({\n tagName: 'code',\n children: this.renderCodeAST(result),\n properties: { 'data-code': '' },\n })\n );\n return { ...result.preAST, children };\n }\n\n public renderCodeAST(result: FileRenderResult): ElementContent[] {\n const gutter = createGutterWrapper();\n gutter.children = result.gutterAST;\n gutter.properties.style = `grid-row: span ${result.rowCount}`;\n const contentColumn = createContentColumn(\n result.contentAST,\n result.rowCount\n );\n return [gutter, contentColumn];\n }\n\n public renderPartialHTML(\n children: ElementContent[],\n includeCodeNode: boolean = false\n ): string {\n if (!includeCodeNode) {\n return toHtml(children);\n }\n return toHtml(\n createHastElement({\n tagName: 'code',\n children,\n properties: { 'data-code': '' },\n })\n );\n }\n\n public async initializeHighlighter(): Promise<DiffsHighlighter> {\n this.highlighter = await getSharedHighlighter(\n getHighlighterOptions(this.computedLang, {\n theme: this.getLocalHighlightTheme(),\n preferredHighlighter:\n this.workerManager?.getPreferredHighlighter() ??\n this.options.preferredHighlighter,\n })\n );\n return this.highlighter;\n }\n\n public onHighlightSuccess(\n file: FileContents,\n result: ThemedFileResult,\n options: RenderFileOptions,\n highlighted = true\n ): void {\n if (this.editSessionActive) {\n return;\n }\n this.applyHighlightResult(file, result, options, highlighted);\n }\n\n private applyHighlightResult(\n file: FileContents,\n result: ThemedFileResult,\n options: RenderFileOptions,\n highlighted = true\n ): void {\n const { file: currentFile, renderCache } = this;\n if (\n currentFile == null ||\n renderCache == null ||\n !areFileTargetsEqual(file, currentFile) ||\n !areFileRenderOptionsEqual(\n options,\n this.getRenderOptions(currentFile).options\n )\n ) {\n return;\n }\n\n const triggerRender =\n renderCache.result == null ||\n !renderCache.highlighted ||\n !areFileRenderOptionsEqual(renderCache.options, options) ||\n !areFileTargetsEqual(renderCache.file, currentFile);\n if (!triggerRender) {\n return;\n }\n\n this.pendingHighlightResult = {\n file: currentFile,\n options,\n highlighted,\n result,\n };\n this.onRenderUpdate?.();\n }\n\n private getMatchingWorkerResultCache(\n file: FileContents,\n options: RenderFileOptions\n ): RenderFileResult | undefined {\n if (this.editSessionActive) {\n return undefined;\n }\n const cache = this.workerManager?.getFileResultCache(file);\n if (cache == null || !areFileRenderOptionsEqual(options, cache.options)) {\n return undefined;\n }\n return cache;\n }\n\n // Returns completed background work that can replace the rendered AST on\n // the next render. Reading it does not promote or discard pending work.\n private getReadyRenderResult(\n file: FileContents,\n options: RenderFileOptions\n ): PendingHighlightResult | undefined {\n const { pendingHighlightResult } = this;\n if (\n pendingHighlightResult != null &&\n areFileTargetsEqual(pendingHighlightResult.file, file) &&\n areFileRenderOptionsEqual(pendingHighlightResult.options, options)\n ) {\n return pendingHighlightResult;\n }\n\n const workerCache = this.getMatchingWorkerResultCache(file, options);\n if (workerCache == null || this.hasHighlightedRenderCache(file, options)) {\n return undefined;\n }\n return { file, highlighted: true, ...workerCache };\n }\n\n private hasHighlightedRenderCache(\n file: FileContents,\n options: RenderFileOptions\n ): boolean {\n const { renderCache } = this;\n return (\n renderCache?.result != null &&\n renderCache.highlighted &&\n areFileTargetsEqual(file, renderCache.file) &&\n areFileRenderOptionsEqual(options, renderCache.options)\n );\n }\n\n public onHighlightError(error: unknown): void {\n console.error(error);\n }\n\n private getTokenizeMaxLength(): number {\n return this.options.tokenizeMaxLength ?? DEFAULT_TOKENIZE_MAX_LENGTH;\n }\n\n private createPreElement(totalLines: number): HASTElement {\n const { disableLineNumbers = false, overflow = 'scroll' } = this.options;\n return createPreElement({\n type: 'file',\n diffIndicators: 'none',\n disableBackground: true,\n disableLineNumbers,\n overflow,\n split: false,\n totalLines,\n });\n }\n}\n\nfunction isFileMassive(lineCount: number, tokenizeMaxLength: number): boolean {\n return lineCount > tokenizeMaxLength;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAyGA,SAAS,mBAAmB,WAAsB,MAA6B;CAC7E,OAAO,KAAK,YAAY,OACpB,UAAU,SAAS,QAAQ,UAAU,mBAAmB,KAAK,WAC7D,UAAU,aAAa,KAAK;AAClC;AAMA,IAAI,aAAa;AAEjB,IAAa,eAAb,MAAmD;CAmCxC;CACC;CAGA;CACA;CAvCV,OAAwB,iBAAiB,EAAE;CAE3C;CAIA;CAEA;CAGA;CAEA,eAA2C;CAC3C,kBAA0D,CAAC;CAC3D;CACA;CACA,oCAA4B,IAAI,QAG9B;CAOF,oBAA4B;CAE5B,IAAW,YAAsC;EAC/C,OAAO,KAAK,aAAa;CAC3B;CAEA,YACE,UAAsC,EAAE,OAAO,eAAe,GAC9D,qBAEc,uBACd,gBACA,eACA;EANO,KAAA,UAAA;EACC,KAAA,qBAAA;EAGA,KAAA,iBAAA;EACA,KAAA,gBAAA;EAER,IAAI,eAAe,cAAc,MAAM,MACrC,KAAK,cAAc,kBAAkB,QAAQ,SAAS,cAAc,IAChE,uBAAuB,IACvB,KAAA;CAER;CAEA,WAAkB,SAAoC;EACpD,K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EACzD,IAAI,SAAS,QAAQ,CAAC,0BAA0B,SAAS,MAAM,OAAO,GACpE;EAEF,OAAO;CACT;CAIA,qBACE,MACA,SACoC;EACpC,MAAM,EAAE,2BAA2B;EACnC,IACE,0BAA0B,QAC1B,oBAAoB,uBAAuB,MAAM,IAAI,KACrD,0BAA0B,uBAAuB,SAAS,OAAO,GAEjE,OAAO;EAGT,MAAM,cAAc,KAAK,6BAA6B,MAAM,OAAO;EACnE,IAAI,eAAe,QAAQ,KAAK,0BAA0B,MAAM,OAAO,GACrE;EAEF,OAAO;GAAE;GAAM,aAAa;GAAM,GAAG;EAAY;CACnD;CAEA,0BACE,MACA,SACS;EACT,MAAM,EAAE,gBAAgB;EACxB,OACE,aAAa,UAAU,QACvB,YAAY,eACZ,oBAAoB,MAAM,YAAY,IAAI,KAC1C,0BAA0B,SAAS,YAAY,OAAO;CAE1D;CAEA,iBAAwB,OAAsB;EAC5C,QAAQ,MAAM,KAAK;CACrB;CAEA,uBAAuC;EACrC,OAAO,KAAK,QAAQ,qBAAA;CACtB;CAEA,iBAAyB,YAAiC;EACxD,MAAM,EAAE,qBAAqB,OAAO,WAAW,aAAa,KAAK;EACjE,OAAO,iBAAiB;GACtB,MAAM;GACN,gBAAgB;GAChB,mBAAmB;GACnB;GACA;GACA,OAAO;GACP;EACF,CAAC;CACH;AACF;AAEA,SAAS,cAAc,WAAmB,mBAAoC;CAC5E,OAAO,YAAY;AACrB"}
@@ -1,9 +1,9 @@
1
1
  import { Element } from "../node_modules/.pnpm/@types_hast@3.0.4/node_modules/@types/hast/index.js";
2
2
  import { DiffLineAnnotation, FileDiffMetadata, MergeConflictMarkerRow, RenderRange } from "../types.js";
3
3
  import { WorkerPoolManager } from "../worker/WorkerPoolManager.js";
4
+ import "../worker/index.js";
4
5
  import { DiffHunksRenderer, DiffHunksRendererOptions, DiffHunksRendererOptionsWithDefaults, HunksRenderResult, LineDecoration, RenderedLineContext, SplitLineDecorationProps, UnifiedInjectedRowPlacement, UnifiedLineDecorationProps } from "./DiffHunksRenderer.js";
5
6
  import { MergeConflictDiffAction } from "../utils/parseMergeConflictDiffFromFile.js";
6
-
7
7
  //#region src/renderers/UnresolvedFileHunksRenderer.d.ts
8
8
  interface BaseUnresolvedOptionsWithDefaults extends DiffHunksRendererOptionsWithDefaults {
9
9
  mergeConflictActionsType: MergeConflictActionsType;
@@ -24,14 +24,8 @@ declare class UnresolvedFileHunksRenderer<LAnnotation = undefined> extends DiffH
24
24
  renderDiff(diff?: FileDiffMetadata | undefined, renderRange?: RenderRange): HunksRenderResult | undefined;
25
25
  asyncRender(diff: FileDiffMetadata, renderRange?: RenderRange): Promise<HunksRenderResult>;
26
26
  protected createPreElement(split: boolean, totalLines: number): Element;
27
- protected getUnifiedLineDecoration({
28
- type,
29
- lineType
30
- }: UnifiedLineDecorationProps): LineDecoration;
31
- protected getSplitLineDecoration({
32
- side,
33
- type
34
- }: SplitLineDecorationProps): LineDecoration;
27
+ protected getUnifiedLineDecoration({ type, lineType }: UnifiedLineDecorationProps): LineDecoration;
28
+ protected getSplitLineDecoration({ side, type }: SplitLineDecorationProps): LineDecoration;
35
29
  protected getUnifiedInjectedRowsForLine: (ctx: RenderedLineContext) => UnifiedInjectedRowPlacement | undefined;
36
30
  protected getOptionsWithDefaults(): BaseUnresolvedOptionsWithDefaults;
37
31
  }
@@ -1 +1 @@
1
- {"version":3,"file":"UnresolvedFileHunksRenderer.d.ts","names":[],"sources":["../../src/renderers/UnresolvedFileHunksRenderer.ts"],"mappings":";;;;;;;UA+DU,iCAAA,SAA0C,oCAAoC;EACtF,wBAAA,EAA0B,wBAAA;AAAA;AAAA,KAGvB,wBAAA;AAAA,UAEY,kCAAA,SAA2C,wBAAwB;EAClF,wBAAA,GAA2B,wBAAA;AAAA;AAAA,cAGhB,2BAAA,kCAEH,iBAAA,CAAkB,WAAA;EAAA,QAClB,sBAAA;EAAA,QACA,iBAAA;EAAA,QACA,YAAA;EACQ,OAAA,EAAS,kCAAA;EAEzB,WAAA,CACE,OAAA,GAAS,kCAAA,EAGT,kBAAA,IACE,UAAA,EAAY,kBAAA,CAAmB,WAAA,cAEjC,cAAA,kBACA,aAAA,GAAgB,iBAAA;EAWX,gBAAA,CACL,eAAA,GAAkB,uBAAA,iBAClB,UAAA,EAAY,sBAAA,IACZ,IAAA,EAAM,gBAAA;EAAA,QAOA,gBAAA;EAAA,QA0BA,cAAA;EAUQ,UAAA,CACd,IAAA,GAAO,gBAAA,cACP,WAAA,GAAa,WAAA,GACZ,iBAAA;EAWmB,WAAA,CACpB,IAAA,EAAM,gBAAA,EACN,WAAA,GAAa,WAAA,GACZ,OAAA,CAAQ,iBAAA;EAAA,UASQ,gBAAA,CACjB,KAAA,WACA,UAAA,WACC,OAAA;EAAA,UAMgB,wBAAA;IACjB,IAAA;IACA;EAAA,GACC,0BAAA,GAA6B,cAAA;EAAA,UAiBb,sBAAA;IACjB,IAAA;IACA;EAAA,GACC,wBAAA,GAA2B,cAAA;EAAA,UAiBX,6BAAA,GAA6B,GAAA,EACzC,mBAAA,KACJ,2BAAA;EAAA,UAgCgB,sBAAA,IAA0B,iCAAA;AAAA"}
1
+ {"version":3,"file":"UnresolvedFileHunksRenderer.d.ts","names":[],"sources":["../../src/renderers/UnresolvedFileHunksRenderer.ts"],"mappings":";;;;;;;UA+DU,0CAA0C;EAClD,0BAA0B;;KAGvB;UAEY,2CAA2C;EAC1D,2BAA2B;;cAGhB,4BACX,iCACQ,kBAAkB;UAClB;UACA;UACA;EACQ,SAAS;EAEzB,YACE,UAAS,oCAGT,sBACE,YAAY,mBAAmB,yBAEjC,gCACA,gBAAgB;EAWX,iBACL,kBAAkB,wCAClB,YAAY,0BACZ,MAAM;UAOA;UA0BA;EAUQ,WACd,OAAO,8BACP,cAAa,cACZ;EAWmB,YACpB,MAAM,kBACN,cAAa,cACZ,QAAQ;YASQ,iBACjB,gBACA,qBACC;YAMgB,2BACjB,MACA,YACC,6BAA6B;YAiBb,yBACjB,MACA,QACC,2BAA2B;YAiBX,gCAA6B,KACzC,wBACJ;YAgCgB,0BAA0B"}
@@ -1,7 +1,6 @@
1
1
  import { CodeToTokenTransformStreamOptions, RecallToken } from "./types.js";
2
2
  import { ShikiStreamTokenizer } from "./tokenizer.js";
3
3
  import { ThemedToken } from "shiki/core";
4
-
5
4
  //#region src/shiki-stream/stream.d.ts
6
5
  /**
7
6
  * Create a transform stream that takes code chunks and emits themed tokens.
@@ -1 +1 @@
1
- {"version":3,"file":"stream.d.ts","names":[],"sources":["../../src/shiki-stream/stream.ts"],"mappings":";;;;;;;AAQA;cAAa,0BAAA,SAAmC,eAAA,SAE9C,WAAA,GAAc,WAAA;EAAA,SAEL,SAAA,EAAW,oBAAA;EAAA,SACX,OAAA,EAAS,iCAAA;EAElB,WAAA,CAAY,OAAA,EAAS,iCAAA;AAAA"}
1
+ {"version":3,"file":"stream.d.ts","names":[],"sources":["../../src/shiki-stream/stream.ts"],"mappings":";;;;;;;cAQa,mCAAmC,wBAE9C,cAAc;WAEL,WAAW;WACX,SAAS;EAElB,YAAY,SAAS"}
@@ -1 +1 @@
1
- {"version":3,"file":"stream.js","names":[],"sources":["../../src/shiki-stream/stream.ts"],"sourcesContent":["import type { ThemedToken } from 'shiki/core';\n\nimport { ShikiStreamTokenizer } from './tokenizer';\nimport type { CodeToTokenTransformStreamOptions, RecallToken } from './types';\n\n/**\n * Create a transform stream that takes code chunks and emits themed tokens.\n */\nexport class CodeToTokenTransformStream extends TransformStream<\n string,\n ThemedToken | RecallToken\n> {\n readonly tokenizer: ShikiStreamTokenizer;\n readonly options: CodeToTokenTransformStreamOptions;\n\n constructor(options: CodeToTokenTransformStreamOptions) {\n const tokenizer = new ShikiStreamTokenizer(options);\n const { allowRecalls = false } = options;\n\n super({\n async transform(chunk, controller) {\n const {\n stable,\n unstable: buffer,\n recall,\n } = await tokenizer.enqueue(chunk);\n if (allowRecalls && recall > 0) {\n // oxlint-disable-next-line typescript/no-explicit-any\n controller.enqueue({ recall } as any);\n }\n for (const token of stable) {\n controller.enqueue(token);\n }\n if (allowRecalls) {\n for (const token of buffer) {\n controller.enqueue(token);\n }\n }\n },\n // oxlint-disable-next-line typescript/require-await\n async flush(controller) {\n const { stable } = tokenizer.close();\n // if allow recalls, the tokens should already be sent\n if (!allowRecalls) {\n for (const token of stable) {\n controller.enqueue(token);\n }\n }\n },\n });\n\n this.tokenizer = tokenizer;\n this.options = options;\n }\n}\n"],"mappings":";;;;;AAQA,IAAa,6BAAb,cAAgD,gBAG9C;CACA;CACA;CAEA,YAAY,SAA4C;EACtD,MAAM,YAAY,IAAI,qBAAqB,OAAO;EAClD,MAAM,EAAE,eAAe,UAAU;EAEjC,MAAM;GACJ,MAAM,UAAU,OAAO,YAAY;IACjC,MAAM,EACJ,QACA,UAAU,QACV,WACE,MAAM,UAAU,QAAQ,KAAK;IACjC,IAAI,gBAAgB,SAAS,GAE3B,WAAW,QAAQ,EAAE,OAAO,CAAQ;IAEtC,KAAK,MAAM,SAAS,QAClB,WAAW,QAAQ,KAAK;IAE1B,IAAI,cACF,KAAK,MAAM,SAAS,QAClB,WAAW,QAAQ,KAAK;GAG9B;GAEA,MAAM,MAAM,YAAY;IACtB,MAAM,EAAE,WAAW,UAAU,MAAM;IAEnC,IAAI,CAAC,cACH,KAAK,MAAM,SAAS,QAClB,WAAW,QAAQ,KAAK;GAG9B;EACF,CAAC;EAED,KAAK,YAAY;EACjB,KAAK,UAAU;CACjB;AACF"}
1
+ {"version":3,"file":"stream.js","names":[],"sources":["../../src/shiki-stream/stream.ts"],"sourcesContent":["import type { ThemedToken } from 'shiki/core';\n\nimport { ShikiStreamTokenizer } from './tokenizer';\nimport type { CodeToTokenTransformStreamOptions, RecallToken } from './types';\n\n/**\n * Create a transform stream that takes code chunks and emits themed tokens.\n */\nexport class CodeToTokenTransformStream extends TransformStream<\n string,\n ThemedToken | RecallToken\n> {\n readonly tokenizer: ShikiStreamTokenizer;\n readonly options: CodeToTokenTransformStreamOptions;\n\n constructor(options: CodeToTokenTransformStreamOptions) {\n const tokenizer = new ShikiStreamTokenizer(options);\n const { allowRecalls = false } = options;\n\n super({\n async transform(chunk, controller) {\n const {\n stable,\n unstable: buffer,\n recall,\n } = await tokenizer.enqueue(chunk);\n if (allowRecalls && recall > 0) {\n controller.enqueue({ recall });\n }\n for (const token of stable) {\n controller.enqueue(token);\n }\n if (allowRecalls) {\n for (const token of buffer) {\n controller.enqueue(token);\n }\n }\n },\n // oxlint-disable-next-line typescript/require-await\n async flush(controller) {\n const { stable } = tokenizer.close();\n // if allow recalls, the tokens should already be sent\n if (!allowRecalls) {\n for (const token of stable) {\n controller.enqueue(token);\n }\n }\n },\n });\n\n this.tokenizer = tokenizer;\n this.options = options;\n }\n}\n"],"mappings":";;;;;AAQA,IAAa,6BAAb,cAAgD,gBAG9C;CACA;CACA;CAEA,YAAY,SAA4C;EACtD,MAAM,YAAY,IAAI,qBAAqB,OAAO;EAClD,MAAM,EAAE,eAAe,UAAU;EAEjC,MAAM;GACJ,MAAM,UAAU,OAAO,YAAY;IACjC,MAAM,EACJ,QACA,UAAU,QACV,WACE,MAAM,UAAU,QAAQ,KAAK;IACjC,IAAI,gBAAgB,SAAS,GAC3B,WAAW,QAAQ,EAAE,OAAO,CAAC;IAE/B,KAAK,MAAM,SAAS,QAClB,WAAW,QAAQ,KAAK;IAE1B,IAAI,cACF,KAAK,MAAM,SAAS,QAClB,WAAW,QAAQ,KAAK;GAG9B;GAEA,MAAM,MAAM,YAAY;IACtB,MAAM,EAAE,WAAW,UAAU,MAAM;IAEnC,IAAI,CAAC,cACH,KAAK,MAAM,SAAS,QAClB,WAAW,QAAQ,KAAK;GAG9B;EACF,CAAC;EAED,KAAK,YAAY;EACjB,KAAK,UAAU;CACjB;AACF"}
@@ -1,6 +1,5 @@
1
1
  import { ShikiStreamTokenizerEnqueueResult, ShikiStreamTokenizerOptions } from "./types.js";
2
2
  import { GrammarState, ThemedToken } from "shiki/core";
3
-
4
3
  //#region src/shiki-stream/tokenizer.d.ts
5
4
  declare class ShikiStreamTokenizer {
6
5
  readonly options: ShikiStreamTokenizerOptions;
@@ -1 +1 @@
1
- {"version":3,"file":"tokenizer.d.ts","names":[],"sources":["../../src/shiki-stream/tokenizer.ts"],"mappings":";;;;cAQa,oBAAA;EAAA,SACK,OAAA,EAAS,2BAAA;EAElB,YAAA,EAAc,WAAA;EACd,cAAA,EAAgB,WAAA;EAEhB,qBAAA;EACA,sBAAA,EAAwB,YAAA;EAE/B,WAAA,CAAY,OAAA,EAAS,2BAAA;EALE;;;EAajB,OAAA,CAAQ,KAAA,WAAgB,OAAA,CAAQ,iCAAA;EAoCtC,KAAA;IAAW,MAAA,EAAQ,WAAA;EAAA;EAUnB,KAAA;EAOA,KAAA,IAAS,oBAAA;AAAA"}
1
+ {"version":3,"file":"tokenizer.d.ts","names":[],"sources":["../../src/shiki-stream/tokenizer.ts"],"mappings":";;;cAQa;WACK,SAAS;EAElB,cAAc;EACd,gBAAgB;EAEhB;EACA,wBAAwB;EAE/B,YAAY,SAAS;;;;EAQf,QAAQ,gBAAgB,QAAQ;EAoCtC;IAAW,QAAQ;;EAUnB;EAOA,SAAS"}
@@ -1,5 +1,4 @@
1
1
  import { CodeToTokensOptions, HighlighterCore, HighlighterGeneric, ThemedToken } from "shiki/core";
2
-
3
2
  //#region src/shiki-stream/types.d.ts
4
3
  /**
5
4
  * A special token that indicates the number of tokens to be removed from the previous streamed tokens.
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","names":[],"sources":["../../src/shiki-stream/types.ts"],"mappings":";;;;;AAYA;;;UAAiB,WAAA;EAIT;AAGR;;EAHE,MAAM;AAAA;AAAA,KAGI,iCAAA,GAAoC,2BAA2B;EAW/D;;;;;;;EAHV,YAAY;AAAA;AAAA,KAGF,2BAAA,GAA8B,mBAAA;EAKxC,WAAA,EAAa,eAAA,GAAkB,kBAAA;AAAA;AAAA,UAGhB,iCAAA;EAHkC;AAGnD;;EAIE,MAAA;EAQqB;;;EAJrB,MAAA,EAAQ,WAAA;EAIR;;;EAAA,QAAA,EAAU,WAAW;AAAA"}
1
+ {"version":3,"file":"types.d.ts","names":[],"sources":["../../src/shiki-stream/types.ts"],"mappings":";;;;;;;UAYiB;;;;EAIf;;KAGU,oCAAoC;;;;;;;;EAQ9C;;KAGU,8BAA8B;EAKxC,aAAa,kBAAkB;;UAGhB;;;;EAIf;;;;EAIA,QAAQ;;;;EAIR,UAAU"}
@@ -1 +1 @@
1
- {"version":3,"file":"sprite.d.ts","names":[],"sources":["../src/sprite.ts"],"mappings":";KAAY,cAAA;AAAA,cAmBC,cAAA"}
1
+ {"version":3,"file":"sprite.d.ts","names":[],"sources":["../src/sprite.ts"],"mappings":";KAAY;cAmBC"}
@@ -1,6 +1,5 @@
1
1
  import { DiffLineAnnotation } from "../types.js";
2
2
  import { CSSProperties, ReactNode } from "react";
3
-
4
3
  //#region src/ssr/FileDiffReact.d.ts
5
4
  interface FileDiffSsrProps<LAnnotation> {
6
5
  prerenderedHTML: string;
@@ -9,13 +8,7 @@ interface FileDiffSsrProps<LAnnotation> {
9
8
  className?: string;
10
9
  style?: CSSProperties;
11
10
  }
12
- declare function FileDiffSSR<LAnnotation>({
13
- prerenderedHTML,
14
- annotations,
15
- className,
16
- style,
17
- renderAnnotation
18
- }: FileDiffSsrProps<LAnnotation>): React.JSX.Element;
11
+ declare function FileDiffSSR<LAnnotation>({ prerenderedHTML, annotations, className, style, renderAnnotation }: FileDiffSsrProps<LAnnotation>): React.JSX.Element;
19
12
  //#endregion
20
13
  export { FileDiffSSR };
21
14
  //# sourceMappingURL=FileDiffReact.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"FileDiffReact.d.ts","names":[],"sources":["../../src/ssr/FileDiffReact.tsx"],"mappings":";;;;UAUU,gBAAA;EACR,eAAA;EACA,WAAA,GAAc,kBAAA,CAAmB,WAAA;EACjC,gBAAA,EAAkB,WAAA,EAAa,kBAAA,CAAmB,WAAA,IAAe,SAAA;EACjE,SAAA;EACA,KAAA,GAAQ,aAAA;AAAA;AAAA,iBAuBM,WAAA;EACd,eAAA;EACA,WAAA;EACA,SAAA;EACA,KAAA;EACA;AAAA,GACC,gBAAA,CAAiB,WAAA,IAAe,KAAA,CAAM,GAAA,CAAI,OAAA"}
1
+ {"version":3,"file":"FileDiffReact.d.ts","names":[],"sources":["../../src/ssr/FileDiffReact.tsx"],"mappings":";;;UAUU,iBAAiB;EACzB;EACA,cAAc,mBAAmB;EACjC,kBAAkB,aAAa,mBAAmB,eAAe;EACjE;EACA,QAAQ;;iBAuBM,YAAY,eAC1B,iBACA,aACA,WACA,OACA,oBACC,iBAAiB,eAAe,MAAM,IAAI"}
@@ -18,9 +18,14 @@ function FileDiffSSR({ prerenderedHTML, annotations, className, style, renderAnn
18
18
  const wrapperRef = useRef(null);
19
19
  const hydratedRef = useRef(false);
20
20
  const htmlObjectRef = useRef(null);
21
- if (htmlObjectRef.current === null) htmlObjectRef.current = { __html: `<${DIFFS_TAG_NAME}${className !== void 0 ? ` class="${escapeHtml(className)}"` : ""}${style !== void 0 ? ` style="${serializeStyle(style)}"` : ""}><template shadowrootmode="open">${prerenderedHTML}</template>${annotations !== void 0 && annotations.length > 0 && renderAnnotation != null ? annotations.map((annotation) => {
22
- return `<div slot="${getLineAnnotationName(annotation)}">${renderToString(renderAnnotation(annotation))}</div>`;
23
- }).join("") : ""}</${DIFFS_TAG_NAME}>` };
21
+ if (htmlObjectRef.current === null) {
22
+ const classAttr = className !== void 0 ? ` class="${escapeHtml(className)}"` : "";
23
+ const styleAttr = style !== void 0 ? ` style="${serializeStyle(style)}"` : "";
24
+ const annotationSlots = annotations !== void 0 && annotations.length > 0 && renderAnnotation != null ? annotations.map((annotation) => {
25
+ return `<div slot="${getLineAnnotationName(annotation)}">${renderToString(renderAnnotation(annotation))}</div>`;
26
+ }).join("") : "";
27
+ htmlObjectRef.current = { __html: `<${DIFFS_TAG_NAME}${classAttr}${styleAttr}><template shadowrootmode="open">${prerenderedHTML}</template>${annotationSlots}</${DIFFS_TAG_NAME}>` };
28
+ }
24
29
  useEffect(() => {
25
30
  if (wrapperRef.current !== null && annotations !== void 0 && !hydratedRef.current) {
26
31
  const fileElement = wrapperRef.current.querySelector(DIFFS_TAG_NAME);
@@ -1 +1 @@
1
- {"version":3,"file":"FileDiffReact.js","names":[],"sources":["../../src/ssr/FileDiffReact.tsx"],"sourcesContent":["'use client';\n\nimport { type CSSProperties, type ReactNode, useEffect, useRef } from 'react';\nimport { hydrateRoot } from 'react-dom/client';\nimport { renderToString } from 'react-dom/server';\n\nimport { DIFFS_TAG_NAME } from '../constants';\nimport type { DiffLineAnnotation } from '../types';\nimport { getLineAnnotationName } from '../utils/getLineAnnotationName';\n\ninterface FileDiffSsrProps<LAnnotation> {\n prerenderedHTML: string;\n annotations?: DiffLineAnnotation<LAnnotation>[];\n renderAnnotation?(annotations: DiffLineAnnotation<LAnnotation>): ReactNode;\n className?: string;\n style?: CSSProperties;\n}\n\nfunction escapeHtml(unsafe: string): string {\n return unsafe\n .replace(/&/g, '&amp;')\n .replace(/</g, '&lt;')\n .replace(/>/g, '&gt;')\n .replace(/\"/g, '&quot;')\n .replace(/'/g, '&#039;');\n}\n\nfunction serializeStyle(style: CSSProperties): string {\n return Object.entries(style)\n .map(([key, value]) => {\n // Convert camelCase to kebab-case\n const kebabKey = key.replace(/([A-Z])/g, '-$1').toLowerCase();\n // Escape the value for safety\n return `${kebabKey}:${escapeHtml(String(value))}`;\n })\n .join(';');\n}\n\nexport function FileDiffSSR<LAnnotation>({\n prerenderedHTML,\n annotations,\n className,\n style,\n renderAnnotation,\n}: FileDiffSsrProps<LAnnotation>): React.JSX.Element {\n const wrapperRef = useRef<HTMLDivElement>(null);\n const hydratedRef = useRef(false);\n\n // Store the HTML object in a ref so it has a stable reference\n // This prevents React from trying to update innerHTML on every render\n const htmlObjectRef = useRef<{ __html: string } | null>(null);\n\n if (htmlObjectRef.current === null) {\n // Build the full HTML string with the custom element and DSD\n const classAttr =\n className !== undefined ? ` class=\"${escapeHtml(className)}\"` : '';\n const styleAttr =\n style !== undefined ? ` style=\"${serializeStyle(style)}\"` : '';\n\n // Render annotations as static HTML slots for SSR\n const annotationSlots =\n annotations !== undefined &&\n annotations.length > 0 &&\n renderAnnotation != null\n ? annotations\n .map((annotation) => {\n const slotName = getLineAnnotationName(annotation);\n // Render the component with React markers for proper hydration\n const content = renderToString(renderAnnotation(annotation));\n return `<div slot=\"${slotName}\">${content}</div>`;\n })\n .join('')\n : '';\n\n const fullHTML = `<${DIFFS_TAG_NAME}${classAttr}${styleAttr}><template shadowrootmode=\"open\">${prerenderedHTML}</template>${annotationSlots}</${DIFFS_TAG_NAME}>`;\n\n htmlObjectRef.current = { __html: fullHTML };\n }\n\n useEffect(() => {\n // After mount, hydrate the slots with React using render functions\n if (\n wrapperRef.current !== null &&\n annotations !== undefined &&\n !hydratedRef.current\n ) {\n const fileElement = wrapperRef.current.querySelector(DIFFS_TAG_NAME);\n\n if (fileElement !== null) {\n Array.from(fileElement.children).forEach((slotElement) => {\n if (!(slotElement instanceof HTMLElement)) return;\n\n const slotName = slotElement.getAttribute('slot');\n if (slotName === null) return;\n\n // Find the matching annotation\n const annotation = annotations.find((annotation) => {\n return slotName === getLineAnnotationName(annotation);\n });\n\n if (annotation !== undefined && renderAnnotation != null) {\n hydrateRoot(slotElement, renderAnnotation(annotation));\n }\n });\n\n hydratedRef.current = true;\n }\n }\n }, [annotations, renderAnnotation]);\n\n return (\n <div\n ref={wrapperRef}\n dangerouslySetInnerHTML={htmlObjectRef.current}\n suppressHydrationWarning\n />\n );\n}\n"],"mappings":";;;;;;;;AAkBA,SAAS,WAAW,QAAwB;CAC1C,OAAO,OACJ,QAAQ,MAAM,OAAO,CAAC,CACtB,QAAQ,MAAM,MAAM,CAAC,CACrB,QAAQ,MAAM,MAAM,CAAC,CACrB,QAAQ,MAAM,QAAQ,CAAC,CACvB,QAAQ,MAAM,QAAQ;AAC3B;AAEA,SAAS,eAAe,OAA8B;CACpD,OAAO,OAAO,QAAQ,K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,YAAY,UAAU;GACxB;EACF;CACF,GAAG,CAAC,aAAa,gBAAgB,CAAC;CAElC,OACE,oBAAC,OAAD;EACE,KAAK;EACL,yBAAyB,cAAc;EACvC,0BAAA;CACD,CAAA;AAEL"}
1
+ {"version":3,"file":"FileDiffReact.js","names":[],"sources":["../../src/ssr/FileDiffReact.tsx"],"sourcesContent":["'use client';\n\nimport { type CSSProperties, type ReactNode, useEffect, useRef } from 'react';\nimport { hydrateRoot } from 'react-dom/client';\nimport { renderToString } from 'react-dom/server';\n\nimport { DIFFS_TAG_NAME } from '../constants';\nimport type { DiffLineAnnotation } from '../types';\nimport { getLineAnnotationName } from '../utils/getLineAnnotationName';\n\ninterface FileDiffSsrProps<LAnnotation> {\n prerenderedHTML: string;\n annotations?: DiffLineAnnotation<LAnnotation>[];\n renderAnnotation?(annotations: DiffLineAnnotation<LAnnotation>): ReactNode;\n className?: string;\n style?: CSSProperties;\n}\n\nfunction escapeHtml(unsafe: string): string {\n return unsafe\n .replace(/&/g, '&amp;')\n .replace(/</g, '&lt;')\n .replace(/>/g, '&gt;')\n .replace(/\"/g, '&quot;')\n .replace(/'/g, '&#039;');\n}\n\nfunction serializeStyle(style: CSSProperties): string {\n return Object.entries(style)\n .map(([key, value]) => {\n // Convert camelCase to kebab-case\n const kebabKey = key.replace(/([A-Z])/g, '-$1').toLowerCase();\n // Escape the value for safety\n return `${kebabKey}:${escapeHtml(String(value))}`;\n })\n .join(';');\n}\n\nexport function FileDiffSSR<LAnnotation>({\n prerenderedHTML,\n annotations,\n className,\n style,\n renderAnnotation,\n}: FileDiffSsrProps<LAnnotation>): React.JSX.Element {\n const wrapperRef = useRef<HTMLDivElement>(null);\n const hydratedRef = useRef(false);\n\n // Store the HTML object in a ref so it has a stable reference\n // This prevents React from trying to update innerHTML on every render\n const htmlObjectRef = useRef<{ __html: string } | null>(null);\n\n if (htmlObjectRef.current === null) {\n // Build the full HTML string with the custom element and DSD\n const classAttr =\n className !== undefined ? ` class=\"${escapeHtml(className)}\"` : '';\n const styleAttr =\n style !== undefined ? ` style=\"${serializeStyle(style)}\"` : '';\n\n // Render annotations as static HTML slots for SSR\n const annotationSlots =\n annotations !== undefined &&\n annotations.length > 0 &&\n renderAnnotation != null\n ? annotations\n .map((annotation) => {\n const slotName = getLineAnnotationName(annotation);\n // Render the component with React markers for proper hydration\n const content = renderToString(renderAnnotation(annotation));\n return `<div slot=\"${slotName}\">${content}</div>`;\n })\n .join('')\n : '';\n\n const fullHTML = `<${DIFFS_TAG_NAME}${classAttr}${styleAttr}><template shadowrootmode=\"open\">${prerenderedHTML}</template>${annotationSlots}</${DIFFS_TAG_NAME}>`;\n\n htmlObjectRef.current = { __html: fullHTML };\n }\n\n useEffect(() => {\n // After mount, hydrate the slots with React using render functions\n if (\n wrapperRef.current !== null &&\n annotations !== undefined &&\n !hydratedRef.current\n ) {\n const fileElement = wrapperRef.current.querySelector(DIFFS_TAG_NAME);\n\n if (fileElement !== null) {\n Array.from(fileElement.children).forEach((slotElement) => {\n if (!(slotElement instanceof HTMLElement)) return;\n\n const slotName = slotElement.getAttribute('slot');\n if (slotName === null) return;\n\n // Find the matching annotation\n const annotation = annotations.find((annotation) => {\n return slotName === getLineAnnotationName(annotation);\n });\n\n if (annotation !== undefined && renderAnnotation != null) {\n hydrateRoot(slotElement, renderAnnotation(annotation));\n }\n });\n\n hydratedRef.current = true;\n }\n }\n }, [annotations, renderAnnotation]);\n\n return (\n <div\n ref={wrapperRef}\n // Serialized once on the first render and reused verbatim after, so React\n // never replaces the server markup the annotation roots hydrated into.\n // oxlint-disable-next-line react/refs\n dangerouslySetInnerHTML={htmlObjectRef.current}\n suppressHydrationWarning\n />\n );\n}\n"],"mappings":";;;;;;;;AAkBA,SAAS,WAAW,QAAwB;CAC1C,OAAO,OACJ,QAAQ,MAAM,OAAO,CAAC,CACtB,QAAQ,MAAM,MAAM,CAAC,CACrB,QAAQ,MAAM,MAAM,CAAC,CACrB,QAAQ,MAAM,QAAQ,CAAC,CACvB,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AAe;MAClD,OAAO,aAAa,sBAAsB,UAAU;KACtD,CAAC;KAED,IAAI,eAAe,KAAA,KAAa,oBAAoB,MAClD,YAAY,aAAa,iBAAiB,UAAU,CAAC;IAEzD,CAAC;IAED,YAAY,UAAU;GACxB;EACF;CACF,GAAG,CAAC,aAAa,gBAAgB,CAAC;CAElC,OACE,oBAAC,OAAD;EACE,KAAK;EAIL,yBAAyB,cAAc;EACvC,0BAAA;CACD,CAAA;AAEL"}
@@ -1,7 +1,6 @@
1
1
  import { DiffFileInput, DiffLineAnnotation, FileContents, FileDiffMetadata, MaybeDiffFileInput } from "../types.js";
2
2
  import { FileDiffOptions } from "../components/FileDiff.js";
3
3
  import { UnresolvedFileOptions } from "../components/UnresolvedFile.js";
4
-
5
4
  //#region src/ssr/preloadDiffs.d.ts
6
5
  interface PreloadDiffBaseOptions<LAnnotation, Caret> {
7
6
  options?: FileDiffOptions<LAnnotation, Caret>;
@@ -12,18 +11,8 @@ type PreloadDiffOptions<LAnnotation, Caret> = PreloadDiffBaseOptions<LAnnotation
12
11
  } & MaybeDiffFileInput) | ({
13
12
  fileDiff?: undefined;
14
13
  } & DiffFileInput));
15
- declare function preloadDiffHTML<LAnnotation = undefined, Caret = undefined>({
16
- fileDiff,
17
- oldFile,
18
- newFile,
19
- options,
20
- annotations
21
- }: PreloadDiffOptions<LAnnotation, Caret>): Promise<string>;
22
- declare function preloadUnresolvedFileHTML<LAnnotation = undefined>({
23
- file,
24
- options,
25
- annotations
26
- }: PreloadUnresolvedFileOptions<LAnnotation>): Promise<string>;
14
+ declare function preloadDiffHTML<LAnnotation = undefined, Caret = undefined>({ fileDiff, oldFile, newFile, options, annotations }: PreloadDiffOptions<LAnnotation, Caret>): Promise<string>;
15
+ declare function preloadUnresolvedFileHTML<LAnnotation = undefined>({ file, options, annotations }: PreloadUnresolvedFileOptions<LAnnotation>): Promise<string>;
27
16
  interface PreloadMultiFileDiffBaseOptions<LAnnotation, Caret> {
28
17
  options?: FileDiffOptions<LAnnotation, Caret>;
29
18
  annotations?: DiffLineAnnotation<LAnnotation>[];
@@ -32,12 +21,7 @@ type PreloadMultiFileDiffOptions<LAnnotation, Caret> = PreloadMultiFileDiffBaseO
32
21
  type PreloadMultiFileDiffResult<LAnnotation, Caret> = PreloadMultiFileDiffOptions<LAnnotation, Caret> & {
33
22
  prerenderedHTML: string;
34
23
  };
35
- declare function preloadMultiFileDiff<LAnnotation = undefined, Caret = undefined>({
36
- oldFile,
37
- newFile,
38
- options,
39
- annotations
40
- }: PreloadMultiFileDiffOptions<LAnnotation, Caret>): Promise<PreloadMultiFileDiffResult<LAnnotation, Caret>>;
24
+ declare function preloadMultiFileDiff<LAnnotation = undefined, Caret = undefined>({ oldFile, newFile, options, annotations }: PreloadMultiFileDiffOptions<LAnnotation, Caret>): Promise<PreloadMultiFileDiffResult<LAnnotation, Caret>>;
41
25
  interface PreloadFileDiffOptions<LAnnotation, Caret> {
42
26
  fileDiff: FileDiffMetadata;
43
27
  options?: FileDiffOptions<LAnnotation, Caret>;
@@ -46,11 +30,7 @@ interface PreloadFileDiffOptions<LAnnotation, Caret> {
46
30
  interface PreloadFileDiffResult<LAnnotation, Caret> extends PreloadFileDiffOptions<LAnnotation, Caret> {
47
31
  prerenderedHTML: string;
48
32
  }
49
- declare function preloadFileDiff<LAnnotation = undefined, Caret = undefined>({
50
- fileDiff,
51
- options,
52
- annotations
53
- }: PreloadFileDiffOptions<LAnnotation, Caret>): Promise<PreloadFileDiffResult<LAnnotation, Caret>>;
33
+ declare function preloadFileDiff<LAnnotation = undefined, Caret = undefined>({ fileDiff, options, annotations }: PreloadFileDiffOptions<LAnnotation, Caret>): Promise<PreloadFileDiffResult<LAnnotation, Caret>>;
54
34
  interface PreloadUnresolvedFileOptions<LAnnotation> {
55
35
  file: FileContents;
56
36
  options?: Omit<UnresolvedFileOptions<LAnnotation>, 'onMergeConflictAction' | 'onMergeConflictResolve' | 'onPostRender'>;
@@ -59,11 +39,7 @@ interface PreloadUnresolvedFileOptions<LAnnotation> {
59
39
  interface PreloadUnresolvedFileResult<LAnnotation> extends PreloadUnresolvedFileOptions<LAnnotation> {
60
40
  prerenderedHTML: string;
61
41
  }
62
- declare function preloadUnresolvedFile<LAnnotation = undefined>({
63
- file,
64
- options,
65
- annotations
66
- }: PreloadUnresolvedFileOptions<LAnnotation>): Promise<PreloadUnresolvedFileResult<LAnnotation>>;
42
+ declare function preloadUnresolvedFile<LAnnotation = undefined>({ file, options, annotations }: PreloadUnresolvedFileOptions<LAnnotation>): Promise<PreloadUnresolvedFileResult<LAnnotation>>;
67
43
  interface PreloadPatchDiffOptions<LAnnotation, Caret> {
68
44
  patch: string;
69
45
  options?: FileDiffOptions<LAnnotation, Caret>;
@@ -72,11 +48,7 @@ interface PreloadPatchDiffOptions<LAnnotation, Caret> {
72
48
  interface PreloadPatchDiffResult<LAnnotation, Caret> extends PreloadPatchDiffOptions<LAnnotation, Caret> {
73
49
  prerenderedHTML: string;
74
50
  }
75
- declare function preloadPatchDiff<LAnnotation = undefined, Caret = undefined>({
76
- patch,
77
- options,
78
- annotations
79
- }: PreloadPatchDiffOptions<LAnnotation, Caret>): Promise<PreloadPatchDiffResult<LAnnotation, Caret>>;
51
+ declare function preloadPatchDiff<LAnnotation = undefined, Caret = undefined>({ patch, options, annotations }: PreloadPatchDiffOptions<LAnnotation, Caret>): Promise<PreloadPatchDiffResult<LAnnotation, Caret>>;
80
52
  //#endregion
81
53
  export { PreloadDiffOptions, PreloadFileDiffOptions, PreloadFileDiffResult, PreloadMultiFileDiffOptions, PreloadMultiFileDiffResult, PreloadPatchDiffOptions, PreloadPatchDiffResult, PreloadUnresolvedFileOptions, PreloadUnresolvedFileResult, preloadDiffHTML, preloadFileDiff, preloadMultiFileDiff, preloadPatchDiff, preloadUnresolvedFile, preloadUnresolvedFileHTML };
82
54
  //# sourceMappingURL=preloadDiffs.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"preloadDiffs.d.ts","names":[],"sources":["../../src/ssr/preload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GkB,qBACpB,yBACA,qBAEA,SACA,SACA,SACA,eACC,4BAA4B,aAAa,SAAS,QACnD,2BAA2B,aAAa;UAuBzB,uBAAuB,aAAa;EACnD,UAAU;EACV,UAAU,gBAAgB,aAAa;EACvC,cAAc,mBAAmB;;UAGlB,sBACf,aACA,eACQ,uBAAuB,aAAa;EAC5C;;iBAGoB,gBACpB,yBACA,qBAEA,UACA,SACA,eACC,uBAAuB,aAAa,SAAS,QAC9C,sBAAsB,aAAa;UAcpB,6BAA6B;EAC5C,MAAM;EACN,UAAU,KACR,sBAAsB;EAGxB,cAAc,mBAAmB;;UAGlB,4BACf,qBACQ,6BAA6B;EACrC;;iBAGoB,sBAAsB,2BAC1C,MACA,SACA,eACC,6BAA6B,eAAe,QAC7C,4BAA4B;UAcb,wBAAwB,aAAa;EACpD;EACA,UAAU,gBAAgB,aAAa;EACvC,cAAc,mBAAmB;;UAGlB,uBACf,aACA,eACQ,wBAAwB,aAAa;EAC7C;;iBAGoB,iBACpB,yBACA,qBAEA,OACA,SACA,eACC,wBAAwB,aAAa,SAAS,QAC/C,uBAAuB,aAAa"}
@@ -1,6 +1,5 @@
1
1
  import { FileContents, LineAnnotation } from "../types.js";
2
2
  import { FileOptions } from "../components/File.js";
3
-
4
3
  //#region src/ssr/preloadFile.d.ts
5
4
  type PreloadFileOptions<LAnnotation, Caret> = {
6
5
  file: FileContents;
@@ -13,11 +12,7 @@ interface PreloadedFileResult<LAnnotation, Caret> {
13
12
  annotations?: LineAnnotation<LAnnotation>[];
14
13
  prerenderedHTML: string;
15
14
  }
16
- declare function preloadFile<LAnnotation = undefined, Caret = undefined>({
17
- file,
18
- options,
19
- annotations
20
- }: PreloadFileOptions<LAnnotation, Caret>): Promise<PreloadedFileResult<LAnnotation, Caret>>;
15
+ declare function preloadFile<LAnnotation = undefined, Caret = undefined>({ file, options, annotations }: PreloadFileOptions<LAnnotation, Caret>): Promise<PreloadedFileResult<LAnnotation, Caret>>;
21
16
  //#endregion
22
17
  export { PreloadFileOptions, PreloadedFileResult, preloadFile };
23
18
  //# sourceMappingURL=preloadFile.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"preloadFile.d.ts","names":[],"sources":["../../src/ssr/preloadFile.ts"],"mappings":";;;;KAWY,kBAAA;EACV,IAAA,EAAM,YAAA;EACN,OAAA,GAAU,WAAA,CAAY,WAAA,EAAa,KAAA;EACnC,WAAA,GAAc,cAAA,CAAe,WAAA;AAAA;AAAA,UAGd,mBAAA;EACf,IAAA,EAAM,YAAA;EACN,OAAA,GAAU,WAAA,CAAY,WAAA,EAAa,KAAA;EACnC,WAAA,GAAc,cAAA,CAAe,WAAA;EAC7B,eAAA;AAAA;AAAA,iBAGoB,WAAA;EACpB,IAAA;EACA,OAAA;EACA;AAAA,GACC,kBAAA,CAAmB,WAAA,EAAa,KAAA,IAAS,OAAA,CAC1C,mBAAA,CAAoB,WAAA,EAAa,KAAA"}
1
+ {"version":3,"file":"preloadFile.d.ts","names":[],"sources":["../../src/ssr/preloadFile.ts"],"mappings":";;;KAWY,mBAAmB,aAAa;EAC1C,MAAM;EACN,UAAU,YAAY,aAAa;EACnC,cAAc,eAAe;;UAGd,oBAAoB,aAAa;EAChD,MAAM;EACN,UAAU,YAAY,aAAa;EACnC,cAAc,eAAe;EAC7B;;iBAGoB,YAAY,yBAAyB,qBACzD,MACA,SACA,eACC,mBAAmB,aAAa,SAAS,QAC1C,oBAAoB,aAAa"}
@@ -1,15 +1,11 @@
1
1
  import { FileDiffOptions } from "../components/FileDiff.js";
2
2
  import { PreloadFileDiffResult } from "./preloadDiffs.js";
3
-
4
3
  //#region src/ssr/preloadPatchFile.d.ts
5
4
  type PreloadPatchFileOptions<LAnnotation, Caret> = {
6
5
  patch: string;
7
6
  options?: FileDiffOptions<LAnnotation, Caret>;
8
7
  };
9
- declare function preloadPatchFile<LAnnotation = undefined, Caret = undefined>({
10
- patch,
11
- options
12
- }: PreloadPatchFileOptions<LAnnotation, Caret>): Promise<PreloadFileDiffResult<LAnnotation, Caret>[]>;
8
+ declare function preloadPatchFile<LAnnotation = undefined, Caret = undefined>({ patch, options }: PreloadPatchFileOptions<LAnnotation, Caret>): Promise<PreloadFileDiffResult<LAnnotation, Caret>[]>;
13
9
  //#endregion
14
10
  export { PreloadPatchFileOptions, preloadPatchFile };
15
11
  //# sourceMappingURL=preloadPatchFile.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"preloadPatchFile.d.ts","names":[],"sources":["../../src/ssr/preloadPatchFile.ts"],"mappings":";;;;KAIY,uBAAA;EACV,KAAA;EACA,OAAA,GAAU,eAAA,CAAgB,WAAA,EAAa,KAAA;AAAA;AAAA,iBAMnB,gBAAA;EAIpB,KAAA;EACA;AAAA,GACC,uBAAA,CAAwB,WAAA,EAAa,KAAA,IAAS,OAAA,CAC/C,qBAAA,CAAsB,WAAA,EAAa,KAAA"}
1
+ {"version":3,"file":"preloadPatchFile.d.ts","names":[],"sources":["../../src/ssr/preloadPatchFile.ts"],"mappings":";;;KAIY,wBAAwB,aAAa;EAC/C;EACA,UAAU,gBAAgB,aAAa;;iBAMnB,iBACpB,yBACA,qBAEA,OACA,WACC,wBAAwB,aAAa,SAAS,QAC/C,sBAAsB,aAAa"}
@@ -1,5 +1,4 @@
1
1
  import { Element } from "../node_modules/.pnpm/@types_hast@3.0.4/node_modules/@types/hast/index.js";
2
-
3
2
  //#region src/ssr/renderHTML.d.ts
4
3
  declare function renderHTML(children: Element[]): string;
5
4
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"renderHTML.d.ts","names":[],"sources":["../../src/ssr/renderHTML.ts"],"mappings":";;;iBAKgB,UAAA,CAAW,QAAuB,EAAb,OAAW"}
1
+ {"version":3,"file":"renderHTML.d.ts","names":[],"sources":["../../src/ssr/renderHTML.ts"],"mappings":";;iBAKgB,WAAW,UAAU"}
@@ -1 +1 @@
1
- {"version":3,"file":"string-import.d.ts","names":["file"],"sources":["../src/string-import.d.ts"],"mappings":";;QACQA,IAAAA;EAAAA,eACSA,IAAI;AAAA;AAAA;EAAA,MAIbA,IAAAA;EAAAA,eACSA,IAAI;AAAA"}
1
+ {"version":3,"file":"string-import.d.ts","names":[],"sources":["../src/string-import.d.ts"],"mappings":";;QACQ;iBACS;;;QAIT;iBACS"}