Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Svelte preprocessing example #49

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

tommywalkie
Copy link

Hi,
First of all, I would like to say I really enjoy using uvu, thanks @lukeed for making this awesome tool.
I was interested into using it in a Svelte / TypeScript project. but uvu doesn't have preprocessing support.

So I added a new example svelte-preprocess in which I re-adapted the original svelte example but using TypeScript preprocessor. Most of the scripts come from svelte-jester (MIT licensed), which allows Jest to handle Svelte files using preprocessors if some svelte.config.js file exists.

Implementation could be better, but performance seems quite fine though.

Count.svelte

<script>
    type CountResult = number
    export let count: CountResult = 5;

    function increment(): void {
        count++;
    }

    function decrement(): void {
        count--;
    }
</script>

<button id="decr" on:click={decrement}>--</button>
<span>{count}</span>
<button id="incr" on:click={increment}>++</button>

Logs

$ uvu tests -r esm -r tests/setup/register -i setup
Count.js
• • • •   (4 / 4)

  Total:     4
  Passed:    4
  Skipped:   0
  Duration:  29.92ms

Done in 2.57s.

@benmccann
Copy link

benmccann commented Jun 25, 2021

The title of this PR is "Svelte preprocessing support with example", but I only see example code. Is there library code that was accidentally left off this PR or should the title be updated to something more like "Svelte preprocessing example"?

@tommywalkie
Copy link
Author

@benmccann Hi, sorry for the long delay, yes we can rename it like "Svelte preprocessing example" for clarity.

@tommywalkie tommywalkie changed the title [Experimental] Svelte preprocessing support with example Svelte preprocessing example Jun 28, 2021
@seanlail seanlail mentioned this pull request Sep 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants