Commit Graph

3366 Commits

Author SHA1 Message Date
Mihai Bazon
f5eeed7665 Add tool to list DOM properties/methods 2015-03-17 11:46:04 +02:00
Mihai Bazon
80cfd063e2 Export readNameCache / writeNameCache 2015-03-17 10:05:49 +02:00
Mihai Bazon
aa45f6586e rename --prop-cache to --name-cache
... and support storing there variable names as well, to help with multiple
invocations when mangling toplevel.
2015-03-16 13:16:30 +02:00
Mihai Bazon
0c80d21e01 Fix prop mangling
Even if not “defined”, do mangle if name exists in the cache.
2015-03-16 10:53:31 +02:00
Mihai Bazon
375c88245a Fix --reserved-file 2015-03-14 11:36:58 +02:00
Mihai Bazon
ea3430102c Add property name mangler
We only touch properties that are present in an object literal, or which are
assigned to.  Example:

    x = { foo: 1 };
    x.bar = 2;
    x["baz"] = 3;
    x[cond ? "qwe" : "asd"] = 4;
    console.log(x.stuff);

The names "foo", "bar", "baz", "qwe" and "asd" will be mangled, and the
resulting mangled names will be used for the same properties throughout the
code.  The "stuff" will not be, since it's just referenced but never
assigned to.

This *will* break most of the code out there, but could work on carefully
written code: do not use eval, do not define methods or properties by
walking an array of names, etc.  Also, a comprehensive list of exclusions
needs to be passed, to avoid mangling properties that are standard in
JavaScript, DOM, used in external libraries etc.
2015-03-14 11:22:28 +02:00
Mihai Bazon
9de7199b88 v2.4.17 2015-03-11 00:04:26 +02:00
Pavol Bielik
266b81b78e update version 2015-02-20 14:52:35 +01:00
Pavol Bielik
cad5e8935f update features 2015-02-19 01:10:45 +01:00
Edward Casbon
ae07714927 Add filename to the JS_Parse_Error exception.
It would be nice to have access to the filename of the file that includes the code that causes a JavaScript error. This is especially handy if uglifying multiple files at once.

Only a small change is needed for this to happen as it's already available in the function that throws the error.
2015-02-11 23:21:22 +01:00
Rob Loach
0e41a3fad4 Add .npmignore 2015-02-11 23:19:21 +01:00
Richard van Velzen
61e850ceb5 Clean up unit test breakage
In 992b6b9fcc unit test broke (which I missed). This was due to undeclared variables not being side-effects free.

However, since they're really not side-effect free, just declare them in the test cases.
2015-02-11 21:27:21 +01:00
Richard van Velzen
992b6b9fcc Fix invalid removal of left side in && and || compression
See #637. This does not produce the optimal result, but it does prevent the removal of non-side-effect-free code.
2015-02-11 21:08:41 +01:00
Anthony Van de Gejuchte
7b71344051 Parse regexes properly 2015-02-11 18:29:15 +01:00
Pavol Bielik
08b3823db2 move annotations from property name to feature name 2015-02-08 13:40:36 +01:00
Richard van Velzen
605362f89d Drop all console statements properly
Because the base reference can be an member expression as well, we have to dig a bit deeper to find the leftmost base reference.

Fixes #451
2015-01-31 13:24:44 +01:00
Pavol Bielik
53aaf2e606 fix string unescaping 2015-01-29 12:29:11 +01:00
Pavol Bielik
8bfc409ff0 refactoring 2015-01-28 19:56:01 +01:00
Mihai Bazon
fbbaa42ee5 Add option to preserve/enforce string quote style
`-q 0` (default) use single or double quotes such as to minimize the number of
 bytes (prefers double quotes when both will do); this is the previous
 behavior.

`-q 1` -- always use single quotes

`-q 2` -- always use double quotes

`-q 3` or just `-q` -- always use the original quotes.

Related codegen option: `quote_style`.

Close #495
Close #460

