Open-Source Wikis

/

Svelte

/

How to contribute

/

Tooling

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-buddy and a few generation scripts.
  • dts-buddy — rolls up .d.ts files into packages/svelte/types/. Invoked by pnpm generate:types.

Test

  • Vitest — configured in vitest.config.js and vitest-xhtml-environment.ts (a custom XHTML jsdom environment).
  • Playwright — Chromium only, used by tests/runtime-browser/. CI installs it via pnpm 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, and typescript-eslint.
  • Prettier — config at .prettierrc, ignore at .prettierignore. pnpm format writes; pnpm lint checks.

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 under tests/types/.
  • A separate CI job (TSGo in .github/workflows/ci.yml) runs tsgo (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 run npx changeset to add entries; maintainers run pnpm changeset:version to bump and regenerate.
  • changelog plugin@svitejs/changesets-changelog-github-compact produces 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.

Tooling – Svelte wiki | Factory