@xyne/xyne-cli-darwin-x64 0.1.10 → 0.1.11

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 (390) hide show
  1. package/node_modules/@opentui/core/3d/SpriteResourceManager.d.ts +74 -0
  2. package/node_modules/@opentui/core/3d/SpriteUtils.d.ts +13 -0
  3. package/node_modules/@opentui/core/3d/TextureUtils.d.ts +24 -0
  4. package/node_modules/@opentui/core/3d/ThreeRenderable.d.ts +40 -0
  5. package/node_modules/@opentui/core/3d/WGPURenderer.d.ts +61 -0
  6. package/node_modules/@opentui/core/3d/animation/ExplodingSpriteEffect.d.ts +71 -0
  7. package/node_modules/@opentui/core/3d/animation/PhysicsExplodingSpriteEffect.d.ts +76 -0
  8. package/node_modules/@opentui/core/3d/animation/SpriteAnimator.d.ts +124 -0
  9. package/node_modules/@opentui/core/3d/animation/SpriteParticleGenerator.d.ts +62 -0
  10. package/node_modules/@opentui/core/3d/canvas.d.ts +44 -0
  11. package/node_modules/@opentui/core/3d/index.d.ts +12 -0
  12. package/node_modules/@opentui/core/3d/physics/PlanckPhysicsAdapter.d.ts +19 -0
  13. package/node_modules/@opentui/core/3d/physics/RapierPhysicsAdapter.d.ts +19 -0
  14. package/node_modules/@opentui/core/3d/physics/physics-interface.d.ts +27 -0
  15. package/node_modules/@opentui/core/3d.d.ts +2 -0
  16. package/node_modules/@opentui/core/3d.js +34041 -0
  17. package/node_modules/@opentui/core/3d.js.map +155 -0
  18. package/node_modules/@opentui/core/LICENSE +21 -0
  19. package/node_modules/@opentui/core/NativeSpanFeed.d.ts +41 -0
  20. package/node_modules/@opentui/core/README.md +62 -0
  21. package/node_modules/@opentui/core/Renderable.d.ts +334 -0
  22. package/node_modules/@opentui/core/animation/Timeline.d.ts +126 -0
  23. package/node_modules/@opentui/core/ansi.d.ts +13 -0
  24. package/node_modules/@opentui/core/assets/javascript/highlights.scm +205 -0
  25. package/node_modules/@opentui/core/assets/javascript/tree-sitter-javascript.wasm +0 -0
  26. package/node_modules/@opentui/core/assets/markdown/highlights.scm +150 -0
  27. package/node_modules/@opentui/core/assets/markdown/injections.scm +27 -0
  28. package/node_modules/@opentui/core/assets/markdown/tree-sitter-markdown.wasm +0 -0
  29. package/node_modules/@opentui/core/assets/markdown_inline/highlights.scm +115 -0
  30. package/node_modules/@opentui/core/assets/markdown_inline/tree-sitter-markdown_inline.wasm +0 -0
  31. package/node_modules/@opentui/core/assets/typescript/highlights.scm +604 -0
  32. package/node_modules/@opentui/core/assets/typescript/tree-sitter-typescript.wasm +0 -0
  33. package/node_modules/@opentui/core/assets/zig/highlights.scm +284 -0
  34. package/node_modules/@opentui/core/assets/zig/tree-sitter-zig.wasm +0 -0
  35. package/node_modules/@opentui/core/buffer.d.ts +109 -0
  36. package/node_modules/@opentui/core/console.d.ts +143 -0
  37. package/node_modules/@opentui/core/edit-buffer.d.ts +98 -0
  38. package/node_modules/@opentui/core/editor-view.d.ts +73 -0
  39. package/node_modules/@opentui/core/index-4kfx7p6q.js +19143 -0
  40. package/node_modules/@opentui/core/index-4kfx7p6q.js.map +64 -0
  41. package/node_modules/@opentui/core/index-adp83v70.js +13345 -0
  42. package/node_modules/@opentui/core/index-adp83v70.js.map +45 -0
  43. package/node_modules/@opentui/core/index-bhw3bbqb.js +188 -0
  44. package/node_modules/@opentui/core/index-bhw3bbqb.js.map +10 -0
  45. package/node_modules/@opentui/core/index.d.ts +23 -0
  46. package/node_modules/@opentui/core/index.js +472 -0
  47. package/node_modules/@opentui/core/index.js.map +9 -0
  48. package/node_modules/@opentui/core/lib/KeyHandler.d.ts +61 -0
  49. package/node_modules/@opentui/core/lib/RGBA.d.ts +25 -0
  50. package/node_modules/@opentui/core/lib/ascii.font.d.ts +508 -0
  51. package/node_modules/@opentui/core/lib/border.d.ts +49 -0
  52. package/node_modules/@opentui/core/lib/bunfs.d.ts +7 -0
  53. package/node_modules/@opentui/core/lib/clipboard.d.ts +17 -0
  54. package/node_modules/@opentui/core/lib/clock.d.ts +15 -0
  55. package/node_modules/@opentui/core/lib/data-paths.d.ts +26 -0
  56. package/node_modules/@opentui/core/lib/debounce.d.ts +42 -0
  57. package/node_modules/@opentui/core/lib/detect-links.d.ts +6 -0
  58. package/node_modules/@opentui/core/lib/env.d.ts +42 -0
  59. package/node_modules/@opentui/core/lib/extmarks-history.d.ts +17 -0
  60. package/node_modules/@opentui/core/lib/extmarks.d.ts +89 -0
  61. package/node_modules/@opentui/core/lib/hast-styled-text.d.ts +17 -0
  62. package/node_modules/@opentui/core/lib/index.d.ts +21 -0
  63. package/node_modules/@opentui/core/lib/keymapping.d.ts +25 -0
  64. package/node_modules/@opentui/core/lib/objects-in-viewport.d.ts +24 -0
  65. package/node_modules/@opentui/core/lib/output.capture.d.ts +24 -0
  66. package/node_modules/@opentui/core/lib/parse.keypress-kitty.d.ts +2 -0
  67. package/node_modules/@opentui/core/lib/parse.keypress.d.ts +26 -0
  68. package/node_modules/@opentui/core/lib/parse.mouse.d.ts +30 -0
  69. package/node_modules/@opentui/core/lib/paste.d.ts +7 -0
  70. package/node_modules/@opentui/core/lib/queue.d.ts +15 -0
  71. package/node_modules/@opentui/core/lib/renderable.validations.d.ts +12 -0
  72. package/node_modules/@opentui/core/lib/scroll-acceleration.d.ts +43 -0
  73. package/node_modules/@opentui/core/lib/selection.d.ts +63 -0
  74. package/node_modules/@opentui/core/lib/singleton.d.ts +7 -0
  75. package/node_modules/@opentui/core/lib/stdin-parser.d.ts +86 -0
  76. package/node_modules/@opentui/core/lib/styled-text.d.ts +63 -0
  77. package/node_modules/@opentui/core/lib/terminal-capability-detection.d.ts +30 -0
  78. package/node_modules/@opentui/core/lib/terminal-palette.d.ts +50 -0
  79. package/node_modules/@opentui/core/lib/tree-sitter/assets/update.d.ts +11 -0
  80. package/node_modules/@opentui/core/lib/tree-sitter/client.d.ts +47 -0
  81. package/node_modules/@opentui/core/lib/tree-sitter/default-parsers.d.ts +2 -0
  82. package/node_modules/@opentui/core/lib/tree-sitter/download-utils.d.ts +21 -0
  83. package/node_modules/@opentui/core/lib/tree-sitter/index.d.ts +8 -0
  84. package/node_modules/@opentui/core/lib/tree-sitter/parser.worker.d.ts +1 -0
  85. package/node_modules/@opentui/core/lib/tree-sitter/parsers-config.d.ts +53 -0
  86. package/node_modules/@opentui/core/lib/tree-sitter/resolve-ft.d.ts +5 -0
  87. package/node_modules/@opentui/core/lib/tree-sitter/types.d.ts +82 -0
  88. package/node_modules/@opentui/core/lib/tree-sitter-styled-text.d.ts +14 -0
  89. package/node_modules/@opentui/core/lib/validate-dir-name.d.ts +1 -0
  90. package/node_modules/@opentui/core/lib/yoga.options.d.ts +32 -0
  91. package/node_modules/@opentui/core/node_modules/diff/CONTRIBUTING.md +28 -0
  92. package/node_modules/@opentui/core/node_modules/diff/LICENSE +29 -0
  93. package/node_modules/@opentui/core/node_modules/diff/README.md +378 -0
  94. package/node_modules/@opentui/core/node_modules/diff/dist/diff.js +1674 -0
  95. package/node_modules/@opentui/core/node_modules/diff/dist/diff.min.js +1 -0
  96. package/node_modules/@opentui/core/node_modules/diff/eslint.config.mjs +182 -0
  97. package/node_modules/@opentui/core/node_modules/diff/libcjs/convert/dmp.d.ts +8 -0
  98. package/node_modules/@opentui/core/node_modules/diff/libcjs/convert/dmp.d.ts.map +1 -0
  99. package/node_modules/@opentui/core/node_modules/diff/libcjs/convert/dmp.js +24 -0
  100. package/node_modules/@opentui/core/node_modules/diff/libcjs/convert/xml.d.ts +6 -0
  101. package/node_modules/@opentui/core/node_modules/diff/libcjs/convert/xml.d.ts.map +1 -0
  102. package/node_modules/@opentui/core/node_modules/diff/libcjs/convert/xml.js +34 -0
  103. package/node_modules/@opentui/core/node_modules/diff/libcjs/diff/array.d.ts +19 -0
  104. package/node_modules/@opentui/core/node_modules/diff/libcjs/diff/array.d.ts.map +1 -0
  105. package/node_modules/@opentui/core/node_modules/diff/libcjs/diff/array.js +40 -0
  106. package/node_modules/@opentui/core/node_modules/diff/libcjs/diff/base.d.ts +20 -0
  107. package/node_modules/@opentui/core/node_modules/diff/libcjs/diff/base.d.ts.map +1 -0
  108. package/node_modules/@opentui/core/node_modules/diff/libcjs/diff/base.js +265 -0
  109. package/node_modules/@opentui/core/node_modules/diff/libcjs/diff/character.d.ts +19 -0
  110. package/node_modules/@opentui/core/node_modules/diff/libcjs/diff/character.d.ts.map +1 -0
  111. package/node_modules/@opentui/core/node_modules/diff/libcjs/diff/character.js +31 -0
  112. package/node_modules/@opentui/core/node_modules/diff/libcjs/diff/css.d.ts +18 -0
  113. package/node_modules/@opentui/core/node_modules/diff/libcjs/diff/css.d.ts.map +1 -0
  114. package/node_modules/@opentui/core/node_modules/diff/libcjs/diff/css.js +34 -0
  115. package/node_modules/@opentui/core/node_modules/diff/libcjs/diff/json.d.ts +24 -0
  116. package/node_modules/@opentui/core/node_modules/diff/libcjs/diff/json.d.ts.map +1 -0
  117. package/node_modules/@opentui/core/node_modules/diff/libcjs/diff/json.js +105 -0
  118. package/node_modules/@opentui/core/node_modules/diff/libcjs/diff/line.d.ts +24 -0
  119. package/node_modules/@opentui/core/node_modules/diff/libcjs/diff/line.d.ts.map +1 -0
  120. package/node_modules/@opentui/core/node_modules/diff/libcjs/diff/line.js +89 -0
  121. package/node_modules/@opentui/core/node_modules/diff/libcjs/diff/sentence.d.ts +21 -0
  122. package/node_modules/@opentui/core/node_modules/diff/libcjs/diff/sentence.d.ts.map +1 -0
  123. package/node_modules/@opentui/core/node_modules/diff/libcjs/diff/sentence.js +67 -0
  124. package/node_modules/@opentui/core/node_modules/diff/libcjs/diff/word.d.ts +35 -0
  125. package/node_modules/@opentui/core/node_modules/diff/libcjs/diff/word.d.ts.map +1 -0
  126. package/node_modules/@opentui/core/node_modules/diff/libcjs/diff/word.js +307 -0
  127. package/node_modules/@opentui/core/node_modules/diff/libcjs/index.d.ts +20 -0
  128. package/node_modules/@opentui/core/node_modules/diff/libcjs/index.d.ts.map +1 -0
  129. package/node_modules/@opentui/core/node_modules/diff/libcjs/index.js +61 -0
  130. package/node_modules/@opentui/core/node_modules/diff/libcjs/package.json +1 -0
  131. package/node_modules/@opentui/core/node_modules/diff/libcjs/patch/apply.d.ts +62 -0
  132. package/node_modules/@opentui/core/node_modules/diff/libcjs/patch/apply.d.ts.map +1 -0
  133. package/node_modules/@opentui/core/node_modules/diff/libcjs/patch/apply.js +267 -0
  134. package/node_modules/@opentui/core/node_modules/diff/libcjs/patch/create.d.ts +100 -0
  135. package/node_modules/@opentui/core/node_modules/diff/libcjs/patch/create.d.ts.map +1 -0
  136. package/node_modules/@opentui/core/node_modules/diff/libcjs/patch/create.js +223 -0
  137. package/node_modules/@opentui/core/node_modules/diff/libcjs/patch/line-endings.d.ts +17 -0
  138. package/node_modules/@opentui/core/node_modules/diff/libcjs/patch/line-endings.d.ts.map +1 -0
  139. package/node_modules/@opentui/core/node_modules/diff/libcjs/patch/line-endings.js +61 -0
  140. package/node_modules/@opentui/core/node_modules/diff/libcjs/patch/parse.d.ts +8 -0
  141. package/node_modules/@opentui/core/node_modules/diff/libcjs/patch/parse.d.ts.map +1 -0
  142. package/node_modules/@opentui/core/node_modules/diff/libcjs/patch/parse.js +133 -0
  143. package/node_modules/@opentui/core/node_modules/diff/libcjs/patch/reverse.d.ts +9 -0
  144. package/node_modules/@opentui/core/node_modules/diff/libcjs/patch/reverse.d.ts.map +1 -0
  145. package/node_modules/@opentui/core/node_modules/diff/libcjs/patch/reverse.js +37 -0
  146. package/node_modules/@opentui/core/node_modules/diff/libcjs/types.d.ts +213 -0
  147. package/node_modules/@opentui/core/node_modules/diff/libcjs/types.d.ts.map +1 -0
  148. package/node_modules/@opentui/core/node_modules/diff/libcjs/types.js +2 -0
  149. package/node_modules/@opentui/core/node_modules/diff/libcjs/util/array.d.ts +3 -0
  150. package/node_modules/@opentui/core/node_modules/diff/libcjs/util/array.d.ts.map +1 -0
  151. package/node_modules/@opentui/core/node_modules/diff/libcjs/util/array.js +21 -0
  152. package/node_modules/@opentui/core/node_modules/diff/libcjs/util/distance-iterator.d.ts +2 -0
  153. package/node_modules/@opentui/core/node_modules/diff/libcjs/util/distance-iterator.d.ts.map +1 -0
  154. package/node_modules/@opentui/core/node_modules/diff/libcjs/util/distance-iterator.js +40 -0
  155. package/node_modules/@opentui/core/node_modules/diff/libcjs/util/params.d.ts +4 -0
  156. package/node_modules/@opentui/core/node_modules/diff/libcjs/util/params.d.ts.map +1 -0
  157. package/node_modules/@opentui/core/node_modules/diff/libcjs/util/params.js +17 -0
  158. package/node_modules/@opentui/core/node_modules/diff/libcjs/util/string.d.ts +18 -0
  159. package/node_modules/@opentui/core/node_modules/diff/libcjs/util/string.d.ts.map +1 -0
  160. package/node_modules/@opentui/core/node_modules/diff/libcjs/util/string.js +141 -0
  161. package/node_modules/@opentui/core/node_modules/diff/libesm/convert/dmp.d.ts +8 -0
  162. package/node_modules/@opentui/core/node_modules/diff/libesm/convert/dmp.d.ts.map +1 -0
  163. package/node_modules/@opentui/core/node_modules/diff/libesm/convert/dmp.js +21 -0
  164. package/node_modules/@opentui/core/node_modules/diff/libesm/convert/xml.d.ts +6 -0
  165. package/node_modules/@opentui/core/node_modules/diff/libesm/convert/xml.d.ts.map +1 -0
  166. package/node_modules/@opentui/core/node_modules/diff/libesm/convert/xml.js +31 -0
  167. package/node_modules/@opentui/core/node_modules/diff/libesm/diff/array.d.ts +19 -0
  168. package/node_modules/@opentui/core/node_modules/diff/libesm/diff/array.d.ts.map +1 -0
  169. package/node_modules/@opentui/core/node_modules/diff/libesm/diff/array.js +16 -0
  170. package/node_modules/@opentui/core/node_modules/diff/libesm/diff/base.d.ts +20 -0
  171. package/node_modules/@opentui/core/node_modules/diff/libesm/diff/base.d.ts.map +1 -0
  172. package/node_modules/@opentui/core/node_modules/diff/libesm/diff/base.js +253 -0
  173. package/node_modules/@opentui/core/node_modules/diff/libesm/diff/character.d.ts +19 -0
  174. package/node_modules/@opentui/core/node_modules/diff/libesm/diff/character.d.ts.map +1 -0
  175. package/node_modules/@opentui/core/node_modules/diff/libesm/diff/character.js +7 -0
  176. package/node_modules/@opentui/core/node_modules/diff/libesm/diff/css.d.ts +18 -0
  177. package/node_modules/@opentui/core/node_modules/diff/libesm/diff/css.d.ts.map +1 -0
  178. package/node_modules/@opentui/core/node_modules/diff/libesm/diff/css.js +10 -0
  179. package/node_modules/@opentui/core/node_modules/diff/libesm/diff/json.d.ts +24 -0
  180. package/node_modules/@opentui/core/node_modules/diff/libesm/diff/json.d.ts.map +1 -0
  181. package/node_modules/@opentui/core/node_modules/diff/libesm/diff/json.js +78 -0
  182. package/node_modules/@opentui/core/node_modules/diff/libesm/diff/line.d.ts +24 -0
  183. package/node_modules/@opentui/core/node_modules/diff/libesm/diff/line.d.ts.map +1 -0
  184. package/node_modules/@opentui/core/node_modules/diff/libesm/diff/line.js +65 -0
  185. package/node_modules/@opentui/core/node_modules/diff/libesm/diff/sentence.d.ts +21 -0
  186. package/node_modules/@opentui/core/node_modules/diff/libesm/diff/sentence.d.ts.map +1 -0
  187. package/node_modules/@opentui/core/node_modules/diff/libesm/diff/sentence.js +43 -0
  188. package/node_modules/@opentui/core/node_modules/diff/libesm/diff/word.d.ts +35 -0
  189. package/node_modules/@opentui/core/node_modules/diff/libesm/diff/word.d.ts.map +1 -0
  190. package/node_modules/@opentui/core/node_modules/diff/libesm/diff/word.js +276 -0
  191. package/node_modules/@opentui/core/node_modules/diff/libesm/index.d.ts +20 -0
  192. package/node_modules/@opentui/core/node_modules/diff/libesm/index.d.ts.map +1 -0
  193. package/node_modules/@opentui/core/node_modules/diff/libesm/index.js +30 -0
  194. package/node_modules/@opentui/core/node_modules/diff/libesm/package.json +1 -0
  195. package/node_modules/@opentui/core/node_modules/diff/libesm/patch/apply.d.ts +62 -0
  196. package/node_modules/@opentui/core/node_modules/diff/libesm/patch/apply.d.ts.map +1 -0
  197. package/node_modules/@opentui/core/node_modules/diff/libesm/patch/apply.js +257 -0
  198. package/node_modules/@opentui/core/node_modules/diff/libesm/patch/create.d.ts +100 -0
  199. package/node_modules/@opentui/core/node_modules/diff/libesm/patch/create.d.ts.map +1 -0
  200. package/node_modules/@opentui/core/node_modules/diff/libesm/patch/create.js +201 -0
  201. package/node_modules/@opentui/core/node_modules/diff/libesm/patch/line-endings.d.ts +17 -0
  202. package/node_modules/@opentui/core/node_modules/diff/libesm/patch/line-endings.d.ts.map +1 -0
  203. package/node_modules/@opentui/core/node_modules/diff/libesm/patch/line-endings.js +44 -0
  204. package/node_modules/@opentui/core/node_modules/diff/libesm/patch/parse.d.ts +8 -0
  205. package/node_modules/@opentui/core/node_modules/diff/libesm/patch/parse.d.ts.map +1 -0
  206. package/node_modules/@opentui/core/node_modules/diff/libesm/patch/parse.js +130 -0
  207. package/node_modules/@opentui/core/node_modules/diff/libesm/patch/reverse.d.ts +9 -0
  208. package/node_modules/@opentui/core/node_modules/diff/libesm/patch/reverse.d.ts.map +1 -0
  209. package/node_modules/@opentui/core/node_modules/diff/libesm/patch/reverse.js +23 -0
  210. package/node_modules/@opentui/core/node_modules/diff/libesm/types.d.ts +213 -0
  211. package/node_modules/@opentui/core/node_modules/diff/libesm/types.d.ts.map +1 -0
  212. package/node_modules/@opentui/core/node_modules/diff/libesm/types.js +1 -0
  213. package/node_modules/@opentui/core/node_modules/diff/libesm/util/array.d.ts +3 -0
  214. package/node_modules/@opentui/core/node_modules/diff/libesm/util/array.d.ts.map +1 -0
  215. package/node_modules/@opentui/core/node_modules/diff/libesm/util/array.js +17 -0
  216. package/node_modules/@opentui/core/node_modules/diff/libesm/util/distance-iterator.d.ts +2 -0
  217. package/node_modules/@opentui/core/node_modules/diff/libesm/util/distance-iterator.d.ts.map +1 -0
  218. package/node_modules/@opentui/core/node_modules/diff/libesm/util/distance-iterator.js +37 -0
  219. package/node_modules/@opentui/core/node_modules/diff/libesm/util/params.d.ts +4 -0
  220. package/node_modules/@opentui/core/node_modules/diff/libesm/util/params.d.ts.map +1 -0
  221. package/node_modules/@opentui/core/node_modules/diff/libesm/util/params.js +14 -0
  222. package/node_modules/@opentui/core/node_modules/diff/libesm/util/string.d.ts +18 -0
  223. package/node_modules/@opentui/core/node_modules/diff/libesm/util/string.d.ts.map +1 -0
  224. package/node_modules/@opentui/core/node_modules/diff/libesm/util/string.js +128 -0
  225. package/node_modules/@opentui/core/node_modules/diff/package.json +131 -0
  226. package/node_modules/@opentui/core/node_modules/diff/release-notes.md +397 -0
  227. package/node_modules/@opentui/core/node_modules/marked/LICENSE.md +44 -0
  228. package/node_modules/@opentui/core/node_modules/marked/README.md +107 -0
  229. package/node_modules/@opentui/core/node_modules/marked/bin/main.js +283 -0
  230. package/node_modules/@opentui/core/node_modules/marked/bin/marked.js +16 -0
  231. package/node_modules/@opentui/core/node_modules/marked/lib/marked.d.ts +756 -0
  232. package/node_modules/@opentui/core/node_modules/marked/lib/marked.esm.js +72 -0
  233. package/node_modules/@opentui/core/node_modules/marked/lib/marked.esm.js.map +7 -0
  234. package/node_modules/@opentui/core/node_modules/marked/lib/marked.umd.js +74 -0
  235. package/node_modules/@opentui/core/node_modules/marked/lib/marked.umd.js.map +7 -0
  236. package/node_modules/@opentui/core/node_modules/marked/man/marked.1 +113 -0
  237. package/node_modules/@opentui/core/node_modules/marked/man/marked.1.md +93 -0
  238. package/node_modules/@opentui/core/node_modules/marked/package.json +103 -0
  239. package/node_modules/@opentui/core/package.json +77 -0
  240. package/node_modules/@opentui/core/parser.worker.js +891 -0
  241. package/node_modules/@opentui/core/parser.worker.js.map +12 -0
  242. package/node_modules/@opentui/core/plugins/core-slot.d.ts +72 -0
  243. package/node_modules/@opentui/core/plugins/registry.d.ts +42 -0
  244. package/node_modules/@opentui/core/plugins/types.d.ts +34 -0
  245. package/node_modules/@opentui/core/post/effects.d.ts +147 -0
  246. package/node_modules/@opentui/core/post/filters.d.ts +65 -0
  247. package/node_modules/@opentui/core/post/matrices.d.ts +20 -0
  248. package/node_modules/@opentui/core/renderables/ASCIIFont.d.ts +52 -0
  249. package/node_modules/@opentui/core/renderables/Box.d.ts +72 -0
  250. package/node_modules/@opentui/core/renderables/Code.d.ts +78 -0
  251. package/node_modules/@opentui/core/renderables/Diff.d.ts +142 -0
  252. package/node_modules/@opentui/core/renderables/EditBufferRenderable.d.ts +162 -0
  253. package/node_modules/@opentui/core/renderables/FrameBuffer.d.ts +16 -0
  254. package/node_modules/@opentui/core/renderables/Input.d.ts +67 -0
  255. package/node_modules/@opentui/core/renderables/LineNumberRenderable.d.ts +78 -0
  256. package/node_modules/@opentui/core/renderables/Markdown.d.ts +181 -0
  257. package/node_modules/@opentui/core/renderables/ScrollBar.d.ts +77 -0
  258. package/node_modules/@opentui/core/renderables/ScrollBox.d.ts +124 -0
  259. package/node_modules/@opentui/core/renderables/Select.d.ts +115 -0
  260. package/node_modules/@opentui/core/renderables/Slider.d.ts +44 -0
  261. package/node_modules/@opentui/core/renderables/TabSelect.d.ts +96 -0
  262. package/node_modules/@opentui/core/renderables/Text.d.ts +36 -0
  263. package/node_modules/@opentui/core/renderables/TextBufferRenderable.d.ts +105 -0
  264. package/node_modules/@opentui/core/renderables/TextNode.d.ts +91 -0
  265. package/node_modules/@opentui/core/renderables/TextTable.d.ts +140 -0
  266. package/node_modules/@opentui/core/renderables/Textarea.d.ts +114 -0
  267. package/node_modules/@opentui/core/renderables/TimeToFirstDraw.d.ts +24 -0
  268. package/node_modules/@opentui/core/renderables/__tests__/renderable-test-utils.d.ts +12 -0
  269. package/node_modules/@opentui/core/renderables/composition/VRenderable.d.ts +16 -0
  270. package/node_modules/@opentui/core/renderables/composition/constructs.d.ts +35 -0
  271. package/node_modules/@opentui/core/renderables/composition/vnode.d.ts +46 -0
  272. package/node_modules/@opentui/core/renderables/index.d.ts +22 -0
  273. package/node_modules/@opentui/core/renderables/markdown-parser.d.ts +10 -0
  274. package/node_modules/@opentui/core/renderer.d.ts +416 -0
  275. package/node_modules/@opentui/core/runtime-plugin-support.d.ts +3 -0
  276. package/node_modules/@opentui/core/runtime-plugin-support.js +29 -0
  277. package/node_modules/@opentui/core/runtime-plugin-support.js.map +10 -0
  278. package/node_modules/@opentui/core/runtime-plugin.d.ts +11 -0
  279. package/node_modules/@opentui/core/runtime-plugin.js +16 -0
  280. package/node_modules/@opentui/core/runtime-plugin.js.map +9 -0
  281. package/node_modules/@opentui/core/syntax-style.d.ts +54 -0
  282. package/node_modules/@opentui/core/testing/manual-clock.d.ts +17 -0
  283. package/node_modules/@opentui/core/testing/mock-keys.d.ts +81 -0
  284. package/node_modules/@opentui/core/testing/mock-mouse.d.ts +38 -0
  285. package/node_modules/@opentui/core/testing/mock-tree-sitter-client.d.ts +23 -0
  286. package/node_modules/@opentui/core/testing/spy.d.ts +7 -0
  287. package/node_modules/@opentui/core/testing/test-recorder.d.ts +61 -0
  288. package/node_modules/@opentui/core/testing/test-renderer.d.ts +23 -0
  289. package/node_modules/@opentui/core/testing.d.ts +6 -0
  290. package/node_modules/@opentui/core/testing.js +692 -0
  291. package/node_modules/@opentui/core/testing.js.map +15 -0
  292. package/node_modules/@opentui/core/text-buffer-view.d.ts +42 -0
  293. package/node_modules/@opentui/core/text-buffer.d.ts +67 -0
  294. package/node_modules/@opentui/core/types.d.ts +136 -0
  295. package/node_modules/@opentui/core/utils.d.ts +14 -0
  296. package/node_modules/@opentui/core/zig-structs.d.ts +155 -0
  297. package/node_modules/@opentui/core/zig.d.ts +353 -0
  298. package/node_modules/@opentui/core-darwin-arm64/LICENSE +21 -0
  299. package/node_modules/@opentui/core-darwin-arm64/README.md +3 -0
  300. package/node_modules/@opentui/core-darwin-arm64/index.ts +3 -0
  301. package/node_modules/@opentui/core-darwin-arm64/libopentui.dylib +0 -0
  302. package/node_modules/@opentui/core-darwin-arm64/package.json +23 -0
  303. package/node_modules/@opentui/core-darwin-x64/LICENSE +21 -0
  304. package/node_modules/@opentui/core-darwin-x64/README.md +3 -0
  305. package/node_modules/@opentui/core-darwin-x64/index.ts +3 -0
  306. package/node_modules/@opentui/core-darwin-x64/libopentui.dylib +0 -0
  307. package/node_modules/@opentui/core-darwin-x64/package.json +23 -0
  308. package/node_modules/@opentui/core-linux-arm64/LICENSE +21 -0
  309. package/node_modules/@opentui/core-linux-arm64/README.md +3 -0
  310. package/node_modules/@opentui/core-linux-arm64/index.ts +3 -0
  311. package/node_modules/@opentui/core-linux-arm64/libopentui.so +0 -0
  312. package/node_modules/@opentui/core-linux-arm64/package.json +23 -0
  313. package/node_modules/@opentui/core-linux-x64/LICENSE +21 -0
  314. package/node_modules/@opentui/core-linux-x64/README.md +3 -0
  315. package/node_modules/@opentui/core-linux-x64/index.ts +3 -0
  316. package/node_modules/@opentui/core-linux-x64/libopentui.so +0 -0
  317. package/node_modules/@opentui/core-linux-x64/package.json +23 -0
  318. package/node_modules/@opentui/core-win32-x64/LICENSE +21 -0
  319. package/node_modules/@opentui/core-win32-x64/README.md +3 -0
  320. package/node_modules/@opentui/core-win32-x64/index.ts +3 -0
  321. package/node_modules/@opentui/core-win32-x64/opentui.dll +0 -0
  322. package/node_modules/@opentui/core-win32-x64/package.json +23 -0
  323. package/node_modules/web-tree-sitter/LICENSE +21 -0
  324. package/node_modules/web-tree-sitter/README.md +269 -0
  325. package/node_modules/web-tree-sitter/debug/tree-sitter.cjs +4558 -0
  326. package/node_modules/web-tree-sitter/debug/tree-sitter.cjs.map +7 -0
  327. package/node_modules/web-tree-sitter/debug/tree-sitter.js +4516 -0
  328. package/node_modules/web-tree-sitter/debug/tree-sitter.js.map +7 -0
  329. package/node_modules/web-tree-sitter/debug/tree-sitter.wasm +0 -0
  330. package/node_modules/web-tree-sitter/debug/tree-sitter.wasm.map +31 -0
  331. package/node_modules/web-tree-sitter/lib/alloc.c +48 -0
  332. package/node_modules/web-tree-sitter/lib/alloc.h +41 -0
  333. package/node_modules/web-tree-sitter/lib/array.h +291 -0
  334. package/node_modules/web-tree-sitter/lib/atomic.h +68 -0
  335. package/node_modules/web-tree-sitter/lib/clock.h +146 -0
  336. package/node_modules/web-tree-sitter/lib/error_costs.h +11 -0
  337. package/node_modules/web-tree-sitter/lib/get_changed_ranges.c +523 -0
  338. package/node_modules/web-tree-sitter/lib/get_changed_ranges.h +36 -0
  339. package/node_modules/web-tree-sitter/lib/host.h +21 -0
  340. package/node_modules/web-tree-sitter/lib/language.c +293 -0
  341. package/node_modules/web-tree-sitter/lib/language.h +293 -0
  342. package/node_modules/web-tree-sitter/lib/length.h +52 -0
  343. package/node_modules/web-tree-sitter/lib/lexer.c +483 -0
  344. package/node_modules/web-tree-sitter/lib/lexer.h +54 -0
  345. package/node_modules/web-tree-sitter/lib/lib.c +12 -0
  346. package/node_modules/web-tree-sitter/lib/node.c +875 -0
  347. package/node_modules/web-tree-sitter/lib/parser.c +2297 -0
  348. package/node_modules/web-tree-sitter/lib/parser.h +286 -0
  349. package/node_modules/web-tree-sitter/lib/point.h +48 -0
  350. package/node_modules/web-tree-sitter/lib/query.c +4347 -0
  351. package/node_modules/web-tree-sitter/lib/reduce_action.h +34 -0
  352. package/node_modules/web-tree-sitter/lib/reusable_node.h +95 -0
  353. package/node_modules/web-tree-sitter/lib/stack.c +912 -0
  354. package/node_modules/web-tree-sitter/lib/stack.h +133 -0
  355. package/node_modules/web-tree-sitter/lib/subtree.c +1034 -0
  356. package/node_modules/web-tree-sitter/lib/subtree.h +399 -0
  357. package/node_modules/web-tree-sitter/lib/tree-sitter.c +987 -0
  358. package/node_modules/web-tree-sitter/lib/tree-sitter.cjs +2988 -0
  359. package/node_modules/web-tree-sitter/lib/tree-sitter.wasm +0 -0
  360. package/node_modules/web-tree-sitter/lib/tree-sitter.wasm.map +1 -0
  361. package/node_modules/web-tree-sitter/lib/tree.c +170 -0
  362. package/node_modules/web-tree-sitter/lib/tree.h +31 -0
  363. package/node_modules/web-tree-sitter/lib/tree_cursor.c +716 -0
  364. package/node_modules/web-tree-sitter/lib/tree_cursor.h +48 -0
  365. package/node_modules/web-tree-sitter/lib/ts_assert.h +11 -0
  366. package/node_modules/web-tree-sitter/lib/unicode.h +75 -0
  367. package/node_modules/web-tree-sitter/lib/wasm_store.c +1937 -0
  368. package/node_modules/web-tree-sitter/lib/wasm_store.h +31 -0
  369. package/node_modules/web-tree-sitter/package.json +98 -0
  370. package/node_modules/web-tree-sitter/src/bindings.ts +26 -0
  371. package/node_modules/web-tree-sitter/src/constants.ts +133 -0
  372. package/node_modules/web-tree-sitter/src/index.ts +31 -0
  373. package/node_modules/web-tree-sitter/src/language.ts +291 -0
  374. package/node_modules/web-tree-sitter/src/lookahead_iterator.ts +75 -0
  375. package/node_modules/web-tree-sitter/src/marshal.ts +176 -0
  376. package/node_modules/web-tree-sitter/src/node.ts +646 -0
  377. package/node_modules/web-tree-sitter/src/parser.ts +325 -0
  378. package/node_modules/web-tree-sitter/src/query.ts +973 -0
  379. package/node_modules/web-tree-sitter/src/tree.ts +145 -0
  380. package/node_modules/web-tree-sitter/src/tree_cursor.ts +318 -0
  381. package/node_modules/web-tree-sitter/tree-sitter.cjs +4031 -0
  382. package/node_modules/web-tree-sitter/tree-sitter.cjs.map +7 -0
  383. package/node_modules/web-tree-sitter/tree-sitter.js +3980 -0
  384. package/node_modules/web-tree-sitter/tree-sitter.js.map +7 -0
  385. package/node_modules/web-tree-sitter/tree-sitter.wasm +0 -0
  386. package/node_modules/web-tree-sitter/tree-sitter.wasm.map +30 -0
  387. package/node_modules/web-tree-sitter/web-tree-sitter.d.ts +1030 -0
  388. package/node_modules/web-tree-sitter/web-tree-sitter.d.ts.map +56 -0
  389. package/package.json +9 -3
  390. package/xyne-macos-intel +0 -0
