typedoc 0.26.10 → 0.27.0-beta.0

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 (336) hide show
  1. package/bin/package.json +3 -0
  2. package/bin/typedoc +1 -1
  3. package/dist/index.d.ts +23 -13
  4. package/dist/index.js +22 -81
  5. package/dist/lib/application-events.js +1 -4
  6. package/dist/lib/application.d.ts +26 -16
  7. package/dist/lib/application.js +222 -242
  8. package/dist/lib/cli.js +3 -40
  9. package/dist/lib/converter/comments/blockLexer.d.ts +1 -1
  10. package/dist/lib/converter/comments/blockLexer.js +24 -30
  11. package/dist/lib/converter/comments/declarationReference.js +10 -21
  12. package/dist/lib/converter/comments/declarationReferenceResolver.d.ts +2 -2
  13. package/dist/lib/converter/comments/declarationReferenceResolver.js +40 -36
  14. package/dist/lib/converter/comments/discovery.d.ts +4 -4
  15. package/dist/lib/converter/comments/discovery.js +172 -148
  16. package/dist/lib/converter/comments/index.d.ts +4 -4
  17. package/dist/lib/converter/comments/index.js +39 -50
  18. package/dist/lib/converter/comments/lexer.d.ts +1 -1
  19. package/dist/lib/converter/comments/lexer.js +2 -5
  20. package/dist/lib/converter/comments/lineLexer.d.ts +1 -1
  21. package/dist/lib/converter/comments/lineLexer.js +12 -15
  22. package/dist/lib/converter/comments/linkResolver.d.ts +2 -2
  23. package/dist/lib/converter/comments/linkResolver.js +14 -21
  24. package/dist/lib/converter/comments/parser.d.ts +6 -6
  25. package/dist/lib/converter/comments/parser.js +69 -96
  26. package/dist/lib/converter/comments/rawLexer.d.ts +1 -1
  27. package/dist/lib/converter/comments/rawLexer.js +13 -16
  28. package/dist/lib/converter/comments/tagName.js +1 -4
  29. package/dist/lib/converter/comments/textParser.d.ts +4 -4
  30. package/dist/lib/converter/comments/textParser.js +28 -30
  31. package/dist/lib/converter/components.d.ts +2 -3
  32. package/dist/lib/converter/components.js +2 -7
  33. package/dist/lib/converter/context.d.ts +9 -9
  34. package/dist/lib/converter/context.js +54 -44
  35. package/dist/lib/converter/convert-expression.js +16 -23
  36. package/dist/lib/converter/converter-events.d.ts +1 -0
  37. package/dist/lib/converter/converter-events.js +2 -4
  38. package/dist/lib/converter/converter.d.ts +16 -13
  39. package/dist/lib/converter/converter.js +210 -238
  40. package/dist/lib/converter/factories/index-signature.d.ts +1 -1
  41. package/dist/lib/converter/factories/index-signature.js +11 -17
  42. package/dist/lib/converter/factories/signature.d.ts +2 -2
  43. package/dist/lib/converter/factories/signature.js +95 -106
  44. package/dist/lib/converter/index.d.ts +6 -7
  45. package/dist/lib/converter/index.js +3 -11
  46. package/dist/lib/converter/jsdoc.d.ts +1 -1
  47. package/dist/lib/converter/jsdoc.js +34 -41
  48. package/dist/lib/converter/plugins/CategoryPlugin.d.ts +6 -21
  49. package/dist/lib/converter/plugins/CategoryPlugin.js +57 -139
  50. package/dist/lib/converter/plugins/CommentPlugin.d.ts +3 -5
  51. package/dist/lib/converter/plugins/CommentPlugin.js +153 -163
  52. package/dist/lib/converter/plugins/GroupPlugin.d.ts +10 -9
  53. package/dist/lib/converter/plugins/GroupPlugin.js +87 -124
  54. package/dist/lib/converter/plugins/ImplementsPlugin.d.ts +3 -5
  55. package/dist/lib/converter/plugins/ImplementsPlugin.js +255 -321
  56. package/dist/lib/converter/plugins/IncludePlugin.d.ts +11 -0
  57. package/dist/lib/converter/plugins/IncludePlugin.js +72 -0
  58. package/dist/lib/converter/plugins/InheritDocPlugin.d.ts +4 -3
  59. package/dist/lib/converter/plugins/InheritDocPlugin.js +41 -72
  60. package/dist/lib/converter/plugins/LinkResolverPlugin.d.ts +5 -5
  61. package/dist/lib/converter/plugins/LinkResolverPlugin.js +37 -58
  62. package/dist/lib/converter/plugins/MergeModuleWithPlugin.d.ts +12 -0
  63. package/dist/lib/converter/plugins/MergeModuleWithPlugin.js +49 -0
  64. package/dist/lib/converter/plugins/PackagePlugin.d.ts +4 -3
  65. package/dist/lib/converter/plugins/PackagePlugin.js +62 -111
  66. package/dist/lib/converter/plugins/SourcePlugin.d.ts +3 -5
  67. package/dist/lib/converter/plugins/SourcePlugin.js +69 -110
  68. package/dist/lib/converter/plugins/TypePlugin.d.ts +4 -6
  69. package/dist/lib/converter/plugins/TypePlugin.js +95 -158
  70. package/dist/lib/converter/plugins/index.d.ts +10 -9
  71. package/dist/lib/converter/plugins/index.js +10 -21
  72. package/dist/lib/converter/symbols.d.ts +1 -1
  73. package/dist/lib/converter/symbols.js +234 -227
  74. package/dist/lib/converter/types.d.ts +2 -2
  75. package/dist/lib/converter/types.js +252 -237
  76. package/dist/lib/converter/utils/nodes.js +5 -13
  77. package/dist/lib/converter/utils/reflections.d.ts +1 -1
  78. package/dist/lib/converter/utils/reflections.js +4 -7
  79. package/dist/lib/converter/utils/repository.d.ts +1 -1
  80. package/dist/lib/converter/utils/repository.js +103 -97
  81. package/dist/lib/converter/utils/symbols.js +3 -9
  82. package/dist/lib/internationalization/index.d.ts +3 -4
  83. package/dist/lib/internationalization/index.js +3 -8
  84. package/dist/lib/internationalization/internationalization.d.ts +5 -4
  85. package/dist/lib/internationalization/internationalization.js +97 -103
  86. package/dist/lib/internationalization/locale-utils.cjs +8 -0
  87. package/dist/lib/internationalization/locale-utils.d.cts +8 -0
  88. package/dist/lib/internationalization/locales/en.cjs +366 -2
  89. package/dist/lib/internationalization/locales/en.d.cts +339 -2
  90. package/dist/lib/internationalization/locales/jp.cjs +8 -11
  91. package/dist/lib/internationalization/locales/jp.d.cts +310 -1
  92. package/dist/lib/internationalization/locales/ko.cjs +7 -9
  93. package/dist/lib/internationalization/locales/ko.d.cts +223 -1
  94. package/dist/lib/internationalization/locales/zh.cjs +7 -10
  95. package/dist/lib/internationalization/locales/zh.d.cts +381 -1
  96. package/dist/lib/internationalization/translatable.d.ts +4 -327
  97. package/dist/lib/internationalization/translatable.js +2 -360
  98. package/dist/lib/models/FileRegistry.d.ts +20 -9
  99. package/dist/lib/models/FileRegistry.js +54 -45
  100. package/dist/lib/models/ReflectionCategory.d.ts +2 -2
  101. package/dist/lib/models/ReflectionCategory.js +16 -12
  102. package/dist/lib/models/ReflectionGroup.d.ts +3 -3
  103. package/dist/lib/models/ReflectionGroup.js +23 -14
  104. package/dist/lib/models/comments/comment.d.ts +23 -37
  105. package/dist/lib/models/comments/comment.js +388 -325
  106. package/dist/lib/models/comments/index.d.ts +2 -2
  107. package/dist/lib/models/comments/index.js +1 -6
  108. package/dist/lib/models/index.d.ts +7 -7
  109. package/dist/lib/models/index.js +7 -23
  110. package/dist/lib/models/reflections/ReflectionSymbolId.d.ts +2 -2
  111. package/dist/lib/models/reflections/ReflectionSymbolId.js +42 -34
  112. package/dist/lib/models/reflections/abstract.d.ts +17 -20
  113. package/dist/lib/models/reflections/abstract.js +249 -256
  114. package/dist/lib/models/reflections/container.d.ts +7 -7
  115. package/dist/lib/models/reflections/container.js +43 -16
  116. package/dist/lib/models/reflections/declaration.d.ts +15 -12
  117. package/dist/lib/models/reflections/declaration.js +150 -29
  118. package/dist/lib/models/reflections/document.d.ts +3 -3
  119. package/dist/lib/models/reflections/document.js +26 -13
  120. package/dist/lib/models/reflections/index.d.ts +15 -15
  121. package/dist/lib/models/reflections/index.js +12 -31
  122. package/dist/lib/models/reflections/kind.d.ts +1 -1
  123. package/dist/lib/models/reflections/kind.js +3 -6
  124. package/dist/lib/models/reflections/parameter.d.ts +5 -4
  125. package/dist/lib/models/reflections/parameter.js +11 -13
  126. package/dist/lib/models/reflections/project.d.ts +14 -9
  127. package/dist/lib/models/reflections/project.js +104 -56
  128. package/dist/lib/models/reflections/reference.d.ts +3 -3
  129. package/dist/lib/models/reflections/reference.js +6 -9
  130. package/dist/lib/models/reflections/signature.d.ts +8 -8
  131. package/dist/lib/models/reflections/signature.js +35 -14
  132. package/dist/lib/models/reflections/type-parameter.d.ts +5 -5
  133. package/dist/lib/models/reflections/type-parameter.js +9 -10
  134. package/dist/lib/models/reflections/utils.js +1 -4
  135. package/dist/lib/models/reflections/variant.d.ts +8 -7
  136. package/dist/lib/models/reflections/variant.js +1 -2
  137. package/dist/lib/models/sources/file.d.ts +2 -2
  138. package/dist/lib/models/sources/file.js +22 -5
  139. package/dist/lib/models/sources/index.d.ts +1 -1
  140. package/dist/lib/models/sources/index.js +1 -5
  141. package/dist/lib/models/types.d.ts +26 -13
  142. package/dist/lib/models/types.js +236 -151
  143. package/dist/lib/output/components.d.ts +5 -11
  144. package/dist/lib/output/components.js +84 -125
  145. package/dist/lib/output/events.d.ts +3 -3
  146. package/dist/lib/output/events.js +128 -94
  147. package/dist/lib/output/formatter.d.ts +84 -0
  148. package/dist/lib/output/formatter.js +619 -0
  149. package/dist/lib/output/index.d.ts +9 -8
  150. package/dist/lib/output/index.js +7 -19
  151. package/dist/lib/output/models/UrlMapping.d.ts +2 -2
  152. package/dist/lib/output/models/UrlMapping.js +4 -5
  153. package/dist/lib/output/output.d.ts +13 -0
  154. package/dist/lib/output/output.js +72 -0
  155. package/dist/lib/output/plugins/AssetsPlugin.d.ts +7 -8
  156. package/dist/lib/output/plugins/AssetsPlugin.js +62 -80
  157. package/dist/lib/output/plugins/IconsPlugin.d.ts +3 -2
  158. package/dist/lib/output/plugins/IconsPlugin.js +28 -84
  159. package/dist/lib/output/plugins/JavascriptIndexPlugin.d.ts +9 -2
  160. package/dist/lib/output/plugins/JavascriptIndexPlugin.js +90 -96
  161. package/dist/lib/output/plugins/NavigationPlugin.d.ts +3 -2
  162. package/dist/lib/output/plugins/NavigationPlugin.js +22 -102
  163. package/dist/lib/output/plugins/SitemapPlugin.d.ts +3 -2
  164. package/dist/lib/output/plugins/SitemapPlugin.js +60 -120
  165. package/dist/lib/output/plugins/index.d.ts +6 -6
  166. package/dist/lib/output/plugins/index.js +6 -15
  167. package/dist/lib/output/renderer.d.ts +14 -13
  168. package/dist/lib/output/renderer.js +129 -185
  169. package/dist/lib/output/theme.d.ts +9 -5
  170. package/dist/lib/output/theme.js +14 -62
  171. package/dist/lib/output/themes/MarkedPlugin.d.ts +8 -9
  172. package/dist/lib/output/themes/MarkedPlugin.js +152 -117
  173. package/dist/lib/output/themes/default/DefaultTheme.d.ts +17 -29
  174. package/dist/lib/output/themes/default/DefaultTheme.js +334 -310
  175. package/dist/lib/output/themes/default/DefaultThemeRenderContext.d.ts +63 -48
  176. package/dist/lib/output/themes/default/DefaultThemeRenderContext.js +119 -95
  177. package/dist/lib/output/themes/default/Slugger.d.ts +13 -0
  178. package/dist/lib/output/themes/default/Slugger.js +46 -0
  179. package/dist/lib/output/themes/default/layouts/default.d.ts +5 -5
  180. package/dist/lib/output/themes/default/layouts/default.js +67 -34
  181. package/dist/lib/output/themes/default/partials/anchor-icon.d.ts +2 -2
  182. package/dist/lib/output/themes/default/partials/anchor-icon.js +4 -7
  183. package/dist/lib/output/themes/default/partials/breadcrumb.d.ts +3 -3
  184. package/dist/lib/output/themes/default/partials/breadcrumb.js +4 -8
  185. package/dist/lib/output/themes/default/partials/comment.d.ts +6 -4
  186. package/dist/lib/output/themes/default/partials/comment.js +52 -29
  187. package/dist/lib/output/themes/default/partials/footer.d.ts +2 -2
  188. package/dist/lib/output/themes/default/partials/footer.js +11 -14
  189. package/dist/lib/output/themes/default/partials/header.d.ts +4 -4
  190. package/dist/lib/output/themes/default/partials/header.js +9 -13
  191. package/dist/lib/output/themes/default/partials/hierarchy.d.ts +3 -3
  192. package/dist/lib/output/themes/default/partials/hierarchy.js +9 -12
  193. package/dist/lib/output/themes/default/partials/icon.d.ts +4 -4
  194. package/dist/lib/output/themes/default/partials/icon.js +78 -73
  195. package/dist/lib/output/themes/default/partials/index.d.ts +3 -3
  196. package/dist/lib/output/themes/default/partials/index.js +19 -22
  197. package/dist/lib/output/themes/default/partials/member.d.ts +3 -3
  198. package/dist/lib/output/themes/default/partials/member.declaration.d.ts +3 -3
  199. package/dist/lib/output/themes/default/partials/member.declaration.js +18 -61
  200. package/dist/lib/output/themes/default/partials/member.getterSetter.d.ts +3 -3
  201. package/dist/lib/output/themes/default/partials/member.getterSetter.js +10 -26
  202. package/dist/lib/output/themes/default/partials/member.js +19 -24
  203. package/dist/lib/output/themes/default/partials/member.signature.body.d.ts +3 -3
  204. package/dist/lib/output/themes/default/partials/member.signature.body.js +17 -21
  205. package/dist/lib/output/themes/default/partials/member.signature.title.d.ts +4 -7
  206. package/dist/lib/output/themes/default/partials/member.signature.title.js +8 -35
  207. package/dist/lib/output/themes/default/partials/member.signatures.d.ts +3 -3
  208. package/dist/lib/output/themes/default/partials/member.signatures.js +9 -13
  209. package/dist/lib/output/themes/default/partials/member.sources.d.ts +3 -3
  210. package/dist/lib/output/themes/default/partials/member.sources.js +13 -17
  211. package/dist/lib/output/themes/default/partials/members.d.ts +3 -3
  212. package/dist/lib/output/themes/default/partials/members.js +10 -42
  213. package/dist/lib/output/themes/default/partials/moduleReflection.d.ts +5 -0
  214. package/dist/lib/output/themes/default/partials/moduleReflection.js +62 -0
  215. package/dist/lib/output/themes/default/partials/navigation.d.ts +4 -4
  216. package/dist/lib/output/themes/default/partials/navigation.js +51 -62
  217. package/dist/lib/output/themes/default/partials/reflectionPreview.d.ts +3 -3
  218. package/dist/lib/output/themes/default/partials/reflectionPreview.js +12 -15
  219. package/dist/lib/output/themes/default/partials/toolbar.d.ts +4 -4
  220. package/dist/lib/output/themes/default/partials/toolbar.js +16 -20
  221. package/dist/lib/output/themes/default/partials/type.d.ts +4 -6
  222. package/dist/lib/output/themes/default/partials/type.js +8 -388
  223. package/dist/lib/output/themes/default/partials/typeAndParent.d.ts +3 -3
  224. package/dist/lib/output/themes/default/partials/typeAndParent.js +11 -15
  225. package/dist/lib/output/themes/default/partials/typeDetails.d.ts +8 -0
  226. package/dist/lib/output/themes/default/partials/typeDetails.js +221 -0
  227. package/dist/lib/output/themes/default/partials/typeParameters.d.ts +3 -3
  228. package/dist/lib/output/themes/default/partials/typeParameters.js +14 -17
  229. package/dist/lib/output/themes/default/templates/document.d.ts +4 -4
  230. package/dist/lib/output/themes/default/templates/document.js +3 -7
  231. package/dist/lib/output/themes/default/templates/hierarchy.d.ts +4 -4
  232. package/dist/lib/output/themes/default/templates/hierarchy.js +10 -13
  233. package/dist/lib/output/themes/default/templates/index.d.ts +4 -4
  234. package/dist/lib/output/themes/default/templates/index.js +3 -7
  235. package/dist/lib/output/themes/default/templates/reflection.d.ts +4 -4
  236. package/dist/lib/output/themes/default/templates/reflection.js +31 -34
  237. package/dist/lib/output/themes/lib.d.ts +17 -3
  238. package/dist/lib/output/themes/lib.js +110 -49
  239. package/dist/lib/serialization/components.d.ts +2 -5
  240. package/dist/lib/serialization/components.js +1 -2
  241. package/dist/lib/serialization/deserializer.d.ts +21 -7
  242. package/dist/lib/serialization/deserializer.js +138 -123
  243. package/dist/lib/serialization/events.d.ts +2 -2
  244. package/dist/lib/serialization/events.js +6 -5
  245. package/dist/lib/serialization/index.d.ts +5 -5
  246. package/dist/lib/serialization/index.js +4 -33
  247. package/dist/lib/serialization/schema.d.ts +8 -2
  248. package/dist/lib/serialization/schema.js +2 -2
  249. package/dist/lib/serialization/serializer.d.ts +11 -5
  250. package/dist/lib/serialization/serializer.js +32 -25
  251. package/dist/lib/utils/array.d.ts +3 -0
  252. package/dist/lib/utils/array.js +26 -27
  253. package/dist/lib/utils/component.d.ts +2 -44
  254. package/dist/lib/utils/component.js +10 -102
  255. package/dist/lib/utils/entry-point.d.ts +3 -4
  256. package/dist/lib/utils/entry-point.js +114 -85
  257. package/dist/lib/utils/enum.js +6 -14
  258. package/dist/lib/utils/events.js +6 -12
  259. package/dist/lib/utils/fs.js +50 -91
  260. package/dist/lib/utils/general.d.ts +2 -1
  261. package/dist/lib/utils/general.js +50 -40
  262. package/dist/lib/utils/highlighter.js +30 -57
  263. package/dist/lib/utils/hooks.js +7 -13
  264. package/dist/lib/utils/html-entities.d.ts +8926 -0
  265. package/dist/lib/utils/html-entities.js +2329 -0
  266. package/dist/lib/utils/html.d.ts +8 -0
  267. package/dist/lib/utils/html.js +81 -34
  268. package/dist/lib/utils/index.d.ts +22 -22
  269. package/dist/lib/utils/index.js +20 -91
  270. package/dist/lib/utils/jsx.d.ts +12 -5
  271. package/dist/lib/utils/jsx.elements.js +1 -4
  272. package/dist/lib/utils/jsx.js +53 -20
  273. package/dist/lib/utils/loggers.d.ts +3 -3
  274. package/dist/lib/utils/loggers.js +36 -46
  275. package/dist/lib/utils/map.d.ts +1 -1
  276. package/dist/lib/utils/map.js +6 -13
  277. package/dist/lib/utils/minimalSourceFile.js +5 -7
  278. package/dist/lib/utils/options/declaration.d.ts +33 -7
  279. package/dist/lib/utils/options/declaration.js +20 -22
  280. package/dist/lib/utils/options/defaults.d.ts +3 -2
  281. package/dist/lib/utils/options/defaults.js +18 -38
  282. package/dist/lib/utils/options/help.d.ts +2 -2
  283. package/dist/lib/utils/options/help.js +7 -10
  284. package/dist/lib/utils/options/index.d.ts +6 -6
  285. package/dist/lib/utils/options/index.js +4 -18
  286. package/dist/lib/utils/options/options.d.ts +8 -5
  287. package/dist/lib/utils/options/options.js +47 -71
  288. package/dist/lib/utils/options/readers/arguments.d.ts +2 -2
  289. package/dist/lib/utils/options/readers/arguments.js +15 -17
  290. package/dist/lib/utils/options/readers/index.d.ts +4 -4
  291. package/dist/lib/utils/options/readers/index.js +4 -11
  292. package/dist/lib/utils/options/readers/package-json.d.ts +3 -3
  293. package/dist/lib/utils/options/readers/package-json.js +15 -21
  294. package/dist/lib/utils/options/readers/tsconfig.d.ts +2 -2
  295. package/dist/lib/utils/options/readers/tsconfig.js +54 -63
  296. package/dist/lib/utils/options/readers/typedoc.d.ts +3 -3
  297. package/dist/lib/utils/options/readers/typedoc.js +47 -90
  298. package/dist/lib/utils/options/sources/index.d.ts +1 -1
  299. package/dist/lib/utils/options/sources/index.js +1 -5
  300. package/dist/lib/utils/options/sources/typedoc.d.ts +1 -1
  301. package/dist/lib/utils/options/sources/typedoc.js +220 -196
  302. package/dist/lib/utils/options/tsdoc-defaults.d.ts +3 -3
  303. package/dist/lib/utils/options/tsdoc-defaults.js +16 -12
  304. package/dist/lib/utils/package-manifest.d.ts +1 -1
  305. package/dist/lib/utils/package-manifest.js +15 -19
  306. package/dist/lib/utils/paths.js +9 -15
  307. package/dist/lib/utils/perf.js +6 -11
  308. package/dist/lib/utils/plugins.d.ts +1 -1
  309. package/dist/lib/utils/plugins.js +16 -17
  310. package/dist/lib/utils/reflections.d.ts +1 -1
  311. package/dist/lib/utils/reflections.js +9 -12
  312. package/dist/lib/utils/set.js +2 -6
  313. package/dist/lib/utils/sort.d.ts +3 -3
  314. package/dist/lib/utils/sort.js +20 -24
  315. package/dist/lib/utils/tsconfig.d.ts +1 -1
  316. package/dist/lib/utils/tsconfig.js +13 -21
  317. package/dist/lib/utils/tsutils.d.ts +1 -1
  318. package/dist/lib/utils/tsutils.js +3 -30
  319. package/dist/lib/utils/validation.js +6 -12
  320. package/dist/lib/validation/documentation.d.ts +2 -2
  321. package/dist/lib/validation/documentation.js +26 -29
  322. package/dist/lib/validation/exports.d.ts +2 -2
  323. package/dist/lib/validation/exports.js +9 -11
  324. package/dist/lib/validation/links.d.ts +2 -2
  325. package/dist/lib/validation/links.js +4 -7
  326. package/dist/lib/validation/unusedMergeModuleWith.d.ts +3 -0
  327. package/dist/lib/validation/unusedMergeModuleWith.js +11 -0
  328. package/package.json +14 -11
  329. package/static/main.js +4 -4
  330. package/static/style.css +91 -2
  331. package/tsdoc.json +30 -0
  332. package/dist/lib/output/themes/default/partials/member.reference.d.ts +0 -4
  333. package/dist/lib/output/themes/default/partials/member.reference.js +0 -30
  334. package/dist/lib/output/themes/default/partials/parameter.d.ts +0 -4
  335. package/dist/lib/output/themes/default/partials/parameter.js +0 -79
  336. package/dist/lib/utils/html-entities.json +0 -2326
