@mdsvex/parse 1.0.0-next.0 → 1.0.0-next.1
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/CHANGELOG.md +213 -0
- package/WIRE_FORMAT.md +5 -1
- package/dist/buf-utils.js +23 -23
- package/dist/buf_utils.d.ts +1 -1
- package/dist/cursor.d.ts +17 -13
- package/dist/cursor.js +118 -31
- package/dist/main.d.ts +362 -26
- package/dist/main.js +5841 -3420
- package/dist/node_view-bvM0i0-p.js +407 -0
- package/dist/node_view.d.ts +11 -12
- package/dist/opcodes.d.ts +23 -6
- package/dist/plugin_dispatch.d.ts +22 -8
- package/dist/tree-builder.js +185 -66
- package/dist/tree_builder.d.ts +42 -11
- package/dist/undo_log.d.ts +11 -1
- package/dist/utils.d.ts +77 -51
- package/dist/utils.js +687 -209
- package/dist/wire-tree-builder.js +69 -71
- package/dist/wire_tree_builder.d.ts +4 -7
- package/package.json +1 -1
- package/src/buf_utils.ts +10 -14
- package/src/cursor.ts +74 -57
- package/src/main.ts +9898 -5593
- package/src/node_view.ts +159 -140
- package/src/opcodes.ts +39 -7
- package/src/plugin_dispatch.ts +328 -219
- package/src/tree_builder.ts +278 -98
- package/src/undo_log.ts +58 -24
- package/src/utils.spec.ts +86 -9
- package/src/utils.ts +769 -392
- package/src/wire_emitter.ts +6 -0
- package/src/wire_tree_builder.ts +39 -52
- package/test/block_quotes.spec.ts +78 -7
- package/test/code_spans.spec.ts +158 -6
- package/test/crlf.spec.ts +49 -1
- package/test/directives.spec.ts +530 -1
- package/test/emphasis.spec.ts +10 -4
- package/test/fixtures/pfm/block_quotes/pfm_fence_close.md +4 -0
- package/test/fixtures/pfm/block_quotes/pfm_fence_close_compact.md +4 -0
- package/test/fixtures/pfm/block_quotes/pfm_fence_close_end_quote.md +5 -0
- package/test/fixtures/pfm/block_quotes/pfm_fence_close_info.md +5 -0
- package/test/fixtures/pfm/block_quotes/pfm_fence_close_longer.md +4 -0
- package/test/fixtures/pfm/block_quotes/pfm_fence_close_nested.md +3 -0
- package/test/fixtures/pfm/block_quotes/pfm_fence_close_twice.md +6 -0
- package/test/fixtures/pfm/block_quotes/pfm_fence_info_eof.md +1 -0
- package/test/fixtures/pfm/block_quotes/pfm_fence_unclosed.md +2 -0
- package/test/fixtures/pfm/code_spans/pfm_328_5.md +1 -0
- package/test/fixtures/pfm/code_spans/pfm_328_6.md +1 -0
- package/test/fixtures/pfm/code_spans/pfm_328_7.md +1 -0
- package/test/fixtures/pfm/code_spans/pfm_328_8.md +1 -0
- package/test/fixtures/pfm/code_spans/pfm_328_9.md +2 -0
- package/test/fixtures/pfm/fenced_code_blocks/pfm_info_eof.md +1 -0
- package/test/fixtures/pfm/fenced_code_blocks/pfm_info_eof_no_lf.md +1 -0
- package/test/fixtures/pfm/generic_directives/106.md +1 -0
- package/test/fixtures/pfm/generic_directives/107.md +3 -0
- package/test/fixtures/pfm/generic_directives/108.md +1 -0
- package/test/fixtures/pfm/generic_directives/109.md +1 -0
- package/test/fixtures/pfm/generic_directives/110.md +1 -0
- package/test/fixtures/pfm/generic_directives/111.md +1 -0
- package/test/fixtures/pfm/generic_directives/112.md +1 -0
- package/test/fixtures/pfm/generic_directives/113.md +1 -0
- package/test/fixtures/pfm/generic_directives/114.md +2 -0
- package/test/fixtures/pfm/generic_directives/115.md +1 -0
- package/test/fixtures/pfm/generic_directives/116.md +6 -0
- package/test/fixtures/pfm/generic_directives/117.md +3 -0
- package/test/fixtures/pfm/generic_directives/118.md +6 -0
- package/test/fixtures/pfm/generic_directives/119.md +3 -0
- package/test/fixtures/pfm/generic_directives/120.md +5 -0
- package/test/fixtures/pfm/generic_directives/121.md +3 -0
- package/test/fixtures/pfm/generic_directives/122.md +4 -0
- package/test/fixtures/pfm/generic_directives/123.md +2 -0
- package/test/html.spec.ts +44 -1
- package/test/html_block_containers.spec.ts +445 -0
- package/test/incremental.spec.ts +271 -0
- package/test/lists.spec.ts +107 -1
- package/test/parser_reuse.spec.ts +40 -0
- package/test/plugins.spec.ts +196 -226
- package/test/print.ts +2 -3
- package/test/run_bytecode.spec.ts +36 -0
- package/test/snapshots/hybrid/component-children.snap.ast +9 -16
- package/test/snapshots/hybrid/component-simple-00.snap.ast +1 -2
- package/test/snapshots/hybrid/component-simple-01.snap.ast +1 -2
- package/test/snapshots/hybrid/component-simple-03.snap.ast +13 -13
- package/test/snapshots/hybrid/component-simple-04.snap.ast +1 -2
- package/test/snapshots/hybrid/error.snap.ast +1 -2
- package/test/snapshots/markdown/blockquote-nested-markdown.snap.ast +2 -1
- package/test/snapshots/markdown/emphasis.snap.ast +2 -2
- package/test/snapshots/markdown/encodeHTMLCodeTags.snap.ast +1 -2
- package/test/snapshots/markdown/github-style-codeblock-inside-quote.snap.ast +8 -1
- package/test/snapshots/markdown/html-comments.snap.ast +11 -13
- package/test/snapshots/markdown/html5-strutural-tags.snap.ast +16 -31
- package/test/snapshots/markdown/line-starts-with-html.snap.ast +5 -6
- package/test/snapshots/markdown/literal-html-tags.snap.ast +11 -14
- package/test/snapshots/markdown/nested-blockquote.snap.ast +3 -3
- package/test/snapshots/markdown/pre-code-tags.snap.ast +5 -8
- package/test/snapshots/pfm/block_quotes/237.snap.ast +1 -2
- package/test/snapshots/pfm/block_quotes/251.snap.ast +5 -5
- package/test/snapshots/pfm/block_quotes/pfm_fence_close.snap.ast +6 -0
- package/test/snapshots/pfm/block_quotes/pfm_fence_close_compact.snap.ast +6 -0
- package/test/snapshots/pfm/block_quotes/pfm_fence_close_end_quote.snap.ast +8 -0
- package/test/snapshots/pfm/block_quotes/pfm_fence_close_info.snap.ast +4 -0
- package/test/snapshots/pfm/block_quotes/pfm_fence_close_longer.snap.ast +6 -0
- package/test/snapshots/pfm/block_quotes/pfm_fence_close_nested.snap.ast +5 -0
- package/test/snapshots/pfm/block_quotes/pfm_fence_close_twice.snap.ast +5 -0
- package/test/snapshots/pfm/block_quotes/pfm_fence_info_eof.snap.ast +3 -0
- package/test/snapshots/pfm/block_quotes/pfm_fence_unclosed.snap.ast +3 -0
- package/test/snapshots/pfm/code_spans/344.snap.ast +1 -1
- package/test/snapshots/pfm/code_spans/347.snap.ast +1 -2
- package/test/snapshots/pfm/code_spans/pfm_328_5.snap.ast +6 -0
- package/test/snapshots/pfm/code_spans/pfm_328_6.snap.ast +6 -0
- package/test/snapshots/pfm/code_spans/pfm_328_7.snap.ast +6 -0
- package/test/snapshots/pfm/code_spans/pfm_328_8.snap.ast +8 -0
- package/test/snapshots/pfm/code_spans/pfm_328_9.snap.ast +10 -0
- package/test/snapshots/pfm/emphasis_and_strong_emphasis/417.snap.ast +2 -2
- package/test/snapshots/pfm/emphasis_and_strong_emphasis/438.snap.ast +1 -1
- package/test/snapshots/pfm/emphasis_and_strong_emphasis/441.snap.ast +1 -1
- package/test/snapshots/pfm/emphasis_and_strong_emphasis/444.snap.ast +1 -1
- package/test/snapshots/pfm/emphasis_and_strong_emphasis/445.snap.ast +1 -1
- package/test/snapshots/pfm/emphasis_and_strong_emphasis/450.snap.ast +1 -1
- package/test/snapshots/pfm/emphasis_and_strong_emphasis/453.snap.ast +1 -1
- package/test/snapshots/pfm/emphasis_and_strong_emphasis/456.snap.ast +1 -1
- package/test/snapshots/pfm/emphasis_and_strong_emphasis/457.snap.ast +1 -1
- package/test/snapshots/pfm/emphasis_and_strong_emphasis/473.snap.ast +1 -1
- package/test/snapshots/pfm/emphasis_and_strong_emphasis/475.snap.ast +1 -1
- package/test/snapshots/pfm/emphasis_and_strong_emphasis/476.snap.ast +1 -1
- package/test/snapshots/pfm/emphasis_and_strong_emphasis/477.snap.ast +1 -1
- package/test/snapshots/pfm/emphasis_and_strong_emphasis/478.snap.ast +3 -4
- package/test/snapshots/pfm/emphasis_and_strong_emphasis/479.snap.ast +3 -4
- package/test/snapshots/pfm/fenced_code_blocks/126.snap.ast +1 -2
- package/test/snapshots/pfm/fenced_code_blocks/pfm_info_eof.snap.ast +2 -0
- package/test/snapshots/pfm/fenced_code_blocks/pfm_info_eof_no_lf.snap.ast +2 -0
- package/test/snapshots/pfm/generic_directives/011.snap.ast +3 -1
- package/test/snapshots/pfm/generic_directives/015.snap.ast +3 -1
- package/test/snapshots/pfm/generic_directives/016.snap.ast +3 -1
- package/test/snapshots/pfm/generic_directives/017.snap.ast +3 -1
- package/test/snapshots/pfm/generic_directives/019.snap.ast +3 -1
- package/test/snapshots/pfm/generic_directives/020.snap.ast +3 -1
- package/test/snapshots/pfm/generic_directives/030.snap.ast +4 -6
- package/test/snapshots/pfm/generic_directives/034.snap.ast +6 -2
- package/test/snapshots/pfm/generic_directives/036.snap.ast +5 -1
- package/test/snapshots/pfm/generic_directives/038.snap.ast +6 -2
- package/test/snapshots/pfm/generic_directives/039.snap.ast +3 -1
- package/test/snapshots/pfm/generic_directives/040.snap.ast +3 -1
- package/test/snapshots/pfm/generic_directives/044.snap.ast +3 -1
- package/test/snapshots/pfm/generic_directives/046.snap.ast +3 -1
- package/test/snapshots/pfm/generic_directives/089.snap.ast +1 -1
- package/test/snapshots/pfm/generic_directives/103.snap.ast +6 -2
- package/test/snapshots/pfm/generic_directives/106.snap.ast +9 -0
- package/test/snapshots/pfm/generic_directives/107.snap.ast +9 -0
- package/test/snapshots/pfm/generic_directives/108.snap.ast +5 -0
- package/test/snapshots/pfm/generic_directives/109.snap.ast +4 -0
- package/test/snapshots/pfm/generic_directives/110.snap.ast +10 -0
- package/test/snapshots/pfm/generic_directives/111.snap.ast +7 -0
- package/test/snapshots/pfm/generic_directives/112.snap.ast +18 -0
- package/test/snapshots/pfm/generic_directives/113.snap.ast +7 -0
- package/test/snapshots/pfm/generic_directives/114.snap.ast +12 -0
- package/test/snapshots/pfm/generic_directives/115.snap.ast +10 -0
- package/test/snapshots/pfm/generic_directives/116.snap.ast +13 -0
- package/test/snapshots/pfm/generic_directives/117.snap.ast +9 -0
- package/test/snapshots/pfm/generic_directives/118.snap.ast +10 -0
- package/test/snapshots/pfm/generic_directives/119.snap.ast +9 -0
- package/test/snapshots/pfm/generic_directives/120.snap.ast +12 -0
- package/test/snapshots/pfm/generic_directives/121.snap.ast +3 -0
- package/test/snapshots/pfm/generic_directives/122.snap.ast +3 -0
- package/test/snapshots/pfm/generic_directives/123.snap.ast +3 -0
- package/test/snapshots/pfm/hard_line_breaks/642.snap.ast +1 -1
- package/test/snapshots/pfm/hard_line_breaks/643.snap.ast +1 -1
- package/test/snapshots/pfm/html/148.snap.ast +1 -1
- package/test/snapshots/pfm/html/150.snap.ast +1 -1
- package/test/snapshots/pfm/html/159.snap.ast +2 -3
- package/test/snapshots/pfm/html/162.snap.ast +3 -4
- package/test/snapshots/pfm/html/163.snap.ast +1 -1
- package/test/snapshots/pfm/html/164.snap.ast +3 -4
- package/test/snapshots/pfm/html/166.snap.ast +1 -1
- package/test/snapshots/pfm/html/168.snap.ast +2 -3
- package/test/snapshots/pfm/html/169.snap.ast +5 -7
- package/test/snapshots/pfm/html/174.snap.ast +3 -3
- package/test/snapshots/pfm/html/182.snap.ast +1 -1
- package/test/snapshots/pfm/html/613.snap.ast +2 -2
- package/test/snapshots/pfm/html/615.snap.ast +2 -2
- package/test/snapshots/pfm/images/585.snap.ast +1 -1
- package/test/snapshots/pfm/images/589.snap.ast +1 -1
- package/test/snapshots/pfm/link_reference_definitions/201.snap.ast +1 -1
- package/test/snapshots/pfm/link_reference_definitions/208.snap.ast +1 -1
- package/test/snapshots/pfm/links/491.snap.ast +1 -1
- package/test/snapshots/pfm/links/494.snap.ast +2 -2
- package/test/snapshots/pfm/links/516.snap.ast +8 -9
- package/test/snapshots/pfm/links/521.snap.ast +1 -1
- package/test/snapshots/pfm/links/530.snap.ast +8 -12
- package/test/snapshots/pfm/links/534.snap.ast +1 -1
- package/test/snapshots/pfm/links/552.snap.ast +2 -2
- package/test/snapshots/pfm/links/559.snap.ast +1 -1
- package/test/snapshots/pfm/links/564.snap.ast +1 -1
- package/test/snapshots/pfm/list_items/260.snap.ast +3 -4
- package/test/snapshots/pfm/list_items/293.snap.ast +2 -2
- package/test/snapshots/pfm/tabs/16.snap.ast +2 -3
- package/test/snapshots/pfm/tabs/4.snap.ast +6 -5
- package/test/snapshots/svelte/00-introduction/00-hello-world/App.snap.ast +3 -4
- package/test/snapshots/svelte/00-introduction/02-styling/App.snap.ast +2 -3
- package/test/snapshots/svelte/00-introduction/03-nested-components/App.snap.ast +2 -3
- package/test/snapshots/svelte/00-introduction/03-nested-components/Nested.snap.ast +1 -2
- package/test/snapshots/svelte/00-introduction/04-html-tags/App.snap.ast +1 -2
- package/test/snapshots/svelte/01-reactivity/00-reactive-assignments/App.snap.ast +5 -6
- package/test/snapshots/svelte/01-reactivity/01-reactive-declarations/App.snap.ast +11 -14
- package/test/snapshots/svelte/01-reactivity/02-reactive-statements/App.snap.ast +5 -6
- package/test/snapshots/svelte/02-props/00-declaring-props/Nested.snap.ast +2 -3
- package/test/snapshots/svelte/02-props/01-default-values/App.snap.ast +1 -1
- package/test/snapshots/svelte/02-props/01-default-values/Nested.snap.ast +2 -3
- package/test/snapshots/svelte/02-props/02-spread-props/Info.snap.ast +16 -17
- package/test/snapshots/svelte/03-logic/00-if-blocks/App.snap.ast +4 -8
- package/test/snapshots/svelte/03-logic/01-else-blocks/App.snap.ast +4 -8
- package/test/snapshots/svelte/03-logic/02-else-if-blocks/App.snap.ast +6 -9
- package/test/snapshots/svelte/03-logic/03-each-blocks/App.snap.ast +5 -8
- package/test/snapshots/svelte/03-logic/04-keyed-each-blocks/App.snap.ast +4 -7
- package/test/snapshots/svelte/03-logic/04-keyed-each-blocks/Thing.snap.ast +4 -5
- package/test/snapshots/svelte/04-events/02-event-modifiers/App.snap.ast +2 -3
- package/test/snapshots/svelte/04-events/03-component-events/Inner.snap.ast +2 -3
- package/test/snapshots/svelte/04-events/04-event-forwarding/Inner.snap.ast +2 -3
- package/test/snapshots/svelte/04-events/05-dom-event-forwarding/FancyButton.snap.ast +2 -3
- package/test/snapshots/svelte/05-bindings/00-text-inputs/App.snap.ast +3 -4
- package/test/snapshots/svelte/05-bindings/01-numeric-inputs/App.snap.ast +9 -8
- package/test/snapshots/svelte/05-bindings/02-checkbox-inputs/App.snap.ast +7 -11
- package/test/snapshots/svelte/05-bindings/03-group-inputs/App.snap.ast +21 -30
- package/test/snapshots/svelte/05-bindings/04-textarea-inputs/App.snap.ast +1 -2
- package/test/snapshots/svelte/05-bindings/05-select-bindings/App.snap.ast +5 -9
- package/test/snapshots/svelte/05-bindings/06-multiple-select-bindings/App.snap.ast +18 -26
- package/test/snapshots/svelte/05-bindings/07-each-block-bindings/App.snap.ast +7 -11
- package/test/snapshots/svelte/05-bindings/08-media-elements/App.snap.ast +15 -19
- package/test/snapshots/svelte/05-bindings/09-dimensions/App.snap.ast +7 -9
- package/test/snapshots/svelte/05-bindings/11-component-bindings/App.snap.ast +1 -2
- package/test/snapshots/svelte/05-bindings/11-component-bindings/Keypad.snap.ast +32 -34
- package/test/snapshots/svelte/06-lifecycle/00-onmount/App.snap.ast +3 -6
- package/test/snapshots/svelte/06-lifecycle/01-ondestroy/App.snap.ast +6 -7
- package/test/snapshots/svelte/06-lifecycle/02-update/App.snap.ast +2 -4
- package/test/snapshots/svelte/07-stores/00-writable-stores/App.snap.ast +4 -5
- package/test/snapshots/svelte/07-stores/00-writable-stores/Decrementer.snap.ast +2 -3
- package/test/snapshots/svelte/07-stores/00-writable-stores/Incrementer.snap.ast +2 -3
- package/test/snapshots/svelte/07-stores/00-writable-stores/Resetter.snap.ast +2 -3
- package/test/snapshots/svelte/07-stores/01-auto-subscriptions/App.snap.ast +4 -5
- package/test/snapshots/svelte/07-stores/01-auto-subscriptions/Decrementer.snap.ast +2 -3
- package/test/snapshots/svelte/07-stores/01-auto-subscriptions/Incrementer.snap.ast +2 -3
- package/test/snapshots/svelte/07-stores/01-auto-subscriptions/Resetter.snap.ast +2 -3
- package/test/snapshots/svelte/07-stores/02-readable-stores/App.snap.ast +2 -3
- package/test/snapshots/svelte/07-stores/03-derived-stores/App.snap.ast +8 -10
- package/test/snapshots/svelte/07-stores/04-custom-stores/App.snap.ast +7 -11
- package/test/snapshots/svelte/08-motion/00-tweened/App.snap.ast +10 -15
- package/test/snapshots/svelte/08-motion/01-spring/App.snap.ast +10 -10
- package/test/snapshots/svelte/09-transitions/00-transition/App.snap.ast +3 -5
- package/test/snapshots/svelte/09-transitions/01-adding-parameters-to-transitions/App.snap.ast +3 -5
- package/test/snapshots/svelte/09-transitions/02-in-and-out/App.snap.ast +3 -5
- package/test/snapshots/svelte/09-transitions/03-custom-css-transitions/App.snap.ast +4 -6
- package/test/snapshots/svelte/09-transitions/04-custom-js-transitions/App.snap.ast +3 -5
- package/test/snapshots/svelte/09-transitions/05-transition-events/App.snap.ast +5 -8
- package/test/snapshots/svelte/10-animations/00-animate/App.snap.ast +16 -20
- package/test/snapshots/svelte/11-easing/00-easing/App.snap.ast +16 -11
- package/test/snapshots/svelte/11-easing/00-easing/Controls.snap.ast +11 -16
- package/test/snapshots/svelte/11-easing/00-easing/Grid.snap.ast +2 -2
- package/test/snapshots/svelte/12-svg/01-clock/App.snap.ast +2 -1
- package/test/snapshots/svelte/12-svg/02-bar-chart/App.snap.ast +7 -9
- package/test/snapshots/svelte/12-svg/03-area-chart/App.snap.ast +14 -15
- package/test/snapshots/svelte/12-svg/04-scatterplot/App.snap.ast +7 -5
- package/test/snapshots/svelte/12-svg/04-scatterplot/Scatterplot.snap.ast +6 -6
- package/test/snapshots/svelte/12-svg/05-svg-transitions/App.snap.ast +5 -6
- package/test/snapshots/svelte/13-actions/01-adding-parameters-to-actions/App.snap.ast +2 -3
- package/test/snapshots/svelte/14-classes/00-classes/App.snap.ast +3 -6
- package/test/snapshots/svelte/14-classes/01-class-shorthand/App.snap.ast +2 -3
- package/test/snapshots/svelte/15-composition/00-slots/App.snap.ast +3 -5
- package/test/snapshots/svelte/15-composition/01-slot-fallbacks/App.snap.ast +3 -5
- package/test/snapshots/svelte/15-composition/01-slot-fallbacks/Box.snap.ast +1 -2
- package/test/snapshots/svelte/15-composition/02-named-slots/App.snap.ast +7 -11
- package/test/snapshots/svelte/15-composition/02-named-slots/ContactCard.snap.ast +3 -6
- package/test/snapshots/svelte/15-composition/03-slot-props/App.snap.ast +9 -15
- package/test/snapshots/svelte/15-composition/04-modal/App.snap.ast +17 -26
- package/test/snapshots/svelte/15-composition/04-modal/Modal.snap.ast +3 -3
- package/test/snapshots/svelte/16-context/00-context-api/App.snap.ast +10 -5
- package/test/snapshots/svelte/17-special-elements/00-svelte-self/File.snap.ast +1 -2
- package/test/snapshots/svelte/17-special-elements/00-svelte-self/Folder.snap.ast +1 -2
- package/test/snapshots/svelte/17-special-elements/01-svelte-component/App.snap.ast +1 -2
- package/test/snapshots/svelte/17-special-elements/01-svelte-component/BlueThing.snap.ast +1 -2
- package/test/snapshots/svelte/17-special-elements/01-svelte-component/GreenThing.snap.ast +1 -2
- package/test/snapshots/svelte/17-special-elements/01-svelte-component/RedThing.snap.ast +1 -2
- package/test/snapshots/svelte/17-special-elements/02-svelte-window/App.snap.ast +3 -6
- package/test/snapshots/svelte/17-special-elements/03-svelte-window-bindings/App.snap.ast +2 -4
- package/test/snapshots/svelte/17-special-elements/05-svelte-head/App.snap.ast +6 -12
- package/test/snapshots/svelte/18-module-context/01-module-exports/App.snap.ast +2 -3
- package/test/snapshots/svelte/18-module-context/01-module-exports/AudioPlayer.snap.ast +4 -7
- package/test/snapshots/svelte/19-debugging/00-debug/App.snap.ast +5 -7
- package/test/snapshots/svelte/19-debugging/00-debug/Test.snap.ast +7 -11
- package/test/snapshots/svelte/20-7guis/01-7guis-counter/App.snap.ast +2 -3
- package/test/snapshots/svelte/20-7guis/02-7guis-temperature/App.snap.ast +2 -2
- package/test/snapshots/svelte/20-7guis/03-7guis-flight-booker/App.snap.ast +4 -7
- package/test/snapshots/svelte/20-7guis/04-7guis-timer/App.snap.ast +13 -17
- package/test/snapshots/svelte/20-7guis/05-7guis-crud/App.snap.ast +11 -13
- package/test/snapshots/svelte/20-7guis/06-7guis-circles/App.snap.ast +10 -11
- package/test/snapshots/svelte/21-miscellaneous/01-hacker-news/Comment.snap.ast +4 -6
- package/test/snapshots/svelte/21-miscellaneous/01-hacker-news/Item.snap.ast +9 -13
- package/test/snapshots/svelte/21-miscellaneous/01-hacker-news/List.snap.ast +3 -5
- package/test/snapshots/svelte/21-miscellaneous/01-hacker-news/Summary.snap.ast +7 -11
- package/test/snapshots/svelte/21-miscellaneous/02-immutable-data/App.snap.ast +2 -4
- package/test/snapshots/svelte/99-embeds/20181225-blog-svelte-css-in-js/App.snap.ast +6 -7
- package/test/snapshots/svelte/99-embeds/20181225-blog-svelte-css-in-js/Hero.snap.ast +3 -5
- package/test/snapshots/svelte/99-embeds/20190420-blog-write-less-code/App.snap.ast +6 -7
- package/test/svelte_expressions.spec.ts +93 -4
- package/test/svelte_tags.spec.ts +27 -12
- package/test/tables.spec.ts +347 -0
- package/test/tree_builder.spec.ts +286 -1
- package/test/unclosed_delimiters.spec.ts +529 -0
- package/tsc/buf_utils.d.ts +1 -1
- package/tsc/buf_utils.js +9 -9
- package/tsc/cursor.d.ts +17 -13
- package/tsc/cursor.js +60 -43
- package/tsc/main.d.ts +362 -26
- package/tsc/main.js +8955 -4891
- package/tsc/node_view.d.ts +11 -12
- package/tsc/node_view.js +134 -102
- package/tsc/opcodes.d.ts +23 -6
- package/tsc/plugin_dispatch.d.ts +22 -8
- package/tsc/plugin_dispatch.js +292 -170
- package/tsc/tree_builder.d.ts +42 -11
- package/tsc/tree_builder.js +237 -82
- package/tsc/undo_log.d.ts +11 -1
- package/tsc/undo_log.js +54 -19
- package/tsc/utils.d.ts +77 -51
- package/tsc/utils.js +687 -344
- package/tsc/utils.spec.js +83 -9
- package/tsc/wire_emitter.js +6 -0
- package/tsc/wire_tree_builder.d.ts +4 -7
- package/tsc/wire_tree_builder.js +34 -37
- package/dist/node_view-BEh2-H86.js +0 -373
package/tsc/utils.spec.js
CHANGED
|
@@ -161,12 +161,12 @@ describe('NodeBuffer', () => {
|
|
|
161
161
|
// Start with a tiny capacity so we force multiple grows
|
|
162
162
|
const buffer = new NodeBuffer(2);
|
|
163
163
|
// Push enough nodes to trigger at least one grow
|
|
164
|
-
// capacity
|
|
164
|
+
// capacity is floored at 32, root takes slot 0
|
|
165
165
|
const ids = [];
|
|
166
|
-
for (let i = 0; i <
|
|
166
|
+
for (let i = 0; i < 40; i++) {
|
|
167
167
|
ids.push(buffer.push(1 /* NodeKind.text */, i * 10, 0));
|
|
168
168
|
}
|
|
169
|
-
expect(buffer.size).toBe(
|
|
169
|
+
expect(buffer.size).toBe(41);
|
|
170
170
|
// All nodes should still be accessible with correct data
|
|
171
171
|
for (let i = 0; i < ids.length; i++) {
|
|
172
172
|
const node = buffer.get_node(ids[i]);
|
|
@@ -174,7 +174,6 @@ describe('NodeBuffer', () => {
|
|
|
174
174
|
expect(node.start).toBe(i * 10);
|
|
175
175
|
expect(node.parent).toBe(0);
|
|
176
176
|
}
|
|
177
|
-
// Root should have all 10 as children
|
|
178
177
|
expect(buffer.get_node().children).toEqual(ids);
|
|
179
178
|
// Sibling chain should be intact
|
|
180
179
|
for (let i = 0; i < ids.length; i++) {
|
|
@@ -188,7 +187,7 @@ describe('NodeBuffer', () => {
|
|
|
188
187
|
// Create a parent with children, forcing grow in the middle
|
|
189
188
|
const parent = buffer.push(7 /* NodeKind.paragraph */, 0, 0);
|
|
190
189
|
const children = [];
|
|
191
|
-
for (let i = 0; i <
|
|
190
|
+
for (let i = 0; i < 40; i++) {
|
|
192
191
|
children.push(buffer.push(1 /* NodeKind.text */, i, parent));
|
|
193
192
|
}
|
|
194
193
|
// Parent should know all its children
|
|
@@ -205,7 +204,7 @@ describe('NodeBuffer', () => {
|
|
|
205
204
|
info_end: 5,
|
|
206
205
|
});
|
|
207
206
|
// Push enough to trigger grow
|
|
208
|
-
for (let i = 0; i <
|
|
207
|
+
for (let i = 0; i < 40; i++) {
|
|
209
208
|
buffer.push(1 /* NodeKind.text */, i, 0);
|
|
210
209
|
}
|
|
211
210
|
// Metadata should survive the grow
|
|
@@ -218,7 +217,7 @@ describe('NodeBuffer', () => {
|
|
|
218
217
|
const committed = buffer.push_pending(10 /* NodeKind.strong_emphasis */, 5, 0);
|
|
219
218
|
buffer.commit_node(committed);
|
|
220
219
|
// Push enough to trigger grow
|
|
221
|
-
for (let i = 0; i <
|
|
220
|
+
for (let i = 0; i < 40; i++) {
|
|
222
221
|
buffer.push(1 /* NodeKind.text */, i, 0);
|
|
223
222
|
}
|
|
224
223
|
// Pending state should survive
|
|
@@ -229,7 +228,7 @@ describe('NodeBuffer', () => {
|
|
|
229
228
|
const id1 = buffer.push(8 /* NodeKind.code_span */, 0, 0);
|
|
230
229
|
buffer.set_value(id1, 1, 4);
|
|
231
230
|
// Push enough to trigger grow
|
|
232
|
-
for (let i = 0; i <
|
|
231
|
+
for (let i = 0; i < 40; i++) {
|
|
233
232
|
buffer.push(1 /* NodeKind.text */, i, 0);
|
|
234
233
|
}
|
|
235
234
|
expect(buffer.get_node(id1).value).toEqual([1, 4]);
|
|
@@ -238,11 +237,86 @@ describe('NodeBuffer', () => {
|
|
|
238
237
|
const buffer = new NodeBuffer(2);
|
|
239
238
|
const id1 = buffer.push(3 /* NodeKind.heading */, 0, 0, 3);
|
|
240
239
|
// Push enough to trigger grow
|
|
241
|
-
for (let i = 0; i <
|
|
240
|
+
for (let i = 0; i < 40; i++) {
|
|
242
241
|
buffer.push(1 /* NodeKind.text */, i, 0);
|
|
243
242
|
}
|
|
244
243
|
expect(buffer.get_node(id1).metadata).toEqual({ depth: 3 });
|
|
245
244
|
});
|
|
245
|
+
test('grow from a slab carve into a dedicated buffer keeps every field', () => {
|
|
246
|
+
const buffer = new NodeBuffer(2);
|
|
247
|
+
const ids = [];
|
|
248
|
+
for (let i = 0; i < 300; i++) {
|
|
249
|
+
const id = i % 3 === 0
|
|
250
|
+
? buffer.push_pending(9 /* NodeKind.emphasis */, i, 0)
|
|
251
|
+
: buffer.push(3 /* NodeKind.heading */, i, 0, i % 7, { n: i });
|
|
252
|
+
buffer.set_value(id, i + 1, i + 2);
|
|
253
|
+
buffer.set_end(id, i + 3);
|
|
254
|
+
ids.push(id);
|
|
255
|
+
}
|
|
256
|
+
for (let i = 0; i < ids.length; i++) {
|
|
257
|
+
const node = buffer.get_node(ids[i]);
|
|
258
|
+
expect(node.kind).toBe(i % 3 === 0 ? 'emphasis' : 'heading');
|
|
259
|
+
expect(node.start).toBe(i);
|
|
260
|
+
expect(node.end).toBe(i + 3);
|
|
261
|
+
expect(node.value).toEqual([i + 1, i + 2]);
|
|
262
|
+
expect(node.parent).toBe(0);
|
|
263
|
+
expect(node.prev).toBe(i === 0 ? null : ids[i - 1]);
|
|
264
|
+
expect(node.next).toBe(i === ids.length - 1 ? null : ids[i + 1]);
|
|
265
|
+
if (i % 3 !== 0) {
|
|
266
|
+
expect(node.metadata).toEqual({ n: i, depth: i % 7 });
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
expect(buffer.get_pending()).toEqual(ids.filter((_, i) => i % 3 === 0));
|
|
270
|
+
expect(buffer.get_node().children).toEqual(ids);
|
|
271
|
+
});
|
|
272
|
+
test('buffers carved from shared slabs stay independent and start zeroed', () => {
|
|
273
|
+
const buffers = [];
|
|
274
|
+
for (let b = 0; b < 120; b++) {
|
|
275
|
+
const buffer = new NodeBuffer(b % 2 === 0 ? 2 : 100);
|
|
276
|
+
for (let i = 0; i < 20; i++) {
|
|
277
|
+
const id = buffer.push(1 /* NodeKind.text */, b * 1000 + i, 0);
|
|
278
|
+
if (i % 2 === 0)
|
|
279
|
+
buffer.set_value(id, b, i);
|
|
280
|
+
}
|
|
281
|
+
buffers.push(buffer);
|
|
282
|
+
}
|
|
283
|
+
for (let b = 0; b < buffers.length; b++) {
|
|
284
|
+
const buffer = buffers[b];
|
|
285
|
+
for (let i = 0; i < 60; i++)
|
|
286
|
+
buffer.push(1 /* NodeKind.text */, i, 0);
|
|
287
|
+
}
|
|
288
|
+
for (let b = 0; b < buffers.length; b++) {
|
|
289
|
+
const buffer = buffers[b];
|
|
290
|
+
expect(buffer.size).toBe(81);
|
|
291
|
+
for (let i = 0; i < 20; i++) {
|
|
292
|
+
const node = buffer.get_node(i + 1);
|
|
293
|
+
expect(node.start).toBe(b * 1000 + i);
|
|
294
|
+
expect(node.value).toEqual(i % 2 === 0 ? [b, i] : [0, 0]);
|
|
295
|
+
expect(node.metadata).toEqual({});
|
|
296
|
+
}
|
|
297
|
+
for (let i = 21; i < 81; i++) {
|
|
298
|
+
expect(buffer.get_node(i).value).toEqual([0, 0]);
|
|
299
|
+
}
|
|
300
|
+
expect(buffer.get_pending()).toEqual([]);
|
|
301
|
+
}
|
|
302
|
+
});
|
|
303
|
+
test('ensure_capacity and reset leave a usable buffer', () => {
|
|
304
|
+
const buffer = new NodeBuffer(4);
|
|
305
|
+
const kept = buffer.push(1 /* NodeKind.text */, 7, 0);
|
|
306
|
+
buffer.set_value(kept, 1, 2);
|
|
307
|
+
buffer.ensure_capacity(1000);
|
|
308
|
+
expect(buffer.get_node(kept).value).toEqual([1, 2]);
|
|
309
|
+
for (let i = 0; i < 999; i++)
|
|
310
|
+
buffer.push(1 /* NodeKind.text */, i, 0);
|
|
311
|
+
expect(buffer.size).toBe(1001);
|
|
312
|
+
buffer.reset();
|
|
313
|
+
expect(buffer.size).toBe(0);
|
|
314
|
+
const id = buffer.push(0 /* NodeKind.root */, 0);
|
|
315
|
+
const child = buffer.push(1 /* NodeKind.text */, 5, id);
|
|
316
|
+
expect(buffer.get_node(child).value).toEqual([0, 0]);
|
|
317
|
+
expect(buffer.get_node(child).metadata).toEqual({});
|
|
318
|
+
expect(buffer.get_pending()).toEqual([]);
|
|
319
|
+
});
|
|
246
320
|
test('pending nodes can be repaired, deeply nested', () => {
|
|
247
321
|
const buffer = new NodeBuffer();
|
|
248
322
|
// Wrap in paragraph so inline repair path fires (not block-level)
|
package/tsc/wire_emitter.js
CHANGED
|
@@ -74,6 +74,12 @@ const KIND_NAMES = [
|
|
|
74
74
|
"svelte_tag",
|
|
75
75
|
"svelte_block",
|
|
76
76
|
"svelte_branch",
|
|
77
|
+
"directive_inline",
|
|
78
|
+
"directive_leaf",
|
|
79
|
+
"directive_container",
|
|
80
|
+
"frontmatter",
|
|
81
|
+
"import_statement",
|
|
82
|
+
"directive_label",
|
|
77
83
|
];
|
|
78
84
|
/**
|
|
79
85
|
* kinds where value_start/value_end on the node itself should produce t events.
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* WireTreeBuilder, populates a NodeBuffer from wire format batches.
|
|
3
3
|
*
|
|
4
4
|
* client-side counterpart to TreeBuilder. consumes the same json
|
|
5
|
-
* opcode batches that WireEmitter produces and builds the same
|
|
5
|
+
* opcode batches that WireEmitter produces and builds the same
|
|
6
6
|
* NodeBuffer structure. the resulting buffer is walkable by Cursor
|
|
7
7
|
* with identical semantics.
|
|
8
8
|
*
|
|
@@ -16,11 +16,10 @@
|
|
|
16
16
|
* const cursor = builder.cursor(); // reusable cursor over the buffer
|
|
17
17
|
* const html = renderCursor(cursor);
|
|
18
18
|
*/
|
|
19
|
-
import { NodeBuffer } from
|
|
20
|
-
import { Cursor } from
|
|
21
|
-
import type { PluginDispatcher } from
|
|
19
|
+
import { NodeBuffer } from './utils';
|
|
20
|
+
import { Cursor } from './cursor';
|
|
21
|
+
import type { PluginDispatcher } from './plugin_dispatch';
|
|
22
22
|
export declare class WireTreeBuilder {
|
|
23
|
-
/** the soa buffer. */
|
|
24
23
|
private buf;
|
|
25
24
|
/** maps wire node id -> buffer index. */
|
|
26
25
|
private id_to_index;
|
|
@@ -28,8 +27,6 @@ export declare class WireTreeBuilder {
|
|
|
28
27
|
private schema;
|
|
29
28
|
/** optional plugin dispatcher. null when no plugins registered. */
|
|
30
29
|
private dispatcher;
|
|
31
|
-
/** callback for dispatcher to register synthetic node ids. */
|
|
32
|
-
private register_id;
|
|
33
30
|
constructor(capacity?: number, dispatcher?: PluginDispatcher);
|
|
34
31
|
/**
|
|
35
32
|
* apply a batch of wire opcodes to the buffer.
|
package/tsc/wire_tree_builder.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* WireTreeBuilder, populates a NodeBuffer from wire format batches.
|
|
3
3
|
*
|
|
4
4
|
* client-side counterpart to TreeBuilder. consumes the same json
|
|
5
|
-
* opcode batches that WireEmitter produces and builds the same
|
|
5
|
+
* opcode batches that WireEmitter produces and builds the same
|
|
6
6
|
* NodeBuffer structure. the resulting buffer is walkable by Cursor
|
|
7
7
|
* with identical semantics.
|
|
8
8
|
*
|
|
@@ -16,17 +16,15 @@
|
|
|
16
16
|
* const cursor = builder.cursor(); // reusable cursor over the buffer
|
|
17
17
|
* const html = renderCursor(cursor);
|
|
18
18
|
*/
|
|
19
|
-
import { NodeBuffer } from
|
|
20
|
-
import { Cursor } from
|
|
21
|
-
import { WireTextSource } from
|
|
19
|
+
import { NodeBuffer, make_meta, merge_meta } from './utils';
|
|
20
|
+
import { Cursor } from './cursor';
|
|
21
|
+
import { WireTextSource } from './node_view';
|
|
22
22
|
const NONE = 0xffffffff;
|
|
23
23
|
export class WireTreeBuilder {
|
|
24
24
|
constructor(capacity = 128, dispatcher) {
|
|
25
|
-
/** callback for dispatcher to register synthetic node ids. */
|
|
26
|
-
this.register_id = (synthetic_id, buf_idx) => {
|
|
27
|
-
this.id_to_index[synthetic_id] = buf_idx;
|
|
28
|
-
};
|
|
29
25
|
this.buf = new NodeBuffer(capacity);
|
|
26
|
+
// this builder writes strings in place and its text source holds the array
|
|
27
|
+
this.buf.own_strings();
|
|
30
28
|
this.id_to_index = [0]; // root id 0 -> buffer index 0
|
|
31
29
|
this.schema = null;
|
|
32
30
|
this.dispatcher = dispatcher ?? null;
|
|
@@ -46,28 +44,28 @@ export class WireTreeBuilder {
|
|
|
46
44
|
for (let i = 0; i < batch.length; i++) {
|
|
47
45
|
const op = batch[i];
|
|
48
46
|
switch (op[0]) {
|
|
49
|
-
case
|
|
47
|
+
case 'S':
|
|
50
48
|
this.schema = op[1];
|
|
51
49
|
break;
|
|
52
|
-
case
|
|
50
|
+
case 'O':
|
|
53
51
|
this._open(op[1], op[2], op[3], op[4] === 1, op[5]);
|
|
54
52
|
break;
|
|
55
|
-
case
|
|
53
|
+
case 'C':
|
|
56
54
|
this._close(op[1]);
|
|
57
55
|
break;
|
|
58
|
-
case
|
|
56
|
+
case 'T':
|
|
59
57
|
this._text(op[1], op[2]);
|
|
60
58
|
break;
|
|
61
|
-
case
|
|
59
|
+
case 'A':
|
|
62
60
|
this._attr(op[1], op[2], op[3]);
|
|
63
61
|
break;
|
|
64
|
-
case
|
|
62
|
+
case 'R':
|
|
65
63
|
this._revoke(op[1], op[2]);
|
|
66
64
|
break;
|
|
67
|
-
case
|
|
65
|
+
case 'K':
|
|
68
66
|
this._commit(op[1]);
|
|
69
67
|
break;
|
|
70
|
-
case
|
|
68
|
+
case 'X':
|
|
71
69
|
this._clear(op[1]);
|
|
72
70
|
break;
|
|
73
71
|
}
|
|
@@ -75,7 +73,7 @@ export class WireTreeBuilder {
|
|
|
75
73
|
}
|
|
76
74
|
/** get a cursor over the current buffer state. */
|
|
77
75
|
cursor() {
|
|
78
|
-
return new Cursor(this.buf,
|
|
76
|
+
return new Cursor(this.buf, '');
|
|
79
77
|
}
|
|
80
78
|
/** get the underlying NodeBuffer. */
|
|
81
79
|
get_buffer() {
|
|
@@ -105,7 +103,7 @@ export class WireTreeBuilder {
|
|
|
105
103
|
this.id_to_index[id] = idx;
|
|
106
104
|
// plugin dispatch
|
|
107
105
|
if (this.dispatcher && this.dispatcher.has_handlers(kind)) {
|
|
108
|
-
this.dispatcher.dispatch_open(idx, kind, this.buf
|
|
106
|
+
this.dispatcher.dispatch_open(idx, kind, this.buf);
|
|
109
107
|
}
|
|
110
108
|
}
|
|
111
109
|
_close(id) {
|
|
@@ -116,7 +114,7 @@ export class WireTreeBuilder {
|
|
|
116
114
|
// capture pending state BEFORE close dispatch / commit.
|
|
117
115
|
// pending nodes may still be revoked after close, so their
|
|
118
116
|
// undo logs must be preserved until explicit commit or revoke.
|
|
119
|
-
const was_pending = this.buf.
|
|
117
|
+
const was_pending = this.buf.pending_at(idx) === 1;
|
|
120
118
|
// plugin close dispatch
|
|
121
119
|
if (this.dispatcher) {
|
|
122
120
|
this.dispatcher.dispatch_close(idx, this.buf);
|
|
@@ -124,11 +122,11 @@ export class WireTreeBuilder {
|
|
|
124
122
|
// pending paragraphs inside list_items are tight-list speculation
|
|
125
123
|
// wrappers, they stay pending after close until the list closes
|
|
126
124
|
// and the parser either revokes (tight) or commits (loose) them.
|
|
127
|
-
const kind = this.buf.
|
|
128
|
-
const parent_kind = this.buf.
|
|
125
|
+
const kind = this.buf.kind_at(idx);
|
|
126
|
+
const parent_kind = this.buf.kind_at(this.buf.parent_at(idx));
|
|
129
127
|
if (!(kind === 7 /* NodeKind.paragraph */ &&
|
|
130
128
|
parent_kind === 16 /* NodeKind.list_item */ &&
|
|
131
|
-
this.buf.
|
|
129
|
+
this.buf.pending_at(idx) === 1)) {
|
|
132
130
|
this.buf.commit_node(idx);
|
|
133
131
|
// only commit undo log if the node was NOT pending at close time.
|
|
134
132
|
// pending nodes keep their undo logs until explicit commit/revoke.
|
|
@@ -141,13 +139,13 @@ export class WireTreeBuilder {
|
|
|
141
139
|
if (kind === 15 /* NodeKind.list */) {
|
|
142
140
|
const meta = this.buf.metadata_at(idx);
|
|
143
141
|
if (meta && meta.tight) {
|
|
144
|
-
let item = this.buf.
|
|
142
|
+
let item = this.buf.first_child_at(idx);
|
|
145
143
|
while (item !== NONE) {
|
|
146
|
-
const next_item = this.buf.
|
|
147
|
-
let child = this.buf.
|
|
144
|
+
const next_item = this.buf.next_at(item);
|
|
145
|
+
let child = this.buf.first_child_at(item);
|
|
148
146
|
while (child !== NONE) {
|
|
149
|
-
const next_child = this.buf.
|
|
150
|
-
if (this.buf.
|
|
147
|
+
const next_child = this.buf.next_at(child);
|
|
148
|
+
if (this.buf.kind_at(child) === 7 /* NodeKind.paragraph */) {
|
|
151
149
|
this.buf.unwrap_node(child);
|
|
152
150
|
}
|
|
153
151
|
child = next_child;
|
|
@@ -167,7 +165,7 @@ export class WireTreeBuilder {
|
|
|
167
165
|
if (redirect !== undefined)
|
|
168
166
|
idx = redirect;
|
|
169
167
|
}
|
|
170
|
-
const kind = this.buf.
|
|
168
|
+
const kind = this.buf.kind_at(idx);
|
|
171
169
|
const strings = this.buf._strings;
|
|
172
170
|
// content leaves: store string directly on the node
|
|
173
171
|
if (kind === 5 /* NodeKind.code_fence */ ||
|
|
@@ -183,7 +181,7 @@ export class WireTreeBuilder {
|
|
|
183
181
|
// the parser writes value_start/value_end directly on the html node.
|
|
184
182
|
if (kind === 2 /* NodeKind.html */) {
|
|
185
183
|
const meta = this.buf.metadata_at(idx);
|
|
186
|
-
if (meta && (meta.tag ===
|
|
184
|
+
if (meta && (meta.tag === 'script' || meta.tag === 'style')) {
|
|
187
185
|
const existing = strings[idx];
|
|
188
186
|
strings[idx] = existing !== undefined ? existing + content : content;
|
|
189
187
|
return;
|
|
@@ -203,7 +201,7 @@ export class WireTreeBuilder {
|
|
|
203
201
|
}
|
|
204
202
|
const text_idx = this.buf.push(1 /* NodeKind.text */, 0, idx);
|
|
205
203
|
strings[text_idx] = content;
|
|
206
|
-
this.buf.
|
|
204
|
+
this.buf.set_end(text_idx, 1);
|
|
207
205
|
}
|
|
208
206
|
/**
|
|
209
207
|
* return the buffer index of the last child of `idx` if and only if that
|
|
@@ -211,17 +209,17 @@ export class WireTreeBuilder {
|
|
|
211
209
|
* and _clear (discard in-progress text).
|
|
212
210
|
*/
|
|
213
211
|
_last_text_child(idx) {
|
|
214
|
-
let child = this.buf.
|
|
212
|
+
let child = this.buf.first_child_at(idx);
|
|
215
213
|
if (child === NONE)
|
|
216
214
|
return NONE;
|
|
217
215
|
let last = child;
|
|
218
216
|
while (true) {
|
|
219
|
-
const next = this.buf.
|
|
220
|
-
if (next === NONE || this.buf.
|
|
217
|
+
const next = this.buf.next_at(last);
|
|
218
|
+
if (next === NONE || this.buf.parent_at(next) !== idx)
|
|
221
219
|
break;
|
|
222
220
|
last = next;
|
|
223
221
|
}
|
|
224
|
-
return this.buf.
|
|
222
|
+
return this.buf.kind_at(last) === 1 /* NodeKind.text */ ? last : NONE;
|
|
225
223
|
}
|
|
226
224
|
_attr(id, key, value) {
|
|
227
225
|
const idx = this.id_to_index[id];
|
|
@@ -229,11 +227,10 @@ export class WireTreeBuilder {
|
|
|
229
227
|
return;
|
|
230
228
|
const existing = this.buf.metadata_at(idx);
|
|
231
229
|
if (existing) {
|
|
232
|
-
existing
|
|
233
|
-
this.buf.set_metadata(idx, existing);
|
|
230
|
+
merge_meta(existing, key, value);
|
|
234
231
|
}
|
|
235
232
|
else {
|
|
236
|
-
this.buf.set_metadata(idx,
|
|
233
|
+
this.buf.set_metadata(idx, make_meta(key, value));
|
|
237
234
|
}
|
|
238
235
|
}
|
|
239
236
|
_revoke(id, delimiter) {
|