How to use the uglify-js-papandreou.AST_Array function in uglify-js-papandreou

To help you get started, we’ve selected a few uglify-js-papandreou 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 assetgraph / assetgraph / lib / assets / JavaScript.js View on Github external
if (arrayItemAst instanceof uglifyJs.AST_String) {
                                if (['require', 'exports', 'module'].indexOf(arrayItemAst.value) === -1) {
                                    outgoingRelations.push(new AssetGraph.JavaScriptAmdRequire({
                                        from: this,
                                        callNode: node,
                                        arrayNode: arrayNode,
                                        node: arrayItemAst
                                    }));
                                }
                            } else {
                                infos.push(new errors.SyntaxError('Skipping non-string JavaScriptAmdRequire item: ' + node.print_to_string()));
                            }
                        }, this);
                    }
                } else if (this.isRequired && node.expression instanceof uglifyJs.AST_Symbol && node.expression.name === 'define') {
                    if (node.args.length === 2 && node.args[0] instanceof uglifyJs.AST_Array) {
                        var arrayNode = node.args[0];
                        arrayNode.elements.forEach(function (arrayItemAst, i) {
                            arrayNode.elements[i] = arrayItemAst = tryFoldConstantToString(arrayItemAst);
                            if (arrayItemAst instanceof uglifyJs.AST_String) {
                                if (['require', 'exports', 'module'].indexOf(arrayItemAst.value) === -1) {
                                    outgoingRelations.push(new AssetGraph.JavaScriptAmdDefine({
                                        from: this,
                                        callNode: node,
                                        arrayNode: arrayNode,
                                        node: arrayItemAst
                                    }));
                                }
                            } else {
                                infos.push(new errors.SyntaxError('Skipping non-string JavaScriptAmdDefine item: ' + node.print_to_string()));
                            }
                        }, this);
github assetgraph / assetgraph / lib / assets / JavaScript.js View on Github external
}.bind(this));
                        argumentNodes.forEach(function (argumentNode) {
                            argumentNode.walk(angularWalker);
                        });
                    }.bind(this);

                    var stackPosition = stack.length - 1;
                    while (stack[stackPosition - 1] instanceof uglifyJs.AST_Dot && stack[stackPosition - 2] instanceof uglifyJs.AST_Call) {
                        var callNode = stack[stackPosition - 2],
                            methodName = stack[stackPosition - 1].property,
                            argumentNodes = callNode.args,
                            templateCacheVariableName;

                        if (methodName === 'run' &&
                            argumentNodes.length > 0 &&
                            argumentNodes[0] instanceof uglifyJs.AST_Array &&
                            argumentNodes[0].elements.length === 2 &&
                            argumentNodes[0].elements[0] instanceof uglifyJs.AST_String &&
                            argumentNodes[0].elements[0].value === '$templateCache' &&
                            argumentNodes[0].elements[1] instanceof uglifyJs.AST_Function) {

                            templateCacheVariableName = argumentNodes[0].elements[1].argnames[0].name;
                        }
                        diveIntoAngularMethodCall(argumentNodes, templateCacheVariableName);
                        stackPosition -= 2;
                    }
                }

                if (node.expression instanceof uglifyJs.AST_Symbol && node.expression.name === 'INCLUDE') {
                    if (node.args.length === 1 && node.args[0] instanceof uglifyJs.AST_String) {
                        outgoingRelations.push(new AssetGraph.JavaScriptInclude({
                            from: this,