Support query string parameters in module resolution

This commit is contained in:
Jarred Sumner
2023-01-21 23:11:31 -08:00
parent a2cfdf0e1c
commit 99d2d6e607
11 changed files with 181 additions and 60 deletions

View File

@@ -553,6 +553,11 @@ pub fn withoutTrailingSlash(this: string) []const u8 {
return href;
}
pub fn withTrailingSlash(dir: string, in: string) []const u8 {
std.debug.assert(bun.isSliceInBuffer(dir, in));
return in[0..@min(strings.withoutTrailingSlash(in[0..@min(dir.len + 1, in.len)]).len + 1, in.len)];
}
pub fn withoutLeadingSlash(this: string) []const u8 {
return std.mem.trimLeft(u8, this, "/");
}