aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/runtime.zig2
-rw-r--r--src/string_immutable.zig5
2 files changed, 6 insertions, 1 deletions
diff --git a/src/runtime.zig b/src/runtime.zig
index 7312aa4bd..6916df6b1 100644
--- a/src/runtime.zig
+++ b/src/runtime.zig
@@ -329,7 +329,7 @@ pub const Runtime = struct {
commonjs_at_runtime: bool = false,
pub fn shouldUnwrapRequire(this: *const Features, package_name: string) bool {
- return package_name.len > 0 and strings.indexAny(this.unwrap_commonjs_packages, package_name) != null;
+ return package_name.len > 0 and strings.indexEqualAny(this.unwrap_commonjs_packages, package_name) != null;
}
pub const ReplaceableExport = union(enum) {
diff --git a/src/string_immutable.zig b/src/string_immutable.zig
index 25d4fb01a..3d1724d4e 100644
--- a/src/string_immutable.zig
+++ b/src/string_immutable.zig
@@ -127,6 +127,11 @@ pub inline fn indexAnyComptime(target: string, comptime chars: string) ?usize {
return null;
}
+pub inline fn indexEqualAny(in: anytype, target: string) ?usize {
+ for (in, 0..) |str, i| if (eqlLong(str, target, true)) return i;
+ return null;
+}
+
pub fn repeatingAlloc(allocator: std.mem.Allocator, count: usize, char: u8) ![]u8 {
var buf = try allocator.alloc(u8, count);
repeatingBuf(buf, char);