How to use the uglify-js-papandreou.OutputStream 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
get text() {
        if (!('_text' in this)) {
            var parseTree = this._parseTree;
            if (parseTree) {
                var outputStream = uglifyJs.OutputStream({
                    // Preserve all comments when isPretty is true, and only preserve copyright notices/license info
                    // when it's false:
                    comments: this.isPretty || shouldCommentNodeBePreservedInNonPrettyPrintedOutput,
                    beautify: this.isPretty,
                    quote_char: this.quoteChar,
                    source_map: null
                });
                parseTree.print(outputStream);
                var text = outputStream.get();

                if (text.length > 0) {
                    text = text.replace(/;*$/, ';'); // Always end with a semicolon like the UglifyJS binary (if non-empty)
                }

                // Workaround for https://github.com/mishoo/UglifyJS2/issues/180
                if (parseTree.end && parseTree.end.comments_before && !parseTree.end._comments_dumped) {