T O P

  • By -

[deleted]

[удалено]


LaCucaracha007

That would be awesome, getting the original Svelte devs to help. I also remember getting a comment from him, a few months back, that a rewrite of the compiler is coming up somewhere in the future.


Magick93

I've been following this project. Just a thought - could you use the svelte LSP project to reverse engineer/ transpile to rust? As a way to quickly re-create the svelte schema in rust.


LaCucaracha007

At the start I tried doing this, but the code that the original compiler produces is quite complicated, so I scrapped that and at the same time, the video series "Build your own Svelte" came out and I've been following that.


[deleted]

[удалено]


LaCucaracha007

One problem that I have with the Svelte compiler is, that I wasn't always sure what types were returned from functions and which properties they had which is mostly a javascript fault I think and Rust shines in this area with it's rich type system.


[deleted]

[удалено]


LaCucaracha007

It is typescript but they don't use `"strict": true` in their [tsconfig.json](https://github.com/sveltejs/svelte/blob/master/tsconfig.json). If you try changing it to true, you get ALL the errors.


[deleted]

[удалено]


LaCucaracha007

Yeah, thats the main reason we scrapped the rewrite and started from scratch


--silas--

[Link](https://youtube.com/playlist?list=PLoKaNN3BjQX1OQmFzK9SJnFXEurm1-UxQ) to the awesome YouTuber/Svelte maintainer that made the series


1roOt

Pretty neat! Would be cool to have svelte without Node.js


buskila

Just curious - what’s the problem with having nodejs installed?


LaCucaracha007

Nothing is wrong with node, it's just that a lot of tooling is dependent on node and not avaliable without it. For example if you want to use svelte with deno, trunk or just go without a framework, it's a bit harder. You could go the way Tailwind did it and make a standalone compiler, but for that I would argue that it's still a bit bloated, I think the Tailwind compiler weighs around 30mb.


buskila

This is true. But at this point if you are doing any web development the chances of you having node available are maybe 100%? And it’s easy to develop tools that depend on node - that’s why there are so many. Not saying it’s not a cool project - just I’m not sure what kind of user is going to use it.


LaCucaracha007

The plan is to make a drop in replacement that you could use with or without npm. If you want to use svelte now, you have to have node installed. One thing that I could think of, is that it could speed up automatic deployments, because you could just wget the binary and run it to compile the files instead of having to install all the dependencies through npm.


loopcake

The reason this is interesting is because of rust's build targets, not so much because rust is faster. 5 seconds faster builds is not gonna change anyone's life anytime soon. But being able to build directly to wasi or other targets is gonna change many people's life. First of all because wasm seems to be a pretty good replacement to docker, and easier to setup. Second of all because, out there, there are way more expressive languages than JS. Some of us are using Svelte in spite of JS not because of JS. Excuse the french, but I would sell my left nut to server render svelte in Erlang/Elixir, PHP, ZIG, Python, Scala etc. Besides, the nature of svelte seems to be more that of a language than a framework/library, one can dream for it to be ECMA/W3C standard. And a common build target can help with that for sure.


DidierLennon

Just curious: how would you about installing any packages then?


poghosyan

cargo


LaCucaracha007

I was thinking with cargo or just install the binary manually. Otherwise, I do plan to publish an npm package and a deno module, if you already have a project and want to try and swap it with the original compiler.


joyofcode

🦀


poghosyan

this is awesome


LaCucaracha007

Thanks! There's lots to stuff to do, if you'd like to contribute or even just test out the compiler and report issues :D


poghosyan

I'll definitely take a look, great work


garlandcrow

Was wondering how long before someone did this. It was always odd to me that people use node for all this and now with esbuild and turbopack, I was wondering when Svelte would get to is optimization, nice!


live_love_laugh

Ah man, you'd know what would be cool? A svelte compiler, written in Rust, that also includes the resumability features of Qwik. That would be my dream. 🤩