diff options
| author | 2021-08-11 00:02:08 -0700 | |
|---|---|---|
| committer | 2021-08-11 00:02:08 -0700 | |
| commit | ca90126cc43e688cfbe8636f6b373c4bb3af602c (patch) | |
| tree | b0bf9f39bc9f7c52396e2618fd88a56f885a6a8c /src/router.zig | |
| parent | 10b4b872a2824b6d7c66030dafc831f0da3309e8 (diff) | |
| download | bun-ca90126cc43e688cfbe8636f6b373c4bb3af602c.tar.gz bun-ca90126cc43e688cfbe8636f6b373c4bb3af602c.tar.zst bun-ca90126cc43e688cfbe8636f6b373c4bb3af602c.zip | |
client-side entry point works and also generates a correct url on the server
Former-commit-id: 272e52f55e44e998b9238e4173de37bfc6a05a94
Diffstat (limited to '')
| -rw-r--r-- | src/router.zig | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/router.zig b/src/router.zig index 17e265bd5..884741d3d 100644 --- a/src/router.zig +++ b/src/router.zig @@ -281,6 +281,10 @@ pub const RouteMap = struct { allocator: *std.mem.Allocator, config: Options.RouteConfig, + // This is passed here and propagated through Match + // We put this here to avoid loading the FrameworkConfig for the client, on the server. + client_framework_enabled: bool = false, + pub threadlocal var segments_buf: [128]string = undefined; pub threadlocal var segments_hash: [128]u32 = undefined; @@ -482,6 +486,7 @@ pub const RouteMap = struct { .hash = index_route_hash, .file_path = Fs.FileSystem.instance.absBuf(&parts, file_path_buf), .query_string = url_path.query_string, + .client_framework_enabled = this.client_framework_enabled, }; } @@ -512,6 +517,7 @@ pub const RouteMap = struct { .hash = child_hash, .file_path = Fs.FileSystem.instance.absBuf(&parts, file_path_buf), .query_string = url_path.query_string, + .client_framework_enabled = this.client_framework_enabled, }; } } @@ -530,6 +536,7 @@ pub const RouteMap = struct { .pathname = url_path.pathname, .query_string = url_path.query_string, .file_path = Fs.FileSystem.instance.absBuf(&parts, file_path_buf), + .client_framework_enabled = this.client_framework_enabled, }; } } @@ -575,7 +582,7 @@ pub const RouteMap = struct { dynamic_route.name = dynamic_route.name[0 .. dynamic_route.name.len - std.fs.path.extension(dynamic_route.file_path).len]; std.debug.assert(dynamic_route.name.len > 0); if (dynamic_route.name[0] == '/') dynamic_route.name = dynamic_route.name[1..]; - + dynamic_route.client_framework_enabled = this.client_framework_enabled; return dynamic_route; } @@ -702,6 +709,8 @@ pub const Match = struct { /// route name, like `"posts/[id]"` name: string, + client_framework_enabled: bool = false, + /// basename of the route in the file system, including file extension basename: string, |
