@mtkruto/node 0.1.200 → 0.1.300

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 (231) hide show
  1. package/esm/0_deps.d.ts +1 -1
  2. package/esm/0_deps.js +2 -1
  3. package/esm/1_utilities.d.ts +1 -1
  4. package/esm/1_utilities.js +1 -1
  5. package/esm/4_errors.js +3 -3
  6. package/esm/client/0_markdown.js +5 -5
  7. package/esm/client/0_utilities.d.ts +6 -0
  8. package/esm/client/0_utilities.js +35 -4
  9. package/esm/client/1_account_manager.js +4 -4
  10. package/esm/client/1_client_encrypted.js +4 -4
  11. package/esm/client/1_client_plain.js +3 -3
  12. package/esm/client/1_file_manager.js +6 -5
  13. package/esm/client/1_reaction_manager.js +2 -2
  14. package/esm/client/1_update_manager.js +9 -8
  15. package/esm/client/2_message_manager.js +47 -24
  16. package/esm/client/3_callback_query_manager.js +2 -0
  17. package/esm/client/3_chat_list_manager.js +13 -12
  18. package/esm/client/3_inline_query_manager.js +4 -2
  19. package/esm/client/3_story_manager.js +7 -5
  20. package/esm/client/4_client.d.ts +5 -8
  21. package/esm/client/4_client.js +19 -27
  22. package/esm/connection/1_connection_web_socket.js +3 -2
  23. package/{script/deps/deno.land/x/tgcrypto@0.3.3 → esm/deps/deno.land/x/tgcrypto@0.4.0}/mod.d.ts +0 -1
  24. package/esm/deps/deno.land/x/{tgcrypto@0.3.3 → tgcrypto@0.4.0}/mod.js +0 -11
  25. package/esm/deps/deno.land/x/tgcrypto@0.4.0/tgcrypto.js +308 -0
  26. package/esm/mod.d.ts +1 -1
  27. package/esm/mod.js +1 -1
  28. package/esm/storage/0_storage.js +6 -5
  29. package/esm/storage/1_utilities.d.ts +0 -1
  30. package/esm/storage/1_utilities.js +2 -3
  31. package/esm/storage/2_storage_local_storage.js +1 -4
  32. package/esm/storage/2_storage_session_storage.js +1 -4
  33. package/esm/tl/3_utilities.js +5 -4
  34. package/esm/transport/2_transport_provider.js +4 -4
  35. package/esm/types/0_message_entity.js +3 -3
  36. package/esm/types/0_message_search_filter.js +2 -2
  37. package/esm/types/0_reaction.js +2 -2
  38. package/esm/types/1_bot_command_scope.js +3 -3
  39. package/esm/types/1_chat_p.js +3 -2
  40. package/esm/types/1_keyboard_button.js +3 -3
  41. package/esm/types/1_message_reaction.js +2 -2
  42. package/esm/types/1_story_privacy.js +3 -3
  43. package/esm/types/2_chat_member.js +6 -5
  44. package/esm/types/2_chosen_inline_result.js +3 -2
  45. package/esm/types/2_inactive_chat.js +3 -2
  46. package/esm/types/2_inline_keyboard_button.js +3 -3
  47. package/esm/types/2_inline_query.js +3 -3
  48. package/esm/types/2_invite_link.js +3 -2
  49. package/esm/types/2_story_content.js +5 -5
  50. package/esm/types/2_story_interactive_area.js +5 -5
  51. package/esm/types/3_chat_member_updated.js +4 -3
  52. package/esm/types/3_reply_markup.js +4 -3
  53. package/esm/types/3_story.js +3 -2
  54. package/esm/types/4_inline_query_result.js +5 -5
  55. package/esm/types/4_message.js +17 -16
  56. package/esm/types/5_callback_query.js +4 -3
  57. package/esm/types/5_chat.js +8 -7
  58. package/esm/types/_file_id.js +9 -8
  59. package/esm/utilities/0_bigint.d.ts +1 -0
  60. package/esm/utilities/0_bigint.js +25 -0
  61. package/esm/utilities/0_logger.d.ts +8 -0
  62. package/esm/utilities/0_logger.js +9 -5
  63. package/esm/utilities/1_math.d.ts +1 -0
  64. package/esm/utilities/1_math.js +51 -0
  65. package/esm/utilities/1_misc.js +2 -2
  66. package/package.json +1 -1
  67. package/script/0_deps.d.ts +1 -1
  68. package/script/0_deps.js +3 -3
  69. package/script/1_utilities.d.ts +1 -1
  70. package/script/1_utilities.js +1 -1
  71. package/script/4_errors.js +3 -3
  72. package/script/client/0_markdown.js +5 -5
  73. package/script/client/0_utilities.d.ts +6 -0
  74. package/script/client/0_utilities.js +41 -4
  75. package/script/client/1_account_manager.js +4 -4
  76. package/script/client/1_client_encrypted.js +2 -2
  77. package/script/client/1_client_plain.js +2 -2
  78. package/script/client/1_file_manager.js +5 -4
  79. package/script/client/1_reaction_manager.js +2 -2
  80. package/script/client/1_update_manager.js +8 -7
  81. package/script/client/2_message_manager.js +51 -28
  82. package/script/client/3_callback_query_manager.js +2 -0
  83. package/script/client/3_chat_list_manager.js +12 -11
  84. package/script/client/3_inline_query_manager.js +4 -2
  85. package/script/client/3_story_manager.js +4 -2
  86. package/script/client/4_client.d.ts +5 -8
  87. package/script/client/4_client.js +18 -26
  88. package/script/connection/1_connection_web_socket.js +2 -1
  89. package/{esm/deps/deno.land/x/tgcrypto@0.3.3 → script/deps/deno.land/x/tgcrypto@0.4.0}/mod.d.ts +0 -1
  90. package/script/deps/deno.land/x/{tgcrypto@0.3.3 → tgcrypto@0.4.0}/mod.js +1 -13
  91. package/script/deps/deno.land/x/tgcrypto@0.4.0/tgcrypto.js +310 -0
  92. package/script/mod.d.ts +1 -1
  93. package/script/mod.js +2 -1
  94. package/script/storage/0_storage.js +5 -4
  95. package/script/storage/1_utilities.d.ts +0 -1
  96. package/script/storage/1_utilities.js +3 -4
  97. package/script/storage/2_storage_local_storage.js +0 -3
  98. package/script/storage/2_storage_session_storage.js +0 -3
  99. package/script/tl/3_utilities.js +4 -3
  100. package/script/transport/2_transport_provider.js +4 -4
  101. package/script/types/0_message_entity.js +3 -3
  102. package/script/types/0_message_search_filter.js +2 -2
  103. package/script/types/0_reaction.js +2 -2
  104. package/script/types/1_bot_command_scope.js +3 -3
  105. package/script/types/1_chat_p.js +2 -1
  106. package/script/types/1_keyboard_button.js +3 -3
  107. package/script/types/1_message_reaction.js +2 -2
  108. package/script/types/1_story_privacy.js +3 -3
  109. package/script/types/2_chat_member.js +5 -4
  110. package/script/types/2_chosen_inline_result.js +2 -1
  111. package/script/types/2_inactive_chat.js +2 -1
  112. package/script/types/2_inline_keyboard_button.js +3 -3
  113. package/script/types/2_inline_query.js +3 -3
  114. package/script/types/2_invite_link.js +2 -1
  115. package/script/types/2_story_content.js +5 -5
  116. package/script/types/2_story_interactive_area.js +5 -5
  117. package/script/types/3_chat_member_updated.js +3 -2
  118. package/script/types/3_reply_markup.js +3 -2
  119. package/script/types/3_story.js +2 -1
  120. package/script/types/4_inline_query_result.js +5 -5
  121. package/script/types/4_message.js +16 -15
  122. package/script/types/5_callback_query.js +3 -2
  123. package/script/types/5_chat.js +7 -6
  124. package/script/types/_file_id.js +8 -7
  125. package/script/utilities/0_bigint.d.ts +1 -0
  126. package/script/utilities/0_bigint.js +27 -1
  127. package/script/utilities/0_logger.d.ts +8 -0
  128. package/script/utilities/0_logger.js +11 -6
  129. package/script/utilities/1_math.d.ts +1 -0
  130. package/script/utilities/1_math.js +55 -0
  131. package/script/utilities/1_misc.js +2 -2
  132. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/DomHandler.d.ts +0 -83
  133. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/DomHandler.js +0 -203
  134. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/DomSerializer.d.ts +0 -50
  135. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/DomSerializer.js +0 -274
  136. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/ElementType.d.ts +0 -47
  137. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/ElementType.js +0 -51
  138. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/FeedHandler.d.ts +0 -66
  139. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/FeedHandler.js +0 -191
  140. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/Node.d.ts +0 -168
  141. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/Node.js +0 -385
  142. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/Parser.d.ts +0 -159
  143. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/Parser.js +0 -431
  144. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/Tokenizer.d.ts +0 -181
  145. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/Tokenizer.js +0 -1046
  146. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/mod.d.ts +0 -42
  147. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/mod.js +0 -52
  148. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/decode.d.ts +0 -11
  149. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/decode.js +0 -122
  150. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/decode_codepoint.d.ts +0 -1
  151. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/decode_codepoint.js +0 -24
  152. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/encode.d.ts +0 -46
  153. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/encode.js +0 -121
  154. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/maps/decode.d.ts +0 -31
  155. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/maps/decode.js +0 -30
  156. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/maps/entities.d.ts +0 -2128
  157. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/maps/entities.js +0 -2127
  158. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/maps/legacy.d.ts +0 -109
  159. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/maps/legacy.js +0 -108
  160. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/maps/xml.d.ts +0 -8
  161. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/maps/xml.js +0 -1
  162. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/mod.d.ts +0 -90
  163. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/mod.js +0 -95
  164. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/helpers.d.ts +0 -50
  165. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/helpers.js +0 -128
  166. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/legacy.d.ts +0 -46
  167. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/legacy.js +0 -110
  168. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/manipulation.d.ts +0 -42
  169. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/manipulation.js +0 -120
  170. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/mod.d.ts +0 -6
  171. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/mod.js +0 -6
  172. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/querying.d.ts +0 -54
  173. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/querying.js +0 -110
  174. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/stringify.d.ts +0 -40
  175. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/stringify.js +0 -75
  176. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/traversal.d.ts +0 -58
  177. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/traversal.js +0 -101
  178. package/esm/deps/deno.land/x/tgcrypto@0.3.3/tgcrypto.js +0 -324
  179. package/esm/utilities/0_control.d.ts +0 -1
  180. package/esm/utilities/0_control.js +0 -3
  181. package/script/deps/deno.land/x/html_parser@v0.1.3/src/DomHandler.d.ts +0 -83
  182. package/script/deps/deno.land/x/html_parser@v0.1.3/src/DomHandler.js +0 -207
  183. package/script/deps/deno.land/x/html_parser@v0.1.3/src/DomSerializer.d.ts +0 -50
  184. package/script/deps/deno.land/x/html_parser@v0.1.3/src/DomSerializer.js +0 -301
  185. package/script/deps/deno.land/x/html_parser@v0.1.3/src/ElementType.d.ts +0 -47
  186. package/script/deps/deno.land/x/html_parser@v0.1.3/src/ElementType.js +0 -55
  187. package/script/deps/deno.land/x/html_parser@v0.1.3/src/FeedHandler.d.ts +0 -66
  188. package/script/deps/deno.land/x/html_parser@v0.1.3/src/FeedHandler.js +0 -222
  189. package/script/deps/deno.land/x/html_parser@v0.1.3/src/Node.d.ts +0 -168
  190. package/script/deps/deno.land/x/html_parser@v0.1.3/src/Node.js +0 -404
  191. package/script/deps/deno.land/x/html_parser@v0.1.3/src/Parser.d.ts +0 -159
  192. package/script/deps/deno.land/x/html_parser@v0.1.3/src/Parser.js +0 -438
  193. package/script/deps/deno.land/x/html_parser@v0.1.3/src/Tokenizer.d.ts +0 -181
  194. package/script/deps/deno.land/x/html_parser@v0.1.3/src/Tokenizer.js +0 -1052
  195. package/script/deps/deno.land/x/html_parser@v0.1.3/src/mod.d.ts +0 -42
  196. package/script/deps/deno.land/x/html_parser@v0.1.3/src/mod.js +0 -88
  197. package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/decode.d.ts +0 -11
  198. package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/decode.js +0 -128
  199. package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/decode_codepoint.d.ts +0 -1
  200. package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/decode_codepoint.js +0 -30
  201. package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/encode.d.ts +0 -46
  202. package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/encode.js +0 -129
  203. package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/maps/decode.d.ts +0 -31
  204. package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/maps/decode.js +0 -32
  205. package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/maps/entities.d.ts +0 -2128
  206. package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/maps/entities.js +0 -2129
  207. package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/maps/legacy.d.ts +0 -109
  208. package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/maps/legacy.js +0 -110
  209. package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/maps/xml.d.ts +0 -8
  210. package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/maps/xml.js +0 -3
  211. package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/mod.d.ts +0 -90
  212. package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/mod.js +0 -114
  213. package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/helpers.d.ts +0 -50
  214. package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/helpers.js +0 -134
  215. package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/legacy.d.ts +0 -46
  216. package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/legacy.js +0 -118
  217. package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/manipulation.d.ts +0 -42
  218. package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/manipulation.js +0 -129
  219. package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/mod.d.ts +0 -6
  220. package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/mod.js +0 -22
  221. package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/querying.d.ts +0 -54
  222. package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/querying.js +0 -119
  223. package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/stringify.d.ts +0 -40
  224. package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/stringify.js +0 -86
  225. package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/traversal.d.ts +0 -58
  226. package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/traversal.js +0 -112
  227. package/script/deps/deno.land/x/tgcrypto@0.3.3/tgcrypto.js +0 -326
  228. package/script/utilities/0_control.d.ts +0 -1
  229. package/script/utilities/0_control.js +0 -7
  230. /package/esm/deps/deno.land/x/{tgcrypto@0.3.3 → tgcrypto@0.4.0}/tgcrypto.d.ts +0 -0
  231. /package/script/deps/deno.land/x/{tgcrypto@0.3.3 → tgcrypto@0.4.0}/tgcrypto.d.ts +0 -0
