aboutsummaryrefslogtreecommitdiff
path: root/src/bun.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/bun.js')
-rw-r--r--src/bun.js/bindings/bindings.zig2
-rw-r--r--src/bun.js/javascript.zig4
-rw-r--r--src/bun.js/module_loader.zig6
3 files changed, 5 insertions, 7 deletions
diff --git a/src/bun.js/bindings/bindings.zig b/src/bun.js/bindings/bindings.zig
index 1afb5a588..41a52956d 100644
--- a/src/bun.js/bindings/bindings.zig
+++ b/src/bun.js/bindings/bindings.zig
@@ -1506,7 +1506,7 @@ pub const JSPromise = extern struct {
) JSValue {
if (value.isEmpty()) {
return resolvedPromiseValue(globalObject, JSValue.jsUndefined());
- } else if (value.isEmptyOrUndefinedOrNull() or !value.isCell()) {
+ } else if (value.isUndefinedOrNull() or !value.isCell()) {
return resolvedPromiseValue(globalObject, value);
}
diff --git a/src/bun.js/javascript.zig b/src/bun.js/javascript.zig
index 9ba56fffa..fd2ded108 100644
--- a/src/bun.js/javascript.zig
+++ b/src/bun.js/javascript.zig
@@ -910,11 +910,11 @@ pub const VirtualMachine = struct {
ret.result = null;
ret.path = jsc_vm.entry_point.source.path.text;
return;
- } 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)) {
ret.result = null;
ret.path = specifier;
return;
- } else if (specifier.len > "/bun-vfs/node_modules/".len and strings.eqlComptimeIgnoreLen(specifier[0.."/bun-vfs/node_modules/".len], "/bun-vfs/node_modules/")) {
+ } else if (strings.hasPrefixComptime(specifier, "/bun-vfs/node_modules/")) {
ret.result = null;
ret.path = specifier;
return;
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,