@@ -1,52 +1,11 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
- Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.isFile = isFile;
27
- exports.isDir = isDir;
28
- exports.deriveRootDir = deriveRootDir;
29
- exports.getCommonDirectory = getCommonDirectory;
30
- exports.readFile = readFile;
31
- exports.writeFileSync = writeFileSync;
32
- exports.writeFile = writeFile;
33
- exports.copy = copy;
34
- exports.copySync = copySync;
35
- exports.glob = glob;
36
- exports.hasTsExtension = hasTsExtension;
37
- exports.hasDeclarationFileExtension = hasDeclarationFileExtension;
38
- exports.discoverInParentDir = discoverInParentDir;
39
- exports.discoverInParentDirExactMatch = discoverInParentDirExactMatch;
40
- exports.discoverPackageJson = discoverPackageJson;
41
- exports.findPackageForPath = findPackageForPath;
42
- const fs = __importStar(require("fs"));
43
- const fs_1 = require("fs");
44
- const minimatch_1 = require("minimatch");
45
- const path_1 = require("path");
46
- const validation_1 = require("./validation");
47
- const paths_1 = require("./paths");
48
- const array_1 = require("./array");
49
- function isFile(file) {
1
+ import * as fs from "fs";
2
+ import { promises as fsp } from "fs";
3
+ import { Minimatch } from "minimatch";
4
+ import { dirname, join, relative, resolve } from "path";
5
+ import { optional, validate } from "./validation.js";
6
+ import { createMinimatch, normalizePath } from "./paths.js";
7
+ import { filterMap } from "./array.js";
8
+ export function isFile(file) {
50
9
  try {
51
10
  return fs.statSync(file).isFile();
52
11
  }
@@ -54,7 +13,7 @@ function isFile(file) {
54
13
  return false;
55
14
  }
56
15
  }
57
- function isDir(path) {
16
+ export function isDir(path) {
58
17
  try {
59
18
  return fs.statSync(path).isDirectory();
60
19
  }
@@ -62,10 +21,10 @@ function isDir(path) {
62
21
  return false;
63
22
  }
64
23
  }
65
- function deriveRootDir(globPaths) {
66
- const normalized = globPaths.map(paths_1.normalizePath);
67
- const globs = (0, paths_1.createMinimatch)(normalized);
68
- const rootPaths = globs.flatMap((glob, i) => (0, array_1.filterMap)(glob.set, (set) => {
24
+ export function deriveRootDir(globPaths) {
25
+ const normalized = globPaths.map(normalizePath);
26
+ const globs = createMinimatch(normalized);
27
+ const rootPaths = globs.flatMap((glob, i) => filterMap(glob.set, (set) => {
69
28
  const stop = set.findIndex((part) => typeof part !== "string");
70
29
  if (stop === -1) {
71
30
  return normalized[i];
@@ -80,7 +39,7 @@ function deriveRootDir(globPaths) {
80
39
  /**
81
40
  * Get the longest directory path common to all files.
82
41
  */
83
- function getCommonDirectory(files) {
42
+ export function getCommonDirectory(files) {
84
43
  if (!files.length) {
85
44
  return "";
86
45
  }
@@ -101,7 +60,7 @@ function getCommonDirectory(files) {
101
60
  * @param file The path of the file to read.
102
61
  * @returns The files contents.
103
62
  */
104
- function readFile(file) {
63
+ export function readFile(file) {
105
64
  const buffer = fs.readFileSync(file);
106
65
  switch (buffer[0]) {
107
66
  case 0xfe:
@@ -136,9 +95,9 @@ function readFile(file) {
136
95
  * @param fileName The name of the file that should be written.
137
96
  * @param data The contents of the file.
138
97
  */
139
- function writeFileSync(fileName, data) {
140
- fs.mkdirSync((0, path_1.dirname)((0, paths_1.normalizePath)(fileName)), { recursive: true });
141
- fs.writeFileSync((0, paths_1.normalizePath)(fileName), data);
98
+ export function writeFileSync(fileName, data) {
99
+ fs.mkdirSync(dirname(normalizePath(fileName)), { recursive: true });
100
+ fs.writeFileSync(normalizePath(fileName), data);
142
101
  }
143
102
  /**
144
103
  * Write a file to disc.
@@ -148,37 +107,37 @@ function writeFileSync(fileName, data) {
148
107
  * @param fileName The name of the file that should be written.
149
108
  * @param data The contents of the file.
150
109
  */
151
- async function writeFile(fileName, data) {
152
- await fs_1.promises.mkdir((0, path_1.dirname)((0, paths_1.normalizePath)(fileName)), {
110
+ export async function writeFile(fileName, data) {
111
+ await fsp.mkdir(dirname(normalizePath(fileName)), {
153
112
  recursive: true,
154
113
  });
155
- await fs_1.promises.writeFile((0, paths_1.normalizePath)(fileName), data);
114
+ await fsp.writeFile(normalizePath(fileName), data);
156
115
  }
157
116
  /**
158
117
  * Copy a file or directory recursively.
159
118
  */
160
- async function copy(src, dest) {
161
- const stat = await fs_1.promises.stat(src);
119
+ export async function copy(src, dest) {
120
+ const stat = await fsp.stat(src);
162
121
  if (stat.isDirectory()) {
163
- const contained = await fs_1.promises.readdir(src);
164
- await Promise.all(contained.map((file) => copy((0, path_1.join)(src, file), (0, path_1.join)(dest, file))));
122
+ const contained = await fsp.readdir(src);
123
+ await Promise.all(contained.map((file) => copy(join(src, file), join(dest, file))));
165
124
  }
166
125
  else if (stat.isFile()) {
167
- await fs_1.promises.mkdir((0, path_1.dirname)(dest), { recursive: true });
168
- await fs_1.promises.copyFile(src, dest);
126
+ await fsp.mkdir(dirname(dest), { recursive: true });
127
+ await fsp.copyFile(src, dest);
169
128
  }
170
129
  else {
171
130
  // Do nothing for FIFO, special devices.
172
131
  }
173
132
  }
174
- function copySync(src, dest) {
133
+ export function copySync(src, dest) {
175
134
  const stat = fs.statSync(src);
176
135
  if (stat.isDirectory()) {
177
136
  const contained = fs.readdirSync(src);
178
- contained.forEach((file) => copySync((0, path_1.join)(src, file), (0, path_1.join)(dest, file)));
137
+ contained.forEach((file) => copySync(join(src, file), join(dest, file)));
179
138
  }
180
139
  else if (stat.isFile()) {
181
- fs.mkdirSync((0, path_1.dirname)(dest), { recursive: true });
140
+ fs.mkdirSync(dirname(dest), { recursive: true });
182
141
  fs.copyFileSync(src, dest);
183
142
  }
184
143
  else {
@@ -188,10 +147,10 @@ function copySync(src, dest) {
188
147
  /**
189
148
  * Simpler version of `glob.sync` that only covers our use cases, always ignoring node_modules.
190
149
  */
191
- function glob(pattern, root, options = {}) {
150
+ export function glob(pattern, root, options = {}) {
192
151
  const result = [];
193
- const mini = new minimatch_1.Minimatch((0, paths_1.normalizePath)(pattern));
194
- const dirs = [(0, paths_1.normalizePath)(root).split("/")];
152
+ const mini = new Minimatch(normalizePath(pattern));
153
+ const dirs = [normalizePath(root).split("/")];
195
154
  // cache of real paths to avoid infinite recursion
196
155
  const symlinkTargetsSeen = new Set();
197
156
  // cache of fs.realpathSync results to avoid extra I/O
@@ -244,7 +203,7 @@ function glob(pattern, root, options = {}) {
244
203
  // special case: real path of symlink is the directory we're currently traversing
245
204
  return;
246
205
  }
247
- const targetPath = (0, path_1.relative)(dirpath, realpath);
206
+ const targetPath = relative(dirpath, realpath);
248
207
  handleSymlink(targetPath);
249
208
  } // everything else should be ignored
250
209
  }
@@ -275,61 +234,61 @@ function glob(pattern, root, options = {}) {
275
234
  }
276
235
  return result;
277
236
  }
278
- function hasTsExtension(path) {
237
+ export function hasTsExtension(path) {
279
238
  return /\.[cm]?ts$|\.tsx$/.test(path);
280
239
  }
281
- function hasDeclarationFileExtension(path) {
240
+ export function hasDeclarationFileExtension(path) {
282
241
  return /\.d\.[cm]?ts$/.test(path);
283
242
  }
284
- function discoverInParentDir(name, dir, read) {
243
+ export function discoverInParentDir(name, dir, read) {
285
244
  if (!isDir(dir))
286
245
  return;
287
- const reachedTopDirectory = (dirName) => dirName === (0, path_1.resolve)((0, path_1.join)(dirName, ".."));
246
+ const reachedTopDirectory = (dirName) => dirName === resolve(join(dirName, ".."));
288
247
  while (!reachedTopDirectory(dir)) {
289
248
  for (const file of fs.readdirSync(dir)) {
290
249
  if (file.toLowerCase() !== name.toLowerCase())
291
250
  continue;
292
251
  try {
293
- const content = read(readFile((0, path_1.join)(dir, file)));
252
+ const content = read(readFile(join(dir, file)));
294
253
  if (content != null) {
295
- return { file: (0, path_1.join)(dir, file), content };
254
+ return { file: join(dir, file), content };
296
255
  }
297
256
  }
298
257
  catch {
299
258
  // Ignore, file didn't pass validation
300
259
  }
301
260
  }
302
- dir = (0, path_1.resolve)((0, path_1.join)(dir, ".."));
261
+ dir = resolve(join(dir, ".."));
303
262
  }
304
263
  }
305
- function discoverInParentDirExactMatch(name, dir, read) {
264
+ export function discoverInParentDirExactMatch(name, dir, read) {
306
265
  if (!isDir(dir))
307
266
  return;
308
- const reachedTopDirectory = (dirName) => dirName === (0, path_1.resolve)((0, path_1.join)(dirName, ".."));
267
+ const reachedTopDirectory = (dirName) => dirName === resolve(join(dirName, ".."));
309
268
  while (!reachedTopDirectory(dir)) {
310
269
  try {
311
- const content = read(readFile((0, path_1.join)(dir, name)));
270
+ const content = read(readFile(join(dir, name)));
312
271
  if (content != null) {
313
- return { file: (0, path_1.join)(dir, name), content };
272
+ return { file: join(dir, name), content };
314
273
  }
315
274
  }
316
275
  catch {
317
276
  // Ignore, file didn't pass validation
318
277
  }
319
- dir = (0, path_1.resolve)((0, path_1.join)(dir, ".."));
278
+ dir = resolve(join(dir, ".."));
320
279
  }
321
280
  }
322
- function discoverPackageJson(dir) {
281
+ export function discoverPackageJson(dir) {
323
282
  return discoverInParentDirExactMatch("package.json", dir, (content) => {
324
283
  const pkg = JSON.parse(content);
325
- if ((0, validation_1.validate)({ name: String, version: (0, validation_1.optional)(String) }, pkg)) {
284
+ if (validate({ name: String, version: optional(String) }, pkg)) {
326
285
  return pkg;
327
286
  }
328
287
  });
329
288
  }
330
289
  // dir -> package name according to package.json in this or some parent dir
331
290
  const packageCache = new Map();
332
- function findPackageForPath(sourcePath) {
291
+ export function findPackageForPath(sourcePath) {
333
292
  // Attempt to decide package name from path if it contains "node_modules"
334
293
  let startIndex = sourcePath.lastIndexOf("node_modules/");
335
294
  if (startIndex !== -1) {
@@ -341,7 +300,7 @@ function findPackageForPath(sourcePath) {
341
300
  }
342
301
  return sourcePath.substring(startIndex, stopIndex);
343
302
  }
344
- const dir = (0, path_1.dirname)(sourcePath);
303
+ const dir = dirname(sourcePath);
345
304
  const cache = packageCache.get(dir);
346
305
  if (cache) {
347
306
  return cache;
@@ -39,7 +39,8 @@ export type Chars<T extends string> = T extends `${infer C}${infer R}` ? C | Cha
39
39
  * Utility to help type checking ensure that there is no uncovered case.
40
40
  */
41
41
  export declare function assertNever(x: never): never;
42
- export declare function camelToTitleCase(text: string): string;
42
+ export declare function editDistance(s: string, t: string): number;
43
+ export declare function getSimilarValues(values: Iterable<string>, compareTo: string): string[];
43
44
  export declare function NonEnumerable(_cls: unknown, context: ClassFieldDecoratorContext): void;
44
45
  export declare function hasBeenLoadedMultipleTimes(): boolean;
45
46
  export declare function getLoadedPaths(): string[];
@@ -1,46 +1,56 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
- Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.assertNever = assertNever;
27
- exports.camelToTitleCase = camelToTitleCase;
28
- exports.NonEnumerable = NonEnumerable;
29
- exports.hasBeenLoadedMultipleTimes = hasBeenLoadedMultipleTimes;
30
- exports.getLoadedPaths = getLoadedPaths;
31
- const path_1 = require("path");
32
- const Util = __importStar(require("util"));
1
+ import { dirname } from "path";
2
+ import * as Util from "util";
3
+ import url from "url";
4
+ import { DefaultMap } from "./map.js";
33
5
  /**
34
6
  * Utility to help type checking ensure that there is no uncovered case.
35
7
  */
36
- function assertNever(x) {
8
+ export function assertNever(x) {
37
9
  throw new Error(`Expected handling to cover all possible cases, but it didn't cover: ${Util.inspect(x)}`);
38
10
  }
39
- function camelToTitleCase(text) {
40
- return (text.substring(0, 1).toUpperCase() +
41
- text.substring(1).replace(/[a-z][A-Z]/g, (x) => `${x[0]} ${x[1]}`));
11
+ // Based on https://en.wikipedia.org/wiki/Levenshtein_distance#Iterative_with_two_matrix_rows
12
+ // Slightly modified for improved match results for options
13
+ export function editDistance(s, t) {
14
+ if (s.length < t.length)
15
+ return editDistance(t, s);
16
+ let v0 = Array.from({ length: t.length + 1 }, (_, i) => i);
17
+ let v1 = Array.from({ length: t.length + 1 }, () => 0);
18
+ for (let i = 0; i < s.length; i++) {
19
+ v1[0] = i + 1;
20
+ for (let j = 0; j < s.length; j++) {
21
+ const deletionCost = v0[j + 1] + 1;
22
+ const insertionCost = v1[j] + 1;
23
+ let substitutionCost;
24
+ if (s[i] === t[j]) {
25
+ substitutionCost = v0[j];
26
+ }
27
+ else if (s[i]?.toUpperCase() === t[j]?.toUpperCase()) {
28
+ substitutionCost = v0[j] + 1;
29
+ }
30
+ else {
31
+ substitutionCost = v0[j] + 3;
32
+ }
33
+ v1[j + 1] = Math.min(deletionCost, insertionCost, substitutionCost);
34
+ }
35
+ [v0, v1] = [v1, v0];
36
+ }
37
+ return v0[t.length];
38
+ }
39
+ export function getSimilarValues(values, compareTo) {
40
+ const results = new DefaultMap(() => []);
41
+ let lowest = Infinity;
42
+ for (const name of values) {
43
+ const distance = editDistance(compareTo, name);
44
+ lowest = Math.min(lowest, distance);
45
+ results.get(distance).push(name);
46
+ }
47
+ // Experimenting a bit, it seems an edit distance of 3 is roughly the
48
+ // right metric for relevant "similar" results without showing obviously wrong suggestions
49
+ return results
50
+ .get(lowest)
51
+ .concat(results.get(lowest + 1), results.get(lowest + 2));
42
52
  }
43
- function NonEnumerable(_cls, context) {
53
+ export function NonEnumerable(_cls, context) {
44
54
  context.addInitializer(function () {
45
55
  Object.defineProperty(this, context.name, {
46
56
  enumerable: false,
@@ -60,10 +70,10 @@ const g = globalThis;
60
70
  g[loadSymbol] = (g[loadSymbol] || 0) + 1;
61
71
  g[pathSymbol] ||= [];
62
72
  // transform /abs/path/to/typedoc/dist/lib/utils/general -> /abs/path/to/typedoc
63
- g[pathSymbol].push((0, path_1.dirname)((0, path_1.dirname)((0, path_1.dirname)(__dirname))));
64
- function hasBeenLoadedMultipleTimes() {
73
+ g[pathSymbol].push(dirname(dirname(dirname(dirname(url.fileURLToPath(import.meta.url))))));
74
+ export function hasBeenLoadedMultipleTimes() {
65
75
  return g[loadSymbol] !== 1;
66
76
  }
67
- function getLoadedPaths() {
77
+ export function getLoadedPaths() {
68
78
  return g[pathSymbol] || [];
69
79
  }
@@ -1,45 +1,12 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
- Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.loadShikiMetadata = loadShikiMetadata;
27
- exports.loadHighlighter = loadHighlighter;
28
- exports.isSupportedLanguage = isSupportedLanguage;
29
- exports.getSupportedLanguages = getSupportedLanguages;
30
- exports.getSupportedLanguagesWithoutAliases = getSupportedLanguagesWithoutAliases;
31
- exports.getSupportedThemes = getSupportedThemes;
32
- exports.isLoadedLanguage = isLoadedLanguage;
33
- exports.highlight = highlight;
34
- exports.getStyles = getStyles;
35
- const assert_1 = require("assert");
36
- const JSX = __importStar(require("./jsx"));
37
- const array_1 = require("./array");
1
+ import { ok as assert, ok } from "assert";
2
+ import * as JSX from "./jsx.js";
3
+ import { unique } from "./array.js";
38
4
  const aliases = new Map();
39
5
  let supportedLanguagesWithoutAliases = [];
40
6
  let supportedLanguages = [];
41
7
  let supportedThemes = [];
42
- async function loadShikiMetadata() {
8
+ const plaintextLanguages = ["txt", "text"];
9
+ export async function loadShikiMetadata() {
43
10
  if (aliases.size)
44
11
  return;
45
12
  const shiki = await import("shiki");
@@ -48,20 +15,26 @@ async function loadShikiMetadata() {
48
15
  aliases.set(alias, lang.id);
49
16
  }
50
17
  }
51
- supportedLanguages = (0, array_1.unique)([
52
- "text",
18
+ supportedLanguages = unique([
19
+ ...plaintextLanguages,
53
20
  ...aliases.keys(),
54
21
  ...shiki.bundledLanguagesInfo.map((lang) => lang.id),
55
22
  ]).sort();
56
- supportedLanguagesWithoutAliases = (0, array_1.unique)(["text", ...shiki.bundledLanguagesInfo.map((lang) => lang.id)]);
23
+ supportedLanguagesWithoutAliases = unique([
24
+ ...plaintextLanguages,
25
+ ...shiki.bundledLanguagesInfo.map((lang) => lang.id),
26
+ ]);
57
27
  supportedThemes = Object.keys(shiki.bundledThemes);
58
28
  }
59
29
  class DoubleHighlighter {
30
+ highlighter;
31
+ light;
32
+ dark;
33
+ schemes = new Map();
60
34
  constructor(highlighter, light, dark) {
61
35
  this.highlighter = highlighter;
62
36
  this.light = light;
63
37
  this.dark = dark;
64
- this.schemes = new Map();
65
38
  }
66
39
  supports(lang) {
67
40
  return this.highlighter.getLoadedLanguages().includes(lang);
@@ -129,39 +102,39 @@ class DoubleHighlighter {
129
102
  }
130
103
  }
131
104
  let highlighter;
132
- async function loadHighlighter(lightTheme, darkTheme, langs) {
105
+ export async function loadHighlighter(lightTheme, darkTheme, langs) {
133
106
  if (highlighter)
134
107
  return;
135
108
  const shiki = await import("shiki");
136
109
  const hl = await shiki.createHighlighter({ themes: [lightTheme, darkTheme], langs });
137
110
  highlighter = new DoubleHighlighter(hl, lightTheme, darkTheme);
138
111
  }
139
- function isSupportedLanguage(lang) {
112
+ export function isSupportedLanguage(lang) {
140
113
  return getSupportedLanguages().includes(lang);
141
114
  }
142
- function getSupportedLanguages() {
143
- (0, assert_1.ok)(supportedLanguages.length > 0, "loadShikiMetadata has not been called");
115
+ export function getSupportedLanguages() {
116
+ ok(supportedLanguages.length > 0, "loadShikiMetadata has not been called");
144
117
  return supportedLanguages;
145
118
  }
146
- function getSupportedLanguagesWithoutAliases() {
147
- (0, assert_1.ok)(supportedLanguagesWithoutAliases.length > 0, "loadShikiMetadata has not been called");
119
+ export function getSupportedLanguagesWithoutAliases() {
120
+ ok(supportedLanguagesWithoutAliases.length > 0, "loadShikiMetadata has not been called");
148
121
  return supportedLanguages;
149
122
  }
150
- function getSupportedThemes() {
151
- (0, assert_1.ok)(supportedThemes.length > 0, "loadShikiMetadata has not been called");
123
+ export function getSupportedThemes() {
124
+ ok(supportedThemes.length > 0, "loadShikiMetadata has not been called");
152
125
  return supportedThemes;
153
126
  }
154
- function isLoadedLanguage(lang) {
155
- return lang === "text" || (highlighter?.supports(lang) ?? false);
127
+ export function isLoadedLanguage(lang) {
128
+ return plaintextLanguages.includes(lang) || (highlighter?.supports(lang) ?? false);
156
129
  }
157
- function highlight(code, lang) {
158
- (0, assert_1.ok)(highlighter, "Tried to highlight with an uninitialized highlighter");
159
- if (lang === "text") {
130
+ export function highlight(code, lang) {
131
+ assert(highlighter, "Tried to highlight with an uninitialized highlighter");
132
+ if (plaintextLanguages.includes(lang)) {
160
133
  return JSX.renderElement(JSX.createElement(JSX.Fragment, null, code));
161
134
  }
162
135
  return highlighter.highlight(code, aliases.get(lang) ?? lang);
163
136
  }
164
- function getStyles() {
165
- (0, assert_1.ok)(highlighter, "Tried to highlight with an uninitialized highlighter");
137
+ export function getStyles() {
138
+ assert(highlighter, "Tried to highlight with an uninitialized highlighter");
166
139
  return highlighter.getStyles();
167
140
  }
@@ -1,7 +1,4 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.EventHooks = void 0;
4
- const array_1 = require("./array");
1
+ import { insertOrderSorted } from "./array.js";
5
2
  const momentos = new WeakMap();
6
3
  /**
7
4
  * Event emitter which allows listeners to return a value.
@@ -19,12 +16,10 @@ const momentos = new WeakMap();
19
16
  * x.on('a' a => 1) // error, returns a number but expected a string
20
17
  * ```
21
18
  */
22
- class EventHooks {
23
- constructor() {
24
- // Function is *usually* not a good type to use, but here it lets us specify stricter
25
- // contracts in the methods while not casting everywhere this is used.
26
- this._listeners = new Map();
27
- }
19
+ export class EventHooks {
20
+ // Function is *usually* not a good type to use, but here it lets us specify stricter
21
+ // contracts in the methods while not casting everywhere this is used.
22
+ _listeners = new Map();
28
23
  /**
29
24
  * Starts listening to an event.
30
25
  * @param event the event to listen to.
@@ -33,7 +28,7 @@ class EventHooks {
33
28
  */
34
29
  on(event, listener, order = 0) {
35
30
  const list = (this._listeners.get(event) || []).slice();
36
- (0, array_1.insertOrderSorted)(list, { listener, order });
31
+ insertOrderSorted(list, { listener, order });
37
32
  this._listeners.set(event, list);
38
33
  }
39
34
  /**
@@ -44,7 +39,7 @@ class EventHooks {
44
39
  */
45
40
  once(event, listener, order = 0) {
46
41
  const list = (this._listeners.get(event) || []).slice();
47
- (0, array_1.insertOrderSorted)(list, { listener, once: true, order });
42
+ insertOrderSorted(list, { listener, once: true, order });
48
43
  this._listeners.set(event, list);
49
44
  }
50
45
  /**
@@ -93,4 +88,3 @@ class EventHooks {
93
88
  }
94
89
  }
95
90
  }
96
- exports.EventHooks = EventHooks;