aboutsummaryrefslogtreecommitdiff
path: root/node_modules/uglify-to-browserify
diff options
context:
space:
mode:
authorFlorian Dold <florian.dold@gmail.com>2017-05-03 15:35:00 +0200
committerFlorian Dold <florian.dold@gmail.com>2017-05-03 15:35:00 +0200
commitde98e0b232509d5f40c135d540a70e415272ff85 (patch)
treea79222a5b58484ab3b80d18efcaaa7ccc4769b33 /node_modules/uglify-to-browserify
parente0c9d480a73fa629c1e4a47d3e721f1d2d345406 (diff)
downloadwallet-core-de98e0b232509d5f40c135d540a70e415272ff85.tar.xz
node_modules
Diffstat (limited to 'node_modules/uglify-to-browserify')
-rw-r--r--node_modules/uglify-to-browserify/.npmignore14
-rw-r--r--node_modules/uglify-to-browserify/.travis.yml3
-rw-r--r--node_modules/uglify-to-browserify/LICENSE19
-rw-r--r--node_modules/uglify-to-browserify/README.md15
-rw-r--r--node_modules/uglify-to-browserify/index.js49
-rw-r--r--node_modules/uglify-to-browserify/package.json20
-rw-r--r--node_modules/uglify-to-browserify/test/index.js22
7 files changed, 142 insertions, 0 deletions
diff --git a/node_modules/uglify-to-browserify/.npmignore b/node_modules/uglify-to-browserify/.npmignore
new file mode 100644
index 000000000..66d015baf
--- /dev/null
+++ b/node_modules/uglify-to-browserify/.npmignore
@@ -0,0 +1,14 @@
+lib-cov
+*.seed
+*.log
+*.csv
+*.dat
+*.out
+*.pid
+*.gz
+pids
+logs
+results
+npm-debug.log
+node_modules
+/test/output.js
diff --git a/node_modules/uglify-to-browserify/.travis.yml b/node_modules/uglify-to-browserify/.travis.yml
new file mode 100644
index 000000000..9a61f6bd7
--- /dev/null
+++ b/node_modules/uglify-to-browserify/.travis.yml
@@ -0,0 +1,3 @@
+language: node_js
+node_js:
+ - "0.10" \ No newline at end of file
diff --git a/node_modules/uglify-to-browserify/LICENSE b/node_modules/uglify-to-browserify/LICENSE
new file mode 100644
index 000000000..dfb0b19ea
--- /dev/null
+++ b/node_modules/uglify-to-browserify/LICENSE
@@ -0,0 +1,19 @@
+Copyright (c) 2013 Forbes Lindesay
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE. \ No newline at end of file
diff --git a/node_modules/uglify-to-browserify/README.md b/node_modules/uglify-to-browserify/README.md
new file mode 100644
index 000000000..99685da2b
--- /dev/null
+++ b/node_modules/uglify-to-browserify/README.md
@@ -0,0 +1,15 @@
+# uglify-to-browserify
+
+A transform to make UglifyJS work in browserify.
+
+[![Build Status](https://travis-ci.org/ForbesLindesay/uglify-to-browserify.png?branch=master)](https://travis-ci.org/ForbesLindesay/uglify-to-browserify)
+[![Dependency Status](https://gemnasium.com/ForbesLindesay/uglify-to-browserify.png)](https://gemnasium.com/ForbesLindesay/uglify-to-browserify)
+[![NPM version](https://badge.fury.io/js/uglify-to-browserify.png)](http://badge.fury.io/js/uglify-to-browserify)
+
+## Installation
+
+ npm install uglify-to-browserify
+
+## License
+
+ MIT \ No newline at end of file
diff --git a/node_modules/uglify-to-browserify/index.js b/node_modules/uglify-to-browserify/index.js
new file mode 100644
index 000000000..2cea629e6
--- /dev/null
+++ b/node_modules/uglify-to-browserify/index.js
@@ -0,0 +1,49 @@
+'use strict'
+
+var fs = require('fs')
+var PassThrough = require('stream').PassThrough
+var Transform = require('stream').Transform
+
+if (typeof Transform === 'undefined') {
+ throw new Error('UglifyJS only supports browserify when using node >= 0.10.x')
+}
+
+var cache = {}
+module.exports = transform
+function transform(file) {
+ if (!/tools\/node\.js$/.test(file.replace(/\\/g,'/'))) return new PassThrough();
+ if (cache[file]) return makeStream(cache[file])
+ var uglify = require(file)
+ var src = 'var sys = require("util");\nvar MOZ_SourceMap = require("source-map");\nvar UglifyJS = exports;\n' + uglify.FILES.map(function (path) { return fs.readFileSync(path, 'utf8') }).join('\n')
+
+ var ast = uglify.parse(src)
+ ast.figure_out_scope()
+
+ var variables = ast.variables
+ .map(function (node, name) {
+ return name
+ })
+
+ src += '\n\n' + variables.map(function (v) { return 'exports.' + v + ' = ' + v + ';' }).join('\n') + '\n\n'
+
+ src += 'exports.AST_Node.warn_function = function (txt) { if (typeof console != "undefined" && typeof console.warn === "function") console.warn(txt) }\n\n'
+
+ src += 'exports.minify = ' + uglify.minify.toString() + ';\n\n'
+ src += 'exports.describe_ast = ' + uglify.describe_ast.toString() + ';'
+
+ // TODO: remove once https://github.com/substack/node-browserify/issues/631 is resolved
+ src = src.replace(/"for"/g, '"fo" + "r"')
+
+ cache[file] = src
+ return makeStream(src);
+}
+
+function makeStream(src) {
+ var res = new Transform();
+ res._transform = function (chunk, encoding, callback) { callback() }
+ res._flush = function (callback) {
+ res.push(src)
+ callback()
+ }
+ return res;
+}
diff --git a/node_modules/uglify-to-browserify/package.json b/node_modules/uglify-to-browserify/package.json
new file mode 100644
index 000000000..24eed9b48
--- /dev/null
+++ b/node_modules/uglify-to-browserify/package.json
@@ -0,0 +1,20 @@
+{
+ "name": "uglify-to-browserify",
+ "version": "1.0.2",
+ "description": "A transform to make UglifyJS work in browserify.",
+ "keywords": [],
+ "dependencies": {},
+ "devDependencies": {
+ "uglify-js": "~2.4.0",
+ "source-map": "~0.1.27"
+ },
+ "scripts": {
+ "test": "node test/index.js"
+ },
+ "repository": {
+ "type": "git",
+ "url": "https://github.com/ForbesLindesay/uglify-to-browserify.git"
+ },
+ "author": "ForbesLindesay",
+ "license": "MIT"
+} \ No newline at end of file
diff --git a/node_modules/uglify-to-browserify/test/index.js b/node_modules/uglify-to-browserify/test/index.js
new file mode 100644
index 000000000..411789422
--- /dev/null
+++ b/node_modules/uglify-to-browserify/test/index.js
@@ -0,0 +1,22 @@
+var fs = require('fs')
+var br = require('../')
+var test = fs.readFileSync(require.resolve('uglify-js/test/run-tests.js'), 'utf8')
+ .replace(/^#.*\n/, '')
+
+var transform = br(require.resolve('uglify-js'))
+transform.pipe(fs.createWriteStream(__dirname + '/output.js'))
+ .on('close', function () {
+ Function('module,require', test)({
+ filename: require.resolve('uglify-js/test/run-tests.js')
+ },
+ function (name) {
+ if (name === '../tools/node') {
+ return require('./output.js')
+ } else if (/^[a-z]+$/.test(name)) {
+ return require(name)
+ } else {
+ throw new Error('I didn\'t expect you to require ' + name)
+ }
+ })
+ })
+transform.end(fs.readFileSync(require.resolve('uglify-js'), 'utf8')) \ No newline at end of file