Commit Graph

66 Commits

Author SHA1 Message Date
1111hui 0a35acbbe7 feat: add option.outFileName for JS API, if absense, sourceMap.file field will deduced 2016-11-29 20:29:12 +01:00
pengzhenqing e51c6ba380 Add an option for writing inline source map 2016-10-23 21:21:39 +02:00
kzc dcdcfe4d39 Add input file glob support to minify() 2016-08-14 21:46:38 +02:00
kzc 72306b9885 Add simple file globbing to bin/uglifyjs for Windows 2016-08-14 21:46:38 +02:00
Lucas Wiener 307b88d6cc Fixed sourceMapIncludeSources and inSourceMap = string combination of the UglifyJS.minify function. 2016-08-14 21:40:14 +02:00
Yotam Spenser af37ecafe1 Source map URL override from programmatic API 2016-07-17 19:39:08 +02:00
Geraint 85924bb32e Allow input files to be map (url->filename) 2016-06-30 22:23:59 +02:00
Richard van Velzen aa82027a17 Don't assume DEBUG is defined when exporting --self
Potential fix for #1148
2016-06-20 08:40:45 +02:00
Anthony Van de Gejuchte 2149bfb707 Don't mix strings with directives in output
* Don't interpret strings with escaped content as directive
 * Don't interpret strings after empty statement as directive
 * Adapt output to prevent strings being represent as directive
 * Introduce UGLIFY_DEBUG to allow internal testing like EXPECT_DIRECTIVE
2016-06-19 20:59:17 +02:00
ChALkeR 5cb5305cf3 Export tokenizer function
In uglify-js@1, both parser and tokenizer methods were exported

This allows to use tokenizer() separately, e.g. to wrap or override it, as
parse() method accepts not only text, but also tokenized functions.
2016-06-07 12:25:16 +03:00
kzc d2945744f2 Workaround for process.exit() tty output truncation.
Fixes #1055
2016-05-04 20:04:48 +02:00
kzc c55dd5ed74 Add passes compress option. Fix duplicate compress warnings. 2016-04-19 20:05:33 +02:00
Martii cdba43cfa4 Create and map bare-returns into new parse property name 2016-02-08 10:45:42 +01:00
Boris Letocha a123e232b9 Fixes #951 missing export for SymbolDef 2016-01-31 21:41:38 +01:00
Jeremy Marzka 799509e145 Added a mangle properties option 2016-01-26 22:10:08 +01:00
Mihai Bazon 7691bebea5 Rework has_directive
It's now available during tree walking, i.e. walker.has_directive("use
asm"), rather than as part of the scope.  It's thus no longer necessary
to call `figure_out_scope` before codegen.  Added special bits in the
code generator to overcome the fact that it doesn't inherit from
TreeWalker.

Fix #861
2015-11-11 22:15:25 +02:00
kzc e870c7db45 have minify() call figure_out_scope() if needed to produce well formed "use asm" code 2015-10-07 16:31:57 -04:00
Mihai Bazon 6637c267a5 Fix mozilla-ast after module loading changes
Need to explicitly qualify stuff now, since it's not evaluated in some
global scope.

Ref #636
2015-09-24 18:13:21 +03:00
Mihai Bazon 99233c44cc No longer use vm to load code.
Improves performance 2x on node > 0.10.

Ref #636
2015-09-24 17:58:51 +03:00
Ingo Struck 3a5f354846 allow for anonymous map generation using string type check 2015-08-27 19:38:33 +02:00
Richard van Velzen 464a942a95 Merge pull request #736 from AlbertoGP/master
fromString option, use index from argument array for filename instead of "?"
2015-08-07 14:12:41 +02:00
Kosei Kitahara 8108c7ffaf Support wrap and exportAll options. 2015-07-28 21:36:22 +09:00
Alberto González Palomo 4fba3e0b80 fromString option, use index from argument array for filename instead of "?"
The index allows the caller to map things like parse errors back to the
code chunk where they appeared.
2015-06-15 18:03:06 +02:00
Mihai Bazon d2dda34b2a Remove deprecated calls to utils.print/utils.error
Close #542, #641, #647
2015-05-04 15:07:16 +03:00
Mihai Bazon 6b82069e1a Merge in more DOM properties. 2015-03-24 13:59:57 +02:00
Mihai Bazon e1c3861832 Export readDefaultReservedFile 2015-03-22 11:04:28 +02:00
Mihai Bazon 81b7335267 Don't use Object.create 2015-03-19 12:54:43 +02:00
Mihai Bazon bb010c2253 tools/props.html: output complete JSON 2015-03-19 10:10:01 +02:00
Mihai Bazon 03b6121194 Add --reserve-domprops along with a default exclusion list in tools/domprops.json 2015-03-18 12:10:21 +02:00
Mihai Bazon 3ef092332b Support multiple --reserved-file args 2015-03-18 11:53:17 +02:00
Mihai Bazon 7c8c9b94bc tools/props.html: use try/catch in a few more places 2015-03-17 14:31:22 +02:00
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 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
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
Richard van Velzen 7f9bc9e863 Pass mangle options to figure_out_scope and compute_char_frequence
Fix #219. Because the options were not set and `toplevel` is `false` by default, some toplevel names would sometimes not be mangled correctly.
2015-01-05 19:10:32 +01:00
truiken 0f80b1058d Resolve the relative path to lib files last
This allows usage of UglifyJS on build systems which have a flat (or non-matching relative) directory structure for source files.
2015-01-04 21:01:11 +01:00
achingbrain 4613644cce passes in references to process and Buffer to silence ReferenceErrors 2015-01-04 19:26:47 +01:00
OiNutter ef772b0049 add sourceMappingUrl to output in node module
If options.outSourceMap is specified the sourceMappingURL comment
should be appended to the output stream
2014-04-13 11:48:38 +02:00
ebednarz 6fcabbde08 Fix sourceMapIncludeSources exception in Node API
https://github.com/mishoo/UglifyJS2/issues/459
2014-04-13 11:16:10 +02:00
Artemy Tregubenko f6203bd5a8 added hasOwnProperty check to avoid warnings 2014-01-09 15:20:05 +01:00
Artemy Tregubenko 03cf94ebe8 Added support for sourcesContent property of source map 2014-01-09 15:12:00 +01:00
Mihai Bazon b9fac687ff Support SpiderMonkey AST in UglifyJS.minify. Fix #393. 2014-01-07 18:42:48 +02:00
Mihai Bazon d0689c81bb Reset the base54 counters every time minify is called.
Close #229
2013-06-28 10:08:13 +03:00
Devon Govett f2767452e6 Allow inSourceMap to be a generated JSON source map instead of just a file name 2013-02-10 10:06:13 -08:00
Mihai Bazon 130c623be7 Support output, mangle and compress options to UglifyJS.minify.
Close #57
Close #86
Close #33
2013-01-04 11:25:13 +02:00
Mihai Bazon 7f5f4d60b7 discard the hack that worked around the deprecation warning
(since the source-map module no longer uses require.js)

refs #9
2012-11-05 22:23:51 +02:00
Mihai Bazon 202fb93799 test for fs.existsSync 2012-10-25 10:58:48 +03:00
Mihai Bazon bee01dc1be Merge branch 'master' of github.com:mishoo/UglifyJS2 2012-10-20 11:14:25 +03:00
Mihai Bazon 12f71e01d0 alternate hack to disable deprecation warning
ref #9, close #20
2012-10-20 11:12:21 +03:00