diff options
author | 2021-06-06 21:16:43 -0700 | |
---|---|---|
committer | 2021-06-06 21:16:43 -0700 | |
commit | 079fe523d4c397c5e4d877cc2faf8d29139e0a07 (patch) | |
tree | 58bea423b5ccde9bb4e6e7aa703e583f2191bd99 /src/options.zig | |
parent | 13653a93a2a4181fcea35576338fe24f465fc748 (diff) | |
download | bun-079fe523d4c397c5e4d877cc2faf8d29139e0a07.tar.gz bun-079fe523d4c397c5e4d877cc2faf8d29139e0a07.tar.zst bun-079fe523d4c397c5e4d877cc2faf8d29139e0a07.zip |
Upgrade hash table
Former-commit-id: 5d208f9ea0be4e5f2a682f25b0a20a623ce61091
Diffstat (limited to 'src/options.zig')
-rw-r--r-- | src/options.zig | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/src/options.zig b/src/options.zig index fd44c9d0a..954e01dfa 100644 --- a/src/options.zig +++ b/src/options.zig @@ -74,7 +74,7 @@ pub const ExternalModules = struct { // TODO: fix this stupid copy result.node_modules.hash_map.ensureCapacity(NodeBuiltinPatterns.len) catch unreachable; for (NodeBuiltinPatterns) |pattern| { - result.node_modules.put(pattern) catch unreachable; + result.node_modules.insert(pattern) catch unreachable; } } @@ -97,12 +97,12 @@ pub const ExternalModules = struct { .suffix = external[i + 1 .. external.len], }) catch unreachable; } else if (resolver.Resolver.isPackagePath(external)) { - result.node_modules.put(external) catch unreachable; + result.node_modules.insert(external) catch unreachable; } else { const normalized = validatePath(log, fs, cwd, external, allocator, "external path"); if (normalized.len > 0) { - result.abs_paths.put(normalized) catch unreachable; + result.abs_paths.insert(normalized) catch unreachable; } } } @@ -470,6 +470,14 @@ pub const Timings = struct { read_file: i128 = 0, }; +pub const DefaultUserDefines = struct { + // This must be globally scoped so it doesn't disappear + pub const NodeEnv = struct { + pub const Key = "process.env.NODE_ENV"; + pub const Value = "\"development\""; + }; +}; + pub const BundleOptions = struct { footer: string = "", banner: string = "", @@ -548,7 +556,7 @@ pub const BundleOptions = struct { var user_defines = try stringHashMapFromArrays(defines.RawDefines, allocator, transform.define_keys, transform.define_values); if (transform.define_keys.len == 0) { - try user_defines.put("process.env.NODE_ENV", "\"development\""); + try user_defines.put(DefaultUserDefines.NodeEnv.Key, DefaultUserDefines.NodeEnv.Value); } var resolved_defines = try defines.DefineData.from_input(user_defines, log, allocator); |