How to use the uglify-js.mangle_properties function in uglify-js

To help you get started, we’ve selected a few uglify-js examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Arnavion / libjass / build / uglify.js View on Github external
});


				// Compress
				var compressor = UglifyJS.Compressor({
					warnings: true,
					screw_ie8: true
				});
				root = root.transform(compressor);


				// Mangle
				root.figure_out_scope({ screw_ie8: true });
				root.compute_char_frequency();
				root.mangle_names({ screw_ie8: true });
				root = UglifyJS.mangle_properties(root, {
					regex: /^_/
				});


				// Output
				var firstLicenseHeaderFound = false; // To detect and preserve the first license header

				var output = {
					source_map: UglifyJS.SourceMap({
						file: path.basename(sourceMapFile.path),
						orig: sourceMapFile.contents.toString()
					}),
					ascii_only: true,
					comments: function (node, comment) {
						if (!firstLicenseHeaderFound && comment.value.indexOf("Copyright") !== -1) {
							firstLicenseHeaderFound = true;
github enigmampc / secret-contracts / node_modules / uglifyjs-webpack-plugin / dist / index.js View on Github external
var ast = uglify.parse(input, {
								filename: file
							});
							if (options.compress !== false) {
								ast.figure_out_scope();
								var compress = uglify.Compressor(options.compress || {
									warnings: false
								}); // eslint-disable-line new-cap
								ast = compress.compress(ast);
							}
							if (options.mangle !== false) {
								ast.figure_out_scope(options.mangle || {});
								ast.compute_char_frequency(options.mangle || {});
								ast.mangle_names(options.mangle || {});
								if (options.mangle && options.mangle.props) {
									uglify.mangle_properties(ast, options.mangle.props);
								}
							}
							var output = {};
							output.comments = Object.prototype.hasOwnProperty.call(options, "comments") ? options.comments : /^\**!|@preserve|@license/;
							output.beautify = options.beautify;
							for (var k in options.output) {
								output[k] = options.output[k];
							}
							var extractedComments = [];
							if (options.extractComments) {
								var condition = {};
								if (typeof options.extractComments === "string" || options.extractComments instanceof RegExp) {
									// extractComments specifies the extract condition and output.comments specifies the preserve condition
									condition.preserve = output.comments;
									condition.extract = options.extractComments;
								} else if (Object.prototype.hasOwnProperty.call(options.extractComments, "condition")) {
github forestturner / PokerHandRangeCalc / node_modules / webpack / lib / optimize / UglifyJsPlugin.js View on Github external
}
					uglify.base54.reset();
					var ast = uglify.parse(input, {
						filename: file
					});
					if(options.compress !== false) {
						ast.figure_out_scope();
						var compress = uglify.Compressor(options.compress); // eslint-disable-line new-cap
						ast = ast.transform(compress);
					}
					if(options.mangle !== false) {
						ast.figure_out_scope(options.mangle || {});
						ast.compute_char_frequency(options.mangle || {});
						ast.mangle_names(options.mangle || {});
						if(options.mangle && options.mangle.props) {
							uglify.mangle_properties(ast, options.mangle.props);
						}
					}
					var output = {};
					output.comments = Object.prototype.hasOwnProperty.call(options, "comments") ? options.comments : /^\**!|@preserve|@license/;
					output.beautify = options.beautify;
					for(var k in options.output) {
						output[k] = options.output[k];
					}
					if(options.sourceMap !== false) {
						var map = uglify.SourceMap({ // eslint-disable-line new-cap
							file: file,
							root: ""
						});
						output.source_map = map; // eslint-disable-line camelcase
					}
					var stream = uglify.OutputStream(output); // eslint-disable-line new-cap
github daviddbarrero / Ionic-4-firebase / node_modules / uglifyjs-webpack-plugin / dist / index.js View on Github external
var ast = uglify.parse(input, {
								filename: file
							});
							if (options.compress !== false) {
								ast.figure_out_scope();
								var compress = uglify.Compressor(options.compress || {
									warnings: false
								}); // eslint-disable-line new-cap
								ast = compress.compress(ast);
							}
							if (options.mangle !== false) {
								ast.figure_out_scope(options.mangle || {});
								ast.compute_char_frequency(options.mangle || {});
								ast.mangle_names(options.mangle || {});
								if (options.mangle && options.mangle.props) {
									uglify.mangle_properties(ast, options.mangle.props);
								}
							}
							var output = {};
							output.comments = Object.prototype.hasOwnProperty.call(options, "comments") ? options.comments : /^\**!|@preserve|@license/;
							output.beautify = options.beautify;
							for (var k in options.output) {
								output[k] = options.output[k];
							}
							var extractedComments = [];
							if (options.extractComments) {
								var condition = {};
								if (typeof options.extractComments === "string" || options.extractComments instanceof RegExp) {
									// extractComments specifies the extract condition and output.comments specifies the preserve condition
									condition.preserve = output.comments;
									condition.extract = options.extractComments;
								} else if (Object.prototype.hasOwnProperty.call(options.extractComments, "condition")) {
github sx1989827 / DOClever / Desktop / node_modules / webpack / node_modules / uglifyjs-webpack-plugin / dist / index.js View on Github external
var ast = uglify.parse(input, {
								filename: file
							});
							if (options.compress !== false) {
								ast.figure_out_scope();
								var compress = uglify.Compressor(options.compress || {
									warnings: false
								}); // eslint-disable-line new-cap
								ast = compress.compress(ast);
							}
							if (options.mangle !== false) {
								ast.figure_out_scope(options.mangle || {});
								ast.compute_char_frequency(options.mangle || {});
								ast.mangle_names(options.mangle || {});
								if (options.mangle && options.mangle.props) {
									uglify.mangle_properties(ast, options.mangle.props);
								}
							}
							var output = {};
							output.comments = Object.prototype.hasOwnProperty.call(options, "comments") ? options.comments : /^\**!|@preserve|@license/;
							output.beautify = options.beautify;
							for (var k in options.output) {
								output[k] = options.output[k];
							}
							var extractedComments = [];
							if (options.extractComments) {
								var condition = {};
								if (typeof options.extractComments === "string" || options.extractComments instanceof RegExp) {
									// extractComments specifies the extract condition and output.comments specifies the preserve condition
									condition.preserve = output.comments;
									condition.extract = options.extractComments;
								} else if (Object.prototype.hasOwnProperty.call(options.extractComments, "condition")) {
github youzan / fast-uglifyjs-plugin / lib / worker.js View on Github external
}
    uglify.base54.reset();
    var ast = uglify.parse(task.input, {
        filename: task.file
    });
    if (options.compress !== false) {
        ast.figure_out_scope();
        var compress = uglify.Compressor(options.compress); // eslint-disable-line new-cap
        ast = ast.transform(compress);
    }
    if (options.mangle !== false) {
        ast.figure_out_scope();
        ast.compute_char_frequency(options.mangle || {});
        ast.mangle_names(options.mangle || {});
        if (options.mangle && options.mangle.props) {
            uglify.mangle_properties(ast, options.mangle.props);
        }
    }
    var output = {};
    output.comments = Object.prototype.hasOwnProperty.call(options, "comments") ? options.comments : /^\**!|@preserve|@license/;
    output.beautify = options.beautify;
    for (var k in options.output) {
        output[k] = options.output[k];
    }
    if (options.sourceMap) {
        var map = uglify.SourceMap({ // eslint-disable-line new-cap
            file: task.file,
            root: ""
        });
        output.source_map = map; // eslint-disable-line camelcase
    }
    var stream = uglify.OutputStream(output); // eslint-disable-line new-cap
github facebookarchive / WebDriverAgent / Inspector / node_modules / webpack / lib / optimize / UglifyJsPlugin.js View on Github external
}
					uglify.base54.reset();
					var ast = uglify.parse(input, {
						filename: file
					});
					if(options.compress !== false) {
						ast.figure_out_scope();
						var compress = uglify.Compressor(options.compress); // eslint-disable-line new-cap
						ast = ast.transform(compress);
					}
					if(options.mangle !== false) {
						ast.figure_out_scope();
						ast.compute_char_frequency(options.mangle || {});
						ast.mangle_names(options.mangle || {});
						if(options.mangle && options.mangle.props) {
							uglify.mangle_properties(ast, options.mangle.props);
						}
					}
					var output = {};
					output.comments = Object.prototype.hasOwnProperty.call(options, "comments") ? options.comments : /^\**!|@preserve|@license/;
					output.beautify = options.beautify;
					for(var k in options.output) {
						output[k] = options.output[k];
					}
					if(options.sourceMap !== false) {
						var map = uglify.SourceMap({ // eslint-disable-line new-cap
							file: file,
							root: ""
						});
						output.source_map = map; // eslint-disable-line camelcase
					}
					var stream = uglify.OutputStream(output); // eslint-disable-line new-cap
github circlecell / jsoncompare.com / node_modules / webpack / lib / optimize / UglifyJsPlugin.js View on Github external
}
					uglify.base54.reset();
					var ast = uglify.parse(input, {
						filename: file
					});
					if(options.compress !== false) {
						ast.figure_out_scope();
						var compress = uglify.Compressor(options.compress); // eslint-disable-line new-cap
						ast = ast.transform(compress);
					}
					if(options.mangle !== false) {
						ast.figure_out_scope();
						ast.compute_char_frequency(options.mangle || {});
						ast.mangle_names(options.mangle || {});
						if(options.mangle && options.mangle.props) {
							uglify.mangle_properties(ast, options.mangle.props);
						}
					}
					var output = {};
					output.comments = Object.prototype.hasOwnProperty.call(options, "comments") ? options.comments : /^\**!|@preserve|@license/;
					output.beautify = options.beautify;
					for(var k in options.output) {
						output[k] = options.output[k];
					}
					if(options.sourceMap !== false) {
						var map = uglify.SourceMap({ // eslint-disable-line new-cap
							file: file,
							root: ""
						});
						output.source_map = map; // eslint-disable-line camelcase
					}
					var stream = uglify.OutputStream(output); // eslint-disable-line new-cap
github cedricdelpoux / react-google-map / node_modules / webpack / lib / optimize / UglifyJsPlugin.js View on Github external
}
					uglify.base54.reset();
					var ast = uglify.parse(input, {
						filename: file
					});
					if(options.compress !== false) {
						ast.figure_out_scope();
						var compress = uglify.Compressor(options.compress); // eslint-disable-line new-cap
						ast = ast.transform(compress);
					}
					if(options.mangle !== false) {
						ast.figure_out_scope();
						ast.compute_char_frequency(options.mangle || {});
						ast.mangle_names(options.mangle || {});
						if(options.mangle && options.mangle.props) {
							uglify.mangle_properties(ast, options.mangle.props);
						}
					}
					var output = {};
					output.comments = Object.prototype.hasOwnProperty.call(options, "comments") ? options.comments : /^\**!|@preserve|@license/;
					output.beautify = options.beautify;
					for(var k in options.output) {
						output[k] = options.output[k];
					}
					if(options.sourceMap !== false) {
						var map = uglify.SourceMap({ // eslint-disable-line new-cap
							file: file,
							root: ""
						});
						output.source_map = map; // eslint-disable-line camelcase
					}
					var stream = uglify.OutputStream(output); // eslint-disable-line new-cap