diff options
author | 2021-09-20 13:48:05 -0700 | |
---|---|---|
committer | 2021-09-20 13:48:05 -0700 | |
commit | 7e2539ed702f0667163b726a6bb12bbd5569979d (patch) | |
tree | 0daa2e883acb4e93a2df2bbb16eefb0dc7ce539f /src/options.zig | |
parent | 60b5fb95b19b2f96dcfd851663b40e1155c9cc0e (diff) | |
download | bun-jarred/ast.tar.gz bun-jarred/ast.tar.zst bun-jarred/ast.zip |
WIPjarred/ast
Diffstat (limited to '')
-rw-r--r-- | src/options.zig | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/src/options.zig b/src/options.zig index 02d44fa08..229defe1b 100644 --- a/src/options.zig +++ b/src/options.zig @@ -337,18 +337,26 @@ pub const Platform = enum { neutral, browser, bun, + bunMacro, node, + pub inline fn isBun(this: Platform) bool { + return switch (this) { + .bunMacro, .bun => true, + else => false, + }; + } + pub inline fn isClient(this: Platform) bool { return switch (this) { - .bun => false, + .bunMacro, .bun => false, else => true, }; } pub inline fn supportsBrowserField(this: Platform) bool { return switch (this) { - .neutral, .browser, .bun => true, + .bunMacro, .neutral, .browser, .bun => true, else => false, }; } @@ -359,7 +367,7 @@ pub const Platform = enum { pub inline fn processBrowserDefineValue(this: Platform) ?string { return switch (this) { .browser => browser_define_value_true, - .bun, .node => browser_define_value_false, + .bunMacro, .bun, .node => browser_define_value_false, else => null, }; } @@ -446,6 +454,7 @@ pub const Platform = enum { var listc = [_]string{ MAIN_FIELD_NAMES[0], MAIN_FIELD_NAMES[1], MAIN_FIELD_NAMES[2] }; array.set(Platform.browser, &listc); array.set(Platform.bun, &listc); + array.set(Platform.bunMacro, &listc); // Original comment: // The neutral platform is for people that don't want esbuild to try to |