Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function isNamedDefineNode(node) {
return (
node instanceof uglifyJs.AST_Call &&
node.expression instanceof uglifyJs.AST_Symbol &&
node.expression.name === 'define' &&
node.args.length === 2 &&
node.args[0] instanceof uglifyJs.AST_String
);
}
function shouldCommentNodeBePreservedInNonPrettyPrintedOutput(node, comment) {
return (/@preserve|@license|@cc_on|[@#]\s*sourceURL|[#@]\s*sourceMappingURL|^!/).test(comment.value);
}
// From http://lisperator.net/uglifyjs/transform
var deepCloneTransform = new uglifyJs.TreeTransformer(function (node, descend) {
node = node.clone();
// the descend function expects two arguments:
// the node to dive into, and the tree walker
// `this` here is the tree walker (=== deep_clone).
// by descending into the *cloned* node, we keep the original intact
descend(node, this);
return node;
});
extendWithGettersAndSetters(JavaScript.prototype, {
contentType: 'application/javascript', // TODO: Double check that this is everyone's recommended value
supportedExtensions: ['.js'],
isPretty: false,