This commit is contained in:
Moshe Brevda 2024-06-05 15:14:41 +03:00 committed by GitHub
commit 441abd81c5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 16 additions and 9 deletions

5
.gitignore vendored
View File

@ -1,3 +1,4 @@
/node_modules/ index.js.map
/npm-debug.log node_modules/
npm-debug.log
tmp/ tmp/

View File

@ -8,7 +8,7 @@ require("../tools/tty");
var fs = require("fs"); var fs = require("fs");
var info = require("../package.json"); var info = require("../package.json");
var path = require("path"); var path = require("path");
var UglifyJS = require("../tools/node"); var UglifyJS = require("..");
var skip_keys = [ "cname", "fixed", "in_arg", "inlined", "length_read", "parent_scope", "redef", "scope", "unused" ]; var skip_keys = [ "cname", "fixed", "in_arg", "inlined", "length_read", "parent_scope", "redef", "scope", "unused" ];
var truthy_keys = [ "optional", "pure", "terminal", "uses_arguments", "uses_eval", "uses_with" ]; var truthy_keys = [ "optional", "pure", "terminal", "uses_arguments", "uses_eval", "uses_with" ];
@ -175,6 +175,9 @@ function process_option(name, no_value) {
case "wrap": case "wrap":
options[name] = read_value(true); options[name] = read_value(true);
break; break;
case "no-wrap":
options.wrap = false;
break;
case "verbose": case "verbose":
options.warnings = "verbose"; options.warnings = "verbose";
break; break;
@ -271,7 +274,7 @@ if (typeof options.sourceMap == "object" && "base" in options.sourceMap) {
} }
if (specified["self"]) { if (specified["self"]) {
if (paths.length) UglifyJS.AST_Node.warn("Ignoring input files since --self was passed"); if (paths.length) UglifyJS.AST_Node.warn("Ignoring input files since --self was passed");
if (!options.wrap) options.wrap = "UglifyJS"; if (!("wrap" in options)) options.wrap = "UglifyJS";
paths = UglifyJS.FILES; paths = UglifyJS.FILES;
} else if (paths.length) { } else if (paths.length) {
paths = simple_glob(paths); paths = simple_glob(paths);

1
index.js Normal file
View File

@ -0,0 +1 @@
module.exports = require("./tools/node");

View File

@ -12,14 +12,14 @@
"Mihai Bazon <mihai.bazon@gmail.com> (http://lisperator.net/)" "Mihai Bazon <mihai.bazon@gmail.com> (http://lisperator.net/)"
], ],
"repository": "mishoo/UglifyJS", "repository": "mishoo/UglifyJS",
"main": "tools/node.js", "main": "index.js",
"bin": { "bin": {
"uglifyjs": "bin/uglifyjs" "uglifyjs": "bin/uglifyjs"
}, },
"files": [ "files": [
"bin", "index.js",
"lib", "index.js.map",
"tools", "tools/tty.js",
"LICENSE" "LICENSE"
], ],
"devDependencies": { "devDependencies": {
@ -27,7 +27,8 @@
"semver": "~6.3.0" "semver": "~6.3.0"
}, },
"scripts": { "scripts": {
"test": "node test/compress.js && node test/mocha.js" "test": "node test/compress.js && node test/mocha.js",
"prepack": "node bin/uglifyjs --self --no-wrap --beautify --source-map --output index.js"
}, },
"keywords": [ "keywords": [
"cli", "cli",

View File

@ -59,3 +59,4 @@ npm --version
while !(npm install); do while !(npm install); do
while !(npm cache clean --force); do echo "'npm cache clean' failed - retrying..."; done while !(npm cache clean --force); do echo "'npm cache clean' failed - retrying..."; done
done done
npm run prepack