@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/test/print.ts
CHANGED
|
@@ -16,7 +16,8 @@ function fmt_val(v: unknown): string {
|
|
|
16
16
|
|
|
17
17
|
/**
|
|
18
18
|
* Node kinds that carry a meaningful value range to display as a quoted string.
|
|
19
|
-
* Container nodes (paragraph, emphasis, etc.) let children convey content
|
|
19
|
+
* Container nodes (paragraph, emphasis, etc.) let children convey content, as
|
|
20
|
+
* does a block directive, whose bracket text is its directive_label child.
|
|
20
21
|
*/
|
|
21
22
|
const VALUE_KINDS = new Set([
|
|
22
23
|
'text',
|
|
@@ -27,8 +28,6 @@ const VALUE_KINDS = new Set([
|
|
|
27
28
|
'mustache',
|
|
28
29
|
'svelte_tag',
|
|
29
30
|
'svelte_branch',
|
|
30
|
-
'directive_leaf',
|
|
31
|
-
'directive_container',
|
|
32
31
|
'frontmatter',
|
|
33
32
|
'import_statement',
|
|
34
33
|
]);
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { spawnSync } from 'node:child_process';
|
|
2
|
+
import { existsSync } from 'node:fs';
|
|
3
|
+
import { fileURLToPath, pathToFileURL } from 'node:url';
|
|
4
|
+
import { describe, expect, test } from 'vitest';
|
|
5
|
+
|
|
6
|
+
// v8 never optimizes a function over 61440 bytes of bytecode, so an oversized
|
|
7
|
+
// _run keeps the whole state machine in baseline code, the margin is for new states
|
|
8
|
+
const MAX_RUN_BYTECODE = 55000;
|
|
9
|
+
|
|
10
|
+
const DIST = fileURLToPath(new URL('../dist/main.js', import.meta.url));
|
|
11
|
+
|
|
12
|
+
describe('PFMParser._run', () => {
|
|
13
|
+
test.skipIf(!existsSync(DIST))(
|
|
14
|
+
'bytecode stays below the turbofan size limit',
|
|
15
|
+
() => {
|
|
16
|
+
const script =
|
|
17
|
+
`const m = await import(${JSON.stringify(pathToFileURL(DIST).href)});` +
|
|
18
|
+
`m.parse_markdown_svelte('# a\\n\\n- b *c*\\n');`;
|
|
19
|
+
const result = spawnSync(
|
|
20
|
+
process.execPath,
|
|
21
|
+
[
|
|
22
|
+
'--print-bytecode',
|
|
23
|
+
'--print-bytecode-filter=_run',
|
|
24
|
+
'--input-type=module',
|
|
25
|
+
'-e',
|
|
26
|
+
script,
|
|
27
|
+
],
|
|
28
|
+
{ encoding: 'utf8', maxBuffer: 256 * 1024 * 1024 }
|
|
29
|
+
);
|
|
30
|
+
expect(result.status).toBe(0);
|
|
31
|
+
const match = /Bytecode length: (\d+)/.exec(result.stdout);
|
|
32
|
+
expect(match).not.toBeNull();
|
|
33
|
+
expect(Number(match![1])).toBeLessThan(MAX_RUN_BYTECODE);
|
|
34
|
+
}
|
|
35
|
+
);
|
|
36
|
+
});
|
|
@@ -1,19 +1,13 @@
|
|
|
1
1
|
root
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
line_break
|
|
6
|
-
html tag="title"
|
|
7
|
-
paragraph
|
|
2
|
+
html tag="svelte:head"
|
|
3
|
+
line_break
|
|
4
|
+
html tag="title"
|
|
8
5
|
text "My Title"
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
paragraph
|
|
15
|
-
text "</svelte"
|
|
16
|
-
text ":head>"
|
|
6
|
+
line_break
|
|
7
|
+
html tag="link" rel="stylesheet" type="text/css" href="theme.css" self_closing=true
|
|
8
|
+
soft_break
|
|
9
|
+
html tag="style"
|
|
10
|
+
line_break
|
|
17
11
|
line_break
|
|
18
12
|
line_break
|
|
19
13
|
html tag="Counter" prop=[object Object]
|
|
@@ -39,6 +33,5 @@ root
|
|
|
39
33
|
paragraph
|
|
40
34
|
text "text"
|
|
41
35
|
line_break
|
|
42
|
-
|
|
43
|
-
text "</Counter>"
|
|
36
|
+
text "</Counter>"
|
|
44
37
|
line_break
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
root
|
|
2
|
-
html tag="Counter" prop="prop" self_closing=true
|
|
3
|
-
line_break
|
|
4
2
|
paragraph
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
3
|
+
html tag="Counter" prop="prop" self_closing=true
|
|
4
|
+
soft_break
|
|
5
|
+
text tag="Counter" prop="prop/" "<Counter prop=prop/>"
|
|
6
|
+
soft_break
|
|
7
|
+
html tag="Counter" prop="{prop}" self_closing=true
|
|
8
|
+
soft_break
|
|
9
|
+
html tag="Counter" prop=[object Object] self_closing=true
|
|
10
|
+
soft_break
|
|
11
|
+
html tag="Counter" prop="{[1, 2, 3, 4, 5, 6, 7]]}" self_closing=true
|
|
12
|
+
soft_break
|
|
13
|
+
html tag="Counter" prop="{[{a: 1, b: { c: 2}}, {a: 1, b: { c: 2}}, {a: 1, b: { c: 2}}, {a: 1, b: { c: 2}}, {a: 1, b: { c: 2}}]}" self_closing=true
|
|
14
|
+
soft_break
|
|
15
|
+
html tag="Counter" prop=[object Object] self_closing=true
|
|
16
16
|
line_break
|
|
@@ -121,7 +121,7 @@ root
|
|
|
121
121
|
line_break
|
|
122
122
|
paragraph
|
|
123
123
|
text "another line with just "
|
|
124
|
-
text "
|
|
124
|
+
text "_"
|
|
125
125
|
text "_one double underscore"
|
|
126
126
|
line_break
|
|
127
127
|
line_break
|
|
@@ -132,7 +132,7 @@ root
|
|
|
132
132
|
line_break
|
|
133
133
|
paragraph
|
|
134
134
|
text "another line with just "
|
|
135
|
-
text "
|
|
135
|
+
text "*"
|
|
136
136
|
text "*one double asterix"
|
|
137
137
|
line_break
|
|
138
138
|
line_break
|
|
@@ -3,4 +3,11 @@ root
|
|
|
3
3
|
paragraph
|
|
4
4
|
text "Define a function in javascript:"
|
|
5
5
|
line_break
|
|
6
|
-
code_fence "> function MyFunc(a) {\n> var s = '`';\n> }
|
|
6
|
+
code_fence "> function MyFunc(a) {\n> var s = '`';\n> }"
|
|
7
|
+
line_break
|
|
8
|
+
block_quote
|
|
9
|
+
paragraph
|
|
10
|
+
text "And some nested quote"
|
|
11
|
+
line_break
|
|
12
|
+
code_fence info="html" ">> <div>HTML!</div>"
|
|
13
|
+
line_break
|
|
@@ -4,18 +4,16 @@ root
|
|
|
4
4
|
html_comment " a comment with *bogus* __markdown__ inside "
|
|
5
5
|
line_break
|
|
6
6
|
html tag="p"
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
7
|
+
text "words "
|
|
8
|
+
html_comment " a comment "
|
|
9
|
+
text " words"
|
|
10
|
+
soft_break
|
|
11
|
+
html_comment " comment "
|
|
12
|
+
text " words"
|
|
13
|
+
soft_break
|
|
14
|
+
html_comment " comment "
|
|
15
|
+
soft_break
|
|
12
16
|
html_comment " comment "
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
soft_break
|
|
16
|
-
html_comment " comment "
|
|
17
|
-
soft_break
|
|
18
|
-
html_comment " comment "
|
|
19
|
-
soft_break
|
|
20
|
-
html_comment "--------------------------------------------------------------------------------------------------------------------------------------------------\n<!------------------------------------------------------------------"
|
|
17
|
+
soft_break
|
|
18
|
+
html_comment "--------------------------------------------------------------------------------------------------------------------------------------------------\n<!------------------------------------------------------------------"
|
|
21
19
|
line_break
|
|
@@ -4,28 +4,22 @@ root
|
|
|
4
4
|
line_break
|
|
5
5
|
line_break
|
|
6
6
|
html tag="section"
|
|
7
|
-
|
|
8
|
-
text "hello"
|
|
7
|
+
text "hello"
|
|
9
8
|
line_break
|
|
10
9
|
html tag="header"
|
|
11
|
-
|
|
12
|
-
text "head"
|
|
10
|
+
text "head"
|
|
13
11
|
line_break
|
|
14
12
|
html tag="footer"
|
|
15
|
-
|
|
16
|
-
text "footsies"
|
|
13
|
+
text "footsies"
|
|
17
14
|
line_break
|
|
18
15
|
html tag="nav"
|
|
19
|
-
|
|
20
|
-
text "navigation"
|
|
16
|
+
text "navigation"
|
|
21
17
|
line_break
|
|
22
18
|
html tag="article"
|
|
23
|
-
|
|
24
|
-
text "read me"
|
|
19
|
+
text "read me"
|
|
25
20
|
line_break
|
|
26
21
|
html tag="aside"
|
|
27
|
-
|
|
28
|
-
text "ignore me"
|
|
22
|
+
text "ignore me"
|
|
29
23
|
line_break
|
|
30
24
|
html tag="article"
|
|
31
25
|
paragraph
|
|
@@ -49,15 +43,13 @@ root
|
|
|
49
43
|
html tag="tr"
|
|
50
44
|
line_break
|
|
51
45
|
html tag="td"
|
|
52
|
-
|
|
53
|
-
text "Foo"
|
|
46
|
+
text "Foo"
|
|
54
47
|
line_break
|
|
55
48
|
line_break
|
|
56
49
|
html tag="tr"
|
|
57
50
|
line_break
|
|
58
51
|
html tag="td"
|
|
59
|
-
|
|
60
|
-
text "Bar"
|
|
52
|
+
text "Bar"
|
|
61
53
|
line_break
|
|
62
54
|
line_break
|
|
63
55
|
line_break
|
|
@@ -69,16 +61,14 @@ root
|
|
|
69
61
|
html tag="tr"
|
|
70
62
|
line_break
|
|
71
63
|
html tag="td"
|
|
72
|
-
|
|
73
|
-
text "Foo"
|
|
64
|
+
text "Foo"
|
|
74
65
|
line_break
|
|
75
66
|
line_break
|
|
76
67
|
line_break
|
|
77
68
|
html tag="tr"
|
|
78
69
|
line_break
|
|
79
70
|
html tag="td"
|
|
80
|
-
|
|
81
|
-
text "Bar"
|
|
71
|
+
text "Bar"
|
|
82
72
|
line_break
|
|
83
73
|
line_break
|
|
84
74
|
html tag="tfoot"
|
|
@@ -86,8 +76,7 @@ root
|
|
|
86
76
|
html tag="tr"
|
|
87
77
|
line_break
|
|
88
78
|
html tag="td"
|
|
89
|
-
|
|
90
|
-
text "Bar"
|
|
79
|
+
text "Bar"
|
|
91
80
|
line_break
|
|
92
81
|
line_break
|
|
93
82
|
line_break
|
|
@@ -110,15 +99,14 @@ root
|
|
|
110
99
|
line_break
|
|
111
100
|
line_break
|
|
112
101
|
html tag="address"
|
|
113
|
-
|
|
114
|
-
text "My street"
|
|
102
|
+
text "My street"
|
|
115
103
|
line_break
|
|
116
104
|
line_break
|
|
117
105
|
html tag="canvas" id="canvas" width="300" height="300"
|
|
118
106
|
line_break
|
|
119
107
|
paragraph
|
|
120
108
|
text "Sorry, your browser doesn't support the <canvas> element."
|
|
121
|
-
|
|
109
|
+
line_break
|
|
122
110
|
line_break
|
|
123
111
|
line_break
|
|
124
112
|
html tag="figure"
|
|
@@ -126,20 +114,17 @@ root
|
|
|
126
114
|
html tag="img" src="mypic.png" alt="An awesome picture" self_closing=true
|
|
127
115
|
line_break
|
|
128
116
|
html tag="figcaption"
|
|
129
|
-
|
|
130
|
-
text "Caption for the awesome picture"
|
|
117
|
+
text "Caption for the awesome picture"
|
|
131
118
|
line_break
|
|
132
119
|
line_break
|
|
133
120
|
line_break
|
|
134
121
|
html tag="hgroup"
|
|
135
122
|
line_break
|
|
136
123
|
html tag="h1"
|
|
137
|
-
|
|
138
|
-
text "Main title"
|
|
124
|
+
text "Main title"
|
|
139
125
|
line_break
|
|
140
126
|
html tag="h2"
|
|
141
|
-
|
|
142
|
-
text "Secondary title"
|
|
127
|
+
text "Secondary title"
|
|
143
128
|
line_break
|
|
144
129
|
line_break
|
|
145
130
|
line_break
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
root
|
|
2
|
-
html tag="a" href="foo"
|
|
3
|
-
paragraph
|
|
4
|
-
text "some text"
|
|
5
2
|
paragraph
|
|
6
|
-
|
|
3
|
+
html tag="a" href="foo"
|
|
4
|
+
text "some text"
|
|
5
|
+
text " words"
|
|
7
6
|
line_break
|
|
8
7
|
line_break
|
|
9
|
-
html tag="br" self_closing=true
|
|
10
8
|
paragraph
|
|
11
|
-
|
|
9
|
+
html tag="br" self_closing=true
|
|
10
|
+
text " words"
|
|
12
11
|
line_break
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
root
|
|
2
2
|
html tag="code"
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
text "some "
|
|
4
|
+
strong_emphasis
|
|
5
5
|
strong_emphasis
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
text " yeah"
|
|
6
|
+
text "code"
|
|
7
|
+
text " yeah"
|
|
9
8
|
line_break
|
|
10
9
|
line_break
|
|
11
10
|
paragraph
|
|
@@ -18,14 +17,13 @@ root
|
|
|
18
17
|
text " block"
|
|
19
18
|
line_break
|
|
20
19
|
line_break
|
|
21
|
-
|
|
22
|
-
|
|
20
|
+
paragraph
|
|
21
|
+
html tag="code"
|
|
23
22
|
text "some inline "
|
|
24
23
|
strong_emphasis
|
|
25
24
|
strong_emphasis
|
|
26
25
|
text "code"
|
|
27
|
-
|
|
28
|
-
text "block"
|
|
26
|
+
text " block"
|
|
29
27
|
line_break
|
|
30
28
|
line_break
|
|
31
29
|
paragraph
|
|
@@ -38,10 +36,9 @@ root
|
|
|
38
36
|
line_break
|
|
39
37
|
line_break
|
|
40
38
|
html tag="div"
|
|
41
|
-
|
|
42
|
-
|
|
39
|
+
text "some "
|
|
40
|
+
strong_emphasis
|
|
43
41
|
strong_emphasis
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
text " yeah"
|
|
42
|
+
text "div"
|
|
43
|
+
text " yeah"
|
|
47
44
|
line_break
|
|
@@ -3,9 +3,8 @@ root
|
|
|
3
3
|
line_break
|
|
4
4
|
html tag="code"
|
|
5
5
|
line_break
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
soft_break
|
|
6
|
+
text "foobar"
|
|
7
|
+
line_break
|
|
9
8
|
line_break
|
|
10
9
|
line_break
|
|
11
10
|
line_break
|
|
@@ -17,9 +16,8 @@ root
|
|
|
17
16
|
line_break
|
|
18
17
|
html tag="code" bla="bla"
|
|
19
18
|
line_break
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
soft_break
|
|
19
|
+
text "foobar"
|
|
20
|
+
line_break
|
|
23
21
|
line_break
|
|
24
22
|
line_break
|
|
25
23
|
line_break
|
|
@@ -28,8 +26,7 @@ root
|
|
|
28
26
|
html tag="code"
|
|
29
27
|
line_break
|
|
30
28
|
html tag="div"
|
|
31
|
-
|
|
32
|
-
text "some html code"
|
|
29
|
+
text "some html code"
|
|
33
30
|
line_break
|
|
34
31
|
line_break
|
|
35
32
|
line_break
|