v0.36.1
Features
- cache generated
.d.tstext across runs (84a57ac) - stop rescanning the output buffer while formatting
.d.ts(c5c4d86)
Fixes
- resolve the Svelte version through
svelte/package.jsoninstead of an internal module path (af84645, #394)
Performance
0.36.1 is a patch that moves the remaining cost out of the write phase.
The parse cache already made warm parses nearly free, but every run still regenerated all .d.ts text from scratch even when no source file changed — roughly 48% of a warm-cache rebuild on the carbon fixture. writeTsDefinition is a pure function of one component's document entry plus the --types-format option, since cross-component @extends / @extendProps resolution happens at parse time and is embedded in the cached component. The generated text now rides on the same per-run parse-cache entry, so existing invalidation covers it: an invalidated path's entry is recreated after reparse and never carries stale text.
The .d.ts formatter was also quadratic in per-file output size. expandStatements trimmed trailing whitespace after every } and ; with an end-anchored String.prototype.replace, which still walks the buffer looking for a match start — 3,670 calls over 3.12M characters to produce 184KB of output on the carbon fixture. It now accumulates into an array with a bounded pop-trailing-whitespace loop and reconstructs only the last ~200 characters when checking for an interface header, about 2.9x faster on the formatter alone and widening on larger inputs.
Both changes were verified byte-identical across the full carbon fixture, cold versus warm cache.
Svelte version resolution
Version detection previously read ../node_modules/svelte/src/version.js — an internal, unpublished path hardcoded relative to src/, which assumed node_modules is a direct sibling and broke under non-hoisted layouts such as Yarn PnP. The version now comes from svelte/package.json via the bare specifier, resolving through Svelte's own exports map. sveld inlines this at its own build time, so consumers still don't need Svelte installed at runtime.