aboutsummaryrefslogtreecommitdiff
path: root/src/bun.js/api/transpiler.zig
diff options
context:
space:
mode:
authorGravatar Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> 2022-12-11 23:28:53 -0800
committerGravatar Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> 2022-12-11 23:28:53 -0800
commit007133d060bc3bba1c390b26fb9e5993c1a1b116 (patch)
tree3fb8692fc8d241a49f9d5fed00ef30dc9ec01132 /src/bun.js/api/transpiler.zig
parent6279358cbccc0016a461dd4e665c37e5613370f0 (diff)
downloadbun-007133d060bc3bba1c390b26fb9e5993c1a1b116.tar.gz
bun-007133d060bc3bba1c390b26fb9e5993c1a1b116.tar.zst
bun-007133d060bc3bba1c390b26fb9e5993c1a1b116.zip
[Transpiler] Implement `minifyWhitespace` option
Diffstat (limited to 'src/bun.js/api/transpiler.zig')
-rw-r--r--src/bun.js/api/transpiler.zig8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/bun.js/api/transpiler.zig b/src/bun.js/api/transpiler.zig
index 341a0d9db..24104c2b7 100644
--- a/src/bun.js/api/transpiler.zig
+++ b/src/bun.js/api/transpiler.zig
@@ -104,6 +104,9 @@ const TranspilerOptions = struct {
tree_shaking: bool = false,
trim_unused_imports: ?bool = null,
inlining: bool = false,
+
+ minify_whitespace: bool = false,
+ minify_identifiers: bool = false,
};
// Mimalloc gets unstable if we try to move this to a different thread
@@ -560,6 +563,10 @@ fn transformOptionsFromJSC(ctx: JSC.C.JSContextRef, temp_allocator: std.mem.Allo
transpiler.runtime.inlining = flag.toBoolean();
}
+ if (object.get(globalThis, "minifyWhitespace")) |flag| {
+ transpiler.minify_whitespace = flag.toBoolean();
+ }
+
if (object.get(globalThis, "sourcemap")) |flag| {
if (flag.isBoolean() or flag.isUndefinedOrNull()) {
if (flag.toBoolean()) {
@@ -785,6 +792,7 @@ pub fn constructor(
bundler.options.macro_remap = transpiler_options.macro_map;
}
+ bundler.options.minify_whitespace = transpiler_options.minify_whitespace;
bundler.options.tree_shaking = transpiler_options.tree_shaking;
bundler.options.trim_unused_imports = transpiler_options.trim_unused_imports;
bundler.options.allow_runtime = transpiler_options.runtime.allow_runtime;