aboutsummaryrefslogtreecommitdiff
path: root/src/bun.js/module_loader.zig
diff options
context:
space:
mode:
authorGravatar Alex Lam S.L <alexlamsl@gmail.com> 2023-01-10 15:35:20 +0200
committerGravatar GitHub <noreply@github.com> 2023-01-10 05:35:20 -0800
commit270b07e85e82b46491cc713fb2a5bb973d3de4f6 (patch)
treeb8071eaf835f2aefb8ee95c68f9002d84b7b5761 /src/bun.js/module_loader.zig
parentb458abedbb865461005757cac5ea2b458249ef25 (diff)
downloadbun-270b07e85e82b46491cc713fb2a5bb973d3de4f6.tar.gz
bun-270b07e85e82b46491cc713fb2a5bb973d3de4f6.tar.zst
bun-270b07e85e82b46491cc713fb2a5bb973d3de4f6.zip
use `strings.hasPrefixComptime()` (#1755)
Diffstat (limited to 'src/bun.js/module_loader.zig')
-rw-r--r--src/bun.js/module_loader.zig6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/bun.js/module_loader.zig b/src/bun.js/module_loader.zig
index 46b7d0c09..c4dea6fc4 100644
--- a/src/bun.js/module_loader.zig
+++ b/src/bun.js/module_loader.zig
@@ -940,7 +940,7 @@ pub const ModuleLoader = struct {
}
// this should be a cheap lookup because 24 bytes == 8 * 3 so it's read 3 machine words
- const is_node_override = specifier.len > "/bun-vfs/node_modules/".len and strings.eqlComptimeIgnoreLen(specifier[0.."/bun-vfs/node_modules/".len], "/bun-vfs/node_modules/");
+ const is_node_override = strings.hasPrefixComptime(specifier, "/bun-vfs/node_modules/");
const macro_remappings = if (jsc_vm.macro_mode or !jsc_vm.has_any_macro_remappings or is_node_override)
MacroRemap{}
@@ -1910,9 +1910,7 @@ pub const ModuleLoader = struct {
};
},
}
- } else if (specifier.len > js_ast.Macro.namespaceWithColon.len and
- strings.eqlComptimeIgnoreLen(specifier[0..js_ast.Macro.namespaceWithColon.len], js_ast.Macro.namespaceWithColon))
- {
+ } else if (strings.hasPrefixComptime(specifier, js_ast.Macro.namespaceWithColon)) {
if (jsc_vm.macro_entry_points.get(MacroEntryPoint.generateIDFromSpecifier(specifier))) |entry| {
return ResolvedSource{
.allocator = null,