aboutsummaryrefslogtreecommitdiff
path: root/src/router.zig
diff options
context:
space:
mode:
authorGravatar Jarred Sumner <jarred@jarredsumner.com> 2021-08-07 22:09:19 -0700
committerGravatar Jarred Sumner <jarred@jarredsumner.com> 2021-08-07 22:09:19 -0700
commitbdc3308271b9bcc05d6ad2661ee601309aa03461 (patch)
treeb83e8a92e9dc2d8a2c27a8a3a2804f4b93753a94 /src/router.zig
parentde35ad995eb76b281045d7f7a626c4e05afdc408 (diff)
downloadbun-bdc3308271b9bcc05d6ad2661ee601309aa03461.tar.gz
bun-bdc3308271b9bcc05d6ad2661ee601309aa03461.tar.zst
bun-bdc3308271b9bcc05d6ad2661ee601309aa03461.zip
getImportedStyles hook
Former-commit-id: 730eb465fb23bcfa23842f293712cfc2cf51d363
Diffstat (limited to 'src/router.zig')
-rw-r--r--src/router.zig13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/router.zig b/src/router.zig
index ffba58e5e..5ba7c3457 100644
--- a/src/router.zig
+++ b/src/router.zig
@@ -465,19 +465,21 @@ pub const RouteMap = struct {
redirect = false;
}
+ const routes_slice = this.routes.slice();
+
if (path.len == 0) {
if (this.index) |index| {
- const entry = Fs.FileSystem.DirEntry.EntryStore.instance.at(this.routes.items(.entry_index)[index]).?;
+ const entry = Fs.FileSystem.DirEntry.EntryStore.instance.at(routes_slice.items(.entry_index)[index]).?;
const parts = [_]string{ entry.dir, entry.base };
return Match{
.params = params,
- .name = "index",
- .path = this.routes.items(.path)[index],
- .file_path = Fs.FileSystem.instance.absBuf(&parts, file_path_buf),
- .basename = entry.base,
+ .name = routes_slice.items(.name)[index],
+ .path = routes_slice.items(.path)[index],
.pathname = url_path.pathname,
+ .basename = entry.base,
.hash = index_route_hash,
+ .file_path = Fs.FileSystem.instance.absBuf(&parts, file_path_buf),
.query_string = url_path.query_string,
};
}
@@ -486,7 +488,6 @@ pub const RouteMap = struct {
}
const full_hash = @truncate(u32, std.hash.Wyhash.hash(0, path));
- const routes_slice = this.routes.slice();
// Check for an exact match
// These means there are no params.