Gathering detailed insights and metrics for svelte-check
Gathering detailed insights and metrics for svelte-check
Gathering detailed insights and metrics for svelte-check
Gathering detailed insights and metrics for svelte-check
The Svelte Language Server, and official extensions which use it
npm install svelte-check
extensions-109.3.2
Published on 22 Nov 2024
extensions-109.3.1
Published on 22 Nov 2024
svelte2tsx-0.7.28
Published on 22 Nov 2024
extensions-109.3.0
Published on 22 Nov 2024
svelte-check-4.1.0
Published on 22 Nov 2024
language-server-0.17.7
Published on 22 Nov 2024
Module System
Min. Node Version
Typescript Support
Node Version
NPM Version
1,258 Stars
1,707 Commits
201 Forks
14 Watching
24 Branches
133 Contributors
Updated on 25 Nov 2024
Minified
Minified + Gzipped
TypeScript (78.79%)
JavaScript (16.14%)
Svelte (5.07%)
Cumulative downloads
Total Downloads
Last day
0.3%
85,373
Compared to previous day
Last week
3.3%
470,816
Compared to previous week
Last month
15.9%
1,883,219
Compared to previous month
Last year
55.8%
17,409,109
Compared to previous year
5
2
17
Svelte Language Tools contains a library implementing the Language Server Protocol (LSP). LSP powers the VSCode extension, which is also hosted in this repository. Additionally, LSP is capable of powering plugins for numerous other IDEs.
A .svelte
file would look something like this:
1<script> 2 let count = 1; 3 4 // the `$:` means 're-run whenever these values change' 5 $: doubled = count * 2; 6 $: quadrupled = doubled * 2; 7 8 function handleClick() { 9 count += 1; 10 } 11</script> 12 13<button on:click="{handleClick}">Count: {count}</button> 14 15<p>{count} * 2 = {doubled}</p> 16<p>{doubled} * 2 = {quadrupled}</p>
Which is a mix of HTMLx and vanilla JavaScript (but with additional runtime behavior coming from the svelte compiler).
This repo contains the tools which provide editor integrations for Svelte files like this.
This repo uses pnpm workspaces
, which TLDR means if you want to run a commands in each project then you can either cd
to that directory and run the command, or use pnpm -r [command]
.
For example pnpm -r test
.
svelte-language-server
The language server for Svelte. Built from UnwrittenFun/svelte-language-server and heavily inspired by Vetur to become the official language server for the language.
svelte-check
A command line tool to check your svelte files for type errors, unused css, and more. Built from Vetur's VTI.
svelte-vscode
The official vscode extension for Svelte. Built from UnwrittenFun/svelte-vscode to become the official vscode extension for the language.
svelte2tsx
Converts a .svelte file into a legal TypeScript file. Built from halfnelson/svelte2tsx to provide the auto-complete and import mapping inside the language server.
Want to see how it's transformed? Check out this REPL
1flowchart LR 2 %% IDEs 3 VSC[IDE: VSCode + Svelte for VS Code extension] 4 click VSC "https://github.com/sveltejs/language-tools/tree/master/packages/svelte-vscode" "Svelte for VSCode extension" 5 %% Tools 6 CLI[CLI: svelte-check] 7 click CLI "https://github.com/sveltejs/language-tools/tree/master/packages/svelte-check" "A command line tool to get diagnostics for Svelte code" 8 %% Svelte - Extensions 9 VSC_TSSP[typescript-svelte-plugin] 10 click VSC_TSSP "https://github.com/sveltejs/language-tools/tree/master/packages/typescript-plugin" "A TypeScript plugin for Svelte intellisense" 11 %% Svelte - Packages 12 SVELTE_LANGUAGE_SERVER["svelte-language-server"] 13 SVELTE_COMPILER_SERVICE["svelte2tsx"] 14 TS_SERVICE["TS/JS intellisense using TypeScript language service"] 15 SVELTE_SERVICE["Svelte intellisense using Svelte compiler"] 16 click SVELTE_LANGUAGE_SERVER "https://github.com/sveltejs/language-tools/tree/master/packages/language-server" "A language server adhering to the LSP" 17 click SVELTE_COMPILER_SERVICE "https://github.com/sveltejs/language-tools/tree/master/packages/language-server/src/plugins/svelte" "Transforms Svelte code into JSX/TSX code" 18 click TS_SERVICE "https://github.com/sveltejs/language-tools/tree/master/packages/language-server/src/plugins/typescript" 19 click SVELTE_SERVICE "https://github.com/sveltejs/language-tools/tree/master/packages/language-server/src/plugins/svelte" 20 %% External Packages 21 HTML_SERVICE[HTML intellisense using vscode-html-languageservice] 22 CSS_SERVICE[CSS intellisense using vscode-css-languageservice] 23 VSC_TS[vscode-typescript-language-features] 24 click HTML_SERVICE "https://github.com/microsoft/vscode-html-languageservice" 25 click CSS_SERVICE "https://github.com/microsoft/vscode-css-languageservice" 26 click VSC_TS "https://github.com/microsoft/vscode/tree/main/extensions/typescript-language-features" 27 subgraph EMBEDDED_SERVICES[Embedded Language Services] 28 direction LR 29 TS_SERVICE 30 SVELTE_SERVICE 31 HTML_SERVICE 32 CSS_SERVICE 33 end 34 VSC -- Language Server Protocol --> SVELTE_LANGUAGE_SERVER 35 CLI -- Only using diagnostics feature --> SVELTE_LANGUAGE_SERVER 36 VSC -- includes --> VSC_TS 37 VSC_TS -- loads --> VSC_TSSP 38 VSC_TSSP -- uses --> SVELTE_COMPILER_SERVICE 39 TS_SERVICE -- uses --> SVELTE_COMPILER_SERVICE 40 SVELTE_LANGUAGE_SERVER -- bundles --> EMBEDDED_SERVICES
More information about the internals can be found HERE.
Pull requests are encouraged and always welcome. Pick an issue and help us out!
To install and work on these tools locally:
Make sure to uninstall the extension from the marketplace to not have it clash with the local one.
1git clone https://github.com/sveltejs/language-tools.git svelte-language-tools 2cd svelte-language-tools 3pnpm install 4pnpm bootstrap
Do not use npm to install the dependencies, as the specific package versions in
pnpm-lock.yaml
are used to build and test Svelte.
To build all of the tools, run:
1pnpm build
The tools are written in TypeScript, but don't let that put you off — it's basically just JavaScript with type annotations. You'll pick it up in no time. If you're using an editor other than Visual Studio Code you may need to install a plugin in order to get syntax highlighting and code hints etc.
There are two ways to work on this project: either by working against an existing project or entirely through tests.
To run the developer version of both the language server and the VSCode extension:
This launches a new VSCode window and a watcher for your changes. In this dev window you can choose an existing Svelte project to work against. If you don't use pure Javascript and CSS, but languages like Typescript or SCSS, your project will need a Svelte preprocessor setup. When you make changes to the extension or language server you can use the command "Reload Window" in the VSCode command palette to see your changes. When you make changes to svelte2tsx
, you first need to run pnpm build
within its folder.
You might think that as a language server, you'd need to handle a lot of back and forth between APIs, but actually it's mostly high-level JavaScript objects which are passed to the npm module vscode-languageserver.
This means it's easy to write tests for your changes:
1pnpm test
For tricker issues, you can run the tests with a debugger in VSCode by setting a breakpoint (or adding debugger
in the code) and launching the task: "Run tests with debugger".
Svelte is an MIT-licensed open source project with its ongoing development made possible entirely by the support of awesome volunteers. If you'd like to support their efforts, please consider:
Funds donated via Open Collective will be used for compensating expenses related to Svelte's development such as hosting costs. If sufficient donations are received, funds may also be used to support Svelte's development more directly.
svelte2tsx
No vulnerabilities found.
Reason
30 commit(s) and 18 issue activity found in the last 90 days -- score normalized to 10
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
packaging workflow detected
Details
Reason
6 existing vulnerabilities detected
Details
Reason
Found 6/30 approved changesets -- score normalized to 2
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Score
Last Scanned on 2024-11-18
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More