Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

sync: prune metadata entries for removed routes

Open Beginner friendly
#17,451 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
85/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
javascript
Domain
tooling

Research direction

The change belongs in write_all_types in packages/kit/src/core/sync/write_types/index.js, which reads the existing route_meta_data.json, updates entries for current routes, and writes it back without removing entries for deleted routes. Start by reading that function, then add the pruning step so only route IDs in the current manifest are kept. Run the new test in packages/kit/src/core/sync/write_types/index.spec.js inside the 'Cleans up unused files' block; it passes when /about is removed and / keeps its original metadata.

Written by the indexing model from the issue text.

Description

types / typescript
Describe the problem

After a route is removed and write_all_types runs with a fresh manifest, its generated type files are deleted, but its entry remains in .svelte-kit/types/route_meta_data.json. Repeated route churn can leave obsolete cache entries behind in the file.

Describe the proposed solution

Prune metadata entries whose route IDs are no longer present in the current manifest, preserving metadata for current routes.

Alternatives considered

Keep the current behavior. Retained entries have not been shown to break type generation.

Importance

Nice to have.

Failing test

Add this test inside describe('Cleans up unused files', ...) in packages/kit/src/core/sync/write_types/index.spec.js.

test('prunes metadata entries for removed routes', () => {
	const types_dir = sync();
	const meta_data_file = path.join(types_dir, 'route_meta_data.json');
	const original_metadata = JSON.parse(fs.readFileSync(meta_data_file, 'utf-8'));
	assert.deepEqual(original_metadata['/about'], []);

	fs.rmSync(path.join(root, 'src/routes/about'), { recursive: true });
	sync();

	const metadata = JSON.parse(fs.readFileSync(meta_data_file, 'utf-8'));
	assert.ok(!Object.hasOwn(metadata, '/about'));
	assert.deepEqual(metadata['/'], original_metadata['/']);
});

Relevant implementation: write_all_types reads the existing metadata, updates generated routes, and writes it back without pruning removed-route entries.

Dominant language
JavaScript
Stars
20.9k
Forks
2.4k
Avg merge
1d 20h
Merged PRs (30d)
83

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from sveltejs/kit

All issues in sveltejs/kit

Similar issues

More JavaScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.