@mtkruto/node 0.1.191 → 0.1.201
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.
- package/esm/1_utilities.d.ts +1 -1
- package/esm/1_utilities.js +1 -1
- package/esm/2_tl.d.ts +6 -6
- package/esm/2_tl.js +6 -6
- package/esm/3_storage.d.ts +5 -5
- package/esm/3_storage.js +5 -5
- package/esm/3_types.d.ts +6 -5
- package/esm/3_types.js +6 -5
- package/esm/4_constants.d.ts +2 -2
- package/esm/4_constants.js +2 -2
- package/esm/5_client.d.ts +1 -1
- package/esm/5_client.js +1 -1
- package/esm/client/0_params.d.ts +7 -1
- package/esm/client/0_types.d.ts +1 -0
- package/esm/client/0_utilities.d.ts +0 -3
- package/esm/client/0_utilities.js +0 -20
- package/esm/client/1_business_connection_manager.d.ts +11 -0
- package/esm/client/1_business_connection_manager.js +47 -0
- package/esm/client/1_update_manager.d.ts +8 -1
- package/esm/client/1_update_manager.js +88 -8
- package/esm/client/2_message_manager.d.ts +7 -6
- package/esm/client/2_message_manager.js +48 -31
- package/esm/client/4_client.d.ts +426 -428
- package/esm/client/4_client.js +570 -530
- package/esm/storage/0_storage.d.ts +5 -0
- package/esm/storage/0_storage.js +20 -0
- package/esm/storage/{1_storage_indexed_db.js → 2_storage_indexed_db.js} +1 -1
- package/esm/storage/{1_storage_local_storage.js → 2_storage_local_storage.js} +1 -1
- package/{script/storage/1_storage_memory.d.ts → esm/storage/2_storage_memory.d.ts} +1 -4
- package/esm/storage/{1_storage_memory.js → 2_storage_memory.js} +8 -28
- package/esm/storage/{1_storage_session_storage.js → 2_storage_session_storage.js} +1 -1
- package/esm/tl/2_types.d.ts +1071 -183
- package/esm/tl/2_types.js +2916 -464
- package/esm/tl/3_functions.d.ts +381 -17
- package/esm/tl/3_functions.js +1002 -120
- package/{script/tl/4_tl_writer.d.ts → esm/tl/5_tl_writer.d.ts} +1 -1
- package/{script/tl/4_rpc_result.d.ts → esm/tl/6_rpc_result.d.ts} +1 -1
- package/esm/tl/{4_rpc_result.js → 6_rpc_result.js} +1 -1
- package/esm/tl/{6_message.d.ts → 7_message.d.ts} +2 -2
- package/esm/tl/{6_message.js → 7_message.js} +3 -3
- package/esm/tl/{7_message_container.d.ts → 8_message_container.d.ts} +1 -1
- package/esm/tl/{7_message_container.js → 8_message_container.js} +3 -3
- package/esm/types/0_chat_photo.js +1 -1
- package/esm/types/0_message_entity.d.ts +1 -1
- package/esm/types/0_thumbnail.js +1 -1
- package/esm/types/1_bot_command_scope.d.ts +1 -1
- package/esm/types/1_photo.js +2 -2
- package/esm/types/1_story_privacy.d.ts +1 -1
- package/esm/types/2_business_connection.d.ts +11 -0
- package/esm/types/2_business_connection.js +12 -0
- package/esm/types/2_chat_member.d.ts +1 -1
- package/esm/types/2_chosen_inline_result.d.ts +1 -1
- package/esm/types/2_game.js +1 -1
- package/esm/types/2_inline_keyboard_button.d.ts +1 -1
- package/esm/types/2_inline_query.d.ts +1 -1
- package/esm/types/2_invite_link.d.ts +1 -1
- package/esm/types/2_message_reaction_count.d.ts +1 -1
- package/esm/types/2_message_reactions.d.ts +1 -1
- package/esm/types/2_story_content.js +1 -1
- package/esm/types/{1_story_interactive_area.d.ts → 2_story_interactive_area.d.ts} +2 -2
- package/esm/types/{1_story_interactive_area.js → 2_story_interactive_area.js} +1 -1
- package/esm/types/3_chat_member_updated.d.ts +1 -1
- package/esm/types/3_reply_markup.d.ts +1 -1
- package/esm/types/3_story.d.ts +2 -2
- package/esm/types/3_story.js +1 -1
- package/esm/types/4_inline_query_result.d.ts +1 -1
- package/esm/types/4_inline_query_result.js +1 -1
- package/esm/types/4_message.d.ts +9 -3
- package/esm/types/4_message.js +22 -5
- package/esm/types/5_callback_query.d.ts +1 -1
- package/esm/types/5_chat.d.ts +1 -1
- package/esm/types/6_update.d.ts +12 -2
- package/package.json +1 -1
- package/script/1_utilities.d.ts +1 -1
- package/script/1_utilities.js +1 -1
- package/script/2_tl.d.ts +6 -6
- package/script/2_tl.js +6 -6
- package/script/3_storage.d.ts +5 -5
- package/script/3_storage.js +5 -5
- package/script/3_types.d.ts +6 -5
- package/script/3_types.js +6 -5
- package/script/4_constants.d.ts +2 -2
- package/script/4_constants.js +2 -2
- package/script/5_client.d.ts +1 -1
- package/script/5_client.js +1 -1
- package/script/client/0_params.d.ts +7 -1
- package/script/client/0_types.d.ts +1 -0
- package/script/client/0_utilities.d.ts +0 -3
- package/script/client/0_utilities.js +1 -23
- package/script/client/1_business_connection_manager.d.ts +11 -0
- package/script/client/1_business_connection_manager.js +51 -0
- package/script/client/1_update_manager.d.ts +8 -1
- package/script/client/1_update_manager.js +88 -8
- package/script/client/2_message_manager.d.ts +7 -6
- package/script/client/2_message_manager.js +47 -30
- package/script/client/4_client.d.ts +426 -428
- package/script/client/4_client.js +570 -530
- package/script/storage/0_storage.d.ts +5 -0
- package/script/storage/0_storage.js +20 -0
- package/script/storage/{1_storage_indexed_db.js → 2_storage_indexed_db.js} +7 -7
- package/script/storage/{1_storage_local_storage.js → 2_storage_local_storage.js} +10 -10
- package/{esm/storage/1_storage_memory.d.ts → script/storage/2_storage_memory.d.ts} +1 -4
- package/script/storage/{1_storage_memory.js → 2_storage_memory.js} +12 -32
- package/script/storage/{1_storage_session_storage.js → 2_storage_session_storage.js} +10 -10
- package/script/tl/2_types.d.ts +1071 -183
- package/script/tl/2_types.js +3028 -504
- package/script/tl/3_functions.d.ts +381 -17
- package/script/tl/3_functions.js +1047 -143
- package/{esm/tl/4_tl_writer.d.ts → script/tl/5_tl_writer.d.ts} +1 -1
- package/{esm/tl/4_rpc_result.d.ts → script/tl/6_rpc_result.d.ts} +1 -1
- package/script/tl/{4_rpc_result.js → 6_rpc_result.js} +2 -2
- package/script/tl/{6_message.d.ts → 7_message.d.ts} +2 -2
- package/script/tl/{6_message.js → 7_message.js} +8 -8
- package/script/tl/{7_message_container.d.ts → 8_message_container.d.ts} +1 -1
- package/script/tl/{7_message_container.js → 8_message_container.js} +7 -7
- package/script/types/0_chat_photo.js +9 -9
- package/script/types/0_message_entity.d.ts +1 -1
- package/script/types/0_thumbnail.js +6 -6
- package/script/types/1_bot_command_scope.d.ts +1 -1
- package/script/types/1_photo.js +7 -7
- package/script/types/1_story_privacy.d.ts +1 -1
- package/script/types/2_business_connection.d.ts +11 -0
- package/script/types/2_business_connection.js +16 -0
- package/script/types/2_chat_member.d.ts +1 -1
- package/script/types/2_chosen_inline_result.d.ts +1 -1
- package/script/types/2_game.js +3 -3
- package/script/types/2_inline_keyboard_button.d.ts +1 -1
- package/script/types/2_inline_query.d.ts +1 -1
- package/script/types/2_invite_link.d.ts +1 -1
- package/script/types/2_message_reaction_count.d.ts +1 -1
- package/script/types/2_message_reactions.d.ts +1 -1
- package/script/types/2_story_content.js +4 -4
- package/script/types/{1_story_interactive_area.d.ts → 2_story_interactive_area.d.ts} +2 -2
- package/script/types/{1_story_interactive_area.js → 2_story_interactive_area.js} +2 -2
- package/script/types/3_chat_member_updated.d.ts +1 -1
- package/script/types/3_reply_markup.d.ts +1 -1
- package/script/types/3_story.d.ts +2 -2
- package/script/types/3_story.js +2 -2
- package/script/types/4_inline_query_result.d.ts +1 -1
- package/script/types/4_inline_query_result.js +2 -2
- package/script/types/4_message.d.ts +9 -3
- package/script/types/4_message.js +37 -20
- package/script/types/5_callback_query.d.ts +1 -1
- package/script/types/5_chat.d.ts +1 -1
- package/script/types/6_update.d.ts +12 -2
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/DomHandler.d.ts +0 -83
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/DomHandler.js +0 -203
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/DomSerializer.d.ts +0 -50
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/DomSerializer.js +0 -274
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/ElementType.d.ts +0 -47
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/ElementType.js +0 -51
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/FeedHandler.d.ts +0 -66
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/FeedHandler.js +0 -191
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/Node.d.ts +0 -168
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/Node.js +0 -385
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/Parser.d.ts +0 -159
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/Parser.js +0 -431
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/Tokenizer.d.ts +0 -181
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/Tokenizer.js +0 -1046
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/mod.d.ts +0 -42
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/mod.js +0 -52
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/decode.d.ts +0 -11
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/decode.js +0 -122
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/decode_codepoint.d.ts +0 -1
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/decode_codepoint.js +0 -24
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/encode.d.ts +0 -46
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/encode.js +0 -121
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/maps/decode.d.ts +0 -31
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/maps/decode.js +0 -30
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/maps/entities.d.ts +0 -2128
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/maps/entities.js +0 -2127
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/maps/legacy.d.ts +0 -109
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/maps/legacy.js +0 -108
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/maps/xml.d.ts +0 -8
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/maps/xml.js +0 -1
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/mod.d.ts +0 -90
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/mod.js +0 -95
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/helpers.d.ts +0 -50
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/helpers.js +0 -128
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/legacy.d.ts +0 -46
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/legacy.js +0 -110
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/manipulation.d.ts +0 -42
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/manipulation.js +0 -120
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/mod.d.ts +0 -6
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/mod.js +0 -6
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/querying.d.ts +0 -54
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/querying.js +0 -110
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/stringify.d.ts +0 -40
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/stringify.js +0 -75
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/traversal.d.ts +0 -58
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/traversal.js +0 -101
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/DomHandler.d.ts +0 -83
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/DomHandler.js +0 -207
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/DomSerializer.d.ts +0 -50
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/DomSerializer.js +0 -301
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/ElementType.d.ts +0 -47
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/ElementType.js +0 -55
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/FeedHandler.d.ts +0 -66
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/FeedHandler.js +0 -222
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/Node.d.ts +0 -168
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/Node.js +0 -404
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/Parser.d.ts +0 -159
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/Parser.js +0 -438
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/Tokenizer.d.ts +0 -181
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/Tokenizer.js +0 -1052
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/mod.d.ts +0 -42
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/mod.js +0 -88
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/decode.d.ts +0 -11
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/decode.js +0 -128
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/decode_codepoint.d.ts +0 -1
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/decode_codepoint.js +0 -30
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/encode.d.ts +0 -46
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/encode.js +0 -129
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/maps/decode.d.ts +0 -31
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/maps/decode.js +0 -32
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/maps/entities.d.ts +0 -2128
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/maps/entities.js +0 -2129
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/maps/legacy.d.ts +0 -109
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/maps/legacy.js +0 -110
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/maps/xml.d.ts +0 -8
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/maps/xml.js +0 -3
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/mod.d.ts +0 -90
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/mod.js +0 -114
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/helpers.d.ts +0 -50
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/helpers.js +0 -134
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/legacy.d.ts +0 -46
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/legacy.js +0 -118
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/manipulation.d.ts +0 -42
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/manipulation.js +0 -129
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/mod.d.ts +0 -6
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/mod.js +0 -22
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/querying.d.ts +0 -54
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/querying.js +0 -119
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/stringify.d.ts +0 -40
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/stringify.js +0 -86
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/traversal.d.ts +0 -58
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/traversal.js +0 -112
- /package/esm/storage/{0_utilities.d.ts → 1_utilities.d.ts} +0 -0
- /package/esm/storage/{0_utilities.js → 1_utilities.js} +0 -0
- /package/esm/storage/{1_storage_indexed_db.d.ts → 2_storage_indexed_db.d.ts} +0 -0
- /package/esm/storage/{1_storage_local_storage.d.ts → 2_storage_local_storage.d.ts} +0 -0
- /package/esm/storage/{1_storage_session_storage.d.ts → 2_storage_session_storage.d.ts} +0 -0
- /package/esm/tl/{3_tl_reader.d.ts → 4_tl_reader.d.ts} +0 -0
- /package/esm/tl/{3_tl_reader.js → 4_tl_reader.js} +0 -0
- /package/esm/tl/{4_tl_writer.js → 5_tl_writer.js} +0 -0
- /package/esm/types/{0_venue.d.ts → 1_venue.d.ts} +0 -0
- /package/esm/types/{0_venue.js → 1_venue.js} +0 -0
- /package/esm/types/{0__file_id.d.ts → _file_id.d.ts} +0 -0
- /package/esm/types/{0__file_id.js → _file_id.js} +0 -0
- /package/esm/types/{1__getters.d.ts → _getters.d.ts} +0 -0
- /package/esm/types/{1__getters.js → _getters.js} +0 -0
- /package/script/storage/{0_utilities.d.ts → 1_utilities.d.ts} +0 -0
- /package/script/storage/{0_utilities.js → 1_utilities.js} +0 -0
- /package/script/storage/{1_storage_indexed_db.d.ts → 2_storage_indexed_db.d.ts} +0 -0
- /package/script/storage/{1_storage_local_storage.d.ts → 2_storage_local_storage.d.ts} +0 -0
- /package/script/storage/{1_storage_session_storage.d.ts → 2_storage_session_storage.d.ts} +0 -0
- /package/script/tl/{3_tl_reader.d.ts → 4_tl_reader.d.ts} +0 -0
- /package/script/tl/{3_tl_reader.js → 4_tl_reader.js} +0 -0
- /package/script/tl/{4_tl_writer.js → 5_tl_writer.js} +0 -0
- /package/script/types/{0_venue.d.ts → 1_venue.d.ts} +0 -0
- /package/script/types/{0_venue.js → 1_venue.js} +0 -0
- /package/script/types/{0__file_id.d.ts → _file_id.d.ts} +0 -0
- /package/script/types/{0__file_id.js → _file_id.js} +0 -0
- /package/script/types/{1__getters.d.ts → _getters.d.ts} +0 -0
- /package/script/types/{1__getters.js → _getters.js} +0 -0
|
@@ -1,159 +0,0 @@
|
|
|
1
|
-
import Tokenizer from './Tokenizer.js';
|
|
2
|
-
export interface ParserOptions {
|
|
3
|
-
/**
|
|
4
|
-
* Indicates whether special tags (`<script>`, `<style>`, and `<title>`) should get special treatment
|
|
5
|
-
* and if "empty" tags (eg. `<br>`) can have children. If `false`, the content of special tags
|
|
6
|
-
* will be text only. For feeds and other XML content (documents that don't consist of HTML),
|
|
7
|
-
* set this to `true`.
|
|
8
|
-
*
|
|
9
|
-
* @default false
|
|
10
|
-
*/
|
|
11
|
-
xmlMode?: boolean;
|
|
12
|
-
/**
|
|
13
|
-
* Decode entities within the document.
|
|
14
|
-
*
|
|
15
|
-
* @default true
|
|
16
|
-
*/
|
|
17
|
-
decodeEntities?: boolean;
|
|
18
|
-
/**
|
|
19
|
-
* If set to true, all tags will be lowercased.
|
|
20
|
-
*
|
|
21
|
-
* @default !xmlMode
|
|
22
|
-
*/
|
|
23
|
-
lowerCaseTags?: boolean;
|
|
24
|
-
/**
|
|
25
|
-
* If set to `true`, all attribute names will be lowercased. This has noticeable impact on speed.
|
|
26
|
-
*
|
|
27
|
-
* @default !xmlMode
|
|
28
|
-
*/
|
|
29
|
-
lowerCaseAttributeNames?: boolean;
|
|
30
|
-
/**
|
|
31
|
-
* If set to true, CDATA sections will be recognized as text even if the xmlMode option is not enabled.
|
|
32
|
-
* NOTE: If xmlMode is set to `true` then CDATA sections will always be recognized as text.
|
|
33
|
-
*
|
|
34
|
-
* @default xmlMode
|
|
35
|
-
*/
|
|
36
|
-
recognizeCDATA?: boolean;
|
|
37
|
-
/**
|
|
38
|
-
* If set to `true`, self-closing tags will trigger the onclosetag event even if xmlMode is not set to `true`.
|
|
39
|
-
* NOTE: If xmlMode is set to `true` then self-closing tags will always be recognized.
|
|
40
|
-
*
|
|
41
|
-
* @default xmlMode
|
|
42
|
-
*/
|
|
43
|
-
recognizeSelfClosing?: boolean;
|
|
44
|
-
/**
|
|
45
|
-
* Allows the default tokenizer to be overwritten.
|
|
46
|
-
*/
|
|
47
|
-
Tokenizer?: typeof Tokenizer;
|
|
48
|
-
}
|
|
49
|
-
export interface Handler {
|
|
50
|
-
onparserinit(parser: Parser): void;
|
|
51
|
-
/**
|
|
52
|
-
* Resets the handler back to starting state
|
|
53
|
-
*/
|
|
54
|
-
onreset(): void;
|
|
55
|
-
/**
|
|
56
|
-
* Signals the handler that parsing is done
|
|
57
|
-
*/
|
|
58
|
-
onend(): void;
|
|
59
|
-
onerror(error: Error): void;
|
|
60
|
-
onclosetag(name: string): void;
|
|
61
|
-
onopentagname(name: string): void;
|
|
62
|
-
/**
|
|
63
|
-
*
|
|
64
|
-
* @param name Name of the attribute
|
|
65
|
-
* @param value Value of the attribute.
|
|
66
|
-
* @param quote Quotes used around the attribute. `null` if the attribute has no quotes around the value, `undefined` if the attribute has no value.
|
|
67
|
-
*/
|
|
68
|
-
onattribute(name: string, value: string, quote?: string | undefined | null): void;
|
|
69
|
-
onopentag(name: string, attribs: {
|
|
70
|
-
[s: string]: string;
|
|
71
|
-
}): void;
|
|
72
|
-
ontext(data: string): void;
|
|
73
|
-
oncomment(data: string): void;
|
|
74
|
-
oncdatastart(): void;
|
|
75
|
-
oncdataend(): void;
|
|
76
|
-
oncommentend(): void;
|
|
77
|
-
onprocessinginstruction(name: string, data: string): void;
|
|
78
|
-
}
|
|
79
|
-
export declare class Parser {
|
|
80
|
-
/** The start index of the last event. */
|
|
81
|
-
startIndex: number;
|
|
82
|
-
/** The end index of the last event. */
|
|
83
|
-
endIndex: number | null;
|
|
84
|
-
private tagname;
|
|
85
|
-
private attribname;
|
|
86
|
-
private attribvalue;
|
|
87
|
-
private attribs;
|
|
88
|
-
private stack;
|
|
89
|
-
private readonly foreignContext;
|
|
90
|
-
private readonly cbs;
|
|
91
|
-
private readonly options;
|
|
92
|
-
private readonly lowerCaseTagNames;
|
|
93
|
-
private readonly lowerCaseAttributeNames;
|
|
94
|
-
private readonly tokenizer;
|
|
95
|
-
constructor(cbs: Partial<Handler> | null, options?: ParserOptions);
|
|
96
|
-
private updatePosition;
|
|
97
|
-
ontext(data: string): void;
|
|
98
|
-
isVoidElement(name: string): boolean;
|
|
99
|
-
onopentagname(name: string): void;
|
|
100
|
-
onopentagend(): void;
|
|
101
|
-
onclosetag(name: string): void;
|
|
102
|
-
onselfclosingtag(): void;
|
|
103
|
-
private closeCurrentTag;
|
|
104
|
-
onattribname(name: string): void;
|
|
105
|
-
onattribdata(value: string): void;
|
|
106
|
-
onattribend(quote: string | undefined | null): void;
|
|
107
|
-
private getInstructionName;
|
|
108
|
-
ondeclaration(value: string): void;
|
|
109
|
-
onprocessinginstruction(value: string): void;
|
|
110
|
-
oncomment(value: string): void;
|
|
111
|
-
oncdata(value: string): void;
|
|
112
|
-
onerror(err: Error): void;
|
|
113
|
-
onend(): void;
|
|
114
|
-
/**
|
|
115
|
-
* Resets the parser to a blank state, ready to parse a new HTML document
|
|
116
|
-
*/
|
|
117
|
-
reset(): void;
|
|
118
|
-
/**
|
|
119
|
-
* Resets the parser, then parses a complete document and
|
|
120
|
-
* pushes it to the handler.
|
|
121
|
-
*
|
|
122
|
-
* @param data Document to parse.
|
|
123
|
-
*/
|
|
124
|
-
parseComplete(data: string): void;
|
|
125
|
-
/**
|
|
126
|
-
* Parses a chunk of data and calls the corresponding callbacks.
|
|
127
|
-
*
|
|
128
|
-
* @param chunk Chunk to parse.
|
|
129
|
-
*/
|
|
130
|
-
write(chunk: string): void;
|
|
131
|
-
/**
|
|
132
|
-
* Parses the end of the buffer and clears the stack, calls onend.
|
|
133
|
-
*
|
|
134
|
-
* @param chunk Optional final chunk to parse.
|
|
135
|
-
*/
|
|
136
|
-
end(chunk?: string): void;
|
|
137
|
-
/**
|
|
138
|
-
* Pauses parsing. The parser won't emit events until `resume` is called.
|
|
139
|
-
*/
|
|
140
|
-
pause(): void;
|
|
141
|
-
/**
|
|
142
|
-
* Resumes parsing after `pause` was called.
|
|
143
|
-
*/
|
|
144
|
-
resume(): void;
|
|
145
|
-
/**
|
|
146
|
-
* Alias of `write`, for backwards compatibility.
|
|
147
|
-
*
|
|
148
|
-
* @param chunk Chunk to parse.
|
|
149
|
-
* @deprecated
|
|
150
|
-
*/
|
|
151
|
-
parseChunk(chunk: string): void;
|
|
152
|
-
/**
|
|
153
|
-
* Alias of `end`, for backwards compatibility.
|
|
154
|
-
*
|
|
155
|
-
* @param chunk Optional final chunk to parse.
|
|
156
|
-
* @deprecated
|
|
157
|
-
*/
|
|
158
|
-
done(chunk?: string): void;
|
|
159
|
-
}
|
|
@@ -1,438 +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.Parser = void 0;
|
|
7
|
-
const Tokenizer_js_1 = __importDefault(require("./Tokenizer.js"));
|
|
8
|
-
const formTags = new Set([
|
|
9
|
-
'input',
|
|
10
|
-
'option',
|
|
11
|
-
'optgroup',
|
|
12
|
-
'select',
|
|
13
|
-
'button',
|
|
14
|
-
'datalist',
|
|
15
|
-
'textarea',
|
|
16
|
-
]);
|
|
17
|
-
const pTag = new Set(['p']);
|
|
18
|
-
const openImpliesClose = {
|
|
19
|
-
tr: new Set(['tr', 'th', 'td']),
|
|
20
|
-
th: new Set(['th']),
|
|
21
|
-
td: new Set(['thead', 'th', 'td']),
|
|
22
|
-
body: new Set(['head', 'link', 'script']),
|
|
23
|
-
li: new Set(['li']),
|
|
24
|
-
p: pTag,
|
|
25
|
-
h1: pTag,
|
|
26
|
-
h2: pTag,
|
|
27
|
-
h3: pTag,
|
|
28
|
-
h4: pTag,
|
|
29
|
-
h5: pTag,
|
|
30
|
-
h6: pTag,
|
|
31
|
-
select: formTags,
|
|
32
|
-
input: formTags,
|
|
33
|
-
output: formTags,
|
|
34
|
-
button: formTags,
|
|
35
|
-
datalist: formTags,
|
|
36
|
-
textarea: formTags,
|
|
37
|
-
option: new Set(['option']),
|
|
38
|
-
optgroup: new Set(['optgroup', 'option']),
|
|
39
|
-
dd: new Set(['dt', 'dd']),
|
|
40
|
-
dt: new Set(['dt', 'dd']),
|
|
41
|
-
address: pTag,
|
|
42
|
-
article: pTag,
|
|
43
|
-
aside: pTag,
|
|
44
|
-
blockquote: pTag,
|
|
45
|
-
details: pTag,
|
|
46
|
-
div: pTag,
|
|
47
|
-
dl: pTag,
|
|
48
|
-
fieldset: pTag,
|
|
49
|
-
figcaption: pTag,
|
|
50
|
-
figure: pTag,
|
|
51
|
-
footer: pTag,
|
|
52
|
-
form: pTag,
|
|
53
|
-
header: pTag,
|
|
54
|
-
hr: pTag,
|
|
55
|
-
main: pTag,
|
|
56
|
-
nav: pTag,
|
|
57
|
-
ol: pTag,
|
|
58
|
-
pre: pTag,
|
|
59
|
-
section: pTag,
|
|
60
|
-
table: pTag,
|
|
61
|
-
ul: pTag,
|
|
62
|
-
rt: new Set(['rt', 'rp']),
|
|
63
|
-
rp: new Set(['rt', 'rp']),
|
|
64
|
-
tbody: new Set(['thead', 'tbody']),
|
|
65
|
-
tfoot: new Set(['thead', 'tbody']),
|
|
66
|
-
};
|
|
67
|
-
const voidElements = new Set([
|
|
68
|
-
'area',
|
|
69
|
-
'base',
|
|
70
|
-
'basefont',
|
|
71
|
-
'br',
|
|
72
|
-
'col',
|
|
73
|
-
'command',
|
|
74
|
-
'embed',
|
|
75
|
-
'frame',
|
|
76
|
-
'hr',
|
|
77
|
-
'img',
|
|
78
|
-
'input',
|
|
79
|
-
'isindex',
|
|
80
|
-
'keygen',
|
|
81
|
-
'link',
|
|
82
|
-
'meta',
|
|
83
|
-
'param',
|
|
84
|
-
'source',
|
|
85
|
-
'track',
|
|
86
|
-
'wbr',
|
|
87
|
-
]);
|
|
88
|
-
const foreignContextElements = new Set(['math', 'svg']);
|
|
89
|
-
const htmlIntegrationElements = new Set([
|
|
90
|
-
'mi',
|
|
91
|
-
'mo',
|
|
92
|
-
'mn',
|
|
93
|
-
'ms',
|
|
94
|
-
'mtext',
|
|
95
|
-
'annotation-xml',
|
|
96
|
-
'foreignObject',
|
|
97
|
-
'desc',
|
|
98
|
-
'title',
|
|
99
|
-
]);
|
|
100
|
-
const reNameEnd = /\s|\//;
|
|
101
|
-
class Parser {
|
|
102
|
-
constructor(cbs, options = {}) {
|
|
103
|
-
/** The start index of the last event. */
|
|
104
|
-
Object.defineProperty(this, "startIndex", {
|
|
105
|
-
enumerable: true,
|
|
106
|
-
configurable: true,
|
|
107
|
-
writable: true,
|
|
108
|
-
value: 0
|
|
109
|
-
});
|
|
110
|
-
/** The end index of the last event. */
|
|
111
|
-
Object.defineProperty(this, "endIndex", {
|
|
112
|
-
enumerable: true,
|
|
113
|
-
configurable: true,
|
|
114
|
-
writable: true,
|
|
115
|
-
value: null
|
|
116
|
-
});
|
|
117
|
-
Object.defineProperty(this, "tagname", {
|
|
118
|
-
enumerable: true,
|
|
119
|
-
configurable: true,
|
|
120
|
-
writable: true,
|
|
121
|
-
value: ''
|
|
122
|
-
});
|
|
123
|
-
Object.defineProperty(this, "attribname", {
|
|
124
|
-
enumerable: true,
|
|
125
|
-
configurable: true,
|
|
126
|
-
writable: true,
|
|
127
|
-
value: ''
|
|
128
|
-
});
|
|
129
|
-
Object.defineProperty(this, "attribvalue", {
|
|
130
|
-
enumerable: true,
|
|
131
|
-
configurable: true,
|
|
132
|
-
writable: true,
|
|
133
|
-
value: ''
|
|
134
|
-
});
|
|
135
|
-
Object.defineProperty(this, "attribs", {
|
|
136
|
-
enumerable: true,
|
|
137
|
-
configurable: true,
|
|
138
|
-
writable: true,
|
|
139
|
-
value: null
|
|
140
|
-
});
|
|
141
|
-
Object.defineProperty(this, "stack", {
|
|
142
|
-
enumerable: true,
|
|
143
|
-
configurable: true,
|
|
144
|
-
writable: true,
|
|
145
|
-
value: []
|
|
146
|
-
});
|
|
147
|
-
Object.defineProperty(this, "foreignContext", {
|
|
148
|
-
enumerable: true,
|
|
149
|
-
configurable: true,
|
|
150
|
-
writable: true,
|
|
151
|
-
value: []
|
|
152
|
-
});
|
|
153
|
-
Object.defineProperty(this, "cbs", {
|
|
154
|
-
enumerable: true,
|
|
155
|
-
configurable: true,
|
|
156
|
-
writable: true,
|
|
157
|
-
value: void 0
|
|
158
|
-
});
|
|
159
|
-
Object.defineProperty(this, "options", {
|
|
160
|
-
enumerable: true,
|
|
161
|
-
configurable: true,
|
|
162
|
-
writable: true,
|
|
163
|
-
value: void 0
|
|
164
|
-
});
|
|
165
|
-
Object.defineProperty(this, "lowerCaseTagNames", {
|
|
166
|
-
enumerable: true,
|
|
167
|
-
configurable: true,
|
|
168
|
-
writable: true,
|
|
169
|
-
value: void 0
|
|
170
|
-
});
|
|
171
|
-
Object.defineProperty(this, "lowerCaseAttributeNames", {
|
|
172
|
-
enumerable: true,
|
|
173
|
-
configurable: true,
|
|
174
|
-
writable: true,
|
|
175
|
-
value: void 0
|
|
176
|
-
});
|
|
177
|
-
Object.defineProperty(this, "tokenizer", {
|
|
178
|
-
enumerable: true,
|
|
179
|
-
configurable: true,
|
|
180
|
-
writable: true,
|
|
181
|
-
value: void 0
|
|
182
|
-
});
|
|
183
|
-
this.options = options;
|
|
184
|
-
this.cbs = cbs ?? {};
|
|
185
|
-
this.lowerCaseTagNames = options.lowerCaseTags ?? !options.xmlMode;
|
|
186
|
-
this.lowerCaseAttributeNames =
|
|
187
|
-
options.lowerCaseAttributeNames ?? !options.xmlMode;
|
|
188
|
-
this.tokenizer = new (options.Tokenizer ?? Tokenizer_js_1.default)(this.options, this);
|
|
189
|
-
this.cbs.onparserinit?.(this);
|
|
190
|
-
}
|
|
191
|
-
updatePosition(initialOffset) {
|
|
192
|
-
if (this.endIndex === null) {
|
|
193
|
-
if (this.tokenizer.sectionStart <= initialOffset) {
|
|
194
|
-
this.startIndex = 0;
|
|
195
|
-
}
|
|
196
|
-
else {
|
|
197
|
-
this.startIndex = this.tokenizer.sectionStart - initialOffset;
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
else {
|
|
201
|
-
this.startIndex = this.endIndex + 1;
|
|
202
|
-
}
|
|
203
|
-
this.endIndex = this.tokenizer.getAbsoluteIndex();
|
|
204
|
-
}
|
|
205
|
-
// Tokenizer event handlers
|
|
206
|
-
ontext(data) {
|
|
207
|
-
this.updatePosition(1);
|
|
208
|
-
this.endIndex--;
|
|
209
|
-
this.cbs.ontext?.(data);
|
|
210
|
-
}
|
|
211
|
-
isVoidElement(name) {
|
|
212
|
-
return !this.options.xmlMode && voidElements.has(name);
|
|
213
|
-
}
|
|
214
|
-
onopentagname(name) {
|
|
215
|
-
if (this.lowerCaseTagNames) {
|
|
216
|
-
name = name.toLowerCase();
|
|
217
|
-
}
|
|
218
|
-
this.tagname = name;
|
|
219
|
-
if (!this.options.xmlMode &&
|
|
220
|
-
Object.prototype.hasOwnProperty.call(openImpliesClose, name)) {
|
|
221
|
-
let el;
|
|
222
|
-
while (this.stack.length > 0 &&
|
|
223
|
-
openImpliesClose[name]?.has((el = this.stack[this.stack.length - 1]))) {
|
|
224
|
-
this.onclosetag(el);
|
|
225
|
-
}
|
|
226
|
-
}
|
|
227
|
-
if (!this.isVoidElement(name)) {
|
|
228
|
-
this.stack.push(name);
|
|
229
|
-
if (foreignContextElements.has(name)) {
|
|
230
|
-
this.foreignContext.push(true);
|
|
231
|
-
}
|
|
232
|
-
else if (htmlIntegrationElements.has(name)) {
|
|
233
|
-
this.foreignContext.push(false);
|
|
234
|
-
}
|
|
235
|
-
}
|
|
236
|
-
this.cbs.onopentagname?.(name);
|
|
237
|
-
if (this.cbs.onopentag)
|
|
238
|
-
this.attribs = {};
|
|
239
|
-
}
|
|
240
|
-
onopentagend() {
|
|
241
|
-
this.updatePosition(1);
|
|
242
|
-
if (this.attribs) {
|
|
243
|
-
this.cbs.onopentag?.(this.tagname, this.attribs);
|
|
244
|
-
this.attribs = null;
|
|
245
|
-
}
|
|
246
|
-
if (this.cbs.onclosetag && this.isVoidElement(this.tagname)) {
|
|
247
|
-
this.cbs.onclosetag(this.tagname);
|
|
248
|
-
}
|
|
249
|
-
this.tagname = '';
|
|
250
|
-
}
|
|
251
|
-
onclosetag(name) {
|
|
252
|
-
this.updatePosition(1);
|
|
253
|
-
if (this.lowerCaseTagNames) {
|
|
254
|
-
name = name.toLowerCase();
|
|
255
|
-
}
|
|
256
|
-
if (foreignContextElements.has(name) ||
|
|
257
|
-
htmlIntegrationElements.has(name)) {
|
|
258
|
-
this.foreignContext.pop();
|
|
259
|
-
}
|
|
260
|
-
if (this.stack.length && !this.isVoidElement(name)) {
|
|
261
|
-
let pos = this.stack.lastIndexOf(name);
|
|
262
|
-
if (pos !== -1) {
|
|
263
|
-
if (this.cbs.onclosetag) {
|
|
264
|
-
pos = this.stack.length - pos;
|
|
265
|
-
while (pos--) {
|
|
266
|
-
// We know the stack has sufficient elements.
|
|
267
|
-
this.cbs.onclosetag(this.stack.pop());
|
|
268
|
-
}
|
|
269
|
-
}
|
|
270
|
-
else
|
|
271
|
-
this.stack.length = pos;
|
|
272
|
-
}
|
|
273
|
-
else if (name === 'p' && !this.options.xmlMode) {
|
|
274
|
-
this.onopentagname(name);
|
|
275
|
-
this.closeCurrentTag();
|
|
276
|
-
}
|
|
277
|
-
}
|
|
278
|
-
else if (!this.options.xmlMode && (name === 'br' || name === 'p')) {
|
|
279
|
-
this.onopentagname(name);
|
|
280
|
-
this.closeCurrentTag();
|
|
281
|
-
}
|
|
282
|
-
}
|
|
283
|
-
onselfclosingtag() {
|
|
284
|
-
if (this.options.xmlMode ||
|
|
285
|
-
this.options.recognizeSelfClosing ||
|
|
286
|
-
this.foreignContext[this.foreignContext.length - 1]) {
|
|
287
|
-
this.closeCurrentTag();
|
|
288
|
-
}
|
|
289
|
-
else {
|
|
290
|
-
this.onopentagend();
|
|
291
|
-
}
|
|
292
|
-
}
|
|
293
|
-
closeCurrentTag() {
|
|
294
|
-
const name = this.tagname;
|
|
295
|
-
this.onopentagend();
|
|
296
|
-
/*
|
|
297
|
-
* Self-closing tags will be on the top of the stack
|
|
298
|
-
* (cheaper check than in onclosetag)
|
|
299
|
-
*/
|
|
300
|
-
if (this.stack[this.stack.length - 1] === name) {
|
|
301
|
-
this.cbs.onclosetag?.(name);
|
|
302
|
-
this.stack.pop();
|
|
303
|
-
}
|
|
304
|
-
}
|
|
305
|
-
onattribname(name) {
|
|
306
|
-
if (this.lowerCaseAttributeNames) {
|
|
307
|
-
name = name.toLowerCase();
|
|
308
|
-
}
|
|
309
|
-
this.attribname = name;
|
|
310
|
-
}
|
|
311
|
-
onattribdata(value) {
|
|
312
|
-
this.attribvalue += value;
|
|
313
|
-
}
|
|
314
|
-
onattribend(quote) {
|
|
315
|
-
this.cbs.onattribute?.(this.attribname, this.attribvalue, quote);
|
|
316
|
-
if (this.attribs &&
|
|
317
|
-
!Object.prototype.hasOwnProperty.call(this.attribs, this.attribname)) {
|
|
318
|
-
this.attribs[this.attribname] = this.attribvalue;
|
|
319
|
-
}
|
|
320
|
-
this.attribname = '';
|
|
321
|
-
this.attribvalue = '';
|
|
322
|
-
}
|
|
323
|
-
getInstructionName(value) {
|
|
324
|
-
const idx = value.search(reNameEnd);
|
|
325
|
-
let name = idx < 0 ? value : value.substr(0, idx);
|
|
326
|
-
if (this.lowerCaseTagNames) {
|
|
327
|
-
name = name.toLowerCase();
|
|
328
|
-
}
|
|
329
|
-
return name;
|
|
330
|
-
}
|
|
331
|
-
ondeclaration(value) {
|
|
332
|
-
if (this.cbs.onprocessinginstruction) {
|
|
333
|
-
const name = this.getInstructionName(value);
|
|
334
|
-
this.cbs.onprocessinginstruction(`!${name}`, `!${value}`);
|
|
335
|
-
}
|
|
336
|
-
}
|
|
337
|
-
onprocessinginstruction(value) {
|
|
338
|
-
if (this.cbs.onprocessinginstruction) {
|
|
339
|
-
const name = this.getInstructionName(value);
|
|
340
|
-
this.cbs.onprocessinginstruction(`?${name}`, `?${value}`);
|
|
341
|
-
}
|
|
342
|
-
}
|
|
343
|
-
oncomment(value) {
|
|
344
|
-
this.updatePosition(4);
|
|
345
|
-
this.cbs.oncomment?.(value);
|
|
346
|
-
this.cbs.oncommentend?.();
|
|
347
|
-
}
|
|
348
|
-
oncdata(value) {
|
|
349
|
-
this.updatePosition(1);
|
|
350
|
-
if (this.options.xmlMode || this.options.recognizeCDATA) {
|
|
351
|
-
this.cbs.oncdatastart?.();
|
|
352
|
-
this.cbs.ontext?.(value);
|
|
353
|
-
this.cbs.oncdataend?.();
|
|
354
|
-
}
|
|
355
|
-
else {
|
|
356
|
-
this.oncomment(`[CDATA[${value}]]`);
|
|
357
|
-
}
|
|
358
|
-
}
|
|
359
|
-
onerror(err) {
|
|
360
|
-
this.cbs.onerror?.(err);
|
|
361
|
-
}
|
|
362
|
-
onend() {
|
|
363
|
-
if (this.cbs.onclosetag) {
|
|
364
|
-
for (let i = this.stack.length; i > 0; this.cbs.onclosetag(this.stack[--i]))
|
|
365
|
-
;
|
|
366
|
-
}
|
|
367
|
-
this.cbs.onend?.();
|
|
368
|
-
}
|
|
369
|
-
/**
|
|
370
|
-
* Resets the parser to a blank state, ready to parse a new HTML document
|
|
371
|
-
*/
|
|
372
|
-
reset() {
|
|
373
|
-
this.cbs.onreset?.();
|
|
374
|
-
this.tokenizer.reset();
|
|
375
|
-
this.tagname = '';
|
|
376
|
-
this.attribname = '';
|
|
377
|
-
this.attribs = null;
|
|
378
|
-
this.stack = [];
|
|
379
|
-
this.cbs.onparserinit?.(this);
|
|
380
|
-
}
|
|
381
|
-
/**
|
|
382
|
-
* Resets the parser, then parses a complete document and
|
|
383
|
-
* pushes it to the handler.
|
|
384
|
-
*
|
|
385
|
-
* @param data Document to parse.
|
|
386
|
-
*/
|
|
387
|
-
parseComplete(data) {
|
|
388
|
-
this.reset();
|
|
389
|
-
this.end(data);
|
|
390
|
-
}
|
|
391
|
-
/**
|
|
392
|
-
* Parses a chunk of data and calls the corresponding callbacks.
|
|
393
|
-
*
|
|
394
|
-
* @param chunk Chunk to parse.
|
|
395
|
-
*/
|
|
396
|
-
write(chunk) {
|
|
397
|
-
this.tokenizer.write(chunk);
|
|
398
|
-
}
|
|
399
|
-
/**
|
|
400
|
-
* Parses the end of the buffer and clears the stack, calls onend.
|
|
401
|
-
*
|
|
402
|
-
* @param chunk Optional final chunk to parse.
|
|
403
|
-
*/
|
|
404
|
-
end(chunk) {
|
|
405
|
-
this.tokenizer.end(chunk);
|
|
406
|
-
}
|
|
407
|
-
/**
|
|
408
|
-
* Pauses parsing. The parser won't emit events until `resume` is called.
|
|
409
|
-
*/
|
|
410
|
-
pause() {
|
|
411
|
-
this.tokenizer.pause();
|
|
412
|
-
}
|
|
413
|
-
/**
|
|
414
|
-
* Resumes parsing after `pause` was called.
|
|
415
|
-
*/
|
|
416
|
-
resume() {
|
|
417
|
-
this.tokenizer.resume();
|
|
418
|
-
}
|
|
419
|
-
/**
|
|
420
|
-
* Alias of `write`, for backwards compatibility.
|
|
421
|
-
*
|
|
422
|
-
* @param chunk Chunk to parse.
|
|
423
|
-
* @deprecated
|
|
424
|
-
*/
|
|
425
|
-
parseChunk(chunk) {
|
|
426
|
-
this.write(chunk);
|
|
427
|
-
}
|
|
428
|
-
/**
|
|
429
|
-
* Alias of `end`, for backwards compatibility.
|
|
430
|
-
*
|
|
431
|
-
* @param chunk Optional final chunk to parse.
|
|
432
|
-
* @deprecated
|
|
433
|
-
*/
|
|
434
|
-
done(chunk) {
|
|
435
|
-
this.end(chunk);
|
|
436
|
-
}
|
|
437
|
-
}
|
|
438
|
-
exports.Parser = Parser;
|