From d78ecc76c854310fd47da32071d22301b0782ec3 Mon Sep 17 00:00:00 2001 From: Dylan Conway <35280289+dylan-conway@users.noreply.github.com> Date: Thu, 20 Apr 2023 05:23:12 -0700 Subject: Symbol minification (#2695) * minify * Update renamer.zig * --minify-whitespace * Speed up minification a little * handle private names * 5% faster minification * use helper function * fix nested scope slots * `bun build --minify` gets another +8% faster * print semicolons afterwards * print semicolon after checking error * after all error checking * Delete code for generating legacy bundes * remove extra whitespace around if statements * print space before import identifier * Use `@constCast` * Make `S.Local#decls` use `BabyList(Decl)` * Add `fromSlice` helper to `BabyList` * Remove unnecessary optional chains * minify `undefined, true, false` * Another @constCast * Implement merge adjacent local var * Support --minify in `bun build --transform` * skip comments when counting character frequencies * Don't wrap commonjs with --transform on (unless targeting bun) * Support --minify in the runtime * Fix edgecase with import * as * don't infinite loop * --trnasform shouldn't mess with require * Only track comments when minifying --------- Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> --- src/bun.js/module_loader.zig | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/bun.js') diff --git a/src/bun.js/module_loader.zig b/src/bun.js/module_loader.zig index ee1f392c5..127bc85e3 100644 --- a/src/bun.js/module_loader.zig +++ b/src/bun.js/module_loader.zig @@ -1606,6 +1606,8 @@ pub const ModuleLoader = struct { opts.features.hot_module_reloading = false; opts.features.top_level_await = true; opts.features.react_fast_refresh = false; + opts.features.minify_identifiers = bundler.options.minify_identifiers; + opts.features.minify_syntax = bundler.options.minify_syntax; opts.filepath_hash_for_hmr = 0; opts.warn_about_unbundled_modules = false; opts.macro_context = &jsc_vm.bundler.macro_context.?; -- cgit v1.2.3