@@ -0,0 +1,891 @@
1
+ // @bun
2
+ var __require = import.meta.require;
3
+
4
+ // src/lib/tree-sitter/parser.worker.ts
5
+ import { Parser, Query, Language } from "web-tree-sitter";
6
+ import { mkdir as mkdir2 } from "fs/promises";
7
+ import * as path2 from "path";
8
+
9
+ // src/lib/tree-sitter/download-utils.ts
10
+ import { mkdir, readFile, writeFile } from "fs/promises";
11
+ import * as path from "path";
12
+
13
+ class DownloadUtils {
14
+ static hashUrl(url) {
15
+ let hash = 0;
16
+ for (let i = 0;i < url.length; i++) {
17
+ const char = url.charCodeAt(i);
18
+ hash = (hash << 5) - hash + char;
19
+ hash = hash & hash;
20
+ }
21
+ return Math.abs(hash).toString(16);
22
+ }
23
+ static async downloadOrLoad(source, cacheDir, cacheSubdir, fileExtension, useHashForCache = true, filetype) {
24
+ const isUrl = source.startsWith("http://") || source.startsWith("https://");
25
+ if (isUrl) {
26
+ let cacheFileName;
27
+ if (useHashForCache) {
28
+ const hash = this.hashUrl(source);
29
+ cacheFileName = filetype ? `${filetype}-${hash}${fileExtension}` : `${hash}${fileExtension}`;
30
+ } else {
31
+ cacheFileName = path.basename(source);
32
+ }
33
+ const cacheFile = path.join(cacheDir, cacheSubdir, cacheFileName);
34
+ await mkdir(path.dirname(cacheFile), { recursive: true });
35
+ try {
36
+ const cachedContent = await readFile(cacheFile);
37
+ if (cachedContent.byteLength > 0) {
38
+ console.log(`Loaded from cache: ${cacheFile} (${source})`);
39
+ return { content: cachedContent, filePath: cacheFile };
40
+ }
41
+ } catch (error) {}
42
+ try {
43
+ console.log(`Downloading from URL: ${source}`);
44
+ const response = await fetch(source);
45
+ if (!response.ok) {
46
+ return { error: `Failed to fetch from ${source}: ${response.statusText}` };
47
+ }
48
+ const content = Buffer.from(await response.arrayBuffer());
49
+ try {
50
+ await writeFile(cacheFile, Buffer.from(content));
51
+ console.log(`Cached: ${source}`);
52
+ } catch (cacheError) {
53
+ console.warn(`Failed to cache: ${cacheError}`);
54
+ }
55
+ return { content, filePath: cacheFile };
56
+ } catch (error) {
57
+ return { error: `Error downloading from ${source}: ${error}` };
58
+ }
59
+ } else {
60
+ try {
61
+ console.log(`Loading from local path: ${source}`);
62
+ const content = await readFile(source);
63
+ return { content, filePath: source };
64
+ } catch (error) {
65
+ return { error: `Error loading from local path ${source}: ${error}` };
66
+ }
67
+ }
68
+ }
69
+ static async downloadToPath(source, targetPath) {
70
+ const isUrl = source.startsWith("http://") || source.startsWith("https://");
71
+ await mkdir(path.dirname(targetPath), { recursive: true });
72
+ if (isUrl) {
73
+ try {
74
+ console.log(`Downloading from URL: ${source}`);
75
+ const response = await fetch(source);
76
+ if (!response.ok) {
77
+ return { error: `Failed to fetch from ${source}: ${response.statusText}` };
78
+ }
79
+ const content = Buffer.from(await response.arrayBuffer());
80
+ await writeFile(targetPath, Buffer.from(content));
81
+ console.log(`Downloaded: ${source} -> ${targetPath}`);
82
+ return { content, filePath: targetPath };
83
+ } catch (error) {
84
+ return { error: `Error downloading from ${source}: ${error}` };
85
+ }
86
+ } else {
87
+ try {
88
+ console.log(`Copying from local path: ${source}`);
89
+ const content = await readFile(source);
90
+ await writeFile(targetPath, Buffer.from(content));
91
+ return { content, filePath: targetPath };
92
+ } catch (error) {
93
+ return { error: `Error copying from local path ${source}: ${error}` };
94
+ }
95
+ }
96
+ }
97
+ static async fetchHighlightQueries(sources, cacheDir, filetype) {
98
+ const queryPromises = sources.map((source) => this.fetchHighlightQuery(source, cacheDir, filetype));
99
+ const queryResults = await Promise.all(queryPromises);
100
+ const validQueries = queryResults.filter((query) => query.trim().length > 0);
101
+ return validQueries.join(`
102
+ `);
103
+ }
104
+ static async fetchHighlightQuery(source, cacheDir, filetype) {
105
+ const result = await this.downloadOrLoad(source, cacheDir, "queries", ".scm", true, filetype);
106
+ if (result.error) {
107
+ console.error(`Error fetching highlight query from ${source}:`, result.error);
108
+ return "";
109
+ }
110
+ if (result.content) {
111
+ return new TextDecoder().decode(result.content);
112
+ }
113
+ return "";
114
+ }
115
+ }
116
+
117
+ // src/lib/tree-sitter/parser.worker.ts
118
+ import { isMainThread } from "worker_threads";
119
+
120
+ // src/lib/bunfs.ts
121
+ import { basename as basename2, join as join2 } from "path";
122
+ function isBunfsPath(path2) {
123
+ return path2.includes("$bunfs") || /^B:[\\/]~BUN/i.test(path2);
124
+ }
125
+ function getBunfsRootPath() {
126
+ return process.platform === "win32" ? "B:\\~BUN\\root" : "/$bunfs/root";
127
+ }
128
+ function normalizeBunfsPath(fileName) {
129
+ return join2(getBunfsRootPath(), basename2(fileName));
130
+ }
131
+
132
+ // src/lib/tree-sitter/parser.worker.ts
133
+ var self = globalThis;
134
+
135
+ class ParserWorker {
136
+ bufferParsers = new Map;
137
+ filetypeParserOptions = new Map;
138
+ filetypeAliases = new Map;
139
+ filetypeParsers = new Map;
140
+ filetypeParserPromises = new Map;
141
+ reusableParsers = new Map;
142
+ reusableParserPromises = new Map;
143
+ initializePromise;
144
+ performance;
145
+ dataPath;
146
+ tsDataPath;
147
+ initialized = false;
148
+ constructor() {
149
+ this.performance = {
150
+ averageParseTime: 0,
151
+ parseTimes: [],
152
+ averageQueryTime: 0,
153
+ queryTimes: []
154
+ };
155
+ }
156
+ async fetchQueries(sources, filetype) {
157
+ if (!this.tsDataPath) {
158
+ return "";
159
+ }
160
+ return DownloadUtils.fetchHighlightQueries(sources, this.tsDataPath, filetype);
161
+ }
162
+ async initialize({ dataPath }) {
163
+ if (this.initializePromise) {
164
+ return this.initializePromise;
165
+ }
166
+ this.initializePromise = (async () => {
167
+ this.dataPath = dataPath;
168
+ this.tsDataPath = path2.join(dataPath, "tree-sitter");
169
+ await mkdir2(path2.join(this.tsDataPath, "languages"), { recursive: true });
170
+ await mkdir2(path2.join(this.tsDataPath, "queries"), { recursive: true });
171
+ let { default: treeWasm } = await import("web-tree-sitter/tree-sitter.wasm", {
172
+ with: { type: "wasm" }
173
+ });
174
+ if (isBunfsPath(treeWasm)) {
175
+ treeWasm = normalizeBunfsPath(path2.parse(treeWasm).base);
176
+ }
177
+ await Parser.init({
178
+ locateFile() {
179
+ return treeWasm;
180
+ }
181
+ });
182
+ this.initialized = true;
183
+ })();
184
+ return this.initializePromise;
185
+ }
186
+ addFiletypeParser(filetypeParser) {
187
+ const previousAliases = this.filetypeParserOptions.get(filetypeParser.filetype)?.aliases ?? [];
188
+ for (const alias of previousAliases) {
189
+ if (this.filetypeAliases.get(alias) === filetypeParser.filetype) {
190
+ this.filetypeAliases.delete(alias);
191
+ }
192
+ }
193
+ const aliases = [...new Set((filetypeParser.aliases ?? []).filter((alias) => alias !== filetypeParser.filetype))];
194
+ this.filetypeAliases.delete(filetypeParser.filetype);
195
+ this.filetypeParserOptions.set(filetypeParser.filetype, {
196
+ ...filetypeParser,
197
+ aliases
198
+ });
199
+ for (const alias of aliases) {
200
+ this.filetypeAliases.set(alias, filetypeParser.filetype);
201
+ }
202
+ this.invalidateParserCaches(filetypeParser.filetype);
203
+ }
204
+ resolveCanonicalFiletype(filetype) {
205
+ if (this.filetypeParserOptions.has(filetype)) {
206
+ return filetype;
207
+ }
208
+ return this.filetypeAliases.get(filetype) ?? filetype;
209
+ }
210
+ invalidateParserCaches(filetype) {
211
+ this.filetypeParsers.delete(filetype);
212
+ this.filetypeParserPromises.delete(filetype);
213
+ const reusableParser = this.reusableParsers.get(filetype);
214
+ if (reusableParser) {
215
+ reusableParser.parser.delete();
216
+ this.reusableParsers.delete(filetype);
217
+ }
218
+ this.reusableParserPromises.delete(filetype);
219
+ }
220
+ async createQueries(filetypeParser, language) {
221
+ try {
222
+ const highlightQueryContent = await this.fetchQueries(filetypeParser.queries.highlights, filetypeParser.filetype);
223
+ if (!highlightQueryContent) {
224
+ console.error("Failed to fetch highlight queries for:", filetypeParser.filetype);
225
+ return;
226
+ }
227
+ const highlightsQuery = new Query(language, highlightQueryContent);
228
+ const result = {
229
+ highlights: highlightsQuery
230
+ };
231
+ if (filetypeParser.queries.injections && filetypeParser.queries.injections.length > 0) {
232
+ const injectionQueryContent = await this.fetchQueries(filetypeParser.queries.injections, filetypeParser.filetype);
233
+ if (injectionQueryContent) {
234
+ result.injections = new Query(language, injectionQueryContent);
235
+ }
236
+ }
237
+ return result;
238
+ } catch (error) {
239
+ console.error("Error creating queries for", filetypeParser.filetype, filetypeParser.queries);
240
+ console.error(error);
241
+ return;
242
+ }
243
+ }
244
+ async loadLanguage(languageSource) {
245
+ if (!this.initialized || !this.tsDataPath) {
246
+ return;
247
+ }
248
+ const result = await DownloadUtils.downloadOrLoad(languageSource, this.tsDataPath, "languages", ".wasm", false);
249
+ if (result.error) {
250
+ console.error(`Error loading language ${languageSource}:`, result.error);
251
+ return;
252
+ }
253
+ if (!result.filePath) {
254
+ return;
255
+ }
256
+ const normalizedPath = result.filePath.replaceAll("\\", "/");
257
+ try {
258
+ const language = await Language.load(normalizedPath);
259
+ return language;
260
+ } catch (error) {
261
+ console.error(`Error loading language from ${normalizedPath}:`, error);
262
+ return;
263
+ }
264
+ }
265
+ async resolveFiletypeParser(filetype) {
266
+ const canonicalFiletype = this.resolveCanonicalFiletype(filetype);
267
+ if (this.filetypeParsers.has(canonicalFiletype)) {
268
+ return this.filetypeParsers.get(canonicalFiletype);
269
+ }
270
+ if (this.filetypeParserPromises.has(canonicalFiletype)) {
271
+ return this.filetypeParserPromises.get(canonicalFiletype);
272
+ }
273
+ const loadingPromise = this.loadFiletypeParser(canonicalFiletype);
274
+ this.filetypeParserPromises.set(canonicalFiletype, loadingPromise);
275
+ try {
276
+ const result = await loadingPromise;
277
+ if (result) {
278
+ this.filetypeParsers.set(canonicalFiletype, result);
279
+ }
280
+ return result;
281
+ } finally {
282
+ this.filetypeParserPromises.delete(canonicalFiletype);
283
+ }
284
+ }
285
+ async loadFiletypeParser(filetype) {
286
+ const filetypeParserOptions = this.filetypeParserOptions.get(filetype);
287
+ if (!filetypeParserOptions) {
288
+ return;
289
+ }
290
+ const language = await this.loadLanguage(filetypeParserOptions.wasm);
291
+ if (!language) {
292
+ return;
293
+ }
294
+ const queries = await this.createQueries(filetypeParserOptions, language);
295
+ if (!queries) {
296
+ console.error("Failed to create queries for:", filetype);
297
+ return;
298
+ }
299
+ const filetypeParser = {
300
+ ...filetypeParserOptions,
301
+ queries,
302
+ language
303
+ };
304
+ return filetypeParser;
305
+ }
306
+ async preloadParser(filetype) {
307
+ return this.resolveFiletypeParser(filetype);
308
+ }
309
+ async getReusableParser(filetype) {
310
+ const canonicalFiletype = this.resolveCanonicalFiletype(filetype);
311
+ if (this.reusableParsers.has(canonicalFiletype)) {
312
+ return this.reusableParsers.get(canonicalFiletype);
313
+ }
314
+ if (this.reusableParserPromises.has(canonicalFiletype)) {
315
+ return this.reusableParserPromises.get(canonicalFiletype);
316
+ }
317
+ const creationPromise = this.createReusableParser(canonicalFiletype);
318
+ this.reusableParserPromises.set(canonicalFiletype, creationPromise);
319
+ try {
320
+ const result = await creationPromise;
321
+ if (result) {
322
+ this.reusableParsers.set(canonicalFiletype, result);
323
+ }
324
+ return result;
325
+ } finally {
326
+ this.reusableParserPromises.delete(canonicalFiletype);
327
+ }
328
+ }
329
+ async createReusableParser(filetype) {
330
+ const filetypeParser = await this.resolveFiletypeParser(filetype);
331
+ if (!filetypeParser) {
332
+ return;
333
+ }
334
+ const parser = new Parser;
335
+ parser.setLanguage(filetypeParser.language);
336
+ const reusableState = {
337
+ parser,
338
+ filetypeParser,
339
+ queries: filetypeParser.queries
340
+ };
341
+ return reusableState;
342
+ }
343
+ async handleInitializeParser(bufferId, version, content, filetype, messageId) {
344
+ const filetypeParser = await this.resolveFiletypeParser(filetype);
345
+ if (!filetypeParser) {
346
+ self.postMessage({
347
+ type: "PARSER_INIT_RESPONSE",
348
+ bufferId,
349
+ messageId,
350
+ hasParser: false,
351
+ warning: `No parser available for filetype ${filetype}`
352
+ });
353
+ return;
354
+ }
355
+ const parser = new Parser;
356
+ parser.setLanguage(filetypeParser.language);
357
+ const tree = parser.parse(content);
358
+ if (!tree) {
359
+ self.postMessage({
360
+ type: "PARSER_INIT_RESPONSE",
361
+ bufferId,
362
+ messageId,
363
+ hasParser: false,
364
+ error: "Failed to parse buffer"
365
+ });
366
+ return;
367
+ }
368
+ const parserState = {
369
+ parser,
370
+ tree,
371
+ queries: filetypeParser.queries,
372
+ filetype,
373
+ content,
374
+ injectionMapping: filetypeParser.injectionMapping
375
+ };
376
+ this.bufferParsers.set(bufferId, parserState);
377
+ self.postMessage({
378
+ type: "PARSER_INIT_RESPONSE",
379
+ bufferId,
380
+ messageId,
381
+ hasParser: true
382
+ });
383
+ const highlights = await this.initialQuery(parserState);
384
+ self.postMessage({
385
+ type: "HIGHLIGHT_RESPONSE",
386
+ bufferId,
387
+ version,
388
+ ...highlights
389
+ });
390
+ }
391
+ async initialQuery(parserState) {
392
+ const query = parserState.queries.highlights;
393
+ const matches = query.captures(parserState.tree.rootNode);
394
+ let injectionRanges = new Map;
395
+ if (parserState.queries.injections) {
396
+ const injectionResult = await this.processInjections(parserState);
397
+ matches.push(...injectionResult.captures);
398
+ injectionRanges = injectionResult.injectionRanges;
399
+ }
400
+ return this.getHighlights(parserState, matches, injectionRanges);
401
+ }
402
+ getNodeText(node, content) {
403
+ return content.substring(node.startIndex, node.endIndex);
404
+ }
405
+ async processInjections(parserState) {
406
+ const injectionMatches = [];
407
+ const injectionRanges = new Map;
408
+ if (!parserState.queries.injections) {
409
+ return { captures: injectionMatches, injectionRanges };
410
+ }
411
+ const content = parserState.content;
412
+ const injectionCaptures = parserState.queries.injections.captures(parserState.tree.rootNode);
413
+ const languageGroups = new Map;
414
+ const injectionMapping = parserState.injectionMapping;
415
+ for (const capture of injectionCaptures) {
416
+ const captureName = capture.name;
417
+ if (captureName === "injection.content" || captureName.includes("injection")) {
418
+ const nodeType = capture.node.type;
419
+ let targetLanguage;
420
+ if (injectionMapping?.nodeTypes && injectionMapping.nodeTypes[nodeType]) {
421
+ targetLanguage = injectionMapping.nodeTypes[nodeType];
422
+ } else if (nodeType === "code_fence_content") {
423
+ const parent = capture.node.parent;
424
+ if (parent) {
425
+ const infoString = parent.children.find((child) => child.type === "info_string");
426
+ if (infoString) {
427
+ const languageNode = infoString.children.find((child) => child.type === "language");
428
+ if (languageNode) {
429
+ const languageName = this.getNodeText(languageNode, content);
430
+ if (injectionMapping?.infoStringMap && injectionMapping.infoStringMap[languageName]) {
431
+ targetLanguage = injectionMapping.infoStringMap[languageName];
432
+ } else {
433
+ targetLanguage = languageName;
434
+ }
435
+ }
436
+ }
437
+ }
438
+ }
439
+ if (targetLanguage) {
440
+ if (!languageGroups.has(targetLanguage)) {
441
+ languageGroups.set(targetLanguage, []);
442
+ }
443
+ languageGroups.get(targetLanguage).push({ node: capture.node, name: capture.name });
444
+ }
445
+ }
446
+ }
447
+ for (const [language, captures] of languageGroups.entries()) {
448
+ const injectedParser = await this.getReusableParser(language);
449
+ if (!injectedParser) {
450
+ console.warn(`No parser found for injection language: ${language}`);
451
+ continue;
452
+ }
453
+ if (!injectionRanges.has(language)) {
454
+ injectionRanges.set(language, []);
455
+ }
456
+ const parser = injectedParser.parser;
457
+ for (const { node: injectionNode } of captures) {
458
+ try {
459
+ injectionRanges.get(language).push({
460
+ start: injectionNode.startIndex,
461
+ end: injectionNode.endIndex
462
+ });
463
+ const injectionContent = this.getNodeText(injectionNode, content);
464
+ const tree = parser.parse(injectionContent);
465
+ if (tree) {
466
+ const matches = injectedParser.queries.highlights.captures(tree.rootNode);
467
+ for (const match of matches) {
468
+ const offsetCapture = {
469
+ name: match.name,
470
+ patternIndex: match.patternIndex,
471
+ _injectedQuery: injectedParser.queries.highlights,
472
+ node: {
473
+ ...match.node,
474
+ startPosition: {
475
+ row: match.node.startPosition.row + injectionNode.startPosition.row,
476
+ column: match.node.startPosition.row === 0 ? match.node.startPosition.column + injectionNode.startPosition.column : match.node.startPosition.column
477
+ },
478
+ endPosition: {
479
+ row: match.node.endPosition.row + injectionNode.startPosition.row,
480
+ column: match.node.endPosition.row === 0 ? match.node.endPosition.column + injectionNode.startPosition.column : match.node.endPosition.column
481
+ },
482
+ startIndex: match.node.startIndex + injectionNode.startIndex,
483
+ endIndex: match.node.endIndex + injectionNode.startIndex
484
+ }
485
+ };
486
+ injectionMatches.push(offsetCapture);
487
+ }
488
+ tree.delete();
489
+ }
490
+ } catch (error) {
491
+ console.error(`Error processing injection for language ${language}:`, error);
492
+ }
493
+ }
494
+ }
495
+ return { captures: injectionMatches, injectionRanges };
496
+ }
497
+ editToRange(edit) {
498
+ return {
499
+ startPosition: {
500
+ column: edit.startPosition.column,
501
+ row: edit.startPosition.row
502
+ },
503
+ endPosition: {
504
+ column: edit.newEndPosition.column,
505
+ row: edit.newEndPosition.row
506
+ },
507
+ startIndex: edit.startIndex,
508
+ endIndex: edit.newEndIndex
509
+ };
510
+ }
511
+ async handleEdits(bufferId, content, edits) {
512
+ const parserState = this.bufferParsers.get(bufferId);
513
+ if (!parserState) {
514
+ return { warning: "No parser state found for buffer" };
515
+ }
516
+ parserState.content = content;
517
+ for (const edit of edits) {
518
+ parserState.tree.edit(edit);
519
+ }
520
+ const startParse = performance.now();
521
+ const newTree = parserState.parser.parse(content, parserState.tree);
522
+ const endParse = performance.now();
523
+ const parseTime = endParse - startParse;
524
+ this.performance.parseTimes.push(parseTime);
525
+ if (this.performance.parseTimes.length > 10) {
526
+ this.performance.parseTimes.shift();
527
+ }
528
+ this.performance.averageParseTime = this.performance.parseTimes.reduce((acc, time) => acc + time, 0) / this.performance.parseTimes.length;
529
+ if (!newTree) {
530
+ return { error: "Failed to parse buffer" };
531
+ }
532
+ const changedRanges = parserState.tree.getChangedRanges(newTree);
533
+ parserState.tree = newTree;
534
+ const startQuery = performance.now();
535
+ const matches = [];
536
+ if (changedRanges.length === 0) {
537
+ edits.forEach((edit) => {
538
+ const range = this.editToRange(edit);
539
+ changedRanges.push(range);
540
+ });
541
+ }
542
+ for (const range of changedRanges) {
543
+ let node = parserState.tree.rootNode.descendantForPosition(range.startPosition, range.endPosition);
544
+ if (!node) {
545
+ continue;
546
+ }
547
+ if (node.equals(parserState.tree.rootNode)) {
548
+ const rangeCaptures = parserState.queries.highlights.captures(node, {
549
+ startIndex: range.startIndex - 100,
550
+ endIndex: range.endIndex + 1000
551
+ });
552
+ matches.push(...rangeCaptures);
553
+ continue;
554
+ }
555
+ while (node && !this.nodeContainsRange(node, range)) {
556
+ node = node.parent;
557
+ }
558
+ if (!node) {
559
+ node = parserState.tree.rootNode;
560
+ }
561
+ const nodeCaptures = parserState.queries.highlights.captures(node);
562
+ matches.push(...nodeCaptures);
563
+ }
564
+ let injectionRanges = new Map;
565
+ if (parserState.queries.injections) {
566
+ const injectionResult = await this.processInjections(parserState);
567
+ matches.push(...injectionResult.captures);
568
+ injectionRanges = injectionResult.injectionRanges;
569
+ }
570
+ const endQuery = performance.now();
571
+ const queryTime = endQuery - startQuery;
572
+ this.performance.queryTimes.push(queryTime);
573
+ if (this.performance.queryTimes.length > 10) {
574
+ this.performance.queryTimes.shift();
575
+ }
576
+ this.performance.averageQueryTime = this.performance.queryTimes.reduce((acc, time) => acc + time, 0) / this.performance.queryTimes.length;
577
+ return this.getHighlights(parserState, matches, injectionRanges);
578
+ }
579
+ nodeContainsRange(node, range) {
580
+ return node.startPosition.row <= range.startPosition.row && node.endPosition.row >= range.endPosition.row && (node.startPosition.row < range.startPosition.row || node.startPosition.column <= range.startPosition.column) && (node.endPosition.row > range.endPosition.row || node.endPosition.column >= range.endPosition.column);
581
+ }
582
+ getHighlights(parserState, matches, injectionRanges) {
583
+ const lineHighlights = new Map;
584
+ const droppedHighlights = new Map;
585
+ for (const match of matches) {
586
+ const node = match.node;
587
+ const startLine = node.startPosition.row;
588
+ const endLine = node.endPosition.row;
589
+ const highlight = {
590
+ startCol: node.startPosition.column,
591
+ endCol: node.endPosition.column,
592
+ group: match.name
593
+ };
594
+ if (!lineHighlights.has(startLine)) {
595
+ lineHighlights.set(startLine, new Map);
596
+ droppedHighlights.set(startLine, new Map);
597
+ }
598
+ if (lineHighlights.get(startLine)?.has(node.id)) {
599
+ droppedHighlights.get(startLine)?.set(node.id, lineHighlights.get(startLine)?.get(node.id));
600
+ }
601
+ lineHighlights.get(startLine)?.set(node.id, highlight);
602
+ if (startLine !== endLine) {
603
+ for (let line = startLine + 1;line <= endLine; line++) {
604
+ if (!lineHighlights.has(line)) {
605
+ lineHighlights.set(line, new Map);
606
+ }
607
+ const hl = {
608
+ startCol: 0,
609
+ endCol: node.endPosition.column,
610
+ group: match.name
611
+ };
612
+ lineHighlights.get(line)?.set(node.id, hl);
613
+ }
614
+ }
615
+ }
616
+ return {
617
+ highlights: Array.from(lineHighlights.entries()).map(([line, lineHighlights2]) => ({
618
+ line,
619
+ highlights: Array.from(lineHighlights2.values()),
620
+ droppedHighlights: droppedHighlights.get(line) ? Array.from(droppedHighlights.get(line).values()) : []
621
+ }))
622
+ };
623
+ }
624
+ getSimpleHighlights(matches, injectionRanges) {
625
+ const highlights = [];
626
+ const flatInjectionRanges = [];
627
+ for (const [lang, ranges] of injectionRanges.entries()) {
628
+ for (const range of ranges) {
629
+ flatInjectionRanges.push({ ...range, lang });
630
+ }
631
+ }
632
+ for (const match of matches) {
633
+ const node = match.node;
634
+ let isInjection = false;
635
+ let injectionLang;
636
+ let containsInjection = false;
637
+ for (const injRange of flatInjectionRanges) {
638
+ if (node.startIndex >= injRange.start && node.endIndex <= injRange.end) {
639
+ isInjection = true;
640
+ injectionLang = injRange.lang;
641
+ break;
642
+ } else if (node.startIndex <= injRange.start && node.endIndex >= injRange.end) {
643
+ containsInjection = true;
644
+ break;
645
+ }
646
+ }
647
+ const matchQuery = match._injectedQuery;
648
+ const patternProperties = matchQuery?.setProperties?.[match.patternIndex];
649
+ const concealValue = patternProperties?.conceal ?? match.setProperties?.conceal;
650
+ const concealLines = patternProperties?.conceal_lines ?? match.setProperties?.conceal_lines;
651
+ const meta = {};
652
+ if (isInjection && injectionLang) {
653
+ meta.isInjection = true;
654
+ meta.injectionLang = injectionLang;
655
+ }
656
+ if (containsInjection) {
657
+ meta.containsInjection = true;
658
+ }
659
+ if (concealValue !== undefined) {
660
+ meta.conceal = concealValue;
661
+ }
662
+ if (concealLines !== undefined) {
663
+ meta.concealLines = concealLines;
664
+ }
665
+ if (Object.keys(meta).length > 0) {
666
+ highlights.push([node.startIndex, node.endIndex, match.name, meta]);
667
+ } else {
668
+ highlights.push([node.startIndex, node.endIndex, match.name]);
669
+ }
670
+ }
671
+ highlights.sort((a, b) => a[0] - b[0]);
672
+ return highlights;
673
+ }
674
+ async handleResetBuffer(bufferId, version, content) {
675
+ const parserState = this.bufferParsers.get(bufferId);
676
+ if (!parserState) {
677
+ return { warning: "No parser state found for buffer" };
678
+ }
679
+ parserState.content = content;
680
+ const newTree = parserState.parser.parse(content);
681
+ if (!newTree) {
682
+ return { error: "Failed to parse buffer during reset" };
683
+ }
684
+ parserState.tree = newTree;
685
+ const matches = parserState.queries.highlights.captures(parserState.tree.rootNode);
686
+ let injectionRanges = new Map;
687
+ if (parserState.queries.injections) {
688
+ const injectionResult = await this.processInjections(parserState);
689
+ matches.push(...injectionResult.captures);
690
+ injectionRanges = injectionResult.injectionRanges;
691
+ }
692
+ return this.getHighlights(parserState, matches, injectionRanges);
693
+ }
694
+ disposeBuffer(bufferId) {
695
+ const parserState = this.bufferParsers.get(bufferId);
696
+ if (!parserState) {
697
+ return;
698
+ }
699
+ parserState.tree.delete();
700
+ parserState.parser.delete();
701
+ this.bufferParsers.delete(bufferId);
702
+ }
703
+ async handleOneShotHighlight(content, filetype, messageId) {
704
+ const reusableState = await this.getReusableParser(filetype);
705
+ if (!reusableState) {
706
+ self.postMessage({
707
+ type: "ONESHOT_HIGHLIGHT_RESPONSE",
708
+ messageId,
709
+ hasParser: false,
710
+ warning: `No parser available for filetype ${filetype}`
711
+ });
712
+ return;
713
+ }
714
+ const parseContent = filetype === "markdown" && content.endsWith("```") ? content + `
715
+ ` : content;
716
+ const tree = reusableState.parser.parse(parseContent);
717
+ if (!tree) {
718
+ self.postMessage({
719
+ type: "ONESHOT_HIGHLIGHT_RESPONSE",
720
+ messageId,
721
+ hasParser: false,
722
+ error: "Failed to parse content"
723
+ });
724
+ return;
725
+ }
726
+ try {
727
+ const matches = reusableState.filetypeParser.queries.highlights.captures(tree.rootNode);
728
+ let injectionRanges = new Map;
729
+ if (reusableState.filetypeParser.queries.injections) {
730
+ const parserState = {
731
+ parser: reusableState.parser,
732
+ tree,
733
+ queries: reusableState.filetypeParser.queries,
734
+ filetype,
735
+ content,
736
+ injectionMapping: reusableState.filetypeParser.injectionMapping
737
+ };
738
+ const injectionResult = await this.processInjections(parserState);
739
+ matches.push(...injectionResult.captures);
740
+ injectionRanges = injectionResult.injectionRanges;
741
+ }
742
+ const highlights = this.getSimpleHighlights(matches, injectionRanges);
743
+ self.postMessage({
744
+ type: "ONESHOT_HIGHLIGHT_RESPONSE",
745
+ messageId,
746
+ hasParser: true,
747
+ highlights
748
+ });
749
+ } finally {
750
+ tree.delete();
751
+ }
752
+ }
753
+ async updateDataPath(dataPath) {
754
+ this.dataPath = dataPath;
755
+ this.tsDataPath = path2.join(dataPath, "tree-sitter");
756
+ try {
757
+ await mkdir2(path2.join(this.tsDataPath, "languages"), { recursive: true });
758
+ await mkdir2(path2.join(this.tsDataPath, "queries"), { recursive: true });
759
+ } catch (error) {
760
+ throw new Error(`Failed to update data path: ${error}`);
761
+ }
762
+ }
763
+ async clearCache() {
764
+ if (!this.dataPath || !this.tsDataPath) {
765
+ throw new Error("No data path configured");
766
+ }
767
+ const { rm } = await import("fs/promises");
768
+ try {
769
+ const treeSitterPath = path2.join(this.dataPath, "tree-sitter");
770
+ await rm(treeSitterPath, { recursive: true, force: true });
771
+ await mkdir2(path2.join(treeSitterPath, "languages"), { recursive: true });
772
+ await mkdir2(path2.join(treeSitterPath, "queries"), { recursive: true });
773
+ this.filetypeParsers.clear();
774
+ this.filetypeParserPromises.clear();
775
+ this.reusableParsers.clear();
776
+ this.reusableParserPromises.clear();
777
+ } catch (error) {
778
+ throw new Error(`Failed to clear cache: ${error}`);
779
+ }
780
+ }
781
+ }
782
+ if (!isMainThread) {
783
+ let logMessage = function(type, ...args) {
784
+ self.postMessage({
785
+ type: "WORKER_LOG",
786
+ logType: type,
787
+ data: args
788
+ });
789
+ };
790
+ const worker = new ParserWorker;
791
+ console.log = (...args) => logMessage("log", ...args);
792
+ console.error = (...args) => logMessage("error", ...args);
793
+ console.warn = (...args) => logMessage("warn", ...args);
794
+ self.onmessage = async (e) => {
795
+ const { type, bufferId, version, content, filetype, edits, filetypeParser, messageId, dataPath } = e.data;
796
+ try {
797
+ switch (type) {
798
+ case "INIT":
799
+ try {
800
+ await worker.initialize({ dataPath });
801
+ self.postMessage({ type: "INIT_RESPONSE" });
802
+ } catch (error) {
803
+ self.postMessage({
804
+ type: "INIT_RESPONSE",
805
+ error: error instanceof Error ? error.stack || error.message : String(error)
806
+ });
807
+ }
808
+ break;
809
+ case "ADD_FILETYPE_PARSER":
810
+ worker.addFiletypeParser(filetypeParser);
811
+ break;
812
+ case "PRELOAD_PARSER":
813
+ const maybeParser = await worker.preloadParser(filetype);
814
+ self.postMessage({ type: "PRELOAD_PARSER_RESPONSE", messageId, hasParser: !!maybeParser });
815
+ break;
816
+ case "INITIALIZE_PARSER":
817
+ await worker.handleInitializeParser(bufferId, version, content, filetype, messageId);
818
+ break;
819
+ case "HANDLE_EDITS":
820
+ const response = await worker.handleEdits(bufferId, content, edits);
821
+ if (response.highlights && response.highlights.length > 0) {
822
+ self.postMessage({ type: "HIGHLIGHT_RESPONSE", bufferId, version, ...response });
823
+ } else if (response.warning) {
824
+ self.postMessage({ type: "WARNING", bufferId, warning: response.warning });
825
+ } else if (response.error) {
826
+ self.postMessage({ type: "ERROR", bufferId, error: response.error });
827
+ }
828
+ break;
829
+ case "GET_PERFORMANCE":
830
+ self.postMessage({ type: "PERFORMANCE_RESPONSE", performance: worker.performance, messageId });
831
+ break;
832
+ case "RESET_BUFFER":
833
+ const resetResponse = await worker.handleResetBuffer(bufferId, version, content);
834
+ if (resetResponse.highlights && resetResponse.highlights.length > 0) {
835
+ self.postMessage({ type: "HIGHLIGHT_RESPONSE", bufferId, version, ...resetResponse });
836
+ } else if (resetResponse.warning) {
837
+ self.postMessage({ type: "WARNING", bufferId, warning: resetResponse.warning });
838
+ } else if (resetResponse.error) {
839
+ self.postMessage({ type: "ERROR", bufferId, error: resetResponse.error });
840
+ }
841
+ break;
842
+ case "DISPOSE_BUFFER":
843
+ worker.disposeBuffer(bufferId);
844
+ self.postMessage({ type: "BUFFER_DISPOSED", bufferId });
845
+ break;
846
+ case "ONESHOT_HIGHLIGHT":
847
+ await worker.handleOneShotHighlight(content, filetype, messageId);
848
+ break;
849
+ case "UPDATE_DATA_PATH":
850
+ try {
851
+ await worker.updateDataPath(dataPath);
852
+ self.postMessage({ type: "UPDATE_DATA_PATH_RESPONSE", messageId });
853
+ } catch (error) {
854
+ self.postMessage({
855
+ type: "UPDATE_DATA_PATH_RESPONSE",
856
+ messageId,
857
+ error: error instanceof Error ? error.message : String(error)
858
+ });
859
+ }
860
+ break;
861
+ case "CLEAR_CACHE":
862
+ try {
863
+ await worker.clearCache();
864
+ self.postMessage({ type: "CLEAR_CACHE_RESPONSE", messageId });
865
+ } catch (error) {
866
+ self.postMessage({
867
+ type: "CLEAR_CACHE_RESPONSE",
868
+ messageId,
869
+ error: error instanceof Error ? error.message : String(error)
870
+ });
871
+ }
872
+ break;
873
+ default:
874
+ self.postMessage({
875
+ type: "ERROR",
876
+ bufferId,
877
+ error: `Unknown message type: ${type}`
878
+ });
879
+ }
880
+ } catch (error) {
881
+ self.postMessage({
882
+ type: "ERROR",
883
+ bufferId,
884
+ error: error instanceof Error ? error.stack || error.message : String(error)
885
+ });
886
+ }
887
+ };
888
+ }
889
+
890
+ //# debugId=DD1DC2FE99A4319364756E2164756E21
891
+ //# sourceMappingURL=parser.worker.js.map