Skip to content

svelte2tsx incremental transformation #253

@dummdidumm

Description

@dummdidumm

Is your feature request related to a problem? Please describe.
svelte2tsx transformation is triggered on every document change / on every key stroke. This may be imperformant. Also, since it relies on the svelte parser, it will not return anything in error states.

Describe the solution you'd like
In case of addition/deletion of a single character, try some kind of update to the transformed code instead. This could improve the performance and also prevent some error states.

Logic could be the following:

  • Inside style tags, use the old version and adjust offset afterwards, because style tags will never alter the output (they are blanked out)
  • Inside script tags, try to add it at the correct position. Do a complete reparse in case of characters that might need special treatment, like export or $
  • Template: If it's a new tag getting added <b.., try to add it, else reparse
  • in error state, always reparse

Problems:

  • source mapping

Describe alternatives you've considered
Wait on more robust/error forgiving and incremental svelte compiler.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions