sprockets-browserify 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/MIT-LICENSE +20 -0
- data/README.rdoc +70 -0
- data/Rakefile +38 -0
- data/lib/sprockets/browserify/engine.rb +15 -0
- data/lib/sprockets/browserify.rb +37 -0
- data/lib/sprockets-browserify.rb +2 -0
- data/lib/tasks/sprockets-browserify_tasks.rake +4 -0
- data/node_modules/JSONStream/LICENSE.APACHE2 +15 -0
- data/node_modules/JSONStream/LICENSE.MIT +24 -0
- data/node_modules/JSONStream/examples/all_docs.js +13 -0
- data/node_modules/JSONStream/index.js +189 -0
- data/node_modules/JSONStream/node_modules/jsonparse/LICENSE +24 -0
- data/node_modules/JSONStream/node_modules/jsonparse/README.markdown +11 -0
- data/node_modules/JSONStream/node_modules/jsonparse/bench.js +26 -0
- data/node_modules/JSONStream/node_modules/jsonparse/examples/twitterfeed.js +30 -0
- data/node_modules/JSONStream/node_modules/jsonparse/jsonparse.js +379 -0
- data/node_modules/JSONStream/node_modules/jsonparse/package.json +34 -0
- data/node_modules/JSONStream/node_modules/jsonparse/samplejson/basic.json +167 -0
- data/node_modules/JSONStream/node_modules/jsonparse/samplejson/basic2.json +180 -0
- data/node_modules/JSONStream/node_modules/jsonparse/test/primitives.js +54 -0
- data/node_modules/JSONStream/node_modules/jsonparse/test/utf8.js +38 -0
- data/node_modules/JSONStream/package.json +38 -0
- data/node_modules/JSONStream/readme.markdown +145 -0
- data/node_modules/JSONStream/test/bool.js +41 -0
- data/node_modules/JSONStream/test/destroy_missing.js +22 -0
- data/node_modules/JSONStream/test/empty.js +44 -0
- data/node_modules/JSONStream/test/fixtures/all_npm.json +4030 -0
- data/node_modules/JSONStream/test/fn.js +39 -0
- data/node_modules/JSONStream/test/memory.js +69 -0
- data/node_modules/JSONStream/test/multiple_objects.js +42 -0
- data/node_modules/JSONStream/test/multiple_objects_error.js +35 -0
- data/node_modules/JSONStream/test/parsejson.js +28 -0
- data/node_modules/JSONStream/test/stringify.js +41 -0
- data/node_modules/JSONStream/test/stringify_object.js +47 -0
- data/node_modules/JSONStream/test/test.js +35 -0
- data/node_modules/JSONStream/test/test2.js +29 -0
- data/node_modules/JSONStream/test/two-ways.js +41 -0
- data/node_modules/browserify/LICENSE +63 -0
- data/node_modules/browserify/README.markdown +172 -0
- data/node_modules/browserify/bin/cmd.js +161 -0
- data/node_modules/browserify/builtins/__browserify_process.js +55 -0
- data/node_modules/browserify/builtins/assert.js +314 -0
- data/node_modules/browserify/builtins/child_process.js +2 -0
- data/node_modules/browserify/builtins/events.js +178 -0
- data/node_modules/browserify/builtins/fs.js +1 -0
- data/node_modules/browserify/builtins/https.js +1 -0
- data/node_modules/browserify/builtins/net.js +1 -0
- data/node_modules/browserify/builtins/path.js +175 -0
- data/node_modules/browserify/builtins/querystring.js +250 -0
- data/node_modules/browserify/builtins/stream.js +119 -0
- data/node_modules/browserify/builtins/string_decoder.js +161 -0
- data/node_modules/browserify/builtins/sys.js +1 -0
- data/node_modules/browserify/builtins/timers.js +39 -0
- data/node_modules/browserify/builtins/tls.js +1 -0
- data/node_modules/browserify/builtins/tty.js +2 -0
- data/node_modules/browserify/builtins/url.js +604 -0
- data/node_modules/browserify/builtins/util.js +351 -0
- data/node_modules/browserify/doc/methods.markdown +182 -0
- data/node_modules/browserify/doc/recipes.markdown +62 -0
- data/node_modules/browserify/example/debug/browserify.js +219 -0
- data/node_modules/browserify/example/debug/build.sh +3 -0
- data/node_modules/browserify/example/debug/index.html +7 -0
- data/node_modules/browserify/example/debug/js/entry.js +2 -0
- data/node_modules/browserify/example/debug/js/thrower.js +3 -0
- data/node_modules/browserify/example/debug/server.js +9 -0
- data/node_modules/browserify/example/simple-build/browserify.js +368 -0
- data/node_modules/browserify/example/simple-build/build.sh +3 -0
- data/node_modules/browserify/example/simple-build/index.html +9 -0
- data/node_modules/browserify/example/simple-build/js/bar.js +3 -0
- data/node_modules/browserify/example/simple-build/js/entry.js +5 -0
- data/node_modules/browserify/example/simple-build/js/foo.js +5 -0
- data/node_modules/browserify/example/simple-build/server.js +9 -0
- data/node_modules/browserify/example/test/b.js +5 -0
- data/node_modules/browserify/example/test/bar.js +3 -0
- data/node_modules/browserify/example/test/foo.js +3 -0
- data/node_modules/browserify/example/test/m.js +3 -0
- data/node_modules/browserify/example/test/n.js +3 -0
- data/node_modules/browserify/example/using-http/bundle.js +813 -0
- data/node_modules/browserify/example/using-http/entry.js +25 -0
- data/node_modules/browserify/example/using-http/index.html +9 -0
- data/node_modules/browserify/example/using-http/server.js +28 -0
- data/node_modules/browserify/index.js +202 -0
- data/node_modules/browserify/lib/watch.js +75 -0
- data/node_modules/browserify/lib/wrap.js +583 -0
- data/node_modules/browserify/lib/wrappers.js +10 -0
- data/node_modules/browserify/node_modules/buffer-browserify/README.md +11 -0
- data/node_modules/browserify/node_modules/buffer-browserify/buffer_ieee754.js +84 -0
- data/node_modules/browserify/node_modules/buffer-browserify/index.js +1317 -0
- data/node_modules/browserify/node_modules/buffer-browserify/node_modules/base64-js/README.md +14 -0
- data/node_modules/browserify/node_modules/buffer-browserify/node_modules/base64-js/lib/b64.js +84 -0
- data/node_modules/browserify/node_modules/buffer-browserify/node_modules/base64-js/package.json +26 -0
- data/node_modules/browserify/node_modules/buffer-browserify/node_modules/base64-js/test/runner.js +50 -0
- data/node_modules/browserify/node_modules/buffer-browserify/package.json +42 -0
- data/node_modules/browserify/node_modules/buffer-browserify/test/buffer.js +218 -0
- data/node_modules/browserify/node_modules/coffee-script/CNAME +1 -0
- data/node_modules/browserify/node_modules/coffee-script/CONTRIBUTING.md +9 -0
- data/node_modules/browserify/node_modules/coffee-script/LICENSE +22 -0
- data/node_modules/browserify/node_modules/coffee-script/README +51 -0
- data/node_modules/browserify/node_modules/coffee-script/Rakefile +79 -0
- data/node_modules/browserify/node_modules/coffee-script/bin/cake +7 -0
- data/node_modules/browserify/node_modules/coffee-script/bin/coffee +7 -0
- data/node_modules/browserify/node_modules/coffee-script/extras/jsl.conf +44 -0
- data/node_modules/browserify/node_modules/coffee-script/lib/coffee-script/browser.js +101 -0
- data/node_modules/browserify/node_modules/coffee-script/lib/coffee-script/cake.js +113 -0
- data/node_modules/browserify/node_modules/coffee-script/lib/coffee-script/coffee-script.js +218 -0
- data/node_modules/browserify/node_modules/coffee-script/lib/coffee-script/command.js +506 -0
- data/node_modules/browserify/node_modules/coffee-script/lib/coffee-script/grammar.js +623 -0
- data/node_modules/browserify/node_modules/coffee-script/lib/coffee-script/helpers.js +150 -0
- data/node_modules/browserify/node_modules/coffee-script/lib/coffee-script/index.js +11 -0
- data/node_modules/browserify/node_modules/coffee-script/lib/coffee-script/lexer.js +905 -0
- data/node_modules/browserify/node_modules/coffee-script/lib/coffee-script/nodes.js +3088 -0
- data/node_modules/browserify/node_modules/coffee-script/lib/coffee-script/optparse.js +138 -0
- data/node_modules/browserify/node_modules/coffee-script/lib/coffee-script/parser.js +608 -0
- data/node_modules/browserify/node_modules/coffee-script/lib/coffee-script/repl.js +104 -0
- data/node_modules/browserify/node_modules/coffee-script/lib/coffee-script/rewriter.js +478 -0
- data/node_modules/browserify/node_modules/coffee-script/lib/coffee-script/scope.js +147 -0
- data/node_modules/browserify/node_modules/coffee-script/lib/coffee-script/sourcemap.js +237 -0
- data/node_modules/browserify/node_modules/coffee-script/package.json +48 -0
- data/node_modules/browserify/node_modules/commondir/README.markdown +45 -0
- data/node_modules/browserify/node_modules/commondir/example/base.js +3 -0
- data/node_modules/browserify/node_modules/commondir/example/dir.js +3 -0
- data/node_modules/browserify/node_modules/commondir/index.js +29 -0
- data/node_modules/browserify/node_modules/commondir/package.json +43 -0
- data/node_modules/browserify/node_modules/commondir/test/dirs.js +66 -0
- data/node_modules/browserify/node_modules/console-browserify/LICENCE +19 -0
- data/node_modules/browserify/node_modules/console-browserify/README.md +32 -0
- data/node_modules/browserify/node_modules/console-browserify/index.js +85 -0
- data/node_modules/browserify/node_modules/console-browserify/package.json +76 -0
- data/node_modules/browserify/node_modules/console-browserify/test/index.js +67 -0
- data/node_modules/browserify/node_modules/console-browserify/test/static/index.html +12 -0
- data/node_modules/browserify/node_modules/console-browserify/test/static/test-adapter.js +53 -0
- data/node_modules/browserify/node_modules/crypto-browserify/example/bundle.js +637 -0
- data/node_modules/browserify/node_modules/crypto-browserify/example/index.html +12 -0
- data/node_modules/browserify/node_modules/crypto-browserify/example/test.js +4 -0
- data/node_modules/browserify/node_modules/crypto-browserify/index.js +74 -0
- data/node_modules/browserify/node_modules/crypto-browserify/md5.js +384 -0
- data/node_modules/browserify/node_modules/crypto-browserify/package.json +30 -0
- data/node_modules/browserify/node_modules/crypto-browserify/readme.markdown +20 -0
- data/node_modules/browserify/node_modules/crypto-browserify/rng.js +37 -0
- data/node_modules/browserify/node_modules/crypto-browserify/sha.js +210 -0
- data/node_modules/browserify/node_modules/crypto-browserify/test/simple.js +35 -0
- data/node_modules/browserify/node_modules/deputy/README.markdown +55 -0
- data/node_modules/browserify/node_modules/deputy/example/cache.js +5 -0
- data/node_modules/browserify/node_modules/deputy/index.js +46 -0
- data/node_modules/browserify/node_modules/deputy/node_modules/mkdirp/LICENSE +21 -0
- data/node_modules/browserify/node_modules/deputy/node_modules/mkdirp/examples/pow.js +6 -0
- data/node_modules/browserify/node_modules/deputy/node_modules/mkdirp/index.js +82 -0
- data/node_modules/browserify/node_modules/deputy/node_modules/mkdirp/package.json +30 -0
- data/node_modules/browserify/node_modules/deputy/node_modules/mkdirp/readme.markdown +63 -0
- data/node_modules/browserify/node_modules/deputy/node_modules/mkdirp/test/chmod.js +38 -0
- data/node_modules/browserify/node_modules/deputy/node_modules/mkdirp/test/clobber.js +37 -0
- data/node_modules/browserify/node_modules/deputy/node_modules/mkdirp/test/mkdirp.js +28 -0
- data/node_modules/browserify/node_modules/deputy/node_modules/mkdirp/test/perm.js +32 -0
- data/node_modules/browserify/node_modules/deputy/node_modules/mkdirp/test/perm_sync.js +39 -0
- data/node_modules/browserify/node_modules/deputy/node_modules/mkdirp/test/race.js +41 -0
- data/node_modules/browserify/node_modules/deputy/node_modules/mkdirp/test/rel.js +32 -0
- data/node_modules/browserify/node_modules/deputy/node_modules/mkdirp/test/return.js +25 -0
- data/node_modules/browserify/node_modules/deputy/node_modules/mkdirp/test/return_sync.js +24 -0
- data/node_modules/browserify/node_modules/deputy/node_modules/mkdirp/test/root.js +18 -0
- data/node_modules/browserify/node_modules/deputy/node_modules/mkdirp/test/sync.js +32 -0
- data/node_modules/browserify/node_modules/deputy/node_modules/mkdirp/test/umask.js +28 -0
- data/node_modules/browserify/node_modules/deputy/node_modules/mkdirp/test/umask_sync.js +32 -0
- data/node_modules/browserify/node_modules/deputy/package.json +43 -0
- data/node_modules/browserify/node_modules/deputy/test/cache.js +58 -0
- data/node_modules/browserify/node_modules/detective/README.markdown +66 -0
- data/node_modules/browserify/node_modules/detective/example/strings.js +6 -0
- data/node_modules/browserify/node_modules/detective/example/strings_src.js +3 -0
- data/node_modules/browserify/node_modules/detective/index.js +60 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/LICENSE.BSD +19 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/README.md +74 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/assets/codemirror/codemirror.css +112 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/assets/codemirror/codemirror.js +2972 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/assets/codemirror/javascript.js +360 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/assets/json2.js +487 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/assets/style.css +164 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/assets/yui/treeview-min.js +12 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/assets/yui/treeview-sprite.gif +0 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/assets/yui/treeview.css +7 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/assets/yui/yahoo-dom-event.js +14 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/bin/esparse.js +42 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/changes +92 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/cm +696 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/demo/checkenv.js +42 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/demo/collector.html +82 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/demo/collector.js +170 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/demo/functiontrace.html +106 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/demo/functiontrace.js +123 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/demo/parse.css +82 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/demo/parse.html +352 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/demo/precedence.html +225 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/demo/rewrite.html +120 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/demo/rewrite.js +71 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/esprima.js +3577 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/index.html +103 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/package.json +39 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/test/3rdparty/Tokenizer.js +646 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/test/3rdparty/XMLHttpRequest.js +509 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/test/3rdparty/ZeParser.js +2185 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/test/3rdparty/backbone-0.5.3.js +1158 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/test/3rdparty/benchmark.js +3261 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/test/3rdparty/escodegen.js +906 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/test/3rdparty/esmorph.js +240 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/test/3rdparty/ext-core-3.0.0.js +6579 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/test/3rdparty/ext-core-3.1.0.js +10255 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/test/3rdparty/jquery-1.6.4.js +9046 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/test/3rdparty/jquery-1.7.1.js +9266 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/test/3rdparty/jquery.mobile-1.0.js +6951 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/test/3rdparty/jsdefs.js +731 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/test/3rdparty/jslex.js +588 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/test/3rdparty/jsparse.js +1921 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/test/3rdparty/mootools-1.3.2.js +5952 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/test/3rdparty/mootools-1.4.1.js +6297 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/test/3rdparty/parse-js.js +1342 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/test/3rdparty/platform.js +878 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/test/3rdparty/prototype-1.6.1.js +4874 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/test/3rdparty/prototype-1.7.0.0.js +6082 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/test/3rdparty/underscore-1.2.3.js +981 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/test/benchmarks.html +58 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/test/benchmarks.js +328 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/test/compare.html +140 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/test/compare.js +270 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/test/compat.html +40 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/test/compat.js +239 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/test/coverage.footer.html +3 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/test/coverage.header.html +37 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/test/coverage.html +3617 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/test/index.html +36 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/test/reflect.js +403 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/test/run.js +66 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/test/test.js +16659 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/tools/generate-unicode-regex.py +164 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/tools/update-coverage.sh +28 -0
- data/node_modules/browserify/node_modules/detective/package.json +43 -0
- data/node_modules/browserify/node_modules/detective/test/both.js +11 -0
- data/node_modules/browserify/node_modules/detective/test/chained.js +9 -0
- data/node_modules/browserify/node_modules/detective/test/files/both.js +4 -0
- data/node_modules/browserify/node_modules/detective/test/files/chained.js +5 -0
- data/node_modules/browserify/node_modules/detective/test/files/nested.js +22 -0
- data/node_modules/browserify/node_modules/detective/test/files/skip.js +7 -0
- data/node_modules/browserify/node_modules/detective/test/files/strings.js +13 -0
- data/node_modules/browserify/node_modules/detective/test/files/word.js +13 -0
- data/node_modules/browserify/node_modules/detective/test/nested.js +9 -0
- data/node_modules/browserify/node_modules/detective/test/skip.js +9 -0
- data/node_modules/browserify/node_modules/detective/test/strings.js +9 -0
- data/node_modules/browserify/node_modules/detective/test/word.js +12 -0
- data/node_modules/browserify/node_modules/http-browserify/example/get/index.html +9 -0
- data/node_modules/browserify/node_modules/http-browserify/example/get/main.js +14 -0
- data/node_modules/browserify/node_modules/http-browserify/example/get/server.js +12 -0
- data/node_modules/browserify/node_modules/http-browserify/example/headers/index.html +9 -0
- data/node_modules/browserify/node_modules/http-browserify/example/headers/main.js +18 -0
- data/node_modules/browserify/node_modules/http-browserify/example/headers/server.js +15 -0
- data/node_modules/browserify/node_modules/http-browserify/example/json-stream/data.json +139 -0
- data/node_modules/browserify/node_modules/http-browserify/example/json-stream/index.html +9 -0
- data/node_modules/browserify/node_modules/http-browserify/example/json-stream/main.js +13 -0
- data/node_modules/browserify/node_modules/http-browserify/example/json-stream/node_modules/JSONStream/LICENSE.APACHE2 +15 -0
- data/node_modules/browserify/node_modules/http-browserify/example/json-stream/node_modules/JSONStream/LICENSE.MIT +24 -0
- data/node_modules/browserify/node_modules/http-browserify/example/json-stream/node_modules/JSONStream/examples/all_docs.js +13 -0
- data/node_modules/browserify/node_modules/http-browserify/example/json-stream/node_modules/JSONStream/index.js +189 -0
- data/node_modules/browserify/node_modules/http-browserify/example/json-stream/node_modules/JSONStream/node_modules/jsonparse/LICENSE +24 -0
- data/node_modules/browserify/node_modules/http-browserify/example/json-stream/node_modules/JSONStream/node_modules/jsonparse/README.markdown +11 -0
- data/node_modules/browserify/node_modules/http-browserify/example/json-stream/node_modules/JSONStream/node_modules/jsonparse/bench.js +26 -0
- data/node_modules/browserify/node_modules/http-browserify/example/json-stream/node_modules/JSONStream/node_modules/jsonparse/examples/twitterfeed.js +30 -0
- data/node_modules/browserify/node_modules/http-browserify/example/json-stream/node_modules/JSONStream/node_modules/jsonparse/jsonparse.js +379 -0
- data/node_modules/browserify/node_modules/http-browserify/example/json-stream/node_modules/JSONStream/node_modules/jsonparse/package.json +36 -0
- data/node_modules/browserify/node_modules/http-browserify/example/json-stream/node_modules/JSONStream/node_modules/jsonparse/samplejson/basic.json +167 -0
- data/node_modules/browserify/node_modules/http-browserify/example/json-stream/node_modules/JSONStream/node_modules/jsonparse/samplejson/basic2.json +180 -0
- data/node_modules/browserify/node_modules/http-browserify/example/json-stream/node_modules/JSONStream/node_modules/jsonparse/test/primitives.js +54 -0
- data/node_modules/browserify/node_modules/http-browserify/example/json-stream/node_modules/JSONStream/node_modules/jsonparse/test/utf8.js +38 -0
- data/node_modules/browserify/node_modules/http-browserify/example/json-stream/node_modules/JSONStream/package.json +40 -0
- data/node_modules/browserify/node_modules/http-browserify/example/json-stream/node_modules/JSONStream/readme.markdown +145 -0
- data/node_modules/browserify/node_modules/http-browserify/example/json-stream/node_modules/JSONStream/test/bool.js +41 -0
- data/node_modules/browserify/node_modules/http-browserify/example/json-stream/node_modules/JSONStream/test/destroy_missing.js +22 -0
- data/node_modules/browserify/node_modules/http-browserify/example/json-stream/node_modules/JSONStream/test/empty.js +44 -0
- data/node_modules/browserify/node_modules/http-browserify/example/json-stream/node_modules/JSONStream/test/fixtures/all_npm.json +4030 -0
- data/node_modules/browserify/node_modules/http-browserify/example/json-stream/node_modules/JSONStream/test/fn.js +39 -0
- data/node_modules/browserify/node_modules/http-browserify/example/json-stream/node_modules/JSONStream/test/memory.js +69 -0
- data/node_modules/browserify/node_modules/http-browserify/example/json-stream/node_modules/JSONStream/test/multiple_objects.js +42 -0
- data/node_modules/browserify/node_modules/http-browserify/example/json-stream/node_modules/JSONStream/test/multiple_objects_error.js +35 -0
- data/node_modules/browserify/node_modules/http-browserify/example/json-stream/node_modules/JSONStream/test/parsejson.js +28 -0
- data/node_modules/browserify/node_modules/http-browserify/example/json-stream/node_modules/JSONStream/test/stringify.js +41 -0
- data/node_modules/browserify/node_modules/http-browserify/example/json-stream/node_modules/JSONStream/test/stringify_object.js +47 -0
- data/node_modules/browserify/node_modules/http-browserify/example/json-stream/node_modules/JSONStream/test/test.js +35 -0
- data/node_modules/browserify/node_modules/http-browserify/example/json-stream/node_modules/JSONStream/test/test2.js +29 -0
- data/node_modules/browserify/node_modules/http-browserify/example/json-stream/node_modules/JSONStream/test/two-ways.js +41 -0
- data/node_modules/browserify/node_modules/http-browserify/example/json-stream/server.js +10 -0
- data/node_modules/browserify/node_modules/http-browserify/example/post/index.html +9 -0
- data/node_modules/browserify/node_modules/http-browserify/example/post/main.js +16 -0
- data/node_modules/browserify/node_modules/http-browserify/example/post/server.js +19 -0
- data/node_modules/browserify/node_modules/http-browserify/example/streaming/index.html +9 -0
- data/node_modules/browserify/node_modules/http-browserify/example/streaming/main.js +16 -0
- data/node_modules/browserify/node_modules/http-browserify/example/streaming/server.js +21 -0
- data/node_modules/browserify/node_modules/http-browserify/index.js +60 -0
- data/node_modules/browserify/node_modules/http-browserify/lib/request.js +128 -0
- data/node_modules/browserify/node_modules/http-browserify/lib/response.js +119 -0
- data/node_modules/browserify/node_modules/http-browserify/node_modules/concat-stream/index.js +48 -0
- data/node_modules/browserify/node_modules/http-browserify/node_modules/concat-stream/package.json +29 -0
- data/node_modules/browserify/node_modules/http-browserify/node_modules/concat-stream/readme.md +31 -0
- data/node_modules/browserify/node_modules/http-browserify/node_modules/concat-stream/test.js +34 -0
- data/node_modules/browserify/node_modules/http-browserify/package.json +42 -0
- data/node_modules/browserify/node_modules/http-browserify/readme.markdown +128 -0
- data/node_modules/browserify/node_modules/nub/README.markdown +23 -0
- data/node_modules/browserify/node_modules/nub/index.js +64 -0
- data/node_modules/browserify/node_modules/nub/package.json +42 -0
- data/node_modules/browserify/node_modules/nub/test/by.js +51 -0
- data/node_modules/browserify/node_modules/nub/test/nub.js +46 -0
- data/node_modules/browserify/node_modules/optimist/LICENSE +21 -0
- data/node_modules/browserify/node_modules/optimist/README.markdown +487 -0
- data/node_modules/browserify/node_modules/optimist/example/bool.js +10 -0
- data/node_modules/browserify/node_modules/optimist/example/boolean_double.js +7 -0
- data/node_modules/browserify/node_modules/optimist/example/boolean_single.js +7 -0
- data/node_modules/browserify/node_modules/optimist/example/default_hash.js +8 -0
- data/node_modules/browserify/node_modules/optimist/example/default_singles.js +7 -0
- data/node_modules/browserify/node_modules/optimist/example/divide.js +8 -0
- data/node_modules/browserify/node_modules/optimist/example/line_count.js +20 -0
- data/node_modules/browserify/node_modules/optimist/example/line_count_options.js +29 -0
- data/node_modules/browserify/node_modules/optimist/example/line_count_wrap.js +29 -0
- data/node_modules/browserify/node_modules/optimist/example/nonopt.js +4 -0
- data/node_modules/browserify/node_modules/optimist/example/reflect.js +2 -0
- data/node_modules/browserify/node_modules/optimist/example/short.js +3 -0
- data/node_modules/browserify/node_modules/optimist/example/string.js +11 -0
- data/node_modules/browserify/node_modules/optimist/example/usage-options.js +19 -0
- data/node_modules/browserify/node_modules/optimist/example/xup.js +10 -0
- data/node_modules/browserify/node_modules/optimist/index.js +475 -0
- data/node_modules/browserify/node_modules/optimist/node_modules/wordwrap/README.markdown +70 -0
- data/node_modules/browserify/node_modules/optimist/node_modules/wordwrap/example/center.js +10 -0
- data/node_modules/browserify/node_modules/optimist/node_modules/wordwrap/example/meat.js +3 -0
- data/node_modules/browserify/node_modules/optimist/node_modules/wordwrap/index.js +76 -0
- data/node_modules/browserify/node_modules/optimist/node_modules/wordwrap/package.json +41 -0
- data/node_modules/browserify/node_modules/optimist/node_modules/wordwrap/test/break.js +30 -0
- data/node_modules/browserify/node_modules/optimist/node_modules/wordwrap/test/idleness.txt +63 -0
- data/node_modules/browserify/node_modules/optimist/node_modules/wordwrap/test/wrap.js +31 -0
- data/node_modules/browserify/node_modules/optimist/package.json +47 -0
- data/node_modules/browserify/node_modules/optimist/test/_/argv.js +2 -0
- data/node_modules/browserify/node_modules/optimist/test/_/bin.js +3 -0
- data/node_modules/browserify/node_modules/optimist/test/_.js +71 -0
- data/node_modules/browserify/node_modules/optimist/test/parse.js +433 -0
- data/node_modules/browserify/node_modules/optimist/test/usage.js +292 -0
- data/node_modules/browserify/node_modules/optimist/x.js +1 -0
- data/node_modules/browserify/node_modules/resolve/LICENSE +18 -0
- data/node_modules/browserify/node_modules/resolve/README.markdown +47 -0
- data/node_modules/browserify/node_modules/resolve/index.js +109 -0
- data/node_modules/browserify/node_modules/resolve/package.json +41 -0
- data/node_modules/browserify/node_modules/resolve/test/core.js +12 -0
- data/node_modules/browserify/node_modules/resolve/test/filter.js +15 -0
- data/node_modules/browserify/node_modules/resolve/test/mock.js +68 -0
- data/node_modules/browserify/node_modules/resolve/test/resolver/bar/node_modules/foo/index.js +1 -0
- data/node_modules/browserify/node_modules/resolve/test/resolver/baz/doom.js +0 -0
- data/node_modules/browserify/node_modules/resolve/test/resolver/baz/package.json +3 -0
- data/node_modules/browserify/node_modules/resolve/test/resolver/baz/quux.js +1 -0
- data/node_modules/browserify/node_modules/resolve/test/resolver/biz/node_modules/grux/index.js +1 -0
- data/node_modules/browserify/node_modules/resolve/test/resolver/biz/node_modules/tiv/index.js +1 -0
- data/node_modules/browserify/node_modules/resolve/test/resolver/cup.coffee +1 -0
- data/node_modules/browserify/node_modules/resolve/test/resolver/foo.js +1 -0
- data/node_modules/browserify/node_modules/resolve/test/resolver/mug.coffee +0 -0
- data/node_modules/browserify/node_modules/resolve/test/resolver/mug.js +0 -0
- data/node_modules/browserify/node_modules/resolve/test/resolver/other_path/lib/other-lib.js +0 -0
- data/node_modules/browserify/node_modules/resolve/test/resolver/other_path/root.js +0 -0
- data/node_modules/browserify/node_modules/resolve/test/resolver.js +157 -0
- data/node_modules/browserify/node_modules/syntax-error/LICENSE +18 -0
- data/node_modules/browserify/node_modules/syntax-error/example/check.js +12 -0
- data/node_modules/browserify/node_modules/syntax-error/example/src.js +9 -0
- data/node_modules/browserify/node_modules/syntax-error/index.js +54 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/LICENSE.BSD +19 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/README.md +74 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/assets/codemirror/codemirror.css +112 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/assets/codemirror/codemirror.js +2972 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/assets/codemirror/javascript.js +360 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/assets/json2.js +487 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/assets/style.css +164 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/assets/yui/treeview-min.js +12 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/assets/yui/treeview-sprite.gif +0 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/assets/yui/treeview.css +7 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/assets/yui/yahoo-dom-event.js +14 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/bin/esparse.js +42 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/changes +92 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/cm +696 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/demo/checkenv.js +42 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/demo/collector.html +82 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/demo/collector.js +170 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/demo/functiontrace.html +106 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/demo/functiontrace.js +123 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/demo/parse.css +82 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/demo/parse.html +352 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/demo/precedence.html +225 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/demo/rewrite.html +120 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/demo/rewrite.js +71 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/esprima.js +3577 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/index.html +103 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/package.json +39 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/test/3rdparty/Tokenizer.js +646 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/test/3rdparty/XMLHttpRequest.js +509 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/test/3rdparty/ZeParser.js +2185 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/test/3rdparty/backbone-0.5.3.js +1158 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/test/3rdparty/benchmark.js +3261 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/test/3rdparty/escodegen.js +906 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/test/3rdparty/esmorph.js +240 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/test/3rdparty/ext-core-3.0.0.js +6579 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/test/3rdparty/ext-core-3.1.0.js +10255 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/test/3rdparty/jquery-1.6.4.js +9046 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/test/3rdparty/jquery-1.7.1.js +9266 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/test/3rdparty/jquery.mobile-1.0.js +6951 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/test/3rdparty/jsdefs.js +731 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/test/3rdparty/jslex.js +588 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/test/3rdparty/jsparse.js +1921 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/test/3rdparty/mootools-1.3.2.js +5952 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/test/3rdparty/mootools-1.4.1.js +6297 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/test/3rdparty/parse-js.js +1342 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/test/3rdparty/platform.js +878 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/test/3rdparty/prototype-1.6.1.js +4874 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/test/3rdparty/prototype-1.7.0.0.js +6082 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/test/3rdparty/underscore-1.2.3.js +981 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/test/benchmarks.html +58 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/test/benchmarks.js +328 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/test/compare.html +140 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/test/compare.js +270 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/test/compat.html +40 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/test/compat.js +239 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/test/coverage.footer.html +3 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/test/coverage.header.html +37 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/test/coverage.html +3617 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/test/index.html +36 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/test/reflect.js +403 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/test/run.js +66 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/test/test.js +16659 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/tools/generate-unicode-regex.py +164 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/tools/update-coverage.sh +28 -0
- data/node_modules/browserify/node_modules/syntax-error/package.json +46 -0
- data/node_modules/browserify/node_modules/syntax-error/readme.markdown +87 -0
- data/node_modules/browserify/node_modules/syntax-error/test/check.js +17 -0
- data/node_modules/browserify/node_modules/syntax-error/test/sources/check.js +9 -0
- data/node_modules/browserify/node_modules/vm-browserify/README.markdown +103 -0
- data/node_modules/browserify/node_modules/vm-browserify/example/run/bundle.js +473 -0
- data/node_modules/browserify/node_modules/vm-browserify/example/run/entry.js +6 -0
- data/node_modules/browserify/node_modules/vm-browserify/example/run/index.html +9 -0
- data/node_modules/browserify/node_modules/vm-browserify/example/run/server.js +6 -0
- data/node_modules/browserify/node_modules/vm-browserify/index.js +85 -0
- data/node_modules/browserify/node_modules/vm-browserify/package.json +39 -0
- data/node_modules/browserify/node_modules/vm-browserify/testling/run.js +22 -0
- data/node_modules/browserify/node_modules/vm-browserify/testling/test.sh +11 -0
- data/node_modules/browserify/package.json +71 -0
- data/node_modules/browserify/test/alias.js +58 -0
- data/node_modules/browserify/test/backbone.js +21 -0
- data/node_modules/browserify/test/bin.js +39 -0
- data/node_modules/browserify/test/buffer.js +99 -0
- data/node_modules/browserify/test/bundle.js +32 -0
- data/node_modules/browserify/test/cache.js +28 -0
- data/node_modules/browserify/test/coffee/bar.js +1 -0
- data/node_modules/browserify/test/coffee/baz.coffee +1 -0
- data/node_modules/browserify/test/coffee/entry.coffee +1 -0
- data/node_modules/browserify/test/coffee/foo.coffee +1 -0
- data/node_modules/browserify/test/coffee/index.coffee +5 -0
- data/node_modules/browserify/test/coffee/nested/nested.coffee +2 -0
- data/node_modules/browserify/test/coffee.js +39 -0
- data/node_modules/browserify/test/comment/main.js +2 -0
- data/node_modules/browserify/test/comment.js +17 -0
- data/node_modules/browserify/test/crypto.js +37 -0
- data/node_modules/browserify/test/dnode.js +27 -0
- data/node_modules/browserify/test/dollar/dollar/index.js +7 -0
- data/node_modules/browserify/test/dollar.js +19 -0
- data/node_modules/browserify/test/entry/main.js +1 -0
- data/node_modules/browserify/test/entry/one.js +1 -0
- data/node_modules/browserify/test/entry/two.js +1 -0
- data/node_modules/browserify/test/entry.js +36 -0
- data/node_modules/browserify/test/error_code/src.js +2 -0
- data/node_modules/browserify/test/error_code.js +24 -0
- data/node_modules/browserify/test/export/entry.js +1 -0
- data/node_modules/browserify/test/export.js +52 -0
- data/node_modules/browserify/test/field/miss.js +1 -0
- data/node_modules/browserify/test/field/node_modules/z-miss/browser.js +1 -0
- data/node_modules/browserify/test/field/node_modules/z-miss/main.js +1 -0
- data/node_modules/browserify/test/field/node_modules/z-miss/package.json +4 -0
- data/node_modules/browserify/test/field/node_modules/z-object/browser.js +1 -0
- data/node_modules/browserify/test/field/node_modules/z-object/main.js +1 -0
- data/node_modules/browserify/test/field/node_modules/z-object/package.json +6 -0
- data/node_modules/browserify/test/field/node_modules/z-string/browser.js +1 -0
- data/node_modules/browserify/test/field/node_modules/z-string/main.js +1 -0
- data/node_modules/browserify/test/field/node_modules/z-string/package.json +4 -0
- data/node_modules/browserify/test/field/node_modules/z-sub/browser/a.js +1 -0
- data/node_modules/browserify/test/field/node_modules/z-sub/browser/b.js +1 -0
- data/node_modules/browserify/test/field/node_modules/z-sub/main.js +1 -0
- data/node_modules/browserify/test/field/node_modules/z-sub/package.json +4 -0
- data/node_modules/browserify/test/field/object.js +1 -0
- data/node_modules/browserify/test/field/string.js +1 -0
- data/node_modules/browserify/test/field/sub.js +1 -0
- data/node_modules/browserify/test/field.js +64 -0
- data/node_modules/browserify/test/global/main.js +2 -0
- data/node_modules/browserify/test/global.js +19 -0
- data/node_modules/browserify/test/jade.js +35 -0
- data/node_modules/browserify/test/json/beep.json +4 -0
- data/node_modules/browserify/test/json/main.js +1 -0
- data/node_modules/browserify/test/json.js +17 -0
- data/node_modules/browserify/test/maxlisteners.js +8 -0
- data/node_modules/browserify/test/module.js +22 -0
- data/node_modules/browserify/test/multi_entry/a.js +2 -0
- data/node_modules/browserify/test/multi_entry/b.js +2 -0
- data/node_modules/browserify/test/multi_entry/c.js +3 -0
- data/node_modules/browserify/test/multi_entry.js +20 -0
- data/node_modules/browserify/test/multi_ignore.js +23 -0
- data/node_modules/browserify/test/node_modules/beep/index.js +1 -0
- data/node_modules/browserify/test/require_cache.js +18 -0
- data/node_modules/browserify/test/retarget.js +27 -0
- data/node_modules/browserify/test/seq.js +47 -0
- data/node_modules/browserify/test/subdep/index.js +1 -0
- data/node_modules/browserify/test/subdep/node_modules/qq/b.js +1 -0
- data/node_modules/browserify/test/subdep/node_modules/qq/ignore_me.js +1 -0
- data/node_modules/browserify/test/subdep/node_modules/qq/node_modules/a/index.js +1 -0
- data/node_modules/browserify/test/subdep/node_modules/qq/node_modules/a/package.json +5 -0
- data/node_modules/browserify/test/subdep/node_modules/qq/node_modules/c/index.js +1 -0
- data/node_modules/browserify/test/subdep/node_modules/qq/node_modules/c/package.json +5 -0
- data/node_modules/browserify/test/subdep/node_modules/qq/node_modules/f/index.js +1 -0
- data/node_modules/browserify/test/subdep/node_modules/qq/node_modules/z/index.js +1 -0
- data/node_modules/browserify/test/subdep/node_modules/qq/package.json +3 -0
- data/node_modules/browserify/test/subdep/package.json +6 -0
- data/node_modules/browserify/test/subdep.js +26 -0
- data/node_modules/browserify/test/util.js +48 -0
- data/node_modules/browserify/test/watch/a.js +1 -0
- data/node_modules/browserify/test/watch.js +91 -0
- data/node_modules/browserify/test/wrap/a.js +2 -0
- data/node_modules/browserify/test/wrap/c.js +1 -0
- data/node_modules/browserify/test/wrap/node_modules/b/main.js +1 -0
- data/node_modules/browserify/test/wrap/node_modules/b/package.json +3 -0
- data/node_modules/browserify/test/wrap/node_modules/skipmetoo/index.js +1 -0
- data/node_modules/browserify/test/wrap/skipme.js +1 -0
- data/node_modules/browserify/test/wrap/x.js +0 -0
- data/node_modules/browserify/test/wrap.js +43 -0
- data/node_modules/browserify/testling/README.markdown +29 -0
- data/node_modules/browserify/testling/test.sh +37 -0
- data/node_modules/browserify/testling/tick.js +9 -0
- data/node_modules/browserify/testling/timers.js +50 -0
- data/node_modules/browserify/testling/util.js +24 -0
- data/node_modules/browserify/v2.markdown +41 -0
- data/node_modules/browserify/wrappers/alias.js +1 -0
- data/node_modules/browserify/wrappers/body.js +2 -0
- data/node_modules/browserify/wrappers/body_debug.js +2 -0
- data/node_modules/browserify/wrappers/entry.js +3 -0
- data/node_modules/browserify/wrappers/entry_debug.js +3 -0
- data/node_modules/browserify/wrappers/package.js +3 -0
- data/node_modules/browserify/wrappers/prelude.js +196 -0
- data/node_modules/module-deps/LICENSE +18 -0
- data/node_modules/module-deps/cmd.js +8 -0
- data/node_modules/module-deps/example/deps.js +8 -0
- data/node_modules/module-deps/example/files/bar.js +3 -0
- data/node_modules/module-deps/example/files/foo.js +5 -0
- data/node_modules/module-deps/example/files/main.js +2 -0
- data/node_modules/module-deps/example/files/xyz.js +2 -0
- data/node_modules/module-deps/index.js +142 -0
- data/node_modules/module-deps/node_modules/browser-resolve/README.md +14 -0
- data/node_modules/module-deps/node_modules/browser-resolve/builtin/assert.js +314 -0
- data/node_modules/module-deps/node_modules/browser-resolve/builtin/child_process.js +2 -0
- data/node_modules/module-deps/node_modules/browser-resolve/builtin/events.js +183 -0
- data/node_modules/module-deps/node_modules/browser-resolve/builtin/fs.js +1 -0
- data/node_modules/module-deps/node_modules/browser-resolve/builtin/https.js +13 -0
- data/node_modules/module-deps/node_modules/browser-resolve/builtin/net.js +1 -0
- data/node_modules/module-deps/node_modules/browser-resolve/builtin/path.js +175 -0
- data/node_modules/module-deps/node_modules/browser-resolve/builtin/process.js +55 -0
- data/node_modules/module-deps/node_modules/browser-resolve/builtin/querystring.js +250 -0
- data/node_modules/module-deps/node_modules/browser-resolve/builtin/stream.js +119 -0
- data/node_modules/module-deps/node_modules/browser-resolve/builtin/string_decoder.js +161 -0
- data/node_modules/module-deps/node_modules/browser-resolve/builtin/sys.js +1 -0
- data/node_modules/module-deps/node_modules/browser-resolve/builtin/timers.js +39 -0
- data/node_modules/module-deps/node_modules/browser-resolve/builtin/tls.js +1 -0
- data/node_modules/module-deps/node_modules/browser-resolve/builtin/tty.js +2 -0
- data/node_modules/module-deps/node_modules/browser-resolve/builtin/url.js +604 -0
- data/node_modules/module-deps/node_modules/browser-resolve/builtin/util.js +351 -0
- data/node_modules/module-deps/node_modules/browser-resolve/index.js +144 -0
- data/node_modules/module-deps/node_modules/browser-resolve/node_modules/buffer-browserify/README.md +11 -0
- data/node_modules/module-deps/node_modules/browser-resolve/node_modules/buffer-browserify/buffer_ieee754.js +84 -0
- data/node_modules/module-deps/node_modules/browser-resolve/node_modules/buffer-browserify/index.js +1282 -0
- data/node_modules/module-deps/node_modules/browser-resolve/node_modules/buffer-browserify/node_modules/base64-js/README.md +14 -0
- data/node_modules/module-deps/node_modules/browser-resolve/node_modules/buffer-browserify/node_modules/base64-js/lib/b64.js +84 -0
- data/node_modules/module-deps/node_modules/browser-resolve/node_modules/buffer-browserify/node_modules/base64-js/package.json +26 -0
- data/node_modules/module-deps/node_modules/browser-resolve/node_modules/buffer-browserify/node_modules/base64-js/test/runner.js +50 -0
- data/node_modules/module-deps/node_modules/browser-resolve/node_modules/buffer-browserify/package.json +42 -0
- data/node_modules/module-deps/node_modules/browser-resolve/node_modules/buffer-browserify/test/buffer.js +121 -0
- data/node_modules/module-deps/node_modules/browser-resolve/node_modules/console-browserify/LICENCE +19 -0
- data/node_modules/module-deps/node_modules/browser-resolve/node_modules/console-browserify/README.md +32 -0
- data/node_modules/module-deps/node_modules/browser-resolve/node_modules/console-browserify/index.js +85 -0
- data/node_modules/module-deps/node_modules/browser-resolve/node_modules/console-browserify/package.json +76 -0
- data/node_modules/module-deps/node_modules/browser-resolve/node_modules/console-browserify/test/index.js +67 -0
- data/node_modules/module-deps/node_modules/browser-resolve/node_modules/console-browserify/test/static/index.html +12 -0
- data/node_modules/module-deps/node_modules/browser-resolve/node_modules/console-browserify/test/static/test-adapter.js +53 -0
- data/node_modules/module-deps/node_modules/browser-resolve/node_modules/crypto-browserify/example/bundle.js +637 -0
- data/node_modules/module-deps/node_modules/browser-resolve/node_modules/crypto-browserify/example/index.html +12 -0
- data/node_modules/module-deps/node_modules/browser-resolve/node_modules/crypto-browserify/example/test.js +4 -0
- data/node_modules/module-deps/node_modules/browser-resolve/node_modules/crypto-browserify/index.js +74 -0
- data/node_modules/module-deps/node_modules/browser-resolve/node_modules/crypto-browserify/md5.js +384 -0
- data/node_modules/module-deps/node_modules/browser-resolve/node_modules/crypto-browserify/package.json +30 -0
- data/node_modules/module-deps/node_modules/browser-resolve/node_modules/crypto-browserify/readme.markdown +20 -0
- data/node_modules/module-deps/node_modules/browser-resolve/node_modules/crypto-browserify/rng.js +37 -0
- data/node_modules/module-deps/node_modules/browser-resolve/node_modules/crypto-browserify/sha.js +210 -0
- data/node_modules/module-deps/node_modules/browser-resolve/node_modules/crypto-browserify/test/simple.js +35 -0
- data/node_modules/module-deps/node_modules/browser-resolve/node_modules/http-browserify/README.markdown +128 -0
- data/node_modules/module-deps/node_modules/browser-resolve/node_modules/http-browserify/example/get/index.html +9 -0
- data/node_modules/module-deps/node_modules/browser-resolve/node_modules/http-browserify/example/get/main.js +14 -0
- data/node_modules/module-deps/node_modules/browser-resolve/node_modules/http-browserify/example/get/server.js +12 -0
- data/node_modules/module-deps/node_modules/browser-resolve/node_modules/http-browserify/example/headers/index.html +9 -0
- data/node_modules/module-deps/node_modules/browser-resolve/node_modules/http-browserify/example/headers/main.js +18 -0
- data/node_modules/module-deps/node_modules/browser-resolve/node_modules/http-browserify/example/headers/server.js +15 -0
- data/node_modules/module-deps/node_modules/browser-resolve/node_modules/http-browserify/example/post/index.html +9 -0
- data/node_modules/module-deps/node_modules/browser-resolve/node_modules/http-browserify/example/post/main.js +16 -0
- data/node_modules/module-deps/node_modules/browser-resolve/node_modules/http-browserify/example/post/server.js +19 -0
- data/node_modules/module-deps/node_modules/browser-resolve/node_modules/http-browserify/example/streaming/index.html +9 -0
- data/node_modules/module-deps/node_modules/browser-resolve/node_modules/http-browserify/example/streaming/main.js +16 -0
- data/node_modules/module-deps/node_modules/browser-resolve/node_modules/http-browserify/example/streaming/server.js +21 -0
- data/node_modules/module-deps/node_modules/browser-resolve/node_modules/http-browserify/index.js +59 -0
- data/node_modules/module-deps/node_modules/browser-resolve/node_modules/http-browserify/lib/request.js +122 -0
- data/node_modules/module-deps/node_modules/browser-resolve/node_modules/http-browserify/lib/response.js +119 -0
- data/node_modules/module-deps/node_modules/browser-resolve/node_modules/http-browserify/node_modules/concat-stream/index.js +48 -0
- data/node_modules/module-deps/node_modules/browser-resolve/node_modules/http-browserify/node_modules/concat-stream/package.json +29 -0
- data/node_modules/module-deps/node_modules/browser-resolve/node_modules/http-browserify/node_modules/concat-stream/readme.md +31 -0
- data/node_modules/module-deps/node_modules/browser-resolve/node_modules/http-browserify/node_modules/concat-stream/test.js +34 -0
- data/node_modules/module-deps/node_modules/browser-resolve/node_modules/http-browserify/package.json +42 -0
- data/node_modules/module-deps/node_modules/browser-resolve/node_modules/vm-browserify/README.markdown +103 -0
- data/node_modules/module-deps/node_modules/browser-resolve/node_modules/vm-browserify/example/run/bundle.js +473 -0
- data/node_modules/module-deps/node_modules/browser-resolve/node_modules/vm-browserify/example/run/entry.js +6 -0
- data/node_modules/module-deps/node_modules/browser-resolve/node_modules/vm-browserify/example/run/index.html +9 -0
- data/node_modules/module-deps/node_modules/browser-resolve/node_modules/vm-browserify/example/run/server.js +6 -0
- data/node_modules/module-deps/node_modules/browser-resolve/node_modules/vm-browserify/index.js +85 -0
- data/node_modules/module-deps/node_modules/browser-resolve/node_modules/vm-browserify/package.json +39 -0
- data/node_modules/module-deps/node_modules/browser-resolve/node_modules/vm-browserify/testling/run.js +22 -0
- data/node_modules/module-deps/node_modules/browser-resolve/node_modules/vm-browserify/testling/test.sh +11 -0
- data/node_modules/module-deps/node_modules/browser-resolve/node_modules/zlib-browserify/index.js +43 -0
- data/node_modules/module-deps/node_modules/browser-resolve/node_modules/zlib-browserify/package.json +33 -0
- data/node_modules/module-deps/node_modules/browser-resolve/node_modules/zlib-browserify/readme.md +1 -0
- data/node_modules/module-deps/node_modules/browser-resolve/node_modules/zlib-browserify/test/zlib.test.js +65 -0
- data/node_modules/module-deps/node_modules/browser-resolve/node_modules/zlib-browserify/zlib.js +55 -0
- data/node_modules/module-deps/node_modules/browser-resolve/package.json +38 -0
- data/node_modules/module-deps/node_modules/browser-resolve/test/core.js +20 -0
- data/node_modules/module-deps/node_modules/browser-resolve/test/fixtures/foo.js +1 -0
- data/node_modules/module-deps/node_modules/browser-resolve/test/local.js +15 -0
- data/node_modules/module-deps/node_modules/browser-resolve/test/mocha.opts +1 -0
- data/node_modules/module-deps/node_modules/browser-resolve/test/modules.js +99 -0
- data/node_modules/module-deps/node_modules/detective/LICENSE +18 -0
- data/node_modules/module-deps/node_modules/detective/example/strings.js +6 -0
- data/node_modules/module-deps/node_modules/detective/example/strings_src.js +3 -0
- data/node_modules/module-deps/node_modules/detective/index.js +62 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/escodegen/LICENSE.BSD +19 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/escodegen/LICENSE.source-map +27 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/escodegen/README.md +99 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/escodegen/bin/escodegen.js +43 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/escodegen/bin/esgenerate.js +43 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/escodegen/escodegen.js +2245 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/escodegen/node_modules/source-map/LICENSE +28 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/escodegen/node_modules/source-map/Makefile.dryice.js +165 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/escodegen/node_modules/source-map/README.md +268 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/escodegen/node_modules/source-map/build/assert-shim.js +56 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/escodegen/node_modules/source-map/build/mini-require.js +152 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/escodegen/node_modules/source-map/build/prefix-source-map.jsm +20 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/escodegen/node_modules/source-map/build/prefix-utils.jsm +18 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/escodegen/node_modules/source-map/build/suffix-browser.js +8 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/escodegen/node_modules/source-map/build/suffix-source-map.jsm +6 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/escodegen/node_modules/source-map/build/suffix-utils.jsm +20 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/escodegen/node_modules/source-map/build/test-prefix.js +8 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/escodegen/node_modules/source-map/build/test-suffix.js +3 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/escodegen/node_modules/source-map/lib/source-map/array-set.js +107 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/escodegen/node_modules/source-map/lib/source-map/base64-vlq.js +144 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/escodegen/node_modules/source-map/lib/source-map/base64.js +42 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/escodegen/node_modules/source-map/lib/source-map/binary-search.js +81 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/escodegen/node_modules/source-map/lib/source-map/source-map-consumer.js +379 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/escodegen/node_modules/source-map/lib/source-map/source-map-generator.js +202 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/escodegen/node_modules/source-map/lib/source-map/source-node.js +199 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/escodegen/node_modules/source-map/lib/source-map/util.js +40 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/escodegen/node_modules/source-map/lib/source-map.js +8 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/escodegen/node_modules/source-map/node_modules/amdefine/LICENSE +58 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/escodegen/node_modules/source-map/node_modules/amdefine/README.md +119 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/escodegen/node_modules/source-map/node_modules/amdefine/amdefine.js +299 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/escodegen/node_modules/source-map/node_modules/amdefine/package.json +29 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/escodegen/node_modules/source-map/package.json +38 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/escodegen/node_modules/source-map/test/run-tests.js +72 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/escodegen/node_modules/source-map/test/source-map/test-api.js +26 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/escodegen/node_modules/source-map/test/source-map/test-array-set.js +71 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/escodegen/node_modules/source-map/test/source-map/test-base64-vlq.js +24 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/escodegen/node_modules/source-map/test/source-map/test-base64.js +35 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/escodegen/node_modules/source-map/test/source-map/test-binary-search.js +54 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/escodegen/node_modules/source-map/test/source-map/test-dog-fooding.js +72 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/escodegen/node_modules/source-map/test/source-map/test-source-map-consumer.js +142 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/escodegen/node_modules/source-map/test/source-map/test-source-map-generator.js +187 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/escodegen/node_modules/source-map/test/source-map/test-source-node.js +163 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/escodegen/node_modules/source-map/test/source-map/util.js +78 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/escodegen/package.json +48 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/esprima/ChangeLog +18 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/esprima/LICENSE.BSD +19 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/esprima/README.md +73 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/esprima/bin/esparse.js +117 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/esprima/bin/esvalidate.js +177 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/esprima/component.json +14 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/esprima/doc/index.html +473 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/esprima/esprima.js +3895 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/esprima/examples/detectnestedternary.js +106 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/esprima/examples/findbooleantrap.js +173 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/esprima/examples/tokendist.js +33 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/esprima/index.html +102 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/esprima/package.json +40 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/esprima/test/benchmarks.html +58 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/esprima/test/benchmarks.js +334 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/esprima/test/compare.html +69 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/esprima/test/compare.js +328 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/esprima/test/compat.html +40 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/esprima/test/compat.js +239 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/esprima/test/coverage.footer.html +3 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/esprima/test/coverage.header.html +37 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/esprima/test/coverage.html +4676 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/esprima/test/index.html +37 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/esprima/test/module.html +36 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/esprima/test/module.js +129 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/esprima/test/reflect.js +422 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/esprima/test/run.js +66 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/esprima/test/runner.js +387 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/esprima/test/test.js +19764 -0
- data/node_modules/module-deps/node_modules/detective/package.json +36 -0
- data/node_modules/module-deps/node_modules/detective/readme.markdown +70 -0
- data/node_modules/module-deps/node_modules/detective/test/both.js +11 -0
- data/node_modules/module-deps/node_modules/detective/test/chained.js +9 -0
- data/node_modules/module-deps/node_modules/detective/test/files/both.js +4 -0
- data/node_modules/module-deps/node_modules/detective/test/files/chained.js +5 -0
- data/node_modules/module-deps/node_modules/detective/test/files/nested.js +22 -0
- data/node_modules/module-deps/node_modules/detective/test/files/shebang.js +5 -0
- data/node_modules/module-deps/node_modules/detective/test/files/strings.js +13 -0
- data/node_modules/module-deps/node_modules/detective/test/files/word.js +13 -0
- data/node_modules/module-deps/node_modules/detective/test/nested.js +9 -0
- data/node_modules/module-deps/node_modules/detective/test/shebang.js +9 -0
- data/node_modules/module-deps/node_modules/detective/test/strings.js +9 -0
- data/node_modules/module-deps/node_modules/detective/test/word.js +12 -0
- data/node_modules/module-deps/node_modules/resolve/LICENSE +18 -0
- data/node_modules/module-deps/node_modules/resolve/example/async.js +5 -0
- data/node_modules/module-deps/node_modules/resolve/example/sync.js +3 -0
- data/node_modules/module-deps/node_modules/resolve/index.js +5 -0
- data/node_modules/module-deps/node_modules/resolve/lib/async.js +131 -0
- data/node_modules/module-deps/node_modules/resolve/lib/core.js +4 -0
- data/node_modules/module-deps/node_modules/resolve/lib/core.json +38 -0
- data/node_modules/module-deps/node_modules/resolve/lib/sync.js +98 -0
- data/node_modules/module-deps/node_modules/resolve/package.json +32 -0
- data/node_modules/module-deps/node_modules/resolve/readme.markdown +134 -0
- data/node_modules/module-deps/node_modules/resolve/test/core.js +12 -0
- data/node_modules/module-deps/node_modules/resolve/test/filter.js +17 -0
- data/node_modules/module-deps/node_modules/resolve/test/filter_sync.js +15 -0
- data/node_modules/module-deps/node_modules/resolve/test/mock.js +68 -0
- data/node_modules/module-deps/node_modules/resolve/test/mock_sync.js +68 -0
- data/node_modules/module-deps/node_modules/resolve/test/resolver/bar/node_modules/foo/index.js +1 -0
- data/node_modules/module-deps/node_modules/resolve/test/resolver/baz/doom.js +0 -0
- data/node_modules/module-deps/node_modules/resolve/test/resolver/baz/package.json +3 -0
- data/node_modules/module-deps/node_modules/resolve/test/resolver/baz/quux.js +1 -0
- data/node_modules/module-deps/node_modules/resolve/test/resolver/biz/node_modules/grux/index.js +1 -0
- data/node_modules/module-deps/node_modules/resolve/test/resolver/biz/node_modules/tiv/index.js +1 -0
- data/node_modules/module-deps/node_modules/resolve/test/resolver/cup.coffee +1 -0
- data/node_modules/module-deps/node_modules/resolve/test/resolver/foo.js +1 -0
- data/node_modules/module-deps/node_modules/resolve/test/resolver/mug.coffee +0 -0
- data/node_modules/module-deps/node_modules/resolve/test/resolver/mug.js +0 -0
- data/node_modules/module-deps/node_modules/resolve/test/resolver/other_path/lib/other-lib.js +0 -0
- data/node_modules/module-deps/node_modules/resolve/test/resolver/other_path/root.js +0 -0
- data/node_modules/module-deps/node_modules/resolve/test/resolver.js +144 -0
- data/node_modules/module-deps/node_modules/resolve/test/resolver_sync.js +157 -0
- data/node_modules/module-deps/package.json +47 -0
- data/node_modules/module-deps/readme.markdown +128 -0
- data/node_modules/module-deps/test/bundle.js +21 -0
- data/node_modules/module-deps/test/deps.js +42 -0
- data/node_modules/module-deps/test/files/bar.js +3 -0
- data/node_modules/module-deps/test/files/foo.js +5 -0
- data/node_modules/module-deps/test/files/main.js +2 -0
- data/node_modules/module-deps/test/files/tr_module/f.js +1 -0
- data/node_modules/module-deps/test/files/tr_module/main.js +7 -0
- data/node_modules/module-deps/test/files/tr_module/node_modules/g/index.js +1 -0
- data/node_modules/module-deps/test/files/tr_module/node_modules/g/node_modules/insert-ggg/index.js +7 -0
- data/node_modules/module-deps/test/files/tr_module/node_modules/g/package.json +6 -0
- data/node_modules/module-deps/test/files/tr_module/node_modules/insert-aaa/index.js +7 -0
- data/node_modules/module-deps/test/files/tr_module/node_modules/insert-bbb/index.js +7 -0
- data/node_modules/module-deps/test/files/tr_module/node_modules/m/index.js +3 -0
- data/node_modules/module-deps/test/files/tr_sh/f.js +1 -0
- data/node_modules/module-deps/test/files/tr_sh/main.js +7 -0
- data/node_modules/module-deps/test/files/tr_sh/node_modules/g/index.js +1 -0
- data/node_modules/module-deps/test/files/tr_sh/node_modules/g/package.json +6 -0
- data/node_modules/module-deps/test/files/tr_sh/node_modules/g/tr_g.js +6 -0
- data/node_modules/module-deps/test/files/tr_sh/node_modules/m/index.js +3 -0
- data/node_modules/module-deps/test/files/tr_sh/tr_a.js +6 -0
- data/node_modules/module-deps/test/files/tr_sh/tr_b.js +6 -0
- data/node_modules/module-deps/test/files/xyz.js +2 -0
- data/node_modules/module-deps/test/tr_fn.js +29 -0
- data/node_modules/module-deps/test/tr_module.js +21 -0
- data/node_modules/module-deps/test/tr_sh.js +21 -0
- data/node_modules/through/LICENSE.APACHE2 +15 -0
- data/node_modules/through/LICENSE.MIT +24 -0
- data/node_modules/through/index.js +103 -0
- data/node_modules/through/package.json +35 -0
- data/node_modules/through/readme.markdown +43 -0
- data/node_modules/through/test/buffering.js +71 -0
- data/node_modules/through/test/end.js +27 -0
- data/node_modules/through/test/index.js +113 -0
- data/package.json +11 -0
- metadata +846 -0
@@ -0,0 +1,2245 @@
|
|
1
|
+
/*
|
2
|
+
Copyright (C) 2012 Michael Ficarra <escodegen.copyright@michael.ficarra.me>
|
3
|
+
Copyright (C) 2012 Robert Gust-Bardon <donate@robert.gust-bardon.org>
|
4
|
+
Copyright (C) 2012 John Freeman <jfreeman08@gmail.com>
|
5
|
+
Copyright (C) 2011-2012 Ariya Hidayat <ariya.hidayat@gmail.com>
|
6
|
+
Copyright (C) 2012 Mathias Bynens <mathias@qiwi.be>
|
7
|
+
Copyright (C) 2012 Joost-Wim Boekesteijn <joost-wim@boekesteijn.nl>
|
8
|
+
Copyright (C) 2012 Kris Kowal <kris.kowal@cixar.com>
|
9
|
+
Copyright (C) 2012 Yusuke Suzuki <utatane.tea@gmail.com>
|
10
|
+
Copyright (C) 2012 Arpad Borsos <arpad.borsos@googlemail.com>
|
11
|
+
|
12
|
+
Redistribution and use in source and binary forms, with or without
|
13
|
+
modification, are permitted provided that the following conditions are met:
|
14
|
+
|
15
|
+
* Redistributions of source code must retain the above copyright
|
16
|
+
notice, this list of conditions and the following disclaimer.
|
17
|
+
* Redistributions in binary form must reproduce the above copyright
|
18
|
+
notice, this list of conditions and the following disclaimer in the
|
19
|
+
documentation and/or other materials provided with the distribution.
|
20
|
+
|
21
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
22
|
+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
23
|
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
24
|
+
ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
|
25
|
+
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
26
|
+
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
27
|
+
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
28
|
+
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
29
|
+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
30
|
+
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
31
|
+
*/
|
32
|
+
|
33
|
+
/*jslint bitwise:true */
|
34
|
+
/*global escodegen:true, exports:true, generateStatement:true, generateExpression:true, generateFunctionBody:true, process:true, require:true, define:true*/
|
35
|
+
|
36
|
+
(function (factory, global) {
|
37
|
+
'use strict';
|
38
|
+
|
39
|
+
// Universal Module Definition (UMD) to support AMD, CommonJS/Node.js,
|
40
|
+
// and plain browser loading,
|
41
|
+
if (typeof define === 'function' && define.amd) {
|
42
|
+
define(['exports'], function (exports) {
|
43
|
+
factory(exports, global);
|
44
|
+
});
|
45
|
+
} else if (typeof exports !== 'undefined') {
|
46
|
+
factory(exports, global);
|
47
|
+
} else {
|
48
|
+
factory((global.escodegen = {}), global);
|
49
|
+
}
|
50
|
+
}(function (exports, global) {
|
51
|
+
'use strict';
|
52
|
+
|
53
|
+
var Syntax,
|
54
|
+
Precedence,
|
55
|
+
BinaryPrecedence,
|
56
|
+
Regex,
|
57
|
+
VisitorKeys,
|
58
|
+
VisitorOption,
|
59
|
+
SourceNode,
|
60
|
+
isArray,
|
61
|
+
base,
|
62
|
+
indent,
|
63
|
+
json,
|
64
|
+
renumber,
|
65
|
+
hexadecimal,
|
66
|
+
quotes,
|
67
|
+
escapeless,
|
68
|
+
newline,
|
69
|
+
space,
|
70
|
+
parentheses,
|
71
|
+
semicolons,
|
72
|
+
safeConcatenation,
|
73
|
+
directive,
|
74
|
+
extra,
|
75
|
+
parse,
|
76
|
+
sourceMap;
|
77
|
+
|
78
|
+
Syntax = {
|
79
|
+
AssignmentExpression: 'AssignmentExpression',
|
80
|
+
ArrayExpression: 'ArrayExpression',
|
81
|
+
ArrayPattern: 'ArrayPattern',
|
82
|
+
BlockStatement: 'BlockStatement',
|
83
|
+
BinaryExpression: 'BinaryExpression',
|
84
|
+
BreakStatement: 'BreakStatement',
|
85
|
+
CallExpression: 'CallExpression',
|
86
|
+
CatchClause: 'CatchClause',
|
87
|
+
ComprehensionBlock: 'ComprehensionBlock',
|
88
|
+
ComprehensionExpression: 'ComprehensionExpression',
|
89
|
+
ConditionalExpression: 'ConditionalExpression',
|
90
|
+
ContinueStatement: 'ContinueStatement',
|
91
|
+
DirectiveStatement: 'DirectiveStatement',
|
92
|
+
DoWhileStatement: 'DoWhileStatement',
|
93
|
+
DebuggerStatement: 'DebuggerStatement',
|
94
|
+
EmptyStatement: 'EmptyStatement',
|
95
|
+
ExpressionStatement: 'ExpressionStatement',
|
96
|
+
ForStatement: 'ForStatement',
|
97
|
+
ForInStatement: 'ForInStatement',
|
98
|
+
FunctionDeclaration: 'FunctionDeclaration',
|
99
|
+
FunctionExpression: 'FunctionExpression',
|
100
|
+
Identifier: 'Identifier',
|
101
|
+
IfStatement: 'IfStatement',
|
102
|
+
Literal: 'Literal',
|
103
|
+
LabeledStatement: 'LabeledStatement',
|
104
|
+
LogicalExpression: 'LogicalExpression',
|
105
|
+
MemberExpression: 'MemberExpression',
|
106
|
+
NewExpression: 'NewExpression',
|
107
|
+
ObjectExpression: 'ObjectExpression',
|
108
|
+
ObjectPattern: 'ObjectPattern',
|
109
|
+
Program: 'Program',
|
110
|
+
Property: 'Property',
|
111
|
+
ReturnStatement: 'ReturnStatement',
|
112
|
+
SequenceExpression: 'SequenceExpression',
|
113
|
+
SwitchStatement: 'SwitchStatement',
|
114
|
+
SwitchCase: 'SwitchCase',
|
115
|
+
ThisExpression: 'ThisExpression',
|
116
|
+
ThrowStatement: 'ThrowStatement',
|
117
|
+
TryStatement: 'TryStatement',
|
118
|
+
UnaryExpression: 'UnaryExpression',
|
119
|
+
UpdateExpression: 'UpdateExpression',
|
120
|
+
VariableDeclaration: 'VariableDeclaration',
|
121
|
+
VariableDeclarator: 'VariableDeclarator',
|
122
|
+
WhileStatement: 'WhileStatement',
|
123
|
+
WithStatement: 'WithStatement',
|
124
|
+
YieldExpression: 'YieldExpression',
|
125
|
+
|
126
|
+
};
|
127
|
+
|
128
|
+
Precedence = {
|
129
|
+
Sequence: 0,
|
130
|
+
Assignment: 1,
|
131
|
+
Conditional: 2,
|
132
|
+
LogicalOR: 3,
|
133
|
+
LogicalAND: 4,
|
134
|
+
BitwiseOR: 5,
|
135
|
+
BitwiseXOR: 6,
|
136
|
+
BitwiseAND: 7,
|
137
|
+
Equality: 8,
|
138
|
+
Relational: 9,
|
139
|
+
BitwiseSHIFT: 10,
|
140
|
+
Additive: 11,
|
141
|
+
Multiplicative: 12,
|
142
|
+
Unary: 13,
|
143
|
+
Postfix: 14,
|
144
|
+
Call: 15,
|
145
|
+
New: 16,
|
146
|
+
Member: 17,
|
147
|
+
Primary: 18
|
148
|
+
};
|
149
|
+
|
150
|
+
BinaryPrecedence = {
|
151
|
+
'||': Precedence.LogicalOR,
|
152
|
+
'&&': Precedence.LogicalAND,
|
153
|
+
'|': Precedence.BitwiseOR,
|
154
|
+
'^': Precedence.BitwiseXOR,
|
155
|
+
'&': Precedence.BitwiseAND,
|
156
|
+
'==': Precedence.Equality,
|
157
|
+
'!=': Precedence.Equality,
|
158
|
+
'===': Precedence.Equality,
|
159
|
+
'!==': Precedence.Equality,
|
160
|
+
'is': Precedence.Equality,
|
161
|
+
'isnt': Precedence.Equality,
|
162
|
+
'<': Precedence.Relational,
|
163
|
+
'>': Precedence.Relational,
|
164
|
+
'<=': Precedence.Relational,
|
165
|
+
'>=': Precedence.Relational,
|
166
|
+
'in': Precedence.Relational,
|
167
|
+
'instanceof': Precedence.Relational,
|
168
|
+
'<<': Precedence.BitwiseSHIFT,
|
169
|
+
'>>': Precedence.BitwiseSHIFT,
|
170
|
+
'>>>': Precedence.BitwiseSHIFT,
|
171
|
+
'+': Precedence.Additive,
|
172
|
+
'-': Precedence.Additive,
|
173
|
+
'*': Precedence.Multiplicative,
|
174
|
+
'%': Precedence.Multiplicative,
|
175
|
+
'/': Precedence.Multiplicative
|
176
|
+
};
|
177
|
+
|
178
|
+
Regex = {
|
179
|
+
NonAsciiIdentifierPart: new RegExp('[\xaa\xb5\xba\xc0-\xd6\xd8-\xf6\xf8-\u02c1\u02c6-\u02d1\u02e0-\u02e4\u02ec\u02ee\u0300-\u0374\u0376\u0377\u037a-\u037d\u0386\u0388-\u038a\u038c\u038e-\u03a1\u03a3-\u03f5\u03f7-\u0481\u0483-\u0487\u048a-\u0527\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u05d0-\u05ea\u05f0-\u05f2\u0610-\u061a\u0620-\u0669\u066e-\u06d3\u06d5-\u06dc\u06df-\u06e8\u06ea-\u06fc\u06ff\u0710-\u074a\u074d-\u07b1\u07c0-\u07f5\u07fa\u0800-\u082d\u0840-\u085b\u08a0\u08a2-\u08ac\u08e4-\u08fe\u0900-\u0963\u0966-\u096f\u0971-\u0977\u0979-\u097f\u0981-\u0983\u0985-\u098c\u098f\u0990\u0993-\u09a8\u09aa-\u09b0\u09b2\u09b6-\u09b9\u09bc-\u09c4\u09c7\u09c8\u09cb-\u09ce\u09d7\u09dc\u09dd\u09df-\u09e3\u09e6-\u09f1\u0a01-\u0a03\u0a05-\u0a0a\u0a0f\u0a10\u0a13-\u0a28\u0a2a-\u0a30\u0a32\u0a33\u0a35\u0a36\u0a38\u0a39\u0a3c\u0a3e-\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a59-\u0a5c\u0a5e\u0a66-\u0a75\u0a81-\u0a83\u0a85-\u0a8d\u0a8f-\u0a91\u0a93-\u0aa8\u0aaa-\u0ab0\u0ab2\u0ab3\u0ab5-\u0ab9\u0abc-\u0ac5\u0ac7-\u0ac9\u0acb-\u0acd\u0ad0\u0ae0-\u0ae3\u0ae6-\u0aef\u0b01-\u0b03\u0b05-\u0b0c\u0b0f\u0b10\u0b13-\u0b28\u0b2a-\u0b30\u0b32\u0b33\u0b35-\u0b39\u0b3c-\u0b44\u0b47\u0b48\u0b4b-\u0b4d\u0b56\u0b57\u0b5c\u0b5d\u0b5f-\u0b63\u0b66-\u0b6f\u0b71\u0b82\u0b83\u0b85-\u0b8a\u0b8e-\u0b90\u0b92-\u0b95\u0b99\u0b9a\u0b9c\u0b9e\u0b9f\u0ba3\u0ba4\u0ba8-\u0baa\u0bae-\u0bb9\u0bbe-\u0bc2\u0bc6-\u0bc8\u0bca-\u0bcd\u0bd0\u0bd7\u0be6-\u0bef\u0c01-\u0c03\u0c05-\u0c0c\u0c0e-\u0c10\u0c12-\u0c28\u0c2a-\u0c33\u0c35-\u0c39\u0c3d-\u0c44\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c58\u0c59\u0c60-\u0c63\u0c66-\u0c6f\u0c82\u0c83\u0c85-\u0c8c\u0c8e-\u0c90\u0c92-\u0ca8\u0caa-\u0cb3\u0cb5-\u0cb9\u0cbc-\u0cc4\u0cc6-\u0cc8\u0cca-\u0ccd\u0cd5\u0cd6\u0cde\u0ce0-\u0ce3\u0ce6-\u0cef\u0cf1\u0cf2\u0d02\u0d03\u0d05-\u0d0c\u0d0e-\u0d10\u0d12-\u0d3a\u0d3d-\u0d44\u0d46-\u0d48\u0d4a-\u0d4e\u0d57\u0d60-\u0d63\u0d66-\u0d6f\u0d7a-\u0d7f\u0d82\u0d83\u0d85-\u0d96\u0d9a-\u0db1\u0db3-\u0dbb\u0dbd\u0dc0-\u0dc6\u0dca\u0dcf-\u0dd4\u0dd6\u0dd8-\u0ddf\u0df2\u0df3\u0e01-\u0e3a\u0e40-\u0e4e\u0e50-\u0e59\u0e81\u0e82\u0e84\u0e87\u0e88\u0e8a\u0e8d\u0e94-\u0e97\u0e99-\u0e9f\u0ea1-\u0ea3\u0ea5\u0ea7\u0eaa\u0eab\u0ead-\u0eb9\u0ebb-\u0ebd\u0ec0-\u0ec4\u0ec6\u0ec8-\u0ecd\u0ed0-\u0ed9\u0edc-\u0edf\u0f00\u0f18\u0f19\u0f20-\u0f29\u0f35\u0f37\u0f39\u0f3e-\u0f47\u0f49-\u0f6c\u0f71-\u0f84\u0f86-\u0f97\u0f99-\u0fbc\u0fc6\u1000-\u1049\u1050-\u109d\u10a0-\u10c5\u10c7\u10cd\u10d0-\u10fa\u10fc-\u1248\u124a-\u124d\u1250-\u1256\u1258\u125a-\u125d\u1260-\u1288\u128a-\u128d\u1290-\u12b0\u12b2-\u12b5\u12b8-\u12be\u12c0\u12c2-\u12c5\u12c8-\u12d6\u12d8-\u1310\u1312-\u1315\u1318-\u135a\u135d-\u135f\u1380-\u138f\u13a0-\u13f4\u1401-\u166c\u166f-\u167f\u1681-\u169a\u16a0-\u16ea\u16ee-\u16f0\u1700-\u170c\u170e-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176c\u176e-\u1770\u1772\u1773\u1780-\u17d3\u17d7\u17dc\u17dd\u17e0-\u17e9\u180b-\u180d\u1810-\u1819\u1820-\u1877\u1880-\u18aa\u18b0-\u18f5\u1900-\u191c\u1920-\u192b\u1930-\u193b\u1946-\u196d\u1970-\u1974\u1980-\u19ab\u19b0-\u19c9\u19d0-\u19d9\u1a00-\u1a1b\u1a20-\u1a5e\u1a60-\u1a7c\u1a7f-\u1a89\u1a90-\u1a99\u1aa7\u1b00-\u1b4b\u1b50-\u1b59\u1b6b-\u1b73\u1b80-\u1bf3\u1c00-\u1c37\u1c40-\u1c49\u1c4d-\u1c7d\u1cd0-\u1cd2\u1cd4-\u1cf6\u1d00-\u1de6\u1dfc-\u1f15\u1f18-\u1f1d\u1f20-\u1f45\u1f48-\u1f4d\u1f50-\u1f57\u1f59\u1f5b\u1f5d\u1f5f-\u1f7d\u1f80-\u1fb4\u1fb6-\u1fbc\u1fbe\u1fc2-\u1fc4\u1fc6-\u1fcc\u1fd0-\u1fd3\u1fd6-\u1fdb\u1fe0-\u1fec\u1ff2-\u1ff4\u1ff6-\u1ffc\u200c\u200d\u203f\u2040\u2054\u2071\u207f\u2090-\u209c\u20d0-\u20dc\u20e1\u20e5-\u20f0\u2102\u2107\u210a-\u2113\u2115\u2119-\u211d\u2124\u2126\u2128\u212a-\u212d\u212f-\u2139\u213c-\u213f\u2145-\u2149\u214e\u2160-\u2188\u2c00-\u2c2e\u2c30-\u2c5e\u2c60-\u2ce4\u2ceb-\u2cf3\u2d00-\u2d25\u2d27\u2d2d\u2d30-\u2d67\u2d6f\u2d7f-\u2d96\u2da0-\u2da6\u2da8-\u2dae\u2db0-\u2db6\u2db8-\u2dbe\u2dc0-\u2dc6\u2dc8-\u2dce\u2dd0-\u2dd6\u2dd8-\u2dde\u2de0-\u2dff\u2e2f\u3005-\u3007\u3021-\u302f\u3031-\u3035\u3038-\u303c\u3041-\u3096\u3099\u309a\u309d-\u309f\u30a1-\u30fa\u30fc-\u30ff\u3105-\u312d\u3131-\u318e\u31a0-\u31ba\u31f0-\u31ff\u3400-\u4db5\u4e00-\u9fcc\ua000-\ua48c\ua4d0-\ua4fd\ua500-\ua60c\ua610-\ua62b\ua640-\ua66f\ua674-\ua67d\ua67f-\ua697\ua69f-\ua6f1\ua717-\ua71f\ua722-\ua788\ua78b-\ua78e\ua790-\ua793\ua7a0-\ua7aa\ua7f8-\ua827\ua840-\ua873\ua880-\ua8c4\ua8d0-\ua8d9\ua8e0-\ua8f7\ua8fb\ua900-\ua92d\ua930-\ua953\ua960-\ua97c\ua980-\ua9c0\ua9cf-\ua9d9\uaa00-\uaa36\uaa40-\uaa4d\uaa50-\uaa59\uaa60-\uaa76\uaa7a\uaa7b\uaa80-\uaac2\uaadb-\uaadd\uaae0-\uaaef\uaaf2-\uaaf6\uab01-\uab06\uab09-\uab0e\uab11-\uab16\uab20-\uab26\uab28-\uab2e\uabc0-\uabea\uabec\uabed\uabf0-\uabf9\uac00-\ud7a3\ud7b0-\ud7c6\ud7cb-\ud7fb\uf900-\ufa6d\ufa70-\ufad9\ufb00-\ufb06\ufb13-\ufb17\ufb1d-\ufb28\ufb2a-\ufb36\ufb38-\ufb3c\ufb3e\ufb40\ufb41\ufb43\ufb44\ufb46-\ufbb1\ufbd3-\ufd3d\ufd50-\ufd8f\ufd92-\ufdc7\ufdf0-\ufdfb\ufe00-\ufe0f\ufe20-\ufe26\ufe33\ufe34\ufe4d-\ufe4f\ufe70-\ufe74\ufe76-\ufefc\uff10-\uff19\uff21-\uff3a\uff3f\uff41-\uff5a\uff66-\uffbe\uffc2-\uffc7\uffca-\uffcf\uffd2-\uffd7\uffda-\uffdc]')
|
180
|
+
};
|
181
|
+
|
182
|
+
function getDefaultOptions() {
|
183
|
+
// default options
|
184
|
+
return {
|
185
|
+
indent: null,
|
186
|
+
base: null,
|
187
|
+
parse: null,
|
188
|
+
comment: false,
|
189
|
+
format: {
|
190
|
+
indent: {
|
191
|
+
style: ' ',
|
192
|
+
base: 0,
|
193
|
+
adjustMultilineComment: false
|
194
|
+
},
|
195
|
+
json: false,
|
196
|
+
renumber: false,
|
197
|
+
hexadecimal: false,
|
198
|
+
quotes: 'single',
|
199
|
+
escapeless: false,
|
200
|
+
compact: false,
|
201
|
+
parentheses: true,
|
202
|
+
semicolons: true,
|
203
|
+
safeConcatenation: false
|
204
|
+
},
|
205
|
+
moz: {
|
206
|
+
starlessGenerator: false,
|
207
|
+
parenthesizedComprehensionBlock: false
|
208
|
+
},
|
209
|
+
sourceMap: null,
|
210
|
+
sourceMapWithCode: false,
|
211
|
+
directive: false,
|
212
|
+
verbatim: null
|
213
|
+
};
|
214
|
+
}
|
215
|
+
|
216
|
+
function stringToArray(str) {
|
217
|
+
var length = str.length,
|
218
|
+
result = [],
|
219
|
+
i;
|
220
|
+
for (i = 0; i < length; i += 1) {
|
221
|
+
result[i] = str.charAt(i);
|
222
|
+
}
|
223
|
+
return result;
|
224
|
+
}
|
225
|
+
|
226
|
+
function stringRepeat(str, num) {
|
227
|
+
var result = '';
|
228
|
+
|
229
|
+
for (num |= 0; num > 0; num >>>= 1, str += str) {
|
230
|
+
if (num & 1) {
|
231
|
+
result += str;
|
232
|
+
}
|
233
|
+
}
|
234
|
+
|
235
|
+
return result;
|
236
|
+
}
|
237
|
+
|
238
|
+
isArray = Array.isArray;
|
239
|
+
if (!isArray) {
|
240
|
+
isArray = function isArray(array) {
|
241
|
+
return Object.prototype.toString.call(array) === '[object Array]';
|
242
|
+
};
|
243
|
+
}
|
244
|
+
|
245
|
+
// Fallback for the non SourceMap environment
|
246
|
+
function SourceNodeMock(line, column, filename, chunk) {
|
247
|
+
var result = [];
|
248
|
+
|
249
|
+
function flatten(input) {
|
250
|
+
var i, iz;
|
251
|
+
if (isArray(input)) {
|
252
|
+
for (i = 0, iz = input.length; i < iz; ++i) {
|
253
|
+
flatten(input[i]);
|
254
|
+
}
|
255
|
+
} else if (input instanceof SourceNodeMock) {
|
256
|
+
result.push(input);
|
257
|
+
} else if (typeof input === 'string' && input) {
|
258
|
+
result.push(input);
|
259
|
+
}
|
260
|
+
}
|
261
|
+
|
262
|
+
flatten(chunk);
|
263
|
+
this.children = result;
|
264
|
+
}
|
265
|
+
|
266
|
+
SourceNodeMock.prototype.toString = function toString() {
|
267
|
+
var res = '', i, iz, node;
|
268
|
+
for (i = 0, iz = this.children.length; i < iz; ++i) {
|
269
|
+
node = this.children[i];
|
270
|
+
if (node instanceof SourceNodeMock) {
|
271
|
+
res += node.toString();
|
272
|
+
} else {
|
273
|
+
res += node;
|
274
|
+
}
|
275
|
+
}
|
276
|
+
return res;
|
277
|
+
};
|
278
|
+
|
279
|
+
SourceNodeMock.prototype.replaceRight = function replaceRight(pattern, replacement) {
|
280
|
+
var last = this.children[this.children.length - 1];
|
281
|
+
if (last instanceof SourceNodeMock) {
|
282
|
+
last.replaceRight(pattern, replacement);
|
283
|
+
} else if (typeof last === 'string') {
|
284
|
+
this.children[this.children.length - 1] = last.replace(pattern, replacement);
|
285
|
+
} else {
|
286
|
+
this.children.push(''.replace(pattern, replacement));
|
287
|
+
}
|
288
|
+
return this;
|
289
|
+
};
|
290
|
+
|
291
|
+
SourceNodeMock.prototype.join = function join(sep) {
|
292
|
+
var i, iz, result;
|
293
|
+
result = [];
|
294
|
+
iz = this.children.length;
|
295
|
+
if (iz > 0) {
|
296
|
+
for (i = 0, iz -= 1; i < iz; ++i) {
|
297
|
+
result.push(this.children[i], sep);
|
298
|
+
}
|
299
|
+
result.push(this.children[iz]);
|
300
|
+
this.children = result;
|
301
|
+
}
|
302
|
+
return this;
|
303
|
+
};
|
304
|
+
|
305
|
+
function hasLineTerminator(str) {
|
306
|
+
return /[\r\n]/g.test(str);
|
307
|
+
}
|
308
|
+
|
309
|
+
function endsWithLineTerminator(str) {
|
310
|
+
var ch = str.charAt(str.length - 1);
|
311
|
+
return ch === '\r' || ch === '\n';
|
312
|
+
}
|
313
|
+
|
314
|
+
function shallowCopy(obj) {
|
315
|
+
var ret = {}, key;
|
316
|
+
for (key in obj) {
|
317
|
+
if (obj.hasOwnProperty(key)) {
|
318
|
+
ret[key] = obj[key];
|
319
|
+
}
|
320
|
+
}
|
321
|
+
return ret;
|
322
|
+
}
|
323
|
+
|
324
|
+
function deepCopy(obj) {
|
325
|
+
var ret = {}, key, val;
|
326
|
+
for (key in obj) {
|
327
|
+
if (obj.hasOwnProperty(key)) {
|
328
|
+
val = obj[key];
|
329
|
+
if (typeof val === 'object' && val !== null) {
|
330
|
+
ret[key] = deepCopy(val);
|
331
|
+
} else {
|
332
|
+
ret[key] = val;
|
333
|
+
}
|
334
|
+
}
|
335
|
+
}
|
336
|
+
return ret;
|
337
|
+
}
|
338
|
+
|
339
|
+
function updateDeeply(target, override) {
|
340
|
+
var key, val;
|
341
|
+
|
342
|
+
function isHashObject(target) {
|
343
|
+
return typeof target === 'object' && target instanceof Object && !(target instanceof RegExp);
|
344
|
+
}
|
345
|
+
|
346
|
+
for (key in override) {
|
347
|
+
if (override.hasOwnProperty(key)) {
|
348
|
+
val = override[key];
|
349
|
+
if (isHashObject(val)) {
|
350
|
+
if (isHashObject(target[key])) {
|
351
|
+
updateDeeply(target[key], val);
|
352
|
+
} else {
|
353
|
+
target[key] = updateDeeply({}, val);
|
354
|
+
}
|
355
|
+
} else {
|
356
|
+
target[key] = val;
|
357
|
+
}
|
358
|
+
}
|
359
|
+
}
|
360
|
+
return target;
|
361
|
+
}
|
362
|
+
|
363
|
+
function generateNumber(value) {
|
364
|
+
var result, point, temp, exponent, pos;
|
365
|
+
|
366
|
+
if (value !== value) {
|
367
|
+
throw new Error('Numeric literal whose value is NaN');
|
368
|
+
}
|
369
|
+
if (value < 0 || (value === 0 && 1 / value < 0)) {
|
370
|
+
throw new Error('Numeric literal whose value is negative');
|
371
|
+
}
|
372
|
+
|
373
|
+
if (value === 1 / 0) {
|
374
|
+
return json ? 'null' : renumber ? '1e400' : '1e+400';
|
375
|
+
}
|
376
|
+
|
377
|
+
result = '' + value;
|
378
|
+
if (!renumber || result.length < 3) {
|
379
|
+
return result;
|
380
|
+
}
|
381
|
+
|
382
|
+
point = result.indexOf('.');
|
383
|
+
if (!json && result.charAt(0) === '0' && point === 1) {
|
384
|
+
point = 0;
|
385
|
+
result = result.slice(1);
|
386
|
+
}
|
387
|
+
temp = result;
|
388
|
+
result = result.replace('e+', 'e');
|
389
|
+
exponent = 0;
|
390
|
+
if ((pos = temp.indexOf('e')) > 0) {
|
391
|
+
exponent = +temp.slice(pos + 1);
|
392
|
+
temp = temp.slice(0, pos);
|
393
|
+
}
|
394
|
+
if (point >= 0) {
|
395
|
+
exponent -= temp.length - point - 1;
|
396
|
+
temp = +(temp.slice(0, point) + temp.slice(point + 1)) + '';
|
397
|
+
}
|
398
|
+
pos = 0;
|
399
|
+
while (temp.charAt(temp.length + pos - 1) === '0') {
|
400
|
+
pos -= 1;
|
401
|
+
}
|
402
|
+
if (pos !== 0) {
|
403
|
+
exponent -= pos;
|
404
|
+
temp = temp.slice(0, pos);
|
405
|
+
}
|
406
|
+
if (exponent !== 0) {
|
407
|
+
temp += 'e' + exponent;
|
408
|
+
}
|
409
|
+
if ((temp.length < result.length ||
|
410
|
+
(hexadecimal && value > 1e12 && Math.floor(value) === value && (temp = '0x' + value.toString(16)).length < result.length)) &&
|
411
|
+
+temp === value) {
|
412
|
+
result = temp;
|
413
|
+
}
|
414
|
+
|
415
|
+
return result;
|
416
|
+
}
|
417
|
+
|
418
|
+
function escapeAllowedCharacter(ch, next) {
|
419
|
+
var code = ch.charCodeAt(0), hex = code.toString(16), result = '\\';
|
420
|
+
|
421
|
+
switch (ch) {
|
422
|
+
case '\b':
|
423
|
+
result += 'b';
|
424
|
+
break;
|
425
|
+
case '\f':
|
426
|
+
result += 'f';
|
427
|
+
break;
|
428
|
+
case '\t':
|
429
|
+
result += 't';
|
430
|
+
break;
|
431
|
+
default:
|
432
|
+
if (json || code > 0xff) {
|
433
|
+
result += 'u' + '0000'.slice(hex.length) + hex;
|
434
|
+
} else if (ch === '\u0000' && '0123456789'.indexOf(next) < 0) {
|
435
|
+
result += '0';
|
436
|
+
} else if (ch === '\v') {
|
437
|
+
result += 'v';
|
438
|
+
} else {
|
439
|
+
result += 'x' + '00'.slice(hex.length) + hex;
|
440
|
+
}
|
441
|
+
break;
|
442
|
+
}
|
443
|
+
|
444
|
+
return result;
|
445
|
+
}
|
446
|
+
|
447
|
+
function escapeDisallowedCharacter(ch) {
|
448
|
+
var result = '\\';
|
449
|
+
switch (ch) {
|
450
|
+
case '\\':
|
451
|
+
result += '\\';
|
452
|
+
break;
|
453
|
+
case '\n':
|
454
|
+
result += 'n';
|
455
|
+
break;
|
456
|
+
case '\r':
|
457
|
+
result += 'r';
|
458
|
+
break;
|
459
|
+
case '\u2028':
|
460
|
+
result += 'u2028';
|
461
|
+
break;
|
462
|
+
case '\u2029':
|
463
|
+
result += 'u2029';
|
464
|
+
break;
|
465
|
+
default:
|
466
|
+
throw new Error('Incorrectly classified character');
|
467
|
+
}
|
468
|
+
|
469
|
+
return result;
|
470
|
+
}
|
471
|
+
|
472
|
+
function escapeDirective(str) {
|
473
|
+
var i, iz, ch, single, buf, quote;
|
474
|
+
|
475
|
+
buf = str;
|
476
|
+
if (typeof buf[0] === 'undefined') {
|
477
|
+
buf = stringToArray(buf);
|
478
|
+
}
|
479
|
+
|
480
|
+
quote = quotes === 'double' ? '"' : '\'';
|
481
|
+
for (i = 0, iz = buf.length; i < iz; i += 1) {
|
482
|
+
ch = buf[i];
|
483
|
+
if (ch === '\'') {
|
484
|
+
quote = '"';
|
485
|
+
break;
|
486
|
+
} else if (ch === '"') {
|
487
|
+
quote = '\'';
|
488
|
+
break;
|
489
|
+
} else if (ch === '\\') {
|
490
|
+
i += 1;
|
491
|
+
}
|
492
|
+
}
|
493
|
+
|
494
|
+
return quote + str + quote;
|
495
|
+
}
|
496
|
+
|
497
|
+
function escapeString(str) {
|
498
|
+
var result = '', i, len, ch, next, singleQuotes = 0, doubleQuotes = 0, single;
|
499
|
+
|
500
|
+
if (typeof str[0] === 'undefined') {
|
501
|
+
str = stringToArray(str);
|
502
|
+
}
|
503
|
+
|
504
|
+
for (i = 0, len = str.length; i < len; i += 1) {
|
505
|
+
ch = str[i];
|
506
|
+
if (ch === '\'') {
|
507
|
+
singleQuotes += 1;
|
508
|
+
} else if (ch === '"') {
|
509
|
+
doubleQuotes += 1;
|
510
|
+
} else if (ch === '/' && json) {
|
511
|
+
result += '\\';
|
512
|
+
} else if ('\\\n\r\u2028\u2029'.indexOf(ch) >= 0) {
|
513
|
+
result += escapeDisallowedCharacter(ch);
|
514
|
+
continue;
|
515
|
+
} else if ((json && ch < ' ') || !(json || escapeless || (ch >= ' ' && ch <= '~'))) {
|
516
|
+
result += escapeAllowedCharacter(ch, str[i + 1]);
|
517
|
+
continue;
|
518
|
+
}
|
519
|
+
result += ch;
|
520
|
+
}
|
521
|
+
|
522
|
+
single = !(quotes === 'double' || (quotes === 'auto' && doubleQuotes < singleQuotes));
|
523
|
+
str = result;
|
524
|
+
result = single ? '\'' : '"';
|
525
|
+
|
526
|
+
if (typeof str[0] === 'undefined') {
|
527
|
+
str = stringToArray(str);
|
528
|
+
}
|
529
|
+
|
530
|
+
for (i = 0, len = str.length; i < len; i += 1) {
|
531
|
+
ch = str[i];
|
532
|
+
if ((ch === '\'' && single) || (ch === '"' && !single)) {
|
533
|
+
result += '\\';
|
534
|
+
}
|
535
|
+
result += ch;
|
536
|
+
}
|
537
|
+
|
538
|
+
return result + (single ? '\'' : '"');
|
539
|
+
}
|
540
|
+
|
541
|
+
function isWhiteSpace(ch) {
|
542
|
+
return '\t\v\f \xa0'.indexOf(ch) >= 0 || (ch.charCodeAt(0) >= 0x1680 && '\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\ufeff'.indexOf(ch) >= 0);
|
543
|
+
}
|
544
|
+
|
545
|
+
function isLineTerminator(ch) {
|
546
|
+
return '\n\r\u2028\u2029'.indexOf(ch) >= 0;
|
547
|
+
}
|
548
|
+
|
549
|
+
function isIdentifierPart(ch) {
|
550
|
+
return (ch === '$') || (ch === '_') || (ch === '\\') ||
|
551
|
+
(ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z') ||
|
552
|
+
((ch >= '0') && (ch <= '9')) ||
|
553
|
+
((ch.charCodeAt(0) >= 0x80) && Regex.NonAsciiIdentifierPart.test(ch));
|
554
|
+
}
|
555
|
+
|
556
|
+
function toSourceNode(generated, node) {
|
557
|
+
if (node == null) {
|
558
|
+
if (generated instanceof SourceNode) {
|
559
|
+
return generated;
|
560
|
+
} else {
|
561
|
+
node = {};
|
562
|
+
}
|
563
|
+
}
|
564
|
+
if (node.loc == null) {
|
565
|
+
return new SourceNode(null, null, sourceMap, generated);
|
566
|
+
}
|
567
|
+
return new SourceNode(node.loc.start.line, node.loc.start.column, (sourceMap === true ? node.loc.source || null : sourceMap), generated);
|
568
|
+
}
|
569
|
+
|
570
|
+
function join(left, right) {
|
571
|
+
var leftSource = toSourceNode(left).toString(),
|
572
|
+
rightSource = toSourceNode(right).toString(),
|
573
|
+
leftChar = leftSource.charAt(leftSource.length - 1),
|
574
|
+
rightChar = rightSource.charAt(0);
|
575
|
+
|
576
|
+
if (((leftChar === '+' || leftChar === '-') && leftChar === rightChar) || (isIdentifierPart(leftChar) && isIdentifierPart(rightChar))) {
|
577
|
+
return [left, ' ', right];
|
578
|
+
} else if (isWhiteSpace(leftChar) || isLineTerminator(leftChar) || isWhiteSpace(rightChar) || isLineTerminator(rightChar)) {
|
579
|
+
return [left, right];
|
580
|
+
}
|
581
|
+
return [left, space, right];
|
582
|
+
}
|
583
|
+
|
584
|
+
function addIndent(stmt) {
|
585
|
+
return [base, stmt];
|
586
|
+
}
|
587
|
+
|
588
|
+
function withIndent(fn) {
|
589
|
+
var previousBase, result;
|
590
|
+
previousBase = base;
|
591
|
+
base += indent;
|
592
|
+
result = fn.call(this, base);
|
593
|
+
base = previousBase;
|
594
|
+
return result;
|
595
|
+
}
|
596
|
+
|
597
|
+
function calculateSpaces(str) {
|
598
|
+
var i;
|
599
|
+
for (i = str.length - 1; i >= 0; i -= 1) {
|
600
|
+
if (isLineTerminator(str.charAt(i))) {
|
601
|
+
break;
|
602
|
+
}
|
603
|
+
}
|
604
|
+
return (str.length - 1) - i;
|
605
|
+
}
|
606
|
+
|
607
|
+
function adjustMultilineComment(value, specialBase) {
|
608
|
+
var array, i, len, line, j, ch, spaces, previousBase;
|
609
|
+
|
610
|
+
array = value.split(/\r\n|[\r\n]/);
|
611
|
+
spaces = Number.MAX_VALUE;
|
612
|
+
|
613
|
+
// first line doesn't have indentation
|
614
|
+
for (i = 1, len = array.length; i < len; i += 1) {
|
615
|
+
line = array[i];
|
616
|
+
j = 0;
|
617
|
+
while (j < line.length && isWhiteSpace(line[j])) {
|
618
|
+
j += 1;
|
619
|
+
}
|
620
|
+
if (spaces > j) {
|
621
|
+
spaces = j;
|
622
|
+
}
|
623
|
+
}
|
624
|
+
|
625
|
+
if (typeof specialBase !== 'undefined') {
|
626
|
+
// pattern like
|
627
|
+
// {
|
628
|
+
// var t = 20; /*
|
629
|
+
// * this is comment
|
630
|
+
// */
|
631
|
+
// }
|
632
|
+
previousBase = base;
|
633
|
+
if (array[1][spaces] === '*') {
|
634
|
+
specialBase += ' ';
|
635
|
+
}
|
636
|
+
base = specialBase;
|
637
|
+
} else {
|
638
|
+
if (spaces & 1) {
|
639
|
+
// /*
|
640
|
+
// *
|
641
|
+
// */
|
642
|
+
// If spaces are odd number, above pattern is considered.
|
643
|
+
// We waste 1 space.
|
644
|
+
spaces -= 1;
|
645
|
+
}
|
646
|
+
previousBase = base;
|
647
|
+
}
|
648
|
+
|
649
|
+
for (i = 1, len = array.length; i < len; i += 1) {
|
650
|
+
array[i] = toSourceNode(addIndent(array[i].slice(spaces))).join('');
|
651
|
+
}
|
652
|
+
|
653
|
+
base = previousBase;
|
654
|
+
|
655
|
+
return array.join('\n');
|
656
|
+
}
|
657
|
+
|
658
|
+
function generateComment(comment, specialBase) {
|
659
|
+
if (comment.type === 'Line') {
|
660
|
+
if (endsWithLineTerminator(comment.value)) {
|
661
|
+
return '//' + comment.value;
|
662
|
+
} else {
|
663
|
+
// Always use LineTerminator
|
664
|
+
return '//' + comment.value + '\n';
|
665
|
+
}
|
666
|
+
}
|
667
|
+
if (extra.format.indent.adjustMultilineComment && /[\n\r]/.test(comment.value)) {
|
668
|
+
return adjustMultilineComment('/*' + comment.value + '*/', specialBase);
|
669
|
+
}
|
670
|
+
return '/*' + comment.value + '*/';
|
671
|
+
}
|
672
|
+
|
673
|
+
function addCommentsToStatement(stmt, result) {
|
674
|
+
var i, len, comment, save, node, tailingToStatement, specialBase, fragment;
|
675
|
+
|
676
|
+
if (stmt.leadingComments && stmt.leadingComments.length > 0) {
|
677
|
+
save = result;
|
678
|
+
|
679
|
+
comment = stmt.leadingComments[0];
|
680
|
+
result = [];
|
681
|
+
if (safeConcatenation && stmt.type === Syntax.Program && stmt.body.length === 0) {
|
682
|
+
result.push('\n');
|
683
|
+
}
|
684
|
+
result.push(generateComment(comment));
|
685
|
+
if (!endsWithLineTerminator(toSourceNode(result).toString())) {
|
686
|
+
result.push('\n');
|
687
|
+
}
|
688
|
+
|
689
|
+
for (i = 1, len = stmt.leadingComments.length; i < len; i += 1) {
|
690
|
+
comment = stmt.leadingComments[i];
|
691
|
+
fragment = [generateComment(comment)];
|
692
|
+
if (!endsWithLineTerminator(toSourceNode(fragment).toString())) {
|
693
|
+
fragment.push('\n');
|
694
|
+
}
|
695
|
+
result.push(addIndent(fragment));
|
696
|
+
}
|
697
|
+
|
698
|
+
result.push(addIndent(save));
|
699
|
+
}
|
700
|
+
|
701
|
+
if (stmt.trailingComments) {
|
702
|
+
tailingToStatement = !endsWithLineTerminator(toSourceNode(result).toString());
|
703
|
+
specialBase = stringRepeat(' ', calculateSpaces(toSourceNode([base, result, indent]).toString()));
|
704
|
+
for (i = 0, len = stmt.trailingComments.length; i < len; i += 1) {
|
705
|
+
comment = stmt.trailingComments[i];
|
706
|
+
if (tailingToStatement) {
|
707
|
+
// We assume target like following script
|
708
|
+
//
|
709
|
+
// var t = 20; /**
|
710
|
+
// * This is comment of t
|
711
|
+
// */
|
712
|
+
if (i === 0) {
|
713
|
+
// first case
|
714
|
+
result = [result, indent];
|
715
|
+
} else {
|
716
|
+
result = [result, specialBase];
|
717
|
+
}
|
718
|
+
result.push(generateComment(comment, specialBase));
|
719
|
+
} else {
|
720
|
+
result = [result, addIndent(generateComment(comment))];
|
721
|
+
}
|
722
|
+
if (i !== len - 1 && !endsWithLineTerminator(toSourceNode(result).toString())) {
|
723
|
+
result = [result, '\n'];
|
724
|
+
}
|
725
|
+
}
|
726
|
+
}
|
727
|
+
|
728
|
+
return result;
|
729
|
+
}
|
730
|
+
|
731
|
+
function parenthesize(text, current, should) {
|
732
|
+
if (current < should) {
|
733
|
+
return ['(', text, ')'];
|
734
|
+
}
|
735
|
+
return text;
|
736
|
+
}
|
737
|
+
|
738
|
+
function maybeBlock(stmt, semicolonOptional, functionBody) {
|
739
|
+
var result, noLeadingComment;
|
740
|
+
|
741
|
+
noLeadingComment = !extra.comment || !stmt.leadingComments;
|
742
|
+
|
743
|
+
if (stmt.type === Syntax.BlockStatement && noLeadingComment) {
|
744
|
+
return [space, generateStatement(stmt, { functionBody: functionBody })];
|
745
|
+
}
|
746
|
+
|
747
|
+
if (stmt.type === Syntax.EmptyStatement && noLeadingComment) {
|
748
|
+
return ';';
|
749
|
+
}
|
750
|
+
|
751
|
+
withIndent(function () {
|
752
|
+
result = [newline, addIndent(generateStatement(stmt, { semicolonOptional: semicolonOptional, functionBody: functionBody }))];
|
753
|
+
});
|
754
|
+
|
755
|
+
return result;
|
756
|
+
}
|
757
|
+
|
758
|
+
function maybeBlockSuffix(stmt, result) {
|
759
|
+
var ends = endsWithLineTerminator(toSourceNode(result).toString());
|
760
|
+
if (stmt.type === Syntax.BlockStatement && (!extra.comment || !stmt.leadingComments) && !ends) {
|
761
|
+
return [result, space];
|
762
|
+
}
|
763
|
+
if (ends) {
|
764
|
+
return [result, base];
|
765
|
+
}
|
766
|
+
return [result, newline, base];
|
767
|
+
}
|
768
|
+
|
769
|
+
function generateVerbatim(expr, option) {
|
770
|
+
var i, result;
|
771
|
+
result = expr[extra.verbatim].split(/\r\n|\n/);
|
772
|
+
for (i = 1; i < result.length; i++) {
|
773
|
+
result[i] = newline + base + result[i];
|
774
|
+
}
|
775
|
+
|
776
|
+
result = parenthesize(result, Precedence.Sequence, option.precedence);
|
777
|
+
return toSourceNode(result, expr);
|
778
|
+
}
|
779
|
+
|
780
|
+
function generateFunctionBody(node) {
|
781
|
+
var result, i, len, expr;
|
782
|
+
result = ['('];
|
783
|
+
for (i = 0, len = node.params.length; i < len; i += 1) {
|
784
|
+
result.push(node.params[i].name);
|
785
|
+
if (i + 1 < len) {
|
786
|
+
result.push(',' + space);
|
787
|
+
}
|
788
|
+
}
|
789
|
+
result.push(')');
|
790
|
+
|
791
|
+
if (node.expression) {
|
792
|
+
result.push(space);
|
793
|
+
expr = generateExpression(node.body, {
|
794
|
+
precedence: Precedence.Assignment,
|
795
|
+
allowIn: true,
|
796
|
+
allowCall: true
|
797
|
+
});
|
798
|
+
if (expr.toString().charAt(0) === '{') {
|
799
|
+
expr = ['(', expr, ')'];
|
800
|
+
}
|
801
|
+
result.push(expr);
|
802
|
+
} else {
|
803
|
+
result.push(maybeBlock(node.body, false, true));
|
804
|
+
}
|
805
|
+
return result;
|
806
|
+
}
|
807
|
+
|
808
|
+
function generateExpression(expr, option) {
|
809
|
+
var result, precedence, currentPrecedence, i, len, raw, fragment, multiline, leftChar, leftSource, rightChar, rightSource, allowIn, allowCall, allowUnparenthesizedNew, property, key, value;
|
810
|
+
|
811
|
+
precedence = option.precedence;
|
812
|
+
allowIn = option.allowIn;
|
813
|
+
allowCall = option.allowCall;
|
814
|
+
|
815
|
+
if (extra.verbatim && expr.hasOwnProperty(extra.verbatim)) {
|
816
|
+
return generateVerbatim(expr, option);
|
817
|
+
}
|
818
|
+
|
819
|
+
switch (expr.type) {
|
820
|
+
case Syntax.SequenceExpression:
|
821
|
+
result = [];
|
822
|
+
allowIn |= (Precedence.Sequence < precedence);
|
823
|
+
for (i = 0, len = expr.expressions.length; i < len; i += 1) {
|
824
|
+
result.push(generateExpression(expr.expressions[i], {
|
825
|
+
precedence: Precedence.Assignment,
|
826
|
+
allowIn: allowIn,
|
827
|
+
allowCall: true
|
828
|
+
}));
|
829
|
+
if (i + 1 < len) {
|
830
|
+
result.push(',' + space);
|
831
|
+
}
|
832
|
+
}
|
833
|
+
result = parenthesize(result, Precedence.Sequence, precedence);
|
834
|
+
break;
|
835
|
+
|
836
|
+
case Syntax.AssignmentExpression:
|
837
|
+
allowIn |= (Precedence.Assignment < precedence);
|
838
|
+
result = parenthesize(
|
839
|
+
[
|
840
|
+
generateExpression(expr.left, {
|
841
|
+
precedence: Precedence.Call,
|
842
|
+
allowIn: allowIn,
|
843
|
+
allowCall: true
|
844
|
+
}),
|
845
|
+
space + expr.operator + space,
|
846
|
+
generateExpression(expr.right, {
|
847
|
+
precedence: Precedence.Assignment,
|
848
|
+
allowIn: allowIn,
|
849
|
+
allowCall: true
|
850
|
+
})
|
851
|
+
],
|
852
|
+
Precedence.Assignment,
|
853
|
+
precedence
|
854
|
+
);
|
855
|
+
break;
|
856
|
+
|
857
|
+
case Syntax.ConditionalExpression:
|
858
|
+
allowIn |= (Precedence.Conditional < precedence);
|
859
|
+
result = parenthesize(
|
860
|
+
[
|
861
|
+
generateExpression(expr.test, {
|
862
|
+
precedence: Precedence.LogicalOR,
|
863
|
+
allowIn: allowIn,
|
864
|
+
allowCall: true
|
865
|
+
}),
|
866
|
+
space + '?' + space,
|
867
|
+
generateExpression(expr.consequent, {
|
868
|
+
precedence: Precedence.Assignment,
|
869
|
+
allowIn: allowIn,
|
870
|
+
allowCall: true
|
871
|
+
}),
|
872
|
+
space + ':' + space,
|
873
|
+
generateExpression(expr.alternate, {
|
874
|
+
precedence: Precedence.Assignment,
|
875
|
+
allowIn: allowIn,
|
876
|
+
allowCall: true
|
877
|
+
})
|
878
|
+
],
|
879
|
+
Precedence.Conditional,
|
880
|
+
precedence
|
881
|
+
);
|
882
|
+
break;
|
883
|
+
|
884
|
+
case Syntax.LogicalExpression:
|
885
|
+
case Syntax.BinaryExpression:
|
886
|
+
currentPrecedence = BinaryPrecedence[expr.operator];
|
887
|
+
|
888
|
+
allowIn |= (currentPrecedence < precedence);
|
889
|
+
|
890
|
+
result = join(
|
891
|
+
generateExpression(expr.left, {
|
892
|
+
precedence: currentPrecedence,
|
893
|
+
allowIn: allowIn,
|
894
|
+
allowCall: true
|
895
|
+
}),
|
896
|
+
expr.operator
|
897
|
+
);
|
898
|
+
|
899
|
+
fragment = generateExpression(expr.right, {
|
900
|
+
precedence: currentPrecedence + 1,
|
901
|
+
allowIn: allowIn,
|
902
|
+
allowCall: true
|
903
|
+
});
|
904
|
+
|
905
|
+
if (expr.operator === '/' && fragment.toString().charAt(0) === '/') {
|
906
|
+
// If '/' concats with '/', it is interpreted as comment start
|
907
|
+
result.push(' ', fragment);
|
908
|
+
} else {
|
909
|
+
result = join(result, fragment);
|
910
|
+
}
|
911
|
+
|
912
|
+
if (expr.operator === 'in' && !allowIn) {
|
913
|
+
result = ['(', result, ')'];
|
914
|
+
} else {
|
915
|
+
result = parenthesize(result, currentPrecedence, precedence);
|
916
|
+
}
|
917
|
+
|
918
|
+
break;
|
919
|
+
|
920
|
+
case Syntax.CallExpression:
|
921
|
+
result = [generateExpression(expr.callee, {
|
922
|
+
precedence: Precedence.Call,
|
923
|
+
allowIn: true,
|
924
|
+
allowCall: true,
|
925
|
+
allowUnparenthesizedNew: false
|
926
|
+
})];
|
927
|
+
|
928
|
+
result.push('(');
|
929
|
+
for (i = 0, len = expr['arguments'].length; i < len; i += 1) {
|
930
|
+
result.push(generateExpression(expr['arguments'][i], {
|
931
|
+
precedence: Precedence.Assignment,
|
932
|
+
allowIn: true,
|
933
|
+
allowCall: true
|
934
|
+
}));
|
935
|
+
if (i + 1 < len) {
|
936
|
+
result.push(',' + space);
|
937
|
+
}
|
938
|
+
}
|
939
|
+
result.push(')');
|
940
|
+
|
941
|
+
if (!allowCall) {
|
942
|
+
result = ['(', result, ')'];
|
943
|
+
} else {
|
944
|
+
result = parenthesize(result, Precedence.Call, precedence);
|
945
|
+
}
|
946
|
+
break;
|
947
|
+
|
948
|
+
case Syntax.NewExpression:
|
949
|
+
len = expr['arguments'].length;
|
950
|
+
allowUnparenthesizedNew = option.allowUnparenthesizedNew === undefined || option.allowUnparenthesizedNew;
|
951
|
+
|
952
|
+
result = join(
|
953
|
+
'new',
|
954
|
+
generateExpression(expr.callee, {
|
955
|
+
precedence: Precedence.New,
|
956
|
+
allowIn: true,
|
957
|
+
allowCall: false,
|
958
|
+
allowUnparenthesizedNew: allowUnparenthesizedNew && !parentheses && len === 0
|
959
|
+
})
|
960
|
+
);
|
961
|
+
|
962
|
+
if (!allowUnparenthesizedNew || parentheses || len > 0) {
|
963
|
+
result.push('(');
|
964
|
+
for (i = 0; i < len; i += 1) {
|
965
|
+
result.push(generateExpression(expr['arguments'][i], {
|
966
|
+
precedence: Precedence.Assignment,
|
967
|
+
allowIn: true,
|
968
|
+
allowCall: true
|
969
|
+
}));
|
970
|
+
if (i + 1 < len) {
|
971
|
+
result.push(',' + space);
|
972
|
+
}
|
973
|
+
}
|
974
|
+
result.push(')');
|
975
|
+
}
|
976
|
+
|
977
|
+
result = parenthesize(result, Precedence.New, precedence);
|
978
|
+
break;
|
979
|
+
|
980
|
+
case Syntax.MemberExpression:
|
981
|
+
result = [generateExpression(expr.object, {
|
982
|
+
precedence: Precedence.Call,
|
983
|
+
allowIn: true,
|
984
|
+
allowCall: allowCall,
|
985
|
+
allowUnparenthesizedNew: false
|
986
|
+
})];
|
987
|
+
|
988
|
+
if (expr.computed) {
|
989
|
+
result.push('[', generateExpression(expr.property, {
|
990
|
+
precedence: Precedence.Sequence,
|
991
|
+
allowIn: true,
|
992
|
+
allowCall: allowCall
|
993
|
+
}), ']');
|
994
|
+
} else {
|
995
|
+
if (expr.object.type === Syntax.Literal && typeof expr.object.value === 'number') {
|
996
|
+
if (result.indexOf('.') < 0) {
|
997
|
+
if (!/[eExX]/.test(result) && !(result.length >= 2 && result[0] === '0')) {
|
998
|
+
result.push('.');
|
999
|
+
}
|
1000
|
+
}
|
1001
|
+
}
|
1002
|
+
result.push('.' + expr.property.name);
|
1003
|
+
}
|
1004
|
+
|
1005
|
+
result = parenthesize(result, Precedence.Member, precedence);
|
1006
|
+
break;
|
1007
|
+
|
1008
|
+
case Syntax.UnaryExpression:
|
1009
|
+
fragment = generateExpression(expr.argument, {
|
1010
|
+
precedence: Precedence.Unary,
|
1011
|
+
allowIn: true,
|
1012
|
+
allowCall: true
|
1013
|
+
});
|
1014
|
+
|
1015
|
+
if (space === '') {
|
1016
|
+
result = join(expr.operator, fragment);
|
1017
|
+
} else {
|
1018
|
+
result = [expr.operator];
|
1019
|
+
if (expr.operator.length > 2) {
|
1020
|
+
// delete, void, typeof
|
1021
|
+
// get `typeof []`, not `typeof[]`
|
1022
|
+
result = join(result, fragment);
|
1023
|
+
} else {
|
1024
|
+
// Prevent inserting spaces between operator and argument if it is unnecessary
|
1025
|
+
// like, `!cond`
|
1026
|
+
leftSource = toSourceNode(result).toString();
|
1027
|
+
leftChar = leftSource.charAt(leftSource.length - 1);
|
1028
|
+
rightChar = fragment.toString().charAt(0);
|
1029
|
+
|
1030
|
+
if (((leftChar === '+' || leftChar === '-') && leftChar === rightChar) || (isIdentifierPart(leftChar) && isIdentifierPart(rightChar))) {
|
1031
|
+
result.push(' ', fragment);
|
1032
|
+
} else {
|
1033
|
+
result.push(fragment);
|
1034
|
+
}
|
1035
|
+
}
|
1036
|
+
}
|
1037
|
+
result = parenthesize(result, Precedence.Unary, precedence);
|
1038
|
+
break;
|
1039
|
+
|
1040
|
+
case Syntax.YieldExpression:
|
1041
|
+
if (expr.delegate) {
|
1042
|
+
result = 'yield*';
|
1043
|
+
} else {
|
1044
|
+
result = 'yield';
|
1045
|
+
}
|
1046
|
+
if (expr.argument) {
|
1047
|
+
result = join(
|
1048
|
+
result,
|
1049
|
+
generateExpression(expr.argument, {
|
1050
|
+
precedence: Precedence.Assignment,
|
1051
|
+
allowIn: true,
|
1052
|
+
allowCall: true
|
1053
|
+
})
|
1054
|
+
);
|
1055
|
+
}
|
1056
|
+
break;
|
1057
|
+
|
1058
|
+
case Syntax.UpdateExpression:
|
1059
|
+
if (expr.prefix) {
|
1060
|
+
result = parenthesize(
|
1061
|
+
[
|
1062
|
+
expr.operator,
|
1063
|
+
generateExpression(expr.argument, {
|
1064
|
+
precedence: Precedence.Unary,
|
1065
|
+
allowIn: true,
|
1066
|
+
allowCall: true
|
1067
|
+
})
|
1068
|
+
],
|
1069
|
+
Precedence.Unary,
|
1070
|
+
precedence
|
1071
|
+
);
|
1072
|
+
} else {
|
1073
|
+
result = parenthesize(
|
1074
|
+
[
|
1075
|
+
generateExpression(expr.argument, {
|
1076
|
+
precedence: Precedence.Postfix,
|
1077
|
+
allowIn: true,
|
1078
|
+
allowCall: true
|
1079
|
+
}),
|
1080
|
+
expr.operator
|
1081
|
+
],
|
1082
|
+
Precedence.Postfix,
|
1083
|
+
precedence
|
1084
|
+
);
|
1085
|
+
}
|
1086
|
+
break;
|
1087
|
+
|
1088
|
+
case Syntax.FunctionExpression:
|
1089
|
+
result = 'function';
|
1090
|
+
if (expr.id) {
|
1091
|
+
result += ' ' + expr.id.name;
|
1092
|
+
} else {
|
1093
|
+
result += space;
|
1094
|
+
}
|
1095
|
+
|
1096
|
+
result = [result, generateFunctionBody(expr)];
|
1097
|
+
break;
|
1098
|
+
|
1099
|
+
case Syntax.ArrayPattern:
|
1100
|
+
case Syntax.ArrayExpression:
|
1101
|
+
if (!expr.elements.length) {
|
1102
|
+
result = '[]';
|
1103
|
+
break;
|
1104
|
+
}
|
1105
|
+
multiline = expr.elements.length > 1;
|
1106
|
+
result = ['[', multiline ? newline : ''];
|
1107
|
+
withIndent(function (indent) {
|
1108
|
+
for (i = 0, len = expr.elements.length; i < len; i += 1) {
|
1109
|
+
if (!expr.elements[i]) {
|
1110
|
+
if (multiline) {
|
1111
|
+
result.push(indent);
|
1112
|
+
}
|
1113
|
+
if (i + 1 === len) {
|
1114
|
+
result.push(',');
|
1115
|
+
}
|
1116
|
+
} else {
|
1117
|
+
result.push(multiline ? indent : '', generateExpression(expr.elements[i], {
|
1118
|
+
precedence: Precedence.Assignment,
|
1119
|
+
allowIn: true,
|
1120
|
+
allowCall: true
|
1121
|
+
}));
|
1122
|
+
}
|
1123
|
+
if (i + 1 < len) {
|
1124
|
+
result.push(',' + (multiline ? newline : space));
|
1125
|
+
}
|
1126
|
+
}
|
1127
|
+
});
|
1128
|
+
if (multiline && !endsWithLineTerminator(toSourceNode(result).toString())) {
|
1129
|
+
result.push(newline);
|
1130
|
+
}
|
1131
|
+
result.push(multiline ? base : '', ']');
|
1132
|
+
break;
|
1133
|
+
|
1134
|
+
case Syntax.Property:
|
1135
|
+
if (expr.kind === 'get' || expr.kind === 'set') {
|
1136
|
+
result = [
|
1137
|
+
expr.kind + ' ',
|
1138
|
+
generateExpression(expr.key, {
|
1139
|
+
precedence: Precedence.Sequence,
|
1140
|
+
allowIn: true,
|
1141
|
+
allowCall: true
|
1142
|
+
}),
|
1143
|
+
generateFunctionBody(expr.value)
|
1144
|
+
];
|
1145
|
+
} else {
|
1146
|
+
if (expr.shorthand) {
|
1147
|
+
result = generateExpression(expr.key, {
|
1148
|
+
precedence: Precedence.Sequence,
|
1149
|
+
allowIn: true,
|
1150
|
+
allowCall: true
|
1151
|
+
});
|
1152
|
+
} else if (expr.method) {
|
1153
|
+
result = [];
|
1154
|
+
if (expr.value.generator) {
|
1155
|
+
result.push('*');
|
1156
|
+
}
|
1157
|
+
result.push(generateExpression(expr.key, {
|
1158
|
+
precedence: Precedence.Sequence,
|
1159
|
+
allowIn: true,
|
1160
|
+
allowCall: true
|
1161
|
+
}), generateFunctionBody(expr.value));
|
1162
|
+
} else {
|
1163
|
+
result = [
|
1164
|
+
generateExpression(expr.key, {
|
1165
|
+
precedence: Precedence.Sequence,
|
1166
|
+
allowIn: true,
|
1167
|
+
allowCall: true
|
1168
|
+
}),
|
1169
|
+
':' + space,
|
1170
|
+
generateExpression(expr.value, {
|
1171
|
+
precedence: Precedence.Assignment,
|
1172
|
+
allowIn: true,
|
1173
|
+
allowCall: true
|
1174
|
+
})
|
1175
|
+
];
|
1176
|
+
}
|
1177
|
+
}
|
1178
|
+
break;
|
1179
|
+
|
1180
|
+
case Syntax.ObjectExpression:
|
1181
|
+
if (!expr.properties.length) {
|
1182
|
+
result = '{}';
|
1183
|
+
break;
|
1184
|
+
}
|
1185
|
+
multiline = expr.properties.length > 1;
|
1186
|
+
|
1187
|
+
withIndent(function (indent) {
|
1188
|
+
fragment = generateExpression(expr.properties[0], {
|
1189
|
+
precedence: Precedence.Sequence,
|
1190
|
+
allowIn: true,
|
1191
|
+
allowCall: true
|
1192
|
+
});
|
1193
|
+
});
|
1194
|
+
|
1195
|
+
if (!multiline) {
|
1196
|
+
// issues 4
|
1197
|
+
// Do not transform from
|
1198
|
+
// dejavu.Class.declare({
|
1199
|
+
// method2: function () {}
|
1200
|
+
// });
|
1201
|
+
// to
|
1202
|
+
// dejavu.Class.declare({method2: function () {
|
1203
|
+
// }});
|
1204
|
+
if (!hasLineTerminator(toSourceNode(fragment).toString())) {
|
1205
|
+
result = [ '{', space, fragment, space, '}' ];
|
1206
|
+
break;
|
1207
|
+
}
|
1208
|
+
}
|
1209
|
+
|
1210
|
+
withIndent(function (indent) {
|
1211
|
+
result = [ '{', newline, indent, fragment ];
|
1212
|
+
|
1213
|
+
if (multiline) {
|
1214
|
+
result.push(',' + newline);
|
1215
|
+
for (i = 1, len = expr.properties.length; i < len; i += 1) {
|
1216
|
+
result.push(indent, generateExpression(expr.properties[i], {
|
1217
|
+
precedence: Precedence.Sequence,
|
1218
|
+
allowIn: true,
|
1219
|
+
allowCall: true
|
1220
|
+
}));
|
1221
|
+
if (i + 1 < len) {
|
1222
|
+
result.push(',' + newline);
|
1223
|
+
}
|
1224
|
+
}
|
1225
|
+
}
|
1226
|
+
});
|
1227
|
+
|
1228
|
+
if (!endsWithLineTerminator(toSourceNode(result).toString())) {
|
1229
|
+
result.push(newline);
|
1230
|
+
}
|
1231
|
+
result.push(base, '}');
|
1232
|
+
break;
|
1233
|
+
|
1234
|
+
case Syntax.ObjectPattern:
|
1235
|
+
if (!expr.properties.length) {
|
1236
|
+
result = '{}';
|
1237
|
+
break;
|
1238
|
+
}
|
1239
|
+
|
1240
|
+
multiline = false;
|
1241
|
+
if (expr.properties.length === 1) {
|
1242
|
+
property = expr.properties[0];
|
1243
|
+
if (property.value.type !== Syntax.Identifier) {
|
1244
|
+
multiline = true;
|
1245
|
+
}
|
1246
|
+
} else {
|
1247
|
+
for (i = 0, len = expr.properties.length; i < len; i += 1) {
|
1248
|
+
property = expr.properties[i];
|
1249
|
+
if (!property.shorthand) {
|
1250
|
+
multiline = true;
|
1251
|
+
break;
|
1252
|
+
}
|
1253
|
+
}
|
1254
|
+
}
|
1255
|
+
result = ['{', multiline ? newline : '' ];
|
1256
|
+
|
1257
|
+
withIndent(function (indent) {
|
1258
|
+
for (i = 0, len = expr.properties.length; i < len; i += 1) {
|
1259
|
+
result.push(multiline ? indent : '', generateExpression(expr.properties[i], {
|
1260
|
+
precedence: Precedence.Sequence,
|
1261
|
+
allowIn: true,
|
1262
|
+
allowCall: true
|
1263
|
+
}));
|
1264
|
+
if (i + 1 < len) {
|
1265
|
+
result.push(',' + (multiline ? newline : space));
|
1266
|
+
}
|
1267
|
+
}
|
1268
|
+
});
|
1269
|
+
|
1270
|
+
if (multiline && !endsWithLineTerminator(toSourceNode(result).toString())) {
|
1271
|
+
result.push(newline);
|
1272
|
+
}
|
1273
|
+
result.push(multiline ? base : '', '}');
|
1274
|
+
break;
|
1275
|
+
|
1276
|
+
case Syntax.ThisExpression:
|
1277
|
+
result = 'this';
|
1278
|
+
break;
|
1279
|
+
|
1280
|
+
case Syntax.Identifier:
|
1281
|
+
result = expr.name;
|
1282
|
+
break;
|
1283
|
+
|
1284
|
+
case Syntax.Literal:
|
1285
|
+
if (expr.hasOwnProperty('raw') && parse) {
|
1286
|
+
try {
|
1287
|
+
raw = parse(expr.raw).body[0].expression;
|
1288
|
+
if (raw.type === Syntax.Literal) {
|
1289
|
+
if (raw.value === expr.value) {
|
1290
|
+
result = expr.raw;
|
1291
|
+
break;
|
1292
|
+
}
|
1293
|
+
}
|
1294
|
+
} catch (e) {
|
1295
|
+
// not use raw property
|
1296
|
+
}
|
1297
|
+
}
|
1298
|
+
|
1299
|
+
if (expr.value === null) {
|
1300
|
+
result = 'null';
|
1301
|
+
break;
|
1302
|
+
}
|
1303
|
+
|
1304
|
+
if (typeof expr.value === 'string') {
|
1305
|
+
result = escapeString(expr.value);
|
1306
|
+
break;
|
1307
|
+
}
|
1308
|
+
|
1309
|
+
if (typeof expr.value === 'number') {
|
1310
|
+
result = generateNumber(expr.value);
|
1311
|
+
break;
|
1312
|
+
}
|
1313
|
+
|
1314
|
+
result = expr.value.toString();
|
1315
|
+
break;
|
1316
|
+
|
1317
|
+
case Syntax.ComprehensionExpression:
|
1318
|
+
result = [
|
1319
|
+
'[',
|
1320
|
+
generateExpression(expr.body, {
|
1321
|
+
precedence: Precedence.Assignment,
|
1322
|
+
allowIn: true,
|
1323
|
+
allowCall: true
|
1324
|
+
})
|
1325
|
+
];
|
1326
|
+
|
1327
|
+
if (expr.blocks) {
|
1328
|
+
for (i = 0, len = expr.blocks.length; i < len; i += 1) {
|
1329
|
+
fragment = generateExpression(expr.blocks[i], {
|
1330
|
+
precedence: Precedence.Sequence,
|
1331
|
+
allowIn: true,
|
1332
|
+
allowCall: true
|
1333
|
+
});
|
1334
|
+
result = join(result, fragment);
|
1335
|
+
}
|
1336
|
+
}
|
1337
|
+
|
1338
|
+
if (expr.filter) {
|
1339
|
+
result = join(result, 'if' + space);
|
1340
|
+
fragment = generateExpression(expr.filter, {
|
1341
|
+
precedence: Precedence.Sequence,
|
1342
|
+
allowIn: true,
|
1343
|
+
allowCall: true
|
1344
|
+
});
|
1345
|
+
if (extra.moz.parenthesizedComprehensionBlock) {
|
1346
|
+
result = join(result, [ '(', fragment, ')' ]);
|
1347
|
+
} else {
|
1348
|
+
result = join(result, fragment);
|
1349
|
+
}
|
1350
|
+
}
|
1351
|
+
result.push(']');
|
1352
|
+
break;
|
1353
|
+
|
1354
|
+
case Syntax.ComprehensionBlock:
|
1355
|
+
if (expr.left.type === Syntax.VariableDeclaration) {
|
1356
|
+
fragment = [
|
1357
|
+
expr.left.kind + ' ',
|
1358
|
+
generateStatement(expr.left.declarations[0], {
|
1359
|
+
allowIn: false
|
1360
|
+
})
|
1361
|
+
];
|
1362
|
+
} else {
|
1363
|
+
fragment = generateExpression(expr.left, {
|
1364
|
+
precedence: Precedence.Call,
|
1365
|
+
allowIn: true,
|
1366
|
+
allowCall: true
|
1367
|
+
});
|
1368
|
+
}
|
1369
|
+
|
1370
|
+
fragment = join(fragment, expr.of ? 'of' : 'in');
|
1371
|
+
fragment = join(fragment, generateExpression(expr.right, {
|
1372
|
+
precedence: Precedence.Sequence,
|
1373
|
+
allowIn: true,
|
1374
|
+
allowCall: true
|
1375
|
+
}));
|
1376
|
+
|
1377
|
+
if (extra.moz.parenthesizedComprehensionBlock) {
|
1378
|
+
result = [ 'for' + space + '(', fragment, ')' ];
|
1379
|
+
} else {
|
1380
|
+
result = join('for' + space, fragment);
|
1381
|
+
}
|
1382
|
+
break;
|
1383
|
+
|
1384
|
+
default:
|
1385
|
+
throw new Error('Unknown expression type: ' + expr.type);
|
1386
|
+
}
|
1387
|
+
|
1388
|
+
return toSourceNode(result, expr);
|
1389
|
+
}
|
1390
|
+
|
1391
|
+
function generateStatement(stmt, option) {
|
1392
|
+
var i, len, result, node, allowIn, functionBody, directiveContext, fragment, semicolon;
|
1393
|
+
|
1394
|
+
allowIn = true;
|
1395
|
+
semicolon = ';';
|
1396
|
+
functionBody = false;
|
1397
|
+
directiveContext = false;
|
1398
|
+
if (option) {
|
1399
|
+
allowIn = option.allowIn === undefined || option.allowIn;
|
1400
|
+
if (!semicolons && option.semicolonOptional === true) {
|
1401
|
+
semicolon = '';
|
1402
|
+
}
|
1403
|
+
functionBody = option.functionBody;
|
1404
|
+
directiveContext = option.directiveContext;
|
1405
|
+
}
|
1406
|
+
|
1407
|
+
switch (stmt.type) {
|
1408
|
+
case Syntax.BlockStatement:
|
1409
|
+
result = ['{', newline];
|
1410
|
+
|
1411
|
+
withIndent(function () {
|
1412
|
+
for (i = 0, len = stmt.body.length; i < len; i += 1) {
|
1413
|
+
fragment = addIndent(generateStatement(stmt.body[i], {
|
1414
|
+
semicolonOptional: i === len - 1,
|
1415
|
+
directiveContext: functionBody
|
1416
|
+
}));
|
1417
|
+
result.push(fragment);
|
1418
|
+
if (!endsWithLineTerminator(toSourceNode(fragment).toString())) {
|
1419
|
+
result.push(newline);
|
1420
|
+
}
|
1421
|
+
}
|
1422
|
+
});
|
1423
|
+
|
1424
|
+
result.push(addIndent('}'));
|
1425
|
+
break;
|
1426
|
+
|
1427
|
+
case Syntax.BreakStatement:
|
1428
|
+
if (stmt.label) {
|
1429
|
+
result = 'break ' + stmt.label.name + semicolon;
|
1430
|
+
} else {
|
1431
|
+
result = 'break' + semicolon;
|
1432
|
+
}
|
1433
|
+
break;
|
1434
|
+
|
1435
|
+
case Syntax.ContinueStatement:
|
1436
|
+
if (stmt.label) {
|
1437
|
+
result = 'continue ' + stmt.label.name + semicolon;
|
1438
|
+
} else {
|
1439
|
+
result = 'continue' + semicolon;
|
1440
|
+
}
|
1441
|
+
break;
|
1442
|
+
|
1443
|
+
case Syntax.DirectiveStatement:
|
1444
|
+
if (stmt.raw) {
|
1445
|
+
result = stmt.raw + semicolon;
|
1446
|
+
} else {
|
1447
|
+
result = escapeDirective(stmt.directive) + semicolon;
|
1448
|
+
}
|
1449
|
+
break;
|
1450
|
+
|
1451
|
+
case Syntax.DoWhileStatement:
|
1452
|
+
// Because `do 42 while (cond)` is Syntax Error. We need semicolon.
|
1453
|
+
result = join('do', maybeBlock(stmt.body));
|
1454
|
+
result = maybeBlockSuffix(stmt.body, result);
|
1455
|
+
result = join(result, [
|
1456
|
+
'while' + space + '(',
|
1457
|
+
generateExpression(stmt.test, {
|
1458
|
+
precedence: Precedence.Sequence,
|
1459
|
+
allowIn: true,
|
1460
|
+
allowCall: true
|
1461
|
+
}),
|
1462
|
+
')' + semicolon
|
1463
|
+
]);
|
1464
|
+
break;
|
1465
|
+
|
1466
|
+
case Syntax.CatchClause:
|
1467
|
+
withIndent(function () {
|
1468
|
+
result = [
|
1469
|
+
'catch' + space + '(',
|
1470
|
+
generateExpression(stmt.param, {
|
1471
|
+
precedence: Precedence.Sequence,
|
1472
|
+
allowIn: true,
|
1473
|
+
allowCall: true
|
1474
|
+
}),
|
1475
|
+
')'
|
1476
|
+
];
|
1477
|
+
});
|
1478
|
+
result.push(maybeBlock(stmt.body));
|
1479
|
+
break;
|
1480
|
+
|
1481
|
+
case Syntax.DebuggerStatement:
|
1482
|
+
result = 'debugger' + semicolon;
|
1483
|
+
break;
|
1484
|
+
|
1485
|
+
case Syntax.EmptyStatement:
|
1486
|
+
result = ';';
|
1487
|
+
break;
|
1488
|
+
|
1489
|
+
case Syntax.ExpressionStatement:
|
1490
|
+
result = [generateExpression(stmt.expression, {
|
1491
|
+
precedence: Precedence.Sequence,
|
1492
|
+
allowIn: true,
|
1493
|
+
allowCall: true
|
1494
|
+
})];
|
1495
|
+
// 12.4 '{', 'function' is not allowed in this position.
|
1496
|
+
// wrap expression with parentheses
|
1497
|
+
if (result.toString().charAt(0) === '{' || (result.toString().slice(0, 8) === 'function' && " (".indexOf(result.toString().charAt(8)) >= 0) || (directive && directiveContext && stmt.expression.type === Syntax.Literal && typeof stmt.expression.value === 'string')) {
|
1498
|
+
result = ['(', result, ')' + semicolon];
|
1499
|
+
} else {
|
1500
|
+
result.push(semicolon);
|
1501
|
+
}
|
1502
|
+
break;
|
1503
|
+
|
1504
|
+
case Syntax.VariableDeclarator:
|
1505
|
+
if (stmt.init) {
|
1506
|
+
result = [
|
1507
|
+
generateExpression(stmt.id, {
|
1508
|
+
precedence: Precedence.Assignment,
|
1509
|
+
allowIn: allowIn,
|
1510
|
+
allowCall: true
|
1511
|
+
}) + space + '=' + space,
|
1512
|
+
generateExpression(stmt.init, {
|
1513
|
+
precedence: Precedence.Assignment,
|
1514
|
+
allowIn: allowIn,
|
1515
|
+
allowCall: true
|
1516
|
+
})
|
1517
|
+
];
|
1518
|
+
} else {
|
1519
|
+
result = stmt.id.name;
|
1520
|
+
}
|
1521
|
+
break;
|
1522
|
+
|
1523
|
+
case Syntax.VariableDeclaration:
|
1524
|
+
result = [stmt.kind];
|
1525
|
+
// special path for
|
1526
|
+
// var x = function () {
|
1527
|
+
// };
|
1528
|
+
if (stmt.declarations.length === 1 && stmt.declarations[0].init &&
|
1529
|
+
stmt.declarations[0].init.type === Syntax.FunctionExpression) {
|
1530
|
+
result.push(' ', generateStatement(stmt.declarations[0], {
|
1531
|
+
allowIn: allowIn
|
1532
|
+
}));
|
1533
|
+
} else {
|
1534
|
+
// VariableDeclarator is typed as Statement,
|
1535
|
+
// but joined with comma (not LineTerminator).
|
1536
|
+
// So if comment is attached to target node, we should specialize.
|
1537
|
+
withIndent(function () {
|
1538
|
+
node = stmt.declarations[0];
|
1539
|
+
if (extra.comment && node.leadingComments) {
|
1540
|
+
result.push('\n', addIndent(generateStatement(node, {
|
1541
|
+
allowIn: allowIn
|
1542
|
+
})));
|
1543
|
+
} else {
|
1544
|
+
result.push(' ', generateStatement(node, {
|
1545
|
+
allowIn: allowIn
|
1546
|
+
}));
|
1547
|
+
}
|
1548
|
+
|
1549
|
+
for (i = 1, len = stmt.declarations.length; i < len; i += 1) {
|
1550
|
+
node = stmt.declarations[i];
|
1551
|
+
if (extra.comment && node.leadingComments) {
|
1552
|
+
result.push(',' + newline, addIndent(generateStatement(node, {
|
1553
|
+
allowIn: allowIn
|
1554
|
+
})));
|
1555
|
+
} else {
|
1556
|
+
result.push(',' + space, generateStatement(node, {
|
1557
|
+
allowIn: allowIn
|
1558
|
+
}));
|
1559
|
+
}
|
1560
|
+
}
|
1561
|
+
});
|
1562
|
+
}
|
1563
|
+
result.push(semicolon);
|
1564
|
+
break;
|
1565
|
+
|
1566
|
+
case Syntax.ThrowStatement:
|
1567
|
+
result = [join(
|
1568
|
+
'throw',
|
1569
|
+
generateExpression(stmt.argument, {
|
1570
|
+
precedence: Precedence.Sequence,
|
1571
|
+
allowIn: true,
|
1572
|
+
allowCall: true
|
1573
|
+
})
|
1574
|
+
), semicolon];
|
1575
|
+
break;
|
1576
|
+
|
1577
|
+
case Syntax.TryStatement:
|
1578
|
+
result = ['try', maybeBlock(stmt.block)];
|
1579
|
+
result = maybeBlockSuffix(stmt.block, result);
|
1580
|
+
for (i = 0, len = stmt.handlers.length; i < len; i += 1) {
|
1581
|
+
result = join(result, generateStatement(stmt.handlers[i]));
|
1582
|
+
if (stmt.finalizer || i + 1 !== len) {
|
1583
|
+
result = maybeBlockSuffix(stmt.handlers[i].body, result);
|
1584
|
+
}
|
1585
|
+
}
|
1586
|
+
if (stmt.finalizer) {
|
1587
|
+
result = join(result, ['finally', maybeBlock(stmt.finalizer)]);
|
1588
|
+
}
|
1589
|
+
break;
|
1590
|
+
|
1591
|
+
case Syntax.SwitchStatement:
|
1592
|
+
withIndent(function () {
|
1593
|
+
result = [
|
1594
|
+
'switch' + space + '(',
|
1595
|
+
generateExpression(stmt.discriminant, {
|
1596
|
+
precedence: Precedence.Sequence,
|
1597
|
+
allowIn: true,
|
1598
|
+
allowCall: true
|
1599
|
+
}),
|
1600
|
+
')' + space + '{' + newline
|
1601
|
+
];
|
1602
|
+
});
|
1603
|
+
if (stmt.cases) {
|
1604
|
+
for (i = 0, len = stmt.cases.length; i < len; i += 1) {
|
1605
|
+
fragment = addIndent(generateStatement(stmt.cases[i], {semicolonOptional: i === len - 1}));
|
1606
|
+
result.push(fragment);
|
1607
|
+
if (!endsWithLineTerminator(toSourceNode(fragment).toString())) {
|
1608
|
+
result.push(newline);
|
1609
|
+
}
|
1610
|
+
}
|
1611
|
+
}
|
1612
|
+
result.push(addIndent('}'));
|
1613
|
+
break;
|
1614
|
+
|
1615
|
+
case Syntax.SwitchCase:
|
1616
|
+
withIndent(function () {
|
1617
|
+
if (stmt.test) {
|
1618
|
+
result = [
|
1619
|
+
join('case', generateExpression(stmt.test, {
|
1620
|
+
precedence: Precedence.Sequence,
|
1621
|
+
allowIn: true,
|
1622
|
+
allowCall: true
|
1623
|
+
})),
|
1624
|
+
':'
|
1625
|
+
];
|
1626
|
+
} else {
|
1627
|
+
result = ['default:'];
|
1628
|
+
}
|
1629
|
+
|
1630
|
+
i = 0;
|
1631
|
+
len = stmt.consequent.length;
|
1632
|
+
if (len && stmt.consequent[0].type === Syntax.BlockStatement) {
|
1633
|
+
fragment = maybeBlock(stmt.consequent[0]);
|
1634
|
+
result.push(fragment);
|
1635
|
+
i = 1;
|
1636
|
+
}
|
1637
|
+
|
1638
|
+
if (i !== len && !endsWithLineTerminator(toSourceNode(result).toString())) {
|
1639
|
+
result.push(newline);
|
1640
|
+
}
|
1641
|
+
|
1642
|
+
for (; i < len; i += 1) {
|
1643
|
+
fragment = addIndent(generateStatement(stmt.consequent[i], {semicolonOptional: i === len - 1 && semicolon === ''}));
|
1644
|
+
result.push(fragment);
|
1645
|
+
if (i + 1 !== len && !endsWithLineTerminator(toSourceNode(fragment).toString())) {
|
1646
|
+
result.push(newline);
|
1647
|
+
}
|
1648
|
+
}
|
1649
|
+
});
|
1650
|
+
break;
|
1651
|
+
|
1652
|
+
case Syntax.IfStatement:
|
1653
|
+
withIndent(function () {
|
1654
|
+
result = [
|
1655
|
+
'if' + space + '(',
|
1656
|
+
generateExpression(stmt.test, {
|
1657
|
+
precedence: Precedence.Sequence,
|
1658
|
+
allowIn: true,
|
1659
|
+
allowCall: true
|
1660
|
+
}),
|
1661
|
+
')'
|
1662
|
+
];
|
1663
|
+
});
|
1664
|
+
if (stmt.alternate) {
|
1665
|
+
result.push(maybeBlock(stmt.consequent));
|
1666
|
+
result = maybeBlockSuffix(stmt.consequent, result);
|
1667
|
+
if (stmt.alternate.type === Syntax.IfStatement) {
|
1668
|
+
result = join(result, ['else ', generateStatement(stmt.alternate, {semicolonOptional: semicolon === ''})]);
|
1669
|
+
} else {
|
1670
|
+
result = join(result, join('else', maybeBlock(stmt.alternate, semicolon === '')));
|
1671
|
+
}
|
1672
|
+
} else {
|
1673
|
+
result.push(maybeBlock(stmt.consequent, semicolon === ''));
|
1674
|
+
}
|
1675
|
+
break;
|
1676
|
+
|
1677
|
+
case Syntax.ForStatement:
|
1678
|
+
withIndent(function () {
|
1679
|
+
result = ['for' + space + '('];
|
1680
|
+
if (stmt.init) {
|
1681
|
+
if (stmt.init.type === Syntax.VariableDeclaration) {
|
1682
|
+
result.push(generateStatement(stmt.init, {allowIn: false}));
|
1683
|
+
} else {
|
1684
|
+
result.push(generateExpression(stmt.init, {
|
1685
|
+
precedence: Precedence.Sequence,
|
1686
|
+
allowIn: false,
|
1687
|
+
allowCall: true
|
1688
|
+
}), ';');
|
1689
|
+
}
|
1690
|
+
} else {
|
1691
|
+
result.push(';');
|
1692
|
+
}
|
1693
|
+
|
1694
|
+
if (stmt.test) {
|
1695
|
+
result.push(space, generateExpression(stmt.test, {
|
1696
|
+
precedence: Precedence.Sequence,
|
1697
|
+
allowIn: true,
|
1698
|
+
allowCall: true
|
1699
|
+
}), ';');
|
1700
|
+
} else {
|
1701
|
+
result.push(';');
|
1702
|
+
}
|
1703
|
+
|
1704
|
+
if (stmt.update) {
|
1705
|
+
result.push(space, generateExpression(stmt.update, {
|
1706
|
+
precedence: Precedence.Sequence,
|
1707
|
+
allowIn: true,
|
1708
|
+
allowCall: true
|
1709
|
+
}), ')');
|
1710
|
+
} else {
|
1711
|
+
result.push(')');
|
1712
|
+
}
|
1713
|
+
});
|
1714
|
+
|
1715
|
+
result.push(maybeBlock(stmt.body, semicolon === ''));
|
1716
|
+
break;
|
1717
|
+
|
1718
|
+
case Syntax.ForInStatement:
|
1719
|
+
result = ['for' + space + '('];
|
1720
|
+
withIndent(function () {
|
1721
|
+
if (stmt.left.type === Syntax.VariableDeclaration) {
|
1722
|
+
withIndent(function () {
|
1723
|
+
result.push(stmt.left.kind + ' ', generateStatement(stmt.left.declarations[0], {
|
1724
|
+
allowIn: false
|
1725
|
+
}));
|
1726
|
+
});
|
1727
|
+
} else {
|
1728
|
+
result.push(generateExpression(stmt.left, {
|
1729
|
+
precedence: Precedence.Call,
|
1730
|
+
allowIn: true,
|
1731
|
+
allowCall: true
|
1732
|
+
}));
|
1733
|
+
}
|
1734
|
+
|
1735
|
+
result = join(result, 'in');
|
1736
|
+
result = [join(
|
1737
|
+
result,
|
1738
|
+
generateExpression(stmt.right, {
|
1739
|
+
precedence: Precedence.Sequence,
|
1740
|
+
allowIn: true,
|
1741
|
+
allowCall: true
|
1742
|
+
})
|
1743
|
+
), ')'];
|
1744
|
+
});
|
1745
|
+
result.push(maybeBlock(stmt.body, semicolon === ''));
|
1746
|
+
break;
|
1747
|
+
|
1748
|
+
case Syntax.LabeledStatement:
|
1749
|
+
result = [stmt.label.name + ':', maybeBlock(stmt.body, semicolon === '')];
|
1750
|
+
break;
|
1751
|
+
|
1752
|
+
case Syntax.Program:
|
1753
|
+
len = stmt.body.length;
|
1754
|
+
result = [safeConcatenation && len > 0 ? '\n' : ''];
|
1755
|
+
for (i = 0; i < len; i += 1) {
|
1756
|
+
fragment = addIndent(
|
1757
|
+
generateStatement(stmt.body[i], {
|
1758
|
+
semicolonOptional: !safeConcatenation && i === len - 1,
|
1759
|
+
directiveContext: true
|
1760
|
+
})
|
1761
|
+
);
|
1762
|
+
result.push(fragment);
|
1763
|
+
if (i + 1 < len && !endsWithLineTerminator(toSourceNode(fragment).toString())) {
|
1764
|
+
result.push(newline);
|
1765
|
+
}
|
1766
|
+
}
|
1767
|
+
break;
|
1768
|
+
|
1769
|
+
case Syntax.FunctionDeclaration:
|
1770
|
+
result = [(stmt.generator && !extra.moz.starlessGenerator ? 'function* ' : 'function ') + stmt.id.name, generateFunctionBody(stmt)];
|
1771
|
+
break;
|
1772
|
+
|
1773
|
+
case Syntax.ReturnStatement:
|
1774
|
+
if (stmt.argument) {
|
1775
|
+
result = [join(
|
1776
|
+
'return',
|
1777
|
+
generateExpression(stmt.argument, {
|
1778
|
+
precedence: Precedence.Sequence,
|
1779
|
+
allowIn: true,
|
1780
|
+
allowCall: true
|
1781
|
+
})
|
1782
|
+
), semicolon];
|
1783
|
+
} else {
|
1784
|
+
result = ['return' + semicolon];
|
1785
|
+
}
|
1786
|
+
break;
|
1787
|
+
|
1788
|
+
case Syntax.WhileStatement:
|
1789
|
+
withIndent(function () {
|
1790
|
+
result = [
|
1791
|
+
'while' + space + '(',
|
1792
|
+
generateExpression(stmt.test, {
|
1793
|
+
precedence: Precedence.Sequence,
|
1794
|
+
allowIn: true,
|
1795
|
+
allowCall: true
|
1796
|
+
}),
|
1797
|
+
')'
|
1798
|
+
];
|
1799
|
+
});
|
1800
|
+
result.push(maybeBlock(stmt.body, semicolon === ''));
|
1801
|
+
break;
|
1802
|
+
|
1803
|
+
case Syntax.WithStatement:
|
1804
|
+
withIndent(function () {
|
1805
|
+
result = [
|
1806
|
+
'with' + space + '(',
|
1807
|
+
generateExpression(stmt.object, {
|
1808
|
+
precedence: Precedence.Sequence,
|
1809
|
+
allowIn: true,
|
1810
|
+
allowCall: true
|
1811
|
+
}),
|
1812
|
+
')'
|
1813
|
+
];
|
1814
|
+
});
|
1815
|
+
result.push(maybeBlock(stmt.body, semicolon === ''));
|
1816
|
+
break;
|
1817
|
+
|
1818
|
+
default:
|
1819
|
+
throw new Error('Unknown statement type: ' + stmt.type);
|
1820
|
+
}
|
1821
|
+
|
1822
|
+
// Attach comments
|
1823
|
+
|
1824
|
+
if (extra.comment) {
|
1825
|
+
result = addCommentsToStatement(stmt, result);
|
1826
|
+
}
|
1827
|
+
|
1828
|
+
fragment = toSourceNode(result).toString();
|
1829
|
+
if (stmt.type === Syntax.Program && !safeConcatenation && newline === '' && fragment.charAt(fragment.length - 1) === '\n') {
|
1830
|
+
result = toSourceNode(result).replaceRight(/\s+$/, '');
|
1831
|
+
}
|
1832
|
+
|
1833
|
+
return toSourceNode(result, stmt);
|
1834
|
+
}
|
1835
|
+
|
1836
|
+
function generate(node, options) {
|
1837
|
+
var defaultOptions = getDefaultOptions(), result, pair;
|
1838
|
+
|
1839
|
+
if (options != null) {
|
1840
|
+
// Obsolete options
|
1841
|
+
//
|
1842
|
+
// `options.indent`
|
1843
|
+
// `options.base`
|
1844
|
+
//
|
1845
|
+
// Instead of them, we can use `option.format.indent`.
|
1846
|
+
if (typeof options.indent === 'string') {
|
1847
|
+
defaultOptions.format.indent.style = options.indent;
|
1848
|
+
}
|
1849
|
+
if (typeof options.base === 'number') {
|
1850
|
+
defaultOptions.format.indent.base = options.base;
|
1851
|
+
}
|
1852
|
+
options = updateDeeply(defaultOptions, options);
|
1853
|
+
indent = options.format.indent.style;
|
1854
|
+
if (typeof options.base === 'string') {
|
1855
|
+
base = options.base;
|
1856
|
+
} else {
|
1857
|
+
base = stringRepeat(indent, options.format.indent.base);
|
1858
|
+
}
|
1859
|
+
} else {
|
1860
|
+
options = defaultOptions;
|
1861
|
+
indent = options.format.indent.style;
|
1862
|
+
base = stringRepeat(indent, options.format.indent.base);
|
1863
|
+
}
|
1864
|
+
json = options.format.json;
|
1865
|
+
renumber = options.format.renumber;
|
1866
|
+
hexadecimal = json ? false : options.format.hexadecimal;
|
1867
|
+
quotes = json ? 'double' : options.format.quotes;
|
1868
|
+
escapeless = options.format.escapeless;
|
1869
|
+
if (options.format.compact) {
|
1870
|
+
newline = space = indent = base = '';
|
1871
|
+
} else {
|
1872
|
+
newline = '\n';
|
1873
|
+
space = ' ';
|
1874
|
+
}
|
1875
|
+
parentheses = options.format.parentheses;
|
1876
|
+
semicolons = options.format.semicolons;
|
1877
|
+
safeConcatenation = options.format.safeConcatenation;
|
1878
|
+
directive = options.directive;
|
1879
|
+
parse = json ? null : options.parse;
|
1880
|
+
sourceMap = options.sourceMap;
|
1881
|
+
extra = options;
|
1882
|
+
|
1883
|
+
if (sourceMap) {
|
1884
|
+
if (typeof process !== 'undefined') {
|
1885
|
+
// We assume environment is node.js
|
1886
|
+
SourceNode = require('source-map').SourceNode;
|
1887
|
+
} else {
|
1888
|
+
SourceNode = global.sourceMap.SourceNode;
|
1889
|
+
}
|
1890
|
+
} else {
|
1891
|
+
SourceNode = SourceNodeMock;
|
1892
|
+
}
|
1893
|
+
|
1894
|
+
switch (node.type) {
|
1895
|
+
case Syntax.BlockStatement:
|
1896
|
+
case Syntax.BreakStatement:
|
1897
|
+
case Syntax.CatchClause:
|
1898
|
+
case Syntax.ContinueStatement:
|
1899
|
+
case Syntax.DirectiveStatement:
|
1900
|
+
case Syntax.DoWhileStatement:
|
1901
|
+
case Syntax.DebuggerStatement:
|
1902
|
+
case Syntax.EmptyStatement:
|
1903
|
+
case Syntax.ExpressionStatement:
|
1904
|
+
case Syntax.ForStatement:
|
1905
|
+
case Syntax.ForInStatement:
|
1906
|
+
case Syntax.FunctionDeclaration:
|
1907
|
+
case Syntax.IfStatement:
|
1908
|
+
case Syntax.LabeledStatement:
|
1909
|
+
case Syntax.Program:
|
1910
|
+
case Syntax.ReturnStatement:
|
1911
|
+
case Syntax.SwitchStatement:
|
1912
|
+
case Syntax.SwitchCase:
|
1913
|
+
case Syntax.ThrowStatement:
|
1914
|
+
case Syntax.TryStatement:
|
1915
|
+
case Syntax.VariableDeclaration:
|
1916
|
+
case Syntax.VariableDeclarator:
|
1917
|
+
case Syntax.WhileStatement:
|
1918
|
+
case Syntax.WithStatement:
|
1919
|
+
result = generateStatement(node);
|
1920
|
+
break;
|
1921
|
+
|
1922
|
+
case Syntax.AssignmentExpression:
|
1923
|
+
case Syntax.ArrayExpression:
|
1924
|
+
case Syntax.ArrayPattern:
|
1925
|
+
case Syntax.BinaryExpression:
|
1926
|
+
case Syntax.CallExpression:
|
1927
|
+
case Syntax.ConditionalExpression:
|
1928
|
+
case Syntax.FunctionExpression:
|
1929
|
+
case Syntax.Identifier:
|
1930
|
+
case Syntax.Literal:
|
1931
|
+
case Syntax.LogicalExpression:
|
1932
|
+
case Syntax.MemberExpression:
|
1933
|
+
case Syntax.NewExpression:
|
1934
|
+
case Syntax.ObjectExpression:
|
1935
|
+
case Syntax.ObjectPattern:
|
1936
|
+
case Syntax.Property:
|
1937
|
+
case Syntax.SequenceExpression:
|
1938
|
+
case Syntax.ThisExpression:
|
1939
|
+
case Syntax.UnaryExpression:
|
1940
|
+
case Syntax.UpdateExpression:
|
1941
|
+
case Syntax.YieldExpression:
|
1942
|
+
|
1943
|
+
result = generateExpression(node, {
|
1944
|
+
precedence: Precedence.Sequence,
|
1945
|
+
allowIn: true,
|
1946
|
+
allowCall: true
|
1947
|
+
});
|
1948
|
+
break;
|
1949
|
+
|
1950
|
+
default:
|
1951
|
+
throw new Error('Unknown node type: ' + node.type);
|
1952
|
+
}
|
1953
|
+
|
1954
|
+
if (!sourceMap) {
|
1955
|
+
return result.toString();
|
1956
|
+
}
|
1957
|
+
|
1958
|
+
pair = result.toStringWithSourceMap({file: options.sourceMap});
|
1959
|
+
|
1960
|
+
if (options.sourceMapWithCode) {
|
1961
|
+
return pair;
|
1962
|
+
}
|
1963
|
+
return pair.map.toString();
|
1964
|
+
}
|
1965
|
+
|
1966
|
+
// simple visitor implementation
|
1967
|
+
|
1968
|
+
VisitorKeys = {
|
1969
|
+
AssignmentExpression: ['left', 'right'],
|
1970
|
+
ArrayExpression: ['elements'],
|
1971
|
+
ArrayPattern: ['elements'],
|
1972
|
+
BlockStatement: ['body'],
|
1973
|
+
BinaryExpression: ['left', 'right'],
|
1974
|
+
BreakStatement: ['label'],
|
1975
|
+
CallExpression: ['callee', 'arguments'],
|
1976
|
+
CatchClause: ['param', 'body'],
|
1977
|
+
ConditionalExpression: ['test', 'consequent', 'alternate'],
|
1978
|
+
ContinueStatement: ['label'],
|
1979
|
+
DirectiveStatement: [],
|
1980
|
+
DoWhileStatement: ['body', 'test'],
|
1981
|
+
DebuggerStatement: [],
|
1982
|
+
EmptyStatement: [],
|
1983
|
+
ExpressionStatement: ['expression'],
|
1984
|
+
ForStatement: ['init', 'test', 'update', 'body'],
|
1985
|
+
ForInStatement: ['left', 'right', 'body'],
|
1986
|
+
FunctionDeclaration: ['id', 'params', 'body'],
|
1987
|
+
FunctionExpression: ['id', 'params', 'body'],
|
1988
|
+
Identifier: [],
|
1989
|
+
IfStatement: ['test', 'consequent', 'alternate'],
|
1990
|
+
Literal: [],
|
1991
|
+
LabeledStatement: ['label', 'body'],
|
1992
|
+
LogicalExpression: ['left', 'right'],
|
1993
|
+
MemberExpression: ['object', 'property'],
|
1994
|
+
NewExpression: ['callee', 'arguments'],
|
1995
|
+
ObjectExpression: ['properties'],
|
1996
|
+
ObjectPattern: ['properties'],
|
1997
|
+
Program: ['body'],
|
1998
|
+
Property: ['key', 'value'],
|
1999
|
+
ReturnStatement: ['argument'],
|
2000
|
+
SequenceExpression: ['expressions'],
|
2001
|
+
SwitchStatement: ['discriminant', 'cases'],
|
2002
|
+
SwitchCase: ['test', 'consequent'],
|
2003
|
+
ThisExpression: [],
|
2004
|
+
ThrowStatement: ['argument'],
|
2005
|
+
TryStatement: ['block', 'handlers', 'finalizer'],
|
2006
|
+
UnaryExpression: ['argument'],
|
2007
|
+
UpdateExpression: ['argument'],
|
2008
|
+
VariableDeclaration: ['declarations'],
|
2009
|
+
VariableDeclarator: ['id', 'init'],
|
2010
|
+
WhileStatement: ['test', 'body'],
|
2011
|
+
WithStatement: ['object', 'body'],
|
2012
|
+
YieldExpression: ['argument']
|
2013
|
+
};
|
2014
|
+
|
2015
|
+
VisitorOption = {
|
2016
|
+
Break: 1,
|
2017
|
+
Skip: 2
|
2018
|
+
};
|
2019
|
+
|
2020
|
+
function traverse(top, visitor) {
|
2021
|
+
var worklist, leavelist, node, ret, current, current2, candidates, candidate, marker = {};
|
2022
|
+
|
2023
|
+
worklist = [ top ];
|
2024
|
+
leavelist = [ null ];
|
2025
|
+
|
2026
|
+
while (worklist.length) {
|
2027
|
+
node = worklist.pop();
|
2028
|
+
|
2029
|
+
if (node === marker) {
|
2030
|
+
node = leavelist.pop();
|
2031
|
+
if (visitor.leave) {
|
2032
|
+
ret = visitor.leave(node, leavelist[leavelist.length - 1]);
|
2033
|
+
} else {
|
2034
|
+
ret = undefined;
|
2035
|
+
}
|
2036
|
+
if (ret === VisitorOption.Break) {
|
2037
|
+
return;
|
2038
|
+
}
|
2039
|
+
} else if (node) {
|
2040
|
+
if (visitor.enter) {
|
2041
|
+
ret = visitor.enter(node, leavelist[leavelist.length - 1]);
|
2042
|
+
} else {
|
2043
|
+
ret = undefined;
|
2044
|
+
}
|
2045
|
+
|
2046
|
+
if (ret === VisitorOption.Break) {
|
2047
|
+
return;
|
2048
|
+
}
|
2049
|
+
|
2050
|
+
worklist.push(marker);
|
2051
|
+
leavelist.push(node);
|
2052
|
+
|
2053
|
+
if (ret !== VisitorOption.Skip) {
|
2054
|
+
candidates = VisitorKeys[node.type];
|
2055
|
+
current = candidates.length;
|
2056
|
+
while ((current -= 1) >= 0) {
|
2057
|
+
candidate = node[candidates[current]];
|
2058
|
+
if (candidate) {
|
2059
|
+
if (isArray(candidate)) {
|
2060
|
+
current2 = candidate.length;
|
2061
|
+
while ((current2 -= 1) >= 0) {
|
2062
|
+
if (candidate[current2]) {
|
2063
|
+
worklist.push(candidate[current2]);
|
2064
|
+
}
|
2065
|
+
}
|
2066
|
+
} else {
|
2067
|
+
worklist.push(candidate);
|
2068
|
+
}
|
2069
|
+
}
|
2070
|
+
}
|
2071
|
+
}
|
2072
|
+
}
|
2073
|
+
}
|
2074
|
+
}
|
2075
|
+
|
2076
|
+
// based on LLVM libc++ upper_bound / lower_bound
|
2077
|
+
// MIT License
|
2078
|
+
|
2079
|
+
function upperBound(array, func) {
|
2080
|
+
var diff, len, i, current;
|
2081
|
+
|
2082
|
+
len = array.length;
|
2083
|
+
i = 0;
|
2084
|
+
|
2085
|
+
while (len) {
|
2086
|
+
diff = len >>> 1;
|
2087
|
+
current = i + diff;
|
2088
|
+
if (func(array[current])) {
|
2089
|
+
len = diff;
|
2090
|
+
} else {
|
2091
|
+
i = current + 1;
|
2092
|
+
len -= diff + 1;
|
2093
|
+
}
|
2094
|
+
}
|
2095
|
+
return i;
|
2096
|
+
}
|
2097
|
+
|
2098
|
+
function lowerBound(array, func) {
|
2099
|
+
var diff, len, i, current;
|
2100
|
+
|
2101
|
+
len = array.length;
|
2102
|
+
i = 0;
|
2103
|
+
|
2104
|
+
while (len) {
|
2105
|
+
diff = len >>> 1;
|
2106
|
+
current = i + diff;
|
2107
|
+
if (func(array[current])) {
|
2108
|
+
i = current + 1;
|
2109
|
+
len -= diff + 1;
|
2110
|
+
} else {
|
2111
|
+
len = diff;
|
2112
|
+
}
|
2113
|
+
}
|
2114
|
+
return i;
|
2115
|
+
}
|
2116
|
+
|
2117
|
+
function extendCommentRange(comment, tokens) {
|
2118
|
+
var target, token;
|
2119
|
+
|
2120
|
+
target = upperBound(tokens, function search(token) {
|
2121
|
+
return token.range[0] > comment.range[0];
|
2122
|
+
});
|
2123
|
+
|
2124
|
+
comment.extendedRange = [comment.range[0], comment.range[1]];
|
2125
|
+
|
2126
|
+
if (target !== tokens.length) {
|
2127
|
+
comment.extendedRange[1] = tokens[target].range[0];
|
2128
|
+
}
|
2129
|
+
|
2130
|
+
target -= 1;
|
2131
|
+
if (target >= 0) {
|
2132
|
+
if (target < tokens.length) {
|
2133
|
+
comment.extendedRange[0] = tokens[target].range[1];
|
2134
|
+
} else if (token.length) {
|
2135
|
+
comment.extendedRange[1] = tokens[tokens.length - 1].range[0];
|
2136
|
+
}
|
2137
|
+
}
|
2138
|
+
|
2139
|
+
return comment;
|
2140
|
+
}
|
2141
|
+
|
2142
|
+
function attachComments(tree, providedComments, tokens) {
|
2143
|
+
// At first, we should calculate extended comment ranges.
|
2144
|
+
var comments = [], comment, len, i;
|
2145
|
+
|
2146
|
+
if (!tree.range) {
|
2147
|
+
throw new Error('attachComments needs range information');
|
2148
|
+
}
|
2149
|
+
|
2150
|
+
// tokens array is empty, we attach comments to tree as 'leadingComments'
|
2151
|
+
if (!tokens.length) {
|
2152
|
+
if (providedComments.length) {
|
2153
|
+
for (i = 0, len = providedComments.length; i < len; i += 1) {
|
2154
|
+
comment = deepCopy(providedComments[i]);
|
2155
|
+
comment.extendedRange = [0, tree.range[0]];
|
2156
|
+
comments.push(comment);
|
2157
|
+
}
|
2158
|
+
tree.leadingComments = comments;
|
2159
|
+
}
|
2160
|
+
return tree;
|
2161
|
+
}
|
2162
|
+
|
2163
|
+
for (i = 0, len = providedComments.length; i < len; i += 1) {
|
2164
|
+
comments.push(extendCommentRange(deepCopy(providedComments[i]), tokens));
|
2165
|
+
}
|
2166
|
+
|
2167
|
+
// This is based on John Freeman's implementation.
|
2168
|
+
traverse(tree, {
|
2169
|
+
cursor: 0,
|
2170
|
+
enter: function (node) {
|
2171
|
+
var comment;
|
2172
|
+
|
2173
|
+
while (this.cursor < comments.length) {
|
2174
|
+
comment = comments[this.cursor];
|
2175
|
+
if (comment.extendedRange[1] > node.range[0]) {
|
2176
|
+
break;
|
2177
|
+
}
|
2178
|
+
|
2179
|
+
if (comment.extendedRange[1] === node.range[0]) {
|
2180
|
+
if (!node.leadingComments) {
|
2181
|
+
node.leadingComments = [];
|
2182
|
+
}
|
2183
|
+
node.leadingComments.push(comment);
|
2184
|
+
comments.splice(this.cursor, 1);
|
2185
|
+
} else {
|
2186
|
+
this.cursor += 1;
|
2187
|
+
}
|
2188
|
+
}
|
2189
|
+
|
2190
|
+
// already out of owned node
|
2191
|
+
if (this.cursor === comments.length) {
|
2192
|
+
return VisitorOption.Break;
|
2193
|
+
}
|
2194
|
+
|
2195
|
+
if (comments[this.cursor].extendedRange[0] > node.range[1]) {
|
2196
|
+
return VisitorOption.Skip;
|
2197
|
+
}
|
2198
|
+
}
|
2199
|
+
});
|
2200
|
+
|
2201
|
+
traverse(tree, {
|
2202
|
+
cursor: 0,
|
2203
|
+
leave: function (node) {
|
2204
|
+
var comment;
|
2205
|
+
|
2206
|
+
while (this.cursor < comments.length) {
|
2207
|
+
comment = comments[this.cursor];
|
2208
|
+
if (node.range[1] < comment.extendedRange[0]) {
|
2209
|
+
break;
|
2210
|
+
}
|
2211
|
+
|
2212
|
+
if (node.range[1] === comment.extendedRange[0]) {
|
2213
|
+
if (!node.trailingComments) {
|
2214
|
+
node.trailingComments = [];
|
2215
|
+
}
|
2216
|
+
node.trailingComments.push(comment);
|
2217
|
+
comments.splice(this.cursor, 1);
|
2218
|
+
} else {
|
2219
|
+
this.cursor += 1;
|
2220
|
+
}
|
2221
|
+
}
|
2222
|
+
|
2223
|
+
// already out of owned node
|
2224
|
+
if (this.cursor === comments.length) {
|
2225
|
+
return VisitorOption.Break;
|
2226
|
+
}
|
2227
|
+
|
2228
|
+
if (comments[this.cursor].extendedRange[0] > node.range[1]) {
|
2229
|
+
return VisitorOption.Skip;
|
2230
|
+
}
|
2231
|
+
}
|
2232
|
+
});
|
2233
|
+
|
2234
|
+
return tree;
|
2235
|
+
}
|
2236
|
+
|
2237
|
+
// Sync with package.json.
|
2238
|
+
exports.version = '0.0.15';
|
2239
|
+
|
2240
|
+
exports.generate = generate;
|
2241
|
+
exports.traverse = traverse;
|
2242
|
+
exports.attachComments = attachComments;
|
2243
|
+
|
2244
|
+
}, this));
|
2245
|
+
/* vim: set sw=4 ts=4 et tw=80 : */
|