Metadata-Version: 2.4
Name: rbtr-lang-svelte
Version: 2026.9.0.dev3
Summary: rbtr — Svelte language plugin (and shared SFC machinery)
Keywords: code-search,code-index,tree-sitter,static-analysis,semantic-search,developer-tools,svelte
Author: Alejandro Giacometti
Author-email: Alejandro Giacometti <alejandro.giacometti@gmail.com>
License-Expression: MIT
License-File: LICENSE
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Software Development :: Libraries
Classifier: Topic :: Text Processing :: Indexing
Classifier: Typing :: Typed
Requires-Dist: rbtr==2026.9.0.dev3
Requires-Dist: tree-sitter-svelte
Requires-Python: >=3.13
Project-URL: Homepage, https://github.com/janrito/rbtr
Project-URL: Repository, https://github.com/janrito/rbtr
Project-URL: Documentation, https://github.com/janrito/rbtr/tree/main/packages/rbtr-lang-svelte#readme
Project-URL: Issues, https://github.com/janrito/rbtr/issues
Project-URL: Changelog, https://github.com/janrito/rbtr/releases
Description-Content-Type: text/markdown

# rbtr-lang-svelte

Svelte support for [rbtr]. Optional plugin — install with
`pip install rbtr[svelte]`. Also hosts the shared single-file-component
machinery that [rbtr-lang-vue] reuses.

[rbtr]: https://github.com/janrito/rbtr/tree/main/packages/rbtr#readme
[rbtr-lang-vue]: https://github.com/janrito/rbtr/tree/main/packages/rbtr-lang-vue#readme

## What it ingests

`.svelte` components. A component mixes several languages in one file, and
each part is indexed as itself:

- The **markup template** becomes one host **doc-section** chunk (named after
  the file), so component markup is searchable.
- A **comment** above the markup is its own chunk, so the note explaining
  what the component is for stays searchable.
- The `<script>` and `<style>` blocks are **delegated** to their embedded
  language by injection (see below) — not re-parsed here.

## Chunks produced

```svelte
<script lang="ts">
  import { store } from "./store";     // → import        (typescript)
  export let name = "world";           // → variable "name" (typescript)
</script>

<h1 class="greeting">Hello {name}</h1> <!-- → doc_section "Greeting" (svelte host) -->

<style lang="scss">
  .greeting { color: red; }            // → class ".greeting" (scss)
</style>
```

## Embedded / injected chunks

The `lang` attribute picks the dialect; a bare block uses the fallback:

- `<script lang="ts">` → **TypeScript**, bare `<script>` → **JavaScript**
- `<style lang="scss">` → **SCSS**, `lang="less"` → **Less**, bare `<style>`
  → **CSS**

These chunks carry their *embedded* language; the delegated extraction runs
only when the corresponding plugin (e.g. `rbtr-lang-javascript`,
`rbtr-lang-css`) is installed.

## Grammar & dependencies

Uses the `tree-sitter-svelte` grammar. Ships `chunk_sfc` and `injections.scm`,
which `rbtr-lang-vue` imports for `.vue` files (they share the SFC shape).
