sveld 0.37.8 → 0.37.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +21 -6
- package/cli.js +7 -0
- package/lib/browser.d.ts +2 -0
- package/lib/browser.js +149 -149
- package/lib/chunk-81w3m3mq.js +8 -0
- package/lib/chunk-f8nq2w4s.js +325 -0
- package/lib/chunk-fk1w3bnw.js +29 -0
- package/lib/chunk-fz6nj0w3.js +4 -0
- package/lib/chunk-r92p6t72.js +1 -0
- package/lib/{chunk-0s0w60zm.js → chunk-wd6xaaes.js} +9 -9
- package/lib/{chunk-dh2cbpn0.js → chunk-yp6p39jn.js} +2 -2
- package/lib/cli-entry.js +1 -1
- package/lib/index.d.ts +1348 -1
- package/lib/index.js +1 -1
- package/package.json +1 -1
- package/lib/chunk-1tbcz36r.js +0 -1
- package/lib/chunk-2vte7cyp.js +0 -356
- package/lib/chunk-p9hkwnfy.js +0 -1
- package/lib/chunk-sg7vsn8d.js +0 -6
package/README.md
CHANGED
|
@@ -366,7 +366,7 @@ A prop with no type annotation, no `@type` JSDoc, and no initializer has nothing
|
|
|
366
366
|
With `reportDiagnostics` or `strict`, the grouped summary looks like this:
|
|
367
367
|
|
|
368
368
|
```
|
|
369
|
-
sveld: 5
|
|
369
|
+
sveld: 5 diagnostics (1 error, 4 warnings).
|
|
370
370
|
|
|
371
371
|
Props without inferred types (1):
|
|
372
372
|
./icons/Add.svelte
|
|
@@ -382,8 +382,8 @@ Context values typed as `any` (1):
|
|
|
382
382
|
- @event "close" has no matching dispatch or callback prop. (./Modal.svelte:4:5) [sveld/event-no-source]
|
|
383
383
|
|
|
384
384
|
Component syntax sveld skipped (1):
|
|
385
|
-
./
|
|
386
|
-
-
|
|
385
|
+
./List.svelte
|
|
386
|
+
- Both the "generics" script attribute and @generics/@template JSDoc tags declare component generics; the script attribute takes precedence and the JSDoc declaration was ignored. (./List.svelte:1:1) [sveld/syntax-skipped]
|
|
387
387
|
```
|
|
388
388
|
|
|
389
389
|
When `checkExamples` is also enabled, `@example` failures appear as additional groups: TS/JS failures under `example-compile-error`, `svelte`/`html` failures under `example-syntax-error`.
|
|
@@ -468,7 +468,7 @@ await sveld({ json: true, strict: "errors" });
|
|
|
468
468
|
|
|
469
469
|
#### Ignoring diagnostics
|
|
470
470
|
|
|
471
|
-
Two ways to suppress a diagnostic without disabling `strict` for the whole run. Either way, the diagnostic still appears in `SveldResult.diagnostics` (with `ignored: true`) and is still counted in the text summary (`sveld: 2
|
|
471
|
+
Two ways to suppress a diagnostic without disabling `strict` for the whole run. Either way, the diagnostic still appears in `SveldResult.diagnostics` (with `ignored: true`) and is still counted in the text summary (`sveld: 2 diagnostics (0 errors, 2 warnings) (1 ignored).`), but never fails `--strict` / `--strict=errors`.
|
|
472
472
|
|
|
473
473
|
**Config matchers** (`diagnostics.ignore`, an array of `{ code?, component?, name? }`): every field you set on a matcher must match for it to apply; an omitted field matches anything. `component` is a glob (`*` within a path segment, `**` across segments):
|
|
474
474
|
|
|
@@ -601,7 +601,7 @@ npx sveld --json --markdown
|
|
|
601
601
|
|
|
602
602
|
If no entry point can be resolved (no `package.json#svelte` field and no `--entry`), the CLI exits `1` and prints the reason to `stderr`. If `src/index.js` happens to exist relative to your working directory, sveld falls back to it and prints a one-line note asking you to set `package.json#svelte` (or `--entry`) instead of relying on the fallback.
|
|
603
603
|
|
|
604
|
-
Flags are kebab-case: `--entry`, `--glob`, `--types`, `--json`, `--markdown`, `--custom-elements`, `--llms`, `--fail-fast`, `--dry-run`, `--cache`, `--resolve-types`, `--check-examples`, `--report-diagnostics`, `--strict`, `--check`, `--check-level`, `--types-format`, `--types-export`, `--types-comments`, `--types-inline`, `--types-index-types`, `--types-props-declaration`, `--quiet`, `--stdout`, `--format`. The camelCase spellings `--resolveTypes` and `--checkExamples` still work as deprecated aliases for compatibility with existing scripts. `--entry`, `--cache`, `--check`, `--types-format`, `--types-export`, `--types-comments`, `--types-inline`, and `--types-props-declaration` take their value either as `--flag=value` or as a separate `--flag value` argument (`sveld --entry src/index.js` and `sveld --entry=src/index.js` are equivalent); if the next argument starts with `--` it's not consumed as a value, so `--cache` and `--check` fall back to their default location and the rest of that list report a usage error naming the flag. Boolean flags (`--json`, `--glob`, `--strict`, `--types-index-types`, and the like) never consume a following argument. An unrecognized flag (e.g. `--markdwon`) prints `
|
|
604
|
+
Flags are kebab-case: `--entry`, `--glob`, `--types`, `--json`, `--markdown`, `--custom-elements`, `--llms`, `--fail-fast`, `--dry-run`, `--cache`, `--resolve-types`, `--check-examples`, `--report-diagnostics`, `--strict`, `--check`, `--check-level`, `--types-format`, `--types-export`, `--types-comments`, `--types-inline`, `--types-index-types`, `--types-props-declaration`, `--quiet`, `--stdout`, `--format`. The camelCase spellings `--resolveTypes` and `--checkExamples` still work as deprecated aliases for compatibility with existing scripts. `--entry`, `--cache`, `--check`, `--types-format`, `--types-export`, `--types-comments`, `--types-inline`, and `--types-props-declaration` take their value either as `--flag=value` or as a separate `--flag value` argument (`sveld --entry src/index.js` and `sveld --entry=src/index.js` are equivalent); if the next argument starts with `--` it's not consumed as a value, so `--cache` and `--check` fall back to their default location and the rest of that list report a usage error naming the flag. Boolean flags (`--json`, `--glob`, `--strict`, `--types-index-types`, and the like) never consume a following argument. An unrecognized flag (e.g. `--markdwon`) prints `sveld: unknown flag "--markdwon".` to `stderr`, exits `1`, and skips generation; when a close match exists it appends a suggestion, e.g. `Did you mean "--markdown"?`. sveld takes no positional arguments, so any non-flag argument errors the same way.
|
|
605
605
|
|
|
606
606
|
Writer progress lines (`created "..."` / `unchanged "..."`) print to `stderr`, keeping `stdout` reserved for machine-readable data. Pass `--quiet` (or `quiet: true` in `sveld.config.*`) to suppress them; it does not suppress error messages, the diagnostics summary (`--report-diagnostics` / `--strict`), or the `--check` report.
|
|
607
607
|
|
|
@@ -965,7 +965,7 @@ The `svelte` condition lets bundlers that understand it (Vite, Rollup, webpack v
|
|
|
965
965
|
- **`linkBase`** (string, optional, default: `""`): Prefixed to each component's link in `llms.txt`.
|
|
966
966
|
- **`title`** (string, optional, default: the `"name"` field from `package.json`): The `# <title>` heading both files start with.
|
|
967
967
|
- **`summary`** (string, optional, default: the `"description"` field from `package.json`): The `> <summary>` blockquote under the title.
|
|
968
|
-
- **`config`** (boolean | string, optional, default: `false`): Load `sveld.config.{js,mjs,ts}` and merge it with these options; these options win when a key is set in both. `true` resolves the config from the Vite project root (or `process.cwd()` outside Vite); a string is an explicit path to the config file. See [Config File](#config-file).
|
|
968
|
+
- **`config`** (boolean | string, optional, default: `false`): Load `sveld.config.{js,mjs,ts}` and merge it with these options; these options win when a key is set in both. `true` resolves the config from the Vite project root (or `process.cwd()` outside Vite); a string is an explicit path to the config file. The plugin warns about keys only the CLI and `sveld()` act on (`reportDiagnostics`, `strict`, `check`, `checkLevel`, `stdout`, `format`, `dryRun`). See [Config File](#config-file).
|
|
969
969
|
- **`watch`** (boolean, optional, default: `false`): Regenerate output incrementally when relevant source changes during `vite dev` / `vite build --watch`. A reparse is triggered by: editing a component; editing the entry barrel itself, which adds/removes the corresponding component; or editing a non-`.svelte` file a component depends on via [`@extendProps`](#extendprops) / `@extends` or a typedef `import("./x")` reference. Only the affected components are re-parsed, rather than rebuilding every component. Overlapping regenerations are queued, never run concurrently. Without this option, the plugin only runs during `vite build`.
|
|
970
970
|
- **`failFast`** (boolean, optional, default: `false`): Abort the entire run when a single component fails to parse. By default, parse failures are collected as diagnostics (and reported to `stderr`) so the remaining components still emit their output. Also available as the `--fail-fast` CLI flag.
|
|
971
971
|
- **`resolveTypes`** (boolean, optional, default: `false`): Load the TypeScript program to expand opaque imported whole-object `$props()` types into JSON. Also available as `--resolve-types` (`--resolveTypes` remains as a deprecated alias). See [Opt-in semantic resolution](#opt-in-semantic-resolution-resolvetypes).
|
|
@@ -2025,6 +2025,21 @@ For `lang="ts"` components, prefer native TypeScript annotations when you alread
|
|
|
2025
2025
|
|
|
2026
2026
|
For runes components with multiple destructured props, put JSDoc on the property you want to document. A declaration-level block is a fallback when the destructure exposes a single public prop.
|
|
2027
2027
|
|
|
2028
|
+
A declaration-level `@type` naming an object `@typedef` (or an inline `{ ... }` type) types the whole `$props()` object instead, the form Svelte's docs recommend for JavaScript components. Each prop takes its type, optionality, and description from the matching member:
|
|
2029
|
+
|
|
2030
|
+
```svelte
|
|
2031
|
+
<script>
|
|
2032
|
+
/**
|
|
2033
|
+
* @typedef {object} Props
|
|
2034
|
+
* @property {string} title Card title
|
|
2035
|
+
* @property {boolean} [elevated=false] Raise the card
|
|
2036
|
+
*/
|
|
2037
|
+
|
|
2038
|
+
/** @type {Props} */
|
|
2039
|
+
let { title, elevated = false } = $props();
|
|
2040
|
+
</script>
|
|
2041
|
+
```
|
|
2042
|
+
|
|
2028
2043
|
<details>
|
|
2029
2044
|
<summary>Svelte 3/4 (legacy) syntax</summary>
|
|
2030
2045
|
|
package/cli.js
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
+
// biome-ignore lint/performance/noNamespaceImport: a named import of enableCompileCache fails to link on Node < 22.1.
|
|
4
|
+
import * as nodeModule from "node:module";
|
|
5
|
+
|
|
6
|
+
// Caches V8's compiled bytecode for sveld's own modules across runs (Node
|
|
7
|
+
// 22.1+; a no-op on older Node and Bun), so startup skips recompiling them.
|
|
8
|
+
nodeModule.enableCompileCache?.();
|
|
9
|
+
|
|
3
10
|
import("./lib/cli-entry.js")
|
|
4
11
|
.then(({ cli }) => cli(process))
|
|
5
12
|
.catch((error) => {
|