Ecosyste.ms: OpenCollective

An open API service for software projects hosted on Open Collective.

github.com/terser/terser

🗜 JavaScript parser, mangler and compressor toolkit for ES6+
https://github.com/terser/terser

better support for multiple input files:

- use a single AST_Toplevel node for all files
- keep original source filename in the tokens

5491e1d7b11e363c79bdd352883e92fa3b711e69 authored over 12 years ago by Mihai Bazon <[email protected]>
more on detecting side effects

c4f8c2103fd77e3a6666034c2ca19a5ef09fe68b authored over 12 years ago by Mihai Bazon <[email protected]>
drop unused variables

e8da72d304778cdaf4570f24838effee73f6b993 authored over 12 years ago by Mihai Bazon <[email protected]>
support -c with no arguments to disable compression entirely

d53e1a9931d29c875d2bb23e50a2d2f535b01890 authored over 12 years ago by Mihai Bazon <[email protected]>
fixed label scope/mangling

a4d2340c7325ff864d2ca3937d8556eb4cbd7437 authored over 12 years ago by Mihai Bazon <[email protected]>
minor

669874d46b42a6241f271c57d8f731ba0a2ca61a authored over 12 years ago by Mihai Bazon <[email protected]>
support for directives

3da0ac4897e1b12adbdedbfa1c3a145931f0af56 authored over 12 years ago by Mihai Bazon <[email protected]>
added AST_NaN (output as 0/0)

21968285e8fad1cfe775b389c6bcd16e14b62c6c authored over 12 years ago by Mihai Bazon <[email protected]>
only do the typeof x == "undefined" optimization if x is a symbol reference and it's declared in scope, or x is not a symbol reference.

d91613b4a8318b7fdd0d18cf6550e6670c59f71e authored over 12 years ago by Mihai Bazon <[email protected]>
moved `typeof foo == "undefined"` ==> `foo === undefined` under `--unsafe`

because https://github.com/mishoo/UglifyJS2/commit/43fd45154bac89b89330e13bd1f167e2a927a23c#comm...

ee669ba8784a37805cd699cc0ca38e335982eb59 authored over 12 years ago by Mihai Bazon <[email protected]>
fix .undeclared (it's now a function)

e370e3b5a4fcde13402f910a34b736847fe49a9e authored over 12 years ago by Mihai Bazon <[email protected]>
minor

6ad414ef28e64ff7c53ee89e737f4e9d7cd2f009 authored over 12 years ago by Mihai Bazon <[email protected]>
one more test for sequences

45a3970ca35e0c640a761601d0854a4c7c5a5cf0 authored over 12 years ago by Mihai Bazon <[email protected]>
possible optimization for AST_Undefined

if undefined is defined, ;-), we replace AST_Undefined nodes to a reference
to the "undefined" v...

92e22c460d689008055f4f3f9b850989e4359f4d authored over 12 years ago by Mihai Bazon <[email protected]>
empty block to empty statement: {} ==> ;

14481de0e9141eff41877f56876f7e6a78c3d059 authored over 12 years ago by Mihai Bazon <[email protected]>
more smallish optimizations

07f1d56f69a5190d33400d4e5d4032edcaf016ff authored over 12 years ago by Mihai Bazon <[email protected]>
try negating AST_Binary

5e60a60b3b9ddea872187cf6568ebbcad58c1a60 authored over 12 years ago by Mihai Bazon <[email protected]>
some cleanup

5d781ec6f8689f102db1c0666c725bd64b463df2 authored over 12 years ago by Mihai Bazon <[email protected]>
more sequencesizing (WIP)

0f418d654e035b8547340c4d4c03802a01a532b8 authored over 12 years ago by Mihai Bazon <[email protected]>
drop unused function

21c34a17922f826d3c1d1fa230fb08788393f69b authored over 12 years ago by Mihai Bazon <[email protected]>
rewrite handle_if_return

optimizations of if/return/continue seem to be even better now

7b6a402916fe697049c38f6ee89c644fcf93c8d4 authored over 12 years ago by Mihai Bazon <[email protected]>
other small optimization:

if (foo) continue;
...body...

==>

if (!foo) { ...body ... }

Only when the parent block is the...

397bf56d2597d4c2849e380e103b92b87303785f authored over 12 years ago by Mihai Bazon <[email protected]>
figure out label targets

4e0262bdfb4097a2d2ff000d38f5c847631f0eb2 authored over 12 years ago by Mihai Bazon <[email protected]>
join_vars:

var XXX;
for (var YYY; ...)

==>

for (var XXX,YYY; ...)

86c14d0988960b5fc52551f143f0ae4361794b4b authored over 12 years ago by Mihai Bazon <[email protected]>
compress typeof x == "undefined" to x === undefined, which further gets

shortened to x === void 0 (or x === [][0] in unsafe mode)

