diff options
| author | Teddy Wing | 2014-03-26 21:44:46 -0400 |
|---|---|---|
| committer | Teddy Wing | 2014-03-26 21:44:46 -0400 |
| commit | 996d3b473a35416fb6d13805ba22067031f1a2de (patch) | |
| tree | 6a2c06bd073d3c1d36028c223d54c66e65645032 /node_modules | |
| parent | b8d9210a27d977ac0cd474477e578e14358487aa (diff) | |
| download | GitHub-Show-Full-Commit-Message-Bookmarklet-996d3b473a35416fb6d13805ba22067031f1a2de.tar.bz2 | |
Remove 'boomlet', install 'bookmarklet' package
Diffstat (limited to 'node_modules')
| l--------- | node_modules/.bin/bookmarklet | 1 | ||||
| l--------- | node_modules/.bin/boomlet | 1 | ||||
| -rw-r--r-- | node_modules/bookmarklet/.npmignore (renamed from node_modules/boomlet/node_modules/uglify-js/node_modules/optimist/node_modules/wordwrap/.npmignore) | 0 | ||||
| -rw-r--r-- | node_modules/bookmarklet/README.md | 24 | ||||
| -rwxr-xr-x | node_modules/bookmarklet/bin/bookmarklet | 90 | ||||
| -rw-r--r-- | node_modules/bookmarklet/bookmarklet.js | 148 | ||||
| l--------- | node_modules/bookmarklet/node_modules/.bin/uglifyjs (renamed from node_modules/boomlet/node_modules/.bin/uglifyjs) | 0 | ||||
| -rw-r--r-- | node_modules/bookmarklet/node_modules/uglify-js/.npmignore (renamed from node_modules/boomlet/node_modules/uglify-js/.npmignore) | 0 | ||||
| -rw-r--r-- | node_modules/bookmarklet/node_modules/uglify-js/README.md (renamed from node_modules/boomlet/node_modules/uglify-js/README.md) | 378 | ||||
| -rwxr-xr-x | node_modules/bookmarklet/node_modules/uglify-js/bin/uglifyjs (renamed from node_modules/boomlet/node_modules/uglify-js/bin/uglifyjs) | 284 | ||||
| -rw-r--r-- | node_modules/bookmarklet/node_modules/uglify-js/lib/ast.js (renamed from node_modules/boomlet/node_modules/uglify-js/lib/ast.js) | 72 | ||||
| -rw-r--r-- | node_modules/bookmarklet/node_modules/uglify-js/lib/compress.js (renamed from node_modules/boomlet/node_modules/uglify-js/lib/compress.js) | 732 | ||||
| -rw-r--r-- | node_modules/bookmarklet/node_modules/uglify-js/lib/mozilla-ast.js (renamed from node_modules/boomlet/node_modules/uglify-js/lib/mozilla-ast.js) | 6 | ||||
| -rw-r--r-- | node_modules/bookmarklet/node_modules/uglify-js/lib/output.js (renamed from node_modules/boomlet/node_modules/uglify-js/lib/output.js) | 184 | ||||
| -rw-r--r-- | node_modules/bookmarklet/node_modules/uglify-js/lib/parse.js (renamed from node_modules/boomlet/node_modules/uglify-js/lib/parse.js) | 186 | ||||
| -rw-r--r-- | node_modules/bookmarklet/node_modules/uglify-js/lib/scope.js (renamed from node_modules/boomlet/node_modules/uglify-js/lib/scope.js) | 135 | ||||
| -rw-r--r-- | node_modules/bookmarklet/node_modules/uglify-js/lib/sourcemap.js (renamed from node_modules/boomlet/node_modules/uglify-js/lib/sourcemap.js) | 10 | ||||
| -rw-r--r-- | node_modules/bookmarklet/node_modules/uglify-js/lib/transform.js (renamed from node_modules/boomlet/node_modules/uglify-js/lib/transform.js) | 2 | ||||
| -rw-r--r-- | node_modules/bookmarklet/node_modules/uglify-js/lib/utils.js (renamed from node_modules/boomlet/node_modules/uglify-js/lib/utils.js) | 16 | ||||
| -rw-r--r-- | node_modules/bookmarklet/node_modules/uglify-js/node_modules/optimist/.travis.yml (renamed from node_modules/boomlet/node_modules/uglify-js/node_modules/optimist/.travis.yml) | 0 | ||||
| -rw-r--r-- | node_modules/bookmarklet/node_modules/uglify-js/node_modules/optimist/LICENSE (renamed from node_modules/boomlet/node_modules/uglify-js/node_modules/optimist/LICENSE) | 0 | ||||
| -rw-r--r-- | node_modules/bookmarklet/node_modules/uglify-js/node_modules/optimist/example/bool.js (renamed from node_modules/boomlet/node_modules/uglify-js/node_modules/optimist/example/bool.js) | 0 | ||||
| -rw-r--r-- | node_modules/bookmarklet/node_modules/uglify-js/node_modules/optimist/example/boolean_double.js (renamed from node_modules/boomlet/node_modules/uglify-js/node_modules/optimist/example/boolean_double.js) | 0 | ||||
| -rw-r--r-- | node_modules/bookmarklet/node_modules/uglify-js/node_modules/optimist/example/boolean_single.js (renamed from node_modules/boomlet/node_modules/uglify-js/node_modules/optimist/example/boolean_single.js) | 0 | ||||
| -rw-r--r-- | node_modules/bookmarklet/node_modules/uglify-js/node_modules/optimist/example/default_hash.js (renamed from node_modules/boomlet/node_modules/uglify-js/node_modules/optimist/example/default_hash.js) | 0 | ||||
| -rw-r--r-- | node_modules/bookmarklet/node_modules/uglify-js/node_modules/optimist/example/default_singles.js (renamed from node_modules/boomlet/node_modules/uglify-js/node_modules/optimist/example/default_singles.js) | 0 | ||||
| -rw-r--r-- | node_modules/bookmarklet/node_modules/uglify-js/node_modules/optimist/example/divide.js (renamed from node_modules/boomlet/node_modules/uglify-js/node_modules/optimist/example/divide.js) | 0 | ||||
| -rw-r--r-- | node_modules/bookmarklet/node_modules/uglify-js/node_modules/optimist/example/line_count.js (renamed from node_modules/boomlet/node_modules/uglify-js/node_modules/optimist/example/line_count.js) | 0 | ||||
| -rw-r--r-- | node_modules/bookmarklet/node_modules/uglify-js/node_modules/optimist/example/line_count_options.js (renamed from node_modules/boomlet/node_modules/uglify-js/node_modules/optimist/example/line_count_options.js) | 0 | ||||
| -rw-r--r-- | node_modules/bookmarklet/node_modules/uglify-js/node_modules/optimist/example/line_count_wrap.js (renamed from node_modules/boomlet/node_modules/uglify-js/node_modules/optimist/example/line_count_wrap.js) | 0 | ||||
| -rw-r--r-- | node_modules/bookmarklet/node_modules/uglify-js/node_modules/optimist/example/nonopt.js (renamed from node_modules/boomlet/node_modules/uglify-js/node_modules/optimist/example/nonopt.js) | 0 | ||||
| -rw-r--r-- | node_modules/bookmarklet/node_modules/uglify-js/node_modules/optimist/example/reflect.js (renamed from node_modules/boomlet/node_modules/uglify-js/node_modules/optimist/example/reflect.js) | 0 | ||||
| -rw-r--r-- | node_modules/bookmarklet/node_modules/uglify-js/node_modules/optimist/example/short.js (renamed from node_modules/boomlet/node_modules/uglify-js/node_modules/optimist/example/short.js) | 0 | ||||
| -rw-r--r-- | node_modules/bookmarklet/node_modules/uglify-js/node_modules/optimist/example/string.js (renamed from node_modules/boomlet/node_modules/uglify-js/node_modules/optimist/example/string.js) | 0 | ||||
| -rw-r--r-- | node_modules/bookmarklet/node_modules/uglify-js/node_modules/optimist/example/usage-options.js (renamed from node_modules/boomlet/node_modules/uglify-js/node_modules/optimist/example/usage-options.js) | 0 | ||||
| -rw-r--r-- | node_modules/bookmarklet/node_modules/uglify-js/node_modules/optimist/example/xup.js (renamed from node_modules/boomlet/node_modules/uglify-js/node_modules/optimist/example/xup.js) | 0 | ||||
| -rw-r--r-- | node_modules/bookmarklet/node_modules/uglify-js/node_modules/optimist/index.js (renamed from node_modules/boomlet/node_modules/uglify-js/node_modules/optimist/index.js) | 0 | ||||
| -rw-r--r-- | node_modules/bookmarklet/node_modules/uglify-js/node_modules/optimist/node_modules/wordwrap/.npmignore (renamed from node_modules/boomlet/node_modules/open/.jshintignore) | 1 | ||||
| -rw-r--r-- | node_modules/bookmarklet/node_modules/uglify-js/node_modules/optimist/node_modules/wordwrap/README.markdown (renamed from node_modules/boomlet/node_modules/uglify-js/node_modules/optimist/node_modules/wordwrap/README.markdown) | 0 | ||||
| -rw-r--r-- | node_modules/bookmarklet/node_modules/uglify-js/node_modules/optimist/node_modules/wordwrap/example/center.js (renamed from node_modules/boomlet/node_modules/uglify-js/node_modules/optimist/node_modules/wordwrap/example/center.js) | 0 | ||||
| -rw-r--r-- | node_modules/bookmarklet/node_modules/uglify-js/node_modules/optimist/node_modules/wordwrap/example/meat.js (renamed from node_modules/boomlet/node_modules/uglify-js/node_modules/optimist/node_modules/wordwrap/example/meat.js) | 0 | ||||
| -rw-r--r-- | node_modules/bookmarklet/node_modules/uglify-js/node_modules/optimist/node_modules/wordwrap/index.js (renamed from node_modules/boomlet/node_modules/uglify-js/node_modules/optimist/node_modules/wordwrap/index.js) | 0 | ||||
| -rw-r--r-- | node_modules/bookmarklet/node_modules/uglify-js/node_modules/optimist/node_modules/wordwrap/package.json (renamed from node_modules/boomlet/node_modules/uglify-js/node_modules/optimist/node_modules/wordwrap/package.json) | 0 | ||||
| -rw-r--r-- | node_modules/bookmarklet/node_modules/uglify-js/node_modules/optimist/node_modules/wordwrap/test/break.js (renamed from node_modules/boomlet/node_modules/uglify-js/node_modules/optimist/node_modules/wordwrap/test/break.js) | 0 | ||||
| -rw-r--r-- | node_modules/bookmarklet/node_modules/uglify-js/node_modules/optimist/node_modules/wordwrap/test/idleness.txt (renamed from node_modules/boomlet/node_modules/uglify-js/node_modules/optimist/node_modules/wordwrap/test/idleness.txt) | 0 | ||||
| -rw-r--r-- | node_modules/bookmarklet/node_modules/uglify-js/node_modules/optimist/node_modules/wordwrap/test/wrap.js (renamed from node_modules/boomlet/node_modules/uglify-js/node_modules/optimist/node_modules/wordwrap/test/wrap.js) | 0 | ||||
| -rw-r--r-- | node_modules/bookmarklet/node_modules/uglify-js/node_modules/optimist/package.json (renamed from node_modules/boomlet/node_modules/uglify-js/node_modules/optimist/package.json) | 0 | ||||
| -rw-r--r-- | node_modules/bookmarklet/node_modules/uglify-js/node_modules/optimist/readme.markdown (renamed from node_modules/boomlet/node_modules/uglify-js/node_modules/optimist/readme.markdown) | 0 | ||||
| -rw-r--r-- | node_modules/bookmarklet/node_modules/uglify-js/node_modules/optimist/test/_.js (renamed from node_modules/boomlet/node_modules/uglify-js/node_modules/optimist/test/_.js) | 0 | ||||
| -rw-r--r-- | node_modules/bookmarklet/node_modules/uglify-js/node_modules/optimist/test/_/argv.js (renamed from node_modules/boomlet/node_modules/uglify-js/node_modules/optimist/test/_/argv.js) | 0 | ||||
| -rwxr-xr-x | node_modules/bookmarklet/node_modules/uglify-js/node_modules/optimist/test/_/bin.js (renamed from node_modules/boomlet/node_modules/uglify-js/node_modules/optimist/test/_/bin.js) | 0 | ||||
| -rw-r--r-- | node_modules/bookmarklet/node_modules/uglify-js/node_modules/optimist/test/parse.js (renamed from node_modules/boomlet/node_modules/uglify-js/node_modules/optimist/test/parse.js) | 0 | ||||
| -rw-r--r-- | node_modules/bookmarklet/node_modules/uglify-js/node_modules/optimist/test/usage.js (renamed from node_modules/boomlet/node_modules/uglify-js/node_modules/optimist/test/usage.js) | 0 | ||||
| -rw-r--r-- | node_modules/bookmarklet/node_modules/uglify-js/node_modules/source-map/.npmignore (renamed from node_modules/boomlet/node_modules/uglify-js/node_modules/source-map/.npmignore) | 0 | ||||
| -rw-r--r-- | node_modules/bookmarklet/node_modules/uglify-js/node_modules/source-map/.travis.yml (renamed from node_modules/boomlet/node_modules/uglify-js/node_modules/source-map/.travis.yml) | 0 | ||||
| -rw-r--r-- | node_modules/bookmarklet/node_modules/uglify-js/node_modules/source-map/CHANGELOG.md (renamed from node_modules/boomlet/node_modules/uglify-js/node_modules/source-map/CHANGELOG.md) | 0 | ||||
| -rw-r--r-- | node_modules/bookmarklet/node_modules/uglify-js/node_modules/source-map/LICENSE (renamed from node_modules/boomlet/node_modules/uglify-js/node_modules/source-map/LICENSE) | 0 | ||||
| -rw-r--r-- | node_modules/bookmarklet/node_modules/uglify-js/node_modules/source-map/Makefile.dryice.js (renamed from node_modules/boomlet/node_modules/uglify-js/node_modules/source-map/Makefile.dryice.js) | 0 | ||||
| -rw-r--r-- | node_modules/bookmarklet/node_modules/uglify-js/node_modules/source-map/README.md (renamed from node_modules/boomlet/node_modules/uglify-js/node_modules/source-map/README.md) | 0 | ||||
| -rw-r--r-- | node_modules/bookmarklet/node_modules/uglify-js/node_modules/source-map/build/assert-shim.js (renamed from node_modules/boomlet/node_modules/uglify-js/node_modules/source-map/build/assert-shim.js) | 0 | ||||
| -rw-r--r-- | node_modules/bookmarklet/node_modules/uglify-js/node_modules/source-map/build/mini-require.js (renamed from node_modules/boomlet/node_modules/uglify-js/node_modules/source-map/build/mini-require.js) | 0 | ||||
| -rw-r--r-- | node_modules/bookmarklet/node_modules/uglify-js/node_modules/source-map/build/prefix-source-map.jsm (renamed from node_modules/boomlet/node_modules/uglify-js/node_modules/source-map/build/prefix-source-map.jsm) | 0 | ||||
| -rw-r--r-- | node_modules/bookmarklet/node_modules/uglify-js/node_modules/source-map/build/prefix-utils.jsm (renamed from node_modules/boomlet/node_modules/uglify-js/node_modules/source-map/build/prefix-utils.jsm) | 0 | ||||
| -rw-r--r-- | node_modules/bookmarklet/node_modules/uglify-js/node_modules/source-map/build/suffix-browser.js (renamed from node_modules/boomlet/node_modules/uglify-js/node_modules/source-map/build/suffix-browser.js) | 0 | ||||
| -rw-r--r-- | node_modules/bookmarklet/node_modules/uglify-js/node_modules/source-map/build/suffix-source-map.jsm (renamed from node_modules/boomlet/node_modules/uglify-js/node_modules/source-map/build/suffix-source-map.jsm) | 0 | ||||
| -rw-r--r-- | node_modules/bookmarklet/node_modules/uglify-js/node_modules/source-map/build/suffix-utils.jsm (renamed from node_modules/boomlet/node_modules/uglify-js/node_modules/source-map/build/suffix-utils.jsm) | 0 | ||||
| -rw-r--r-- | node_modules/bookmarklet/node_modules/uglify-js/node_modules/source-map/build/test-prefix.js (renamed from node_modules/boomlet/node_modules/uglify-js/node_modules/source-map/build/test-prefix.js) | 0 | ||||
| -rw-r--r-- | node_modules/bookmarklet/node_modules/uglify-js/node_modules/source-map/build/test-suffix.js (renamed from node_modules/boomlet/node_modules/uglify-js/node_modules/source-map/build/test-suffix.js) | 0 | ||||
| -rw-r--r-- | node_modules/bookmarklet/node_modules/uglify-js/node_modules/source-map/lib/source-map.js (renamed from node_modules/boomlet/node_modules/uglify-js/node_modules/source-map/lib/source-map.js) | 0 | ||||
| -rw-r--r-- | node_modules/bookmarklet/node_modules/uglify-js/node_modules/source-map/lib/source-map/array-set.js (renamed from node_modules/boomlet/node_modules/uglify-js/node_modules/source-map/lib/source-map/array-set.js) | 0 | ||||
| -rw-r--r-- | node_modules/bookmarklet/node_modules/uglify-js/node_modules/source-map/lib/source-map/base64-vlq.js (renamed from node_modules/boomlet/node_modules/uglify-js/node_modules/source-map/lib/source-map/base64-vlq.js) | 0 | ||||
| -rw-r--r-- | node_modules/bookmarklet/node_modules/uglify-js/node_modules/source-map/lib/source-map/base64.js (renamed from node_modules/boomlet/node_modules/uglify-js/node_modules/source-map/lib/source-map/base64.js) | 0 | ||||
| -rw-r--r-- | node_modules/bookmarklet/node_modules/uglify-js/node_modules/source-map/lib/source-map/binary-search.js (renamed from node_modules/boomlet/node_modules/uglify-js/node_modules/source-map/lib/source-map/binary-search.js) | 0 | ||||
| -rw-r--r-- | node_modules/bookmarklet/node_modules/uglify-js/node_modules/source-map/lib/source-map/source-map-consumer.js (renamed from node_modules/boomlet/node_modules/uglify-js/node_modules/source-map/lib/source-map/source-map-consumer.js) | 0 | ||||
| -rw-r--r-- | node_modules/bookmarklet/node_modules/uglify-js/node_modules/source-map/lib/source-map/source-map-generator.js (renamed from node_modules/boomlet/node_modules/uglify-js/node_modules/source-map/lib/source-map/source-map-generator.js) | 0 | ||||
| -rw-r--r-- | node_modules/bookmarklet/node_modules/uglify-js/node_modules/source-map/lib/source-map/source-node.js (renamed from node_modules/boomlet/node_modules/uglify-js/node_modules/source-map/lib/source-map/source-node.js) | 0 | ||||
| -rw-r--r-- | node_modules/bookmarklet/node_modules/uglify-js/node_modules/source-map/lib/source-map/util.js (renamed from node_modules/boomlet/node_modules/uglify-js/node_modules/source-map/lib/source-map/util.js) | 0 | ||||
| -rw-r--r-- | node_modules/bookmarklet/node_modules/uglify-js/node_modules/source-map/node_modules/amdefine/LICENSE (renamed from node_modules/boomlet/node_modules/uglify-js/node_modules/source-map/node_modules/amdefine/LICENSE) | 0 | ||||
| -rw-r--r-- | node_modules/bookmarklet/node_modules/uglify-js/node_modules/source-map/node_modules/amdefine/README.md (renamed from node_modules/boomlet/node_modules/uglify-js/node_modules/source-map/node_modules/amdefine/README.md) | 0 | ||||
| -rw-r--r-- | node_modules/bookmarklet/node_modules/uglify-js/node_modules/source-map/node_modules/amdefine/amdefine.js (renamed from node_modules/boomlet/node_modules/uglify-js/node_modules/source-map/node_modules/amdefine/amdefine.js) | 0 | ||||
| -rw-r--r-- | node_modules/bookmarklet/node_modules/uglify-js/node_modules/source-map/node_modules/amdefine/intercept.js (renamed from node_modules/boomlet/node_modules/uglify-js/node_modules/source-map/node_modules/amdefine/intercept.js) | 0 | ||||
| -rw-r--r-- | node_modules/bookmarklet/node_modules/uglify-js/node_modules/source-map/node_modules/amdefine/package.json (renamed from node_modules/boomlet/node_modules/uglify-js/node_modules/source-map/node_modules/amdefine/package.json) | 0 | ||||
| -rw-r--r-- | node_modules/bookmarklet/node_modules/uglify-js/node_modules/source-map/package.json (renamed from node_modules/boomlet/node_modules/uglify-js/node_modules/source-map/package.json) | 2 | ||||
| -rwxr-xr-x | node_modules/bookmarklet/node_modules/uglify-js/node_modules/source-map/test/run-tests.js (renamed from node_modules/boomlet/node_modules/uglify-js/node_modules/source-map/test/run-tests.js) | 0 | ||||
| -rw-r--r-- | node_modules/bookmarklet/node_modules/uglify-js/node_modules/source-map/test/source-map/test-api.js (renamed from node_modules/boomlet/node_modules/uglify-js/node_modules/source-map/test/source-map/test-api.js) | 0 | ||||
| -rw-r--r-- | node_modules/bookmarklet/node_modules/uglify-js/node_modules/source-map/test/source-map/test-array-set.js (renamed from node_modules/boomlet/node_modules/uglify-js/node_modules/source-map/test/source-map/test-array-set.js) | 0 | ||||
| -rw-r--r-- | node_modules/bookmarklet/node_modules/uglify-js/node_modules/source-map/test/source-map/test-base64-vlq.js (renamed from node_modules/boomlet/node_modules/uglify-js/node_modules/source-map/test/source-map/test-base64-vlq.js) | 0 | ||||
| -rw-r--r-- | node_modules/bookmarklet/node_modules/uglify-js/node_modules/source-map/test/source-map/test-base64.js (renamed from node_modules/boomlet/node_modules/uglify-js/node_modules/source-map/test/source-map/test-base64.js) | 0 | ||||
| -rw-r--r-- | node_modules/bookmarklet/node_modules/uglify-js/node_modules/source-map/test/source-map/test-binary-search.js (renamed from node_modules/boomlet/node_modules/uglify-js/node_modules/source-map/test/source-map/test-binary-search.js) | 0 | ||||
| -rw-r--r-- | node_modules/bookmarklet/node_modules/uglify-js/node_modules/source-map/test/source-map/test-dog-fooding.js (renamed from node_modules/boomlet/node_modules/uglify-js/node_modules/source-map/test/source-map/test-dog-fooding.js) | 0 | ||||
| -rw-r--r-- | node_modules/bookmarklet/node_modules/uglify-js/node_modules/source-map/test/source-map/test-source-map-consumer.js (renamed from node_modules/boomlet/node_modules/uglify-js/node_modules/source-map/test/source-map/test-source-map-consumer.js) | 0 | ||||
| -rw-r--r-- | node_modules/bookmarklet/node_modules/uglify-js/node_modules/source-map/test/source-map/test-source-map-generator.js (renamed from node_modules/boomlet/node_modules/uglify-js/node_modules/source-map/test/source-map/test-source-map-generator.js) | 0 | ||||
| -rw-r--r-- | node_modules/bookmarklet/node_modules/uglify-js/node_modules/source-map/test/source-map/test-source-node.js (renamed from node_modules/boomlet/node_modules/uglify-js/node_modules/source-map/test/source-map/test-source-node.js) | 0 | ||||
| -rw-r--r-- | node_modules/bookmarklet/node_modules/uglify-js/node_modules/source-map/test/source-map/test-util.js (renamed from node_modules/boomlet/node_modules/uglify-js/node_modules/source-map/test/source-map/test-util.js) | 0 | ||||
| -rw-r--r-- | node_modules/bookmarklet/node_modules/uglify-js/node_modules/source-map/test/source-map/util.js (renamed from node_modules/boomlet/node_modules/uglify-js/node_modules/source-map/test/source-map/util.js) | 0 | ||||
| -rw-r--r-- | node_modules/bookmarklet/node_modules/uglify-js/package.json | 48 | ||||
| -rw-r--r-- | node_modules/bookmarklet/node_modules/uglify-js/test/compress/arrays.js | 12 | ||||
| -rw-r--r-- | node_modules/bookmarklet/node_modules/uglify-js/test/compress/blocks.js (renamed from node_modules/boomlet/node_modules/uglify-js/test/compress/blocks.js) | 0 | ||||
| -rw-r--r-- | node_modules/bookmarklet/node_modules/uglify-js/test/compress/conditionals.js (renamed from node_modules/boomlet/node_modules/uglify-js/test/compress/conditionals.js) | 91 | ||||
| -rw-r--r-- | node_modules/bookmarklet/node_modules/uglify-js/test/compress/dead-code.js (renamed from node_modules/boomlet/node_modules/uglify-js/test/compress/dead-code.js) | 0 | ||||
| -rw-r--r-- | node_modules/bookmarklet/node_modules/uglify-js/test/compress/debugger.js (renamed from node_modules/boomlet/node_modules/uglify-js/test/compress/debugger.js) | 0 | ||||
| -rw-r--r-- | node_modules/bookmarklet/node_modules/uglify-js/test/compress/drop-unused.js (renamed from node_modules/boomlet/node_modules/uglify-js/test/compress/drop-unused.js) | 68 | ||||
| -rw-r--r-- | node_modules/bookmarklet/node_modules/uglify-js/test/compress/issue-105.js (renamed from node_modules/boomlet/node_modules/uglify-js/test/compress/issue-105.js) | 14 | ||||
| -rw-r--r-- | node_modules/bookmarklet/node_modules/uglify-js/test/compress/issue-12.js (renamed from node_modules/boomlet/node_modules/uglify-js/test/compress/issue-12.js) | 0 | ||||
| -rw-r--r-- | node_modules/bookmarklet/node_modules/uglify-js/test/compress/issue-22.js (renamed from node_modules/boomlet/node_modules/uglify-js/test/compress/issue-22.js) | 0 | ||||
| -rw-r--r-- | node_modules/bookmarklet/node_modules/uglify-js/test/compress/issue-44.js (renamed from node_modules/boomlet/node_modules/uglify-js/test/compress/issue-44.js) | 0 | ||||
| -rw-r--r-- | node_modules/bookmarklet/node_modules/uglify-js/test/compress/issue-59.js (renamed from node_modules/boomlet/node_modules/uglify-js/test/compress/issue-59.js) | 0 | ||||
| -rw-r--r-- | node_modules/bookmarklet/node_modules/uglify-js/test/compress/labels.js (renamed from node_modules/boomlet/node_modules/uglify-js/test/compress/labels.js) | 0 | ||||
| -rw-r--r-- | node_modules/bookmarklet/node_modules/uglify-js/test/compress/loops.js (renamed from node_modules/boomlet/node_modules/uglify-js/test/compress/loops.js) | 0 | ||||
| -rw-r--r-- | node_modules/bookmarklet/node_modules/uglify-js/test/compress/properties.js | 25 | ||||
| -rw-r--r-- | node_modules/bookmarklet/node_modules/uglify-js/test/compress/sequences.js (renamed from node_modules/boomlet/node_modules/uglify-js/test/compress/sequences.js) | 6 | ||||
| -rw-r--r-- | node_modules/bookmarklet/node_modules/uglify-js/test/compress/switch.js (renamed from node_modules/boomlet/node_modules/uglify-js/test/compress/switch.js) | 50 | ||||
| -rwxr-xr-x | node_modules/bookmarklet/node_modules/uglify-js/test/run-tests.js (renamed from node_modules/boomlet/node_modules/uglify-js/test/run-tests.js) | 9 | ||||
| -rw-r--r-- | node_modules/bookmarklet/node_modules/uglify-js/tools/node.js (renamed from node_modules/boomlet/node_modules/uglify-js/tools/node.js) | 60 | ||||
| -rw-r--r-- | node_modules/bookmarklet/package.json | 38 | ||||
| -rw-r--r-- | node_modules/bookmarklet/test/test.bookmarklet.js | 18 | ||||
| -rw-r--r-- | node_modules/boomlet/LICENSE | 21 | ||||
| -rw-r--r-- | node_modules/boomlet/README.md | 71 | ||||
| -rwxr-xr-x | node_modules/boomlet/bin/boomlet | 5 | ||||
| -rw-r--r-- | node_modules/boomlet/lib/boomlet.html | 24 | ||||
| -rw-r--r-- | node_modules/boomlet/lib/main.js | 34 | ||||
| -rw-r--r-- | node_modules/boomlet/node_modules/open/.jshintrc | 27 | ||||
| -rw-r--r-- | node_modules/boomlet/node_modules/open/.npmignore | 1 | ||||
| -rw-r--r-- | node_modules/boomlet/node_modules/open/LICENSE | 22 | ||||
| -rw-r--r-- | node_modules/boomlet/node_modules/open/README.md | 33 | ||||
| -rw-r--r-- | node_modules/boomlet/node_modules/open/lib/open.js | 60 | ||||
| -rw-r--r-- | node_modules/boomlet/node_modules/open/package.json | 48 | ||||
| -rwxr-xr-x | node_modules/boomlet/node_modules/open/vendor/xdg-open | 767 | ||||
| -rw-r--r-- | node_modules/boomlet/node_modules/uglify-js/.travis.yml | 6 | ||||
| -rw-r--r-- | node_modules/boomlet/node_modules/uglify-js/LICENSE | 29 | ||||
| -rw-r--r-- | node_modules/boomlet/node_modules/uglify-js/node_modules/async/LICENSE | 19 | ||||
| -rw-r--r-- | node_modules/boomlet/node_modules/uglify-js/node_modules/async/README.md | 1425 | ||||
| -rw-r--r-- | node_modules/boomlet/node_modules/uglify-js/node_modules/async/component.json | 11 | ||||
| -rwxr-xr-x | node_modules/boomlet/node_modules/uglify-js/node_modules/async/lib/async.js | 958 | ||||
| -rw-r--r-- | node_modules/boomlet/node_modules/uglify-js/node_modules/async/package.json | 43 | ||||
| -rw-r--r-- | node_modules/boomlet/node_modules/uglify-js/node_modules/uglify-to-browserify/.npmignore | 14 | ||||
| -rw-r--r-- | node_modules/boomlet/node_modules/uglify-js/node_modules/uglify-to-browserify/.travis.yml | 3 | ||||
| -rw-r--r-- | node_modules/boomlet/node_modules/uglify-js/node_modules/uglify-to-browserify/LICENSE | 19 | ||||
| -rw-r--r-- | node_modules/boomlet/node_modules/uglify-js/node_modules/uglify-to-browserify/README.md | 15 | ||||
| -rw-r--r-- | node_modules/boomlet/node_modules/uglify-js/node_modules/uglify-to-browserify/index.js | 49 | ||||
| -rw-r--r-- | node_modules/boomlet/node_modules/uglify-js/node_modules/uglify-to-browserify/package.json | 34 | ||||
| -rw-r--r-- | node_modules/boomlet/node_modules/uglify-js/node_modules/uglify-to-browserify/test/index.js | 22 | ||||
| -rw-r--r-- | node_modules/boomlet/node_modules/uglify-js/package.json | 49 | ||||
| -rw-r--r-- | node_modules/boomlet/node_modules/uglify-js/test/compress/arrays.js | 74 | ||||
| -rw-r--r-- | node_modules/boomlet/node_modules/uglify-js/test/compress/concat-strings.js | 22 | ||||
| -rw-r--r-- | node_modules/boomlet/node_modules/uglify-js/test/compress/issue-126.js | 24 | ||||
| -rw-r--r-- | node_modules/boomlet/node_modules/uglify-js/test/compress/issue-143.js | 48 | ||||
| -rw-r--r-- | node_modules/boomlet/node_modules/uglify-js/test/compress/issue-267.js | 11 | ||||
| -rw-r--r-- | node_modules/boomlet/node_modules/uglify-js/test/compress/issue-269.js | 66 | ||||
| -rw-r--r-- | node_modules/boomlet/node_modules/uglify-js/test/compress/negate-iife.js | 76 | ||||
| -rw-r--r-- | node_modules/boomlet/node_modules/uglify-js/test/compress/properties.js | 54 | ||||
| -rw-r--r-- | node_modules/boomlet/node_modules/uglify-js/test/compress/typeof.js | 25 | ||||
| -rw-r--r-- | node_modules/boomlet/package.json | 38 |
153 files changed, 1059 insertions, 5899 deletions
diff --git a/node_modules/.bin/bookmarklet b/node_modules/.bin/bookmarklet new file mode 120000 index 0000000..df7cf56 --- /dev/null +++ b/node_modules/.bin/bookmarklet @@ -0,0 +1 @@ +../bookmarklet/bin/bookmarklet
\ No newline at end of file diff --git a/node_modules/.bin/boomlet b/node_modules/.bin/boomlet deleted file mode 120000 index 7e8e892..0000000 --- a/node_modules/.bin/boomlet +++ /dev/null @@ -1 +0,0 @@ -../boomlet/bin/boomlet
\ No newline at end of file diff --git a/node_modules/boomlet/node_modules/uglify-js/node_modules/optimist/node_modules/wordwrap/.npmignore b/node_modules/bookmarklet/.npmignore index 3c3629e..3c3629e 100644 --- a/node_modules/boomlet/node_modules/uglify-js/node_modules/optimist/node_modules/wordwrap/.npmignore +++ b/node_modules/bookmarklet/.npmignore diff --git a/node_modules/bookmarklet/README.md b/node_modules/bookmarklet/README.md new file mode 100644 index 0000000..fa6e4ab --- /dev/null +++ b/node_modules/bookmarklet/README.md @@ -0,0 +1,24 @@ + +Bookmarklet: sane development, familiar format +============================================== + +Bookmarklet is a nodejs module for compiling bookmarklets in server-side code and directly from the shell. You can run it on any JavaScript file—it will minify it using uglify-js, wrap it in a self executing function, and return an escaped bookmarklet. + +More so, it supports a metadata block—modeled after the [greasemonkey userscript metadata block](http://wiki.greasespot.net/Metadata_Block)—to specify metadata, external stylesheets and script includes, which can look like this: + + // ==Bookmarklet== + // @name LoveGames + // @author Old Gregg + // @style http://www.cornify.com/css/cornify.css + // @script https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js + // ==/Bookmarklet== + +Most notably, you can specify any external scripts that you’d like your bookmarklet to include via the `@script` rule, which can be repeated as many times as you’d like. + +NOTE: currently with script includes you have to handle `noConflict` scenarios yourself, e.g., you might want to start off a script with `var $ = jQuery.noConflict(true)`. + +In addition, any css files included with `@style` will be injected. + +This project is new and open to suggestions & pull requests. + +Also, if you’re just looking for a quick way to throw together a bookmarklet, try my [browser-based bookmarklet creator](http://mrcoles.com/bookmarklet/). diff --git a/node_modules/bookmarklet/bin/bookmarklet b/node_modules/bookmarklet/bin/bookmarklet new file mode 100755 index 0000000..eeafbe2 --- /dev/null +++ b/node_modules/bookmarklet/bin/bookmarklet @@ -0,0 +1,90 @@ +#!/usr/bin/env node + +var path = require('path'), + fs = require('fs'), + util = require('util'), + bookmarklet = require('bookmarklet'); + // XXX - what's the right way to do this in dev vs prod? + // bookmarklet = require('../bookmarklet'); + + +// +// Input parsing +// + +var args = process.argv.slice(2); + +function help() { + util.puts(['Bookmarklet v' + bookmarklet.version.join('.') + + ' usage: bookmarklet source [destination]', + '', + 'source - path to file to read from or `-` for stdin', + 'destination - path to file to write to', + '', + 'More info: https://github.com/mrcoles/bookmarklet' + ].join('\n') + '\n'); +} + +function die(msg) { + msg && util.puts('[ERROR] bookmarklet: ' + msg); + process.exit(1); +} + +function warn(msg) { + util.puts('[WARN] bookmarklet: ' + msg); +} + +if (args.length == 0 || {'-h':1, '--help':1}[args[0]]) { + help(); + process.exit(0); +} + +if (args.length > 2) { + die('invalid arguments, run with --help to see usage.\n\n'); +} + +var source = args[0], + destination = args[1]; + +if (source && source[0] != '/' && source != '-') { + source = path.join(process.cwd(), source); +} +if (destination && destination[0] != '/') { + destination = path.join(process.cwd(), destination); +} + + +// +// Main +// + +function dataCallback(e, data) { + if (e) { + die(e.message); + } + + data = bookmarklet.parseFile(data); + + if (data.errors) { + die(data.errors.join('\n')); + } + + var code = bookmarklet.convert(data.code, data.options); + util.print(code + '\n'); +}; + +if (source != '-') { + fs.readFile(source, 'utf8', dataCallback); +} else { + process.stdin.resume(); + process.stdin.setEncoding('utf8'); + + var buffer = ''; + process.stdin.on('data', function(data) { + buffer += data; + }); + + process.stdin.on('end', function() { + dataCallback(false, buffer); + }); +} diff --git a/node_modules/bookmarklet/bookmarklet.js b/node_modules/bookmarklet/bookmarklet.js new file mode 100644 index 0000000..d74a87d --- /dev/null +++ b/node_modules/bookmarklet/bookmarklet.js @@ -0,0 +1,148 @@ + +var version = [0, 0, 4]; + +var uglify = require('uglify-js'); + +// metadata +var str = 1, + list = 2, + metadata = { + types: { + string: str, + list: list + }, + keys: { + name: str, + version: str, + description: str, + repository: str, + author: str, + email: str, + url: str, + license: str, + script: list, + style: list + } + }; + +function quoteEscape(x) { + return x.replace('"', '\\"').replace("'", "\\'"); +} + +function loadScript(code, path) { + return ('' + + 'function callback(){' + // + (isJQuery ? '(function($){var jQuery=$;' : '') + + code + // + (isJQuery ? '})(jQuery.noConflict(true))' : '') + + '}' + + 'var s = document.createElement("script");' + + 'if (s.addEventListener) {' + + ' s.addEventListener("load", callback, false)' + + '} else if (s.readyState) {' + + ' s.onreadystatechange = callback' + + '}' + + 's.src = "' + quoteEscape(path) + '";' + + 'document.body.appendChild(s);' + ); +} + +function minify(code) { + return uglify.minify(code, {fromString: true}).code; +} + +function convert(code, options) { + code = minify(code); + var stylesCode = ''; + + if (options.script) { + options.script = options.script.reverse(); + for (var i=0, len=options.script.length; i<len; i++) { + code = loadScript(code, options.script[i]); + } + code = minify(code); + } + + if (options.style) { + for (var j=0, length=options.style.length; j<length; j++) { + stylesCode += 'var link = document.createElement("link"); link.rel="stylesheet"; link.href = "' + quoteEscape(options.style[j]) + '"; document.body.appendChild(link);'; + } + code = minify(stylesCode) + code; + } + + code = '(function(){' + code + '})()'; + return 'javascript:' + encodeURIComponent(code); +} + +function parseFile(data) { + var inMetadataBlock = false, + openMetadata = '==Bookmarklet==', + closeMetadata = '==/Bookmarklet==', + rComment = /^(\s*\/\/\s*)/, + mdKeys = metadata.keys, + mdTypes = metadata.types, + options = {}, + code = [], + errors = []; + + // parse file and gather options from metadata block if available + data.match(/[^\r\n]+/g).forEach(function(line, i, lines) { + + // comment + if (rComment.test(line)) { + var comment = line.replace(rComment, '').trim(), + canonicalComment = comment.toLowerCase().replace(/\s+/g, ''); + + if (!inMetadataBlock) { + if (canonicalComment == openMetadata.toLowerCase()) { + inMetadataBlock = true; + } + } else { + if (canonicalComment == closeMetadata.toLowerCase()) { + inMetadataBlock = false; + } else { + var m = comment.match(/^@([^\s]+)\s+(.*)$/); + if (m) { + var k = m[1], v = m[2]; + if (k) { + if (mdKeys[k] == mdTypes.list) { + options[k] = options[k] || []; + options[k].push(v); + } else { + options[m[1]] = m[2]; + } + } else { + warn('ignoring invalid metadata option: `' + k + '`'); + } + } + } + } + + // code + } else { + code.push(line); + } + + if (inMetadataBlock && i + 1 == lines.length) { + errors.push('missing metdata block closing `' + + closeMetadata + '`'); + } + }); + + return { + code: code.join('\n'), + options: options, + errors: errors.length ? errors : null + }; +} + +var _exports = { + version: version, + convert: convert, + parseFile: parseFile, + metadata: metadata +}; + +for (var k in _exports) { + exports[k] = _exports[k]; +} diff --git a/node_modules/boomlet/node_modules/.bin/uglifyjs b/node_modules/bookmarklet/node_modules/.bin/uglifyjs index fef3468..fef3468 120000 --- a/node_modules/boomlet/node_modules/.bin/uglifyjs +++ b/node_modules/bookmarklet/node_modules/.bin/uglifyjs diff --git a/node_modules/boomlet/node_modules/uglify-js/.npmignore b/node_modules/bookmarklet/node_modules/uglify-js/.npmignore index 94fceeb..94fceeb 100644 --- a/node_modules/boomlet/node_modules/uglify-js/.npmignore +++ b/node_modules/bookmarklet/node_modules/uglify-js/.npmignore diff --git a/node_modules/boomlet/node_modules/uglify-js/README.md b/node_modules/bookmarklet/node_modules/uglify-js/README.md index 27d06cd..de6abe5 100644 --- a/node_modules/boomlet/node_modules/uglify-js/README.md +++ b/node_modules/bookmarklet/node_modules/uglify-js/README.md @@ -1,6 +1,5 @@ UglifyJS 2 ========== -[](https://travis-ci.org/mishoo/UglifyJS2) UglifyJS is a JavaScript parser, minifier, compressor or beautifier toolkit. @@ -46,72 +45,52 @@ files. The available options are: -``` - --source-map Specify an output file where to generate source map. - [string] - --source-map-root The path to the original source to be included in the - source map. [string] - --source-map-url The path to the source map to be added in //# - sourceMappingURL. Defaults to the value passed with - --source-map. [string] - --source-map-include-sources - Pass this flag if you want to include the content of - source files in the source map as sourcesContent - property. [boolean] - --in-source-map Input source map, useful if you're compressing JS that was - generated from some other original code. - --screw-ie8 Pass this flag if you don't care about full compliance - with Internet Explorer 6-8 quirks (by default UglifyJS - will try to be IE-proof). [boolean] - --expr Parse a single expression, rather than a program (for - parsing JSON) [boolean] - -p, --prefix Skip prefix for original filenames that appear in source - maps. For example -p 3 will drop 3 directories from file - names and ensure they are relative paths. You can also - specify -p relative, which will make UglifyJS figure out - itself the relative paths between original sources, the - source map and the output file. [string] - -o, --output Output file (default STDOUT). - -b, --beautify Beautify output/specify output options. [string] - -m, --mangle Mangle names/pass mangler options. [string] - -r, --reserved Reserved names to exclude from mangling. - -c, --compress Enable compressor/pass compressor options. Pass options - like -c hoist_vars=false,if_return=false. Use -c with no - argument to use the default compression options. [string] - -d, --define Global definitions [string] - -e, --enclose Embed everything in a big function, with a configurable - parameter/argument list. [string] - --comments Preserve copyright comments in the output. By default this - works like Google Closure, keeping JSDoc-style comments - that contain "@license" or "@preserve". You can optionally - pass one of the following arguments to this flag: - - "all" to keep all comments - - a valid JS regexp (needs to start with a slash) to keep - only comments that match. - Note that currently not *all* comments can be kept when - compression is on, because of dead code removal or - cascading statements into sequences. [string] - --preamble Preamble to prepend to the output. You can use this to - insert a comment, for example for licensing information. - This will not be parsed, but the source map will adjust - for its presence. - --stats Display operations run time on STDERR. [boolean] - --acorn Use Acorn for parsing. [boolean] - --spidermonkey Assume input files are SpiderMonkey AST format (as JSON). - [boolean] - --self Build itself (UglifyJS2) as a library (implies - --wrap=UglifyJS --export-all) [boolean] - --wrap Embed everything in a big function, making the “exports” - and “global” variables available. You need to pass an - argument to this option to specify the name that your - module will take when included in, say, a browser. - [string] - --export-all Only used when --wrap, this tells UglifyJS to add code to - automatically export all globals. [boolean] - --lint Display some scope warnings [boolean] - -v, --verbose Verbose [boolean] - -V, --version Print version number and exit. [boolean] -``` + --source-map Specify an output file where to generate source map. + [string] + --source-map-root The path to the original source to be included in the + source map. [string] + --source-map-url The path to the source map to be added in //@ + sourceMappingURL. Defaults to the value passed with + --source-map. [string] + --in-source-map Input source map, useful if you're compressing JS that was + generated from some other original code. + -p, --prefix Skip prefix for original filenames that appear in source + maps. For example -p 3 will drop 3 directories from file + names and ensure they are relative paths. + -o, --output Output file (default STDOUT). + -b, --beautify Beautify output/specify output options. [string] + -m, --mangle Mangle names/pass mangler options. [string] + -r, --reserved Reserved names to exclude from mangling. + -c, --compress Enable compressor/pass compressor options. Pass options + like -c hoist_vars=false,if_return=false. Use -c with no + argument to use the default compression options. [string] + -d, --define Global definitions [string] + --comments Preserve copyright comments in the output. By default this + works like Google Closure, keeping JSDoc-style comments + that contain "@license" or "@preserve". You can optionally + pass one of the following arguments to this flag: + - "all" to keep all comments + - a valid JS regexp (needs to start with a slash) to keep + only comments that match. + Note that currently not *all* comments can be kept when + compression is on, because of dead code removal or + cascading statements into sequences. [string] + --stats Display operations run time on STDERR. [boolean] + --acorn Use Acorn for parsing. [boolean] + --spidermonkey Assume input fles are SpiderMonkey AST format (as JSON). + [boolean] + --self Build itself (UglifyJS2) as a library (implies + --wrap=UglifyJS --export-all) [boolean] + --wrap Embed everything in a big function, making the “exports” + and “global” variables available. You need to pass an + argument to this option to specify the name that your + module will take when included in, say, a browser. + [string] + --export-all Only used when --wrap, this tells UglifyJS to add code to + automatically export all globals. [boolean] + --lint Display some scope warnings [boolean] + -v, --verbose Verbose [boolean] + -V, --version Print version number and exit. [boolean] Specify `--output` (`-o`) to declare the output file. Otherwise the output goes to STDOUT. @@ -162,19 +141,12 @@ input files from the command line. ## Mangler options -To enable the mangler you need to pass `--mangle` (`-m`). The following -(comma-separated) options are supported: - -- `sort` — to assign shorter names to most frequently used variables. This - saves a few hundred bytes on jQuery before gzip, but the output is - _bigger_ after gzip (and seems to happen for other libraries I tried it - on) therefore it's not enabled by default. - -- `toplevel` — mangle names declared in the toplevel scope (disabled by - default). - -- `eval` — mangle names visible in scopes where `eval` or `with` are used - (disabled by default). +To enable the mangler you need to pass `--mangle` (`-m`). Optionally you +can pass `-m sort=true` (we'll possibly have other flags in the future) in order +to assign shorter names to most frequently used variables. This saves a few +hundred bytes on jQuery before gzip, but the output is _bigger_ after gzip +(and seems to happen for other libraries I tried it on) therefore it's not +enabled by default. When mangling is enabled but you want to prevent certain names from being mangled, you can declare those names with `--reserved` (`-r`) — pass a @@ -191,98 +163,46 @@ you can pass a comma-separated list of options. Options are in the form `foo=bar`, or just `foo` (the latter implies a boolean option that you want to set `true`; it's effectively a shortcut for `foo=true`). -- `sequences` -- join consecutive simple statements using the comma operator +The defaults should be tuned for maximum compression on most code. Here are +the available options (all are `true` by default, except `hoist_vars`): +- `sequences` -- join consecutive simple statements using the comma operator - `properties` -- rewrite property access using the dot notation, for example `foo["bar"] → foo.bar` - - `dead_code` -- remove unreachable code - - `drop_debugger` -- remove `debugger;` statements - -- `unsafe` (default: false) -- apply "unsafe" transformations (discussion below) - +- `unsafe` -- apply "unsafe" transformations (discussion below) - `conditionals` -- apply optimizations for `if`-s and conditional expressions - - `comparisons` -- apply certain optimizations to binary nodes, for example: `!(a <= b) → a > b` (only when `unsafe`), attempts to negate binary nodes, e.g. `a = !b && !c && !d && !e → a=!(b||c||d||e)` etc. - - `evaluate` -- attempt to evaluate constant expressions - - `booleans` -- various optimizations for boolean context, for example `!!a ? b : c → a ? b : c` - - `loops` -- optimizations for `do`, `while` and `for` loops when we can statically determine the condition - - `unused` -- drop unreferenced functions and variables - - `hoist_funs` -- hoist function declarations - -- `hoist_vars` (default: false) -- hoist `var` declarations (this is `false` - by default because it seems to increase the size of the output in general) - +- `hoist_vars` -- hoist `var` declarations (this is `false` by default + because it seems to increase the size of the output in general) - `if_return` -- optimizations for if/return and if/continue - - `join_vars` -- join consecutive `var` statements - - `cascade` -- small optimization for sequences, transform `x, x` into `x` and `x = something(), x` into `x = something()` - - `warnings` -- display warnings when dropping unreachable code or unused declarations etc. -- `negate_iife` -- negate "Immediately-Called Function Expressions" - where the return value is discarded, to avoid the parens that the - code generator would insert. - -- `pure_getters` -- the default is `false`. If you pass `true` for - this, UglifyJS will assume that object property access - (e.g. `foo.bar` or `foo["bar"]`) doesn't have any side effects. - -- `pure_funcs` -- default `null`. You can pass an array of names and - UglifyJS will assume that those functions do not produce side - effects. DANGER: will not check if the name is redefined in scope. - An example case here, for instance `var q = Math.floor(a/b)`. If - variable `q` is not used elsewhere, UglifyJS will drop it, but will - still keep the `Math.floor(a/b)`, not knowing what it does. You can - pass `pure_funcs: [ 'Math.floor' ]` to let it know that this - function won't produce any side effect, in which case the whole - statement would get discarded. The current implementation adds some - overhead (compression will be slower). - -- `drop_console` -- default `false`. Pass `true` to discard calls to - `console.*` functions. - -### The `unsafe` option - -It enables some transformations that *might* break code logic in certain -contrived cases, but should be fine for most code. You might want to try it -on your own code, it should reduce the minified size. Here's what happens -when this flag is on: - -- `new Array(1, 2, 3)` or `Array(1, 2, 3)` → `[1, 2, 3 ]` -- `new Object()` → `{}` -- `String(exp)` or `exp.toString()` → `"" + exp` -- `new Object/RegExp/Function/Error/Array (...)` → we discard the `new` -- `typeof foo == "undefined"` → `foo === void 0` -- `void 0` → `undefined` (if there is a variable named "undefined" in - scope; we do it because the variable name will be mangled, typically - reduced to a single character). - ### Conditional compilation You can use the `--define` (`-d`) switch in order to declare global variables that UglifyJS will assume to be constants (unless defined in scope). For example if you pass `--define DEBUG=false` then, coupled with dead code removal UglifyJS will discard the following from the output: -```javascript -if (DEBUG) { - console.log("debug stuff"); -} -``` + + if (DEBUG) { + console.log("debug stuff"); + } UglifyJS will warn about the condition being always false and about dropping unreachable code; for now there is no option to turn off only this specific @@ -291,11 +211,10 @@ warning, you can pass `warnings=false` to turn off *all* warnings. Another way of doing that is to declare your globals as constants in a separate file and include it into the build. For example you can have a `build/defines.js` file with the following: -```javascript -const DEBUG = false; -const PRODUCTION = true; -// etc. -``` + + const DEBUG = false; + const PRODUCTION = true; + // etc. and build your code like this: @@ -332,6 +251,9 @@ can pass additional arguments that control the code output: It doesn't work very well currently, but it does make the code generated by UglifyJS more readable. - `max-line-len` (default 32000) -- maximum line length (for uglified code) +- `ie-proof` (default `true`) -- generate “IE-proof” code (for now this + means add brackets around the do/while in code like this: `if (foo) do + something(); while (bar); else ...`. - `bracketize` (default `false`) -- always insert brackets in `if`, `for`, `do`, `while` or `with` statements, even if their body is a single statement. @@ -339,10 +261,6 @@ can pass additional arguments that control the code output: you pass `false` then whenever possible we will use a newline instead of a semicolon, leading to more readable output of uglified code (size before gzip could be smaller; size after gzip insignificantly larger). -- `preamble` (default `null`) -- when passed it must be a string and - it will be prepended to the output literally. The source map will - adjust for this text. Can be used to insert a comment containing - licensing information, for example. ### Keeping copyright notices or other comments @@ -355,15 +273,14 @@ keep only comments that match this regexp. For example `--comments Note, however, that there might be situations where comments are lost. For example: -```javascript -function f() { - /** @preserve Foo Bar */ - function g() { - // this function is never called - } - return something(); -} -``` + + function f() { + /** @preserve Foo Bar */ + function g() { + // this function is never called + } + return something(); + } Even though it has "@preserve", the comment will be lost because the inner function `g` (which is the AST node to which the comment is attached to) is @@ -405,9 +322,8 @@ API Reference Assuming installation via NPM, you can load UglifyJS in your application like this: -```javascript -var UglifyJS = require("uglify-js"); -``` + + var UglifyJS = require("uglify-js"); It exports a lot of names, but I'll discuss here the basics that are needed for parsing, mangling and compressing a piece of code. The sequence is (1) @@ -418,49 +334,45 @@ parse, (2) compress, (3) mangle, (4) generate output code. There's a single toplevel function which combines all the steps. If you don't need additional customization, you might want to go with `minify`. Example: -```javascript -var result = UglifyJS.minify("/path/to/file.js"); -console.log(result.code); // minified output -// if you need to pass code instead of file name -var result = UglifyJS.minify("var b = function () {};", {fromString: true}); -``` + + var result = UglifyJS.minify("/path/to/file.js"); + console.log(result.code); // minified output + // if you need to pass code instead of file name + var result = UglifyJS.minify("var b = function () {};", {fromString: true}); You can also compress multiple files: -```javascript -var result = UglifyJS.minify([ "file1.js", "file2.js", "file3.js" ]); -console.log(result.code); -``` + + var result = UglifyJS.minify([ "file1.js", "file2.js", "file3.js" ]); + console.log(result.code); To generate a source map: -```javascript -var result = UglifyJS.minify([ "file1.js", "file2.js", "file3.js" ], { - outSourceMap: "out.js.map" -}); -console.log(result.code); // minified output -console.log(result.map); -``` + + var result = UglifyJS.minify([ "file1.js", "file2.js", "file3.js" ], { + outSourceMap: "out.js.map" + }); + console.log(result.code); // minified output + console.log(result.map); Note that the source map is not saved in a file, it's just returned in `result.map`. The value passed for `outSourceMap` is only used to set the `file` attribute in the source map (see [the spec][sm-spec]). You can also specify sourceRoot property to be included in source map: -```javascript -var result = UglifyJS.minify([ "file1.js", "file2.js", "file3.js" ], { - outSourceMap: "out.js.map", - sourceRoot: "http://example.com/src" -}); -``` + + var result = UglifyJS.minify([ "file1.js", "file2.js", "file3.js" ], { + outSourceMap: "out.js.map", + sourceRoot: "http://example.com/src" + }); + If you're compressing compiled JavaScript and have a source map for it, you can use the `inSourceMap` argument: -```javascript -var result = UglifyJS.minify("compiled.js", { - inSourceMap: "compiled.js.map", - outSourceMap: "minified.js.map" -}); -// same as before, it returns `code` and `map` -``` + + var result = UglifyJS.minify("compiled.js", { + inSourceMap: "compiled.js.map", + outSourceMap: "minified.js.map" + }); + // same as before, it returns `code` and `map` The `inSourceMap` is only used if you also request `outSourceMap` (it makes no sense otherwise). @@ -490,9 +402,8 @@ Following there's more detailed API info, in case the `minify` function is too simple for your needs. #### The parser -```javascript -var toplevel_ast = UglifyJS.parse(code, options); -``` + + var toplevel_ast = UglifyJS.parse(code, options); `options` is optional and if present it must be an object. The following properties are available: @@ -506,16 +417,15 @@ properties are available: The last two options are useful when you'd like to minify multiple files and get a single file as the output and a proper source map. Our CLI tool does something like this: -```javascript -var toplevel = null; -files.forEach(function(file){ - var code = fs.readFileSync(file, "utf8"); - toplevel = UglifyJS.parse(code, { - filename: file, - toplevel: toplevel - }); -}); -``` + + var toplevel = null; + files.forEach(function(file){ + var code = fs.readFileSync(file); + toplevel = UglifyJS.parse(code, { + filename: file, + toplevel: toplevel + }); + }); After this, we have in `toplevel` a big AST containing all our files, with each token having proper information about where it came from. @@ -529,17 +439,15 @@ referenced, if it is a global or not, if a function is using `eval` or the `with` statement etc. I will discuss this some place else, for now what's important to know is that you need to call the following before doing anything with the tree: -```javascript -toplevel.figure_out_scope() -``` + + toplevel.figure_out_scope() #### Compression Like this: -```javascript -var compressor = UglifyJS.Compressor(options); -var compressed_ast = toplevel.transform(compressor); -``` + + var compressor = UglifyJS.Compressor(options); + var compressed_ast = toplevel.transform(compressor); The `options` can be missing. Available options are discussed above in “Compressor options”. Defaults should lead to best compression in most @@ -555,26 +463,23 @@ the compressor might drop unused variables / unreachable code and this might change the number of identifiers or their position). Optionally, you can call a trick that helps after Gzip (counting character frequency in non-mangleable words). Example: -```javascript -compressed_ast.figure_out_scope(); -compressed_ast.compute_char_frequency(); -compressed_ast.mangle_names(); -``` + + compressed_ast.figure_out_scope(); + compressed_ast.compute_char_frequency(); + compressed_ast.mangle_names(); #### Generating output AST nodes have a `print` method that takes an output stream. Essentially, to generate code you do this: -```javascript -var stream = UglifyJS.OutputStream(options); -compressed_ast.print(stream); -var code = stream.toString(); // this is your minified code -``` + + var stream = UglifyJS.OutputStream(options); + compressed_ast.print(stream); + var code = stream.toString(); // this is your minified code or, for a shortcut you can do: -```javascript -var code = compressed_ast.print_to_string(options); -``` + + var code = compressed_ast.print_to_string(options); As usual, `options` is optional. The output stream accepts a lot of otions, most of them documented above in section “Beautifier options”. The two @@ -612,17 +517,16 @@ to be a `SourceMap` object (which is a thin wrapper on top of the [source-map][source-map] library). Example: -```javascript -var source_map = UglifyJS.SourceMap(source_map_options); -var stream = UglifyJS.OutputStream({ - ... - source_map: source_map -}); -compressed_ast.print(stream); - -var code = stream.toString(); -var map = source_map.toString(); // json output for your source map -``` + + var source_map = UglifyJS.SourceMap(source_map_options); + var stream = UglifyJS.OutputStream({ + ... + source_map: source_map + }); + compressed_ast.print(stream); + + var code = stream.toString(); + var map = source_map.toString(); // json output for your source map The `source_map_options` (optional) can contain the following properties: diff --git a/node_modules/boomlet/node_modules/uglify-js/bin/uglifyjs b/node_modules/bookmarklet/node_modules/uglify-js/bin/uglifyjs index 3a3318b..dc9a451 100755 --- a/node_modules/boomlet/node_modules/uglify-js/bin/uglifyjs +++ b/node_modules/bookmarklet/node_modules/uglify-js/bin/uglifyjs @@ -7,8 +7,6 @@ var UglifyJS = require("../tools/node"); var sys = require("util"); var optimist = require("optimist"); var fs = require("fs"); -var path = require("path"); -var async = require("async"); var acorn; var ARGS = optimist .usage("$0 input1.js [input2.js ...] [options]\n\ @@ -21,15 +19,10 @@ mangling you need to use `-c` and `-m`.\ ") .describe("source-map", "Specify an output file where to generate source map.") .describe("source-map-root", "The path to the original source to be included in the source map.") - .describe("source-map-url", "The path to the source map to be added in //# sourceMappingURL. Defaults to the value passed with --source-map.") - .describe("source-map-include-sources", "Pass this flag if you want to include the content of source files in the source map as sourcesContent property.") + .describe("source-map-url", "The path to the source map to be added in //@ sourceMappingURL. Defaults to the value passed with --source-map.") .describe("in-source-map", "Input source map, useful if you're compressing JS that was generated from some other original code.") - .describe("screw-ie8", "Pass this flag if you don't care about full compliance with Internet Explorer 6-8 quirks (by default UglifyJS will try to be IE-proof).") - .describe("expr", "Parse a single expression, rather than a program (for parsing JSON)") .describe("p", "Skip prefix for original filenames that appear in source maps. \ -For example -p 3 will drop 3 directories from file names and ensure they are relative paths. \ -You can also specify -p relative, which will make UglifyJS figure out itself the relative paths between original sources, \ -the source map and the output file.") +For example -p 3 will drop 3 directories from file names and ensure they are relative paths.") .describe("o", "Output file (default STDOUT).") .describe("b", "Beautify output/specify output options.") .describe("m", "Mangle names/pass mangler options.") @@ -38,7 +31,6 @@ the source map and the output file.") Pass options like -c hoist_vars=false,if_return=false. \ Use -c with no argument to use the default compression options.") .describe("d", "Global definitions") - .describe("e", "Embed everything in a big function, with a configurable parameter/argument list.") .describe("comments", "Preserve copyright comments in the output. \ By default this works like Google Closure, keeping JSDoc-style comments that contain \"@license\" or \"@preserve\". \ @@ -49,13 +41,9 @@ You can optionally pass one of the following arguments to this flag:\n\ Note that currently not *all* comments can be kept when compression is on, \ because of dead code removal or cascading statements into sequences.") - .describe("preamble", "Preamble to prepend to the output. You can use this to insert a \ -comment, for example for licensing information. This will not be \ -parsed, but the source map will adjust for its presence.") - .describe("stats", "Display operations run time on STDERR.") .describe("acorn", "Use Acorn for parsing.") - .describe("spidermonkey", "Assume input files are SpiderMonkey AST format (as JSON).") + .describe("spidermonkey", "Assume input fles are SpiderMonkey AST format (as JSON).") .describe("self", "Build itself (UglifyJS2) as a library (implies --wrap=UglifyJS --export-all)") .describe("wrap", "Embed everything in a big function, making the “exports” and “global” variables available. \ You need to pass an argument to this option to specify the name that your module will take when included in, say, a browser.") @@ -63,7 +51,6 @@ You need to pass an argument to this option to specify the name that your module .describe("lint", "Display some scope warnings") .describe("v", "Verbose") .describe("V", "Print version number and exit.") - .describe("noerr", "Don't throw an error for unknown options in -c, -b or -m.") .alias("p", "prefix") .alias("o", "output") @@ -74,7 +61,6 @@ You need to pass an argument to this option to specify the name that your module .alias("d", "define") .alias("r", "reserved") .alias("V", "version") - .alias("e", "enclose") .string("source-map") .string("source-map-root") @@ -83,14 +69,8 @@ You need to pass an argument to this option to specify the name that your module .string("m") .string("c") .string("d") - .string("e") .string("comments") .string("wrap") - .string("p") - - .boolean("expr") - .boolean("source-map-include-sources") - .boolean("screw-ie8") .boolean("export-all") .boolean("self") .boolean("v") @@ -99,7 +79,6 @@ You need to pass an argument to this option to specify the name that your module .boolean("spidermonkey") .boolean("lint") .boolean("V") - .boolean("noerr") .wrap(80) @@ -108,12 +87,6 @@ You need to pass an argument to this option to specify the name that your module normalize(ARGS); -if (ARGS.noerr) { - UglifyJS.DefaultsError.croak = function(msg, defs) { - sys.error("WARN: " + msg); - }; -} - if (ARGS.version || ARGS.V) { var json = require("../package.json"); sys.puts(json.name + ' ' + json.version); @@ -139,25 +112,18 @@ var COMPRESS = getOptions("c", true); var MANGLE = getOptions("m", true); var BEAUTIFY = getOptions("b", true); -if (ARGS.d) { - if (COMPRESS) COMPRESS.global_defs = getOptions("d"); +if (COMPRESS && ARGS.d) { + COMPRESS.global_defs = getOptions("d"); } -if (ARGS.r) { - if (MANGLE) MANGLE.except = ARGS.r.replace(/^\s+|\s+$/g).split(/\s*,+\s*/); +if (MANGLE && ARGS.r) { + MANGLE.except = ARGS.r.replace(/^\s+|\s+$/g).split(/\s*,+\s*/); } var OUTPUT_OPTIONS = { - beautify: BEAUTIFY ? true : false, - preamble: ARGS.preamble || null, + beautify: BEAUTIFY ? true : false }; -if (ARGS.screw_ie8) { - if (COMPRESS) COMPRESS.screw_ie8 = true; - if (MANGLE) MANGLE.screw_ie8 = true; - OUTPUT_OPTIONS.screw_ie8 = true; -} - if (BEAUTIFY) UglifyJS.merge(OUTPUT_OPTIONS, BEAUTIFY); @@ -219,11 +185,9 @@ if (files.filter(function(el){ return el == "-" }).length > 1) { var STATS = {}; var OUTPUT_FILE = ARGS.o; var TOPLEVEL = null; -var P_RELATIVE = ARGS.p && ARGS.p == "relative"; -var SOURCES_CONTENT = {}; var SOURCE_MAP = ARGS.source_map ? UglifyJS.SourceMap({ - file: P_RELATIVE ? path.relative(path.dirname(ARGS.source_map), OUTPUT_FILE) : OUTPUT_FILE, + file: OUTPUT_FILE, root: ARGS.source_map_root, orig: ORIG_MAP, }) : null; @@ -242,148 +206,100 @@ try { } } -async.eachLimit(files, 1, function (file, cb) { - read_whole_file(file, function (err, code) { - if (err) { - sys.error("ERROR: can't read file: " + file); - process.exit(1); - } - if (ARGS.p != null) { - if (P_RELATIVE) { - file = path.relative(path.dirname(ARGS.source_map), file); - } else { - var p = parseInt(ARGS.p, 10); - if (!isNaN(p)) { - file = file.replace(/^\/+/, "").split(/\/+/).slice(ARGS.p).join("/"); - } - } - } - SOURCES_CONTENT[file] = code; - time_it("parse", function(){ - if (ARGS.spidermonkey) { - var program = JSON.parse(code); - if (!TOPLEVEL) TOPLEVEL = program; - else TOPLEVEL.body = TOPLEVEL.body.concat(program.body); - } - else if (ARGS.acorn) { - TOPLEVEL = acorn.parse(code, { - locations : true, - sourceFile : file, - program : TOPLEVEL - }); - } - else { - try { - TOPLEVEL = UglifyJS.parse(code, { - filename : file, - toplevel : TOPLEVEL, - expression : ARGS.expr, - }); - } catch(ex) { - if (ex instanceof UglifyJS.JS_Parse_Error) { - sys.error("Parse error at " + file + ":" + ex.line + "," + ex.col); - sys.error(ex.message); - sys.error(ex.stack); - process.exit(1); - } - throw ex; - } - }; - }); - cb(); - }); -}, function () { - if (ARGS.acorn || ARGS.spidermonkey) time_it("convert_ast", function(){ - TOPLEVEL = UglifyJS.AST_Node.from_mozilla_ast(TOPLEVEL); - }); - - if (ARGS.wrap) { - TOPLEVEL = TOPLEVEL.wrap_commonjs(ARGS.wrap, ARGS.export_all); +files.forEach(function(file) { + var code = read_whole_file(file); + if (ARGS.p != null) { + file = file.replace(/^\/+/, "").split(/\/+/).slice(ARGS.p).join("/"); } - - if (ARGS.enclose) { - var arg_parameter_list = ARGS.enclose; - if (arg_parameter_list === true) { - arg_parameter_list = []; + time_it("parse", function(){ + if (ARGS.spidermonkey) { + var program = JSON.parse(code); + if (!TOPLEVEL) TOPLEVEL = program; + else TOPLEVEL.body = TOPLEVEL.body.concat(program.body); } - else if (!(arg_parameter_list instanceof Array)) { - arg_parameter_list = [arg_parameter_list]; + else if (ARGS.acorn) { + TOPLEVEL = acorn.parse(code, { + locations : true, + trackComments : true, + sourceFile : file, + program : TOPLEVEL + }); } - TOPLEVEL = TOPLEVEL.wrap_enclose(arg_parameter_list); - } + else { + TOPLEVEL = UglifyJS.parse(code, { + filename: file, + toplevel: TOPLEVEL + }); + }; + }); +}); - var SCOPE_IS_NEEDED = COMPRESS || MANGLE || ARGS.lint; +if (ARGS.acorn || ARGS.spidermonkey) time_it("convert_ast", function(){ + TOPLEVEL = UglifyJS.AST_Node.from_mozilla_ast(TOPLEVEL); +}); - if (SCOPE_IS_NEEDED) { - time_it("scope", function(){ - TOPLEVEL.figure_out_scope({ screw_ie8: ARGS.screw_ie8 }); - if (ARGS.lint) { - TOPLEVEL.scope_warnings(); - } - }); - } +if (ARGS.wrap) { + TOPLEVEL = TOPLEVEL.wrap_commonjs(ARGS.wrap, ARGS.export_all); +} - if (COMPRESS) { - time_it("squeeze", function(){ - TOPLEVEL = TOPLEVEL.transform(compressor); - }); - } +var SCOPE_IS_NEEDED = COMPRESS || MANGLE || ARGS.lint; - if (SCOPE_IS_NEEDED) { - time_it("scope", function(){ - TOPLEVEL.figure_out_scope({ screw_ie8: ARGS.screw_ie8 }); - if (MANGLE) { - TOPLEVEL.compute_char_frequency(MANGLE); - } - }); - } +if (SCOPE_IS_NEEDED) { + time_it("scope", function(){ + TOPLEVEL.figure_out_scope(); + if (ARGS.lint) { + TOPLEVEL.scope_warnings(); + } + }); +} - if (MANGLE) time_it("mangle", function(){ - TOPLEVEL.mangle_names(MANGLE); +if (COMPRESS) { + time_it("squeeze", function(){ + TOPLEVEL = TOPLEVEL.transform(compressor); }); +} - if (ARGS.source_map_include_sources) { - for (var file in SOURCES_CONTENT) { - if (SOURCES_CONTENT.hasOwnProperty(file)) { - SOURCE_MAP.get().setSourceContent(file, SOURCES_CONTENT[file]); - } +if (SCOPE_IS_NEEDED) { + time_it("scope", function(){ + TOPLEVEL.figure_out_scope(); + if (MANGLE) { + TOPLEVEL.compute_char_frequency(MANGLE); } - } - - time_it("generate", function(){ - TOPLEVEL.print(output); }); +} - output = output.get(); +if (MANGLE) time_it("mangle", function(){ + TOPLEVEL.mangle_names(MANGLE); +}); +time_it("generate", function(){ + TOPLEVEL.print(output); +}); - if (SOURCE_MAP) { - fs.writeFileSync(ARGS.source_map, SOURCE_MAP, "utf8"); - var source_map_url = ARGS.source_map_url || ( - P_RELATIVE - ? path.relative(path.dirname(OUTPUT_FILE), ARGS.source_map) - : ARGS.source_map - ); - output += "\n//# sourceMappingURL=" + source_map_url; - } +output = output.get(); - if (OUTPUT_FILE) { - fs.writeFileSync(OUTPUT_FILE, output, "utf8"); - } else { - sys.print(output); - } +if (SOURCE_MAP) { + fs.writeFileSync(ARGS.source_map, SOURCE_MAP, "utf8"); + output += "\n/*\n//@ sourceMappingURL=" + (ARGS.source_map_url || ARGS.source_map) + "\n*/"; +} - if (ARGS.stats) { - sys.error(UglifyJS.string_template("Timing information (compressed {count} files):", { - count: files.length +if (OUTPUT_FILE) { + fs.writeFileSync(OUTPUT_FILE, output, "utf8"); +} else { + sys.print(output); + sys.error("\n"); +} + +if (ARGS.stats) { + sys.error(UglifyJS.string_template("Timing information (compressed {count} files):", { + count: files.length + })); + for (var i in STATS) if (STATS.hasOwnProperty(i)) { + sys.error(UglifyJS.string_template("- {name}: {time}s", { + name: i, + time: (STATS[i] / 1000).toFixed(3) })); - for (var i in STATS) if (STATS.hasOwnProperty(i)) { - sys.error(UglifyJS.string_template("- {name}: {time}s", { - name: i, - time: (STATS[i] / 1000).toFixed(3) - })); - } } -}); +} /* -----[ functions ]----- */ @@ -401,7 +317,7 @@ function getOptions(x, constants) { if (x !== true) { var ast; try { - ast = UglifyJS.parse(x, { expression: true }); + ast = UglifyJS.parse(x); } catch(ex) { if (ex instanceof UglifyJS.JS_Parse_Error) { sys.error("Error parsing arguments in: " + x); @@ -409,6 +325,8 @@ function getOptions(x, constants) { } } ast.walk(new UglifyJS.TreeWalker(function(node){ + if (node instanceof UglifyJS.AST_Toplevel) return; // descend + if (node instanceof UglifyJS.AST_SimpleStatement) return; // descend if (node instanceof UglifyJS.AST_Seq) return; // descend if (node instanceof UglifyJS.AST_Assign) { var name = node.left.print_to_string({ beautify: false }).replace(/-/g, "_"); @@ -418,11 +336,6 @@ function getOptions(x, constants) { ret[name] = value; return true; // no descend } - if (node instanceof UglifyJS.AST_Symbol || node instanceof UglifyJS.AST_Binary) { - var name = node.print_to_string({ beautify: false }).replace(/-/g, "_"); - ret[name] = true; - return true; // no descend - } sys.error(node.TYPE) sys.error("Error parsing arguments in: " + x); process.exit(1); @@ -431,18 +344,17 @@ function getOptions(x, constants) { return ret; } -function read_whole_file(filename, cb) { +function read_whole_file(filename) { if (filename == "-") { - var chunks = []; - process.stdin.setEncoding('utf-8'); - process.stdin.on('data', function (chunk) { - chunks.push(chunk); - }).on('end', function () { - cb(null, chunks.join("")); - }); - process.openStdin(); - } else { - fs.readFile(filename, "utf-8", cb); + // XXX: this sucks. How does one read the whole STDIN + // synchronously? + filename = "/dev/stdin"; + } + try { + return fs.readFileSync(filename, "utf8"); + } catch(ex) { + sys.error("ERROR: can't read file: " + filename); + process.exit(1); } } diff --git a/node_modules/boomlet/node_modules/uglify-js/lib/ast.js b/node_modules/bookmarklet/node_modules/uglify-js/lib/ast.js index 2f216c2..62bdd8d 100644 --- a/node_modules/boomlet/node_modules/uglify-js/lib/ast.js +++ b/node_modules/bookmarklet/node_modules/uglify-js/lib/ast.js @@ -197,10 +197,6 @@ var AST_LabeledStatement = DEFNODE("LabeledStatement", "label", { } }, AST_StatementWithBody); -var AST_IterationStatement = DEFNODE("IterationStatement", null, { - $documentation: "Internal class. All loops inherit from it." -}, AST_StatementWithBody); - var AST_DWLoop = DEFNODE("DWLoop", "condition", { $documentation: "Base class for do/while statements", $propdoc: { @@ -212,7 +208,7 @@ var AST_DWLoop = DEFNODE("DWLoop", "condition", { this.body._walk(visitor); }); } -}, AST_IterationStatement); +}, AST_StatementWithBody); var AST_Do = DEFNODE("Do", null, { $documentation: "A `do` statement", @@ -237,7 +233,7 @@ var AST_For = DEFNODE("For", "init condition step", { this.body._walk(visitor); }); } -}, AST_IterationStatement); +}, AST_StatementWithBody); var AST_ForIn = DEFNODE("ForIn", "init name object", { $documentation: "A `for ... in` statement", @@ -253,7 +249,7 @@ var AST_ForIn = DEFNODE("ForIn", "init name object", { this.body._walk(visitor); }); } -}, AST_IterationStatement); +}, AST_StatementWithBody); var AST_With = DEFNODE("With", "expression", { $documentation: "A `with` statement", @@ -289,27 +285,6 @@ var AST_Toplevel = DEFNODE("Toplevel", "globals", { $propdoc: { globals: "[Object/S] a map of name -> SymbolDef for all undeclared names", }, - wrap_enclose: function(arg_parameter_pairs) { - var self = this; - var args = []; - var parameters = []; - - arg_parameter_pairs.forEach(function(pair) { - var split = pair.split(":"); - - args.push(split[0]); - parameters.push(split[1]); - }); - - var wrapped_tl = "(function(" + parameters.join(",") + "){ '$ORIG'; })(" + args.join(",") + ")"; - wrapped_tl = parse(wrapped_tl); - wrapped_tl = wrapped_tl.transform(new TreeTransformer(function before(node){ - if (node instanceof AST_Directive && node.value == "$ORIG") { - return MAP.splice(self.body); - } - })); - return wrapped_tl; - }, wrap_commonjs: function(name, export_all) { var self = this; var to_export = []; @@ -371,7 +346,7 @@ var AST_Lambda = DEFNODE("Lambda", "name argnames uses_arguments", { }, AST_Scope); var AST_Accessor = DEFNODE("Accessor", null, { - $documentation: "A setter/getter function. The `name` property is always null." + $documentation: "A setter/getter function" }, AST_Lambda); var AST_Function = DEFNODE("Function", null, { @@ -498,6 +473,12 @@ var AST_Try = DEFNODE("Try", "bcatch bfinally", { } }, AST_Block); +// XXX: this is wrong according to ECMA-262 (12.4). the catch block +// should introduce another scope, as the argname should be visible +// only inside the catch block. However, doing it this way because of +// IE which simply introduces the name in the surrounding scope. If +// we ever want to fix this then AST_Catch should inherit from +// AST_Scope. var AST_Catch = DEFNODE("Catch", "argname", { $documentation: "A `catch` node; only makes sense as part of a `try` statement", $propdoc: { @@ -750,7 +731,7 @@ var AST_Object = DEFNODE("Object", "properties", { var AST_ObjectProperty = DEFNODE("ObjectProperty", "key value", { $documentation: "Base class for literal object properties", $propdoc: { - key: "[string] the property name converted to a string for ObjectKeyVal. For setters and getters this is an arbitrary AST_Node.", + key: "[string] the property name; it's always a plain string in our AST, no matter if it was a string, number or identifier in original code", value: "[AST_Node] property value. For setters and getters this is an AST_Function." }, _walk: function(visitor) { @@ -819,11 +800,7 @@ var AST_SymbolCatch = DEFNODE("SymbolCatch", null, { var AST_Label = DEFNODE("Label", "references", { $documentation: "Symbol naming a label (declaration)", $propdoc: { - references: "[AST_LoopControl*] a list of nodes referring to this label" - }, - initialize: function() { - this.references = []; - this.thedef = this; + references: "[AST_LabelRef*] a list of nodes referring to this label" } }, AST_Symbol); @@ -947,9 +924,6 @@ TreeWalker.prototype = { if (x instanceof type) return x; } }, - has_directive: function(type) { - return this.find_parent(AST_Scope).has_directive(type); - }, in_boolean_context: function() { var stack = this.stack; var i = stack.length, self = stack[--i]; @@ -970,15 +944,21 @@ TreeWalker.prototype = { }, loopcontrol_target: function(label) { var stack = this.stack; - if (label) for (var i = stack.length; --i >= 0;) { - var x = stack[i]; - if (x instanceof AST_LabeledStatement && x.label.name == label.name) { - return x.body; + if (label) { + for (var i = stack.length; --i >= 0;) { + var x = stack[i]; + if (x instanceof AST_LabeledStatement && x.label.name == label.name) { + return x.body; + } + } + } else { + for (var i = stack.length; --i >= 0;) { + var x = stack[i]; + if (x instanceof AST_Switch + || x instanceof AST_For + || x instanceof AST_ForIn + || x instanceof AST_DWLoop) return x; } - } else for (var i = stack.length; --i >= 0;) { - var x = stack[i]; - if (x instanceof AST_Switch || x instanceof AST_IterationStatement) - return x; } } }; diff --git a/node_modules/boomlet/node_modules/uglify-js/lib/compress.js b/node_modules/bookmarklet/node_modules/uglify-js/lib/compress.js index b589aca..ca23c40 100644 --- a/node_modules/boomlet/node_modules/uglify-js/lib/compress.js +++ b/node_modules/bookmarklet/node_modules/uglify-js/lib/compress.js @@ -52,7 +52,7 @@ function Compressor(options, false_by_default) { properties : !false_by_default, dead_code : !false_by_default, drop_debugger : !false_by_default, - unsafe : false, + unsafe : !false_by_default, unsafe_comps : false, conditionals : !false_by_default, comparisons : !false_by_default, @@ -61,18 +61,11 @@ function Compressor(options, false_by_default) { loops : !false_by_default, unused : !false_by_default, hoist_funs : !false_by_default, - keep_fargs : false, hoist_vars : false, if_return : !false_by_default, join_vars : !false_by_default, cascade : !false_by_default, side_effects : !false_by_default, - pure_getters : false, - pure_funcs : null, - negate_iife : !false_by_default, - screw_ie8 : false, - drop_console : false, - angular : false, warnings : true, global_defs : {} @@ -88,16 +81,22 @@ merge(Compressor.prototype, { }, before: function(node, descend, in_list) { if (node._squeezed) return node; - var was_scope = false; if (node instanceof AST_Scope) { + node.drop_unused(this); node = node.hoist_declarations(this); - was_scope = true; } descend(node, this); node = node.optimize(this); - if (was_scope && node instanceof AST_Scope) { + if (node instanceof AST_Scope) { + // dead code removal might leave further unused declarations. + // this'll usually save very few bytes, but the performance + // hit seems negligible so I'll just drop it here. + + // no point to repeat warnings. + var save_warnings = this.options.warnings; + this.options.warnings = false; node.drop_unused(this); - descend(node, this); + this.options.warnings = save_warnings; } node._squeezed = true; return node; @@ -157,7 +156,7 @@ merge(Compressor.prototype, { value: val }).optimize(compressor); case "boolean": - return make_node(val ? AST_True : AST_False, orig).optimize(compressor); + return make_node(val ? AST_True : AST_False, orig); case "undefined": return make_node(AST_Undefined, orig).optimize(compressor); default: @@ -200,9 +199,6 @@ merge(Compressor.prototype, { var CHANGED; do { CHANGED = false; - if (compressor.option("angular")) { - statements = process_for_angular(statements); - } statements = eliminate_spurious_blocks(statements); if (compressor.option("dead_code")) { statements = eliminate_dead_code(statements, compressor); @@ -217,57 +213,8 @@ merge(Compressor.prototype, { statements = join_consecutive_vars(statements, compressor); } } while (CHANGED); - - if (compressor.option("negate_iife")) { - negate_iifes(statements, compressor); - } - return statements; - function process_for_angular(statements) { - function make_injector(func, name) { - return make_node(AST_SimpleStatement, func, { - body: make_node(AST_Assign, func, { - operator: "=", - left: make_node(AST_Dot, name, { - expression: make_node(AST_SymbolRef, name, name), - property: "$inject" - }), - right: make_node(AST_Array, func, { - elements: func.argnames.map(function(sym){ - return make_node(AST_String, sym, { value: sym.name }); - }) - }) - }) - }); - } - return statements.reduce(function(a, stat){ - a.push(stat); - var token = stat.start; - var comments = token.comments_before; - if (comments && comments.length > 0) { - var last = comments.pop(); - if (/@ngInject/.test(last.value)) { - // case 1: defun - if (stat instanceof AST_Defun) { - a.push(make_injector(stat, stat.name)); - } - else if (stat instanceof AST_Definitions) { - stat.definitions.forEach(function(def){ - if (def.value && def.value instanceof AST_Lambda) { - a.push(make_injector(def.value, def.name)); - } - }); - } - else { - compressor.warn("Unknown statement marked with @ngInject [{file}:{line},{col}]", token); - } - } - } - return a; - }, []); - } - function eliminate_spurious_blocks(statements) { var seen_dirs = []; return statements.reduce(function(a, stat){ @@ -370,14 +317,14 @@ merge(Compressor.prototype, { || (ab instanceof AST_Continue && self === loop_body(lct)) || (ab instanceof AST_Break && lct instanceof AST_BlockStatement && self === lct))) { if (ab.label) { - remove(ab.label.thedef.references, ab); + remove(ab.label.thedef.references, ab.label); } CHANGED = true; var body = as_statement_array(stat.body).slice(0, -1); stat = stat.clone(); stat.condition = stat.condition.negate(compressor); stat.body = make_node(AST_BlockStatement, stat, { - body: as_statement_array(stat.alternative).concat(ret) + body: ret }); stat.alternative = make_node(AST_BlockStatement, stat, { body: body @@ -392,7 +339,7 @@ merge(Compressor.prototype, { || (ab instanceof AST_Continue && self === loop_body(lct)) || (ab instanceof AST_Break && lct instanceof AST_BlockStatement && self === lct))) { if (ab.label) { - remove(ab.label.thedef.references, ab); + remove(ab.label.thedef.references, ab.label); } CHANGED = true; stat = stat.clone(); @@ -431,7 +378,7 @@ merge(Compressor.prototype, { && loop_body(lct) === self) || (stat instanceof AST_Continue && loop_body(lct) === self)) { if (stat.label) { - remove(stat.label.thedef.references, stat); + remove(stat.label.thedef.references, stat.label); } } else { a.push(stat); @@ -549,40 +496,6 @@ merge(Compressor.prototype, { }, []); }; - function negate_iifes(statements, compressor) { - statements.forEach(function(stat){ - if (stat instanceof AST_SimpleStatement) { - stat.body = (function transform(thing) { - return thing.transform(new TreeTransformer(function(node){ - if (node instanceof AST_Call && node.expression instanceof AST_Function) { - return make_node(AST_UnaryPrefix, node, { - operator: "!", - expression: node - }); - } - else if (node instanceof AST_Call) { - node.expression = transform(node.expression); - } - else if (node instanceof AST_Seq) { - node.car = transform(node.car); - } - else if (node instanceof AST_Conditional) { - var expr = transform(node.condition); - if (expr !== node.condition) { - // it has been negated, reverse - node.condition = expr; - var tmp = node.consequent; - node.consequent = node.alternative; - node.alternative = tmp; - } - } - return node; - })); - })(stat.body); - } - }); - }; - }; function extract_declarations_from_unreachable_code(compressor, stat, target) { @@ -676,14 +589,14 @@ merge(Compressor.prototype, { // elements. If the node has been successfully reduced to a // constant, then the second element tells us the value; // otherwise the second element is missing. The first element - // of the array is always an AST_Node descendant; if + // of the array is always an AST_Node descendant; when // evaluation was successful it's a node that represents the - // constant; otherwise it's the original or a replacement node. + // constant; otherwise it's the original node. AST_Node.DEFMETHOD("evaluate", function(compressor){ if (!compressor.option("evaluate")) return [ this ]; try { - var val = this._eval(compressor); - return [ best_of(make_node_from_constant(compressor, val, this), this), val ]; + var val = this._eval(), ast = make_node_from_constant(compressor, val, this); + return [ best_of(ast, this), val ]; } catch(ex) { if (ex !== def) throw ex; return [ this ]; @@ -697,12 +610,10 @@ merge(Compressor.prototype, { // inherits from AST_Statement; however, an AST_Function // isn't really a statement. This could byte in other // places too. :-( Wish JS had multiple inheritance. - throw def; + return [ this ]; }); - function ev(node, compressor) { - if (!compressor) throw new Error("Compressor must be passed"); - - return node._eval(compressor); + function ev(node) { + return node._eval(); }; def(AST_Node, function(){ throw def; // not constant @@ -710,69 +621,58 @@ merge(Compressor.prototype, { def(AST_Constant, function(){ return this.getValue(); }); - def(AST_UnaryPrefix, function(compressor){ + def(AST_UnaryPrefix, function(){ var e = this.expression; switch (this.operator) { - case "!": return !ev(e, compressor); - case "typeof": - // Function would be evaluated to an array and so typeof would - // incorrectly return 'object'. Hence making is a special case. - if (e instanceof AST_Function) return typeof function(){}; - - e = ev(e, compressor); - - // typeof <RegExp> returns "object" or "function" on different platforms - // so cannot evaluate reliably - if (e instanceof RegExp) throw def; - - return typeof e; - case "void": return void ev(e, compressor); - case "~": return ~ev(e, compressor); + case "!": return !ev(e); + case "typeof": return typeof ev(e); + case "void": return void ev(e); + case "~": return ~ev(e); case "-": - e = ev(e, compressor); + e = ev(e); if (e === 0) throw def; return -e; - case "+": return +ev(e, compressor); + case "+": return +ev(e); } throw def; }); - def(AST_Binary, function(c){ + def(AST_Binary, function(){ var left = this.left, right = this.right; switch (this.operator) { - case "&&" : return ev(left, c) && ev(right, c); - case "||" : return ev(left, c) || ev(right, c); - case "|" : return ev(left, c) | ev(right, c); - case "&" : return ev(left, c) & ev(right, c); - case "^" : return ev(left, c) ^ ev(right, c); - case "+" : return ev(left, c) + ev(right, c); - case "*" : return ev(left, c) * ev(right, c); - case "/" : return ev(left, c) / ev(right, c); - case "%" : return ev(left, c) % ev(right, c); - case "-" : return ev(left, c) - ev(right, c); - case "<<" : return ev(left, c) << ev(right, c); - case ">>" : return ev(left, c) >> ev(right, c); - case ">>>" : return ev(left, c) >>> ev(right, c); - case "==" : return ev(left, c) == ev(right, c); - case "===" : return ev(left, c) === ev(right, c); - case "!=" : return ev(left, c) != ev(right, c); - case "!==" : return ev(left, c) !== ev(right, c); - case "<" : return ev(left, c) < ev(right, c); - case "<=" : return ev(left, c) <= ev(right, c); - case ">" : return ev(left, c) > ev(right, c); - case ">=" : return ev(left, c) >= ev(right, c); - case "in" : return ev(left, c) in ev(right, c); - case "instanceof" : return ev(left, c) instanceof ev(right, c); + case "&&" : return ev(left) && ev(right); + case "||" : return ev(left) || ev(right); + case "|" : return ev(left) | ev(right); + case "&" : return ev(left) & ev(right); + case "^" : return ev(left) ^ ev(right); + case "+" : return ev(left) + ev(right); + case "*" : return ev(left) * ev(right); + case "/" : return ev(left) / ev(right); + case "%" : return ev(left) % ev(right); + case "-" : return ev(left) - ev(right); + case "<<" : return ev(left) << ev(right); + case ">>" : return ev(left) >> ev(right); + case ">>>" : return ev(left) >>> ev(right); + case "==" : return ev(left) == ev(right); + case "===" : return ev(left) === ev(right); + case "!=" : return ev(left) != ev(right); + case "!==" : return ev(left) !== ev(right); + case "<" : return ev(left) < ev(right); + case "<=" : return ev(left) <= ev(right); + case ">" : return ev(left) > ev(right); + case ">=" : return ev(left) >= ev(right); + case "in" : return ev(left) in ev(right); + case "instanceof" : return ev(left) instanceof ev(right); } throw def; }); - def(AST_Conditional, function(compressor){ - return ev(this.condition, compressor) - ? ev(this.consequent, compressor) - : ev(this.alternative, compressor); + def(AST_Conditional, function(){ + return ev(this.condition) + ? ev(this.consequent) + : ev(this.alternative); }); - def(AST_SymbolRef, function(compressor){ + def(AST_SymbolRef, function(){ var d = this.definition(); - if (d && d.constant && d.init) return ev(d.init, compressor); + if (d && d.constant && d.init) return ev(d.init); throw def; }); })(function(node, func){ @@ -848,78 +748,70 @@ merge(Compressor.prototype, { // determine if expression has side effects (function(def){ - def(AST_Node, function(compressor){ return true }); + def(AST_Node, function(){ return true }); - def(AST_EmptyStatement, function(compressor){ return false }); - def(AST_Constant, function(compressor){ return false }); - def(AST_This, function(compressor){ return false }); + def(AST_EmptyStatement, function(){ return false }); + def(AST_Constant, function(){ return false }); + def(AST_This, function(){ return false }); - def(AST_Call, function(compressor){ - var pure = compressor.option("pure_funcs"); - if (!pure) return true; - return pure.indexOf(this.expression.print_to_string()) < 0; - }); - - def(AST_Block, function(compressor){ + def(AST_Block, function(){ for (var i = this.body.length; --i >= 0;) { - if (this.body[i].has_side_effects(compressor)) + if (this.body[i].has_side_effects()) return true; } return false; }); - def(AST_SimpleStatement, function(compressor){ - return this.body.has_side_effects(compressor); + def(AST_SimpleStatement, function(){ + return this.body.has_side_effects(); }); - def(AST_Defun, function(compressor){ return true }); - def(AST_Function, function(compressor){ return false }); - def(AST_Binary, function(compressor){ - return this.left.has_side_effects(compressor) - || this.right.has_side_effects(compressor); + def(AST_Defun, function(){ return true }); + def(AST_Function, function(){ return false }); + def(AST_Binary, function(){ + return this.left.has_side_effects() + || this.right.has_side_effects(); }); - def(AST_Assign, function(compressor){ return true }); - def(AST_Conditional, function(compressor){ - return this.condition.has_side_effects(compressor) - || this.consequent.has_side_effects(compressor) - || this.alternative.has_side_effects(compressor); + def(AST_Assign, function(){ return true }); + def(AST_Conditional, function(){ + return this.condition.has_side_effects() + || this.consequent.has_side_effects() + || this.alternative.has_side_effects(); }); - def(AST_Unary, function(compressor){ + def(AST_Unary, function(){ return this.operator == "delete" || this.operator == "++" || this.operator == "--" - || this.expression.has_side_effects(compressor); + || this.expression.has_side_effects(); }); - def(AST_SymbolRef, function(compressor){ return false }); - def(AST_Object, function(compressor){ + def(AST_SymbolRef, function(){ return false }); + def(AST_Object, function(){ for (var i = this.properties.length; --i >= 0;) - if (this.properties[i].has_side_effects(compressor)) + if (this.properties[i].has_side_effects()) return true; return false; }); - def(AST_ObjectProperty, function(compressor){ - return this.value.has_side_effects(compressor); + def(AST_ObjectProperty, function(){ + return this.value.has_side_effects(); }); - def(AST_Array, function(compressor){ + def(AST_Array, function(){ for (var i = this.elements.length; --i >= 0;) - if (this.elements[i].has_side_effects(compressor)) + if (this.elements[i].has_side_effects()) return true; return false; }); - def(AST_Dot, function(compressor){ - if (!compressor.option("pure_getters")) return true; - return this.expression.has_side_effects(compressor); - }); - def(AST_Sub, function(compressor){ - if (!compressor.option("pure_getters")) return true; - return this.expression.has_side_effects(compressor) - || this.property.has_side_effects(compressor); - }); - def(AST_PropAccess, function(compressor){ - return !compressor.option("pure_getters"); + // def(AST_Dot, function(){ + // return this.expression.has_side_effects(); + // }); + // def(AST_Sub, function(){ + // return this.expression.has_side_effects() + // || this.property.has_side_effects(); + // }); + def(AST_PropAccess, function(){ + return true; }); - def(AST_Seq, function(compressor){ - return this.car.has_side_effects(compressor) - || this.cdr.has_side_effects(compressor); + def(AST_Seq, function(){ + return this.car.has_side_effects() + || this.cdr.has_side_effects(); }); })(function(node, func){ node.DEFMETHOD("has_side_effects", func); @@ -1003,7 +895,7 @@ merge(Compressor.prototype, { node.definitions.forEach(function(def){ if (def.value) { initializations.add(def.name.name, def.value); - if (def.value.has_side_effects(compressor)) { + if (def.value.has_side_effects()) { def.value.walk(tw); } } @@ -1044,21 +936,19 @@ merge(Compressor.prototype, { // pass 3: we should drop declarations not in_use var tt = new TreeTransformer( function before(node, descend, in_list) { - if (node instanceof AST_Lambda && !(node instanceof AST_Accessor)) { - if (!compressor.option("keep_fargs")) { - for (var a = node.argnames, i = a.length; --i >= 0;) { - var sym = a[i]; - if (sym.unreferenced()) { - a.pop(); - compressor.warn("Dropping unused function argument {name} [{file}:{line},{col}]", { - name : sym.name, - file : sym.start.file, - line : sym.start.line, - col : sym.start.col - }); - } - else break; + if (node instanceof AST_Lambda) { + for (var a = node.argnames, i = a.length; --i >= 0;) { + var sym = a[i]; + if (sym.unreferenced()) { + a.pop(); + compressor.warn("Dropping unused function argument {name} [{file}:{line},{col}]", { + name : sym.name, + file : sym.start.file, + line : sym.start.line, + col : sym.start.col + }); } + else break; } } if (node instanceof AST_Defun && node !== self) { @@ -1082,7 +972,7 @@ merge(Compressor.prototype, { line : def.name.start.line, col : def.name.start.col }; - if (def.value && def.value.has_side_effects(compressor)) { + if (def.value && def.value.has_side_effects()) { def._unused_side_effects = true; compressor.warn("Side effects in initialization of unused variable {name} [{file}:{line},{col}]", w); return true; @@ -1136,23 +1026,18 @@ merge(Compressor.prototype, { } return node; } - if (node instanceof AST_For) { + if (node instanceof AST_For && node.init instanceof AST_BlockStatement) { descend(node, this); - - if (node.init instanceof AST_BlockStatement) { - // certain combination of unused name + side effect leads to: - // https://github.com/mishoo/UglifyJS2/issues/44 - // that's an invalid AST. - // We fix it at this stage by moving the `var` outside the `for`. - - var body = node.init.body.slice(0, -1); - node.init = node.init.body.slice(-1)[0].body; - body.push(node); - - return in_list ? MAP.splice(body) : make_node(AST_BlockStatement, node, { - body: body - }); - } + // certain combination of unused name + side effect leads to: + // https://github.com/mishoo/UglifyJS2/issues/44 + // that's an invalid AST. + // We fix it at this stage by moving the `var` outside the `for`. + var body = node.init.body.slice(0, -1); + node.init = node.init.body.slice(-1)[0].body; + body.push(node); + return in_list ? MAP.splice(body) : make_node(AST_BlockStatement, node, { + body: body + }); } if (node instanceof AST_Scope && node !== self) return node; @@ -1289,7 +1174,7 @@ merge(Compressor.prototype, { OPT(AST_SimpleStatement, function(self, compressor){ if (compressor.option("side_effects")) { - if (!self.body.has_side_effects(compressor)) { + if (!self.body.has_side_effects()) { compressor.warn("Dropping side-effect-free statement [{file}:{line},{col}]", self.start); return make_node(AST_EmptyStatement, self); } @@ -1312,6 +1197,8 @@ merge(Compressor.prototype, { extract_declarations_from_unreachable_code(compressor, self.body, a); return make_node(AST_BlockStatement, self, { body: a }); } + } else { + return self.body; } } return self; @@ -1529,18 +1416,11 @@ merge(Compressor.prototype, { body: self.expression }).transform(compressor); } - for(;;) { - var last_branch = self.body[self.body.length - 1]; - if (last_branch) { - var stat = last_branch.body[last_branch.body.length - 1]; // last statement - if (stat instanceof AST_Break && loop_body(compressor.loopcontrol_target(stat.label)) === self) - last_branch.body.pop(); - if (last_branch instanceof AST_Default && last_branch.body.length == 0) { - self.body.pop(); - continue; - } - } - break; + var last_branch = self.body[self.body.length - 1]; + if (last_branch) { + var stat = last_branch.body[last_branch.body.length - 1]; // last statement + if (stat instanceof AST_Break && loop_body(compressor.loopcontrol_target(stat.label)) === self) + last_branch.body.pop(); } var exp = self.expression.evaluate(compressor); out: if (exp.length == 2) try { @@ -1673,7 +1553,7 @@ merge(Compressor.prototype, { if (self.args.length != 1) { return make_node(AST_Array, self, { elements: self.args - }).transform(compressor); + }); } break; case "Object": @@ -1687,80 +1567,11 @@ merge(Compressor.prototype, { if (self.args.length == 0) return make_node(AST_String, self, { value: "" }); - if (self.args.length <= 1) return make_node(AST_Binary, self, { + return make_node(AST_Binary, self, { left: self.args[0], operator: "+", right: make_node(AST_String, self, { value: "" }) - }).transform(compressor); - break; - case "Number": - if (self.args.length == 0) return make_node(AST_Number, self, { - value: 0 }); - if (self.args.length == 1) return make_node(AST_UnaryPrefix, self, { - expression: self.args[0], - operator: "+" - }).transform(compressor); - case "Boolean": - if (self.args.length == 0) return make_node(AST_False, self); - if (self.args.length == 1) return make_node(AST_UnaryPrefix, self, { - expression: make_node(AST_UnaryPrefix, null, { - expression: self.args[0], - operator: "!" - }), - operator: "!" - }).transform(compressor); - break; - case "Function": - if (all(self.args, function(x){ return x instanceof AST_String })) { - // quite a corner-case, but we can handle it: - // https://github.com/mishoo/UglifyJS2/issues/203 - // if the code argument is a constant, then we can minify it. - try { - var code = "(function(" + self.args.slice(0, -1).map(function(arg){ - return arg.value; - }).join(",") + "){" + self.args[self.args.length - 1].value + "})()"; - var ast = parse(code); - ast.figure_out_scope({ screw_ie8: compressor.option("screw_ie8") }); - var comp = new Compressor(compressor.options); - ast = ast.transform(comp); - ast.figure_out_scope({ screw_ie8: compressor.option("screw_ie8") }); - ast.mangle_names(); - var fun; - try { - ast.walk(new TreeWalker(function(node){ - if (node instanceof AST_Lambda) { - fun = node; - throw ast; - } - })); - } catch(ex) { - if (ex !== ast) throw ex; - }; - var args = fun.argnames.map(function(arg, i){ - return make_node(AST_String, self.args[i], { - value: arg.print_to_string() - }); - }); - var code = OutputStream(); - AST_BlockStatement.prototype._codegen.call(fun, fun, code); - code = code.toString().replace(/^\{|\}$/g, ""); - args.push(make_node(AST_String, self.args[self.args.length - 1], { - value: code - })); - self.args = args; - return self; - } catch(ex) { - if (ex instanceof JS_Parse_Error) { - compressor.warn("Error parsing code passed to new Function [{file}:{line},{col}]", self.args[self.args.length - 1].start); - compressor.warn(ex.toString()); - } else { - console.log(ex); - throw ex; - } - } - } - break; } } else if (exp instanceof AST_Dot && exp.property == "toString" && self.args.length == 0) { @@ -1770,70 +1581,15 @@ merge(Compressor.prototype, { right: exp.expression }).transform(compressor); } - else if (exp instanceof AST_Dot && exp.expression instanceof AST_Array && exp.property == "join") EXIT: { - var separator = self.args.length == 0 ? "," : self.args[0].evaluate(compressor)[1]; - if (separator == null) break EXIT; // not a constant - var elements = exp.expression.elements.reduce(function(a, el){ - el = el.evaluate(compressor); - if (a.length == 0 || el.length == 1) { - a.push(el); - } else { - var last = a[a.length - 1]; - if (last.length == 2) { - // it's a constant - var val = "" + last[1] + separator + el[1]; - a[a.length - 1] = [ make_node_from_constant(compressor, val, last[0]), val ]; - } else { - a.push(el); - } - } - return a; - }, []); - if (elements.length == 0) return make_node(AST_String, self, { value: "" }); - if (elements.length == 1) return elements[0][0]; - if (separator == "") { - var first; - if (elements[0][0] instanceof AST_String - || elements[1][0] instanceof AST_String) { - first = elements.shift()[0]; - } else { - first = make_node(AST_String, self, { value: "" }); - } - return elements.reduce(function(prev, el){ - return make_node(AST_Binary, el[0], { - operator : "+", - left : prev, - right : el[0], - }); - }, first).transform(compressor); - } - // need this awkward cloning to not affect original element - // best_of will decide which one to get through. - var node = self.clone(); - node.expression = node.expression.clone(); - node.expression.expression = node.expression.expression.clone(); - node.expression.expression.elements = elements.map(function(el){ - return el[0]; - }); - return best_of(self, node); - } } if (compressor.option("side_effects")) { if (self.expression instanceof AST_Function && self.args.length == 0 - && !AST_Block.prototype.has_side_effects.call(self.expression, compressor)) { - return make_node(AST_Undefined, self).transform(compressor); - } - } - if (compressor.option("drop_console")) { - if (self.expression instanceof AST_PropAccess && - self.expression.expression instanceof AST_SymbolRef && - self.expression.expression.name == "console" && - self.expression.expression.undeclared()) { + && !AST_Block.prototype.has_side_effects.call(self.expression)) { return make_node(AST_Undefined, self).transform(compressor); } } - return self.evaluate(compressor)[0]; + return self; }); OPT(AST_New, function(self, compressor){ @@ -1856,7 +1612,7 @@ merge(Compressor.prototype, { OPT(AST_Seq, function(self, compressor){ if (!compressor.option("side_effects")) return self; - if (!self.car.has_side_effects(compressor)) { + if (!self.car.has_side_effects()) { // we shouldn't compress (1,eval)(something) to // eval(something) because that changes the meaning of // eval (becomes lexical instead of global). @@ -1871,34 +1627,16 @@ merge(Compressor.prototype, { } if (compressor.option("cascade")) { if (self.car instanceof AST_Assign - && !self.car.left.has_side_effects(compressor)) { - if (self.car.left.equivalent_to(self.cdr)) { - return self.car; - } - if (self.cdr instanceof AST_Call - && self.cdr.expression.equivalent_to(self.car.left)) { - self.cdr.expression = self.car; - return self.cdr; - } + && !self.car.left.has_side_effects() + && self.car.left.equivalent_to(self.cdr)) { + return self.car; } - if (!self.car.has_side_effects(compressor) - && !self.cdr.has_side_effects(compressor) + if (!self.car.has_side_effects() + && !self.cdr.has_side_effects() && self.car.equivalent_to(self.cdr)) { return self.car; } } - if (self.cdr instanceof AST_UnaryPrefix - && self.cdr.operator == "void" - && !self.cdr.expression.has_side_effects(compressor)) { - self.cdr.operator = self.car; - return self.cdr; - } - if (self.cdr instanceof AST_Undefined) { - return make_node(AST_UnaryPrefix, self, { - operator : "void", - expression : self.car - }); - } return self; }); @@ -1944,14 +1682,6 @@ merge(Compressor.prototype, { return self.evaluate(compressor)[0]; }); - function has_side_effects_or_prop_access(node, compressor) { - var save_pure_getters = compressor.option("pure_getters"); - compressor.options.pure_getters = false; - var ret = node.has_side_effects(compressor); - compressor.options.pure_getters = save_pure_getters; - return ret; - } - AST_Binary.DEFMETHOD("lift_sequences", function(compressor){ if (compressor.option("sequences")) { if (this.left instanceof AST_Seq) { @@ -1963,8 +1693,8 @@ merge(Compressor.prototype, { return seq; } if (this.right instanceof AST_Seq - && this instanceof AST_Assign - && !has_side_effects_or_prop_access(this.left, compressor)) { + && !(this.operator == "||" || this.operator == "&&") + && !this.left.has_side_effects()) { var seq = this.right; var x = seq.to_array(); this.right = x.pop(); @@ -1979,52 +1709,18 @@ merge(Compressor.prototype, { var commutativeOperators = makePredicate("== === != !== * & | ^"); OPT(AST_Binary, function(self, compressor){ - var reverse = compressor.has_directive("use asm") ? noop - : function(op, force) { - if (force || !(self.left.has_side_effects(compressor) || self.right.has_side_effects(compressor))) { - if (op) self.operator = op; - var tmp = self.left; - self.left = self.right; - self.right = tmp; - } - }; + function reverse(op) { + if (!(self.left.has_side_effects() && self.right.has_side_effects())) { + if (op) self.operator = op; + var tmp = self.left; + self.left = self.right; + self.right = tmp; + } + }; if (commutativeOperators(self.operator)) { if (self.right instanceof AST_Constant && !(self.left instanceof AST_Constant)) { - // if right is a constant, whatever side effects the - // left side might have could not influence the - // result. hence, force switch. - - if (!(self.left instanceof AST_Binary - && PRECEDENCE[self.left.operator] >= PRECEDENCE[self.operator])) { - reverse(null, true); - } - } - if (/^[!=]==?$/.test(self.operator)) { - if (self.left instanceof AST_SymbolRef && self.right instanceof AST_Conditional) { - if (self.right.consequent instanceof AST_SymbolRef - && self.right.consequent.definition() === self.left.definition()) { - if (/^==/.test(self.operator)) return self.right.condition; - if (/^!=/.test(self.operator)) return self.right.condition.negate(compressor); - } - if (self.right.alternative instanceof AST_SymbolRef - && self.right.alternative.definition() === self.left.definition()) { - if (/^==/.test(self.operator)) return self.right.condition.negate(compressor); - if (/^!=/.test(self.operator)) return self.right.condition; - } - } - if (self.right instanceof AST_SymbolRef && self.left instanceof AST_Conditional) { - if (self.left.consequent instanceof AST_SymbolRef - && self.left.consequent.definition() === self.right.definition()) { - if (/^==/.test(self.operator)) return self.left.condition; - if (/^!=/.test(self.operator)) return self.left.condition.negate(compressor); - } - if (self.left.alternative instanceof AST_SymbolRef - && self.left.alternative.definition() === self.right.definition()) { - if (/^==/.test(self.operator)) return self.left.condition.negate(compressor); - if (/^!=/.test(self.operator)) return self.left.condition; - } - } + reverse(); } } self = self.lift_sequences(compressor); @@ -2045,8 +1741,8 @@ merge(Compressor.prototype, { && compressor.option("unsafe")) { if (!(self.right.expression instanceof AST_SymbolRef) || !self.right.expression.undeclared()) { - self.right = self.right.expression; - self.left = make_node(AST_Undefined, self.left).optimize(compressor); + self.left = self.right.expression; + self.right = make_node(AST_Undefined, self.left).optimize(compressor); if (self.operator.length == 2) self.operator += "="; } } @@ -2091,6 +1787,11 @@ merge(Compressor.prototype, { } break; } + var exp = self.evaluate(compressor); + if (exp.length > 1) { + if (best_of(exp[0], self) !== self) + return exp[0]; + } if (compressor.option("comparisons")) { if (!(compressor.parent() instanceof AST_Binary) || compressor.parent() instanceof AST_Assign) { @@ -2110,76 +1811,7 @@ merge(Compressor.prototype, { && self.left.operator == "+" && self.left.is_string(compressor)) { return self.left; } - if (compressor.option("evaluate")) { - if (self.operator == "+") { - if (self.left instanceof AST_Constant - && self.right instanceof AST_Binary - && self.right.operator == "+" - && self.right.left instanceof AST_Constant - && self.right.is_string(compressor)) { - self = make_node(AST_Binary, self, { - operator: "+", - left: make_node(AST_String, null, { - value: "" + self.left.getValue() + self.right.left.getValue(), - start: self.left.start, - end: self.right.left.end - }), - right: self.right.right - }); - } - if (self.right instanceof AST_Constant - && self.left instanceof AST_Binary - && self.left.operator == "+" - && self.left.right instanceof AST_Constant - && self.left.is_string(compressor)) { - self = make_node(AST_Binary, self, { - operator: "+", - left: self.left.left, - right: make_node(AST_String, null, { - value: "" + self.left.right.getValue() + self.right.getValue(), - start: self.left.right.start, - end: self.right.end - }) - }); - } - if (self.left instanceof AST_Binary - && self.left.operator == "+" - && self.left.is_string(compressor) - && self.left.right instanceof AST_Constant - && self.right instanceof AST_Binary - && self.right.operator == "+" - && self.right.left instanceof AST_Constant - && self.right.is_string(compressor)) { - self = make_node(AST_Binary, self, { - operator: "+", - left: make_node(AST_Binary, self.left, { - operator: "+", - left: self.left.left, - right: make_node(AST_String, null, { - value: "" + self.left.right.getValue() + self.right.left.getValue(), - start: self.left.right.start, - end: self.right.left.end - }) - }), - right: self.right.right - }); - } - } - } - // x * (y * z) ==> x * y * z - if (self.right instanceof AST_Binary - && self.right.operator == self.operator - && (self.operator == "*" || self.operator == "&&" || self.operator == "||")) - { - self.left = make_node(AST_Binary, self.left, { - operator : self.operator, - left : self.left, - right : self.right.left - }); - self.right = self.right.right; - return self.transform(compressor); - } - return self.evaluate(compressor)[0]; + return self; }); OPT(AST_SymbolRef, function(self, compressor){ @@ -2270,7 +1902,7 @@ merge(Compressor.prototype, { * ==> * exp = foo ? something : something_else; */ - return make_node(AST_Assign, self, { + self = make_node(AST_Assign, self, { operator: consequent.operator, left: consequent.left, right: make_node(AST_Conditional, self, { @@ -2280,38 +1912,6 @@ merge(Compressor.prototype, { }) }); } - if (consequent instanceof AST_Call - && alternative.TYPE === consequent.TYPE - && consequent.args.length == alternative.args.length - && consequent.expression.equivalent_to(alternative.expression)) { - if (consequent.args.length == 0) { - return make_node(AST_Seq, self, { - car: self.condition, - cdr: consequent - }); - } - if (consequent.args.length == 1) { - consequent.args[0] = make_node(AST_Conditional, self, { - condition: self.condition, - consequent: consequent.args[0], - alternative: alternative.args[0] - }); - return consequent; - } - } - // x?y?z:a:a --> x&&y?z:a - if (consequent instanceof AST_Conditional - && consequent.alternative.equivalent_to(alternative)) { - return make_node(AST_Conditional, self, { - condition: make_node(AST_Binary, self, { - left: self.condition, - operator: "&&", - right: consequent.condition - }), - consequent: consequent.consequent, - alternative: alternative - }); - } return self; }); @@ -2345,18 +1945,12 @@ merge(Compressor.prototype, { var prop = self.property; if (prop instanceof AST_String && compressor.option("properties")) { prop = prop.getValue(); - if (RESERVED_WORDS(prop) ? compressor.option("screw_ie8") : is_identifier_string(prop)) { + if (is_identifier(prop)) { return make_node(AST_Dot, self, { expression : self.expression, property : prop }); } - var v = parseFloat(prop); - if (!isNaN(v) && v.toString() == prop) { - self.property = make_node(AST_Number, self.property, { - value: v - }); - } } return self; }); diff --git a/node_modules/boomlet/node_modules/uglify-js/lib/mozilla-ast.js b/node_modules/bookmarklet/node_modules/uglify-js/lib/mozilla-ast.js index d795094..982d621 100644 --- a/node_modules/boomlet/node_modules/uglify-js/lib/mozilla-ast.js +++ b/node_modules/bookmarklet/node_modules/uglify-js/lib/mozilla-ast.js @@ -148,14 +148,12 @@ }; function From_Moz_Unary(M) { - var prefix = "prefix" in M ? M.prefix - : M.type == "UnaryExpression" ? true : false; - return new (prefix ? AST_UnaryPrefix : AST_UnaryPostfix)({ + return new (M.prefix ? AST_UnaryPrefix : AST_UnaryPostfix)({ start : my_start_token(M), end : my_end_token(M), operator : M.operator, expression : from_moz(M.argument) - }); + }) }; var ME_TO_MOZ = {}; diff --git a/node_modules/boomlet/node_modules/uglify-js/lib/output.js b/node_modules/bookmarklet/node_modules/uglify-js/lib/output.js index adbc9a4..42b3aad 100644 --- a/node_modules/boomlet/node_modules/uglify-js/lib/output.js +++ b/node_modules/bookmarklet/node_modules/uglify-js/lib/output.js @@ -46,23 +46,21 @@ function OutputStream(options) { options = defaults(options, { - indent_start : 0, - indent_level : 4, - quote_keys : false, - space_colon : true, - ascii_only : false, - unescape_regexps : false, - inline_script : false, - width : 80, - max_line_len : 32000, - beautify : false, - source_map : null, - bracketize : false, - semicolons : true, - comments : false, - preserve_line : false, - screw_ie8 : false, - preamble : null, + indent_start : 0, + indent_level : 4, + quote_keys : false, + space_colon : true, + ascii_only : false, + inline_script : false, + width : 80, + max_line_len : 32000, + ie_proof : true, + beautify : false, + source_map : null, + bracketize : false, + semicolons : true, + comments : false, + preserve_line : false }, true); var indentation = 0; @@ -71,16 +69,11 @@ function OutputStream(options) { var current_pos = 0; var OUTPUT = ""; - function to_ascii(str, identifier) { + function to_ascii(str) { return str.replace(/[\u0080-\uffff]/g, function(ch) { var code = ch.charCodeAt(0).toString(16); - if (code.length <= 2 && !identifier) { - while (code.length < 2) code = "0" + code; - return "\\x" + code; - } else { - while (code.length < 4) code = "0" + code; - return "\\u" + code; - } + while (code.length < 4) code = "0" + code; + return "\\u" + code; }); }; @@ -97,7 +90,7 @@ function OutputStream(options) { case "\u2029": return "\\u2029"; case '"': ++dq; return '"'; case "'": ++sq; return "'"; - case "\0": return "\\x00"; + case "\0": return "\\0"; } return s; }); @@ -116,7 +109,7 @@ function OutputStream(options) { function make_name(name) { name = name.toString(); if (options.ascii_only) - name = to_ascii(name, true); + name = to_ascii(name); return name; }; @@ -301,10 +294,6 @@ function OutputStream(options) { return OUTPUT; }; - if (options.preamble) { - print(options.preamble.replace(/\r\n?|[\n\u2028\u2029]|\s*$/g, "\n")); - } - var stack = []; return { get : get, @@ -356,16 +345,17 @@ function OutputStream(options) { AST_Node.DEFMETHOD("print", function(stream, force_parens){ var self = this, generator = self._codegen; - function doit() { - self.add_comments(stream); - self.add_source_map(stream); - generator(self, stream); - } stream.push_node(self); if (force_parens || self.needs_parens(stream)) { - stream.with_parens(doit); + stream.with_parens(function(){ + self.add_comments(stream); + self.add_source_map(stream); + generator(self, stream); + }); } else { - doit(); + self.add_comments(stream); + self.add_source_map(stream); + generator(self, stream); } stream.pop_node(); }); @@ -384,23 +374,15 @@ function OutputStream(options) { var start = self.start; if (start && !start._comments_dumped) { start._comments_dumped = true; - var comments = start.comments_before || []; + var comments = start.comments_before; // XXX: ugly fix for https://github.com/mishoo/UglifyJS2/issues/112 - // and https://github.com/mishoo/UglifyJS2/issues/372 - if (self instanceof AST_Exit && self.value) { - self.value.walk(new TreeWalker(function(node){ - if (node.start && node.start.comments_before) { - comments = comments.concat(node.start.comments_before); - node.start.comments_before = []; - } - if (node instanceof AST_Function || - node instanceof AST_Array || - node instanceof AST_Object) - { - return true; // don't go inside. - } - })); + // if this node is `return` or `throw`, we cannot allow comments before + // the returned or thrown value. + if (self instanceof AST_Exit && + self.value && self.value.start.comments_before.length > 0) { + comments = (comments || []).concat(self.value.start.comments_before); + self.value.start.comments_before = []; } if (c.test) { @@ -413,7 +395,7 @@ function OutputStream(options) { }); } comments.forEach(function(c){ - if (/comment[134]/.test(c.type)) { + if (c.type == "comment1") { output.print("//" + c.value + "\n"); output.indent(); } @@ -464,7 +446,7 @@ function OutputStream(options) { || p instanceof AST_Unary // !(foo, bar, baz) || p instanceof AST_Binary // 1 + (2, 3) + 4 ==> 8 || p instanceof AST_VarDef // var a = (1, 2), b = a + a; ==> b == 4 - || p instanceof AST_PropAccess // (1, {foo:2}).foo or (1, {foo:2})["foo"] ==> 2 + || p instanceof AST_Dot // (1, {foo:2}).foo ==> 2 || p instanceof AST_Array // [ 1, (2, 3), 4 ] ==> [ 1, 3, 4 ] || p instanceof AST_ObjectProperty // { foo: (1, 2) }.foo ==> 2 || p instanceof AST_Conditional /* (false, true) ? (a = 10, b = 20) : (c = 30) @@ -489,7 +471,11 @@ function OutputStream(options) { var so = this.operator, sp = PRECEDENCE[so]; if (pp > sp || (pp == sp - && this === p.right)) { + && this === p.right + && !(so == po && + (so == "*" || + so == "&&" || + so == "||")))) { return true; } } @@ -516,17 +502,8 @@ function OutputStream(options) { }); PARENS(AST_Call, function(output){ - var p = output.parent(), p1; - if (p instanceof AST_New && p.expression === this) - return true; - - // workaround for Safari bug. - // https://bugs.webkit.org/show_bug.cgi?id=123506 - return this.expression instanceof AST_Function - && p instanceof AST_PropAccess - && p.expression === this - && (p1 = output.parent(1)) instanceof AST_Assign - && p1.left === p; + var p = output.parent(); + return p instanceof AST_New && p.expression === this; }); PARENS(AST_New, function(output){ @@ -775,7 +752,7 @@ function OutputStream(options) { if (!self.body) return output.force_semicolon(); if (self.body instanceof AST_Do - && !output.option("screw_ie8")) { + && output.option("ie_proof")) { // https://github.com/mishoo/UglifyJS/issues/#issue/57 IE // croaks with "syntax error" on code like this: if (foo) // do ... while(cond); else ... we need block brackets @@ -1008,18 +985,7 @@ function OutputStream(options) { self.left.print(output); output.space(); output.print(self.operator); - if (self.operator == "<" - && self.right instanceof AST_UnaryPrefix - && self.right.operator == "!" - && self.right.expression instanceof AST_UnaryPrefix - && self.right.expression.operator == "--") { - // space is mandatory to avoid outputting <!-- - // http://javascript.spec.whatwg.org/#comment-syntax - output.print(" "); - } else { - // the space is optional depending on "beautify" - output.space(); - } + output.space(); self.right.print(output); }); DEFPRINT(AST_Conditional, function(self, output){ @@ -1041,11 +1007,6 @@ function OutputStream(options) { a.forEach(function(exp, i){ if (i) output.comma(); exp.print(output); - // If the final element is a hole, we need to make sure it - // doesn't look like a trailing comma, by inserting an actual - // trailing comma. - if (i === len - 1 && exp instanceof AST_Hole) - output.comma(); }); if (len > 0) output.space(); }); @@ -1067,30 +1028,26 @@ function OutputStream(options) { DEFPRINT(AST_ObjectKeyVal, function(self, output){ var key = self.key; if (output.option("quote_keys")) { - output.print_string(key + ""); + output.print_string(key); } else if ((typeof key == "number" || !output.option("beautify") && +key + "" == key) && parseFloat(key) >= 0) { output.print(make_num(key)); - } else if (RESERVED_WORDS(key) ? output.option("screw_ie8") : is_identifier_string(key)) { - output.print_name(key); - } else { + } else if (!is_identifier(key)) { output.print_string(key); + } else { + output.print_name(key); } output.colon(); self.value.print(output); }); DEFPRINT(AST_ObjectSetter, function(self, output){ output.print("set"); - output.space(); - self.key.print(output); self.value._do_print(output, true); }); DEFPRINT(AST_ObjectGetter, function(self, output){ output.print("get"); - output.space(); - self.key.print(output); self.value._do_print(output, true); }); DEFPRINT(AST_Symbol, function(self, output){ @@ -1119,47 +1076,10 @@ function OutputStream(options) { DEFPRINT(AST_Number, function(self, output){ output.print(make_num(self.getValue())); }); - - function regexp_safe_literal(code) { - return [ - 0x5c , // \ - 0x2f , // / - 0x2e , // . - 0x2b , // + - 0x2a , // * - 0x3f , // ? - 0x28 , // ( - 0x29 , // ) - 0x5b , // [ - 0x5d , // ] - 0x7b , // { - 0x7d , // } - 0x24 , // $ - 0x5e , // ^ - 0x3a , // : - 0x7c , // | - 0x21 , // ! - 0x0a , // \n - 0x0d , // \r - 0x00 , // \0 - 0xfeff , // Unicode BOM - 0x2028 , // unicode "line separator" - 0x2029 , // unicode "paragraph separator" - ].indexOf(code) < 0; - }; - DEFPRINT(AST_RegExp, function(self, output){ var str = self.getValue().toString(); - if (output.option("ascii_only")) { + if (output.option("ascii_only")) str = output.to_ascii(str); - } else if (output.option("unescape_regexps")) { - str = str.split("\\\\").map(function(str){ - return str.replace(/\\u[0-9a-fA-F]{4}|\\x[0-9a-fA-F]{2}/g, function(s){ - var code = parseInt(s.substr(2), 16); - return regexp_safe_literal(code) ? String.fromCharCode(code) : s; - }); - }).join("\\\\"); - } output.print(str); var p = output.parent(); if (p instanceof AST_Binary && /^in/.test(p.operator) && p.left === self) @@ -1194,7 +1114,7 @@ function OutputStream(options) { if (p instanceof AST_Statement && p.body === node) return true; if ((p instanceof AST_Seq && p.car === node ) || - (p instanceof AST_Call && p.expression === node && !(p instanceof AST_New) ) || + (p instanceof AST_Call && p.expression === node ) || (p instanceof AST_Dot && p.expression === node ) || (p instanceof AST_Sub && p.expression === node ) || (p instanceof AST_Conditional && p.condition === node ) || diff --git a/node_modules/boomlet/node_modules/uglify-js/lib/parse.js b/node_modules/bookmarklet/node_modules/uglify-js/lib/parse.js index b061067..5a75e75 100644 --- a/node_modules/boomlet/node_modules/uglify-js/lib/parse.js +++ b/node_modules/bookmarklet/node_modules/uglify-js/lib/parse.js @@ -46,7 +46,7 @@ var KEYWORDS = 'break case catch const continue debugger default delete do else finally for function if in instanceof new return switch throw try typeof var void while with'; var KEYWORDS_ATOM = 'false null true'; -var RESERVED_WORDS = 'abstract boolean byte char class double enum export extends final float goto implements import int interface long native package private protected public short static super synchronized this throws transient volatile yield' +var RESERVED_WORDS = 'abstract boolean byte char class double enum export extends final float goto implements import int interface long native package private protected public short static super synchronized this throws transient volatile' + " " + KEYWORDS_ATOM + " " + KEYWORDS; var KEYWORDS_BEFORE_EXPRESSION = 'return new delete throw else case'; @@ -149,7 +149,7 @@ function is_unicode_connector_punctuation(ch) { }; function is_identifier(name) { - return !RESERVED_WORDS(name) && /^[a-z_$][a-z0-9_$]*$/i.test(name); + return /^[a-z_$][a-z0-9_$]*$/i.test(name) && !RESERVED_WORDS(name); }; function is_identifier_start(code) { @@ -167,17 +167,6 @@ function is_identifier_char(ch) { ; }; -function is_identifier_string(str){ - var i = str.length; - if (i == 0) return false; - if (!is_identifier_start(str.charCodeAt(0))) return false; - while (--i >= 0) { - if (!is_identifier_char(str.charAt(i))) - return false; - } - return true; -}; - function parse_js_number(num) { if (RE_HEX_NUMBER.test(num)) { return parseInt(num.substr(2), 16); @@ -201,6 +190,12 @@ JS_Parse_Error.prototype.toString = function() { }; function js_error(message, filename, line, col, pos) { + AST_Node.warn("ERROR: {message} [{file}:{line},{col}]", { + message: message, + file: filename, + line: line, + col: col + }); throw new JS_Parse_Error(message, line, col, pos); }; @@ -210,7 +205,7 @@ function is_token(token, type, val) { var EX_EOF = {}; -function tokenizer($TEXT, filename, html5_comments) { +function tokenizer($TEXT, filename) { var S = { text : $TEXT.replace(/\r\n?|[\n\u2028\u2029]/g, "\n").replace(/\uFEFF/g, ''), @@ -242,14 +237,6 @@ function tokenizer($TEXT, filename, html5_comments) { return ch; }; - function forward(i) { - while (i-- > 0) next(); - }; - - function looking_at(str) { - return S.text.substr(S.pos, str.length) == str; - }; - function find(what, signal_eof) { var pos = S.text.indexOf(what, S.pos); if (signal_eof && pos == -1) throw EX_EOF; @@ -262,12 +249,10 @@ function tokenizer($TEXT, filename, html5_comments) { S.tokpos = S.pos; }; - var prev_was_dot = false; function token(type, value, is_comment) { - S.regex_allowed = ((type == "operator" && !UNARY_POSTFIX(value)) || + S.regex_allowed = ((type == "operator" && !UNARY_POSTFIX[value]) || (type == "keyword" && KEYWORDS_BEFORE_EXPRESSION(value)) || (type == "punc" && PUNC_BEFORE_EXPRESSION(value))); - prev_was_dot = (type == "punc" && value == "."); var ret = { type : type, value : value, @@ -389,8 +374,8 @@ function tokenizer($TEXT, filename, html5_comments) { return token("string", ret); }); - function skip_line_comment(type) { - var regex_allowed = S.regex_allowed; + function read_line_comment() { + next(); var i = find("\n"), ret; if (i == -1) { ret = S.text.substr(S.pos); @@ -399,13 +384,11 @@ function tokenizer($TEXT, filename, html5_comments) { ret = S.text.substring(S.pos, i); S.pos = i; } - S.comments_before.push(token(type, ret, true)); - S.regex_allowed = regex_allowed; - return next_token(); + return token("comment1", ret, true); }; - var skip_multiline_comment = with_eof_error("Unterminated multiline comment", function(){ - var regex_allowed = S.regex_allowed; + var read_multiline_comment = with_eof_error("Unterminated multiline comment", function(){ + next(); var i = find("*/", true); var text = S.text.substring(S.pos, i); var a = text.split("\n"), n = a.length; @@ -415,11 +398,8 @@ function tokenizer($TEXT, filename, html5_comments) { if (n > 1) S.col = a[n - 1].length; else S.col += a[n - 1].length; S.col += 2; - var nlb = S.newline_before = S.newline_before || text.indexOf("\n") >= 0; - S.comments_before.push(token("comment2", text, true)); - S.regex_allowed = regex_allowed; - S.newline_before = nlb; - return next_token(); + S.newline_before = S.newline_before || text.indexOf("\n") >= 0; + return token("comment2", text, true); }); function read_name() { @@ -483,13 +463,16 @@ function tokenizer($TEXT, filename, html5_comments) { function handle_slash() { next(); + var regex_allowed = S.regex_allowed; switch (peek()) { case "/": - next(); - return skip_line_comment("comment1"); + S.comments_before.push(read_line_comment()); + S.regex_allowed = regex_allowed; + return next_token(); case "*": - next(); - return skip_multiline_comment(); + S.comments_before.push(read_multiline_comment()); + S.regex_allowed = regex_allowed; + return next_token(); } return S.regex_allowed ? read_regexp("") : read_operator("/"); }; @@ -503,7 +486,6 @@ function tokenizer($TEXT, filename, html5_comments) { function read_word() { var word = read_name(); - if (prev_was_dot) return token("name", word); return KEYWORDS_ATOM(word) ? token("atom", word) : !KEYWORDS(word) ? token("name", word) : OPERATORS(word) ? token("operator", word) @@ -526,16 +508,6 @@ function tokenizer($TEXT, filename, html5_comments) { return read_regexp(force_regexp); skip_whitespace(); start_token(); - if (html5_comments) { - if (looking_at("<!--")) { - forward(4); - return skip_line_comment("comment3"); - } - if (looking_at("-->") && S.newline_before) { - forward(3); - return skip_line_comment("comment4"); - } - } var ch = peek(); if (!ch) return token("eof"); var code = ch.charCodeAt(0); @@ -579,10 +551,10 @@ var UNARY_POSTFIX = makePredicate([ "--", "++" ]); var ASSIGNMENT = makePredicate([ "=", "+=", "-=", "/=", "*=", "%=", ">>=", "<<=", ">>>=", "|=", "^=", "&=" ]); var PRECEDENCE = (function(a, ret){ - for (var i = 0; i < a.length; ++i) { + for (var i = 0, n = 1; i < a.length; ++i, ++n) { var b = a[i]; for (var j = 0; j < b.length; ++j) { - ret[b[j]] = i + 1; + ret[b[j]] = n; } } return ret; @@ -611,18 +583,13 @@ var ATOMIC_START_TOKEN = array_to_hash([ "atom", "num", "string", "regexp", "nam function parse($TEXT, options) { options = defaults(options, { - strict : false, - filename : null, - toplevel : null, - expression : false, - html5_comments : true, + strict : false, + filename : null, + toplevel : null }); var S = { - input : (typeof $TEXT == "string" - ? tokenizer($TEXT, options.filename, - options.html5_comments) - : $TEXT), + input : typeof $TEXT == "string" ? tokenizer($TEXT, options.filename) : $TEXT, token : null, prev : null, peeked : null, @@ -715,16 +682,12 @@ function parse($TEXT, options) { }; }; - function handle_regexp() { + var statement = embed_tokens(function() { + var tmp; if (is("operator", "/") || is("operator", "/=")) { S.peeked = null; S.token = S.input(S.token.value.substr(1)); // force regexp } - }; - - var statement = embed_tokens(function() { - var tmp; - handle_regexp(); switch (S.token.type) { case "string": var dir = S.in_directives, stat = simple_statement(); @@ -789,7 +752,7 @@ function parse($TEXT, options) { return for_(); case "function": - return function_(AST_Defun); + return function_(true); case "if": return if_(); @@ -852,18 +815,6 @@ function parse($TEXT, options) { S.labels.push(label); var stat = statement(); S.labels.pop(); - if (!(stat instanceof AST_IterationStatement)) { - // check for `continue` that refers to this label. - // those should be reported as syntax errors. - // https://github.com/mishoo/UglifyJS2/issues/287 - label.references.forEach(function(ref){ - if (ref instanceof AST_Continue) { - ref = ref.label.start; - croak("Continue label `" + label.name + "` refers to non-IterationStatement.", - ref.line, ref.col, ref.pos); - } - }); - } return new AST_LabeledStatement({ body: stat, label: label }); }; @@ -872,22 +823,18 @@ function parse($TEXT, options) { }; function break_cont(type) { - var label = null, ldef; + var label = null; if (!can_insert_semicolon()) { label = as_symbol(AST_LabelRef, true); } if (label != null) { - ldef = find_if(function(l){ return l.name == label.name }, S.labels); - if (!ldef) + if (!find_if(function(l){ return l.name == label.name }, S.labels)) croak("Undefined label " + label.name); - label.thedef = ldef; } else if (S.in_loop == 0) croak(type.TYPE + " not inside a loop or switch"); semicolon(); - var stat = new type({ label: label }); - if (ldef) ldef.references.push(stat); - return stat; + return new type({ label: label }); }; function for_() { @@ -933,12 +880,19 @@ function parse($TEXT, options) { }); }; - var function_ = function(ctor) { - var in_statement = ctor === AST_Defun; - var name = is("name") ? as_symbol(in_statement ? AST_SymbolDefun : AST_SymbolLambda) : null; + var function_ = function(in_statement, ctor) { + var is_accessor = ctor === AST_Accessor; + var name = (is("name") ? as_symbol(in_statement + ? AST_SymbolDefun + : is_accessor + ? AST_SymbolAccessor + : AST_SymbolLambda) + : is_accessor && (is("string") || is("num")) ? as_atom_node() + : null); if (in_statement && !name) unexpected(); expect("("); + if (!ctor) ctor = in_statement ? AST_Defun : AST_Function; return new ctor({ name: name, argnames: (function(first, a){ @@ -1109,9 +1063,7 @@ function parse($TEXT, options) { var tok = S.token, ret; switch (tok.type) { case "name": - case "keyword": - ret = _make_symbol(AST_SymbolRef); - break; + return as_symbol(AST_SymbolRef); case "num": ret = new AST_Number({ start: tok, end: tok, value: tok.value }); break; @@ -1162,7 +1114,7 @@ function parse($TEXT, options) { } if (is("keyword", "function")) { next(); - var func = function_(AST_Function); + var func = function_(false); func.start = start; func.end = prev(); return subscripts(func, allow_calls); @@ -1210,8 +1162,8 @@ function parse($TEXT, options) { if (name == "get") { a.push(new AST_ObjectGetter({ start : start, - key : as_atom_node(), - value : function_(AST_Accessor), + key : name, + value : function_(false, AST_Accessor), end : prev() })); continue; @@ -1219,8 +1171,8 @@ function parse($TEXT, options) { if (name == "set") { a.push(new AST_ObjectSetter({ start : start, - key : as_atom_node(), - value : function_(AST_Accessor), + key : name, + value : function_(false, AST_Accessor), end : prev() })); continue; @@ -1268,21 +1220,17 @@ function parse($TEXT, options) { } }; - function _make_symbol(type) { - var name = S.token.value; - return new (name == "this" ? AST_This : type)({ - name : String(name), - start : S.token, - end : S.token - }); - }; - function as_symbol(type, noerror) { if (!is("name")) { if (!noerror) croak("Name expected"); return null; } - var sym = _make_symbol(type); + var name = S.token.value; + var sym = new (name == "this" ? AST_This : type)({ + name : String(S.token.value), + start : S.token, + end : S.token + }); next(); return sym; }; @@ -1325,7 +1273,6 @@ function parse($TEXT, options) { var start = S.token; if (is("operator") && UNARY_PREFIX(start.value)) { next(); - handle_regexp(); var ex = make_unary(AST_UnaryPrefix, start.value, maybe_unary(allow_calls)); ex.start = start; ex.end = prev(); @@ -1381,7 +1328,7 @@ function parse($TEXT, options) { condition : expr, consequent : yes, alternative : expression(false, no_in), - end : prev() + end : peek() }); } return expr; @@ -1389,8 +1336,15 @@ function parse($TEXT, options) { function is_assignable(expr) { if (!options.strict) return true; - if (expr instanceof AST_This) return false; - return (expr instanceof AST_PropAccess || expr instanceof AST_Symbol); + switch (expr[0]+"") { + case "dot": + case "sub": + case "new": + case "call": + return true; + case "name": + return expr[1] != "this"; + } }; var maybe_assign = function(no_in) { @@ -1434,10 +1388,6 @@ function parse($TEXT, options) { return ret; }; - if (options.expression) { - return expression(true); - } - return (function(){ var start = S.token; var body = []; diff --git a/node_modules/boomlet/node_modules/uglify-js/lib/scope.js b/node_modules/bookmarklet/node_modules/uglify-js/lib/scope.js index 1ce17fa..f23f6eb 100644 --- a/node_modules/boomlet/node_modules/uglify-js/lib/scope.js +++ b/node_modules/bookmarklet/node_modules/uglify-js/lib/scope.js @@ -57,48 +57,41 @@ function SymbolDef(scope, index, orig) { SymbolDef.prototype = { unmangleable: function(options) { - return (this.global && !(options && options.toplevel)) + return this.global || this.undeclared || (!(options && options.eval) && (this.scope.uses_eval || this.scope.uses_with)); }, mangle: function(options) { - if (!this.mangled_name && !this.unmangleable(options)) { - var s = this.scope; - if (!options.screw_ie8 && this.orig[0] instanceof AST_SymbolLambda) - s = s.parent_scope; - this.mangled_name = s.next_mangled(options, this); - } + if (!this.mangled_name && !this.unmangleable(options)) + this.mangled_name = this.scope.next_mangled(options); } }; -AST_Toplevel.DEFMETHOD("figure_out_scope", function(options){ - options = defaults(options, { - screw_ie8: false - }); +AST_Toplevel.DEFMETHOD("figure_out_scope", function(){ + // This does what ast_add_scope did in UglifyJS v1. + // + // Part of it could be done at parse time, but it would complicate + // the parser (and it's already kinda complex). It's also worth + // having it separated because we might need to call it multiple + // times on the same tree. // pass 1: setup scope chaining and handle definitions var self = this; var scope = self.parent_scope = null; - var defun = null; + var labels = new Dictionary(); var nesting = 0; var tw = new TreeWalker(function(node, descend){ - if (options.screw_ie8 && node instanceof AST_Catch) { - var save_scope = scope; - scope = new AST_Scope(node); - scope.init_scope_vars(nesting); - scope.parent_scope = save_scope; - descend(); - scope = save_scope; - return true; - } if (node instanceof AST_Scope) { node.init_scope_vars(nesting); var save_scope = node.parent_scope = scope; - var save_defun = defun; - defun = scope = node; - ++nesting; descend(); --nesting; + var save_labels = labels; + ++nesting; + scope = node; + labels = new Dictionary(); + descend(); + labels = save_labels; scope = save_scope; - defun = save_defun; + --nesting; return true; // don't descend again in TreeWalker } if (node instanceof AST_Directive) { @@ -111,11 +104,30 @@ AST_Toplevel.DEFMETHOD("figure_out_scope", function(options){ s.uses_with = true; return; } + if (node instanceof AST_LabeledStatement) { + var l = node.label; + if (labels.has(l.name)) + throw new Error(string_template("Label {name} defined twice", l)); + labels.set(l.name, l); + descend(); + labels.del(l.name); + return true; // no descend again + } if (node instanceof AST_Symbol) { node.scope = scope; } + if (node instanceof AST_Label) { + node.thedef = node; + node.init_scope_vars(); + } if (node instanceof AST_SymbolLambda) { - defun.def_function(node); + //scope.def_function(node); + // + // https://github.com/mishoo/UglifyJS2/issues/24 — MSIE + // leaks function expression names into the containing + // scope. Don't like this fix but seems we can't do any + // better. IE: please die. Please! + (node.scope = scope.parent_scope).def_function(node); } else if (node instanceof AST_SymbolDefun) { // Careful here, the scope where this should be defined is @@ -123,17 +135,31 @@ AST_Toplevel.DEFMETHOD("figure_out_scope", function(options){ // scope when we encounter the AST_Defun node (which is // instanceof AST_Scope) but we get to the symbol a bit // later. - (node.scope = defun.parent_scope).def_function(node); + (node.scope = scope.parent_scope).def_function(node); } else if (node instanceof AST_SymbolVar || node instanceof AST_SymbolConst) { - var def = defun.def_variable(node); + var def = scope.def_variable(node); def.constant = node instanceof AST_SymbolConst; def.init = tw.parent().value; } else if (node instanceof AST_SymbolCatch) { - (options.screw_ie8 ? scope : defun) - .def_variable(node); + // XXX: this is wrong according to ECMA-262 (12.4). the + // `catch` argument name should be visible only inside the + // catch block. For a quick fix AST_Catch should inherit + // from AST_Scope. Keeping it this way because of IE, + // which doesn't obey the standard. (it introduces the + // identifier in the enclosing scope) + scope.def_variable(node); + } + if (node instanceof AST_LabelRef) { + var sym = labels.get(node.name); + if (!sym) throw new Error(string_template("Undefined label {name} [{line},{col}]", { + name: node.name, + line: node.start.line, + col: node.start.col + })); + node.thedef = sym; } }); self.walk(tw); @@ -149,6 +175,10 @@ AST_Toplevel.DEFMETHOD("figure_out_scope", function(options){ func = prev_func; return true; } + if (node instanceof AST_LabelRef) { + node.reference(); + return true; + } if (node instanceof AST_SymbolRef) { var name = node.name; var sym = node.scope.find_variable(name); @@ -159,7 +189,6 @@ AST_Toplevel.DEFMETHOD("figure_out_scope", function(options){ } else { g = new SymbolDef(self, globals.size(), node); g.undeclared = true; - g.global = true; globals.set(name, g); } node.thedef = g; @@ -167,7 +196,7 @@ AST_Toplevel.DEFMETHOD("figure_out_scope", function(options){ for (var s = node.scope; s && !s.uses_eval; s = s.parent_scope) s.uses_eval = true; } - if (func && name == "arguments") { + if (name == "arguments") { func.uses_arguments = true; } } else { @@ -213,6 +242,14 @@ AST_SymbolRef.DEFMETHOD("reference", function() { this.frame = this.scope.nesting - def.scope.nesting; }); +AST_Label.DEFMETHOD("init_scope_vars", function(){ + this.references = []; +}); + +AST_LabelRef.DEFMETHOD("reference", function(){ + this.thedef.references.push(this); +}); + AST_Scope.DEFMETHOD("find_variable", function(name){ if (name instanceof AST_Symbol) name = name.name; return this.variables.get(name) @@ -242,19 +279,14 @@ AST_Scope.DEFMETHOD("def_variable", function(symbol){ }); AST_Scope.DEFMETHOD("next_mangled", function(options){ - var ext = this.enclosed; + var ext = this.enclosed, n = ext.length; out: while (true) { var m = base54(++this.cname); if (!is_identifier(m)) continue; // skip over "do" - - // https://github.com/mishoo/UglifyJS2/issues/242 -- do not - // shadow a name excepted from mangling. - if (options.except.indexOf(m) >= 0) continue; - // we must ensure that the mangled name does not shadow a name // from some parent scope that is referenced in this or in // inner scopes. - for (var i = ext.length; --i >= 0;) { + for (var i = n; --i >= 0;) { var sym = ext[i]; var name = sym.mangled_name || (sym.unmangleable(options) && sym.name); if (m == name) continue out; @@ -263,19 +295,6 @@ AST_Scope.DEFMETHOD("next_mangled", function(options){ } }); -AST_Function.DEFMETHOD("next_mangled", function(options, def){ - // #179, #326 - // in Safari strict mode, something like (function x(x){...}) is a syntax error; - // a function expression's argument cannot shadow the function expression's name - - var tricky_def = def.orig[0] instanceof AST_SymbolFunarg && this.name && this.name.definition(); - while (true) { - var name = AST_Lambda.prototype.next_mangled.call(this, options, def); - if (!(tricky_def && tricky_def.mangled_name == name)) - return name; - } -}); - AST_Scope.DEFMETHOD("references", function(sym){ if (sym instanceof AST_Symbol) sym = sym.definition(); return this.enclosed.indexOf(sym) < 0 ? null : sym; @@ -322,11 +341,9 @@ AST_Symbol.DEFMETHOD("global", function(){ AST_Toplevel.DEFMETHOD("_default_mangler_options", function(options){ return defaults(options, { - except : [], - eval : false, - sort : false, - toplevel : false, - screw_ie8 : false + except : [], + eval : false, + sort : false }); }); @@ -365,10 +382,6 @@ AST_Toplevel.DEFMETHOD("mangle_names", function(options){ node.mangled_name = name; return true; } - if (options.screw_ie8 && node instanceof AST_SymbolCatch) { - to_mangle.push(node.definition()); - return; - } }); this.walk(tw); to_mangle.forEach(function(def){ def.mangle(options) }); diff --git a/node_modules/boomlet/node_modules/uglify-js/lib/sourcemap.js b/node_modules/bookmarklet/node_modules/uglify-js/lib/sourcemap.js index 663ef12..3429908 100644 --- a/node_modules/boomlet/node_modules/uglify-js/lib/sourcemap.js +++ b/node_modules/bookmarklet/node_modules/uglify-js/lib/sourcemap.js @@ -49,9 +49,6 @@ function SourceMap(options) { file : null, root : null, orig : null, - - orig_line_diff : 0, - dest_line_diff : 0, }); var generator = new MOZ_SourceMap.SourceMapGenerator({ file : options.file, @@ -64,17 +61,14 @@ function SourceMap(options) { line: orig_line, column: orig_col }); - if (info.source === null) { - return; - } source = info.source; orig_line = info.line; orig_col = info.column; name = info.name; } generator.addMapping({ - generated : { line: gen_line + options.dest_line_diff, column: gen_col }, - original : { line: orig_line + options.orig_line_diff, column: orig_col }, + generated : { line: gen_line, column: gen_col }, + original : { line: orig_line, column: orig_col }, source : source, name : name }); diff --git a/node_modules/boomlet/node_modules/uglify-js/lib/transform.js b/node_modules/bookmarklet/node_modules/uglify-js/lib/transform.js index c3c34f5..8b4fd9f 100644 --- a/node_modules/boomlet/node_modules/uglify-js/lib/transform.js +++ b/node_modules/bookmarklet/node_modules/uglify-js/lib/transform.js @@ -44,6 +44,7 @@ "use strict"; // Tree transformer helpers. +// XXX: eventually I should refactor the compressor to use this infrastructure. function TreeTransformer(before, after) { TreeWalker.call(this); @@ -159,7 +160,6 @@ TreeTransformer.prototype = new TreeWalker; }); _(AST_VarDef, function(self, tw){ - self.name = self.name.transform(tw); if (self.value) self.value = self.value.transform(tw); }); diff --git a/node_modules/boomlet/node_modules/uglify-js/lib/utils.js b/node_modules/bookmarklet/node_modules/uglify-js/lib/utils.js index 7c6a156..c95b982 100644 --- a/node_modules/boomlet/node_modules/uglify-js/lib/utils.js +++ b/node_modules/bookmarklet/node_modules/uglify-js/lib/utils.js @@ -82,23 +82,16 @@ function repeat_string(str, i) { }; function DefaultsError(msg, defs) { - Error.call(this, msg); this.msg = msg; this.defs = defs; }; -DefaultsError.prototype = Object.create(Error.prototype); -DefaultsError.prototype.constructor = DefaultsError; - -DefaultsError.croak = function(msg, defs) { - throw new DefaultsError(msg, defs); -}; function defaults(args, defs, croak) { if (args === true) args = {}; var ret = args || {}; if (croak) for (var i in ret) if (ret.hasOwnProperty(i) && !defs.hasOwnProperty(i)) - DefaultsError.croak("`" + i + "` is not a supported option", defs); + throw new DefaultsError("`" + i + "` is not a supported option", defs); for (var i in defs) if (defs.hasOwnProperty(i)) { ret[i] = (args && args.hasOwnProperty(i)) ? args[i] : defs[i]; } @@ -252,13 +245,6 @@ function makePredicate(words) { return new Function("str", f); }; -function all(array, predicate) { - for (var i = array.length; --i >= 0;) - if (!predicate(array[i])) - return false; - return true; -}; - function Dictionary() { this._values = Object.create(null); this._size = 0; diff --git a/node_modules/boomlet/node_modules/uglify-js/node_modules/optimist/.travis.yml b/node_modules/bookmarklet/node_modules/uglify-js/node_modules/optimist/.travis.yml index cc4dba2..cc4dba2 100644 --- a/node_modules/boomlet/node_modules/uglify-js/node_modules/optimist/.travis.yml +++ b/node_modules/bookmarklet/node_modules/uglify-js/node_modules/optimist/.travis.yml diff --git a/node_modules/boomlet/node_modules/uglify-js/node_modules/optimist/LICENSE b/node_modules/bookmarklet/node_modules/uglify-js/node_modules/optimist/LICENSE index 432d1ae..432d1ae 100644 --- a/node_modules/boomlet/node_modules/uglify-js/node_modules/optimist/LICENSE +++ b/node_modules/bookmarklet/node_modules/uglify-js/node_modules/optimist/LICENSE diff --git a/node_modules/boomlet/node_modules/uglify-js/node_modules/optimist/example/bool.js b/node_modules/bookmarklet/node_modules/uglify-js/node_modules/optimist/example/bool.js index a998fb7..a998fb7 100644 --- a/node_modules/boomlet/node_modules/uglify-js/node_modules/optimist/example/bool.js +++ b/node_modules/bookmarklet/node_modules/uglify-js/node_modules/optimist/example/bool.js diff --git a/node_modules/boomlet/node_modules/uglify-js/node_modules/optimist/example/boolean_double.js b/node_modules/bookmarklet/node_modules/uglify-js/node_modules/optimist/example/boolean_double.js index a35a7e6..a35a7e6 100644 --- a/node_modules/boomlet/node_modules/uglify-js/node_modules/optimist/example/boolean_double.js +++ b/node_modules/bookmarklet/node_modules/uglify-js/node_modules/optimist/example/boolean_double.js diff --git a/node_modules/boomlet/node_modules/uglify-js/node_modules/optimist/example/boolean_single.js b/node_modules/bookmarklet/node_modules/uglify-js/node_modules/optimist/example/boolean_single.js index 017bb68..017bb68 100644 --- a/node_modules/boomlet/node_modules/uglify-js/node_modules/optimist/example/boolean_single.js +++ b/node_modules/bookmarklet/node_modules/uglify-js/node_modules/optimist/example/boolean_single.js diff --git a/node_modules/boomlet/node_modules/uglify-js/node_modules/optimist/example/default_hash.js b/node_modules/bookmarklet/node_modules/uglify-js/node_modules/optimist/example/default_hash.js index ade7768..ade7768 100644 --- a/node_modules/boomlet/node_modules/uglify-js/node_modules/optimist/example/default_hash.js +++ b/node_modules/bookmarklet/node_modules/uglify-js/node_modules/optimist/example/default_hash.js diff --git a/node_modules/boomlet/node_modules/uglify-js/node_modules/optimist/example/default_singles.js b/node_modules/bookmarklet/node_modules/uglify-js/node_modules/optimist/example/default_singles.js index d9b1ff4..d9b1ff4 100644 --- a/node_modules/boomlet/node_modules/uglify-js/node_modules/optimist/example/default_singles.js +++ b/node_modules/bookmarklet/node_modules/uglify-js/node_modules/optimist/example/default_singles.js diff --git a/node_modules/boomlet/node_modules/uglify-js/node_modules/optimist/example/divide.js b/node_modules/bookmarklet/node_modules/uglify-js/node_modules/optimist/example/divide.js index 5e2ee82..5e2ee82 100644 --- a/node_modules/boomlet/node_modules/uglify-js/node_modules/optimist/example/divide.js +++ b/node_modules/bookmarklet/node_modules/uglify-js/node_modules/optimist/example/divide.js diff --git a/node_modules/boomlet/node_modules/uglify-js/node_modules/optimist/example/line_count.js b/node_modules/bookmarklet/node_modules/uglify-js/node_modules/optimist/example/line_count.js index b5f95bf..b5f95bf 100644 --- a/node_modules/boomlet/node_modules/uglify-js/node_modules/optimist/example/line_count.js +++ b/node_modules/bookmarklet/node_modules/uglify-js/node_modules/optimist/example/line_count.js diff --git a/node_modules/boomlet/node_modules/uglify-js/node_modules/optimist/example/line_count_options.js b/node_modules/bookmarklet/node_modules/uglify-js/node_modules/optimist/example/line_count_options.js index d9ac709..d9ac709 100644 --- a/node_modules/boomlet/node_modules/uglify-js/node_modules/optimist/example/line_count_options.js +++ b/node_modules/bookmarklet/node_modules/uglify-js/node_modules/optimist/example/line_count_options.js diff --git a/node_modules/boomlet/node_modules/uglify-js/node_modules/optimist/example/line_count_wrap.js b/node_modules/bookmarklet/node_modules/uglify-js/node_modules/optimist/example/line_count_wrap.js index 4267511..4267511 100644 --- a/node_modules/boomlet/node_modules/uglify-js/node_modules/optimist/example/line_count_wrap.js +++ b/node_modules/bookmarklet/node_modules/uglify-js/node_modules/optimist/example/line_count_wrap.js diff --git a/node_modules/boomlet/node_modules/uglify-js/node_modules/optimist/example/nonopt.js b/node_modules/bookmarklet/node_modules/uglify-js/node_modules/optimist/example/nonopt.js index ee633ee..ee633ee 100644 --- a/node_modules/boomlet/node_modules/uglify-js/node_modules/optimist/example/nonopt.js +++ b/node_modules/bookmarklet/node_modules/uglify-js/node_modules/optimist/example/nonopt.js diff --git a/node_modules/boomlet/node_modules/uglify-js/node_modules/optimist/example/reflect.js b/node_modules/bookmarklet/node_modules/uglify-js/node_modules/optimist/example/reflect.js index 816b3e1..816b3e1 100644 --- a/node_modules/boomlet/node_modules/uglify-js/node_modules/optimist/example/reflect.js +++ b/node_modules/bookmarklet/node_modules/uglify-js/node_modules/optimist/example/reflect.js diff --git a/node_modules/boomlet/node_modules/uglify-js/node_modules/optimist/example/short.js b/node_modules/bookmarklet/node_modules/uglify-js/node_modules/optimist/example/short.js index 1db0ad0..1db0ad0 100644 --- a/node_modules/boomlet/node_modules/uglify-js/node_modules/optimist/example/short.js +++ b/node_modules/bookmarklet/node_modules/uglify-js/node_modules/optimist/example/short.js diff --git a/node_modules/boomlet/node_modules/uglify-js/node_modules/optimist/example/string.js b/node_modules/bookmarklet/node_modules/uglify-js/node_modules/optimist/example/string.js index a8e5aeb..a8e5aeb 100644 --- a/node_modules/boomlet/node_modules/uglify-js/node_modules/optimist/example/string.js +++ b/node_modules/bookmarklet/node_modules/uglify-js/node_modules/optimist/example/string.js diff --git a/node_modules/boomlet/node_modules/uglify-js/node_modules/optimist/example/usage-options.js b/node_modules/bookmarklet/node_modules/uglify-js/node_modules/optimist/example/usage-options.js index b999977..b999977 100644 --- a/node_modules/boomlet/node_modules/uglify-js/node_modules/optimist/example/usage-options.js +++ b/node_modules/bookmarklet/node_modules/uglify-js/node_modules/optimist/example/usage-options.js diff --git a/node_modules/boomlet/node_modules/uglify-js/node_modules/optimist/example/xup.js b/node_modules/bookmarklet/node_modules/uglify-js/node_modules/optimist/example/xup.js index 8f6ecd2..8f6ecd2 100644 --- a/node_modules/boomlet/node_modules/uglify-js/node_modules/optimist/example/xup.js +++ b/node_modules/bookmarklet/node_modules/uglify-js/node_modules/optimist/example/xup.js diff --git a/node_modules/boomlet/node_modules/uglify-js/node_modules/optimist/index.js b/node_modules/bookmarklet/node_modules/uglify-js/node_modules/optimist/index.js index 8ac67eb..8ac67eb 100644 --- a/node_modules/boomlet/node_modules/uglify-js/node_modules/optimist/index.js +++ b/node_modules/bookmarklet/node_modules/uglify-js/node_modules/optimist/index.js diff --git a/node_modules/boomlet/node_modules/open/.jshintignore b/node_modules/bookmarklet/node_modules/uglify-js/node_modules/optimist/node_modules/wordwrap/.npmignore index 651665b..3c3629e 100644 --- a/node_modules/boomlet/node_modules/open/.jshintignore +++ b/node_modules/bookmarklet/node_modules/uglify-js/node_modules/optimist/node_modules/wordwrap/.npmignore @@ -1,2 +1 @@ node_modules -.git diff --git a/node_modules/boomlet/node_modules/uglify-js/node_modules/optimist/node_modules/wordwrap/README.markdown b/node_modules/bookmarklet/node_modules/uglify-js/node_modules/optimist/node_modules/wordwrap/README.markdown index 346374e..346374e 100644 --- a/node_modules/boomlet/node_modules/uglify-js/node_modules/optimist/node_modules/wordwrap/README.markdown +++ b/node_modules/bookmarklet/node_modules/uglify-js/node_modules/optimist/node_modules/wordwrap/README.markdown diff --git a/node_modules/boomlet/node_modules/uglify-js/node_modules/optimist/node_modules/wordwrap/example/center.js b/node_modules/bookmarklet/node_modules/uglify-js/node_modules/optimist/node_modules/wordwrap/example/center.js index a3fbaae..a3fbaae 100644 --- a/node_modules/boomlet/node_modules/uglify-js/node_modules/optimist/node_modules/wordwrap/example/center.js +++ b/node_modules/bookmarklet/node_modules/uglify-js/node_modules/optimist/node_modules/wordwrap/example/center.js diff --git a/node_modules/boomlet/node_modules/uglify-js/node_modules/optimist/node_modules/wordwrap/example/meat.js b/node_modules/bookmarklet/node_modules/uglify-js/node_modules/optimist/node_modules/wordwrap/example/meat.js index a4665e1..a4665e1 100644 --- a/node_modules/boomlet/node_modules/uglify-js/node_modules/optimist/node_modules/wordwrap/example/meat.js +++ b/node_modules/bookmarklet/node_modules/uglify-js/node_modules/optimist/node_modules/wordwrap/example/meat.js diff --git a/node_modules/boomlet/node_modules/uglify-js/node_modules/optimist/node_modules/wordwrap/index.js b/node_modules/bookmarklet/node_modules/uglify-js/node_modules/optimist/node_modules/wordwrap/index.js index c9bc945..c9bc945 100644 --- a/node_modules/boomlet/node_modules/uglify-js/node_modules/optimist/node_modules/wordwrap/index.js +++ b/node_modules/bookmarklet/node_modules/uglify-js/node_modules/optimist/node_modules/wordwrap/index.js diff --git a/node_modules/boomlet/node_modules/uglify-js/node_modules/optimist/node_modules/wordwrap/package.json b/node_modules/bookmarklet/node_modules/uglify-js/node_modules/optimist/node_modules/wordwrap/package.json index df8dc05..df8dc05 100644 --- a/node_modules/boomlet/node_modules/uglify-js/node_modules/optimist/node_modules/wordwrap/package.json +++ b/node_modules/bookmarklet/node_modules/uglify-js/node_modules/optimist/node_modules/wordwrap/package.json diff --git a/node_modules/boomlet/node_modules/uglify-js/node_modules/optimist/node_modules/wordwrap/test/break.js b/node_modules/bookmarklet/node_modules/uglify-js/node_modules/optimist/node_modules/wordwrap/test/break.js index 749292e..749292e 100644 --- a/node_modules/boomlet/node_modules/uglify-js/node_modules/optimist/node_modules/wordwrap/test/break.js +++ b/node_modules/bookmarklet/node_modules/uglify-js/node_modules/optimist/node_modules/wordwrap/test/break.js diff --git a/node_modules/boomlet/node_modules/uglify-js/node_modules/optimist/node_modules/wordwrap/test/idleness.txt b/node_modules/bookmarklet/node_modules/uglify-js/node_modules/optimist/node_modules/wordwrap/test/idleness.txt index aa3f490..aa3f490 100644 --- a/node_modules/boomlet/node_modules/uglify-js/node_modules/optimist/node_modules/wordwrap/test/idleness.txt +++ b/node_modules/bookmarklet/node_modules/uglify-js/node_modules/optimist/node_modules/wordwrap/test/idleness.txt diff --git a/node_modules/boomlet/node_modules/uglify-js/node_modules/optimist/node_modules/wordwrap/test/wrap.js b/node_modules/bookmarklet/node_modules/uglify-js/node_modules/optimist/node_modules/wordwrap/test/wrap.js index 0cfb76d..0cfb76d 100644 --- a/node_modules/boomlet/node_modules/uglify-js/node_modules/optimist/node_modules/wordwrap/test/wrap.js +++ b/node_modules/bookmarklet/node_modules/uglify-js/node_modules/optimist/node_modules/wordwrap/test/wrap.js diff --git a/node_modules/boomlet/node_modules/uglify-js/node_modules/optimist/package.json b/node_modules/bookmarklet/node_modules/uglify-js/node_modules/optimist/package.json index 745129b..745129b 100644 --- a/node_modules/boomlet/node_modules/uglify-js/node_modules/optimist/package.json +++ b/node_modules/bookmarklet/node_modules/uglify-js/node_modules/optimist/package.json diff --git a/node_modules/boomlet/node_modules/uglify-js/node_modules/optimist/readme.markdown b/node_modules/bookmarklet/node_modules/uglify-js/node_modules/optimist/readme.markdown index ad9d3fd..ad9d3fd 100644 --- a/node_modules/boomlet/node_modules/uglify-js/node_modules/optimist/readme.markdown +++ b/node_modules/bookmarklet/node_modules/uglify-js/node_modules/optimist/readme.markdown diff --git a/node_modules/boomlet/node_modules/uglify-js/node_modules/optimist/test/_.js b/node_modules/bookmarklet/node_modules/uglify-js/node_modules/optimist/test/_.js index d9c58b3..d9c58b3 100644 --- a/node_modules/boomlet/node_modules/uglify-js/node_modules/optimist/test/_.js +++ b/node_modules/bookmarklet/node_modules/uglify-js/node_modules/optimist/test/_.js diff --git a/node_modules/boomlet/node_modules/uglify-js/node_modules/optimist/test/_/argv.js b/node_modules/bookmarklet/node_modules/uglify-js/node_modules/optimist/test/_/argv.js index 3d09606..3d09606 100644 --- a/node_modules/boomlet/node_modules/uglify-js/node_modules/optimist/test/_/argv.js +++ b/node_modules/bookmarklet/node_modules/uglify-js/node_modules/optimist/test/_/argv.js diff --git a/node_modules/boomlet/node_modules/uglify-js/node_modules/optimist/test/_/bin.js b/node_modules/bookmarklet/node_modules/uglify-js/node_modules/optimist/test/_/bin.js index 4a18d85..4a18d85 100755 --- a/node_modules/boomlet/node_modules/uglify-js/node_modules/optimist/test/_/bin.js +++ b/node_modules/bookmarklet/node_modules/uglify-js/node_modules/optimist/test/_/bin.js diff --git a/node_modules/boomlet/node_modules/uglify-js/node_modules/optimist/test/parse.js b/node_modules/bookmarklet/node_modules/uglify-js/node_modules/optimist/test/parse.js index d320f43..d320f43 100644 --- a/node_modules/boomlet/node_modules/uglify-js/node_modules/optimist/test/parse.js +++ b/node_modules/bookmarklet/node_modules/uglify-js/node_modules/optimist/test/parse.js diff --git a/node_modules/boomlet/node_modules/uglify-js/node_modules/optimist/test/usage.js b/node_modules/bookmarklet/node_modules/uglify-js/node_modules/optimist/test/usage.js index 300454c..300454c 100644 --- a/node_modules/boomlet/node_modules/uglify-js/node_modules/optimist/test/usage.js +++ b/node_modules/bookmarklet/node_modules/uglify-js/node_modules/optimist/test/usage.js diff --git a/node_modules/boomlet/node_modules/uglify-js/node_modules/source-map/.npmignore b/node_modules/bookmarklet/node_modules/uglify-js/node_modules/source-map/.npmignore index 3dddf3f..3dddf3f 100644 --- a/node_modules/boomlet/node_modules/uglify-js/node_modules/source-map/.npmignore +++ b/node_modules/bookmarklet/node_modules/uglify-js/node_modules/source-map/.npmignore diff --git a/node_modules/boomlet/node_modules/uglify-js/node_modules/source-map/.travis.yml b/node_modules/bookmarklet/node_modules/uglify-js/node_modules/source-map/.travis.yml index ddc9c4f..ddc9c4f 100644 --- a/node_modules/boomlet/node_modules/uglify-js/node_modules/source-map/.travis.yml +++ b/node_modules/bookmarklet/node_modules/uglify-js/node_modules/source-map/.travis.yml diff --git a/node_modules/boomlet/node_modules/uglify-js/node_modules/source-map/CHANGELOG.md b/node_modules/bookmarklet/node_modules/uglify-js/node_modules/source-map/CHANGELOG.md index a0e1b9c..a0e1b9c 100644 --- a/node_modules/boomlet/node_modules/uglify-js/node_modules/source-map/CHANGELOG.md +++ b/node_modules/bookmarklet/node_modules/uglify-js/node_modules/source-map/CHANGELOG.md diff --git a/node_modules/boomlet/node_modules/uglify-js/node_modules/source-map/LICENSE b/node_modules/bookmarklet/node_modules/uglify-js/node_modules/source-map/LICENSE index ed1b7cf..ed1b7cf 100644 --- a/node_modules/boomlet/node_modules/uglify-js/node_modules/source-map/LICENSE +++ b/node_modules/bookmarklet/node_modules/uglify-js/node_modules/source-map/LICENSE diff --git a/node_modules/boomlet/node_modules/uglify-js/node_modules/source-map/Makefile.dryice.js b/node_modules/bookmarklet/node_modules/uglify-js/node_modules/source-map/Makefile.dryice.js index d6fc26a..d6fc26a 100644 --- a/node_modules/boomlet/node_modules/uglify-js/node_modules/source-map/Makefile.dryice.js +++ b/node_modules/bookmarklet/node_modules/uglify-js/node_modules/source-map/Makefile.dryice.js diff --git a/node_modules/boomlet/node_modules/uglify-js/node_modules/source-map/README.md b/node_modules/bookmarklet/node_modules/uglify-js/node_modules/source-map/README.md index b00e970..b00e970 100644 --- a/node_modules/boomlet/node_modules/uglify-js/node_modules/source-map/README.md +++ b/node_modules/bookmarklet/node_modules/uglify-js/node_modules/source-map/README.md diff --git a/node_modules/boomlet/node_modules/uglify-js/node_modules/source-map/build/assert-shim.js b/node_modules/bookmarklet/node_modules/uglify-js/node_modules/source-map/build/assert-shim.js index daa1a62..daa1a62 100644 --- a/node_modules/boomlet/node_modules/uglify-js/node_modules/source-map/build/assert-shim.js +++ b/node_modules/bookmarklet/node_modules/uglify-js/node_modules/source-map/build/assert-shim.js diff --git a/node_modules/boomlet/node_modules/uglify-js/node_modules/source-map/build/mini-require.js b/node_modules/bookmarklet/node_modules/uglify-js/node_modules/source-map/build/mini-require.js index 0daf453..0daf453 100644 --- a/node_modules/boomlet/node_modules/uglify-js/node_modules/source-map/build/mini-require.js +++ b/node_modules/bookmarklet/node_modules/uglify-js/node_modules/source-map/build/mini-require.js diff --git a/node_modules/boomlet/node_modules/uglify-js/node_modules/source-map/build/prefix-source-map.jsm b/node_modules/bookmarklet/node_modules/uglify-js/node_modules/source-map/build/prefix-source-map.jsm index ee2539d..ee2539d 100644 --- a/node_modules/boomlet/node_modules/uglify-js/node_modules/source-map/build/prefix-source-map.jsm +++ b/node_modules/bookmarklet/node_modules/uglify-js/node_modules/source-map/build/prefix-source-map.jsm diff --git a/node_modules/boomlet/node_modules/uglify-js/node_modules/source-map/build/prefix-utils.jsm b/node_modules/bookmarklet/node_modules/uglify-js/node_modules/source-map/build/prefix-utils.jsm index 80341d4..80341d4 100644 --- a/node_modules/boomlet/node_modules/uglify-js/node_modules/source-map/build/prefix-utils.jsm +++ b/node_modules/bookmarklet/node_modules/uglify-js/node_modules/source-map/build/prefix-utils.jsm diff --git a/node_modules/boomlet/node_modules/uglify-js/node_modules/source-map/build/suffix-browser.js b/node_modules/bookmarklet/node_modules/uglify-js/node_modules/source-map/build/suffix-browser.js index fb29ff5..fb29ff5 100644 --- a/node_modules/boomlet/node_modules/uglify-js/node_modules/source-map/build/suffix-browser.js +++ b/node_modules/bookmarklet/node_modules/uglify-js/node_modules/source-map/build/suffix-browser.js diff --git a/node_modules/boomlet/node_modules/uglify-js/node_modules/source-map/build/suffix-source-map.jsm b/node_modules/bookmarklet/node_modules/uglify-js/node_modules/source-map/build/suffix-source-map.jsm index cf3c2d8..cf3c2d8 100644 --- a/node_modules/boomlet/node_modules/uglify-js/node_modules/source-map/build/suffix-source-map.jsm +++ b/node_modules/bookmarklet/node_modules/uglify-js/node_modules/source-map/build/suffix-source-map.jsm diff --git a/node_modules/boomlet/node_modules/uglify-js/node_modules/source-map/build/suffix-utils.jsm b/node_modules/bookmarklet/node_modules/uglify-js/node_modules/source-map/build/suffix-utils.jsm index b31b84c..b31b84c 100644 --- a/node_modules/boomlet/node_modules/uglify-js/node_modules/source-map/build/suffix-utils.jsm +++ b/node_modules/bookmarklet/node_modules/uglify-js/node_modules/source-map/build/suffix-utils.jsm diff --git a/node_modules/boomlet/node_modules/uglify-js/node_modules/source-map/build/test-prefix.js b/node_modules/bookmarklet/node_modules/uglify-js/node_modules/source-map/build/test-prefix.js index 1b13f30..1b13f30 100644 --- a/node_modules/boomlet/node_modules/uglify-js/node_modules/source-map/build/test-prefix.js +++ b/node_modules/bookmarklet/node_modules/uglify-js/node_modules/source-map/build/test-prefix.js diff --git a/node_modules/boomlet/node_modules/uglify-js/node_modules/source-map/build/test-suffix.js b/node_modules/bookmarklet/node_modules/uglify-js/node_modules/source-map/build/test-suffix.js index bec2de3..bec2de3 100644 --- a/node_modules/boomlet/node_modules/uglify-js/node_modules/source-map/build/test-suffix.js +++ b/node_modules/bookmarklet/node_modules/uglify-js/node_modules/source-map/build/test-suffix.js diff --git a/node_modules/boomlet/node_modules/uglify-js/node_modules/source-map/lib/source-map.js b/node_modules/bookmarklet/node_modules/uglify-js/node_modules/source-map/lib/source-map.js index 121ad24..121ad24 100644 --- a/node_modules/boomlet/node_modules/uglify-js/node_modules/source-map/lib/source-map.js +++ b/node_modules/bookmarklet/node_modules/uglify-js/node_modules/source-map/lib/source-map.js diff --git a/node_modules/boomlet/node_modules/uglify-js/node_modules/source-map/lib/source-map/array-set.js b/node_modules/bookmarklet/node_modules/uglify-js/node_modules/source-map/lib/source-map/array-set.js index 40f9a18..40f9a18 100644 --- a/node_modules/boomlet/node_modules/uglify-js/node_modules/source-map/lib/source-map/array-set.js +++ b/node_modules/bookmarklet/node_modules/uglify-js/node_modules/source-map/lib/source-map/array-set.js diff --git a/node_modules/boomlet/node_modules/uglify-js/node_modules/source-map/lib/source-map/base64-vlq.js b/node_modules/bookmarklet/node_modules/uglify-js/node_modules/source-map/lib/source-map/base64-vlq.js index 1b67bb3..1b67bb3 100644 --- a/node_modules/boomlet/node_modules/uglify-js/node_modules/source-map/lib/source-map/base64-vlq.js +++ b/node_modules/bookmarklet/node_modules/uglify-js/node_modules/source-map/lib/source-map/base64-vlq.js diff --git a/node_modules/boomlet/node_modules/uglify-js/node_modules/source-map/lib/source-map/base64.js b/node_modules/bookmarklet/node_modules/uglify-js/node_modules/source-map/lib/source-map/base64.js index 863cc46..863cc46 100644 --- a/node_modules/boomlet/node_modules/uglify-js/node_modules/source-map/lib/source-map/base64.js +++ b/node_modules/bookmarklet/node_modules/uglify-js/node_modules/source-map/lib/source-map/base64.js diff --git a/node_modules/boomlet/node_modules/uglify-js/node_modules/source-map/lib/source-map/binary-search.js b/node_modules/bookmarklet/node_modules/uglify-js/node_modules/source-map/lib/source-map/binary-search.js index ff347c6..ff347c6 100644 --- a/node_modules/boomlet/node_modules/uglify-js/node_modules/source-map/lib/source-map/binary-search.js +++ b/node_modules/bookmarklet/node_modules/uglify-js/node_modules/source-map/lib/source-map/binary-search.js diff --git a/node_modules/boomlet/node_modules/uglify-js/node_modules/source-map/lib/source-map/source-map-consumer.js b/node_modules/bookmarklet/node_modules/uglify-js/node_modules/source-map/lib/source-map/source-map-consumer.js index 5214d5e..5214d5e 100644 --- a/node_modules/boomlet/node_modules/uglify-js/node_modules/source-map/lib/source-map/source-map-consumer.js +++ b/node_modules/bookmarklet/node_modules/uglify-js/node_modules/source-map/lib/source-map/source-map-consumer.js diff --git a/node_modules/boomlet/node_modules/uglify-js/node_modules/source-map/lib/source-map/source-map-generator.js b/node_modules/bookmarklet/node_modules/uglify-js/node_modules/source-map/lib/source-map/source-map-generator.js index d555f08..d555f08 100644 --- a/node_modules/boomlet/node_modules/uglify-js/node_modules/source-map/lib/source-map/source-map-generator.js +++ b/node_modules/bookmarklet/node_modules/uglify-js/node_modules/source-map/lib/source-map/source-map-generator.js diff --git a/node_modules/boomlet/node_modules/uglify-js/node_modules/source-map/lib/source-map/source-node.js b/node_modules/bookmarklet/node_modules/uglify-js/node_modules/source-map/lib/source-map/source-node.js index 1d98123..1d98123 100644 --- a/node_modules/boomlet/node_modules/uglify-js/node_modules/source-map/lib/source-map/source-node.js +++ b/node_modules/bookmarklet/node_modules/uglify-js/node_modules/source-map/lib/source-map/source-node.js diff --git a/node_modules/boomlet/node_modules/uglify-js/node_modules/source-map/lib/source-map/util.js b/node_modules/bookmarklet/node_modules/uglify-js/node_modules/source-map/lib/source-map/util.js index 4316445..4316445 100644 --- a/node_modules/boomlet/node_modules/uglify-js/node_modules/source-map/lib/source-map/util.js +++ b/node_modules/bookmarklet/node_modules/uglify-js/node_modules/source-map/lib/source-map/util.js diff --git a/node_modules/boomlet/node_modules/uglify-js/node_modules/source-map/node_modules/amdefine/LICENSE b/node_modules/bookmarklet/node_modules/uglify-js/node_modules/source-map/node_modules/amdefine/LICENSE index f33d665..f33d665 100644 --- a/node_modules/boomlet/node_modules/uglify-js/node_modules/source-map/node_modules/amdefine/LICENSE +++ b/node_modules/bookmarklet/node_modules/uglify-js/node_modules/source-map/node_modules/amdefine/LICENSE diff --git a/node_modules/boomlet/node_modules/uglify-js/node_modules/source-map/node_modules/amdefine/README.md b/node_modules/bookmarklet/node_modules/uglify-js/node_modules/source-map/node_modules/amdefine/README.md index c6995c0..c6995c0 100644 --- a/node_modules/boomlet/node_modules/uglify-js/node_modules/source-map/node_modules/amdefine/README.md +++ b/node_modules/bookmarklet/node_modules/uglify-js/node_modules/source-map/node_modules/amdefine/README.md diff --git a/node_modules/boomlet/node_modules/uglify-js/node_modules/source-map/node_modules/amdefine/amdefine.js b/node_modules/bookmarklet/node_modules/uglify-js/node_modules/source-map/node_modules/amdefine/amdefine.js index 53bf5a6..53bf5a6 100644 --- a/node_modules/boomlet/node_modules/uglify-js/node_modules/source-map/node_modules/amdefine/amdefine.js +++ b/node_modules/bookmarklet/node_modules/uglify-js/node_modules/source-map/node_modules/amdefine/amdefine.js diff --git a/node_modules/boomlet/node_modules/uglify-js/node_modules/source-map/node_modules/amdefine/intercept.js b/node_modules/bookmarklet/node_modules/uglify-js/node_modules/source-map/node_modules/amdefine/intercept.js index 771a983..771a983 100644 --- a/node_modules/boomlet/node_modules/uglify-js/node_modules/source-map/node_modules/amdefine/intercept.js +++ b/node_modules/bookmarklet/node_modules/uglify-js/node_modules/source-map/node_modules/amdefine/intercept.js diff --git a/node_modules/boomlet/node_modules/uglify-js/node_modules/source-map/node_modules/amdefine/package.json b/node_modules/bookmarklet/node_modules/uglify-js/node_modules/source-map/node_modules/amdefine/package.json index 8caf15c..8caf15c 100644 --- a/node_modules/boomlet/node_modules/uglify-js/node_modules/source-map/node_modules/amdefine/package.json +++ b/node_modules/bookmarklet/node_modules/uglify-js/node_modules/source-map/node_modules/amdefine/package.json diff --git a/node_modules/boomlet/node_modules/uglify-js/node_modules/source-map/package.json b/node_modules/bookmarklet/node_modules/uglify-js/node_modules/source-map/package.json index ba884d8..429efd0 100644 --- a/node_modules/boomlet/node_modules/uglify-js/node_modules/source-map/package.json +++ b/node_modules/bookmarklet/node_modules/uglify-js/node_modules/source-map/package.json @@ -122,5 +122,5 @@ "url": "https://github.com/mozilla/source-map/issues" }, "_id": "source-map@0.1.33", - "_from": "source-map@~0.1.33" + "_from": "source-map@~0.1.7" } diff --git a/node_modules/boomlet/node_modules/uglify-js/node_modules/source-map/test/run-tests.js b/node_modules/bookmarklet/node_modules/uglify-js/node_modules/source-map/test/run-tests.js index 64a7c3a..64a7c3a 100755 --- a/node_modules/boomlet/node_modules/uglify-js/node_modules/source-map/test/run-tests.js +++ b/node_modules/bookmarklet/node_modules/uglify-js/node_modules/source-map/test/run-tests.js diff --git a/node_modules/boomlet/node_modules/uglify-js/node_modules/source-map/test/source-map/test-api.js b/node_modules/bookmarklet/node_modules/uglify-js/node_modules/source-map/test/source-map/test-api.js index 3801233..3801233 100644 --- a/node_modules/boomlet/node_modules/uglify-js/node_modules/source-map/test/source-map/test-api.js +++ b/node_modules/bookmarklet/node_modules/uglify-js/node_modules/source-map/test/source-map/test-api.js diff --git a/node_modules/boomlet/node_modules/uglify-js/node_modules/source-map/test/source-map/test-array-set.js b/node_modules/bookmarklet/node_modules/uglify-js/node_modules/source-map/test/source-map/test-array-set.js index b5797ed..b5797ed 100644 --- a/node_modules/boomlet/node_modules/uglify-js/node_modules/source-map/test/source-map/test-array-set.js +++ b/node_modules/bookmarklet/node_modules/uglify-js/node_modules/source-map/test/source-map/test-array-set.js diff --git a/node_modules/boomlet/node_modules/uglify-js/node_modules/source-map/test/source-map/test-base64-vlq.js b/node_modules/bookmarklet/node_modules/uglify-js/node_modules/source-map/test/source-map/test-base64-vlq.js index 653a874..653a874 100644 --- a/node_modules/boomlet/node_modules/uglify-js/node_modules/source-map/test/source-map/test-base64-vlq.js +++ b/node_modules/bookmarklet/node_modules/uglify-js/node_modules/source-map/test/source-map/test-base64-vlq.js diff --git a/node_modules/boomlet/node_modules/uglify-js/node_modules/source-map/test/source-map/test-base64.js b/node_modules/bookmarklet/node_modules/uglify-js/node_modules/source-map/test/source-map/test-base64.js index ff3a244..ff3a244 100644 --- a/node_modules/boomlet/node_modules/uglify-js/node_modules/source-map/test/source-map/test-base64.js +++ b/node_modules/bookmarklet/node_modules/uglify-js/node_modules/source-map/test/source-map/test-base64.js diff --git a/node_modules/boomlet/node_modules/uglify-js/node_modules/source-map/test/source-map/test-binary-search.js b/node_modules/bookmarklet/node_modules/uglify-js/node_modules/source-map/test/source-map/test-binary-search.js index ee30683..ee30683 100644 --- a/node_modules/boomlet/node_modules/uglify-js/node_modules/source-map/test/source-map/test-binary-search.js +++ b/node_modules/bookmarklet/node_modules/uglify-js/node_modules/source-map/test/source-map/test-binary-search.js diff --git a/node_modules/boomlet/node_modules/uglify-js/node_modules/source-map/test/source-map/test-dog-fooding.js b/node_modules/bookmarklet/node_modules/uglify-js/node_modules/source-map/test/source-map/test-dog-fooding.js index 26757b2..26757b2 100644 --- a/node_modules/boomlet/node_modules/uglify-js/node_modules/source-map/test/source-map/test-dog-fooding.js +++ b/node_modules/bookmarklet/node_modules/uglify-js/node_modules/source-map/test/source-map/test-dog-fooding.js diff --git a/node_modules/boomlet/node_modules/uglify-js/node_modules/source-map/test/source-map/test-source-map-consumer.js b/node_modules/bookmarklet/node_modules/uglify-js/node_modules/source-map/test/source-map/test-source-map-consumer.js index acd24d5..acd24d5 100644 --- a/node_modules/boomlet/node_modules/uglify-js/node_modules/source-map/test/source-map/test-source-map-consumer.js +++ b/node_modules/bookmarklet/node_modules/uglify-js/node_modules/source-map/test/source-map/test-source-map-consumer.js diff --git a/node_modules/boomlet/node_modules/uglify-js/node_modules/source-map/test/source-map/test-source-map-generator.js b/node_modules/bookmarklet/node_modules/uglify-js/node_modules/source-map/test/source-map/test-source-map-generator.js index 16241dd..16241dd 100644 --- a/node_modules/boomlet/node_modules/uglify-js/node_modules/source-map/test/source-map/test-source-map-generator.js +++ b/node_modules/bookmarklet/node_modules/uglify-js/node_modules/source-map/test/source-map/test-source-map-generator.js diff --git a/node_modules/boomlet/node_modules/uglify-js/node_modules/source-map/test/source-map/test-source-node.js b/node_modules/bookmarklet/node_modules/uglify-js/node_modules/source-map/test/source-map/test-source-node.js index e7afc4e..e7afc4e 100644 --- a/node_modules/boomlet/node_modules/uglify-js/node_modules/source-map/test/source-map/test-source-node.js +++ b/node_modules/bookmarklet/node_modules/uglify-js/node_modules/source-map/test/source-map/test-source-node.js diff --git a/node_modules/boomlet/node_modules/uglify-js/node_modules/source-map/test/source-map/test-util.js b/node_modules/bookmarklet/node_modules/uglify-js/node_modules/source-map/test/source-map/test-util.js index 22e9a9e..22e9a9e 100644 --- a/node_modules/boomlet/node_modules/uglify-js/node_modules/source-map/test/source-map/test-util.js +++ b/node_modules/bookmarklet/node_modules/uglify-js/node_modules/source-map/test/source-map/test-util.js diff --git a/node_modules/boomlet/node_modules/uglify-js/node_modules/source-map/test/source-map/util.js b/node_modules/bookmarklet/node_modules/uglify-js/node_modules/source-map/test/source-map/util.js index 288046b..288046b 100644 --- a/node_modules/boomlet/node_modules/uglify-js/node_modules/source-map/test/source-map/util.js +++ b/node_modules/bookmarklet/node_modules/uglify-js/node_modules/source-map/test/source-map/util.js diff --git a/node_modules/bookmarklet/node_modules/uglify-js/package.json b/node_modules/bookmarklet/node_modules/uglify-js/package.json new file mode 100644 index 0000000..2f99180 --- /dev/null +++ b/node_modules/bookmarklet/node_modules/uglify-js/package.json @@ -0,0 +1,48 @@ +{ + "name": "uglify-js", + "description": "JavaScript parser, mangler/compressor and beautifier toolkit", + "homepage": "http://lisperator.net/uglifyjs", + "main": "tools/node.js", + "version": "2.2.5", + "engines": { + "node": ">=0.4.0" + }, + "maintainers": [ + { + "name": "Mihai Bazon", + "email": "mihai.bazon@gmail.com", + "url": "http://lisperator.net/" + } + ], + "repositories": [ + { + "type": "git", + "url": "https://github.com/mishoo/UglifyJS2.git" + } + ], + "dependencies": { + "source-map": "~0.1.7", + "optimist": "~0.3.5" + }, + "bin": { + "uglifyjs": "bin/uglifyjs" + }, + "scripts": { + "test": "node test/run-tests.js" + }, + "readme": "UglifyJS 2\n==========\n\nUglifyJS is a JavaScript parser, minifier, compressor or beautifier toolkit.\n\nThis page documents the command line utility. For\n[API and internals documentation see my website](http://lisperator.net/uglifyjs/).\nThere's also an\n[in-browser online demo](http://lisperator.net/uglifyjs/#demo) (for Firefox,\nChrome and probably Safari).\n\nInstall\n-------\n\nFirst make sure you have installed the latest version of [node.js](http://nodejs.org/)\n(You may need to restart your computer after this step).\n\nFrom NPM for use as a command line app:\n\n npm install uglify-js -g\n\nFrom NPM for programmatic use:\n\n npm install uglify-js\n\nFrom Git:\n\n git clone git://github.com/mishoo/UglifyJS2.git\n cd UglifyJS2\n npm link .\n\nUsage\n-----\n\n uglifyjs [input files] [options]\n\nUglifyJS2 can take multiple input files. It's recommended that you pass the\ninput files first, then pass the options. UglifyJS will parse input files\nin sequence and apply any compression options. The files are parsed in the\nsame global scope, that is, a reference from a file to some\nvariable/function declared in another file will be matched properly.\n\nIf you want to read from STDIN instead, pass a single dash instead of input\nfiles.\n\nThe available options are:\n\n --source-map Specify an output file where to generate source map.\n [string]\n --source-map-root The path to the original source to be included in the\n source map. [string]\n --source-map-url The path to the source map to be added in //@\n sourceMappingURL. Defaults to the value passed with\n --source-map. [string]\n --in-source-map Input source map, useful if you're compressing JS that was\n generated from some other original code.\n -p, --prefix Skip prefix for original filenames that appear in source\n maps. For example -p 3 will drop 3 directories from file\n names and ensure they are relative paths.\n -o, --output Output file (default STDOUT).\n -b, --beautify Beautify output/specify output options. [string]\n -m, --mangle Mangle names/pass mangler options. [string]\n -r, --reserved Reserved names to exclude from mangling.\n -c, --compress Enable compressor/pass compressor options. Pass options\n like -c hoist_vars=false,if_return=false. Use -c with no\n argument to use the default compression options. [string]\n -d, --define Global definitions [string]\n --comments Preserve copyright comments in the output. By default this\n works like Google Closure, keeping JSDoc-style comments\n that contain \"@license\" or \"@preserve\". You can optionally\n pass one of the following arguments to this flag:\n - \"all\" to keep all comments\n - a valid JS regexp (needs to start with a slash) to keep\n only comments that match.\n Note that currently not *all* comments can be kept when\n compression is on, because of dead code removal or\n cascading statements into sequences. [string]\n --stats Display operations run time on STDERR. [boolean]\n --acorn Use Acorn for parsing. [boolean]\n --spidermonkey Assume input fles are SpiderMonkey AST format (as JSON).\n [boolean]\n --self Build itself (UglifyJS2) as a library (implies\n --wrap=UglifyJS --export-all) [boolean]\n --wrap Embed everything in a big function, making the “exports”\n and “global” variables available. You need to pass an\n argument to this option to specify the name that your\n module will take when included in, say, a browser.\n [string]\n --export-all Only used when --wrap, this tells UglifyJS to add code to\n automatically export all globals. [boolean]\n --lint Display some scope warnings [boolean]\n -v, --verbose Verbose [boolean]\n -V, --version Print version number and exit. [boolean]\n\nSpecify `--output` (`-o`) to declare the output file. Otherwise the output\ngoes to STDOUT.\n\n## Source map options\n\nUglifyJS2 can generate a source map file, which is highly useful for\ndebugging your compressed JavaScript. To get a source map, pass\n`--source-map output.js.map` (full path to the file where you want the\nsource map dumped).\n\nAdditionally you might need `--source-map-root` to pass the URL where the\noriginal files can be found. In case you are passing full paths to input\nfiles to UglifyJS, you can use `--prefix` (`-p`) to specify the number of\ndirectories to drop from the path prefix when declaring files in the source\nmap.\n\nFor example:\n\n uglifyjs /home/doe/work/foo/src/js/file1.js \\\n /home/doe/work/foo/src/js/file2.js \\\n -o foo.min.js \\\n --source-map foo.min.js.map \\\n --source-map-root http://foo.com/src \\\n -p 5 -c -m\n\nThe above will compress and mangle `file1.js` and `file2.js`, will drop the\noutput in `foo.min.js` and the source map in `foo.min.js.map`. The source\nmapping will refer to `http://foo.com/src/js/file1.js` and\n`http://foo.com/src/js/file2.js` (in fact it will list `http://foo.com/src`\nas the source map root, and the original files as `js/file1.js` and\n`js/file2.js`).\n\n### Composed source map\n\nWhen you're compressing JS code that was output by a compiler such as\nCoffeeScript, mapping to the JS code won't be too helpful. Instead, you'd\nlike to map back to the original code (i.e. CoffeeScript). UglifyJS has an\noption to take an input source map. Assuming you have a mapping from\nCoffeeScript → compiled JS, UglifyJS can generate a map from CoffeeScript →\ncompressed JS by mapping every token in the compiled JS to its original\nlocation.\n\nTo use this feature you need to pass `--in-source-map\n/path/to/input/source.map`. Normally the input source map should also point\nto the file containing the generated JS, so if that's correct you can omit\ninput files from the command line.\n\n## Mangler options\n\nTo enable the mangler you need to pass `--mangle` (`-m`). Optionally you\ncan pass `-m sort=true` (we'll possibly have other flags in the future) in order\nto assign shorter names to most frequently used variables. This saves a few\nhundred bytes on jQuery before gzip, but the output is _bigger_ after gzip\n(and seems to happen for other libraries I tried it on) therefore it's not\nenabled by default.\n\nWhen mangling is enabled but you want to prevent certain names from being\nmangled, you can declare those names with `--reserved` (`-r`) — pass a\ncomma-separated list of names. For example:\n\n uglifyjs ... -m -r '$,require,exports'\n\nto prevent the `require`, `exports` and `$` names from being changed.\n\n## Compressor options\n\nYou need to pass `--compress` (`-c`) to enable the compressor. Optionally\nyou can pass a comma-separated list of options. Options are in the form\n`foo=bar`, or just `foo` (the latter implies a boolean option that you want\nto set `true`; it's effectively a shortcut for `foo=true`).\n\nThe defaults should be tuned for maximum compression on most code. Here are\nthe available options (all are `true` by default, except `hoist_vars`):\n\n- `sequences` -- join consecutive simple statements using the comma operator\n- `properties` -- rewrite property access using the dot notation, for\n example `foo[\"bar\"] → foo.bar`\n- `dead_code` -- remove unreachable code\n- `drop_debugger` -- remove `debugger;` statements\n- `unsafe` -- apply \"unsafe\" transformations (discussion below)\n- `conditionals` -- apply optimizations for `if`-s and conditional\n expressions\n- `comparisons` -- apply certain optimizations to binary nodes, for example:\n `!(a <= b) → a > b` (only when `unsafe`), attempts to negate binary nodes,\n e.g. `a = !b && !c && !d && !e → a=!(b||c||d||e)` etc.\n- `evaluate` -- attempt to evaluate constant expressions\n- `booleans` -- various optimizations for boolean context, for example `!!a\n ? b : c → a ? b : c`\n- `loops` -- optimizations for `do`, `while` and `for` loops when we can\n statically determine the condition\n- `unused` -- drop unreferenced functions and variables\n- `hoist_funs` -- hoist function declarations\n- `hoist_vars` -- hoist `var` declarations (this is `false` by default\n because it seems to increase the size of the output in general)\n- `if_return` -- optimizations for if/return and if/continue\n- `join_vars` -- join consecutive `var` statements\n- `cascade` -- small optimization for sequences, transform `x, x` into `x`\n and `x = something(), x` into `x = something()`\n- `warnings` -- display warnings when dropping unreachable code or unused\n declarations etc.\n\n### Conditional compilation\n\nYou can use the `--define` (`-d`) switch in order to declare global\nvariables that UglifyJS will assume to be constants (unless defined in\nscope). For example if you pass `--define DEBUG=false` then, coupled with\ndead code removal UglifyJS will discard the following from the output:\n\n if (DEBUG) {\n console.log(\"debug stuff\");\n }\n\nUglifyJS will warn about the condition being always false and about dropping\nunreachable code; for now there is no option to turn off only this specific\nwarning, you can pass `warnings=false` to turn off *all* warnings.\n\nAnother way of doing that is to declare your globals as constants in a\nseparate file and include it into the build. For example you can have a\n`build/defines.js` file with the following:\n\n const DEBUG = false;\n const PRODUCTION = true;\n // etc.\n\nand build your code like this:\n\n uglifyjs build/defines.js js/foo.js js/bar.js... -c\n\nUglifyJS will notice the constants and, since they cannot be altered, it\nwill evaluate references to them to the value itself and drop unreachable\ncode as usual. The possible downside of this approach is that the build\nwill contain the `const` declarations.\n\n<a name=\"codegen-options\"></a>\n## Beautifier options\n\nThe code generator tries to output shortest code possible by default. In\ncase you want beautified output, pass `--beautify` (`-b`). Optionally you\ncan pass additional arguments that control the code output:\n\n- `beautify` (default `true`) -- whether to actually beautify the output.\n Passing `-b` will set this to true, but you might need to pass `-b` even\n when you want to generate minified code, in order to specify additional\n arguments, so you can use `-b beautify=false` to override it.\n- `indent-level` (default 4)\n- `indent-start` (default 0) -- prefix all lines by that many spaces\n- `quote-keys` (default `false`) -- pass `true` to quote all keys in literal\n objects\n- `space-colon` (default `true`) -- insert a space after the colon signs\n- `ascii-only` (default `false`) -- escape Unicode characters in strings and\n regexps\n- `inline-script` (default `false`) -- escape the slash in occurrences of\n `</script` in strings\n- `width` (default 80) -- only takes effect when beautification is on, this\n specifies an (orientative) line width that the beautifier will try to\n obey. It refers to the width of the line text (excluding indentation).\n It doesn't work very well currently, but it does make the code generated\n by UglifyJS more readable.\n- `max-line-len` (default 32000) -- maximum line length (for uglified code)\n- `ie-proof` (default `true`) -- generate “IE-proof” code (for now this\n means add brackets around the do/while in code like this: `if (foo) do\n something(); while (bar); else ...`.\n- `bracketize` (default `false`) -- always insert brackets in `if`, `for`,\n `do`, `while` or `with` statements, even if their body is a single\n statement.\n- `semicolons` (default `true`) -- separate statements with semicolons. If\n you pass `false` then whenever possible we will use a newline instead of a\n semicolon, leading to more readable output of uglified code (size before\n gzip could be smaller; size after gzip insignificantly larger).\n\n### Keeping copyright notices or other comments\n\nYou can pass `--comments` to retain certain comments in the output. By\ndefault it will keep JSDoc-style comments that contain \"@preserve\",\n\"@license\" or \"@cc_on\" (conditional compilation for IE). You can pass\n`--comments all` to keep all the comments, or a valid JavaScript regexp to\nkeep only comments that match this regexp. For example `--comments\n'/foo|bar/'` will keep only comments that contain \"foo\" or \"bar\".\n\nNote, however, that there might be situations where comments are lost. For\nexample:\n\n function f() {\n /** @preserve Foo Bar */\n function g() {\n // this function is never called\n }\n return something();\n }\n\nEven though it has \"@preserve\", the comment will be lost because the inner\nfunction `g` (which is the AST node to which the comment is attached to) is\ndiscarded by the compressor as not referenced.\n\nThe safest comments where to place copyright information (or other info that\nneeds to be kept in the output) are comments attached to toplevel nodes.\n\n## Support for the SpiderMonkey AST\n\nUglifyJS2 has its own abstract syntax tree format; for\n[practical reasons](http://lisperator.net/blog/uglifyjs-why-not-switching-to-spidermonkey-ast/)\nwe can't easily change to using the SpiderMonkey AST internally. However,\nUglifyJS now has a converter which can import a SpiderMonkey AST.\n\nFor example [Acorn][acorn] is a super-fast parser that produces a\nSpiderMonkey AST. It has a small CLI utility that parses one file and dumps\nthe AST in JSON on the standard output. To use UglifyJS to mangle and\ncompress that:\n\n acorn file.js | uglifyjs --spidermonkey -m -c\n\nThe `--spidermonkey` option tells UglifyJS that all input files are not\nJavaScript, but JS code described in SpiderMonkey AST in JSON. Therefore we\ndon't use our own parser in this case, but just transform that AST into our\ninternal AST.\n\n### Use Acorn for parsing\n\nMore for fun, I added the `--acorn` option which will use Acorn to do all\nthe parsing. If you pass this option, UglifyJS will `require(\"acorn\")`.\n\nAcorn is really fast (e.g. 250ms instead of 380ms on some 650K code), but\nconverting the SpiderMonkey tree that Acorn produces takes another 150ms so\nin total it's a bit more than just using UglifyJS's own parser.\n\nAPI Reference\n-------------\n\nAssuming installation via NPM, you can load UglifyJS in your application\nlike this:\n\n var UglifyJS = require(\"uglify-js\");\n\nIt exports a lot of names, but I'll discuss here the basics that are needed\nfor parsing, mangling and compressing a piece of code. The sequence is (1)\nparse, (2) compress, (3) mangle, (4) generate output code.\n\n### The simple way\n\nThere's a single toplevel function which combines all the steps. If you\ndon't need additional customization, you might want to go with `minify`.\nExample:\n\n var result = UglifyJS.minify(\"/path/to/file.js\");\n console.log(result.code); // minified output\n // if you need to pass code instead of file name\n var result = UglifyJS.minify(\"var b = function () {};\", {fromString: true});\n\nYou can also compress multiple files:\n\n var result = UglifyJS.minify([ \"file1.js\", \"file2.js\", \"file3.js\" ]);\n console.log(result.code);\n\nTo generate a source map:\n\n var result = UglifyJS.minify([ \"file1.js\", \"file2.js\", \"file3.js\" ], {\n outSourceMap: \"out.js.map\"\n });\n console.log(result.code); // minified output\n console.log(result.map);\n\nNote that the source map is not saved in a file, it's just returned in\n`result.map`. The value passed for `outSourceMap` is only used to set the\n`file` attribute in the source map (see [the spec][sm-spec]).\n\nYou can also specify sourceRoot property to be included in source map:\n\n var result = UglifyJS.minify([ \"file1.js\", \"file2.js\", \"file3.js\" ], {\n outSourceMap: \"out.js.map\",\n sourceRoot: \"http://example.com/src\"\n });\n\n\nIf you're compressing compiled JavaScript and have a source map for it, you\ncan use the `inSourceMap` argument:\n\n var result = UglifyJS.minify(\"compiled.js\", {\n inSourceMap: \"compiled.js.map\",\n outSourceMap: \"minified.js.map\"\n });\n // same as before, it returns `code` and `map`\n\nThe `inSourceMap` is only used if you also request `outSourceMap` (it makes\nno sense otherwise).\n\nOther options:\n\n- `warnings` (default `false`) — pass `true` to display compressor warnings.\n\n- `fromString` (default `false`) — if you pass `true` then you can pass\n JavaScript source code, rather than file names.\n\n- `mangle` — pass `false` to skip mangling names.\n\n- `output` (default `null`) — pass an object if you wish to specify\n additional [output options][codegen]. The defaults are optimized\n for best compression.\n\n- `compress` (default `{}`) — pass `false` to skip compressing entirely.\n Pass an object to specify custom [compressor options][compressor].\n\nWe could add more options to `UglifyJS.minify` — if you need additional\nfunctionality please suggest!\n\n### The hard way\n\nFollowing there's more detailed API info, in case the `minify` function is\ntoo simple for your needs.\n\n#### The parser\n\n var toplevel_ast = UglifyJS.parse(code, options);\n\n`options` is optional and if present it must be an object. The following\nproperties are available:\n\n- `strict` — disable automatic semicolon insertion and support for trailing\n comma in arrays and objects\n- `filename` — the name of the file where this code is coming from\n- `toplevel` — a `toplevel` node (as returned by a previous invocation of\n `parse`)\n\nThe last two options are useful when you'd like to minify multiple files and\nget a single file as the output and a proper source map. Our CLI tool does\nsomething like this:\n\n var toplevel = null;\n files.forEach(function(file){\n var code = fs.readFileSync(file);\n toplevel = UglifyJS.parse(code, {\n filename: file,\n toplevel: toplevel\n });\n });\n\nAfter this, we have in `toplevel` a big AST containing all our files, with\neach token having proper information about where it came from.\n\n#### Scope information\n\nUglifyJS contains a scope analyzer that you need to call manually before\ncompressing or mangling. Basically it augments various nodes in the AST\nwith information about where is a name defined, how many times is a name\nreferenced, if it is a global or not, if a function is using `eval` or the\n`with` statement etc. I will discuss this some place else, for now what's\nimportant to know is that you need to call the following before doing\nanything with the tree:\n\n toplevel.figure_out_scope()\n\n#### Compression\n\nLike this:\n\n var compressor = UglifyJS.Compressor(options);\n var compressed_ast = toplevel.transform(compressor);\n\nThe `options` can be missing. Available options are discussed above in\n“Compressor options”. Defaults should lead to best compression in most\nscripts.\n\nThe compressor is destructive, so don't rely that `toplevel` remains the\noriginal tree.\n\n#### Mangling\n\nAfter compression it is a good idea to call again `figure_out_scope` (since\nthe compressor might drop unused variables / unreachable code and this might\nchange the number of identifiers or their position). Optionally, you can\ncall a trick that helps after Gzip (counting character frequency in\nnon-mangleable words). Example:\n\n compressed_ast.figure_out_scope();\n compressed_ast.compute_char_frequency();\n compressed_ast.mangle_names();\n\n#### Generating output\n\nAST nodes have a `print` method that takes an output stream. Essentially,\nto generate code you do this:\n\n var stream = UglifyJS.OutputStream(options);\n compressed_ast.print(stream);\n var code = stream.toString(); // this is your minified code\n\nor, for a shortcut you can do:\n\n var code = compressed_ast.print_to_string(options);\n\nAs usual, `options` is optional. The output stream accepts a lot of otions,\nmost of them documented above in section “Beautifier options”. The two\nwhich we care about here are `source_map` and `comments`.\n\n#### Keeping comments in the output\n\nIn order to keep certain comments in the output you need to pass the\n`comments` option. Pass a RegExp or a function. If you pass a RegExp, only\nthose comments whose body matches the regexp will be kept. Note that body\nmeans without the initial `//` or `/*`. If you pass a function, it will be\ncalled for every comment in the tree and will receive two arguments: the\nnode that the comment is attached to, and the comment token itself.\n\nThe comment token has these properties:\n\n- `type`: \"comment1\" for single-line comments or \"comment2\" for multi-line\n comments\n- `value`: the comment body\n- `pos` and `endpos`: the start/end positions (zero-based indexes) in the\n original code where this comment appears\n- `line` and `col`: the line and column where this comment appears in the\n original code\n- `file` — the file name of the original file\n- `nlb` — true if there was a newline before this comment in the original\n code, or if this comment contains a newline.\n\nYour function should return `true` to keep the comment, or a falsy value\notherwise.\n\n#### Generating a source mapping\n\nYou need to pass the `source_map` argument when calling `print`. It needs\nto be a `SourceMap` object (which is a thin wrapper on top of the\n[source-map][source-map] library).\n\nExample:\n\n var source_map = UglifyJS.SourceMap(source_map_options);\n var stream = UglifyJS.OutputStream({\n ...\n source_map: source_map\n });\n compressed_ast.print(stream);\n\n var code = stream.toString();\n var map = source_map.toString(); // json output for your source map\n\nThe `source_map_options` (optional) can contain the following properties:\n\n- `file`: the name of the JavaScript output file that this mapping refers to\n- `root`: the `sourceRoot` property (see the [spec][sm-spec])\n- `orig`: the \"original source map\", handy when you compress generated JS\n and want to map the minified output back to the original code where it\n came from. It can be simply a string in JSON, or a JSON object containing\n the original source map.\n\n [acorn]: https://github.com/marijnh/acorn\n [source-map]: https://github.com/mozilla/source-map\n [sm-spec]: https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit\n [codegen]: http://lisperator.net/uglifyjs/codegen\n [compressor]: http://lisperator.net/uglifyjs/compress\n", + "readmeFilename": "README.md", + "repository": { + "type": "git", + "url": "https://github.com/mishoo/UglifyJS2.git" + }, + "bugs": { + "url": "https://github.com/mishoo/UglifyJS2/issues" + }, + "_id": "uglify-js@2.2.5", + "dist": { + "shasum": "20481078273e14267b123c56c288bce9c3f61293" + }, + "_from": "uglify-js@2.2.x", + "_resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-2.2.5.tgz" +} diff --git a/node_modules/bookmarklet/node_modules/uglify-js/test/compress/arrays.js b/node_modules/bookmarklet/node_modules/uglify-js/test/compress/arrays.js new file mode 100644 index 0000000..10fe6eb --- /dev/null +++ b/node_modules/bookmarklet/node_modules/uglify-js/test/compress/arrays.js @@ -0,0 +1,12 @@ +holes_and_undefined: { + input: { + x = [1, 2, undefined]; + y = [1, , 2, ]; + z = [1, undefined, 3]; + } + expect: { + x=[1,2,void 0]; + y=[1,,2]; + z=[1,void 0,3]; + } +} diff --git a/node_modules/boomlet/node_modules/uglify-js/test/compress/blocks.js b/node_modules/bookmarklet/node_modules/uglify-js/test/compress/blocks.js index 8372adf..8372adf 100644 --- a/node_modules/boomlet/node_modules/uglify-js/test/compress/blocks.js +++ b/node_modules/bookmarklet/node_modules/uglify-js/test/compress/blocks.js diff --git a/node_modules/boomlet/node_modules/uglify-js/test/compress/conditionals.js b/node_modules/bookmarklet/node_modules/uglify-js/test/compress/conditionals.js index 213b246..dc2bb67 100644 --- a/node_modules/boomlet/node_modules/uglify-js/test/compress/conditionals.js +++ b/node_modules/bookmarklet/node_modules/uglify-js/test/compress/conditionals.js @@ -141,94 +141,3 @@ ifs_6: { x = foo || bar || baz || boo ? 20 : 10; } } - -cond_1: { - options = { - conditionals: true - }; - input: { - if (some_condition()) { - do_something(x); - } else { - do_something(y); - } - } - expect: { - do_something(some_condition() ? x : y); - } -} - -cond_2: { - options = { - conditionals: true - }; - input: { - if (some_condition()) { - x = new FooBar(1); - } else { - x = new FooBar(2); - } - } - expect: { - x = new FooBar(some_condition() ? 1 : 2); - } -} - -cond_3: { - options = { - conditionals: true - }; - input: { - if (some_condition()) { - new FooBar(1); - } else { - FooBar(2); - } - } - expect: { - some_condition() ? new FooBar(1) : FooBar(2); - } -} - -cond_4: { - options = { - conditionals: true - }; - input: { - if (some_condition()) { - do_something(); - } else { - do_something(); - } - } - expect: { - some_condition(), do_something(); - } -} - -cond_5: { - options = { - conditionals: true - }; - input: { - if (some_condition()) { - if (some_other_condition()) { - do_something(); - } else { - alternate(); - } - } else { - alternate(); - } - - if (some_condition()) { - if (some_other_condition()) { - do_something(); - } - } - } - expect: { - some_condition() && some_other_condition() ? do_something() : alternate(); - some_condition() && some_other_condition() && do_something(); - } -} diff --git a/node_modules/boomlet/node_modules/uglify-js/test/compress/dead-code.js b/node_modules/bookmarklet/node_modules/uglify-js/test/compress/dead-code.js index 0fd066e..0fd066e 100644 --- a/node_modules/boomlet/node_modules/uglify-js/test/compress/dead-code.js +++ b/node_modules/bookmarklet/node_modules/uglify-js/test/compress/dead-code.js diff --git a/node_modules/boomlet/node_modules/uglify-js/test/compress/debugger.js b/node_modules/bookmarklet/node_modules/uglify-js/test/compress/debugger.js index 7c27073..7c27073 100644 --- a/node_modules/boomlet/node_modules/uglify-js/test/compress/debugger.js +++ b/node_modules/bookmarklet/node_modules/uglify-js/test/compress/debugger.js diff --git a/node_modules/boomlet/node_modules/uglify-js/test/compress/drop-unused.js b/node_modules/bookmarklet/node_modules/uglify-js/test/compress/drop-unused.js index 89bf008..bf5cd29 100644 --- a/node_modules/boomlet/node_modules/uglify-js/test/compress/drop-unused.js +++ b/node_modules/bookmarklet/node_modules/uglify-js/test/compress/drop-unused.js @@ -95,71 +95,3 @@ unused_circular_references_3: { } } } - -unused_keep_setter_arg: { - options = { unused: true }; - input: { - var x = { - _foo: null, - set foo(val) { - }, - get foo() { - return this._foo; - } - } - } - expect: { - var x = { - _foo: null, - set foo(val) { - }, - get foo() { - return this._foo; - } - } - } -} - -unused_var_in_catch: { - options = { unused: true }; - input: { - function foo() { - try { - foo(); - } catch(ex) { - var x = 10; - } - } - } - expect: { - function foo() { - try { - foo(); - } catch(ex) {} - } - } -} - -used_var_in_catch: { - options = { unused: true }; - input: { - function foo() { - try { - foo(); - } catch(ex) { - var x = 10; - } - return x; - } - } - expect: { - function foo() { - try { - foo(); - } catch(ex) { - var x = 10; - } - return x; - } - } -} diff --git a/node_modules/boomlet/node_modules/uglify-js/test/compress/issue-105.js b/node_modules/bookmarklet/node_modules/uglify-js/test/compress/issue-105.js index ca17adb..349d732 100644 --- a/node_modules/boomlet/node_modules/uglify-js/test/compress/issue-105.js +++ b/node_modules/bookmarklet/node_modules/uglify-js/test/compress/issue-105.js @@ -1,6 +1,7 @@ typeof_eq_undefined: { options = { - comparisons: true + comparisons: true, + unsafe: false }; input: { a = typeof b.c != "undefined" } expect: { a = "undefined" != typeof b.c } @@ -12,14 +13,5 @@ typeof_eq_undefined_unsafe: { unsafe: true }; input: { a = typeof b.c != "undefined" } - expect: { a = void 0 !== b.c } -} - -typeof_eq_undefined_unsafe2: { - options = { - comparisons: true, - unsafe: true - }; - input: { a = "undefined" != typeof b.c } - expect: { a = void 0 !== b.c } + expect: { a = b.c !== void 0 } } diff --git a/node_modules/boomlet/node_modules/uglify-js/test/compress/issue-12.js b/node_modules/bookmarklet/node_modules/uglify-js/test/compress/issue-12.js index bf87d5c..bf87d5c 100644 --- a/node_modules/boomlet/node_modules/uglify-js/test/compress/issue-12.js +++ b/node_modules/bookmarklet/node_modules/uglify-js/test/compress/issue-12.js diff --git a/node_modules/boomlet/node_modules/uglify-js/test/compress/issue-22.js b/node_modules/bookmarklet/node_modules/uglify-js/test/compress/issue-22.js index a8b7bc6..a8b7bc6 100644 --- a/node_modules/boomlet/node_modules/uglify-js/test/compress/issue-22.js +++ b/node_modules/bookmarklet/node_modules/uglify-js/test/compress/issue-22.js diff --git a/node_modules/boomlet/node_modules/uglify-js/test/compress/issue-44.js b/node_modules/bookmarklet/node_modules/uglify-js/test/compress/issue-44.js index 7a972f9..7a972f9 100644 --- a/node_modules/boomlet/node_modules/uglify-js/test/compress/issue-44.js +++ b/node_modules/bookmarklet/node_modules/uglify-js/test/compress/issue-44.js diff --git a/node_modules/boomlet/node_modules/uglify-js/test/compress/issue-59.js b/node_modules/bookmarklet/node_modules/uglify-js/test/compress/issue-59.js index 82b3880..82b3880 100644 --- a/node_modules/boomlet/node_modules/uglify-js/test/compress/issue-59.js +++ b/node_modules/bookmarklet/node_modules/uglify-js/test/compress/issue-59.js diff --git a/node_modules/boomlet/node_modules/uglify-js/test/compress/labels.js b/node_modules/bookmarklet/node_modules/uglify-js/test/compress/labels.js index 044b7a7..044b7a7 100644 --- a/node_modules/boomlet/node_modules/uglify-js/test/compress/labels.js +++ b/node_modules/bookmarklet/node_modules/uglify-js/test/compress/labels.js diff --git a/node_modules/boomlet/node_modules/uglify-js/test/compress/loops.js b/node_modules/bookmarklet/node_modules/uglify-js/test/compress/loops.js index cdf1f04..cdf1f04 100644 --- a/node_modules/boomlet/node_modules/uglify-js/test/compress/loops.js +++ b/node_modules/bookmarklet/node_modules/uglify-js/test/compress/loops.js diff --git a/node_modules/bookmarklet/node_modules/uglify-js/test/compress/properties.js b/node_modules/bookmarklet/node_modules/uglify-js/test/compress/properties.js new file mode 100644 index 0000000..72e245e --- /dev/null +++ b/node_modules/bookmarklet/node_modules/uglify-js/test/compress/properties.js @@ -0,0 +1,25 @@ +keep_properties: { + options = { + properties: false + }; + input: { + a["foo"] = "bar"; + } + expect: { + a["foo"] = "bar"; + } +} + +dot_properties: { + options = { + properties: true + }; + input: { + a["foo"] = "bar"; + a["if"] = "if"; + } + expect: { + a.foo = "bar"; + a["if"] = "if"; + } +} diff --git a/node_modules/boomlet/node_modules/uglify-js/test/compress/sequences.js b/node_modules/bookmarklet/node_modules/uglify-js/test/compress/sequences.js index 4669571..6f63ace 100644 --- a/node_modules/boomlet/node_modules/uglify-js/test/compress/sequences.js +++ b/node_modules/bookmarklet/node_modules/uglify-js/test/compress/sequences.js @@ -101,12 +101,10 @@ lift_sequences_1: { lift_sequences_2: { options = { sequences: true, evaluate: true }; input: { - foo.x = (foo = {}, 10); - bar = (bar = {}, 10); + q = 1 + (foo(), bar(), 5) + 7 * (5 / (3 - (a(), (QW=ER), c(), 2))) - (x(), y(), 5); } expect: { - foo.x = (foo = {}, 10), - bar = {}, bar = 10; + foo(), bar(), a(), QW = ER, c(), x(), y(), q = 36 } } diff --git a/node_modules/boomlet/node_modules/uglify-js/test/compress/switch.js b/node_modules/bookmarklet/node_modules/uglify-js/test/compress/switch.js index 62e39cf..6fde5dd 100644 --- a/node_modules/boomlet/node_modules/uglify-js/test/compress/switch.js +++ b/node_modules/bookmarklet/node_modules/uglify-js/test/compress/switch.js @@ -208,53 +208,3 @@ constant_switch_9: { } } } - -drop_default_1: { - options = { dead_code: true }; - input: { - switch (foo) { - case 'bar': baz(); - default: - } - } - expect: { - switch (foo) { - case 'bar': baz(); - } - } -} - -drop_default_2: { - options = { dead_code: true }; - input: { - switch (foo) { - case 'bar': baz(); break; - default: - break; - } - } - expect: { - switch (foo) { - case 'bar': baz(); - } - } -} - -keep_default: { - options = { dead_code: true }; - input: { - switch (foo) { - case 'bar': baz(); - default: - something(); - break; - } - } - expect: { - switch (foo) { - case 'bar': baz(); - default: - something(); - } - } -} diff --git a/node_modules/boomlet/node_modules/uglify-js/test/run-tests.js b/node_modules/bookmarklet/node_modules/uglify-js/test/run-tests.js index f8e88d4..0568c6a 100755 --- a/node_modules/boomlet/node_modules/uglify-js/test/run-tests.js +++ b/node_modules/bookmarklet/node_modules/uglify-js/test/run-tests.js @@ -7,15 +7,8 @@ var assert = require("assert"); var sys = require("util"); var tests_dir = path.dirname(module.filename); -var failures = 0; -var failed_files = {}; run_compress_tests(); -if (failures) { - sys.error("\n!!! Failed " + failures + " test cases."); - sys.error("!!! " + Object.keys(failed_files).join(", ")); - process.exit(1); -} /* -----[ utils ]----- */ @@ -90,8 +83,6 @@ function run_compress_tests() { output: output, expected: expect }); - failures++; - failed_files[file] = 1; } } var tests = parse_test(path.resolve(dir, file)); diff --git a/node_modules/boomlet/node_modules/uglify-js/tools/node.js b/node_modules/bookmarklet/node_modules/uglify-js/tools/node.js index bef296e..cf87628 100644 --- a/node_modules/boomlet/node_modules/uglify-js/tools/node.js +++ b/node_modules/bookmarklet/node_modules/uglify-js/tools/node.js @@ -51,7 +51,6 @@ for (var i in UglifyJS) { exports.minify = function(files, options) { options = UglifyJS.defaults(options, { - spidermonkey : false, outSourceMap : null, sourceRoot : null, inSourceMap : null, @@ -61,28 +60,20 @@ exports.minify = function(files, options) { output : null, compress : {} }); - UglifyJS.base54.reset(); + if (typeof files == "string") + files = [ files ]; // 1. parse - var toplevel = null, - sourcesContent = {}; - - if (options.spidermonkey) { - toplevel = UglifyJS.AST_Node.from_mozilla_ast(files); - } else { - if (typeof files == "string") - files = [ files ]; - files.forEach(function(file){ - var code = options.fromString - ? file - : fs.readFileSync(file, "utf8"); - sourcesContent[file] = code; - toplevel = UglifyJS.parse(code, { - filename: options.fromString ? "?" : file, - toplevel: toplevel - }); + var toplevel = null; + files.forEach(function(file){ + var code = options.fromString + ? file + : fs.readFileSync(file, "utf8"); + toplevel = UglifyJS.parse(code, { + filename: options.fromString ? "?" : file, + toplevel: toplevel }); - } + }); // 2. compress if (options.compress) { @@ -101,26 +92,17 @@ exports.minify = function(files, options) { } // 4. output - var inMap = options.inSourceMap; - var output = {}; - if (typeof options.inSourceMap == "string") { + var map = null; + var inMap = null; + if (options.inSourceMap) { inMap = fs.readFileSync(options.inSourceMap, "utf8"); } - if (options.outSourceMap) { - output.source_map = UglifyJS.SourceMap({ - file: options.outSourceMap, - orig: inMap, - root: options.sourceRoot - }); - if (options.sourceMapIncludeSources) { - for (var file in sourcesContent) { - if (sourcesContent.hasOwnProperty(file)) { - options.source_map.get().setSourceContent(file, sourcesContent[file]); - } - } - } - - } + if (options.outSourceMap) map = UglifyJS.SourceMap({ + file: options.outSourceMap, + orig: inMap, + root: options.sourceRoot + }); + var output = { source_map: map }; if (options.output) { UglifyJS.merge(output, options.output); } @@ -128,7 +110,7 @@ exports.minify = function(files, options) { toplevel.print(stream); return { code : stream + "", - map : output.source_map + "" + map : map + "" }; }; diff --git a/node_modules/bookmarklet/package.json b/node_modules/bookmarklet/package.json new file mode 100644 index 0000000..9a5939f --- /dev/null +++ b/node_modules/bookmarklet/package.json @@ -0,0 +1,38 @@ +{ + "name": "bookmarklet", + "version": "0.0.4", + "description": "A JavaScript bookmarklet compiler with greasmonkey userscript-like metadata options", + "main": "bookmarklet.js", + "bin": { + "bookmarklet": "./bin/bookmarklet" + }, + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "repository": { + "type": "git", + "url": "https://github.com/mrcoles/bookmarklet" + }, + "keywords": [ + "bookmarklet" + ], + "author": { + "name": "Peter Coles" + }, + "license": "MIT", + "readmeFilename": "README.md", + "dependencies": { + "uglify-js": "2.2.x" + }, + "readme": "\nBookmarklet: sane development, familiar format\n==============================================\n\nBookmarklet is a nodejs module for compiling bookmarklets in server-side code and directly from the shell. You can run it on any JavaScript file—it will minify it using uglify-js, wrap it in a self executing function, and return an escaped bookmarklet.\n\nMore so, it supports a metadata block—modeled after the [greasemonkey userscript metadata block](http://wiki.greasespot.net/Metadata_Block)—to specify metadata, external stylesheets and script includes, which can look like this:\n\n // ==Bookmarklet==\n // @name LoveGames\n // @author Old Gregg\n // @style http://www.cornify.com/css/cornify.css\n // @script https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js\n // ==/Bookmarklet==\n\nMost notably, you can specify any external scripts that you’d like your bookmarklet to include via the `@script` rule, which can be repeated as many times as you’d like.\n\nNOTE: currently with script includes you have to handle `noConflict` scenarios yourself, e.g., you might want to start off a script with `var $ = jQuery.noConflict(true)`.\n\nIn addition, any css files included with `@style` will be injected.\n\nThis project is new and open to suggestions & pull requests.\n\nAlso, if you’re just looking for a quick way to throw together a bookmarklet, try my [browser-based bookmarklet creator](http://mrcoles.com/bookmarklet/).\n", + "bugs": { + "url": "https://github.com/mrcoles/bookmarklet/issues" + }, + "homepage": "https://github.com/mrcoles/bookmarklet", + "_id": "bookmarklet@0.0.4", + "dist": { + "shasum": "1c42b9589fde1e312429887be74c914dd7b0c46e" + }, + "_from": "bookmarklet@0.x", + "_resolved": "https://registry.npmjs.org/bookmarklet/-/bookmarklet-0.0.4.tgz" +} diff --git a/node_modules/bookmarklet/test/test.bookmarklet.js b/node_modules/bookmarklet/test/test.bookmarklet.js new file mode 100644 index 0000000..c6835a4 --- /dev/null +++ b/node_modules/bookmarklet/test/test.bookmarklet.js @@ -0,0 +1,18 @@ +// ==Bookmarklet== +// @name Test +// @author Peter +// @style data:text/css,imaginary%7Bfont-family%3A%20%22ok%22%7D +// @script https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js +// ==/Bookmarklet== + +var $ = jQuery.noConflict(true), + pCount = $('p').size(), + divCount = $('div').size(), + testElement = $('<imaginary>').appendTo('body'), + testPassed = testElement.css('font-family') == 'ok'; + testElement.remove(); + +alert('p tags: ' + pCount + + '\ndiv tags: ' + divCount + + '\nDid the test element get styled? ' + + (testPassed ? 'Of course!' : 'Nope.')); diff --git a/node_modules/boomlet/LICENSE b/node_modules/boomlet/LICENSE deleted file mode 100644 index 791b33d..0000000 --- a/node_modules/boomlet/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2013 Buster Collings - -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/boomlet/README.md b/node_modules/boomlet/README.md deleted file mode 100644 index 0125c07..0000000 --- a/node_modules/boomlet/README.md +++ /dev/null @@ -1,71 +0,0 @@ -# boomlet -Bookmarklet compiler encloses, encodes, minifies your Javascript file and automatically opens an HTML page with your new bookmarklet for immediate use. - -1. Write some tricky Javascript and save it to a file. -1. Run boomlet. -1. Drag, drop and begin using your bookmarklet immediately. - -## Version -1.0.0 - -## Installation -```sh -npm i boomlet -g -``` - -## CLI Usage -```sh -boomlet <filename> <linktext> -``` - -## Makefile Usage (i.e. Sublime Text, etc.) -```sh -BOOMFILE := filename.js -BOOMTEXT := 'This Bookmark Goes BOOM!' - -boom: - boomlet $(BOOMFILE) $(BOOMTEXT) - -.PHONY: boom -``` - -<!--- -# *Easter Egg:* Local Mode - -## Local Installation -```sh -npm i boomlet -``` - -## Local App Usage -```sh -require('boomlet').boom(<filename>, <linktext>); -``` ---> - -## Dependencies -* [open](https://github.com/pwnall/node-open) - opens the default browser -* [uglify-js](http://lisperator.net/uglifyjs) - eliminates uneccessary whitespace - -## License -The MIT License (MIT) - -Copyright (c) 2013 Buster Collings - -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/boomlet/bin/boomlet b/node_modules/boomlet/bin/boomlet deleted file mode 100755 index 7e7710b..0000000 --- a/node_modules/boomlet/bin/boomlet +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/env node -var path = require('path'); -var fs = require('fs'); -var lib = path.join(path.dirname(fs.realpathSync(__filename)), '../lib'); -require(lib + '/main.js').boom();
\ No newline at end of file diff --git a/node_modules/boomlet/lib/boomlet.html b/node_modules/boomlet/lib/boomlet.html deleted file mode 100644 index 3a32902..0000000 --- a/node_modules/boomlet/lib/boomlet.html +++ /dev/null @@ -1,24 +0,0 @@ -<!doctype html> -<html lang="en"> -<head> - <meta charset="UTF-8"> - <title>boomlet</title> - <style> - *{font-family:helvetica,verdana,sans-serif;background:#000000;color:#93a1a1;} - body{padding:1em;margin:0;} - a{color:#268bd2;} - a:hover{background:#222;} - p{margin:1em 0;padding:1em;} - p a{border:solid 1px #93a1a1;padding:1em;margin:1em 0;} - div{position:absolute;bottom:0;right:0;padding:1em;margin:1em;} - div a{text-decoration:none;} - </style> -</head> -<body> - <p><a href="#code#">#linktext#</a></p> - <p> - Here's your new bookmarklet. Drag, drop and start using it. - </p> - <div><a href="https://github.com/busterc/boomlet">boomlet</a> was created by <a href="https://twitter.com/busterc">@busterc</a></div> -</body> -</html> diff --git a/node_modules/boomlet/lib/main.js b/node_modules/boomlet/lib/main.js deleted file mode 100644 index d93fcb6..0000000 --- a/node_modules/boomlet/lib/main.js +++ /dev/null @@ -1,34 +0,0 @@ -var http = require('http'), - path = require('path'), - fs = require('fs'), - UglifyJs = require('uglify-js'), - open = require('open'); - -exports.boom = function(filename, linktext){ - var _filename = filename || process.argv[2], - _linktext = linktext || process.argv[3]; - - if (!_linktext || !_filename || _filename == 'help' || _filename == '-h' || _filename == '--help') { - console.log('Usage: boomlet <filename> <linktext>\nExample: boomlet code.js \'this bookmarklet goes boom!\''); - process.exit(1); - } - - fs.readFile(_filename, 'utf8', function(err, data){ - if(err) throw err; - - var code = 'javascript:(function(){' + encodeURIComponent( - UglifyJs.minify(data, {fromString: true}).code - ) + '}())'; - - fs.readFile(__dirname+'/boomlet.html', 'utf8', function(err, data){ - if(err) throw err; - var output = data.replace('#code#', code).replace('#linktext#', _linktext), - outfile = path.resolve('./boom.html'); - - fs.writeFile(outfile, output, 'utf8', function(err){ - if(err) throw err; - open(outfile); - }); - }); - }); -}; diff --git a/node_modules/boomlet/node_modules/open/.jshintrc b/node_modules/boomlet/node_modules/open/.jshintrc deleted file mode 100644 index 765fb34..0000000 --- a/node_modules/boomlet/node_modules/open/.jshintrc +++ /dev/null @@ -1,27 +0,0 @@ -{ - "bitwise": true, - "curly": true, - "eqeqeq": true, - "forin": true, - "immed": true, - "latedef": false, - "newcap": true, - "noarg": true, - "noempty": false, - "nonew": true, - "plusplus": false, - "regexp": false, - "undef": true, - "strict": false, - "trailing": true, - - "eqnull": true, - "laxcomma": true, - - "node": true, - - "onevar": true, - "white": true, - - "indent": 2 -} diff --git a/node_modules/boomlet/node_modules/open/.npmignore b/node_modules/boomlet/node_modules/open/.npmignore deleted file mode 100644 index 77356c3..0000000 --- a/node_modules/boomlet/node_modules/open/.npmignore +++ /dev/null @@ -1 +0,0 @@ -test
diff --git a/node_modules/boomlet/node_modules/open/LICENSE b/node_modules/boomlet/node_modules/open/LICENSE deleted file mode 100644 index 42719e0..0000000 --- a/node_modules/boomlet/node_modules/open/LICENSE +++ /dev/null @@ -1,22 +0,0 @@ -Copyright (c) 2012 Jay Jordan
-
-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.
diff --git a/node_modules/boomlet/node_modules/open/README.md b/node_modules/boomlet/node_modules/open/README.md deleted file mode 100644 index 4fc0d54..0000000 --- a/node_modules/boomlet/node_modules/open/README.md +++ /dev/null @@ -1,33 +0,0 @@ -# open - -Open a file or url in the user's preferred application. - -# Usage - -```javascript -var open = require("open"); -open("http://www.google.com"); -``` - -`open` taks an optional argument specifying the program to be used to open the -file or URL. - -```javascript -open("http://www.google.com", "firefox"); -``` - -# Installation - - npm install open - -# How it works - -- on `win32` uses `start` -- on `darwin` uses `open` -- otherwise uses the `xdg-open` script from [freedesktop.org](http://portland.freedesktop.org/xdg-utils-1.0/xdg-open.html) - -# Warning - -The same care should be taken when calling open as if you were calling -[child_process.exec](http://nodejs.org/api/child_process.html#child_process_child_process_exec_command_options_callback) -directly. If it is an executable it will run in a new shell. diff --git a/node_modules/boomlet/node_modules/open/lib/open.js b/node_modules/boomlet/node_modules/open/lib/open.js deleted file mode 100644 index aa23a3e..0000000 --- a/node_modules/boomlet/node_modules/open/lib/open.js +++ /dev/null @@ -1,60 +0,0 @@ -var exec = require('child_process').exec
- , path = require('path')
- ;
-
-
-/**
- * open a file or uri using the default application for the file type.
- *
- * @return {ChildProcess} - the child process object.
- * @param {string} target - the file/uri to open.
- * @param {string} appName - (optional) the application to be used to open the
- * file (for example, "chrome", "firefox")
- * @param {function(Error)} callback - called with null on success, or
- * an error object that contains a property 'code' with the exit
- * code of the process.
- */
-
-module.exports = open;
-
-function open(target, appName, callback) {
- var opener;
-
- if (typeof(appName) === 'function') {
- callback = appName;
- appName = null;
- }
-
- switch (process.platform) {
- case 'darwin':
- if (appName) {
- opener = 'open -a "' + escape(appName) + '"';
- } else {
- opener = 'open';
- }
- break;
- case 'win32':
- // if the first parameter to start is quoted, it uses that as the title
- // so we pass a blank title so we can quote the file we are opening
- if (appName) {
- opener = 'start "" "' + escape(appName) + '"';
- } else {
- opener = 'start ""';
- }
- break;
- default:
- if (appName) {
- opener = escape(appName);
- } else {
- // use Portlands xdg-open everywhere else
- opener = path.join(__dirname, '../vendor/xdg-open');
- }
- break;
- }
-
- return exec(opener + ' "' + escape(target) + '"', callback);
-}
-
-function escape(s) {
- return s.replace(/"/g, '\\\"');
-}
diff --git a/node_modules/boomlet/node_modules/open/package.json b/node_modules/boomlet/node_modules/open/package.json deleted file mode 100644 index a63ba12..0000000 --- a/node_modules/boomlet/node_modules/open/package.json +++ /dev/null @@ -1,48 +0,0 @@ -{ - "name": "open", - "version": "0.0.4", - "description": "open a file or url in the user's preferred application", - "keywords": [ - "start", - "open", - "browser", - "editor", - "default" - ], - "homepage": "https://github.com/jjrdn/node-open", - "author": { - "name": "J Jordan", - "email": "jjrdn@styosis.com" - }, - "license": "MIT", - "contributors": [ - { - "name": "Victor Costan", - "email": "victor@costan.us", - "url": "http://www.costan.us" - } - ], - "repository": { - "type": "git", - "url": "https://github.com/pwnall/node-open.git" - }, - "bugs": { - "url": "https://github.com/pwnall/node-open/issues" - }, - "engines": { - "node": ">= 0.6.0" - }, - "dependencies": {}, - "devDependencies": { - "mocha": "*" - }, - "optionalDependencies": {}, - "main": "lib/open.js", - "scripts": { - "test": "node_modules/mocha/bin/mocha" - }, - "readme": "# open\n\nOpen a file or url in the user's preferred application.\n\n# Usage\n\n```javascript\nvar open = require(\"open\");\nopen(\"http://www.google.com\");\n```\n\n`open` taks an optional argument specifying the program to be used to open the\nfile or URL.\n\n```javascript\nopen(\"http://www.google.com\", \"firefox\");\n```\n\n# Installation\n\n npm install open\n\n# How it works\n\n- on `win32` uses `start`\n- on `darwin` uses `open`\n- otherwise uses the `xdg-open` script from [freedesktop.org](http://portland.freedesktop.org/xdg-utils-1.0/xdg-open.html)\n\n# Warning\n\nThe same care should be taken when calling open as if you were calling\n[child_process.exec](http://nodejs.org/api/child_process.html#child_process_child_process_exec_command_options_callback)\ndirectly. If it is an executable it will run in a new shell.\n", - "readmeFilename": "README.md", - "_id": "open@0.0.4", - "_from": "open@~0.0.4" -} diff --git a/node_modules/boomlet/node_modules/open/vendor/xdg-open b/node_modules/boomlet/node_modules/open/vendor/xdg-open deleted file mode 100755 index 13caac1..0000000 --- a/node_modules/boomlet/node_modules/open/vendor/xdg-open +++ /dev/null @@ -1,767 +0,0 @@ -#!/bin/sh -#--------------------------------------------- -# xdg-open -# -# Utility script to open a URL in the registered default application. -# -# Refer to the usage() function below for usage. -# -# Copyright 2009-2010, Fathi Boudra <fabo@freedesktop.org> -# Copyright 2009-2010, Rex Dieter <rdieter@fedoraproject.org> -# Copyright 2006, Kevin Krammer <kevin.krammer@gmx.at> -# Copyright 2006, Jeremy White <jwhite@codeweavers.com> -# -# LICENSE: -# -# 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. -# -#--------------------------------------------- - -manualpage() -{ -cat << _MANUALPAGE -Name - - xdg-open -- opens a file or URL in the user's preferred - application - -Synopsis - - xdg-open { file | URL } - - xdg-open { --help | --manual | --version } - -Description - - xdg-open opens a file or URL in the user's preferred - application. If a URL is provided the URL will be opened in the - user's preferred web browser. If a file is provided the file - will be opened in the preferred application for files of that - type. xdg-open supports file, ftp, http and https URLs. - - xdg-open is for use inside a desktop session only. It is not - recommended to use xdg-open as root. - -Options - - --help - Show command synopsis. - - --manual - Show this manual page. - - --version - Show the xdg-utils version information. - -Exit Codes - - An exit code of 0 indicates success while a non-zero exit code - indicates failure. The following failure codes can be returned: - - 1 - Error in command line syntax. - - 2 - One of the files passed on the command line did not - exist. - - 3 - A required tool could not be found. - - 4 - The action failed. - -Examples - -xdg-open 'http://www.freedesktop.org/' - - Opens the freedesktop.org website in the user's default - browser. - -xdg-open /tmp/foobar.png - - Opens the PNG image file /tmp/foobar.png in the user's default - image viewing application. -_MANUALPAGE -} - -usage() -{ -cat << _USAGE - xdg-open -- opens a file or URL in the user's preferred - application - -Synopsis - - xdg-open { file | URL } - - xdg-open { --help | --manual | --version } - -_USAGE -} - -#@xdg-utils-common@ - -#---------------------------------------------------------------------------- -# Common utility functions included in all XDG wrapper scripts -#---------------------------------------------------------------------------- - -DEBUG() -{ - [ -z "${XDG_UTILS_DEBUG_LEVEL}" ] && return 0; - [ ${XDG_UTILS_DEBUG_LEVEL} -lt $1 ] && return 0; - shift - echo "$@" >&2 -} - -# This handles backslashes but not quote marks. -first_word() -{ - read first rest - echo "$first" -} - -#------------------------------------------------------------- -# map a binary to a .desktop file -binary_to_desktop_file() -{ - search="${XDG_DATA_HOME:-$HOME/.local/share}:${XDG_DATA_DIRS:-/usr/local/share:/usr/share}" - binary="`which "$1"`" - binary="`readlink -f "$binary"`" - base="`basename "$binary"`" - IFS=: - for dir in $search; do - unset IFS - [ "$dir" ] || continue - [ -d "$dir/applications" ] || [ -d "$dir/applnk" ] || continue - for file in "$dir"/applications/*.desktop "$dir"/applications/*/*.desktop "$dir"/applnk/*.desktop "$dir"/applnk/*/*.desktop; do - [ -r "$file" ] || continue - # Check to make sure it's worth the processing. - grep -q "^Exec.*$base" "$file" || continue - # Make sure it's a visible desktop file (e.g. not "preferred-web-browser.desktop"). - grep -Eq "^(NoDisplay|Hidden)=true" "$file" && continue - command="`grep -E "^Exec(\[[^]=]*])?=" "$file" | cut -d= -f 2- | first_word`" - command="`which "$command"`" - if [ x"`readlink -f "$command"`" = x"$binary" ]; then - # Fix any double slashes that got added path composition - echo "$file" | sed -e 's,//*,/,g' - return - fi - done - done -} - -#------------------------------------------------------------- -# map a .desktop file to a binary -## FIXME: handle vendor dir case -desktop_file_to_binary() -{ - search="${XDG_DATA_HOME:-$HOME/.local/share}:${XDG_DATA_DIRS:-/usr/local/share:/usr/share}" - desktop="`basename "$1"`" - IFS=: - for dir in $search; do - unset IFS - [ "$dir" ] && [ -d "$dir/applications" ] || continue - file="$dir/applications/$desktop" - [ -r "$file" ] || continue - # Remove any arguments (%F, %f, %U, %u, etc.). - command="`grep -E "^Exec(\[[^]=]*])?=" "$file" | cut -d= -f 2- | first_word`" - command="`which "$command"`" - readlink -f "$command" - return - done -} - -#------------------------------------------------------------- -# Exit script on successfully completing the desired operation - -exit_success() -{ - if [ $# -gt 0 ]; then - echo "$@" - echo - fi - - exit 0 -} - - -#----------------------------------------- -# Exit script on malformed arguments, not enough arguments -# or missing required option. -# prints usage information - -exit_failure_syntax() -{ - if [ $# -gt 0 ]; then - echo "xdg-open: $@" >&2 - echo "Try 'xdg-open --help' for more information." >&2 - else - usage - echo "Use 'man xdg-open' or 'xdg-open --manual' for additional info." - fi - - exit 1 -} - -#------------------------------------------------------------- -# Exit script on missing file specified on command line - -exit_failure_file_missing() -{ - if [ $# -gt 0 ]; then - echo "xdg-open: $@" >&2 - fi - - exit 2 -} - -#------------------------------------------------------------- -# Exit script on failure to locate necessary tool applications - -exit_failure_operation_impossible() -{ - if [ $# -gt 0 ]; then - echo "xdg-open: $@" >&2 - fi - - exit 3 -} - -#------------------------------------------------------------- -# Exit script on failure returned by a tool application - -exit_failure_operation_failed() -{ - if [ $# -gt 0 ]; then - echo "xdg-open: $@" >&2 - fi - - exit 4 -} - -#------------------------------------------------------------ -# Exit script on insufficient permission to read a specified file - -exit_failure_file_permission_read() -{ - if [ $# -gt 0 ]; then - echo "xdg-open: $@" >&2 - fi - - exit 5 -} - -#------------------------------------------------------------ -# Exit script on insufficient permission to write a specified file - -exit_failure_file_permission_write() -{ - if [ $# -gt 0 ]; then - echo "xdg-open: $@" >&2 - fi - - exit 6 -} - -check_input_file() -{ - if [ ! -e "$1" ]; then - exit_failure_file_missing "file '$1' does not exist" - fi - if [ ! -r "$1" ]; then - exit_failure_file_permission_read "no permission to read file '$1'" - fi -} - -check_vendor_prefix() -{ - file_label="$2" - [ -n "$file_label" ] || file_label="filename" - file=`basename "$1"` - case "$file" in - [a-zA-Z]*-*) - return - ;; - esac - - echo "xdg-open: $file_label '$file' does not have a proper vendor prefix" >&2 - echo 'A vendor prefix consists of alpha characters ([a-zA-Z]) and is terminated' >&2 - echo 'with a dash ("-"). An example '"$file_label"' is '"'example-$file'" >&2 - echo "Use --novendor to override or 'xdg-open --manual' for additional info." >&2 - exit 1 -} - -check_output_file() -{ - # if the file exists, check if it is writeable - # if it does not exists, check if we are allowed to write on the directory - if [ -e "$1" ]; then - if [ ! -w "$1" ]; then - exit_failure_file_permission_write "no permission to write to file '$1'" - fi - else - DIR=`dirname "$1"` - if [ ! -w "$DIR" ] || [ ! -x "$DIR" ]; then - exit_failure_file_permission_write "no permission to create file '$1'" - fi - fi -} - -#---------------------------------------- -# Checks for shared commands, e.g. --help - -check_common_commands() -{ - while [ $# -gt 0 ] ; do - parm="$1" - shift - - case "$parm" in - --help) - usage - echo "Use 'man xdg-open' or 'xdg-open --manual' for additional info." - exit_success - ;; - - --manual) - manualpage - exit_success - ;; - - --version) - echo "xdg-open 1.1.0 rc1" - exit_success - ;; - esac - done -} - -check_common_commands "$@" - -[ -z "${XDG_UTILS_DEBUG_LEVEL}" ] && unset XDG_UTILS_DEBUG_LEVEL; -if [ ${XDG_UTILS_DEBUG_LEVEL-0} -lt 1 ]; then - # Be silent - xdg_redirect_output=" > /dev/null 2> /dev/null" -else - # All output to stderr - xdg_redirect_output=" >&2" -fi - -#-------------------------------------- -# Checks for known desktop environments -# set variable DE to the desktop environments name, lowercase - -detectDE() -{ - # see https://bugs.freedesktop.org/show_bug.cgi?id=34164 - unset GREP_OPTIONS - - if [ -n "${XDG_CURRENT_DESKTOP}" ]; then - case "${XDG_CURRENT_DESKTOP}" in - GNOME) - DE=gnome; - ;; - KDE) - DE=kde; - ;; - LXDE) - DE=lxde; - ;; - XFCE) - DE=xfce - esac - fi - - if [ x"$DE" = x"" ]; then - # classic fallbacks - if [ x"$KDE_FULL_SESSION" = x"true" ]; then DE=kde; - elif [ x"$GNOME_DESKTOP_SESSION_ID" != x"" ]; then DE=gnome; - elif [ x"$MATE_DESKTOP_SESSION_ID" != x"" ]; then DE=mate; - elif `dbus-send --print-reply --dest=org.freedesktop.DBus /org/freedesktop/DBus org.freedesktop.DBus.GetNameOwner string:org.gnome.SessionManager > /dev/null 2>&1` ; then DE=gnome; - elif xprop -root _DT_SAVE_MODE 2> /dev/null | grep ' = \"xfce4\"$' >/dev/null 2>&1; then DE=xfce; - elif xprop -root 2> /dev/null | grep -i '^xfce_desktop_window' >/dev/null 2>&1; then DE=xfce - fi - fi - - if [ x"$DE" = x"" ]; then - # fallback to checking $DESKTOP_SESSION - case "$DESKTOP_SESSION" in - gnome) - DE=gnome; - ;; - LXDE|Lubuntu) - DE=lxde; - ;; - xfce|xfce4|'Xfce Session') - DE=xfce; - ;; - esac - fi - - if [ x"$DE" = x"" ]; then - # fallback to uname output for other platforms - case "$(uname 2>/dev/null)" in - Darwin) - DE=darwin; - ;; - esac - fi - - if [ x"$DE" = x"gnome" ]; then - # gnome-default-applications-properties is only available in GNOME 2.x - # but not in GNOME 3.x - which gnome-default-applications-properties > /dev/null 2>&1 || DE="gnome3" - fi -} - -#---------------------------------------------------------------------------- -# kfmclient exec/openURL can give bogus exit value in KDE <= 3.5.4 -# It also always returns 1 in KDE 3.4 and earlier -# Simply return 0 in such case - -kfmclient_fix_exit_code() -{ - version=`LC_ALL=C.UTF-8 kde-config --version 2>/dev/null | grep '^KDE'` - major=`echo $version | sed 's/KDE.*: \([0-9]\).*/\1/'` - minor=`echo $version | sed 's/KDE.*: [0-9]*\.\([0-9]\).*/\1/'` - release=`echo $version | sed 's/KDE.*: [0-9]*\.[0-9]*\.\([0-9]\).*/\1/'` - test "$major" -gt 3 && return $1 - test "$minor" -gt 5 && return $1 - test "$release" -gt 4 && return $1 - return 0 -} - -# This handles backslashes but not quote marks. -first_word() -{ - read first rest - echo "$first" -} - -last_word() -{ - read first rest - echo "$rest" -} - -open_darwin() -{ - open "$1" - - if [ $? -eq 0 ]; then - exit_success - else - exit_failure_operation_failed - fi -} - -open_kde() -{ - if kde-open -v 2>/dev/null 1>&2; then - kde-open "$1" - else - if [ x"$KDE_SESSION_VERSION" = x"4" ]; then - kfmclient openURL "$1" - else - kfmclient exec "$1" - kfmclient_fix_exit_code $? - fi - fi - - if [ $? -eq 0 ]; then - exit_success - else - exit_failure_operation_failed - fi -} - -open_gnome() -{ - if gvfs-open --help 2>/dev/null 1>&2; then - gvfs-open "$1" - else - gnome-open "$1" - fi - - if [ $? -eq 0 ]; then - exit_success - else - exit_failure_operation_failed - fi -} - -open_mate() -{ - if gvfs-open --help 2>/dev/null 1>&2; then - gvfs-open "$1" - else - mate-open "$1" - fi - - if [ $? -eq 0 ]; then - exit_success - else - exit_failure_operation_failed - fi -} - -open_xfce() -{ - exo-open "$1" - - if [ $? -eq 0 ]; then - exit_success - else - exit_failure_operation_failed - fi -} - -#----------------------------------------- -# Recursively search .desktop file - -search_desktop_file() -{ - local default="$1" - local dir="$2" - local arg="$3" - - local file="" - # look for both vendor-app.desktop, vendor/app.desktop - if [ -r "$dir/$default" ]; then - file="$dir/$default" - elif [ -r "$dir/`echo $default | sed -e 's|-|/|'`" ]; then - file="$dir/`echo $default | sed -e 's|-|/|'`" - fi - - if [ -r "$file" ] ; then - command="`grep -E "^Exec(\[[^]=]*])?=" "$file" | cut -d= -f 2- | first_word`" - command_exec=`which $command 2>/dev/null` - arguments="`grep -E "^Exec(\[[^]=]*])?=" "$file" | cut -d= -f 2- | last_word`" - arg_one="`echo $arg | sed 's/&/\\\\&/g'`" - arguments_exec="`echo $arguments | sed -e 's*%[fFuU]*"'"$arg_one"'"*g'`" - - if [ -x "$command_exec" ] ; then - if echo $arguments | grep -iq '%[fFuU]' ; then - echo START $command_exec $arguments_exec - eval $command_exec $arguments_exec - else - echo START $command_exec $arguments_exec "$arg" - eval $command_exec $arguments_exec "$arg" - fi - - if [ $? -eq 0 ]; then - exit_success - fi - fi - fi - - for d in $dir/*/; do - [ -d "$d" ] && search_desktop_file "$default" "$d" "$arg" - done -} - - -open_generic_xdg_mime() -{ - filetype="$2" - default=`xdg-mime query default "$filetype"` - if [ -n "$default" ] ; then - xdg_user_dir="$XDG_DATA_HOME" - [ -n "$xdg_user_dir" ] || xdg_user_dir="$HOME/.local/share" - - xdg_system_dirs="$XDG_DATA_DIRS" - [ -n "$xdg_system_dirs" ] || xdg_system_dirs=/usr/local/share/:/usr/share/ - -DEBUG 3 "$xdg_user_dir:$xdg_system_dirs" - for x in `echo "$xdg_user_dir:$xdg_system_dirs" | sed 's/:/ /g'`; do - search_desktop_file "$default" "$x/applications/" "$1" - done - fi -} - -open_generic_xdg_file_mime() -{ - filetype=`xdg-mime query filetype "$1" | sed "s/;.*//"` - open_generic_xdg_mime "$1" "$filetype" -} - -open_generic_xdg_x_scheme_handler() -{ - scheme="`echo $1 | sed -n 's/\(^[[:alnum:]+\.-]*\):.*$/\1/p'`" - if [ -n $scheme ]; then - filetype="x-scheme-handler/$scheme" - open_generic_xdg_mime "$1" "$filetype" - fi -} - -open_generic() -{ - # Paths or file:// URLs - if (echo "$1" | grep -q '^file://' || - ! echo "$1" | egrep -q '^[[:alpha:]+\.\-]+:'); then - - local file="$1" - - # Decode URLs - if echo "$file" | grep -q '^file:///'; then - file=${file#file://} - file="$(printf "$(echo "$file" | sed -e 's@%\([a-f0-9A-F]\{2\}\)@\\x\1@g')")" - fi - check_input_file "$file" - - open_generic_xdg_file_mime "$file" - - if [ -f /etc/debian_version ] && - which run-mailcap 2>/dev/null 1>&2; then - run-mailcap --action=view "$file" - if [ $? -eq 0 ]; then - exit_success - fi - fi - - if mimeopen -v 2>/dev/null 1>&2; then - mimeopen -L -n "$file" - if [ $? -eq 0 ]; then - exit_success - fi - fi - fi - - open_generic_xdg_x_scheme_handler "$1" - - IFS=":" - for browser in $BROWSER; do - if [ x"$browser" != x"" ]; then - - browser_with_arg=`printf "$browser" "$1" 2>/dev/null` - if [ $? -ne 0 ]; then - browser_with_arg=$browser; - fi - - if [ x"$browser_with_arg" = x"$browser" ]; then - eval '$browser $1'$xdg_redirect_output; - else eval '$browser_with_arg'$xdg_redirect_output; - fi - - if [ $? -eq 0 ]; then - exit_success; - fi - fi - done - - exit_failure_operation_impossible "no method available for opening '$1'" -} - -open_lxde() -{ - # pcmanfm only knows how to handle file:// urls and filepaths, it seems. - if (echo "$1" | grep -q '^file://' || - ! echo "$1" | egrep -q '^[[:alpha:]+\.\-]+:') - then - local file="$(echo "$1" | sed 's%^file://%%')" - - # handle relative paths - if ! echo "$file" | grep -q '^/'; then - file="$(pwd)/$file" - fi - - pcmanfm "$file" - - else - open_generic "$1" - fi - - if [ $? -eq 0 ]; then - exit_success - else - exit_failure_operation_failed - fi -} - -[ x"$1" != x"" ] || exit_failure_syntax - -url= -while [ $# -gt 0 ] ; do - parm="$1" - shift - - case "$parm" in - -*) - exit_failure_syntax "unexpected option '$parm'" - ;; - - *) - if [ -n "$url" ] ; then - exit_failure_syntax "unexpected argument '$parm'" - fi - url="$parm" - ;; - esac -done - -if [ -z "${url}" ] ; then - exit_failure_syntax "file or URL argument missing" -fi - -detectDE - -if [ x"$DE" = x"" ]; then - DE=generic -fi - -DEBUG 2 "Selected DE $DE" - -# if BROWSER variable is not set, check some well known browsers instead -if [ x"$BROWSER" = x"" ]; then - BROWSER=links2:elinks:links:lynx:w3m - if [ -n "$DISPLAY" ]; then - BROWSER=x-www-browser:firefox:seamonkey:mozilla:epiphany:konqueror:chromium-browser:google-chrome:$BROWSER - fi -fi - -case "$DE" in - kde) - open_kde "$url" - ;; - - gnome*) - open_gnome "$url" - ;; - - mate) - open_mate "$url" - ;; - - xfce) - open_xfce "$url" - ;; - - lxde) - open_lxde "$url" - ;; - - generic) - open_generic "$url" - ;; - - *) - exit_failure_operation_impossible "no method available for opening '$url'" - ;; -esac diff --git a/node_modules/boomlet/node_modules/uglify-js/.travis.yml b/node_modules/boomlet/node_modules/uglify-js/.travis.yml deleted file mode 100644 index 3d9a761..0000000 --- a/node_modules/boomlet/node_modules/uglify-js/.travis.yml +++ /dev/null @@ -1,6 +0,0 @@ -language: node_js -node_js: - - "0.4" - - "0.8" - - "0.10" - - "0.11" diff --git a/node_modules/boomlet/node_modules/uglify-js/LICENSE b/node_modules/boomlet/node_modules/uglify-js/LICENSE deleted file mode 100644 index dd7706f..0000000 --- a/node_modules/boomlet/node_modules/uglify-js/LICENSE +++ /dev/null @@ -1,29 +0,0 @@ -UglifyJS is released under the BSD license: - -Copyright 2012-2013 (c) Mihai Bazon <mihai.bazon@gmail.com> - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions -are met: - - * Redistributions of source code must retain the above - copyright notice, this list of conditions and the following - disclaimer. - - * Redistributions in binary form must reproduce the above - copyright notice, this list of conditions and the following - disclaimer in the documentation and/or other materials - provided with the distribution. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER “AS IS” AND ANY -EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE -LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, -OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR -TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF -THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -SUCH DAMAGE. diff --git a/node_modules/boomlet/node_modules/uglify-js/node_modules/async/LICENSE b/node_modules/boomlet/node_modules/uglify-js/node_modules/async/LICENSE deleted file mode 100644 index b7f9d50..0000000 --- a/node_modules/boomlet/node_modules/uglify-js/node_modules/async/LICENSE +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (c) 2010 Caolan McMahon - -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. diff --git a/node_modules/boomlet/node_modules/uglify-js/node_modules/async/README.md b/node_modules/boomlet/node_modules/uglify-js/node_modules/async/README.md deleted file mode 100644 index 951f76e..0000000 --- a/node_modules/boomlet/node_modules/uglify-js/node_modules/async/README.md +++ /dev/null @@ -1,1425 +0,0 @@ -# Async.js - -Async is a utility module which provides straight-forward, powerful functions -for working with asynchronous JavaScript. Although originally designed for -use with [node.js](http://nodejs.org), it can also be used directly in the -browser. Also supports [component](https://github.com/component/component). - -Async provides around 20 functions that include the usual 'functional' -suspects (map, reduce, filter, each…) as well as some common patterns -for asynchronous control flow (parallel, series, waterfall…). All these -functions assume you follow the node.js convention of providing a single -callback as the last argument of your async function. - - -## Quick Examples - -```javascript -async.map(['file1','file2','file3'], fs.stat, function(err, results){ - // results is now an array of stats for each file -}); - -async.filter(['file1','file2','file3'], fs.exists, function(results){ - // results now equals an array of the existing files -}); - -async.parallel([ - function(){ ... }, - function(){ ... } -], callback); - -async.series([ - function(){ ... }, - function(){ ... } -]); -``` - -There are many more functions available so take a look at the docs below for a -full list. This module aims to be comprehensive, so if you feel anything is -missing please create a GitHub issue for it. - -## Common Pitfalls - -### Binding a context to an iterator - -This section is really about bind, not about async. If you are wondering how to -make async execute your iterators in a given context, or are confused as to why -a method of another library isn't working as an iterator, study this example: - -```js -// Here is a simple object with an (unnecessarily roundabout) squaring method -var AsyncSquaringLibrary = { - squareExponent: 2, - square: function(number, callback){ - var result = Math.pow(number, this.squareExponent); - setTimeout(function(){ - callback(null, result); - }, 200); - } -}; - -async.map([1, 2, 3], AsyncSquaringLibrary.square, function(err, result){ - // result is [NaN, NaN, NaN] - // This fails because the `this.squareExponent` expression in the square - // function is not evaluated in the context of AsyncSquaringLibrary, and is - // therefore undefined. -}); - -async.map([1, 2, 3], AsyncSquaringLibrary.square.bind(AsyncSquaringLibrary), function(err, result){ - // result is [1, 4, 9] - // With the help of bind we can attach a context to the iterator before - // passing it to async. Now the square function will be executed in its - // 'home' AsyncSquaringLibrary context and the value of `this.squareExponent` - // will be as expected. -}); -``` - -## Download - -The source is available for download from -[GitHub](http://github.com/caolan/async). -Alternatively, you can install using Node Package Manager (npm): - - npm install async - -__Development:__ [async.js](https://github.com/caolan/async/raw/master/lib/async.js) - 29.6kb Uncompressed - -## In the Browser - -So far it's been tested in IE6, IE7, IE8, FF3.6 and Chrome 5. Usage: - -```html -<script type="text/javascript" src="async.js"></script> -<script type="text/javascript"> - - async.map(data, asyncProcess, function(err, results){ - alert(results); - }); - -</script> -``` - -## Documentation - -### Collections - -* [each](#each) -* [eachSeries](#eachSeries) -* [eachLimit](#eachLimit) -* [map](#map) -* [mapSeries](#mapSeries) -* [mapLimit](#mapLimit) -* [filter](#filter) -* [filterSeries](#filterSeries) -* [reject](#reject) -* [rejectSeries](#rejectSeries) -* [reduce](#reduce) -* [reduceRight](#reduceRight) -* [detect](#detect) -* [detectSeries](#detectSeries) -* [sortBy](#sortBy) -* [some](#some) -* [every](#every) -* [concat](#concat) -* [concatSeries](#concatSeries) - -### Control Flow - -* [series](#series) -* [parallel](#parallel) -* [parallelLimit](#parallellimittasks-limit-callback) -* [whilst](#whilst) -* [doWhilst](#doWhilst) -* [until](#until) -* [doUntil](#doUntil) -* [forever](#forever) -* [waterfall](#waterfall) -* [compose](#compose) -* [applyEach](#applyEach) -* [applyEachSeries](#applyEachSeries) -* [queue](#queue) -* [cargo](#cargo) -* [auto](#auto) -* [iterator](#iterator) -* [apply](#apply) -* [nextTick](#nextTick) -* [times](#times) -* [timesSeries](#timesSeries) - -### Utils - -* [memoize](#memoize) -* [unmemoize](#unmemoize) -* [log](#log) -* [dir](#dir) -* [noConflict](#noConflict) - - -## Collections - -<a name="forEach" /> -<a name="each" /> -### each(arr, iterator, callback) - -Applies an iterator function to each item in an array, in parallel. -The iterator is called with an item from the list and a callback for when it -has finished. If the iterator passes an error to this callback, the main -callback for the each function is immediately called with the error. - -Note, that since this function applies the iterator to each item in parallel -there is no guarantee that the iterator functions will complete in order. - -__Arguments__ - -* arr - An array to iterate over. -* iterator(item, callback) - A function to apply to each item in the array. - The iterator is passed a callback(err) which must be called once it has - completed. If no error has occured, the callback should be run without - arguments or with an explicit null argument. -* callback(err) - A callback which is called after all the iterator functions - have finished, or an error has occurred. - -__Example__ - -```js -// assuming openFiles is an array of file names and saveFile is a function -// to save the modified contents of that file: - -async.each(openFiles, saveFile, function(err){ - // if any of the saves produced an error, err would equal that error -}); -``` - ---------------------------------------- - -<a name="forEachSeries" /> -<a name="eachSeries" /> -### eachSeries(arr, iterator, callback) - -The same as each only the iterator is applied to each item in the array in -series. The next iterator is only called once the current one has completed -processing. This means the iterator functions will complete in order. - - ---------------------------------------- - -<a name="forEachLimit" /> -<a name="eachLimit" /> -### eachLimit(arr, limit, iterator, callback) - -The same as each only no more than "limit" iterators will be simultaneously -running at any time. - -Note that the items are not processed in batches, so there is no guarantee that - the first "limit" iterator functions will complete before any others are -started. - -__Arguments__ - -* arr - An array to iterate over. -* limit - The maximum number of iterators to run at any time. -* iterator(item, callback) - A function to apply to each item in the array. - The iterator is passed a callback(err) which must be called once it has - completed. If no error has occured, the callback should be run without - arguments or with an explicit null argument. -* callback(err) - A callback which is called after all the iterator functions - have finished, or an error has occurred. - -__Example__ - -```js -// Assume documents is an array of JSON objects and requestApi is a -// function that interacts with a rate-limited REST api. - -async.eachLimit(documents, 20, requestApi, function(err){ - // if any of the saves produced an error, err would equal that error -}); -``` - ---------------------------------------- - -<a name="map" /> -### map(arr, iterator, callback) - -Produces a new array of values by mapping each value in the given array through -the iterator function. The iterator is called with an item from the array and a -callback for when it has finished processing. The callback takes 2 arguments, -an error and the transformed item from the array. If the iterator passes an -error to this callback, the main callback for the map function is immediately -called with the error. - -Note, that since this function applies the iterator to each item in parallel -there is no guarantee that the iterator functions will complete in order, however -the results array will be in the same order as the original array. - -__Arguments__ - -* arr - An array to iterate over. -* iterator(item, callback) - A function to apply to each item in the array. - The iterator is passed a callback(err, transformed) which must be called once - it has completed with an error (which can be null) and a transformed item. -* callback(err, results) - A callback which is called after all the iterator - functions have finished, or an error has occurred. Results is an array of the - transformed items from the original array. - -__Example__ - -```js -async.map(['file1','file2','file3'], fs.stat, function(err, results){ - // results is now an array of stats for each file -}); -``` - ---------------------------------------- - -<a name="mapSeries" /> -### mapSeries(arr, iterator, callback) - -The same as map only the iterator is applied to each item in the array in -series. The next iterator is only called once the current one has completed -processing. The results array will be in the same order as the original. - - ---------------------------------------- - -<a name="mapLimit" /> -### mapLimit(arr, limit, iterator, callback) - -The same as map only no more than "limit" iterators will be simultaneously -running at any time. - -Note that the items are not processed in batches, so there is no guarantee that - the first "limit" iterator functions will complete before any others are -started. - -__Arguments__ - -* arr - An array to iterate over. -* limit - The maximum number of iterators to run at any time. -* iterator(item, callback) - A function to apply to each item in the array. - The iterator is passed a callback(err, transformed) which must be called once - it has completed with an error (which can be null) and a transformed item. -* callback(err, results) - A callback which is called after all the iterator - functions have finished, or an error has occurred. Results is an array of the - transformed items from the original array. - -__Example__ - -```js -async.mapLimit(['file1','file2','file3'], 1, fs.stat, function(err, results){ - // results is now an array of stats for each file -}); -``` - ---------------------------------------- - -<a name="filter" /> -### filter(arr, iterator, callback) - -__Alias:__ select - -Returns a new array of all the values which pass an async truth test. -_The callback for each iterator call only accepts a single argument of true or -false, it does not accept an error argument first!_ This is in-line with the -way node libraries work with truth tests like fs.exists. This operation is -performed in parallel, but the results array will be in the same order as the -original. - -__Arguments__ - -* arr - An array to iterate over. -* iterator(item, callback) - A truth test to apply to each item in the array. - The iterator is passed a callback(truthValue) which must be called with a - boolean argument once it has completed. -* callback(results) - A callback which is called after all the iterator - functions have finished. - -__Example__ - -```js -async.filter(['file1','file2','file3'], fs.exists, function(results){ - // results now equals an array of the existing files -}); -``` - ---------------------------------------- - -<a name="filterSeries" /> -### filterSeries(arr, iterator, callback) - -__alias:__ selectSeries - -The same as filter only the iterator is applied to each item in the array in -series. The next iterator is only called once the current one has completed -processing. The results array will be in the same order as the original. - ---------------------------------------- - -<a name="reject" /> -### reject(arr, iterator, callback) - -The opposite of filter. Removes values that pass an async truth test. - ---------------------------------------- - -<a name="rejectSeries" /> -### rejectSeries(arr, iterator, callback) - -The same as reject, only the iterator is applied to each item in the array -in series. - - ---------------------------------------- - -<a name="reduce" /> -### reduce(arr, memo, iterator, callback) - -__aliases:__ inject, foldl - -Reduces a list of values into a single value using an async iterator to return -each successive step. Memo is the initial state of the reduction. This -function only operates in series. For performance reasons, it may make sense to -split a call to this function into a parallel map, then use the normal -Array.prototype.reduce on the results. This function is for situations where -each step in the reduction needs to be async, if you can get the data before -reducing it then it's probably a good idea to do so. - -__Arguments__ - -* arr - An array to iterate over. -* memo - The initial state of the reduction. -* iterator(memo, item, callback) - A function applied to each item in the - array to produce the next step in the reduction. The iterator is passed a - callback(err, reduction) which accepts an optional error as its first - argument, and the state of the reduction as the second. If an error is - passed to the callback, the reduction is stopped and the main callback is - immediately called with the error. -* callback(err, result) - A callback which is called after all the iterator - functions have finished. Result is the reduced value. - -__Example__ - -```js -async.reduce([1,2,3], 0, function(memo, item, callback){ - // pointless async: - process.nextTick(function(){ - callback(null, memo + item) - }); -}, function(err, result){ - // result is now equal to the last value of memo, which is 6 -}); -``` - ---------------------------------------- - -<a name="reduceRight" /> -### reduceRight(arr, memo, iterator, callback) - -__Alias:__ foldr - -Same as reduce, only operates on the items in the array in reverse order. - - ---------------------------------------- - -<a name="detect" /> -### detect(arr, iterator, callback) - -Returns the first value in a list that passes an async truth test. The -iterator is applied in parallel, meaning the first iterator to return true will -fire the detect callback with that result. That means the result might not be -the first item in the original array (in terms of order) that passes the test. - -If order within the original array is important then look at detectSeries. - -__Arguments__ - -* arr - An array to iterate over. -* iterator(item, callback) - A truth test to apply to each item in the array. - The iterator is passed a callback(truthValue) which must be called with a - boolean argument once it has completed. -* callback(result) - A callback which is called as soon as any iterator returns - true, or after all the iterator functions have finished. Result will be - the first item in the array that passes the truth test (iterator) or the - value undefined if none passed. - -__Example__ - -```js -async.detect(['file1','file2','file3'], fs.exists, function(result){ - // result now equals the first file in the list that exists -}); -``` - ---------------------------------------- - -<a name="detectSeries" /> -### detectSeries(arr, iterator, callback) - -The same as detect, only the iterator is applied to each item in the array -in series. This means the result is always the first in the original array (in -terms of array order) that passes the truth test. - - ---------------------------------------- - -<a name="sortBy" /> -### sortBy(arr, iterator, callback) - -Sorts a list by the results of running each value through an async iterator. - -__Arguments__ - -* arr - An array to iterate over. -* iterator(item, callback) - A function to apply to each item in the array. - The iterator is passed a callback(err, sortValue) which must be called once it - has completed with an error (which can be null) and a value to use as the sort - criteria. -* callback(err, results) - A callback which is called after all the iterator - functions have finished, or an error has occurred. Results is the items from - the original array sorted by the values returned by the iterator calls. - -__Example__ - -```js -async.sortBy(['file1','file2','file3'], function(file, callback){ - fs.stat(file, function(err, stats){ - callback(err, stats.mtime); - }); -}, function(err, results){ - // results is now the original array of files sorted by - // modified date -}); -``` - ---------------------------------------- - -<a name="some" /> -### some(arr, iterator, callback) - -__Alias:__ any - -Returns true if at least one element in the array satisfies an async test. -_The callback for each iterator call only accepts a single argument of true or -false, it does not accept an error argument first!_ This is in-line with the -way node libraries work with truth tests like fs.exists. Once any iterator -call returns true, the main callback is immediately called. - -__Arguments__ - -* arr - An array to iterate over. -* iterator(item, callback) - A truth test to apply to each item in the array. - The iterator is passed a callback(truthValue) which must be called with a - boolean argument once it has completed. -* callback(result) - A callback which is called as soon as any iterator returns - true, or after all the iterator functions have finished. Result will be - either true or false depending on the values of the async tests. - -__Example__ - -```js -async.some(['file1','file2','file3'], fs.exists, function(result){ - // if result is true then at least one of the files exists -}); -``` - ---------------------------------------- - -<a name="every" /> -### every(arr, iterator, callback) - -__Alias:__ all - -Returns true if every element in the array satisfies an async test. -_The callback for each iterator call only accepts a single argument of true or -false, it does not accept an error argument first!_ This is in-line with the -way node libraries work with truth tests like fs.exists. - -__Arguments__ - -* arr - An array to iterate over. -* iterator(item, callback) - A truth test to apply to each item in the array. - The iterator is passed a callback(truthValue) which must be called with a - boolean argument once it has completed. -* callback(result) - A callback which is called after all the iterator - functions have finished. Result will be either true or false depending on - the values of the async tests. - -__Example__ - -```js -async.every(['file1','file2','file3'], fs.exists, function(result){ - // if result is true then every file exists -}); -``` - ---------------------------------------- - -<a name="concat" /> -### concat(arr, iterator, callback) - -Applies an iterator to each item in a list, concatenating the results. Returns the -concatenated list. The iterators are called in parallel, and the results are -concatenated as they return. There is no guarantee that the results array will -be returned in the original order of the arguments passed to the iterator function. - -__Arguments__ - -* arr - An array to iterate over -* iterator(item, callback) - A function to apply to each item in the array. - The iterator is passed a callback(err, results) which must be called once it - has completed with an error (which can be null) and an array of results. -* callback(err, results) - A callback which is called after all the iterator - functions have finished, or an error has occurred. Results is an array containing - the concatenated results of the iterator function. - -__Example__ - -```js -async.concat(['dir1','dir2','dir3'], fs.readdir, function(err, files){ - // files is now a list of filenames that exist in the 3 directories -}); -``` - ---------------------------------------- - -<a name="concatSeries" /> -### concatSeries(arr, iterator, callback) - -Same as async.concat, but executes in series instead of parallel. - - -## Control Flow - -<a name="series" /> -### series(tasks, [callback]) - -Run an array of functions in series, each one running once the previous -function has completed. If any functions in the series pass an error to its -callback, no more functions are run and the callback for the series is -immediately called with the value of the error. Once the tasks have completed, -the results are passed to the final callback as an array. - -It is also possible to use an object instead of an array. Each property will be -run as a function and the results will be passed to the final callback as an object -instead of an array. This can be a more readable way of handling results from -async.series. - - -__Arguments__ - -* tasks - An array or object containing functions to run, each function is passed - a callback(err, result) it must call on completion with an error (which can - be null) and an optional result value. -* callback(err, results) - An optional callback to run once all the functions - have completed. This function gets a results array (or object) containing all - the result arguments passed to the task callbacks. - -__Example__ - -```js -async.series([ - function(callback){ - // do some stuff ... - callback(null, 'one'); - }, - function(callback){ - // do some more stuff ... - callback(null, 'two'); - } -], -// optional callback -function(err, results){ - // results is now equal to ['one', 'two'] -}); - - -// an example using an object instead of an array -async.series({ - one: function(callback){ - setTimeout(function(){ - callback(null, 1); - }, 200); - }, - two: function(callback){ - setTimeout(function(){ - callback(null, 2); - }, 100); - } -}, -function(err, results) { - // results is now equal to: {one: 1, two: 2} -}); -``` - ---------------------------------------- - -<a name="parallel" /> -### parallel(tasks, [callback]) - -Run an array of functions in parallel, without waiting until the previous -function has completed. If any of the functions pass an error to its -callback, the main callback is immediately called with the value of the error. -Once the tasks have completed, the results are passed to the final callback as an -array. - -It is also possible to use an object instead of an array. Each property will be -run as a function and the results will be passed to the final callback as an object -instead of an array. This can be a more readable way of handling results from -async.parallel. - - -__Arguments__ - -* tasks - An array or object containing functions to run, each function is passed - a callback(err, result) it must call on completion with an error (which can - be null) and an optional result value. -* callback(err, results) - An optional callback to run once all the functions - have completed. This function gets a results array (or object) containing all - the result arguments passed to the task callbacks. - -__Example__ - -```js -async.parallel([ - function(callback){ - setTimeout(function(){ - callback(null, 'one'); - }, 200); - }, - function(callback){ - setTimeout(function(){ - callback(null, 'two'); - }, 100); - } -], -// optional callback -function(err, results){ - // the results array will equal ['one','two'] even though - // the second function had a shorter timeout. -}); - - -// an example using an object instead of an array -async.parallel({ - one: function(callback){ - setTimeout(function(){ - callback(null, 1); - }, 200); - }, - two: function(callback){ - setTimeout(function(){ - callback(null, 2); - }, 100); - } -}, -function(err, results) { - // results is now equals to: {one: 1, two: 2} -}); -``` - ---------------------------------------- - -<a name="parallel" /> -### parallelLimit(tasks, limit, [callback]) - -The same as parallel only the tasks are executed in parallel with a maximum of "limit" -tasks executing at any time. - -Note that the tasks are not executed in batches, so there is no guarantee that -the first "limit" tasks will complete before any others are started. - -__Arguments__ - -* tasks - An array or object containing functions to run, each function is passed - a callback(err, result) it must call on completion with an error (which can - be null) and an optional result value. -* limit - The maximum number of tasks to run at any time. -* callback(err, results) - An optional callback to run once all the functions - have completed. This function gets a results array (or object) containing all - the result arguments passed to the task callbacks. - ---------------------------------------- - -<a name="whilst" /> -### whilst(test, fn, callback) - -Repeatedly call fn, while test returns true. Calls the callback when stopped, -or an error occurs. - -__Arguments__ - -* test() - synchronous truth test to perform before each execution of fn. -* fn(callback) - A function to call each time the test passes. The function is - passed a callback(err) which must be called once it has completed with an - optional error argument. -* callback(err) - A callback which is called after the test fails and repeated - execution of fn has stopped. - -__Example__ - -```js -var count = 0; - -async.whilst( - function () { return count < 5; }, - function (callback) { - count++; - setTimeout(callback, 1000); - }, - function (err) { - // 5 seconds have passed - } -); -``` - ---------------------------------------- - -<a name="doWhilst" /> -### doWhilst(fn, test, callback) - -The post check version of whilst. To reflect the difference in the order of operations `test` and `fn` arguments are switched. `doWhilst` is to `whilst` as `do while` is to `while` in plain JavaScript. - ---------------------------------------- - -<a name="until" /> -### until(test, fn, callback) - -Repeatedly call fn, until test returns true. Calls the callback when stopped, -or an error occurs. - -The inverse of async.whilst. - ---------------------------------------- - -<a name="doUntil" /> -### doUntil(fn, test, callback) - -Like doWhilst except the test is inverted. Note the argument ordering differs from `until`. - ---------------------------------------- - -<a name="forever" /> -### forever(fn, callback) - -Calls the asynchronous function 'fn' repeatedly, in series, indefinitely. -If an error is passed to fn's callback then 'callback' is called with the -error, otherwise it will never be called. - ---------------------------------------- - -<a name="waterfall" /> -### waterfall(tasks, [callback]) - -Runs an array of functions in series, each passing their results to the next in -the array. However, if any of the functions pass an error to the callback, the -next function is not executed and the main callback is immediately called with -the error. - -__Arguments__ - -* tasks - An array of functions to run, each function is passed a - callback(err, result1, result2, ...) it must call on completion. The first - argument is an error (which can be null) and any further arguments will be - passed as arguments in order to the next task. -* callback(err, [results]) - An optional callback to run once all the functions - have completed. This will be passed the results of the last task's callback. - - - -__Example__ - -```js -async.waterfall([ - function(callback){ - callback(null, 'one', 'two'); - }, - function(arg1, arg2, callback){ - callback(null, 'three'); - }, - function(arg1, callback){ - // arg1 now equals 'three' - callback(null, 'done'); - } -], function (err, result) { - // result now equals 'done' -}); -``` - ---------------------------------------- -<a name="compose" /> -### compose(fn1, fn2...) - -Creates a function which is a composition of the passed asynchronous -functions. Each function consumes the return value of the function that -follows. Composing functions f(), g() and h() would produce the result of -f(g(h())), only this version uses callbacks to obtain the return values. - -Each function is executed with the `this` binding of the composed function. - -__Arguments__ - -* functions... - the asynchronous functions to compose - - -__Example__ - -```js -function add1(n, callback) { - setTimeout(function () { - callback(null, n + 1); - }, 10); -} - -function mul3(n, callback) { - setTimeout(function () { - callback(null, n * 3); - }, 10); -} - -var add1mul3 = async.compose(mul3, add1); - -add1mul3(4, function (err, result) { - // result now equals 15 -}); -``` - ---------------------------------------- -<a name="applyEach" /> -### applyEach(fns, args..., callback) - -Applies the provided arguments to each function in the array, calling the -callback after all functions have completed. If you only provide the first -argument then it will return a function which lets you pass in the -arguments as if it were a single function call. - -__Arguments__ - -* fns - the asynchronous functions to all call with the same arguments -* args... - any number of separate arguments to pass to the function -* callback - the final argument should be the callback, called when all - functions have completed processing - - -__Example__ - -```js -async.applyEach([enableSearch, updateSchema], 'bucket', callback); - -// partial application example: -async.each( - buckets, - async.applyEach([enableSearch, updateSchema]), - callback -); -``` - ---------------------------------------- - -<a name="applyEachSeries" /> -### applyEachSeries(arr, iterator, callback) - -The same as applyEach only the functions are applied in series. - ---------------------------------------- - -<a name="queue" /> -### queue(worker, concurrency) - -Creates a queue object with the specified concurrency. Tasks added to the -queue will be processed in parallel (up to the concurrency limit). If all -workers are in progress, the task is queued until one is available. Once -a worker has completed a task, the task's callback is called. - -__Arguments__ - -* worker(task, callback) - An asynchronous function for processing a queued - task, which must call its callback(err) argument when finished, with an - optional error as an argument. -* concurrency - An integer for determining how many worker functions should be - run in parallel. - -__Queue objects__ - -The queue object returned by this function has the following properties and -methods: - -* length() - a function returning the number of items waiting to be processed. -* concurrency - an integer for determining how many worker functions should be - run in parallel. This property can be changed after a queue is created to - alter the concurrency on-the-fly. -* push(task, [callback]) - add a new task to the queue, the callback is called - once the worker has finished processing the task. - instead of a single task, an array of tasks can be submitted. the respective callback is used for every task in the list. -* unshift(task, [callback]) - add a new task to the front of the queue. -* saturated - a callback that is called when the queue length hits the concurrency and further tasks will be queued -* empty - a callback that is called when the last item from the queue is given to a worker -* drain - a callback that is called when the last item from the queue has returned from the worker - -__Example__ - -```js -// create a queue object with concurrency 2 - -var q = async.queue(function (task, callback) { - console.log('hello ' + task.name); - callback(); -}, 2); - - -// assign a callback -q.drain = function() { - console.log('all items have been processed'); -} - -// add some items to the queue - -q.push({name: 'foo'}, function (err) { - console.log('finished processing foo'); -}); -q.push({name: 'bar'}, function (err) { - console.log('finished processing bar'); -}); - -// add some items to the queue (batch-wise) - -q.push([{name: 'baz'},{name: 'bay'},{name: 'bax'}], function (err) { - console.log('finished processing bar'); -}); - -// add some items to the front of the queue - -q.unshift({name: 'bar'}, function (err) { - console.log('finished processing bar'); -}); -``` - ---------------------------------------- - -<a name="cargo" /> -### cargo(worker, [payload]) - -Creates a cargo object with the specified payload. Tasks added to the -cargo will be processed altogether (up to the payload limit). If the -worker is in progress, the task is queued until it is available. Once -the worker has completed some tasks, each callback of those tasks is called. - -__Arguments__ - -* worker(tasks, callback) - An asynchronous function for processing an array of - queued tasks, which must call its callback(err) argument when finished, with - an optional error as an argument. -* payload - An optional integer for determining how many tasks should be - processed per round; if omitted, the default is unlimited. - -__Cargo objects__ - -The cargo object returned by this function has the following properties and -methods: - -* length() - a function returning the number of items waiting to be processed. -* payload - an integer for determining how many tasks should be - process per round. This property can be changed after a cargo is created to - alter the payload on-the-fly. -* push(task, [callback]) - add a new task to the queue, the callback is called - once the worker has finished processing the task. - instead of a single task, an array of tasks can be submitted. the respective callback is used for every task in the list. -* saturated - a callback that is called when the queue length hits the concurrency and further tasks will be queued -* empty - a callback that is called when the last item from the queue is given to a worker -* drain - a callback that is called when the last item from the queue has returned from the worker - -__Example__ - -```js -// create a cargo object with payload 2 - -var cargo = async.cargo(function (tasks, callback) { - for(var i=0; i<tasks.length; i++){ - console.log('hello ' + tasks[i].name); - } - callback(); -}, 2); - - -// add some items - -cargo.push({name: 'foo'}, function (err) { - console.log('finished processing foo'); -}); -cargo.push({name: 'bar'}, function (err) { - console.log('finished processing bar'); -}); -cargo.push({name: 'baz'}, function (err) { - console.log('finished processing baz'); -}); -``` - ---------------------------------------- - -<a name="auto" /> -### auto(tasks, [callback]) - -Determines the best order for running functions based on their requirements. -Each function can optionally depend on other functions being completed first, -and each function is run as soon as its requirements are satisfied. If any of -the functions pass an error to their callback, that function will not complete -(so any other functions depending on it will not run) and the main callback -will be called immediately with the error. Functions also receive an object -containing the results of functions which have completed so far. - -Note, all functions are called with a results object as a second argument, -so it is unsafe to pass functions in the tasks object which cannot handle the -extra argument. For example, this snippet of code: - -```js -async.auto({ - readData: async.apply(fs.readFile, 'data.txt', 'utf-8') -}, callback); -``` - -will have the effect of calling readFile with the results object as the last -argument, which will fail: - -```js -fs.readFile('data.txt', 'utf-8', cb, {}); -``` - -Instead, wrap the call to readFile in a function which does not forward the -results object: - -```js -async.auto({ - readData: function(cb, results){ - fs.readFile('data.txt', 'utf-8', cb); - } -}, callback); -``` - -__Arguments__ - -* tasks - An object literal containing named functions or an array of - requirements, with the function itself the last item in the array. The key - used for each function or array is used when specifying requirements. The - function receives two arguments: (1) a callback(err, result) which must be - called when finished, passing an error (which can be null) and the result of - the function's execution, and (2) a results object, containing the results of - the previously executed functions. -* callback(err, results) - An optional callback which is called when all the - tasks have been completed. The callback will receive an error as an argument - if any tasks pass an error to their callback. Results will always be passed - but if an error occurred, no other tasks will be performed, and the results - object will only contain partial results. - - -__Example__ - -```js -async.auto({ - get_data: function(callback){ - // async code to get some data - }, - make_folder: function(callback){ - // async code to create a directory to store a file in - // this is run at the same time as getting the data - }, - write_file: ['get_data', 'make_folder', function(callback){ - // once there is some data and the directory exists, - // write the data to a file in the directory - callback(null, filename); - }], - email_link: ['write_file', function(callback, results){ - // once the file is written let's email a link to it... - // results.write_file contains the filename returned by write_file. - }] -}); -``` - -This is a fairly trivial example, but to do this using the basic parallel and -series functions would look like this: - -```js -async.parallel([ - function(callback){ - // async code to get some data - }, - function(callback){ - // async code to create a directory to store a file in - // this is run at the same time as getting the data - } -], -function(err, results){ - async.series([ - function(callback){ - // once there is some data and the directory exists, - // write the data to a file in the directory - }, - function(callback){ - // once the file is written let's email a link to it... - } - ]); -}); -``` - -For a complicated series of async tasks using the auto function makes adding -new tasks much easier and makes the code more readable. - - ---------------------------------------- - -<a name="iterator" /> -### iterator(tasks) - -Creates an iterator function which calls the next function in the array, -returning a continuation to call the next one after that. It's also possible to -'peek' the next iterator by doing iterator.next(). - -This function is used internally by the async module but can be useful when -you want to manually control the flow of functions in series. - -__Arguments__ - -* tasks - An array of functions to run. - -__Example__ - -```js -var iterator = async.iterator([ - function(){ sys.p('one'); }, - function(){ sys.p('two'); }, - function(){ sys.p('three'); } -]); - -node> var iterator2 = iterator(); -'one' -node> var iterator3 = iterator2(); -'two' -node> iterator3(); -'three' -node> var nextfn = iterator2.next(); -node> nextfn(); -'three' -``` - ---------------------------------------- - -<a name="apply" /> -### apply(function, arguments..) - -Creates a continuation function with some arguments already applied, a useful -shorthand when combined with other control flow functions. Any arguments -passed to the returned function are added to the arguments originally passed -to apply. - -__Arguments__ - -* function - The function you want to eventually apply all arguments to. -* arguments... - Any number of arguments to automatically apply when the - continuation is called. - -__Example__ - -```js -// using apply - -async.parallel([ - async.apply(fs.writeFile, 'testfile1', 'test1'), - async.apply(fs.writeFile, 'testfile2', 'test2'), -]); - - -// the same process without using apply - -async.parallel([ - function(callback){ - fs.writeFile('testfile1', 'test1', callback); - }, - function(callback){ - fs.writeFile('testfile2', 'test2', callback); - } -]); -``` - -It's possible to pass any number of additional arguments when calling the -continuation: - -```js -node> var fn = async.apply(sys.puts, 'one'); -node> fn('two', 'three'); -one -two -three -``` - ---------------------------------------- - -<a name="nextTick" /> -### nextTick(callback) - -Calls the callback on a later loop around the event loop. In node.js this just -calls process.nextTick, in the browser it falls back to setImmediate(callback) -if available, otherwise setTimeout(callback, 0), which means other higher priority -events may precede the execution of the callback. - -This is used internally for browser-compatibility purposes. - -__Arguments__ - -* callback - The function to call on a later loop around the event loop. - -__Example__ - -```js -var call_order = []; -async.nextTick(function(){ - call_order.push('two'); - // call_order now equals ['one','two'] -}); -call_order.push('one') -``` - -<a name="times" /> -### times(n, callback) - -Calls the callback n times and accumulates results in the same manner -you would use with async.map. - -__Arguments__ - -* n - The number of times to run the function. -* callback - The function to call n times. - -__Example__ - -```js -// Pretend this is some complicated async factory -var createUser = function(id, callback) { - callback(null, { - id: 'user' + id - }) -} -// generate 5 users -async.times(5, function(n, next){ - createUser(n, function(err, user) { - next(err, user) - }) -}, function(err, users) { - // we should now have 5 users -}); -``` - -<a name="timesSeries" /> -### timesSeries(n, callback) - -The same as times only the iterator is applied to each item in the array in -series. The next iterator is only called once the current one has completed -processing. The results array will be in the same order as the original. - - -## Utils - -<a name="memoize" /> -### memoize(fn, [hasher]) - -Caches the results of an async function. When creating a hash to store function -results against, the callback is omitted from the hash and an optional hash -function can be used. - -The cache of results is exposed as the `memo` property of the function returned -by `memoize`. - -__Arguments__ - -* fn - the function you to proxy and cache results from. -* hasher - an optional function for generating a custom hash for storing - results, it has all the arguments applied to it apart from the callback, and - must be synchronous. - -__Example__ - -```js -var slow_fn = function (name, callback) { - // do something - callback(null, result); -}; -var fn = async.memoize(slow_fn); - -// fn can now be used as if it were slow_fn -fn('some name', function () { - // callback -}); -``` - -<a name="unmemoize" /> -### unmemoize(fn) - -Undoes a memoized function, reverting it to the original, unmemoized -form. Comes handy in tests. - -__Arguments__ - -* fn - the memoized function - -<a name="log" /> -### log(function, arguments) - -Logs the result of an async function to the console. Only works in node.js or -in browsers that support console.log and console.error (such as FF and Chrome). -If multiple arguments are returned from the async function, console.log is -called on each argument in order. - -__Arguments__ - -* function - The function you want to eventually apply all arguments to. -* arguments... - Any number of arguments to apply to the function. - -__Example__ - -```js -var hello = function(name, callback){ - setTimeout(function(){ - callback(null, 'hello ' + name); - }, 1000); -}; -``` -```js -node> async.log(hello, 'world'); -'hello world' -``` - ---------------------------------------- - -<a name="dir" /> -### dir(function, arguments) - -Logs the result of an async function to the console using console.dir to -display the properties of the resulting object. Only works in node.js or -in browsers that support console.dir and console.error (such as FF and Chrome). -If multiple arguments are returned from the async function, console.dir is -called on each argument in order. - -__Arguments__ - -* function - The function you want to eventually apply all arguments to. -* arguments... - Any number of arguments to apply to the function. - -__Example__ - -```js -var hello = function(name, callback){ - setTimeout(function(){ - callback(null, {hello: name}); - }, 1000); -}; -``` -```js -node> async.dir(hello, 'world'); -{hello: 'world'} -``` - ---------------------------------------- - -<a name="noConflict" /> -### noConflict() - -Changes the value of async back to its original value, returning a reference to the -async object. diff --git a/node_modules/boomlet/node_modules/uglify-js/node_modules/async/component.json b/node_modules/boomlet/node_modules/uglify-js/node_modules/async/component.json deleted file mode 100644 index bbb0115..0000000 --- a/node_modules/boomlet/node_modules/uglify-js/node_modules/async/component.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "name": "async", - "repo": "caolan/async", - "description": "Higher-order functions and common patterns for asynchronous code", - "version": "0.1.23", - "keywords": [], - "dependencies": {}, - "development": {}, - "main": "lib/async.js", - "scripts": [ "lib/async.js" ] -} diff --git a/node_modules/boomlet/node_modules/uglify-js/node_modules/async/lib/async.js b/node_modules/boomlet/node_modules/uglify-js/node_modules/async/lib/async.js deleted file mode 100755 index 1eebb15..0000000 --- a/node_modules/boomlet/node_modules/uglify-js/node_modules/async/lib/async.js +++ /dev/null @@ -1,958 +0,0 @@ -/*global setImmediate: false, setTimeout: false, console: false */ -(function () { - - var async = {}; - - // global on the server, window in the browser - var root, previous_async; - - root = this; - if (root != null) { - previous_async = root.async; - } - - async.noConflict = function () { - root.async = previous_async; - return async; - }; - - function only_once(fn) { - var called = false; - return function() { - if (called) throw new Error("Callback was already called."); - called = true; - fn.apply(root, arguments); - } - } - - //// cross-browser compatiblity functions //// - - var _each = function (arr, iterator) { - if (arr.forEach) { - return arr.forEach(iterator); - } - for (var i = 0; i < arr.length; i += 1) { - iterator(arr[i], i, arr); - } - }; - - var _map = function (arr, iterator) { - if (arr.map) { - return arr.map(iterator); - } - var results = []; - _each(arr, function (x, i, a) { - results.push(iterator(x, i, a)); - }); - return results; - }; - - var _reduce = function (arr, iterator, memo) { - if (arr.reduce) { - return arr.reduce(iterator, memo); - } - _each(arr, function (x, i, a) { - memo = iterator(memo, x, i, a); - }); - return memo; - }; - - var _keys = function (obj) { - if (Object.keys) { - return Object.keys(obj); - } - var keys = []; - for (var k in obj) { - if (obj.hasOwnProperty(k)) { - keys.push(k); - } - } - return keys; - }; - - //// exported async module functions //// - - //// nextTick implementation with browser-compatible fallback //// - if (typeof process === 'undefined' || !(process.nextTick)) { - if (typeof setImmediate === 'function') { - async.nextTick = function (fn) { - // not a direct alias for IE10 compatibility - setImmediate(fn); - }; - async.setImmediate = async.nextTick; - } - else { - async.nextTick = function (fn) { - setTimeout(fn, 0); - }; - async.setImmediate = async.nextTick; - } - } - else { - async.nextTick = process.nextTick; - if (typeof setImmediate !== 'undefined') { - async.setImmediate = function (fn) { - // not a direct alias for IE10 compatibility - setImmediate(fn); - }; - } - else { - async.setImmediate = async.nextTick; - } - } - - async.each = function (arr, iterator, callback) { - callback = callback || function () {}; - if (!arr.length) { - return callback(); - } - var completed = 0; - _each(arr, function (x) { - iterator(x, only_once(function (err) { - if (err) { - callback(err); - callback = function () {}; - } - else { - completed += 1; - if (completed >= arr.length) { - callback(null); - } - } - })); - }); - }; - async.forEach = async.each; - - async.eachSeries = function (arr, iterator, callback) { - callback = callback || function () {}; - if (!arr.length) { - return callback(); - } - var completed = 0; - var iterate = function () { - iterator(arr[completed], function (err) { - if (err) { - callback(err); - callback = function () {}; - } - else { - completed += 1; - if (completed >= arr.length) { - callback(null); - } - else { - iterate(); - } - } - }); - }; - iterate(); - }; - async.forEachSeries = async.eachSeries; - - async.eachLimit = function (arr, limit, iterator, callback) { - var fn = _eachLimit(limit); - fn.apply(null, [arr, iterator, callback]); - }; - async.forEachLimit = async.eachLimit; - - var _eachLimit = function (limit) { - - return function (arr, iterator, callback) { - callback = callback || function () {}; - if (!arr.length || limit <= 0) { - return callback(); - } - var completed = 0; - var started = 0; - var running = 0; - - (function replenish () { - if (completed >= arr.length) { - return callback(); - } - - while (running < limit && started < arr.length) { - started += 1; - running += 1; - iterator(arr[started - 1], function (err) { - if (err) { - callback(err); - callback = function () {}; - } - else { - completed += 1; - running -= 1; - if (completed >= arr.length) { - callback(); - } - else { - replenish(); - } - } - }); - } - })(); - }; - }; - - - var doParallel = function (fn) { - return function () { - var args = Array.prototype.slice.call(arguments); - return fn.apply(null, [async.each].concat(args)); - }; - }; - var doParallelLimit = function(limit, fn) { - return function () { - var args = Array.prototype.slice.call(arguments); - return fn.apply(null, [_eachLimit(limit)].concat(args)); - }; - }; - var doSeries = function (fn) { - return function () { - var args = Array.prototype.slice.call(arguments); - return fn.apply(null, [async.eachSeries].concat(args)); - }; - }; - - - var _asyncMap = function (eachfn, arr, iterator, callback) { - var results = []; - arr = _map(arr, function (x, i) { - return {index: i, value: x}; - }); - eachfn(arr, function (x, callback) { - iterator(x.value, function (err, v) { - results[x.index] = v; - callback(err); - }); - }, function (err) { - callback(err, results); - }); - }; - async.map = doParallel(_asyncMap); - async.mapSeries = doSeries(_asyncMap); - async.mapLimit = function (arr, limit, iterator, callback) { - return _mapLimit(limit)(arr, iterator, callback); - }; - - var _mapLimit = function(limit) { - return doParallelLimit(limit, _asyncMap); - }; - - // reduce only has a series version, as doing reduce in parallel won't - // work in many situations. - async.reduce = function (arr, memo, iterator, callback) { - async.eachSeries(arr, function (x, callback) { - iterator(memo, x, function (err, v) { - memo = v; - callback(err); - }); - }, function (err) { - callback(err, memo); - }); - }; - // inject alias - async.inject = async.reduce; - // foldl alias - async.foldl = async.reduce; - - async.reduceRight = function (arr, memo, iterator, callback) { - var reversed = _map(arr, function (x) { - return x; - }).reverse(); - async.reduce(reversed, memo, iterator, callback); - }; - // foldr alias - async.foldr = async.reduceRight; - - var _filter = function (eachfn, arr, iterator, callback) { - var results = []; - arr = _map(arr, function (x, i) { - return {index: i, value: x}; - }); - eachfn(arr, function (x, callback) { - iterator(x.value, function (v) { - if (v) { - results.push(x); - } - callback(); - }); - }, function (err) { - callback(_map(results.sort(function (a, b) { - return a.index - b.index; - }), function (x) { - return x.value; - })); - }); - }; - async.filter = doParallel(_filter); - async.filterSeries = doSeries(_filter); - // select alias - async.select = async.filter; - async.selectSeries = async.filterSeries; - - var _reject = function (eachfn, arr, iterator, callback) { - var results = []; - arr = _map(arr, function (x, i) { - return {index: i, value: x}; - }); - eachfn(arr, function (x, callback) { - iterator(x.value, function (v) { - if (!v) { - results.push(x); - } - callback(); - }); - }, function (err) { - callback(_map(results.sort(function (a, b) { - return a.index - b.index; - }), function (x) { - return x.value; - })); - }); - }; - async.reject = doParallel(_reject); - async.rejectSeries = doSeries(_reject); - - var _detect = function (eachfn, arr, iterator, main_callback) { - eachfn(arr, function (x, callback) { - iterator(x, function (result) { - if (result) { - main_callback(x); - main_callback = function () {}; - } - else { - callback(); - } - }); - }, function (err) { - main_callback(); - }); - }; - async.detect = doParallel(_detect); - async.detectSeries = doSeries(_detect); - - async.some = function (arr, iterator, main_callback) { - async.each(arr, function (x, callback) { - iterator(x, function (v) { - if (v) { - main_callback(true); - main_callback = function () {}; - } - callback(); - }); - }, function (err) { - main_callback(false); - }); - }; - // any alias - async.any = async.some; - - async.every = function (arr, iterator, main_callback) { - async.each(arr, function (x, callback) { - iterator(x, function (v) { - if (!v) { - main_callback(false); - main_callback = function () {}; - } - callback(); - }); - }, function (err) { - main_callback(true); - }); - }; - // all alias - async.all = async.every; - - async.sortBy = function (arr, iterator, callback) { - async.map(arr, function (x, callback) { - iterator(x, function (err, criteria) { - if (err) { - callback(err); - } - else { - callback(null, {value: x, criteria: criteria}); - } - }); - }, function (err, results) { - if (err) { - return callback(err); - } - else { - var fn = function (left, right) { - var a = left.criteria, b = right.criteria; - return a < b ? -1 : a > b ? 1 : 0; - }; - callback(null, _map(results.sort(fn), function (x) { - return x.value; - })); - } - }); - }; - - async.auto = function (tasks, callback) { - callback = callback || function () {}; - var keys = _keys(tasks); - if (!keys.length) { - return callback(null); - } - - var results = {}; - - var listeners = []; - var addListener = function (fn) { - listeners.unshift(fn); - }; - var removeListener = function (fn) { - for (var i = 0; i < listeners.length; i += 1) { - if (listeners[i] === fn) { - listeners.splice(i, 1); - return; - } - } - }; - var taskComplete = function () { - _each(listeners.slice(0), function (fn) { - fn(); - }); - }; - - addListener(function () { - if (_keys(results).length === keys.length) { - callback(null, results); - callback = function () {}; - } - }); - - _each(keys, function (k) { - var task = (tasks[k] instanceof Function) ? [tasks[k]]: tasks[k]; - var taskCallback = function (err) { - var args = Array.prototype.slice.call(arguments, 1); - if (args.length <= 1) { - args = args[0]; - } - if (err) { - var safeResults = {}; - _each(_keys(results), function(rkey) { - safeResults[rkey] = results[rkey]; - }); - safeResults[k] = args; - callback(err, safeResults); - // stop subsequent errors hitting callback multiple times - callback = function () {}; - } - else { - results[k] = args; - async.setImmediate(taskComplete); - } - }; - var requires = task.slice(0, Math.abs(task.length - 1)) || []; - var ready = function () { - return _reduce(requires, function (a, x) { - return (a && results.hasOwnProperty(x)); - }, true) && !results.hasOwnProperty(k); - }; - if (ready()) { - task[task.length - 1](taskCallback, results); - } - else { - var listener = function () { - if (ready()) { - removeListener(listener); - task[task.length - 1](taskCallback, results); - } - }; - addListener(listener); - } - }); - }; - - async.waterfall = function (tasks, callback) { - callback = callback || function () {}; - if (tasks.constructor !== Array) { - var err = new Error('First argument to waterfall must be an array of functions'); - return callback(err); - } - if (!tasks.length) { - return callback(); - } - var wrapIterator = function (iterator) { - return function (err) { - if (err) { - callback.apply(null, arguments); - callback = function () {}; - } - else { - var args = Array.prototype.slice.call(arguments, 1); - var next = iterator.next(); - if (next) { - args.push(wrapIterator(next)); - } - else { - args.push(callback); - } - async.setImmediate(function () { - iterator.apply(null, args); - }); - } - }; - }; - wrapIterator(async.iterator(tasks))(); - }; - - var _parallel = function(eachfn, tasks, callback) { - callback = callback || function () {}; - if (tasks.constructor === Array) { - eachfn.map(tasks, function (fn, callback) { - if (fn) { - fn(function (err) { - var args = Array.prototype.slice.call(arguments, 1); - if (args.length <= 1) { - args = args[0]; - } - callback.call(null, err, args); - }); - } - }, callback); - } - else { - var results = {}; - eachfn.each(_keys(tasks), function (k, callback) { - tasks[k](function (err) { - var args = Array.prototype.slice.call(arguments, 1); - if (args.length <= 1) { - args = args[0]; - } - results[k] = args; - callback(err); - }); - }, function (err) { - callback(err, results); - }); - } - }; - - async.parallel = function (tasks, callback) { - _parallel({ map: async.map, each: async.each }, tasks, callback); - }; - - async.parallelLimit = function(tasks, limit, callback) { - _parallel({ map: _mapLimit(limit), each: _eachLimit(limit) }, tasks, callback); - }; - - async.series = function (tasks, callback) { - callback = callback || function () {}; - if (tasks.constructor === Array) { - async.mapSeries(tasks, function (fn, callback) { - if (fn) { - fn(function (err) { - var args = Array.prototype.slice.call(arguments, 1); - if (args.length <= 1) { - args = args[0]; - } - callback.call(null, err, args); - }); - } - }, callback); - } - else { - var results = {}; - async.eachSeries(_keys(tasks), function (k, callback) { - tasks[k](function (err) { - var args = Array.prototype.slice.call(arguments, 1); - if (args.length <= 1) { - args = args[0]; - } - results[k] = args; - callback(err); - }); - }, function (err) { - callback(err, results); - }); - } - }; - - async.iterator = function (tasks) { - var makeCallback = function (index) { - var fn = function () { - if (tasks.length) { - tasks[index].apply(null, arguments); - } - return fn.next(); - }; - fn.next = function () { - return (index < tasks.length - 1) ? makeCallback(index + 1): null; - }; - return fn; - }; - return makeCallback(0); - }; - - async.apply = function (fn) { - var args = Array.prototype.slice.call(arguments, 1); - return function () { - return fn.apply( - null, args.concat(Array.prototype.slice.call(arguments)) - ); - }; - }; - - var _concat = function (eachfn, arr, fn, callback) { - var r = []; - eachfn(arr, function (x, cb) { - fn(x, function (err, y) { - r = r.concat(y || []); - cb(err); - }); - }, function (err) { - callback(err, r); - }); - }; - async.concat = doParallel(_concat); - async.concatSeries = doSeries(_concat); - - async.whilst = function (test, iterator, callback) { - if (test()) { - iterator(function (err) { - if (err) { - return callback(err); - } - async.whilst(test, iterator, callback); - }); - } - else { - callback(); - } - }; - - async.doWhilst = function (iterator, test, callback) { - iterator(function (err) { - if (err) { - return callback(err); - } - if (test()) { - async.doWhilst(iterator, test, callback); - } - else { - callback(); - } - }); - }; - - async.until = function (test, iterator, callback) { - if (!test()) { - iterator(function (err) { - if (err) { - return callback(err); - } - async.until(test, iterator, callback); - }); - } - else { - callback(); - } - }; - - async.doUntil = function (iterator, test, callback) { - iterator(function (err) { - if (err) { - return callback(err); - } - if (!test()) { - async.doUntil(iterator, test, callback); - } - else { - callback(); - } - }); - }; - - async.queue = function (worker, concurrency) { - if (concurrency === undefined) { - concurrency = 1; - } - function _insert(q, data, pos, callback) { - if(data.constructor !== Array) { - data = [data]; - } - _each(data, function(task) { - var item = { - data: task, - callback: typeof callback === 'function' ? callback : null - }; - - if (pos) { - q.tasks.unshift(item); - } else { - q.tasks.push(item); - } - - if (q.saturated && q.tasks.length === concurrency) { - q.saturated(); - } - async.setImmediate(q.process); - }); - } - - var workers = 0; - var q = { - tasks: [], - concurrency: concurrency, - saturated: null, - empty: null, - drain: null, - push: function (data, callback) { - _insert(q, data, false, callback); - }, - unshift: function (data, callback) { - _insert(q, data, true, callback); - }, - process: function () { - if (workers < q.concurrency && q.tasks.length) { - var task = q.tasks.shift(); - if (q.empty && q.tasks.length === 0) { - q.empty(); - } - workers += 1; - var next = function () { - workers -= 1; - if (task.callback) { - task.callback.apply(task, arguments); - } - if (q.drain && q.tasks.length + workers === 0) { - q.drain(); - } - q.process(); - }; - var cb = only_once(next); - worker(task.data, cb); - } - }, - length: function () { - return q.tasks.length; - }, - running: function () { - return workers; - } - }; - return q; - }; - - async.cargo = function (worker, payload) { - var working = false, - tasks = []; - - var cargo = { - tasks: tasks, - payload: payload, - saturated: null, - empty: null, - drain: null, - push: function (data, callback) { - if(data.constructor !== Array) { - data = [data]; - } - _each(data, function(task) { - tasks.push({ - data: task, - callback: typeof callback === 'function' ? callback : null - }); - if (cargo.saturated && tasks.length === payload) { - cargo.saturated(); - } - }); - async.setImmediate(cargo.process); - }, - process: function process() { - if (working) return; - if (tasks.length === 0) { - if(cargo.drain) cargo.drain(); - return; - } - - var ts = typeof payload === 'number' - ? tasks.splice(0, payload) - : tasks.splice(0); - - var ds = _map(ts, function (task) { - return task.data; - }); - - if(cargo.empty) cargo.empty(); - working = true; - worker(ds, function () { - working = false; - - var args = arguments; - _each(ts, function (data) { - if (data.callback) { - data.callback.apply(null, args); - } - }); - - process(); - }); - }, - length: function () { - return tasks.length; - }, - running: function () { - return working; - } - }; - return cargo; - }; - - var _console_fn = function (name) { - return function (fn) { - var args = Array.prototype.slice.call(arguments, 1); - fn.apply(null, args.concat([function (err) { - var args = Array.prototype.slice.call(arguments, 1); - if (typeof console !== 'undefined') { - if (err) { - if (console.error) { - console.error(err); - } - } - else if (console[name]) { - _each(args, function (x) { - console[name](x); - }); - } - } - }])); - }; - }; - async.log = _console_fn('log'); - async.dir = _console_fn('dir'); - /*async.info = _console_fn('info'); - async.warn = _console_fn('warn'); - async.error = _console_fn('error');*/ - - async.memoize = function (fn, hasher) { - var memo = {}; - var queues = {}; - hasher = hasher || function (x) { - return x; - }; - var memoized = function () { - var args = Array.prototype.slice.call(arguments); - var callback = args.pop(); - var key = hasher.apply(null, args); - if (key in memo) { - callback.apply(null, memo[key]); - } - else if (key in queues) { - queues[key].push(callback); - } - else { - queues[key] = [callback]; - fn.apply(null, args.concat([function () { - memo[key] = arguments; - var q = queues[key]; - delete queues[key]; - for (var i = 0, l = q.length; i < l; i++) { - q[i].apply(null, arguments); - } - }])); - } - }; - memoized.memo = memo; - memoized.unmemoized = fn; - return memoized; - }; - - async.unmemoize = function (fn) { - return function () { - return (fn.unmemoized || fn).apply(null, arguments); - }; - }; - - async.times = function (count, iterator, callback) { - var counter = []; - for (var i = 0; i < count; i++) { - counter.push(i); - } - return async.map(counter, iterator, callback); - }; - - async.timesSeries = function (count, iterator, callback) { - var counter = []; - for (var i = 0; i < count; i++) { - counter.push(i); - } - return async.mapSeries(counter, iterator, callback); - }; - - async.compose = function (/* functions... */) { - var fns = Array.prototype.reverse.call(arguments); - return function () { - var that = this; - var args = Array.prototype.slice.call(arguments); - var callback = args.pop(); - async.reduce(fns, args, function (newargs, fn, cb) { - fn.apply(that, newargs.concat([function () { - var err = arguments[0]; - var nextargs = Array.prototype.slice.call(arguments, 1); - cb(err, nextargs); - }])) - }, - function (err, results) { - callback.apply(that, [err].concat(results)); - }); - }; - }; - - var _applyEach = function (eachfn, fns /*args...*/) { - var go = function () { - var that = this; - var args = Array.prototype.slice.call(arguments); - var callback = args.pop(); - return eachfn(fns, function (fn, cb) { - fn.apply(that, args.concat([cb])); - }, - callback); - }; - if (arguments.length > 2) { - var args = Array.prototype.slice.call(arguments, 2); - return go.apply(this, args); - } - else { - return go; - } - }; - async.applyEach = doParallel(_applyEach); - async.applyEachSeries = doSeries(_applyEach); - - async.forever = function (fn, callback) { - function next(err) { - if (err) { - if (callback) { - return callback(err); - } - throw err; - } - fn(next); - } - next(); - }; - - // AMD / RequireJS - if (typeof define !== 'undefined' && define.amd) { - define([], function () { - return async; - }); - } - // Node.js - else if (typeof module !== 'undefined' && module.exports) { - module.exports = async; - } - // included directly via <script> tag - else { - root.async = async; - } - -}()); diff --git a/node_modules/boomlet/node_modules/uglify-js/node_modules/async/package.json b/node_modules/boomlet/node_modules/uglify-js/node_modules/async/package.json deleted file mode 100644 index 1af8811..0000000 --- a/node_modules/boomlet/node_modules/uglify-js/node_modules/async/package.json +++ /dev/null @@ -1,43 +0,0 @@ -{ - "name": "async", - "description": "Higher-order functions and common patterns for asynchronous code", - "main": "./lib/async", - "author": { - "name": "Caolan McMahon" - }, - "version": "0.2.10", - "repository": { - "type": "git", - "url": "https://github.com/caolan/async.git" - }, - "bugs": { - "url": "https://github.com/caolan/async/issues" - }, - "licenses": [ - { - "type": "MIT", - "url": "https://github.com/caolan/async/raw/master/LICENSE" - } - ], - "devDependencies": { - "nodeunit": ">0.0.0", - "uglify-js": "1.2.x", - "nodelint": ">0.0.0" - }, - "jam": { - "main": "lib/async.js", - "include": [ - "lib/async.js", - "README.md", - "LICENSE" - ] - }, - "scripts": { - "test": "nodeunit test/test-async.js" - }, - "readme": "# Async.js\n\nAsync is a utility module which provides straight-forward, powerful functions\nfor working with asynchronous JavaScript. Although originally designed for\nuse with [node.js](http://nodejs.org), it can also be used directly in the\nbrowser. Also supports [component](https://github.com/component/component).\n\nAsync provides around 20 functions that include the usual 'functional'\nsuspects (map, reduce, filter, each…) as well as some common patterns\nfor asynchronous control flow (parallel, series, waterfall…). All these\nfunctions assume you follow the node.js convention of providing a single\ncallback as the last argument of your async function.\n\n\n## Quick Examples\n\n```javascript\nasync.map(['file1','file2','file3'], fs.stat, function(err, results){\n // results is now an array of stats for each file\n});\n\nasync.filter(['file1','file2','file3'], fs.exists, function(results){\n // results now equals an array of the existing files\n});\n\nasync.parallel([\n function(){ ... },\n function(){ ... }\n], callback);\n\nasync.series([\n function(){ ... },\n function(){ ... }\n]);\n```\n\nThere are many more functions available so take a look at the docs below for a\nfull list. This module aims to be comprehensive, so if you feel anything is\nmissing please create a GitHub issue for it.\n\n## Common Pitfalls\n\n### Binding a context to an iterator\n\nThis section is really about bind, not about async. If you are wondering how to\nmake async execute your iterators in a given context, or are confused as to why\na method of another library isn't working as an iterator, study this example:\n\n```js\n// Here is a simple object with an (unnecessarily roundabout) squaring method\nvar AsyncSquaringLibrary = {\n squareExponent: 2,\n square: function(number, callback){ \n var result = Math.pow(number, this.squareExponent);\n setTimeout(function(){\n callback(null, result);\n }, 200);\n }\n};\n\nasync.map([1, 2, 3], AsyncSquaringLibrary.square, function(err, result){\n // result is [NaN, NaN, NaN]\n // This fails because the `this.squareExponent` expression in the square\n // function is not evaluated in the context of AsyncSquaringLibrary, and is\n // therefore undefined.\n});\n\nasync.map([1, 2, 3], AsyncSquaringLibrary.square.bind(AsyncSquaringLibrary), function(err, result){\n // result is [1, 4, 9]\n // With the help of bind we can attach a context to the iterator before\n // passing it to async. Now the square function will be executed in its \n // 'home' AsyncSquaringLibrary context and the value of `this.squareExponent`\n // will be as expected.\n});\n```\n\n## Download\n\nThe source is available for download from\n[GitHub](http://github.com/caolan/async).\nAlternatively, you can install using Node Package Manager (npm):\n\n npm install async\n\n__Development:__ [async.js](https://github.com/caolan/async/raw/master/lib/async.js) - 29.6kb Uncompressed\n\n## In the Browser\n\nSo far it's been tested in IE6, IE7, IE8, FF3.6 and Chrome 5. Usage:\n\n```html\n<script type=\"text/javascript\" src=\"async.js\"></script>\n<script type=\"text/javascript\">\n\n async.map(data, asyncProcess, function(err, results){\n alert(results);\n });\n\n</script>\n```\n\n## Documentation\n\n### Collections\n\n* [each](#each)\n* [eachSeries](#eachSeries)\n* [eachLimit](#eachLimit)\n* [map](#map)\n* [mapSeries](#mapSeries)\n* [mapLimit](#mapLimit)\n* [filter](#filter)\n* [filterSeries](#filterSeries)\n* [reject](#reject)\n* [rejectSeries](#rejectSeries)\n* [reduce](#reduce)\n* [reduceRight](#reduceRight)\n* [detect](#detect)\n* [detectSeries](#detectSeries)\n* [sortBy](#sortBy)\n* [some](#some)\n* [every](#every)\n* [concat](#concat)\n* [concatSeries](#concatSeries)\n\n### Control Flow\n\n* [series](#series)\n* [parallel](#parallel)\n* [parallelLimit](#parallellimittasks-limit-callback)\n* [whilst](#whilst)\n* [doWhilst](#doWhilst)\n* [until](#until)\n* [doUntil](#doUntil)\n* [forever](#forever)\n* [waterfall](#waterfall)\n* [compose](#compose)\n* [applyEach](#applyEach)\n* [applyEachSeries](#applyEachSeries)\n* [queue](#queue)\n* [cargo](#cargo)\n* [auto](#auto)\n* [iterator](#iterator)\n* [apply](#apply)\n* [nextTick](#nextTick)\n* [times](#times)\n* [timesSeries](#timesSeries)\n\n### Utils\n\n* [memoize](#memoize)\n* [unmemoize](#unmemoize)\n* [log](#log)\n* [dir](#dir)\n* [noConflict](#noConflict)\n\n\n## Collections\n\n<a name=\"forEach\" />\n<a name=\"each\" />\n### each(arr, iterator, callback)\n\nApplies an iterator function to each item in an array, in parallel.\nThe iterator is called with an item from the list and a callback for when it\nhas finished. If the iterator passes an error to this callback, the main\ncallback for the each function is immediately called with the error.\n\nNote, that since this function applies the iterator to each item in parallel\nthere is no guarantee that the iterator functions will complete in order.\n\n__Arguments__\n\n* arr - An array to iterate over.\n* iterator(item, callback) - A function to apply to each item in the array.\n The iterator is passed a callback(err) which must be called once it has \n completed. If no error has occured, the callback should be run without \n arguments or with an explicit null argument.\n* callback(err) - A callback which is called after all the iterator functions\n have finished, or an error has occurred.\n\n__Example__\n\n```js\n// assuming openFiles is an array of file names and saveFile is a function\n// to save the modified contents of that file:\n\nasync.each(openFiles, saveFile, function(err){\n // if any of the saves produced an error, err would equal that error\n});\n```\n\n---------------------------------------\n\n<a name=\"forEachSeries\" />\n<a name=\"eachSeries\" />\n### eachSeries(arr, iterator, callback)\n\nThe same as each only the iterator is applied to each item in the array in\nseries. The next iterator is only called once the current one has completed\nprocessing. This means the iterator functions will complete in order.\n\n\n---------------------------------------\n\n<a name=\"forEachLimit\" />\n<a name=\"eachLimit\" />\n### eachLimit(arr, limit, iterator, callback)\n\nThe same as each only no more than \"limit\" iterators will be simultaneously \nrunning at any time.\n\nNote that the items are not processed in batches, so there is no guarantee that\n the first \"limit\" iterator functions will complete before any others are \nstarted.\n\n__Arguments__\n\n* arr - An array to iterate over.\n* limit - The maximum number of iterators to run at any time.\n* iterator(item, callback) - A function to apply to each item in the array.\n The iterator is passed a callback(err) which must be called once it has \n completed. If no error has occured, the callback should be run without \n arguments or with an explicit null argument.\n* callback(err) - A callback which is called after all the iterator functions\n have finished, or an error has occurred.\n\n__Example__\n\n```js\n// Assume documents is an array of JSON objects and requestApi is a\n// function that interacts with a rate-limited REST api.\n\nasync.eachLimit(documents, 20, requestApi, function(err){\n // if any of the saves produced an error, err would equal that error\n});\n```\n\n---------------------------------------\n\n<a name=\"map\" />\n### map(arr, iterator, callback)\n\nProduces a new array of values by mapping each value in the given array through\nthe iterator function. The iterator is called with an item from the array and a\ncallback for when it has finished processing. The callback takes 2 arguments, \nan error and the transformed item from the array. If the iterator passes an\nerror to this callback, the main callback for the map function is immediately\ncalled with the error.\n\nNote, that since this function applies the iterator to each item in parallel\nthere is no guarantee that the iterator functions will complete in order, however\nthe results array will be in the same order as the original array.\n\n__Arguments__\n\n* arr - An array to iterate over.\n* iterator(item, callback) - A function to apply to each item in the array.\n The iterator is passed a callback(err, transformed) which must be called once \n it has completed with an error (which can be null) and a transformed item.\n* callback(err, results) - A callback which is called after all the iterator\n functions have finished, or an error has occurred. Results is an array of the\n transformed items from the original array.\n\n__Example__\n\n```js\nasync.map(['file1','file2','file3'], fs.stat, function(err, results){\n // results is now an array of stats for each file\n});\n```\n\n---------------------------------------\n\n<a name=\"mapSeries\" />\n### mapSeries(arr, iterator, callback)\n\nThe same as map only the iterator is applied to each item in the array in\nseries. The next iterator is only called once the current one has completed\nprocessing. The results array will be in the same order as the original.\n\n\n---------------------------------------\n\n<a name=\"mapLimit\" />\n### mapLimit(arr, limit, iterator, callback)\n\nThe same as map only no more than \"limit\" iterators will be simultaneously \nrunning at any time.\n\nNote that the items are not processed in batches, so there is no guarantee that\n the first \"limit\" iterator functions will complete before any others are \nstarted.\n\n__Arguments__\n\n* arr - An array to iterate over.\n* limit - The maximum number of iterators to run at any time.\n* iterator(item, callback) - A function to apply to each item in the array.\n The iterator is passed a callback(err, transformed) which must be called once \n it has completed with an error (which can be null) and a transformed item.\n* callback(err, results) - A callback which is called after all the iterator\n functions have finished, or an error has occurred. Results is an array of the\n transformed items from the original array.\n\n__Example__\n\n```js\nasync.mapLimit(['file1','file2','file3'], 1, fs.stat, function(err, results){\n // results is now an array of stats for each file\n});\n```\n\n---------------------------------------\n\n<a name=\"filter\" />\n### filter(arr, iterator, callback)\n\n__Alias:__ select\n\nReturns a new array of all the values which pass an async truth test.\n_The callback for each iterator call only accepts a single argument of true or\nfalse, it does not accept an error argument first!_ This is in-line with the\nway node libraries work with truth tests like fs.exists. This operation is\nperformed in parallel, but the results array will be in the same order as the\noriginal.\n\n__Arguments__\n\n* arr - An array to iterate over.\n* iterator(item, callback) - A truth test to apply to each item in the array.\n The iterator is passed a callback(truthValue) which must be called with a \n boolean argument once it has completed.\n* callback(results) - A callback which is called after all the iterator\n functions have finished.\n\n__Example__\n\n```js\nasync.filter(['file1','file2','file3'], fs.exists, function(results){\n // results now equals an array of the existing files\n});\n```\n\n---------------------------------------\n\n<a name=\"filterSeries\" />\n### filterSeries(arr, iterator, callback)\n\n__alias:__ selectSeries\n\nThe same as filter only the iterator is applied to each item in the array in\nseries. The next iterator is only called once the current one has completed\nprocessing. The results array will be in the same order as the original.\n\n---------------------------------------\n\n<a name=\"reject\" />\n### reject(arr, iterator, callback)\n\nThe opposite of filter. Removes values that pass an async truth test.\n\n---------------------------------------\n\n<a name=\"rejectSeries\" />\n### rejectSeries(arr, iterator, callback)\n\nThe same as reject, only the iterator is applied to each item in the array\nin series.\n\n\n---------------------------------------\n\n<a name=\"reduce\" />\n### reduce(arr, memo, iterator, callback)\n\n__aliases:__ inject, foldl\n\nReduces a list of values into a single value using an async iterator to return\neach successive step. Memo is the initial state of the reduction. This\nfunction only operates in series. For performance reasons, it may make sense to\nsplit a call to this function into a parallel map, then use the normal\nArray.prototype.reduce on the results. This function is for situations where\neach step in the reduction needs to be async, if you can get the data before\nreducing it then it's probably a good idea to do so.\n\n__Arguments__\n\n* arr - An array to iterate over.\n* memo - The initial state of the reduction.\n* iterator(memo, item, callback) - A function applied to each item in the\n array to produce the next step in the reduction. The iterator is passed a\n callback(err, reduction) which accepts an optional error as its first \n argument, and the state of the reduction as the second. If an error is \n passed to the callback, the reduction is stopped and the main callback is \n immediately called with the error.\n* callback(err, result) - A callback which is called after all the iterator\n functions have finished. Result is the reduced value.\n\n__Example__\n\n```js\nasync.reduce([1,2,3], 0, function(memo, item, callback){\n // pointless async:\n process.nextTick(function(){\n callback(null, memo + item)\n });\n}, function(err, result){\n // result is now equal to the last value of memo, which is 6\n});\n```\n\n---------------------------------------\n\n<a name=\"reduceRight\" />\n### reduceRight(arr, memo, iterator, callback)\n\n__Alias:__ foldr\n\nSame as reduce, only operates on the items in the array in reverse order.\n\n\n---------------------------------------\n\n<a name=\"detect\" />\n### detect(arr, iterator, callback)\n\nReturns the first value in a list that passes an async truth test. The\niterator is applied in parallel, meaning the first iterator to return true will\nfire the detect callback with that result. That means the result might not be\nthe first item in the original array (in terms of order) that passes the test.\n\nIf order within the original array is important then look at detectSeries.\n\n__Arguments__\n\n* arr - An array to iterate over.\n* iterator(item, callback) - A truth test to apply to each item in the array.\n The iterator is passed a callback(truthValue) which must be called with a \n boolean argument once it has completed.\n* callback(result) - A callback which is called as soon as any iterator returns\n true, or after all the iterator functions have finished. Result will be\n the first item in the array that passes the truth test (iterator) or the\n value undefined if none passed.\n\n__Example__\n\n```js\nasync.detect(['file1','file2','file3'], fs.exists, function(result){\n // result now equals the first file in the list that exists\n});\n```\n\n---------------------------------------\n\n<a name=\"detectSeries\" />\n### detectSeries(arr, iterator, callback)\n\nThe same as detect, only the iterator is applied to each item in the array\nin series. This means the result is always the first in the original array (in\nterms of array order) that passes the truth test.\n\n\n---------------------------------------\n\n<a name=\"sortBy\" />\n### sortBy(arr, iterator, callback)\n\nSorts a list by the results of running each value through an async iterator.\n\n__Arguments__\n\n* arr - An array to iterate over.\n* iterator(item, callback) - A function to apply to each item in the array.\n The iterator is passed a callback(err, sortValue) which must be called once it\n has completed with an error (which can be null) and a value to use as the sort\n criteria.\n* callback(err, results) - A callback which is called after all the iterator\n functions have finished, or an error has occurred. Results is the items from\n the original array sorted by the values returned by the iterator calls.\n\n__Example__\n\n```js\nasync.sortBy(['file1','file2','file3'], function(file, callback){\n fs.stat(file, function(err, stats){\n callback(err, stats.mtime);\n });\n}, function(err, results){\n // results is now the original array of files sorted by\n // modified date\n});\n```\n\n---------------------------------------\n\n<a name=\"some\" />\n### some(arr, iterator, callback)\n\n__Alias:__ any\n\nReturns true if at least one element in the array satisfies an async test.\n_The callback for each iterator call only accepts a single argument of true or\nfalse, it does not accept an error argument first!_ This is in-line with the\nway node libraries work with truth tests like fs.exists. Once any iterator\ncall returns true, the main callback is immediately called.\n\n__Arguments__\n\n* arr - An array to iterate over.\n* iterator(item, callback) - A truth test to apply to each item in the array.\n The iterator is passed a callback(truthValue) which must be called with a \n boolean argument once it has completed.\n* callback(result) - A callback which is called as soon as any iterator returns\n true, or after all the iterator functions have finished. Result will be\n either true or false depending on the values of the async tests.\n\n__Example__\n\n```js\nasync.some(['file1','file2','file3'], fs.exists, function(result){\n // if result is true then at least one of the files exists\n});\n```\n\n---------------------------------------\n\n<a name=\"every\" />\n### every(arr, iterator, callback)\n\n__Alias:__ all\n\nReturns true if every element in the array satisfies an async test.\n_The callback for each iterator call only accepts a single argument of true or\nfalse, it does not accept an error argument first!_ This is in-line with the\nway node libraries work with truth tests like fs.exists.\n\n__Arguments__\n\n* arr - An array to iterate over.\n* iterator(item, callback) - A truth test to apply to each item in the array.\n The iterator is passed a callback(truthValue) which must be called with a \n boolean argument once it has completed.\n* callback(result) - A callback which is called after all the iterator\n functions have finished. Result will be either true or false depending on\n the values of the async tests.\n\n__Example__\n\n```js\nasync.every(['file1','file2','file3'], fs.exists, function(result){\n // if result is true then every file exists\n});\n```\n\n---------------------------------------\n\n<a name=\"concat\" />\n### concat(arr, iterator, callback)\n\nApplies an iterator to each item in a list, concatenating the results. Returns the\nconcatenated list. The iterators are called in parallel, and the results are\nconcatenated as they return. There is no guarantee that the results array will\nbe returned in the original order of the arguments passed to the iterator function.\n\n__Arguments__\n\n* arr - An array to iterate over\n* iterator(item, callback) - A function to apply to each item in the array.\n The iterator is passed a callback(err, results) which must be called once it \n has completed with an error (which can be null) and an array of results.\n* callback(err, results) - A callback which is called after all the iterator\n functions have finished, or an error has occurred. Results is an array containing\n the concatenated results of the iterator function.\n\n__Example__\n\n```js\nasync.concat(['dir1','dir2','dir3'], fs.readdir, function(err, files){\n // files is now a list of filenames that exist in the 3 directories\n});\n```\n\n---------------------------------------\n\n<a name=\"concatSeries\" />\n### concatSeries(arr, iterator, callback)\n\nSame as async.concat, but executes in series instead of parallel.\n\n\n## Control Flow\n\n<a name=\"series\" />\n### series(tasks, [callback])\n\nRun an array of functions in series, each one running once the previous\nfunction has completed. If any functions in the series pass an error to its\ncallback, no more functions are run and the callback for the series is\nimmediately called with the value of the error. Once the tasks have completed,\nthe results are passed to the final callback as an array.\n\nIt is also possible to use an object instead of an array. Each property will be\nrun as a function and the results will be passed to the final callback as an object\ninstead of an array. This can be a more readable way of handling results from\nasync.series.\n\n\n__Arguments__\n\n* tasks - An array or object containing functions to run, each function is passed\n a callback(err, result) it must call on completion with an error (which can\n be null) and an optional result value.\n* callback(err, results) - An optional callback to run once all the functions\n have completed. This function gets a results array (or object) containing all \n the result arguments passed to the task callbacks.\n\n__Example__\n\n```js\nasync.series([\n function(callback){\n // do some stuff ...\n callback(null, 'one');\n },\n function(callback){\n // do some more stuff ...\n callback(null, 'two');\n }\n],\n// optional callback\nfunction(err, results){\n // results is now equal to ['one', 'two']\n});\n\n\n// an example using an object instead of an array\nasync.series({\n one: function(callback){\n setTimeout(function(){\n callback(null, 1);\n }, 200);\n },\n two: function(callback){\n setTimeout(function(){\n callback(null, 2);\n }, 100);\n }\n},\nfunction(err, results) {\n // results is now equal to: {one: 1, two: 2}\n});\n```\n\n---------------------------------------\n\n<a name=\"parallel\" />\n### parallel(tasks, [callback])\n\nRun an array of functions in parallel, without waiting until the previous\nfunction has completed. If any of the functions pass an error to its\ncallback, the main callback is immediately called with the value of the error.\nOnce the tasks have completed, the results are passed to the final callback as an\narray.\n\nIt is also possible to use an object instead of an array. Each property will be\nrun as a function and the results will be passed to the final callback as an object\ninstead of an array. This can be a more readable way of handling results from\nasync.parallel.\n\n\n__Arguments__\n\n* tasks - An array or object containing functions to run, each function is passed \n a callback(err, result) it must call on completion with an error (which can\n be null) and an optional result value.\n* callback(err, results) - An optional callback to run once all the functions\n have completed. This function gets a results array (or object) containing all \n the result arguments passed to the task callbacks.\n\n__Example__\n\n```js\nasync.parallel([\n function(callback){\n setTimeout(function(){\n callback(null, 'one');\n }, 200);\n },\n function(callback){\n setTimeout(function(){\n callback(null, 'two');\n }, 100);\n }\n],\n// optional callback\nfunction(err, results){\n // the results array will equal ['one','two'] even though\n // the second function had a shorter timeout.\n});\n\n\n// an example using an object instead of an array\nasync.parallel({\n one: function(callback){\n setTimeout(function(){\n callback(null, 1);\n }, 200);\n },\n two: function(callback){\n setTimeout(function(){\n callback(null, 2);\n }, 100);\n }\n},\nfunction(err, results) {\n // results is now equals to: {one: 1, two: 2}\n});\n```\n\n---------------------------------------\n\n<a name=\"parallel\" />\n### parallelLimit(tasks, limit, [callback])\n\nThe same as parallel only the tasks are executed in parallel with a maximum of \"limit\" \ntasks executing at any time.\n\nNote that the tasks are not executed in batches, so there is no guarantee that \nthe first \"limit\" tasks will complete before any others are started.\n\n__Arguments__\n\n* tasks - An array or object containing functions to run, each function is passed \n a callback(err, result) it must call on completion with an error (which can\n be null) and an optional result value.\n* limit - The maximum number of tasks to run at any time.\n* callback(err, results) - An optional callback to run once all the functions\n have completed. This function gets a results array (or object) containing all \n the result arguments passed to the task callbacks.\n\n---------------------------------------\n\n<a name=\"whilst\" />\n### whilst(test, fn, callback)\n\nRepeatedly call fn, while test returns true. Calls the callback when stopped,\nor an error occurs.\n\n__Arguments__\n\n* test() - synchronous truth test to perform before each execution of fn.\n* fn(callback) - A function to call each time the test passes. The function is\n passed a callback(err) which must be called once it has completed with an \n optional error argument.\n* callback(err) - A callback which is called after the test fails and repeated\n execution of fn has stopped.\n\n__Example__\n\n```js\nvar count = 0;\n\nasync.whilst(\n function () { return count < 5; },\n function (callback) {\n count++;\n setTimeout(callback, 1000);\n },\n function (err) {\n // 5 seconds have passed\n }\n);\n```\n\n---------------------------------------\n\n<a name=\"doWhilst\" />\n### doWhilst(fn, test, callback)\n\nThe post check version of whilst. To reflect the difference in the order of operations `test` and `fn` arguments are switched. `doWhilst` is to `whilst` as `do while` is to `while` in plain JavaScript.\n\n---------------------------------------\n\n<a name=\"until\" />\n### until(test, fn, callback)\n\nRepeatedly call fn, until test returns true. Calls the callback when stopped,\nor an error occurs.\n\nThe inverse of async.whilst.\n\n---------------------------------------\n\n<a name=\"doUntil\" />\n### doUntil(fn, test, callback)\n\nLike doWhilst except the test is inverted. Note the argument ordering differs from `until`.\n\n---------------------------------------\n\n<a name=\"forever\" />\n### forever(fn, callback)\n\nCalls the asynchronous function 'fn' repeatedly, in series, indefinitely.\nIf an error is passed to fn's callback then 'callback' is called with the\nerror, otherwise it will never be called.\n\n---------------------------------------\n\n<a name=\"waterfall\" />\n### waterfall(tasks, [callback])\n\nRuns an array of functions in series, each passing their results to the next in\nthe array. However, if any of the functions pass an error to the callback, the\nnext function is not executed and the main callback is immediately called with\nthe error.\n\n__Arguments__\n\n* tasks - An array of functions to run, each function is passed a \n callback(err, result1, result2, ...) it must call on completion. The first\n argument is an error (which can be null) and any further arguments will be \n passed as arguments in order to the next task.\n* callback(err, [results]) - An optional callback to run once all the functions\n have completed. This will be passed the results of the last task's callback.\n\n\n\n__Example__\n\n```js\nasync.waterfall([\n function(callback){\n callback(null, 'one', 'two');\n },\n function(arg1, arg2, callback){\n callback(null, 'three');\n },\n function(arg1, callback){\n // arg1 now equals 'three'\n callback(null, 'done');\n }\n], function (err, result) {\n // result now equals 'done' \n});\n```\n\n---------------------------------------\n<a name=\"compose\" />\n### compose(fn1, fn2...)\n\nCreates a function which is a composition of the passed asynchronous\nfunctions. Each function consumes the return value of the function that\nfollows. Composing functions f(), g() and h() would produce the result of\nf(g(h())), only this version uses callbacks to obtain the return values.\n\nEach function is executed with the `this` binding of the composed function.\n\n__Arguments__\n\n* functions... - the asynchronous functions to compose\n\n\n__Example__\n\n```js\nfunction add1(n, callback) {\n setTimeout(function () {\n callback(null, n + 1);\n }, 10);\n}\n\nfunction mul3(n, callback) {\n setTimeout(function () {\n callback(null, n * 3);\n }, 10);\n}\n\nvar add1mul3 = async.compose(mul3, add1);\n\nadd1mul3(4, function (err, result) {\n // result now equals 15\n});\n```\n\n---------------------------------------\n<a name=\"applyEach\" />\n### applyEach(fns, args..., callback)\n\nApplies the provided arguments to each function in the array, calling the\ncallback after all functions have completed. If you only provide the first\nargument then it will return a function which lets you pass in the\narguments as if it were a single function call.\n\n__Arguments__\n\n* fns - the asynchronous functions to all call with the same arguments\n* args... - any number of separate arguments to pass to the function\n* callback - the final argument should be the callback, called when all\n functions have completed processing\n\n\n__Example__\n\n```js\nasync.applyEach([enableSearch, updateSchema], 'bucket', callback);\n\n// partial application example:\nasync.each(\n buckets,\n async.applyEach([enableSearch, updateSchema]),\n callback\n);\n```\n\n---------------------------------------\n\n<a name=\"applyEachSeries\" />\n### applyEachSeries(arr, iterator, callback)\n\nThe same as applyEach only the functions are applied in series.\n\n---------------------------------------\n\n<a name=\"queue\" />\n### queue(worker, concurrency)\n\nCreates a queue object with the specified concurrency. Tasks added to the\nqueue will be processed in parallel (up to the concurrency limit). If all\nworkers are in progress, the task is queued until one is available. Once\na worker has completed a task, the task's callback is called.\n\n__Arguments__\n\n* worker(task, callback) - An asynchronous function for processing a queued\n task, which must call its callback(err) argument when finished, with an \n optional error as an argument.\n* concurrency - An integer for determining how many worker functions should be\n run in parallel.\n\n__Queue objects__\n\nThe queue object returned by this function has the following properties and\nmethods:\n\n* length() - a function returning the number of items waiting to be processed.\n* concurrency - an integer for determining how many worker functions should be\n run in parallel. This property can be changed after a queue is created to\n alter the concurrency on-the-fly.\n* push(task, [callback]) - add a new task to the queue, the callback is called\n once the worker has finished processing the task.\n instead of a single task, an array of tasks can be submitted. the respective callback is used for every task in the list.\n* unshift(task, [callback]) - add a new task to the front of the queue.\n* saturated - a callback that is called when the queue length hits the concurrency and further tasks will be queued\n* empty - a callback that is called when the last item from the queue is given to a worker\n* drain - a callback that is called when the last item from the queue has returned from the worker\n\n__Example__\n\n```js\n// create a queue object with concurrency 2\n\nvar q = async.queue(function (task, callback) {\n console.log('hello ' + task.name);\n callback();\n}, 2);\n\n\n// assign a callback\nq.drain = function() {\n console.log('all items have been processed');\n}\n\n// add some items to the queue\n\nq.push({name: 'foo'}, function (err) {\n console.log('finished processing foo');\n});\nq.push({name: 'bar'}, function (err) {\n console.log('finished processing bar');\n});\n\n// add some items to the queue (batch-wise)\n\nq.push([{name: 'baz'},{name: 'bay'},{name: 'bax'}], function (err) {\n console.log('finished processing bar');\n});\n\n// add some items to the front of the queue\n\nq.unshift({name: 'bar'}, function (err) {\n console.log('finished processing bar');\n});\n```\n\n---------------------------------------\n\n<a name=\"cargo\" />\n### cargo(worker, [payload])\n\nCreates a cargo object with the specified payload. Tasks added to the\ncargo will be processed altogether (up to the payload limit). If the\nworker is in progress, the task is queued until it is available. Once\nthe worker has completed some tasks, each callback of those tasks is called.\n\n__Arguments__\n\n* worker(tasks, callback) - An asynchronous function for processing an array of\n queued tasks, which must call its callback(err) argument when finished, with \n an optional error as an argument.\n* payload - An optional integer for determining how many tasks should be\n processed per round; if omitted, the default is unlimited.\n\n__Cargo objects__\n\nThe cargo object returned by this function has the following properties and\nmethods:\n\n* length() - a function returning the number of items waiting to be processed.\n* payload - an integer for determining how many tasks should be\n process per round. This property can be changed after a cargo is created to\n alter the payload on-the-fly.\n* push(task, [callback]) - add a new task to the queue, the callback is called\n once the worker has finished processing the task.\n instead of a single task, an array of tasks can be submitted. the respective callback is used for every task in the list.\n* saturated - a callback that is called when the queue length hits the concurrency and further tasks will be queued\n* empty - a callback that is called when the last item from the queue is given to a worker\n* drain - a callback that is called when the last item from the queue has returned from the worker\n\n__Example__\n\n```js\n// create a cargo object with payload 2\n\nvar cargo = async.cargo(function (tasks, callback) {\n for(var i=0; i<tasks.length; i++){\n console.log('hello ' + tasks[i].name);\n }\n callback();\n}, 2);\n\n\n// add some items\n\ncargo.push({name: 'foo'}, function (err) {\n console.log('finished processing foo');\n});\ncargo.push({name: 'bar'}, function (err) {\n console.log('finished processing bar');\n});\ncargo.push({name: 'baz'}, function (err) {\n console.log('finished processing baz');\n});\n```\n\n---------------------------------------\n\n<a name=\"auto\" />\n### auto(tasks, [callback])\n\nDetermines the best order for running functions based on their requirements.\nEach function can optionally depend on other functions being completed first,\nand each function is run as soon as its requirements are satisfied. If any of\nthe functions pass an error to their callback, that function will not complete\n(so any other functions depending on it will not run) and the main callback\nwill be called immediately with the error. Functions also receive an object\ncontaining the results of functions which have completed so far.\n\nNote, all functions are called with a results object as a second argument, \nso it is unsafe to pass functions in the tasks object which cannot handle the\nextra argument. For example, this snippet of code:\n\n```js\nasync.auto({\n readData: async.apply(fs.readFile, 'data.txt', 'utf-8')\n}, callback);\n```\n\nwill have the effect of calling readFile with the results object as the last\nargument, which will fail:\n\n```js\nfs.readFile('data.txt', 'utf-8', cb, {});\n```\n\nInstead, wrap the call to readFile in a function which does not forward the \nresults object:\n\n```js\nasync.auto({\n readData: function(cb, results){\n fs.readFile('data.txt', 'utf-8', cb);\n }\n}, callback);\n```\n\n__Arguments__\n\n* tasks - An object literal containing named functions or an array of\n requirements, with the function itself the last item in the array. The key\n used for each function or array is used when specifying requirements. The \n function receives two arguments: (1) a callback(err, result) which must be \n called when finished, passing an error (which can be null) and the result of \n the function's execution, and (2) a results object, containing the results of\n the previously executed functions.\n* callback(err, results) - An optional callback which is called when all the\n tasks have been completed. The callback will receive an error as an argument\n if any tasks pass an error to their callback. Results will always be passed\n\tbut if an error occurred, no other tasks will be performed, and the results\n\tobject will only contain partial results.\n \n\n__Example__\n\n```js\nasync.auto({\n get_data: function(callback){\n // async code to get some data\n },\n make_folder: function(callback){\n // async code to create a directory to store a file in\n // this is run at the same time as getting the data\n },\n write_file: ['get_data', 'make_folder', function(callback){\n // once there is some data and the directory exists,\n // write the data to a file in the directory\n callback(null, filename);\n }],\n email_link: ['write_file', function(callback, results){\n // once the file is written let's email a link to it...\n // results.write_file contains the filename returned by write_file.\n }]\n});\n```\n\nThis is a fairly trivial example, but to do this using the basic parallel and\nseries functions would look like this:\n\n```js\nasync.parallel([\n function(callback){\n // async code to get some data\n },\n function(callback){\n // async code to create a directory to store a file in\n // this is run at the same time as getting the data\n }\n],\nfunction(err, results){\n async.series([\n function(callback){\n // once there is some data and the directory exists,\n // write the data to a file in the directory\n },\n function(callback){\n // once the file is written let's email a link to it...\n }\n ]);\n});\n```\n\nFor a complicated series of async tasks using the auto function makes adding\nnew tasks much easier and makes the code more readable.\n\n\n---------------------------------------\n\n<a name=\"iterator\" />\n### iterator(tasks)\n\nCreates an iterator function which calls the next function in the array,\nreturning a continuation to call the next one after that. It's also possible to\n'peek' the next iterator by doing iterator.next().\n\nThis function is used internally by the async module but can be useful when\nyou want to manually control the flow of functions in series.\n\n__Arguments__\n\n* tasks - An array of functions to run.\n\n__Example__\n\n```js\nvar iterator = async.iterator([\n function(){ sys.p('one'); },\n function(){ sys.p('two'); },\n function(){ sys.p('three'); }\n]);\n\nnode> var iterator2 = iterator();\n'one'\nnode> var iterator3 = iterator2();\n'two'\nnode> iterator3();\n'three'\nnode> var nextfn = iterator2.next();\nnode> nextfn();\n'three'\n```\n\n---------------------------------------\n\n<a name=\"apply\" />\n### apply(function, arguments..)\n\nCreates a continuation function with some arguments already applied, a useful\nshorthand when combined with other control flow functions. Any arguments\npassed to the returned function are added to the arguments originally passed\nto apply.\n\n__Arguments__\n\n* function - The function you want to eventually apply all arguments to.\n* arguments... - Any number of arguments to automatically apply when the\n continuation is called.\n\n__Example__\n\n```js\n// using apply\n\nasync.parallel([\n async.apply(fs.writeFile, 'testfile1', 'test1'),\n async.apply(fs.writeFile, 'testfile2', 'test2'),\n]);\n\n\n// the same process without using apply\n\nasync.parallel([\n function(callback){\n fs.writeFile('testfile1', 'test1', callback);\n },\n function(callback){\n fs.writeFile('testfile2', 'test2', callback);\n }\n]);\n```\n\nIt's possible to pass any number of additional arguments when calling the\ncontinuation:\n\n```js\nnode> var fn = async.apply(sys.puts, 'one');\nnode> fn('two', 'three');\none\ntwo\nthree\n```\n\n---------------------------------------\n\n<a name=\"nextTick\" />\n### nextTick(callback)\n\nCalls the callback on a later loop around the event loop. In node.js this just\ncalls process.nextTick, in the browser it falls back to setImmediate(callback)\nif available, otherwise setTimeout(callback, 0), which means other higher priority\nevents may precede the execution of the callback.\n\nThis is used internally for browser-compatibility purposes.\n\n__Arguments__\n\n* callback - The function to call on a later loop around the event loop.\n\n__Example__\n\n```js\nvar call_order = [];\nasync.nextTick(function(){\n call_order.push('two');\n // call_order now equals ['one','two']\n});\ncall_order.push('one')\n```\n\n<a name=\"times\" />\n### times(n, callback)\n\nCalls the callback n times and accumulates results in the same manner\nyou would use with async.map.\n\n__Arguments__\n\n* n - The number of times to run the function.\n* callback - The function to call n times.\n\n__Example__\n\n```js\n// Pretend this is some complicated async factory\nvar createUser = function(id, callback) {\n callback(null, {\n id: 'user' + id\n })\n}\n// generate 5 users\nasync.times(5, function(n, next){\n createUser(n, function(err, user) {\n next(err, user)\n })\n}, function(err, users) {\n // we should now have 5 users\n});\n```\n\n<a name=\"timesSeries\" />\n### timesSeries(n, callback)\n\nThe same as times only the iterator is applied to each item in the array in\nseries. The next iterator is only called once the current one has completed\nprocessing. The results array will be in the same order as the original.\n\n\n## Utils\n\n<a name=\"memoize\" />\n### memoize(fn, [hasher])\n\nCaches the results of an async function. When creating a hash to store function\nresults against, the callback is omitted from the hash and an optional hash\nfunction can be used.\n\nThe cache of results is exposed as the `memo` property of the function returned\nby `memoize`.\n\n__Arguments__\n\n* fn - the function you to proxy and cache results from.\n* hasher - an optional function for generating a custom hash for storing\n results, it has all the arguments applied to it apart from the callback, and\n must be synchronous.\n\n__Example__\n\n```js\nvar slow_fn = function (name, callback) {\n // do something\n callback(null, result);\n};\nvar fn = async.memoize(slow_fn);\n\n// fn can now be used as if it were slow_fn\nfn('some name', function () {\n // callback\n});\n```\n\n<a name=\"unmemoize\" />\n### unmemoize(fn)\n\nUndoes a memoized function, reverting it to the original, unmemoized\nform. Comes handy in tests.\n\n__Arguments__\n\n* fn - the memoized function\n\n<a name=\"log\" />\n### log(function, arguments)\n\nLogs the result of an async function to the console. Only works in node.js or\nin browsers that support console.log and console.error (such as FF and Chrome).\nIf multiple arguments are returned from the async function, console.log is\ncalled on each argument in order.\n\n__Arguments__\n\n* function - The function you want to eventually apply all arguments to.\n* arguments... - Any number of arguments to apply to the function.\n\n__Example__\n\n```js\nvar hello = function(name, callback){\n setTimeout(function(){\n callback(null, 'hello ' + name);\n }, 1000);\n};\n```\n```js\nnode> async.log(hello, 'world');\n'hello world'\n```\n\n---------------------------------------\n\n<a name=\"dir\" />\n### dir(function, arguments)\n\nLogs the result of an async function to the console using console.dir to\ndisplay the properties of the resulting object. Only works in node.js or\nin browsers that support console.dir and console.error (such as FF and Chrome).\nIf multiple arguments are returned from the async function, console.dir is\ncalled on each argument in order.\n\n__Arguments__\n\n* function - The function you want to eventually apply all arguments to.\n* arguments... - Any number of arguments to apply to the function.\n\n__Example__\n\n```js\nvar hello = function(name, callback){\n setTimeout(function(){\n callback(null, {hello: name});\n }, 1000);\n};\n```\n```js\nnode> async.dir(hello, 'world');\n{hello: 'world'}\n```\n\n---------------------------------------\n\n<a name=\"noConflict\" />\n### noConflict()\n\nChanges the value of async back to its original value, returning a reference to the\nasync object.\n", - "readmeFilename": "README.md", - "homepage": "https://github.com/caolan/async", - "_id": "async@0.2.10", - "_from": "async@~0.2.6" -} diff --git a/node_modules/boomlet/node_modules/uglify-js/node_modules/uglify-to-browserify/.npmignore b/node_modules/boomlet/node_modules/uglify-js/node_modules/uglify-to-browserify/.npmignore deleted file mode 100644 index 66d015b..0000000 --- a/node_modules/boomlet/node_modules/uglify-js/node_modules/uglify-to-browserify/.npmignore +++ /dev/null @@ -1,14 +0,0 @@ -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/boomlet/node_modules/uglify-js/node_modules/uglify-to-browserify/.travis.yml b/node_modules/boomlet/node_modules/uglify-js/node_modules/uglify-to-browserify/.travis.yml deleted file mode 100644 index 9a61f6b..0000000 --- a/node_modules/boomlet/node_modules/uglify-js/node_modules/uglify-to-browserify/.travis.yml +++ /dev/null @@ -1,3 +0,0 @@ -language: node_js
-node_js:
- - "0.10"
\ No newline at end of file diff --git a/node_modules/boomlet/node_modules/uglify-js/node_modules/uglify-to-browserify/LICENSE b/node_modules/boomlet/node_modules/uglify-js/node_modules/uglify-to-browserify/LICENSE deleted file mode 100644 index dfb0b19..0000000 --- a/node_modules/boomlet/node_modules/uglify-js/node_modules/uglify-to-browserify/LICENSE +++ /dev/null @@ -1,19 +0,0 @@ -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/boomlet/node_modules/uglify-js/node_modules/uglify-to-browserify/README.md b/node_modules/boomlet/node_modules/uglify-js/node_modules/uglify-to-browserify/README.md deleted file mode 100644 index 99685da..0000000 --- a/node_modules/boomlet/node_modules/uglify-js/node_modules/uglify-to-browserify/README.md +++ /dev/null @@ -1,15 +0,0 @@ -# uglify-to-browserify
-
-A transform to make UglifyJS work in browserify.
-
-[](https://travis-ci.org/ForbesLindesay/uglify-to-browserify)
-[](https://gemnasium.com/ForbesLindesay/uglify-to-browserify)
-[](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/boomlet/node_modules/uglify-js/node_modules/uglify-to-browserify/index.js b/node_modules/boomlet/node_modules/uglify-js/node_modules/uglify-to-browserify/index.js deleted file mode 100644 index 2cea629..0000000 --- a/node_modules/boomlet/node_modules/uglify-js/node_modules/uglify-to-browserify/index.js +++ /dev/null @@ -1,49 +0,0 @@ -'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/boomlet/node_modules/uglify-js/node_modules/uglify-to-browserify/package.json b/node_modules/boomlet/node_modules/uglify-js/node_modules/uglify-to-browserify/package.json deleted file mode 100644 index ec912de..0000000 --- a/node_modules/boomlet/node_modules/uglify-js/node_modules/uglify-to-browserify/package.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "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": { - "name": "ForbesLindesay" - }, - "license": "MIT", - "readme": "# uglify-to-browserify\r\n\r\nA transform to make UglifyJS work in browserify.\r\n\r\n[](https://travis-ci.org/ForbesLindesay/uglify-to-browserify)\r\n[](https://gemnasium.com/ForbesLindesay/uglify-to-browserify)\r\n[](http://badge.fury.io/js/uglify-to-browserify)\r\n\r\n## Installation\r\n\r\n npm install uglify-to-browserify\r\n\r\n## License\r\n\r\n MIT", - "readmeFilename": "README.md", - "bugs": { - "url": "https://github.com/ForbesLindesay/uglify-to-browserify/issues" - }, - "homepage": "https://github.com/ForbesLindesay/uglify-to-browserify", - "_id": "uglify-to-browserify@1.0.2", - "dist": { - "shasum": "bf264296a0f0933b15387efe9aca92fa856abb02" - }, - "_from": "uglify-to-browserify@~1.0.0", - "_resolved": "https://registry.npmjs.org/uglify-to-browserify/-/uglify-to-browserify-1.0.2.tgz" -} diff --git a/node_modules/boomlet/node_modules/uglify-js/node_modules/uglify-to-browserify/test/index.js b/node_modules/boomlet/node_modules/uglify-js/node_modules/uglify-to-browserify/test/index.js deleted file mode 100644 index 4117894..0000000 --- a/node_modules/boomlet/node_modules/uglify-js/node_modules/uglify-to-browserify/test/index.js +++ /dev/null @@ -1,22 +0,0 @@ -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 diff --git a/node_modules/boomlet/node_modules/uglify-js/package.json b/node_modules/boomlet/node_modules/uglify-js/package.json deleted file mode 100644 index 7f642d6..0000000 --- a/node_modules/boomlet/node_modules/uglify-js/package.json +++ /dev/null @@ -1,49 +0,0 @@ -{ - "name": "uglify-js", - "description": "JavaScript parser, mangler/compressor and beautifier toolkit", - "homepage": "http://lisperator.net/uglifyjs", - "main": "tools/node.js", - "version": "2.4.13", - "engines": { - "node": ">=0.4.0" - }, - "maintainers": [ - { - "name": "Mihai Bazon", - "email": "mihai.bazon@gmail.com", - "url": "http://lisperator.net/" - } - ], - "repository": { - "type": "git", - "url": "https://github.com/mishoo/UglifyJS2.git" - }, - "dependencies": { - "async": "~0.2.6", - "source-map": "~0.1.33", - "optimist": "~0.3.5", - "uglify-to-browserify": "~1.0.0" - }, - "browserify": { - "transform": [ - "uglify-to-browserify" - ] - }, - "bin": { - "uglifyjs": "bin/uglifyjs" - }, - "scripts": { - "test": "node test/run-tests.js" - }, - "readme": "UglifyJS 2\n==========\n[](https://travis-ci.org/mishoo/UglifyJS2)\n\nUglifyJS is a JavaScript parser, minifier, compressor or beautifier toolkit.\n\nThis page documents the command line utility. For\n[API and internals documentation see my website](http://lisperator.net/uglifyjs/).\nThere's also an\n[in-browser online demo](http://lisperator.net/uglifyjs/#demo) (for Firefox,\nChrome and probably Safari).\n\nInstall\n-------\n\nFirst make sure you have installed the latest version of [node.js](http://nodejs.org/)\n(You may need to restart your computer after this step).\n\nFrom NPM for use as a command line app:\n\n npm install uglify-js -g\n\nFrom NPM for programmatic use:\n\n npm install uglify-js\n\nFrom Git:\n\n git clone git://github.com/mishoo/UglifyJS2.git\n cd UglifyJS2\n npm link .\n\nUsage\n-----\n\n uglifyjs [input files] [options]\n\nUglifyJS2 can take multiple input files. It's recommended that you pass the\ninput files first, then pass the options. UglifyJS will parse input files\nin sequence and apply any compression options. The files are parsed in the\nsame global scope, that is, a reference from a file to some\nvariable/function declared in another file will be matched properly.\n\nIf you want to read from STDIN instead, pass a single dash instead of input\nfiles.\n\nThe available options are:\n\n```\n --source-map Specify an output file where to generate source map.\n [string]\n --source-map-root The path to the original source to be included in the\n source map. [string]\n --source-map-url The path to the source map to be added in //#\n sourceMappingURL. Defaults to the value passed with\n --source-map. [string]\n --source-map-include-sources\n Pass this flag if you want to include the content of\n source files in the source map as sourcesContent\n property. [boolean]\n --in-source-map Input source map, useful if you're compressing JS that was\n generated from some other original code.\n --screw-ie8 Pass this flag if you don't care about full compliance\n with Internet Explorer 6-8 quirks (by default UglifyJS\n will try to be IE-proof). [boolean]\n --expr Parse a single expression, rather than a program (for\n parsing JSON) [boolean]\n -p, --prefix Skip prefix for original filenames that appear in source\n maps. For example -p 3 will drop 3 directories from file\n names and ensure they are relative paths. You can also\n specify -p relative, which will make UglifyJS figure out\n itself the relative paths between original sources, the\n source map and the output file. [string]\n -o, --output Output file (default STDOUT).\n -b, --beautify Beautify output/specify output options. [string]\n -m, --mangle Mangle names/pass mangler options. [string]\n -r, --reserved Reserved names to exclude from mangling.\n -c, --compress Enable compressor/pass compressor options. Pass options\n like -c hoist_vars=false,if_return=false. Use -c with no\n argument to use the default compression options. [string]\n -d, --define Global definitions [string]\n -e, --enclose Embed everything in a big function, with a configurable\n parameter/argument list. [string]\n --comments Preserve copyright comments in the output. By default this\n works like Google Closure, keeping JSDoc-style comments\n that contain \"@license\" or \"@preserve\". You can optionally\n pass one of the following arguments to this flag:\n - \"all\" to keep all comments\n - a valid JS regexp (needs to start with a slash) to keep\n only comments that match.\n Note that currently not *all* comments can be kept when\n compression is on, because of dead code removal or\n cascading statements into sequences. [string]\n --preamble Preamble to prepend to the output. You can use this to\n insert a comment, for example for licensing information.\n This will not be parsed, but the source map will adjust\n for its presence.\n --stats Display operations run time on STDERR. [boolean]\n --acorn Use Acorn for parsing. [boolean]\n --spidermonkey Assume input files are SpiderMonkey AST format (as JSON).\n [boolean]\n --self Build itself (UglifyJS2) as a library (implies\n --wrap=UglifyJS --export-all) [boolean]\n --wrap Embed everything in a big function, making the “exports”\n and “global” variables available. You need to pass an\n argument to this option to specify the name that your\n module will take when included in, say, a browser.\n [string]\n --export-all Only used when --wrap, this tells UglifyJS to add code to\n automatically export all globals. [boolean]\n --lint Display some scope warnings [boolean]\n -v, --verbose Verbose [boolean]\n -V, --version Print version number and exit. [boolean]\n```\n\nSpecify `--output` (`-o`) to declare the output file. Otherwise the output\ngoes to STDOUT.\n\n## Source map options\n\nUglifyJS2 can generate a source map file, which is highly useful for\ndebugging your compressed JavaScript. To get a source map, pass\n`--source-map output.js.map` (full path to the file where you want the\nsource map dumped).\n\nAdditionally you might need `--source-map-root` to pass the URL where the\noriginal files can be found. In case you are passing full paths to input\nfiles to UglifyJS, you can use `--prefix` (`-p`) to specify the number of\ndirectories to drop from the path prefix when declaring files in the source\nmap.\n\nFor example:\n\n uglifyjs /home/doe/work/foo/src/js/file1.js \\\n /home/doe/work/foo/src/js/file2.js \\\n -o foo.min.js \\\n --source-map foo.min.js.map \\\n --source-map-root http://foo.com/src \\\n -p 5 -c -m\n\nThe above will compress and mangle `file1.js` and `file2.js`, will drop the\noutput in `foo.min.js` and the source map in `foo.min.js.map`. The source\nmapping will refer to `http://foo.com/src/js/file1.js` and\n`http://foo.com/src/js/file2.js` (in fact it will list `http://foo.com/src`\nas the source map root, and the original files as `js/file1.js` and\n`js/file2.js`).\n\n### Composed source map\n\nWhen you're compressing JS code that was output by a compiler such as\nCoffeeScript, mapping to the JS code won't be too helpful. Instead, you'd\nlike to map back to the original code (i.e. CoffeeScript). UglifyJS has an\noption to take an input source map. Assuming you have a mapping from\nCoffeeScript → compiled JS, UglifyJS can generate a map from CoffeeScript →\ncompressed JS by mapping every token in the compiled JS to its original\nlocation.\n\nTo use this feature you need to pass `--in-source-map\n/path/to/input/source.map`. Normally the input source map should also point\nto the file containing the generated JS, so if that's correct you can omit\ninput files from the command line.\n\n## Mangler options\n\nTo enable the mangler you need to pass `--mangle` (`-m`). The following\n(comma-separated) options are supported:\n\n- `sort` — to assign shorter names to most frequently used variables. This\n saves a few hundred bytes on jQuery before gzip, but the output is\n _bigger_ after gzip (and seems to happen for other libraries I tried it\n on) therefore it's not enabled by default.\n\n- `toplevel` — mangle names declared in the toplevel scope (disabled by\n default).\n\n- `eval` — mangle names visible in scopes where `eval` or `with` are used\n (disabled by default).\n\nWhen mangling is enabled but you want to prevent certain names from being\nmangled, you can declare those names with `--reserved` (`-r`) — pass a\ncomma-separated list of names. For example:\n\n uglifyjs ... -m -r '$,require,exports'\n\nto prevent the `require`, `exports` and `$` names from being changed.\n\n## Compressor options\n\nYou need to pass `--compress` (`-c`) to enable the compressor. Optionally\nyou can pass a comma-separated list of options. Options are in the form\n`foo=bar`, or just `foo` (the latter implies a boolean option that you want\nto set `true`; it's effectively a shortcut for `foo=true`).\n\n- `sequences` -- join consecutive simple statements using the comma operator\n\n- `properties` -- rewrite property access using the dot notation, for\n example `foo[\"bar\"] → foo.bar`\n\n- `dead_code` -- remove unreachable code\n\n- `drop_debugger` -- remove `debugger;` statements\n\n- `unsafe` (default: false) -- apply \"unsafe\" transformations (discussion below)\n\n- `conditionals` -- apply optimizations for `if`-s and conditional\n expressions\n\n- `comparisons` -- apply certain optimizations to binary nodes, for example:\n `!(a <= b) → a > b` (only when `unsafe`), attempts to negate binary nodes,\n e.g. `a = !b && !c && !d && !e → a=!(b||c||d||e)` etc.\n\n- `evaluate` -- attempt to evaluate constant expressions\n\n- `booleans` -- various optimizations for boolean context, for example `!!a\n ? b : c → a ? b : c`\n\n- `loops` -- optimizations for `do`, `while` and `for` loops when we can\n statically determine the condition\n\n- `unused` -- drop unreferenced functions and variables\n\n- `hoist_funs` -- hoist function declarations\n\n- `hoist_vars` (default: false) -- hoist `var` declarations (this is `false`\n by default because it seems to increase the size of the output in general)\n\n- `if_return` -- optimizations for if/return and if/continue\n\n- `join_vars` -- join consecutive `var` statements\n\n- `cascade` -- small optimization for sequences, transform `x, x` into `x`\n and `x = something(), x` into `x = something()`\n\n- `warnings` -- display warnings when dropping unreachable code or unused\n declarations etc.\n\n- `negate_iife` -- negate \"Immediately-Called Function Expressions\"\n where the return value is discarded, to avoid the parens that the\n code generator would insert.\n\n- `pure_getters` -- the default is `false`. If you pass `true` for\n this, UglifyJS will assume that object property access\n (e.g. `foo.bar` or `foo[\"bar\"]`) doesn't have any side effects.\n\n- `pure_funcs` -- default `null`. You can pass an array of names and\n UglifyJS will assume that those functions do not produce side\n effects. DANGER: will not check if the name is redefined in scope.\n An example case here, for instance `var q = Math.floor(a/b)`. If\n variable `q` is not used elsewhere, UglifyJS will drop it, but will\n still keep the `Math.floor(a/b)`, not knowing what it does. You can\n pass `pure_funcs: [ 'Math.floor' ]` to let it know that this\n function won't produce any side effect, in which case the whole\n statement would get discarded. The current implementation adds some\n overhead (compression will be slower).\n\n- `drop_console` -- default `false`. Pass `true` to discard calls to\n `console.*` functions.\n\n### The `unsafe` option\n\nIt enables some transformations that *might* break code logic in certain\ncontrived cases, but should be fine for most code. You might want to try it\non your own code, it should reduce the minified size. Here's what happens\nwhen this flag is on:\n\n- `new Array(1, 2, 3)` or `Array(1, 2, 3)` → `[1, 2, 3 ]`\n- `new Object()` → `{}`\n- `String(exp)` or `exp.toString()` → `\"\" + exp`\n- `new Object/RegExp/Function/Error/Array (...)` → we discard the `new`\n- `typeof foo == \"undefined\"` → `foo === void 0`\n- `void 0` → `undefined` (if there is a variable named \"undefined\" in\n scope; we do it because the variable name will be mangled, typically\n reduced to a single character).\n\n### Conditional compilation\n\nYou can use the `--define` (`-d`) switch in order to declare global\nvariables that UglifyJS will assume to be constants (unless defined in\nscope). For example if you pass `--define DEBUG=false` then, coupled with\ndead code removal UglifyJS will discard the following from the output:\n```javascript\nif (DEBUG) {\n\tconsole.log(\"debug stuff\");\n}\n```\n\nUglifyJS will warn about the condition being always false and about dropping\nunreachable code; for now there is no option to turn off only this specific\nwarning, you can pass `warnings=false` to turn off *all* warnings.\n\nAnother way of doing that is to declare your globals as constants in a\nseparate file and include it into the build. For example you can have a\n`build/defines.js` file with the following:\n```javascript\nconst DEBUG = false;\nconst PRODUCTION = true;\n// etc.\n```\n\nand build your code like this:\n\n uglifyjs build/defines.js js/foo.js js/bar.js... -c\n\nUglifyJS will notice the constants and, since they cannot be altered, it\nwill evaluate references to them to the value itself and drop unreachable\ncode as usual. The possible downside of this approach is that the build\nwill contain the `const` declarations.\n\n<a name=\"codegen-options\"></a>\n## Beautifier options\n\nThe code generator tries to output shortest code possible by default. In\ncase you want beautified output, pass `--beautify` (`-b`). Optionally you\ncan pass additional arguments that control the code output:\n\n- `beautify` (default `true`) -- whether to actually beautify the output.\n Passing `-b` will set this to true, but you might need to pass `-b` even\n when you want to generate minified code, in order to specify additional\n arguments, so you can use `-b beautify=false` to override it.\n- `indent-level` (default 4)\n- `indent-start` (default 0) -- prefix all lines by that many spaces\n- `quote-keys` (default `false`) -- pass `true` to quote all keys in literal\n objects\n- `space-colon` (default `true`) -- insert a space after the colon signs\n- `ascii-only` (default `false`) -- escape Unicode characters in strings and\n regexps\n- `inline-script` (default `false`) -- escape the slash in occurrences of\n `</script` in strings\n- `width` (default 80) -- only takes effect when beautification is on, this\n specifies an (orientative) line width that the beautifier will try to\n obey. It refers to the width of the line text (excluding indentation).\n It doesn't work very well currently, but it does make the code generated\n by UglifyJS more readable.\n- `max-line-len` (default 32000) -- maximum line length (for uglified code)\n- `bracketize` (default `false`) -- always insert brackets in `if`, `for`,\n `do`, `while` or `with` statements, even if their body is a single\n statement.\n- `semicolons` (default `true`) -- separate statements with semicolons. If\n you pass `false` then whenever possible we will use a newline instead of a\n semicolon, leading to more readable output of uglified code (size before\n gzip could be smaller; size after gzip insignificantly larger).\n- `preamble` (default `null`) -- when passed it must be a string and\n it will be prepended to the output literally. The source map will\n adjust for this text. Can be used to insert a comment containing\n licensing information, for example.\n\n### Keeping copyright notices or other comments\n\nYou can pass `--comments` to retain certain comments in the output. By\ndefault it will keep JSDoc-style comments that contain \"@preserve\",\n\"@license\" or \"@cc_on\" (conditional compilation for IE). You can pass\n`--comments all` to keep all the comments, or a valid JavaScript regexp to\nkeep only comments that match this regexp. For example `--comments\n'/foo|bar/'` will keep only comments that contain \"foo\" or \"bar\".\n\nNote, however, that there might be situations where comments are lost. For\nexample:\n```javascript\nfunction f() {\n\t/** @preserve Foo Bar */\n\tfunction g() {\n\t // this function is never called\n\t}\n\treturn something();\n}\n```\n\nEven though it has \"@preserve\", the comment will be lost because the inner\nfunction `g` (which is the AST node to which the comment is attached to) is\ndiscarded by the compressor as not referenced.\n\nThe safest comments where to place copyright information (or other info that\nneeds to be kept in the output) are comments attached to toplevel nodes.\n\n## Support for the SpiderMonkey AST\n\nUglifyJS2 has its own abstract syntax tree format; for\n[practical reasons](http://lisperator.net/blog/uglifyjs-why-not-switching-to-spidermonkey-ast/)\nwe can't easily change to using the SpiderMonkey AST internally. However,\nUglifyJS now has a converter which can import a SpiderMonkey AST.\n\nFor example [Acorn][acorn] is a super-fast parser that produces a\nSpiderMonkey AST. It has a small CLI utility that parses one file and dumps\nthe AST in JSON on the standard output. To use UglifyJS to mangle and\ncompress that:\n\n acorn file.js | uglifyjs --spidermonkey -m -c\n\nThe `--spidermonkey` option tells UglifyJS that all input files are not\nJavaScript, but JS code described in SpiderMonkey AST in JSON. Therefore we\ndon't use our own parser in this case, but just transform that AST into our\ninternal AST.\n\n### Use Acorn for parsing\n\nMore for fun, I added the `--acorn` option which will use Acorn to do all\nthe parsing. If you pass this option, UglifyJS will `require(\"acorn\")`.\n\nAcorn is really fast (e.g. 250ms instead of 380ms on some 650K code), but\nconverting the SpiderMonkey tree that Acorn produces takes another 150ms so\nin total it's a bit more than just using UglifyJS's own parser.\n\nAPI Reference\n-------------\n\nAssuming installation via NPM, you can load UglifyJS in your application\nlike this:\n```javascript\nvar UglifyJS = require(\"uglify-js\");\n```\n\nIt exports a lot of names, but I'll discuss here the basics that are needed\nfor parsing, mangling and compressing a piece of code. The sequence is (1)\nparse, (2) compress, (3) mangle, (4) generate output code.\n\n### The simple way\n\nThere's a single toplevel function which combines all the steps. If you\ndon't need additional customization, you might want to go with `minify`.\nExample:\n```javascript\nvar result = UglifyJS.minify(\"/path/to/file.js\");\nconsole.log(result.code); // minified output\n// if you need to pass code instead of file name\nvar result = UglifyJS.minify(\"var b = function () {};\", {fromString: true});\n```\n\nYou can also compress multiple files:\n```javascript\nvar result = UglifyJS.minify([ \"file1.js\", \"file2.js\", \"file3.js\" ]);\nconsole.log(result.code);\n```\n\nTo generate a source map:\n```javascript\nvar result = UglifyJS.minify([ \"file1.js\", \"file2.js\", \"file3.js\" ], {\n\toutSourceMap: \"out.js.map\"\n});\nconsole.log(result.code); // minified output\nconsole.log(result.map);\n```\n\nNote that the source map is not saved in a file, it's just returned in\n`result.map`. The value passed for `outSourceMap` is only used to set the\n`file` attribute in the source map (see [the spec][sm-spec]).\n\nYou can also specify sourceRoot property to be included in source map:\n```javascript\nvar result = UglifyJS.minify([ \"file1.js\", \"file2.js\", \"file3.js\" ], {\n\toutSourceMap: \"out.js.map\",\n\tsourceRoot: \"http://example.com/src\"\n});\n```\n\nIf you're compressing compiled JavaScript and have a source map for it, you\ncan use the `inSourceMap` argument:\n```javascript\nvar result = UglifyJS.minify(\"compiled.js\", {\n\tinSourceMap: \"compiled.js.map\",\n\toutSourceMap: \"minified.js.map\"\n});\n// same as before, it returns `code` and `map`\n```\n\nThe `inSourceMap` is only used if you also request `outSourceMap` (it makes\nno sense otherwise).\n\nOther options:\n\n- `warnings` (default `false`) — pass `true` to display compressor warnings.\n\n- `fromString` (default `false`) — if you pass `true` then you can pass\n JavaScript source code, rather than file names.\n\n- `mangle` — pass `false` to skip mangling names.\n\n- `output` (default `null`) — pass an object if you wish to specify\n additional [output options][codegen]. The defaults are optimized\n for best compression.\n\n- `compress` (default `{}`) — pass `false` to skip compressing entirely.\n Pass an object to specify custom [compressor options][compressor].\n\nWe could add more options to `UglifyJS.minify` — if you need additional\nfunctionality please suggest!\n\n### The hard way\n\nFollowing there's more detailed API info, in case the `minify` function is\ntoo simple for your needs.\n\n#### The parser\n```javascript\nvar toplevel_ast = UglifyJS.parse(code, options);\n```\n\n`options` is optional and if present it must be an object. The following\nproperties are available:\n\n- `strict` — disable automatic semicolon insertion and support for trailing\n comma in arrays and objects\n- `filename` — the name of the file where this code is coming from\n- `toplevel` — a `toplevel` node (as returned by a previous invocation of\n `parse`)\n\nThe last two options are useful when you'd like to minify multiple files and\nget a single file as the output and a proper source map. Our CLI tool does\nsomething like this:\n```javascript\nvar toplevel = null;\nfiles.forEach(function(file){\n\tvar code = fs.readFileSync(file, \"utf8\");\n\ttoplevel = UglifyJS.parse(code, {\n\t\tfilename: file,\n\t\ttoplevel: toplevel\n\t});\n});\n```\n\nAfter this, we have in `toplevel` a big AST containing all our files, with\neach token having proper information about where it came from.\n\n#### Scope information\n\nUglifyJS contains a scope analyzer that you need to call manually before\ncompressing or mangling. Basically it augments various nodes in the AST\nwith information about where is a name defined, how many times is a name\nreferenced, if it is a global or not, if a function is using `eval` or the\n`with` statement etc. I will discuss this some place else, for now what's\nimportant to know is that you need to call the following before doing\nanything with the tree:\n```javascript\ntoplevel.figure_out_scope()\n```\n\n#### Compression\n\nLike this:\n```javascript\nvar compressor = UglifyJS.Compressor(options);\nvar compressed_ast = toplevel.transform(compressor);\n```\n\nThe `options` can be missing. Available options are discussed above in\n“Compressor options”. Defaults should lead to best compression in most\nscripts.\n\nThe compressor is destructive, so don't rely that `toplevel` remains the\noriginal tree.\n\n#### Mangling\n\nAfter compression it is a good idea to call again `figure_out_scope` (since\nthe compressor might drop unused variables / unreachable code and this might\nchange the number of identifiers or their position). Optionally, you can\ncall a trick that helps after Gzip (counting character frequency in\nnon-mangleable words). Example:\n```javascript\ncompressed_ast.figure_out_scope();\ncompressed_ast.compute_char_frequency();\ncompressed_ast.mangle_names();\n```\n\n#### Generating output\n\nAST nodes have a `print` method that takes an output stream. Essentially,\nto generate code you do this:\n```javascript\nvar stream = UglifyJS.OutputStream(options);\ncompressed_ast.print(stream);\nvar code = stream.toString(); // this is your minified code\n```\n\nor, for a shortcut you can do:\n```javascript\nvar code = compressed_ast.print_to_string(options);\n```\n\nAs usual, `options` is optional. The output stream accepts a lot of otions,\nmost of them documented above in section “Beautifier options”. The two\nwhich we care about here are `source_map` and `comments`.\n\n#### Keeping comments in the output\n\nIn order to keep certain comments in the output you need to pass the\n`comments` option. Pass a RegExp or a function. If you pass a RegExp, only\nthose comments whose body matches the regexp will be kept. Note that body\nmeans without the initial `//` or `/*`. If you pass a function, it will be\ncalled for every comment in the tree and will receive two arguments: the\nnode that the comment is attached to, and the comment token itself.\n\nThe comment token has these properties:\n\n- `type`: \"comment1\" for single-line comments or \"comment2\" for multi-line\n comments\n- `value`: the comment body\n- `pos` and `endpos`: the start/end positions (zero-based indexes) in the\n original code where this comment appears\n- `line` and `col`: the line and column where this comment appears in the\n original code\n- `file` — the file name of the original file\n- `nlb` — true if there was a newline before this comment in the original\n code, or if this comment contains a newline.\n\nYour function should return `true` to keep the comment, or a falsy value\notherwise.\n\n#### Generating a source mapping\n\nYou need to pass the `source_map` argument when calling `print`. It needs\nto be a `SourceMap` object (which is a thin wrapper on top of the\n[source-map][source-map] library).\n\nExample:\n```javascript\nvar source_map = UglifyJS.SourceMap(source_map_options);\nvar stream = UglifyJS.OutputStream({\n\t...\n\tsource_map: source_map\n});\ncompressed_ast.print(stream);\n\nvar code = stream.toString();\nvar map = source_map.toString(); // json output for your source map\n```\n\nThe `source_map_options` (optional) can contain the following properties:\n\n- `file`: the name of the JavaScript output file that this mapping refers to\n- `root`: the `sourceRoot` property (see the [spec][sm-spec])\n- `orig`: the \"original source map\", handy when you compress generated JS\n and want to map the minified output back to the original code where it\n came from. It can be simply a string in JSON, or a JSON object containing\n the original source map.\n\n [acorn]: https://github.com/marijnh/acorn\n [source-map]: https://github.com/mozilla/source-map\n [sm-spec]: https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit\n [codegen]: http://lisperator.net/uglifyjs/codegen\n [compressor]: http://lisperator.net/uglifyjs/compress\n", - "readmeFilename": "README.md", - "bugs": { - "url": "https://github.com/mishoo/UglifyJS2/issues" - }, - "_id": "uglify-js@2.4.13", - "dist": { - "shasum": "a46b6870e010c2a9e94be719cd9cbcb931052f44" - }, - "_from": "uglify-js@~2.4.0", - "_resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-2.4.13.tgz" -} diff --git a/node_modules/boomlet/node_modules/uglify-js/test/compress/arrays.js b/node_modules/boomlet/node_modules/uglify-js/test/compress/arrays.js deleted file mode 100644 index e636347..0000000 --- a/node_modules/boomlet/node_modules/uglify-js/test/compress/arrays.js +++ /dev/null @@ -1,74 +0,0 @@ -holes_and_undefined: { - input: { - w = [1,,]; - x = [1, 2, undefined]; - y = [1, , 2, ]; - z = [1, undefined, 3]; - } - expect: { - w=[1,,]; - x=[1,2,void 0]; - y=[1,,2]; - z=[1,void 0,3]; - } -} - -constant_join: { - options = { - unsafe : true, - evaluate : true - }; - input: { - var a = [ "foo", "bar", "baz" ].join(""); - var a1 = [ "foo", "bar", "baz" ].join(); - var b = [ "foo", 1, 2, 3, "bar" ].join(""); - var c = [ boo(), "foo", 1, 2, 3, "bar", bar() ].join(""); - var c1 = [ boo(), bar(), "foo", 1, 2, 3, "bar", bar() ].join(""); - var c2 = [ 1, 2, "foo", "bar", baz() ].join(""); - var d = [ "foo", 1 + 2 + "bar", "baz" ].join("-"); - var e = [].join(foo + bar); - var f = [].join(""); - var g = [].join("foo"); - } - expect: { - var a = "foobarbaz"; - var a1 = "foo,bar,baz"; - var b = "foo123bar"; - var c = boo() + "foo123bar" + bar(); - var c1 = "" + boo() + bar() + "foo123bar" + bar(); - var c2 = "12foobar" + baz(); - var d = "foo-3bar-baz"; - var e = [].join(foo + bar); - var f = ""; - var g = ""; - } -} - -constant_join_2: { - options = { - unsafe : true, - evaluate : true - }; - input: { - var a = [ "foo", "bar", boo(), "baz", "x", "y" ].join(""); - var b = [ "foo", "bar", boo(), "baz", "x", "y" ].join("-"); - var c = [ "foo", "bar", boo(), "baz", "x", "y" ].join("really-long-separator"); - var d = [ "foo", "bar", boo(), - [ "foo", 1, 2, 3, "bar" ].join("+"), - "baz", "x", "y" ].join("-"); - var e = [ "foo", "bar", boo(), - [ "foo", 1, 2, 3, "bar" ].join("+"), - "baz", "x", "y" ].join("really-long-separator"); - var f = [ "str", "str" + variable, "foo", "bar", "moo" + foo ].join(""); - } - expect: { - var a = "foobar" + boo() + "bazxy"; - var b = [ "foo-bar", boo(), "baz-x-y" ].join("-"); - var c = [ "foo", "bar", boo(), "baz", "x", "y" ].join("really-long-separator"); - var d = [ "foo-bar", boo(), "foo+1+2+3+bar-baz-x-y" ].join("-"); - var e = [ "foo", "bar", boo(), - "foo+1+2+3+bar", - "baz", "x", "y" ].join("really-long-separator"); - var f = "strstr" + variable + "foobarmoo" + foo; - } -} diff --git a/node_modules/boomlet/node_modules/uglify-js/test/compress/concat-strings.js b/node_modules/boomlet/node_modules/uglify-js/test/compress/concat-strings.js deleted file mode 100644 index 7919298..0000000 --- a/node_modules/boomlet/node_modules/uglify-js/test/compress/concat-strings.js +++ /dev/null @@ -1,22 +0,0 @@ -concat_1: { - options = { - evaluate: true - }; - input: { - var a = "foo" + "bar" + x() + "moo" + "foo" + y() + "x" + "y" + "z" + q(); - var b = "foo" + 1 + x() + 2 + "boo"; - var c = 1 + x() + 2 + "boo"; - - // this CAN'T safely be shortened to 1 + x() + "5boo" - var d = 1 + x() + 2 + 3 + "boo"; - - var e = 1 + x() + 2 + "X" + 3 + "boo"; - } - expect: { - var a = "foobar" + x() + "moofoo" + y() + "xyz" + q(); - var b = "foo1" + x() + "2boo"; - var c = 1 + x() + 2 + "boo"; - var d = 1 + x() + 2 + 3 + "boo"; - var e = 1 + x() + 2 + "X3boo"; - } -} diff --git a/node_modules/boomlet/node_modules/uglify-js/test/compress/issue-126.js b/node_modules/boomlet/node_modules/uglify-js/test/compress/issue-126.js deleted file mode 100644 index 7a597b8..0000000 --- a/node_modules/boomlet/node_modules/uglify-js/test/compress/issue-126.js +++ /dev/null @@ -1,24 +0,0 @@ -concatenate_rhs_strings: { - options = { - evaluate: true, - unsafe: true, - } - input: { - foo(bar() + 123 + "Hello" + "World"); - foo(bar() + (123 + "Hello") + "World"); - foo((bar() + 123) + "Hello" + "World"); - foo(bar() + 123 + "Hello" + "World" + ("Foo" + "Bar")); - foo("Foo" + "Bar" + bar() + 123 + "Hello" + "World" + ("Foo" + "Bar")); - foo("Hello" + bar() + 123 + "World"); - foo(bar() + 'Foo' + (10 + parseInt('10'))); - } - expect: { - foo(bar() + 123 + "HelloWorld"); - foo(bar() + "123HelloWorld"); - foo((bar() + 123) + "HelloWorld"); - foo(bar() + 123 + "HelloWorldFooBar"); - foo("FooBar" + bar() + "123HelloWorldFooBar"); - foo("Hello" + bar() + "123World"); - foo(bar() + 'Foo' + (10 + parseInt('10'))); - } -} diff --git a/node_modules/boomlet/node_modules/uglify-js/test/compress/issue-143.js b/node_modules/boomlet/node_modules/uglify-js/test/compress/issue-143.js deleted file mode 100644 index 4c79790..0000000 --- a/node_modules/boomlet/node_modules/uglify-js/test/compress/issue-143.js +++ /dev/null @@ -1,48 +0,0 @@ -/** - * There was an incorrect sort behaviour documented in issue #143: - * (x = f(…)) <= x → x >= (x = f(…)) - * - * For example, let the equation be: - * (a = parseInt('100')) <= a - * - * If a was an integer and has the value of 99, - * (a = parseInt('100')) <= a → 100 <= 100 → true - * - * When transformed incorrectly: - * a >= (a = parseInt('100')) → 99 >= 100 → false - */ - -tranformation_sort_order_equal: { - options = { - comparisons: true, - }; - - input: { (a = parseInt('100')) == a } - expect: { (a = parseInt('100')) == a } -} - -tranformation_sort_order_unequal: { - options = { - comparisons: true, - }; - - input: { (a = parseInt('100')) != a } - expect: { (a = parseInt('100')) != a } -} - -tranformation_sort_order_lesser_or_equal: { - options = { - comparisons: true, - }; - - input: { (a = parseInt('100')) <= a } - expect: { (a = parseInt('100')) <= a } -} -tranformation_sort_order_greater_or_equal: { - options = { - comparisons: true, - }; - - input: { (a = parseInt('100')) >= a } - expect: { (a = parseInt('100')) >= a } -}
\ No newline at end of file diff --git a/node_modules/boomlet/node_modules/uglify-js/test/compress/issue-267.js b/node_modules/boomlet/node_modules/uglify-js/test/compress/issue-267.js deleted file mode 100644 index 7233d9f..0000000 --- a/node_modules/boomlet/node_modules/uglify-js/test/compress/issue-267.js +++ /dev/null @@ -1,11 +0,0 @@ -issue_267: { - options = { comparisons: true }; - input: { - x = a % b / b * c * 2; - x = a % b * 2 - } - expect: { - x = a % b / b * c * 2; - x = a % b * 2; - } -} diff --git a/node_modules/boomlet/node_modules/uglify-js/test/compress/issue-269.js b/node_modules/boomlet/node_modules/uglify-js/test/compress/issue-269.js deleted file mode 100644 index 1d41dea..0000000 --- a/node_modules/boomlet/node_modules/uglify-js/test/compress/issue-269.js +++ /dev/null @@ -1,66 +0,0 @@ -issue_269_1: { - options = {unsafe: true}; - input: { - f( - String(x), - Number(x), - Boolean(x), - - String(), - Number(), - Boolean() - ); - } - expect: { - f( - x + '', +x, !!x, - '', 0, false - ); - } -} - -issue_269_dangers: { - options = {unsafe: true}; - input: { - f( - String(x, x), - Number(x, x), - Boolean(x, x) - ); - } - expect: { - f(String(x, x), Number(x, x), Boolean(x, x)); - } -} - -issue_269_in_scope: { - options = {unsafe: true}; - input: { - var String, Number, Boolean; - f( - String(x), - Number(x, x), - Boolean(x) - ); - } - expect: { - var String, Number, Boolean; - f(String(x), Number(x, x), Boolean(x)); - } -} - -strings_concat: { - options = {unsafe: true}; - input: { - f( - String(x + 'str'), - String('str' + x) - ); - } - expect: { - f( - x + 'str', - 'str' + x - ); - } -} diff --git a/node_modules/boomlet/node_modules/uglify-js/test/compress/negate-iife.js b/node_modules/boomlet/node_modules/uglify-js/test/compress/negate-iife.js deleted file mode 100644 index 89c3f06..0000000 --- a/node_modules/boomlet/node_modules/uglify-js/test/compress/negate-iife.js +++ /dev/null @@ -1,76 +0,0 @@ -negate_iife_1: { - options = { - negate_iife: true - }; - input: { - (function(){ stuff() })(); - } - expect: { - !function(){ stuff() }(); - } -} - -negate_iife_2: { - options = { - negate_iife: true - }; - input: { - (function(){ return {} })().x = 10; // should not transform this one - } - expect: { - (function(){ return {} })().x = 10; - } -} - -negate_iife_3: { - options = { - negate_iife: true, - }; - input: { - (function(){ return true })() ? console.log(true) : console.log(false); - } - expect: { - !function(){ return true }() ? console.log(false) : console.log(true); - } -} - -negate_iife_3: { - options = { - negate_iife: true, - sequences: true - }; - input: { - (function(){ return true })() ? console.log(true) : console.log(false); - (function(){ - console.log("something"); - })(); - } - expect: { - !function(){ return true }() ? console.log(false) : console.log(true), function(){ - console.log("something"); - }(); - } -} - -negate_iife_4: { - options = { - negate_iife: true, - sequences: true, - conditionals: true, - }; - input: { - if ((function(){ return true })()) { - foo(true); - } else { - bar(false); - } - (function(){ - console.log("something"); - })(); - } - expect: { - !function(){ return true }() ? bar(false) : foo(true), function(){ - console.log("something"); - }(); - } -} diff --git a/node_modules/boomlet/node_modules/uglify-js/test/compress/properties.js b/node_modules/boomlet/node_modules/uglify-js/test/compress/properties.js deleted file mode 100644 index 8504596..0000000 --- a/node_modules/boomlet/node_modules/uglify-js/test/compress/properties.js +++ /dev/null @@ -1,54 +0,0 @@ -keep_properties: { - options = { - properties: false - }; - input: { - a["foo"] = "bar"; - } - expect: { - a["foo"] = "bar"; - } -} - -dot_properties: { - options = { - properties: true - }; - input: { - a["foo"] = "bar"; - a["if"] = "if"; - a["*"] = "asterisk"; - a["\u0EB3"] = "unicode"; - a[""] = "whitespace"; - a["1_1"] = "foo"; - } - expect: { - a.foo = "bar"; - a["if"] = "if"; - a["*"] = "asterisk"; - a.\u0EB3 = "unicode"; - a[""] = "whitespace"; - a["1_1"] = "foo"; - } -} - -dot_properties_es5: { - options = { - properties: true, - screw_ie8: true - }; - input: { - a["foo"] = "bar"; - a["if"] = "if"; - a["*"] = "asterisk"; - a["\u0EB3"] = "unicode"; - a[""] = "whitespace"; - } - expect: { - a.foo = "bar"; - a.if = "if"; - a["*"] = "asterisk"; - a.\u0EB3 = "unicode"; - a[""] = "whitespace"; - } -} diff --git a/node_modules/boomlet/node_modules/uglify-js/test/compress/typeof.js b/node_modules/boomlet/node_modules/uglify-js/test/compress/typeof.js deleted file mode 100644 index cefdd43..0000000 --- a/node_modules/boomlet/node_modules/uglify-js/test/compress/typeof.js +++ /dev/null @@ -1,25 +0,0 @@ -typeof_evaluation: { - options = { - evaluate: true - }; - input: { - a = typeof 1; - b = typeof 'test'; - c = typeof []; - d = typeof {}; - e = typeof /./; - f = typeof false; - g = typeof function(){}; - h = typeof undefined; - } - expect: { - a='number'; - b='string'; - c=typeof[]; - d=typeof{}; - e=typeof/./; - f='boolean'; - g='function'; - h='undefined'; - } -} diff --git a/node_modules/boomlet/package.json b/node_modules/boomlet/package.json deleted file mode 100644 index 257fa37..0000000 --- a/node_modules/boomlet/package.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "name": "boomlet", - "version": "1.0.0", - "description": "Bookmarklet compiler encloses, encodes, minifies your Javascript file and automatically opens an HTML page with your new bookmarklet for immediate use.", - "main": "./lib/main.js", - "preferGlobal": "true", - "bin": { - "boomlet": "./bin/boomlet" - }, - "dependencies": { - "open": "~0.0.4", - "uglify-js": "~2.4.0" - }, - "repository": { - "type": "git", - "url": "https://github.com/busterc/boomlet.git" - }, - "keywords": [ - "bookmarklet", - "bookmarklets" - ], - "author": { - "name": "busterc" - }, - "license": "MIT", - "readme": "# boomlet\nBookmarklet compiler encloses, encodes, minifies your Javascript file and automatically opens an HTML page with your new bookmarklet for immediate use.\n\n1. Write some tricky Javascript and save it to a file.\n1. Run boomlet.\n1. Drag, drop and begin using your bookmarklet immediately.\n\n## Version\n1.0.0\n\n## Installation\n```sh\nnpm i boomlet -g\n```\n\n## CLI Usage\n```sh\nboomlet <filename> <linktext>\n```\n\n## Makefile Usage (i.e. Sublime Text, etc.)\n```sh\nBOOMFILE := filename.js\nBOOMTEXT := 'This Bookmark Goes BOOM!'\n\nboom:\n boomlet $(BOOMFILE) $(BOOMTEXT)\n\n.PHONY: boom\n```\n\n<!---\n# *Easter Egg:* Local Mode\n\n## Local Installation\n```sh\nnpm i boomlet\n```\n\n## Local App Usage\n```sh\nrequire('boomlet').boom(<filename>, <linktext>);\n```\n-->\n\n## Dependencies\n* [open](https://github.com/pwnall/node-open) - opens the default browser\n* [uglify-js](http://lisperator.net/uglifyjs) - eliminates uneccessary whitespace\n\n## License\nThe MIT License (MIT)\n\nCopyright (c) 2013 Buster Collings\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.", - "readmeFilename": "README.md", - "bugs": { - "url": "https://github.com/busterc/boomlet/issues" - }, - "homepage": "https://github.com/busterc/boomlet", - "_id": "boomlet@1.0.0", - "dist": { - "shasum": "39ef134b1e3c10d426fdb97618428569b1fb34ca" - }, - "_from": "boomlet@1.x", - "_resolved": "https://registry.npmjs.org/boomlet/-/boomlet-1.0.0.tgz" -} |
