diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/bun.js/javascript.zig | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/bun.js/javascript.zig b/src/bun.js/javascript.zig index f87c58e83..6300ae32a 100644 --- a/src/bun.js/javascript.zig +++ b/src/bun.js/javascript.zig @@ -1225,7 +1225,8 @@ pub const VirtualMachine = struct { source else jsc_vm.bundler.fs.top_level_dir, - specifier, + // TODO: do we need to handle things like query string params? + if (strings.hasPrefixComptime(specifier, "file://")) specifier["file://".len..] else specifier, .stmt, ); @@ -1347,12 +1348,10 @@ pub const VirtualMachine = struct { var slice = slice_; if (slice.len == 0) return slice; var was_http = false; - if (strings.hasPrefix(slice, "https://")) { + if (strings.hasPrefixComptime(slice, "https://")) { slice = slice["https://".len..]; was_http = true; - } - - if (strings.hasPrefix(slice, "http://")) { + } else if (strings.hasPrefixComptime(slice, "http://")) { slice = slice["http://".len..]; was_http = true; } @@ -2781,12 +2780,17 @@ pub const HardcodedModule = enum { .{ "node:fs/promises", "node:fs/promises" }, .{ "node:module", "node:module" }, .{ "node:path", "node:path" }, + .{ "node:path/posix", "node:path" }, + .{ "node:path/win32", "node:path" }, + .{ "node:perf_hooks", "node:perf_hooks" }, .{ "node:streams/consumer", "node:streams/consumer" }, .{ "node:streams/web", "node:streams/web" }, .{ "node:timers", "node:timers" }, .{ "node:timers/promises", "node:timers/promises" }, .{ "node:url", "node:url" }, .{ "path", "node:path" }, + .{ "path/posix", "node:path" }, + .{ "path/win32", "node:path" }, .{ "perf_hooks", "node:perf_hooks" }, .{ "streams/consumer", "node:streams/consumer" }, .{ "streams/web", "node:streams/web" }, |