Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sync: account for relative route path #7223

Merged
merged 5 commits into from
Oct 12, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/moody-jeans-obey.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@sveltejs/kit': patch
---

Account for relative path to routes in `config.kit.files.routes`
4 changes: 2 additions & 2 deletions packages/kit/src/core/sync/write_types/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export async function write_all_types(config, manifest_data) {
const types_dir = `${config.kit.outDir}/types`;

// empty out files that no longer need to exist
const routes_dir = path.relative('.', config.kit.files.routes);
const routes_dir = posixify(path.relative('.', config.kit.files.routes)).replace(/\.\.\//g, '');
const expected_directories = new Set(
manifest_data.routes.map((route) => path.join(routes_dir, route.id))
);
Expand Down Expand Up @@ -179,7 +179,7 @@ function create_routes_map(manifest_data) {
* @param {Set<string>} [to_delete]
*/
function update_types(config, routes, route, to_delete = new Set()) {
const routes_dir = posixify(path.relative('.', config.kit.files.routes));
const routes_dir = posixify(path.relative('.', config.kit.files.routes)).replace(/\.\.\//g, '');
const outdir = path.join(config.kit.outDir, 'types', routes_dir, route.id);

// now generate new types
Expand Down