sveltejs/svelte
Tooling
Active contributors: Rich Harris, Ben McCann, Simon H
Build
- Rollup — primary bundler for the published package. Config:
packages/svelte/rollup.config.js. Plugins in use:@rollup/plugin-commonjs,@rollup/plugin-node-resolve,@rollup/plugin-terser,@rollup/plugin-virtual. - esbuild — used by
dts-buddyand a few generation scripts. - dts-buddy — rolls up
.d.tsfiles intopackages/svelte/types/. Invoked bypnpm generate:types.
Test
- Vitest — configured in
vitest.config.jsandvitest-xhtml-environment.ts(a custom XHTML jsdom environment). - Playwright — Chromium only, used by
tests/runtime-browser/. CI installs it viapnpm playwright install chromium. - JSDOM 25 — default DOM impl for non-browser tests.
Lint and format
- ESLint — root config at
eslint.config.js. Pulls in@sveltejs/eslint-config,eslint-plugin-svelte,eslint-plugin-lube, andtypescript-eslint. - Prettier — config at
.prettierrc, ignore at.prettierignore.pnpm formatwrites;pnpm lintchecks.
Type-check
- TypeScript 5.5+. Two configs are used in the package:
packages/svelte/tsconfig.runtime.json— the runtime sources.packages/svelte/tsconfig.json— everything else, plus the test types undertests/types/.
- A separate CI job (
TSGoin.github/workflows/ci.yml) runstsgo(TypeScript native preview) for performance regression detection.
Code generation
| Script | Purpose |
|---|---|
packages/svelte/scripts/process-messages |
Compile error/warning markdown → JS modules. Watch mode used in pnpm dev. |
packages/svelte/scripts/generate-types.js |
Drives dts-buddy to roll up .d.ts. |
packages/svelte/scripts/generate-version.js |
Writes src/version.js from package.json during release. |
packages/svelte/scripts/check-treeshakeability.js |
Runs in prepublishOnly to verify the package tree-shakes cleanly. |
Releases
- changesets (
@changesets/cli) drives versioning. Contributors runnpx changesetto add entries; maintainers runpnpm changeset:versionto bump and regenerate. - changelog plugin —
@svitejs/changesets-changelog-github-compactproduces compact GitHub-linked entries. - The release workflow is
.github/workflows/release.yml.pkg.pr.new(.github/workflows/pkg.pr.new.yml) publishes ephemeral preview packages on every PR.
CI workflows (.github/workflows/)
| Workflow | What it does |
|---|---|
ci.yml |
Tests (matrix), TestNoAsync, TSGo, Lint, Benchmarks. Triggered on PR + main. |
autofix.yml |
Runs prettier --write on PRs and pushes the result back. |
pkg.pr.new.yml |
Publishes a preview build per PR via pkg.pr.new. |
release.yml |
Tags + publishes when changesets are merged to main. |
ecosystem-ci-trigger.yml |
Fires vitejs/vite-ecosystem-ci runs against major Svelte ecosystem repos. |
Knip
packages/svelte/knip.json configures knip for unused-export detection. Run with pnpm knip from packages/svelte/.
Benchmarks
The benchmarking harness is not Vitest — it's a hand-rolled Node script (benchmarking/run.js) that uses v8-natives (--allow-natives-syntax) for deterministic timings and NODE_ENV=production to mirror real-world deopts. The benchmarking/compare/ folder runs the benchmark twice — once on the current branch and once on a configurable reference — and prints a diff.
Built by Factory AutoWiki from public repository content. It is a generated preview for codebase exploration, not source-maintained documentation.