pass module option to parse as well.

This commit is contained in:
Fábio Santos 2018-03-19 16:43:10 +00:00
parent 5da9c304bd
commit 6e9be5486c
2 changed files with 3 additions and 1 deletions

View File

@ -77,7 +77,7 @@ function minify(files, options) {
set_shorthand("ie8", options, [ "compress", "mangle", "output" ]); set_shorthand("ie8", options, [ "compress", "mangle", "output" ]);
set_shorthand("keep_classnames", options, [ "compress", "mangle" ]); set_shorthand("keep_classnames", options, [ "compress", "mangle" ]);
set_shorthand("keep_fnames", options, [ "compress", "mangle" ]); set_shorthand("keep_fnames", options, [ "compress", "mangle" ]);
set_shorthand("module", options, [ "compress", "mangle" ]); set_shorthand("module", options, [ "parse", "compress", "mangle" ]);
set_shorthand("safari10", options, [ "mangle", "output" ]); set_shorthand("safari10", options, [ "mangle", "output" ]);
set_shorthand("toplevel", options, [ "compress", "mangle" ]); set_shorthand("toplevel", options, [ "compress", "mangle" ]);
set_shorthand("warnings", options, [ "compress" ]); set_shorthand("warnings", options, [ "compress" ]);

View File

@ -859,6 +859,7 @@ function parse($TEXT, options) {
expression : false, expression : false,
filename : null, filename : null,
html5_comments : true, html5_comments : true,
module : false,
shebang : true, shebang : true,
strict : false, strict : false,
toplevel : null, toplevel : null,
@ -2913,6 +2914,7 @@ function parse($TEXT, options) {
var start = S.token; var start = S.token;
var body = []; var body = [];
S.input.push_directives_stack(); S.input.push_directives_stack();
if (options.module) S.input.add_directive("use strict");
while (!is("eof")) while (!is("eof"))
body.push(statement()); body.push(statement());
S.input.pop_directives_stack(); S.input.pop_directives_stack();