@@ -1,42 +0,0 @@
1
- import { Parser, ParserOptions } from './Parser.js';
2
- export { Parser };
3
- export type { ParserOptions };
4
- import { Node, Element, Document } from './Node.js';
5
- import { DomHandler, DomHandlerOptions } from './DomHandler.js';
6
- export { DomHandler };
7
- export type { DomHandlerOptions };
8
- type Options = ParserOptions & DomHandlerOptions;
9
- /**
10
- * Parses the data, returns the resulting document.
11
- *
12
- * @param data The data that should be parsed.
13
- * @param options Optional options for the parser and DOM builder.
14
- */
15
- export declare function parseDocument(data: string, options?: Options): Document;
16
- /**
17
- * Parses data, returns an array of the root nodes.
18
- *
19
- * Note that the root nodes still have a `Document` node as their parent.
20
- * Use `parseDocument` to get the `Document` node instead.
21
- *
22
- * @param data The data that should be parsed.
23
- * @param options Optional options for the parser and DOM builder.
24
- * @deprecated Use `parseDocument` instead.
25
- */
26
- export declare function parseDOM(data: string, options?: Options): Node[];
27
- /**
28
- * Creates a parser instance, with an attached DOM handler.
29
- *
30
- * @param cb A callback that will be called once parsing has been completed.
31
- * @param options Optional options for the parser and DOM builder.
32
- * @param elementCb An optional callback that will be called every time a tag has been completed inside of the DOM.
33
- */
34
- export declare function createDomStream(cb: (error: Error | null, dom: Node[]) => void, options?: Options, elementCb?: (element: Element) => void): Parser;
35
- export { default as Tokenizer } from './Tokenizer.js';
36
- export type { Callbacks as TokenizerCallbacks } from './Tokenizer.js';
37
- import * as ElementType from './ElementType.js';
38
- export { ElementType };
39
- export * from './FeedHandler.js';
40
- export * as DomUtils from './utils/mod.js';
41
- export { DomHandler as DefaultHandler };
42
- export { FeedHandler as RssHandler } from './FeedHandler.js';
@@ -1,88 +0,0 @@
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
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
26
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
27
- };
28
- var __importDefault = (this && this.__importDefault) || function (mod) {
29
- return (mod && mod.__esModule) ? mod : { "default": mod };
30
- };
31
- Object.defineProperty(exports, "__esModule", { value: true });
32
- exports.RssHandler = exports.DefaultHandler = exports.DomUtils = exports.ElementType = exports.Tokenizer = exports.createDomStream = exports.parseDOM = exports.parseDocument = exports.DomHandler = exports.Parser = void 0;
33
- const Parser_js_1 = require("./Parser.js");
34
- Object.defineProperty(exports, "Parser", { enumerable: true, get: function () { return Parser_js_1.Parser; } });
35
- const DomHandler_js_1 = require("./DomHandler.js");
36
- Object.defineProperty(exports, "DomHandler", { enumerable: true, get: function () { return DomHandler_js_1.DomHandler; } });
37
- Object.defineProperty(exports, "DefaultHandler", { enumerable: true, get: function () { return DomHandler_js_1.DomHandler; } });
38
- // Helper methods
39
- /**
40
- * Parses the data, returns the resulting document.
41
- *
42
- * @param data The data that should be parsed.
43
- * @param options Optional options for the parser and DOM builder.
44
- */
45
- function parseDocument(data, options) {
46
- const handler = new DomHandler_js_1.DomHandler(undefined, options);
47
- new Parser_js_1.Parser(handler, options).end(data);
48
- return handler.root;
49
- }
50
- exports.parseDocument = parseDocument;
51
- /**
52
- * Parses data, returns an array of the root nodes.
53
- *
54
- * Note that the root nodes still have a `Document` node as their parent.
55
- * Use `parseDocument` to get the `Document` node instead.
56
- *
57
- * @param data The data that should be parsed.
58
- * @param options Optional options for the parser and DOM builder.
59
- * @deprecated Use `parseDocument` instead.
60
- */
61
- function parseDOM(data, options) {
62
- return parseDocument(data, options).children;
63
- }
64
- exports.parseDOM = parseDOM;
65
- /**
66
- * Creates a parser instance, with an attached DOM handler.
67
- *
68
- * @param cb A callback that will be called once parsing has been completed.
69
- * @param options Optional options for the parser and DOM builder.
70
- * @param elementCb An optional callback that will be called every time a tag has been completed inside of the DOM.
71
- */
72
- function createDomStream(cb, options, elementCb) {
73
- const handler = new DomHandler_js_1.DomHandler(cb, options, elementCb);
74
- return new Parser_js_1.Parser(handler, options);
75
- }
76
- exports.createDomStream = createDomStream;
77
- var Tokenizer_js_1 = require("./Tokenizer.js");
78
- Object.defineProperty(exports, "Tokenizer", { enumerable: true, get: function () { return __importDefault(Tokenizer_js_1).default; } });
79
- const ElementType = __importStar(require("./ElementType.js"));
80
- exports.ElementType = ElementType;
81
- /*
82
- * All of the following exports exist for backwards-compatibility.
83
- * They should probably be removed eventually.
84
- */
85
- __exportStar(require("./FeedHandler.js"), exports);
86
- exports.DomUtils = __importStar(require("./utils/mod.js"));
87
- var FeedHandler_js_1 = require("./FeedHandler.js");
88
- Object.defineProperty(exports, "RssHandler", { enumerable: true, get: function () { return FeedHandler_js_1.FeedHandler; } });
@@ -1,11 +0,0 @@
1
- export interface TrieNode {
2
- value?: string;
3
- legacy?: boolean;
4
- base?: number;
5
- next?: Map<string, TrieNode>;
6
- }
7
- export declare const xmlTrie: TrieNode;
8
- export declare const decodeXML: (str: string) => string;
9
- export declare const htmlTrie: TrieNode;
10
- export declare const decodeHTMLStrict: (str: string) => string;
11
- export declare const decodeHTML: (str: string) => string;
@@ -1,128 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.decodeHTML = exports.decodeHTMLStrict = exports.htmlTrie = exports.decodeXML = exports.xmlTrie = void 0;
7
- const entities_js_1 = __importDefault(require("./maps/entities.js"));
8
- const legacy_js_1 = __importDefault(require("./maps/legacy.js"));
9
- const xml_js_1 = __importDefault(require("./maps/xml.js"));
10
- const decode_codepoint_js_1 = __importDefault(require("./decode_codepoint.js"));
11
- const numStart = (function () {
12
- const numStart = new Map();
13
- const numRecurse = new Map();
14
- const numValue = { next: numRecurse, base: 10 };
15
- for (let i = 0; i <= 9; i++) {
16
- numStart.set(i.toString(10), numValue);
17
- numRecurse.set(i.toString(10), numValue);
18
- }
19
- const hexRecurse = new Map();
20
- const hexValue = { next: hexRecurse, base: 16 };
21
- for (let i = 0; i <= 15; i++) {
22
- hexRecurse.set(i.toString(16), hexValue);
23
- hexRecurse.set(i.toString(16).toUpperCase(), hexValue);
24
- }
25
- const hexStart = { next: hexRecurse };
26
- numStart.set('x', hexStart);
27
- numStart.set('X', hexStart);
28
- return { next: numStart };
29
- })();
30
- function getTrieReplacer(trieStart, legacyEntities) {
31
- return (str) => {
32
- let ret = '';
33
- let lastIdx = 0;
34
- let legacyTrieIndex = 0;
35
- let idx = 0;
36
- function decodeNumeric(base) {
37
- const entity = str.substring(
38
- // Skip the leading "&#". For hex entities, also skip the leading "x".
39
- lastIdx + 2 + (base >>> 4), idx);
40
- const parsed = parseInt(entity, base);
41
- return (0, decode_codepoint_js_1.default)(parsed);
42
- }
43
- entityLoop: while ((idx = str.indexOf('&', idx)) >= 0) {
44
- ret += str.slice(lastIdx, idx);
45
- lastIdx = idx;
46
- let trieNode = trieStart;
47
- let legacyTrie;
48
- while (++idx < str.length) {
49
- const c = str.charAt(idx);
50
- if (c === ';') {
51
- if (trieNode.value) {
52
- ret += trieNode.value;
53
- }
54
- else if (trieNode.base) {
55
- ret += decodeNumeric(trieNode.base);
56
- }
57
- else
58
- break;
59
- idx += 1;
60
- lastIdx = idx;
61
- continue entityLoop;
62
- }
63
- else {
64
- const next = trieNode.next?.get(c);
65
- if (next) {
66
- trieNode = next;
67
- if (legacyEntities && next.legacy) {
68
- legacyTrie = next;
69
- legacyTrieIndex = idx;
70
- }
71
- }
72
- else
73
- break;
74
- }
75
- }
76
- if (legacyEntities) {
77
- if (legacyTrie) {
78
- ret += legacyTrie.value;
79
- lastIdx = legacyTrieIndex + 1;
80
- }
81
- else if (trieNode.base) {
82
- ret += decodeNumeric(trieNode.base);
83
- lastIdx = idx;
84
- }
85
- }
86
- }
87
- return ret + str.substr(lastIdx);
88
- };
89
- }
90
- exports.xmlTrie = { next: getTrie(xml_js_1.default) };
91
- exports.decodeXML = getTrieReplacer(exports.xmlTrie, false);
92
- exports.htmlTrie = {
93
- next: markLegacyEntries(getTrie(entities_js_1.default), legacy_js_1.default),
94
- };
95
- exports.decodeHTMLStrict = getTrieReplacer(exports.htmlTrie, false);
96
- exports.decodeHTML = getTrieReplacer(exports.htmlTrie, true);
97
- function getTrie(map) {
98
- const trie = new Map();
99
- for (const key of Object.keys(map)) {
100
- // Resolve the key
101
- let lastMap = trie;
102
- for (const char of key.slice(0, -1)) {
103
- const next = lastMap.get(char) ?? {};
104
- lastMap.set(char, next);
105
- lastMap = next.next ??= new Map();
106
- }
107
- const val = lastMap.get(key.slice(-1)) ?? {};
108
- val.value = map[key];
109
- lastMap.set(key.slice(-1), val);
110
- }
111
- // Add numeric values
112
- trie.set('#', numStart);
113
- return trie;
114
- }
115
- function markLegacyEntries(trie, legacy) {
116
- for (const key of Object.keys(legacy)) {
117
- // Resolve the key
118
- let lastMap = { next: trie };
119
- for (const char of key) {
120
- const next = lastMap.next?.get(char);
121
- if (!next)
122
- throw new Error(`Could not find ${key} at ${char}`);
123
- lastMap = next;
124
- }
125
- lastMap.legacy = true;
126
- }
127
- return trie;
128
- }
@@ -1 +0,0 @@
1
- export default function decodeCodePoint(codePoint: number): string;
@@ -1,30 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- const decode_js_1 = __importDefault(require("./maps/decode.js"));
7
- // Adapted from https://github.com/mathiasbynens/he/blob/master/src/he.js#L94-L119
8
- const fromCodePoint =
9
- // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition, node/no-unsupported-features/es-builtins
10
- String.fromCodePoint ||
11
- function (codePoint) {
12
- let output = '';
13
- if (codePoint > 0xffff) {
14
- codePoint -= 0x10000;
15
- output += String.fromCharCode(((codePoint >>> 10) & 0x3ff) | 0xd800);
16
- codePoint = 0xdc00 | (codePoint & 0x3ff);
17
- }
18
- output += String.fromCharCode(codePoint);
19
- return output;
20
- };
21
- function decodeCodePoint(codePoint) {
22
- if ((codePoint >= 0xd800 && codePoint <= 0xdfff) || codePoint > 0x10ffff) {
23
- return '\uFFFD';
24
- }
25
- if (codePoint in decode_js_1.default) {
26
- codePoint = decode_js_1.default[codePoint];
27
- }
28
- return fromCodePoint(codePoint);
29
- }
30
- exports.default = decodeCodePoint;
@@ -1,46 +0,0 @@
1
- /**
2
- * Encodes all non-ASCII characters, as well as characters not valid in XML
3
- * documents using XML entities.
4
- *
5
- * If a character has no equivalent entity, a
6
- * numeric hexadecimal reference (eg. `&#xfc;`) will be used.
7
- */
8
- export declare const encodeXML: (data: string) => string;
9
- /**
10
- * Encodes all entities and non-ASCII characters in the input.
11
- *
12
- * This includes characters that are valid ASCII characters in HTML documents.
13
- * For example `#` will be encoded as `&num;`. To get a more compact output,
14
- * consider using the `encodeNonAsciiHTML` function.
15
- *
16
- * If a character has no equivalent entity, a
17
- * numeric hexadecimal reference (eg. `&#xfc;`) will be used.
18
- */
19
- export declare const encodeHTML: (data: string) => string;
20
- /**
21
- * Encodes all non-ASCII characters, as well as characters not valid in HTML
22
- * documents using HTML entities.
23
- *
24
- * If a character has no equivalent entity, a
25
- * numeric hexadecimal reference (eg. `&#xfc;`) will be used.
26
- */
27
- export declare const encodeNonAsciiHTML: (data: string) => string;
28
- /**
29
- * Encodes all non-ASCII characters, as well as characters not valid in XML
30
- * documents using numeric hexadecimal reference (eg. `&#xfc;`).
31
- *
32
- * Have a look at `escapeUTF8` if you want a more concise output at the expense
33
- * of reduced transportability.
34
- *
35
- * @param data String to escape.
36
- */
37
- export declare function escape(data: string): string;
38
- /**
39
- * Encodes all characters not valid in XML documents using numeric hexadecimal
40
- * reference (eg. `&#xfc;`).
41
- *
42
- * Note that the output will be character-set dependent.
43
- *
44
- * @param data String to escape.
45
- */
46
- export declare function escapeUTF8(data: string): string;
@@ -1,129 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.escapeUTF8 = exports.escape = exports.encodeNonAsciiHTML = exports.encodeHTML = exports.encodeXML = void 0;
7
- const xml_js_1 = __importDefault(require("./maps/xml.js"));
8
- const inverseXML = getInverseObj(xml_js_1.default);
9
- const xmlReplacer = getInverseReplacer(inverseXML);
10
- /**
11
- * Encodes all non-ASCII characters, as well as characters not valid in XML
12
- * documents using XML entities.
13
- *
14
- * If a character has no equivalent entity, a
15
- * numeric hexadecimal reference (eg. `&#xfc;`) will be used.
16
- */
17
- exports.encodeXML = getASCIIEncoder(inverseXML);
18
- const entities_js_1 = __importDefault(require("./maps/entities.js"));
19
- const inverseHTML = getInverseObj(entities_js_1.default);
20
- const htmlReplacer = getInverseReplacer(inverseHTML);
21
- /**
22
- * Encodes all entities and non-ASCII characters in the input.
23
- *
24
- * This includes characters that are valid ASCII characters in HTML documents.
25
- * For example `#` will be encoded as `&num;`. To get a more compact output,
26
- * consider using the `encodeNonAsciiHTML` function.
27
- *
28
- * If a character has no equivalent entity, a
29
- * numeric hexadecimal reference (eg. `&#xfc;`) will be used.
30
- */
31
- exports.encodeHTML = getInverse(inverseHTML, htmlReplacer);
32
- /**
33
- * Encodes all non-ASCII characters, as well as characters not valid in HTML
34
- * documents using HTML entities.
35
- *
36
- * If a character has no equivalent entity, a
37
- * numeric hexadecimal reference (eg. `&#xfc;`) will be used.
38
- */
39
- exports.encodeNonAsciiHTML = getASCIIEncoder(inverseHTML);
40
- function getInverseObj(obj) {
41
- return Object.keys(obj)
42
- .sort()
43
- .reduce((inverse, name) => {
44
- inverse[obj[name]] = `&${name};`;
45
- return inverse;
46
- }, {});
47
- }
48
- function getInverseReplacer(inverse) {
49
- const single = [];
50
- const multiple = [];
51
- for (const k of Object.keys(inverse)) {
52
- if (k.length === 1) {
53
- // Add value to single array
54
- single.push(`\\${k}`);
55
- }
56
- else {
57
- // Add value to multiple array
58
- multiple.push(k);
59
- }
60
- }
61
- // Add ranges to single characters.
62
- single.sort();
63
- for (let start = 0; start < single.length - 1; start++) {
64
- // Find the end of a run of characters
65
- let end = start;
66
- while (end < single.length - 1 &&
67
- single[end].charCodeAt(1) + 1 === single[end + 1].charCodeAt(1)) {
68
- end += 1;
69
- }
70
- const count = 1 + end - start;
71
- // We want to replace at least three characters
72
- if (count < 3)
73
- continue;
74
- single.splice(start, count, `${single[start]}-${single[end]}`);
75
- }
76
- multiple.unshift(`[${single.join('')}]`);
77
- return new RegExp(multiple.join('|'), 'g');
78
- }
79
- // /[^\0-\x7F]/gu
80
- const reNonASCII = /(?:[\x80-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/g;
81
- const getCodePoint =
82
- // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
83
- String.prototype.codePointAt != null
84
- ? // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
85
- (str) => str.codePointAt(0)
86
- : // http://mathiasbynens.be/notes/javascript-encoding#surrogate-formulae
87
- (c) => (c.charCodeAt(0) - 0xd800) * 0x400 +
88
- c.charCodeAt(1) -
89
- 0xdc00 +
90
- 0x10000;
91
- function singleCharReplacer(c) {
92
- return `&#x${(c.length > 1 ? getCodePoint(c) : c.charCodeAt(0))
93
- .toString(16)
94
- .toUpperCase()};`;
95
- }
96
- function getInverse(inverse, re) {
97
- return (data) => data
98
- .replace(re, name => inverse[name])
99
- .replace(reNonASCII, singleCharReplacer);
100
- }
101
- const reEscapeChars = new RegExp(`${xmlReplacer.source}|${reNonASCII.source}`, 'g');
102
- /**
103
- * Encodes all non-ASCII characters, as well as characters not valid in XML
104
- * documents using numeric hexadecimal reference (eg. `&#xfc;`).
105
- *
106
- * Have a look at `escapeUTF8` if you want a more concise output at the expense
107
- * of reduced transportability.
108
- *
109
- * @param data String to escape.
110
- */
111
- function escape(data) {
112
- return data.replace(reEscapeChars, singleCharReplacer);
113
- }
114
- exports.escape = escape;
115
- /**
116
- * Encodes all characters not valid in XML documents using numeric hexadecimal
117
- * reference (eg. `&#xfc;`).
118
- *
119
- * Note that the output will be character-set dependent.
120
- *
121
- * @param data String to escape.
122
- */
123
- function escapeUTF8(data) {
124
- return data.replace(xmlReplacer, singleCharReplacer);
125
- }
126
- exports.escapeUTF8 = escapeUTF8;
127
- function getASCIIEncoder(obj) {
128
- return (data) => data.replace(reEscapeChars, c => obj[c] || singleCharReplacer(c));
129
- }
@@ -1,31 +0,0 @@
1
- declare const _default: {
2
- '0': number;
3
- '128': number;
4
- '130': number;
5
- '131': number;
6
- '132': number;
7
- '133': number;
8
- '134': number;
9
- '135': number;
10
- '136': number;
11
- '137': number;
12
- '138': number;
13
- '139': number;
14
- '140': number;
15
- '142': number;
16
- '145': number;
17
- '146': number;
18
- '147': number;
19
- '148': number;
20
- '149': number;
21
- '150': number;
22
- '151': number;
23
- '152': number;
24
- '153': number;
25
- '154': number;
26
- '155': number;
27
- '156': number;
28
- '158': number;
29
- '159': number;
30
- };
31
- export default _default;
@@ -1,32 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.default = {
4
- '0': 65533,
5
- '128': 8364,
6
- '130': 8218,
7
- '131': 402,
8
- '132': 8222,
9
- '133': 8230,
10
- '134': 8224,
11
- '135': 8225,
12
- '136': 710,
13
- '137': 8240,
14
- '138': 352,
15
- '139': 8249,
16
- '140': 338,
17
- '142': 381,
18
- '145': 8216,
19
- '146': 8217,
20
- '147': 8220,
21
- '148': 8221,
22
- '149': 8226,
23
- '150': 8211,
24
- '151': 8212,
25
- '152': 732,
26
- '153': 8482,
27
- '154': 353,
28
- '155': 8250,
29
- '156': 339,
30
- '158': 382,
31
- '159': 376,
32
- };