Some `yargs` guru please tell me why `uglifyjs --help` doesn't display the
help string for `-q` / `--quotes`, and why it doesn't output the expected
argument types anymore, like good old `optimist` did.
2015-01-27 22:26:27 +02:00
Pavol Bielik
027027634d check server version 2015-01-27 16:27:35 +01:00
Pavol Bielik
9d013a10af Add support for colored output (disabled by default) 2015-01-26 21:31:12 +01:00
Pavol Bielik
55fac0c9e5 update version number 2015-01-26 20:07:55 +01:00
Pavol Bielik
b9b419c55c Update README.md 2015-01-26 20:06:52 +01:00
Pavol Bielik
def341c8ff minor update 2015-01-26 19:51:13 +01:00
Pavol Bielik
41e457e865 Merge branch 'master' of https://github.com/eth-srl/UnuglifyJS 2015-01-26 19:50:06 +01:00
Pavol Bielik
cdd1247b6a update package.json with UnuglifyJS info 2015-01-26 19:42:51 +01:00
Pavol Bielik
7a7675efa8 update package.json with UnuglifyJS info 2015-01-26 17:12:47 +01:00
Pavol Bielik
1ef640da8e update tests 2015-01-26 17:10:36 +01:00
Pavol Bielik
c54754e7f2 script name refactoring 2015-01-26 16:53:24 +01:00
Pavol Bielik
3e9fe8aea8 Add support for UnuglifyJS packaging 2015-01-26 16:49:55 +01:00
Pavol Bielik
072e0c16e1 update rename functionality 2015-01-26 15:39:51 +01:00
Pavol Bielik
db76bb3c1f Merge branch 'master' of https://github.com/eth-srl/UnuglifyJS 2015-01-26 12:58:13 +01:00
Pavol Bielik
d08e08f913 minor update 2015-01-26 12:48:28 +01:00
Anthony Van de Gejuchte
099992ecae Keep single line comments after nlb, after nlb
Fixes #583
2015-01-26 12:11:52 +01:00
Richard van Velzen
d78ae20e64 Make empty source map values more reasonable in .minify()
`"null"` isn't a very usable value. `JSON.parse(null)` also gives `null`, which makes this fully backwards compatible.

Closes #616
2015-01-26 12:07:44 +01:00
Pavol Bielik
b92319d8e6 Update README.md 2015-01-26 02:33:43 +01:00
Pavol Bielik
4fdfd6a04c Add support for renaming directly from command line 2015-01-26 02:31:07 +01:00
Pavol Bielik
2afb966fbf Update encoding.
Note that using some unicode characters is broken due to UglifyJS.
2015-01-25 16:37:14 +01:00
Pavol Bielik
b2198226dd fix encoding and stack overflow 2015-01-25 15:20:50 +01:00
Pavol Bielik
d9424d8794 minor fix 2015-01-25 12:40:03 +01:00
Pavol Bielik
ff5757d187 Add colored console output 2015-01-25 12:19:30 +01:00
Pavol Bielik
1e3d236aed do not output constrains if there are no features 2015-01-25 01:50:10 +01:00
Pavol Bielik
38b01e67dc refactor 2015-01-25 00:12:10 +01:00
Pavol Bielik
797aa1d035 Add child_id to features 2015-01-25 00:11:59 +01:00
Pavol Bielik
09f3edad48 Add unique name for constants 2015-01-25 00:11:36 +01:00
Pavol Bielik
b0412a6ae8 Add generating scope constraints 2015-01-25 00:11:19 +01:00
Bryce Cronkite-Ratcliff
5c02d65ddb fixes issue #621 SourceMap toString JSON format
The correct format of a sourcemap is acquired
from a mozilla source map generator by calling
toJSON on this object. This patch alters the
toString function on mozilla generators to print
the format that is to spec instead of the generator's
internal representation of itself.
2015-01-24 00:33:02 -08:00
Pavol Bielik
23f79f2a10 Update README.md 2015-01-23 14:49:44 +01:00
Pavol Bielik
0c4e54d82c Update README.md 2015-01-22 18:20:47 +01:00
Pavol Bielik
4abdab7174 Update README.md 2015-01-22 18:05:01 +01:00