43fd45154bac89b89330e13bd1f167e2a927a23c authored over 12 years ago by Mihai Bazon <[email protected]>
minor

when unsafe, compress undefined as [][0]

50d1670e4266b7cefaccb4eef779ee6e08c980e1 authored over 12 years ago by Mihai Bazon <[email protected]>
adding an imaginary "return undefined" can sometimes help

function f() {
if (foo) return x();
if (!bar) return y();
}

==>

function f() {
return fo...

5e83e7ec17aca27ea818ce380a53c72ee221b900 authored over 12 years ago by Mihai Bazon <[email protected]>
more optimizations that v1 does and some cleanups

- a = a + x ==> a+=x
- joining consecutive var statements (hoisting is not always desirable)
- x...

924aa580602a4ad94f1079dcd157286314066553 authored over 12 years ago by Mihai Bazon <[email protected]>
added -m and -c options

93b973c99dd25aeff66ff31f2881e9ce252eaac6 authored over 12 years ago by Mihai Bazon <[email protected]>
few more optimizations:

- do multiple passes in tighten_body if it was changed
- transform if (foo) return x; return y; ...

d72c1d1293487b7e775d0a248f8c9c848b01502c authored over 12 years ago by Mihai Bazon <[email protected]>
minor

f5027ec1fc67d6daeb51714eeddd06350cae00d6 authored over 12 years ago by Mihai Bazon <[email protected]>
more AST_If optimizations

a132841fb920f6815eb6d153f4329242354f1cae authored over 12 years ago by Mihai Bazon <[email protected]>
side effect fixes and small optimization for gzip

prefer to always use > and >= operators (idea from Closure)

2b1e4628e0ee3e73d2e9d00635e51067ec36cd52 authored over 12 years ago by Mihai Bazon <[email protected]>
fixed run-tests and an issue about reversing the condition in AST_If

2b4093ba8342b79bac3f9f89428817231728bb01 authored over 12 years ago by Mihai Bazon <[email protected]>
minor

9a629abe00101d56ccc1a9bd01a90b9f7f19421f authored over 12 years ago by Mihai Bazon <[email protected]>
fixed some mess with symbols/scope

- all symbols now have a `thedef` property which is a SymbolDef object,
instead of the `uniq` ...

8e82d8d94cd60f7423ee61032a30a35222680dc3 authored over 12 years ago by Mihai Bazon <[email protected]>
checkpoint

- discard statements with no side effects (unsafe? could be)
- safer hoist_vars (needs some reva...

da407d46c65eeaf4599b0b50fc0a8ab6ba28ecdf authored over 12 years ago by Mihai Bazon <[email protected]>
hoist_vars is pretty bad, it seems. cancelled it for now.

1579c0fb97bb781a624199decab92e19c77d74d6 authored over 12 years ago by Mihai Bazon <[email protected]>
adaptive base54 digits depending on char frequency (WIP)

6b9aeb5325203a9f4c8e3bdd6bd3f45f8520ee2e authored over 12 years ago by Mihai Bazon <[email protected]>
more progress on the compressor (WIP)

a41e6cfabb0befc0b71c95aa55ac0568cce36518 authored over 12 years ago by Mihai Bazon <[email protected]>
fix "file" in the source map

16b12c62875c67a7ca50f6ee184dcb6f476ea350 authored over 12 years ago by Mihai Bazon <[email protected]>
minor

1c8ba35844f4032fd9f12961a0feee1a78153aa3 authored over 12 years ago by Mihai Bazon <[email protected]>
fix output for division followed by regexp

( v1 report: https://github.com/mishoo/UglifyJS/pull/458 )

5a8e6ce735f6fbdf32fc730735843b225424e357 authored over 12 years ago by Mihai Bazon <[email protected]>
checkpoint

43c75c9248f3f2fe3732b263fc03d73528f005c8 authored over 12 years ago by Mihai Bazon <[email protected]>
fix bug (forgot arg name)

048d6906ae6f43b60cfb0c025c242743f6d2c16f authored over 12 years ago by Mihai Bazon <[email protected]>
always keep declarations found in unreachable code

a few more tests and some cleanups.

919b2733ab52d3072bb4276210fe442bc0ade5fd authored over 12 years ago by Mihai Bazon <[email protected]>
fixed tests (need to drop the toplevel block in "expected" if it's a single statement)

b77574ea1c25e2630dcde000ae0fa32b01f8311e authored over 12 years ago by Mihai Bazon <[email protected]>
don't duplicate argument names

9bb1a84d6bef8fa95d025d65bd0c2772bceca404 authored over 12 years ago by Mihai Bazon <[email protected]>
declared `--stats` as boolean

0afafe64fcbaf720889b8906a91dafb6dc409cdd authored over 12 years ago by Mihai Bazon <[email protected]>
fix for variable names like `toString`

c7b484b64fdce8ed922f18376b7edf3cb40112f1 authored over 12 years ago by Mihai Bazon <[email protected]>
support for hoisting declarations

and finally it seems we beat v1 in terms of compression

0503513dcc9e4dc9f01ffc894245076de9f48cb0 authored over 12 years ago by Mihai Bazon <[email protected]>
cleaned up usage of AST_BlockStatement

The following nodes were instances of AST_BlockStatement: AST_Scope,
AST_SwitchBlock, AST_Switch...

8633b0073f016fddd655ae5e1f1726287a24828d authored over 12 years ago by Mihai Bazon <[email protected]>
checkpoint

1b5183dd5ee7d2b147f5862c9abf8f45f50fc82f authored over 12 years ago by Mihai Bazon <[email protected]>
more fiddling with boolean expressions, etc.

optimize away while(false), and transform while(true) ==> for(;;).

UNSAFE:

some expressions ar...

376667a8188083e4e64ef56bf10f38e4f831447f authored over 12 years ago by Mihai Bazon <[email protected]>
if present, the `else` in an `if` should always be forced statement

3459c40cf9d17c6c791a86d387bba85e965c37b6 authored over 12 years ago by Mihai Bazon <[email protected]>
boolean and if/exit optimizations

86cfb5be86603b472085920a82905b22c9d06fea authored over 12 years ago by Mihai Bazon <[email protected]>
minor

e5f1cec6aa5998a681ad3c890a07d62d0cbb8d06 authored over 12 years ago by Mihai Bazon <[email protected]>
more optimizations for ifs/conditionals

(XXX: should add tests before anything else)

37eecc16a419361672c0c055e0246ee7deb439b7 authored over 12 years ago by Mihai Bazon <[email protected]>
resolve constant expressions

f03138daa805c01293a2b60f96231989906aca59 authored over 12 years ago by Mihai Bazon <[email protected]>
jumps, try and definitions are statements too

f70226461732321780a04f5c5dd02ed753ede0cf authored over 12 years ago by Mihai Bazon <[email protected]>
an AST_If is too a StatementWithBody

6d0db4ce14fd67681bdda1d1861517763eff4c6e authored over 12 years ago by Mihai Bazon <[email protected]>
a LabeledStatement should be in fact a StatementWithBody

This fixes output for:

if (foo) {
moo: if (bar) {
break moo;
}
...

d7c1dc6c0578b55eefc3bc94556146dce6e1a8cb authored over 12 years ago by Mihai Bazon <[email protected]>
declare boolean options

d6efa8b28dc0a937bc154bf5f2e5d5450be5c1d5 authored over 12 years ago by Mihai Bazon <[email protected]>
switch branches must be declared `required` so that the compressor doesn't

replace nodes with a single statement.

looks stable for now, though mess begins to sink in. nee...

66c869c8f6d4392efb56a15c6663a1f93b74da88 authored over 12 years ago by Mihai Bazon <[email protected]>
Reverting "minor perf. improvements"

Revert "minor perf. improvements"

This reverts commit 24bfd55a22afd791d4a97694641831cfbd27fb14.
...

1bf5928b5485db5646515919672e005738d6df81 authored over 12 years ago by Mihai Bazon <[email protected]>
add -b

596af60587a9badd43846aede9936e68868e61b2 authored over 12 years ago by Mihai Bazon <[email protected]>
add source mappings for more node types; started CLI utility

f2f370cee3708c0d9431594f81e192099fc6900c authored over 12 years ago by Mihai Bazon <[email protected]>
minor perf. improvements

24bfd55a22afd791d4a97694641831cfbd27fb14 authored over 12 years ago by Mihai Bazon <[email protected]>
started support for generating source maps (WIP)

plugged in @fitzgen's source-map library

52bcca288fe560670584b24cb170f09c250514e6 authored over 12 years ago by Mihai Bazon <[email protected]>
don't mangle names of setters/getters

48440dc250d0a8b72a8064fa97760fe9962f7511 authored over 12 years ago by Mihai Bazon <[email protected]>
update with link to discussion about Esprima vs. UglifyJS speed

6569e66bf87e5b170ac01f52b32e66639d09b899 authored over 12 years ago by Mihai Bazon <[email protected]>
docstring for AST_StatementWithBody

86cff2029f15b0883622957a5a98d9c27956914e authored over 12 years ago by Mihai Bazon <[email protected]>
fix output for arrays containing undefined values

[1,,2,] ==> [1,,2] instead of [1,undefined,2]

1b6bcca7170c8f08f255448533c211cdb1010f34 authored over 12 years ago by Mihai Bazon <[email protected]>
fix code generator for this case:

if (foo) {
with (bar)
if (baz)
x();
} else y();

(the compressor removes the bracket...

7fcb6bcb1270d1688512e25704125edb5b35b3c5 authored over 12 years ago by Mihai Bazon <[email protected]>
added README

ce8e8d57c0d346dba9527b7a11b03364ce9ad1bb authored over 12 years ago by Mihai Bazon <[email protected]>
minor

bf70205b15ae11135c8e4e7bd99cecff28df73ba authored over 12 years ago by Mihai Bazon <[email protected]>
update (c) years

58a3b5e93f2b8390bc5e091c03ceb3feae5c4e39 authored over 12 years ago by Mihai Bazon <[email protected]>
minor

8dfa9fe7e58c742b7835523daa423b12ada2718c authored over 12 years ago by Mihai Bazon <[email protected]>
fix compressing `a,b; return c;` into `return a,b,c;`

4437e7af1931f995686511938ad80f704ef5925e authored over 12 years ago by Mihai Bazon <[email protected]>
added print_to_string helper method

a8e49f15361cce98fdecb20535df4b4f0de553ca authored over 12 years ago by Mihai Bazon <[email protected]>
fix current_col and force a newline every 32K (support options.max_line_len)

8d233c38d485020bdb9d86865cf50a8199fbfc27 authored over 12 years ago by Mihai Bazon <[email protected]>
added license

95b18e54a4632cc06a4fb36fbf631c6b1d852892 authored over 12 years ago by Mihai Bazon <[email protected]>
wrote more of the compressor and added some tests

159a6f048cfabc6bdee0bb1274eeb0d6ab75b79a authored over 12 years ago by Mihai Bazon <[email protected]>
fix output for certain edge cases

the statements if, for, do, while and with might have an AST_EmptyStatement
as body; if that's t...

f53e139d3cfc9b2eab0239496181a9485728e066 authored over 12 years ago by Mihai Bazon <[email protected]>
declare some properties in the node constructor so that they're copied in clone

fb8c9e3a48501c0a49ec30ba0a60cad7053adc3f authored over 12 years ago by Mihai Bazon <[email protected]>
hint that brackets may be required in AST_BlockStatement

1b839eb35bfb7cb28c59ee80bd88e395f33711ca authored over 12 years ago by Mihai Bazon <[email protected]>
cleaned up some mess and started the actual compressor

ffe58a9961ced012b40c16b93f9fe2370293431b authored over 12 years ago by Mihai Bazon <[email protected]>
some reorganization

(moved pretty much everything that relates to scope in scope.js, added a
module for NodeJS that ...

7ae1c600a24e2f43feb839c5fd1625f6261751b5 authored over 12 years ago by Mihai Bazon <[email protected]>
handle labels properly

(they can't be handled the same way as variables in a scope)

92bd53b513c6cf030d96ed627efc50dd1875ba85 authored over 12 years ago by Mihai Bazon <[email protected]>
warn about unreferenced symbols

159333f4c51e70a758160975a190646ff55bf66b authored over 12 years ago by Mihai Bazon <[email protected]>
more fixes:

- added walker for AST_ObjectProperty
- handle redefinitions properly (only mangle one symbol, m...

99456c6156f8a05734a82be97348ace72aa1ee2a authored over 12 years ago by Mihai Bazon <[email protected]>
added mangler and other stuff

458e251d7ed6e9ac97849237264caa40a40c76b3 authored over 12 years ago by Mihai Bazon <[email protected]>
doc (WIP)

1fe0ff9fff86b5d5fba3f4d1499479d2f23511df authored over 12 years ago by Mihai Bazon <[email protected]>
simple visitor API and code to figure out scope and references

6c35135ace95bb90c33cadeb8c16a43415eef454 authored over 12 years ago by Mihai Bazon <[email protected]>
some fixes (need testing) in AST_If codegen

4488758d485b0b624d4858f764bdf08b10365d3b authored over 12 years ago by Mihai Bazon <[email protected]>
minor whitespace issues

cd8ae5f712fa64ac2d6dff0c5028d8bc70d331ed authored over 12 years ago by Mihai Bazon <[email protected]>
big speed improvement (observable when beautify = false)

who would have thought that str.charAt(str.length - 1) is not a constant,
instant operation? se...

ef87c9fd8fafa006146d45ba2a870237a127c9d4 authored over 12 years ago by Mihai Bazon <[email protected]>
don't output both space and semicolon when beautify=false

901f77047e581c79132f93451f057629788d0e9f authored over 12 years ago by Mihai Bazon <[email protected]>
added some comments about the rules governing parens

07cbc8d3afee368ed143f62302d1b1a51e0f09bc authored over 12 years ago by Mihai Bazon <[email protected]>
fix one more glitch

4fb6021b0bd68fff881adfe2781e991f9fd2416f authored over 12 years ago by Mihai Bazon <[email protected]>