--no-macros flag, disable macros in node_modules

This commit is contained in:
Jarred Sumner
2023-05-31 15:05:38 -07:00
parent 68c1568075
commit 7057cb1982
13 changed files with 91 additions and 11 deletions

View File

@@ -157,6 +157,7 @@ pub const Arguments = struct {
clap.parseParam("--minify-syntax Minify syntax and inline data (experimental)") catch unreachable,
clap.parseParam("--minify-whitespace Minify whitespace (experimental)") catch unreachable,
clap.parseParam("--minify-identifiers Minify identifiers") catch unreachable,
clap.parseParam("--no-macros Disable macros from being executed in the bundler, transpiler and runtime") catch unreachable,
clap.parseParam("--target <STR> The intended execution environment for the bundle. \"browser\", \"bun\" or \"node\"") catch unreachable,
clap.parseParam("<POS>... ") catch unreachable,
};
@@ -744,6 +745,10 @@ pub const Arguments = struct {
ctx.log.level = logger.Log.default_log_level;
}
if (args.flag("--no-macros")) {
ctx.debug.macros = .{ .disable = {} };
}
opts.output_dir = output_dir;
if (output_file != null)
ctx.debug.output_file = output_file.?;
@@ -898,7 +903,7 @@ pub const Command = struct {
loaded_bunfig: bool = false,
// technical debt
macros: ?MacroMap = null,
macros: MacroOptions = MacroOptions.unspecified,
editor: string = "",
package_bundle_map: bun.StringArrayHashMapUnmanaged(options.BundlePackage) = bun.StringArrayHashMapUnmanaged(options.BundlePackage){},
@@ -906,6 +911,8 @@ pub const Command = struct {
output_file: []const u8 = "",
};
pub const MacroOptions = union(enum) { unspecified: void, disable: void, map: MacroMap };
pub const HotReload = enum {
none,
hot,