#javascript #typescript #parser #linter #minifier

oxc_minifier

A collection of JavaScript tools written in Rust

11 releases (7 breaking)

0.7.0 Feb 9, 2024
0.5.0 Jan 12, 2024
0.4.0 Dec 8, 2023
0.3.0 Nov 6, 2023
0.1.0 Jul 27, 2023

#409 in Development tools

Download history 43/week @ 2023-11-01 20/week @ 2023-11-08 14/week @ 2023-11-15 23/week @ 2023-11-22 27/week @ 2023-11-29 42/week @ 2023-12-06 20/week @ 2023-12-13 16/week @ 2023-12-20 22/week @ 2023-12-27 6/week @ 2024-01-03 47/week @ 2024-01-10 12/week @ 2024-01-17 13/week @ 2024-01-24 45/week @ 2024-01-31 45/week @ 2024-02-07 145/week @ 2024-02-14

250 downloads per month
Used in oxc

MIT license

1MB
18K SLoC

Minifier

A JavaScript minifier has three components:

  1. printer
  2. mangler
  3. compressor

Mangler

The mangler implementation is part of the SymbolTable residing in oxc_semantic. It is responsible for shortening variables. Its algorithm should be gzip friendly.

The printer is also responsible for printing out the shortened variable names.

Compressor

The compressor is responsible for rewriting statements and expressions for minimal text output. Terser is a good place to start for learning the fundamentals.

Terser Tests

The fixtures are copied from https://github.com/terser/terser/tree/master/test/compress


lib.rs:

ECMAScript Minifier

Dependencies

~5–15MB
~161K SLoC