traceur-rb 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/README.md +2 -2
- data/lib/js/compile.js +7 -15
- data/lib/traceur.rb +2 -1
- data/lib/traceur/compilation_error.rb +27 -0
- data/lib/traceur/compiler.rb +4 -1
- data/lib/traceur/configuration.rb +1 -1
- data/lib/traceur/node/runner.rb +1 -1
- data/lib/traceur/version.rb +1 -1
- data/spec/examples/syntax_error.js +3 -0
- data/spec/integration/examples_spec.rb +6 -0
- data/vendor/node_modules/traceur/LICENSE +202 -0
- data/vendor/node_modules/traceur/README.md +5 -5
- data/vendor/node_modules/traceur/bin/traceur-runtime.js +1392 -623
- data/vendor/node_modules/traceur/bin/traceur.js +24749 -17990
- data/vendor/node_modules/traceur/node_modules/.bin/semver +2 -2
- data/vendor/node_modules/traceur/node_modules/commander/History.md +222 -0
- data/vendor/node_modules/traceur/node_modules/commander/Readme.md +127 -35
- data/vendor/node_modules/traceur/node_modules/commander/index.js +261 -93
- data/vendor/node_modules/traceur/node_modules/commander/package.json +41 -9
- data/vendor/node_modules/traceur/node_modules/glob/LICENSE +15 -0
- data/vendor/node_modules/traceur/node_modules/glob/README.md +357 -0
- data/vendor/node_modules/traceur/node_modules/glob/common.js +177 -0
- data/vendor/node_modules/traceur/node_modules/glob/glob.js +649 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/inflight/.eslintrc +17 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/inflight/LICENSE +15 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/inflight/README.md +37 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/inflight/inflight.js +44 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/inflight/node_modules/wrappy/LICENSE +15 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/inflight/node_modules/wrappy/README.md +36 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/inflight/node_modules/wrappy/package.json +34 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/inflight/node_modules/wrappy/test/basic.js +51 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/inflight/node_modules/wrappy/wrappy.js +33 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/inflight/package.json +61 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/inflight/test.js +97 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/inherits/LICENSE +16 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/inherits/README.md +42 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/inherits/inherits.js +1 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/inherits/inherits_browser.js +23 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/inherits/package.json +33 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/inherits/test.js +25 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/.npmignore +1 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/.travis.yml +4 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/LICENSE +23 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/README.md +216 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/benchmark.js +15 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/browser.js +1181 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/minimatch.js +845 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/.npmignore +2 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/.travis.yml +3 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/README.md +121 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/example.js +8 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/index.js +191 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/.npmignore +2 -0
- data/vendor/node_modules/traceur/node_modules/{q-io/node_modules/collections → glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match}/.travis.yml +0 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/Makefile +6 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/README.md +80 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/example.js +5 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/index.js +38 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/package.json +73 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/test/balanced.js +56 -0
- data/vendor/node_modules/traceur/node_modules/{q-io/node_modules/url2 → glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map}/.travis.yml +1 -1
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/LICENSE +18 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/README.markdown +62 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/example/map.js +6 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/index.js +13 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/package.json +83 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/test/map.js +39 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/package.json +75 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/bash-comparison.js +32 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/bash-results.txt +1075 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/cases.txt +182 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/dollar.js +9 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/empty-option.js +10 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/generate.sh +24 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/negative-increment.js +15 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/nested.js +16 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/order.js +10 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/pad.js +13 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/same-type.js +7 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/sequence.js +50 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/package.json +60 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/test/basic.js +399 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/test/brace-expand.js +45 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/test/defaults.js +274 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/test/extglob-ending-with-state-char.js +8 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/once/LICENSE +27 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/once/README.md +51 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/once/node_modules/wrappy/LICENSE +15 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/once/node_modules/wrappy/README.md +36 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/once/node_modules/wrappy/package.json +34 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/once/node_modules/wrappy/test/basic.js +51 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/once/node_modules/wrappy/wrappy.js +33 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/once/once.js +21 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/once/package.json +42 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/once/test/once.js +23 -0
- data/vendor/node_modules/traceur/node_modules/glob/package.json +72 -0
- data/vendor/node_modules/traceur/node_modules/glob/sync.js +409 -0
- data/vendor/node_modules/traceur/node_modules/rsvp/.release.json +17 -0
- data/vendor/node_modules/traceur/node_modules/rsvp/CHANGELOG.md +165 -0
- data/vendor/node_modules/traceur/node_modules/rsvp/LICENSE +19 -0
- data/vendor/node_modules/traceur/node_modules/rsvp/README.md +364 -0
- data/vendor/node_modules/traceur/node_modules/rsvp/dist/rsvp.js +1671 -0
- data/vendor/node_modules/traceur/node_modules/rsvp/dist/rsvp.min.js +9 -0
- data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp.js +66 -0
- data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp.umd.js +50 -0
- data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/-internal.js +265 -0
- data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/all-settled.js +71 -0
- data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/all.js +15 -0
- data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/asap.js +109 -0
- data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/config.js +28 -0
- data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/defer.js +45 -0
- data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/enumerator.js +125 -0
- data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/events.js +201 -0
- data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/filter.js +120 -0
- data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/hash-settled.js +124 -0
- data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/hash.js +94 -0
- data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/instrument.js +41 -0
- data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/map.js +99 -0
- data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/node.js +281 -0
- data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/promise-hash.js +51 -0
- data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/promise.js +496 -0
- data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/promise/all.js +52 -0
- data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/promise/race.js +105 -0
- data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/promise/reject.js +47 -0
- data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/promise/resolve.js +49 -0
- data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/race.js +15 -0
- data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/reject.js +16 -0
- data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/resolve.js +17 -0
- data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/rethrow.js +46 -0
- data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/utils.js +39 -0
- data/vendor/node_modules/traceur/node_modules/rsvp/package.json +100 -0
- data/vendor/node_modules/traceur/node_modules/rsvp/rsvp.js/README.md +9 -0
- data/vendor/node_modules/traceur/node_modules/rsvp/rsvp.js/bower.json +22 -0
- data/vendor/node_modules/traceur/node_modules/rsvp/rsvp.js/composer.json +18 -0
- data/vendor/node_modules/traceur/node_modules/rsvp/rsvp.js/package.json +52 -0
- data/vendor/node_modules/traceur/node_modules/rsvp/rsvp.js/rsvp.amd.js +1607 -0
- data/vendor/node_modules/traceur/node_modules/rsvp/rsvp.js/rsvp.js +1566 -0
- data/vendor/node_modules/traceur/node_modules/rsvp/rsvp.js/rsvp.min.js +26 -0
- data/vendor/node_modules/traceur/node_modules/rsvp/vertx.js +1 -0
- data/vendor/node_modules/traceur/node_modules/semver/bin/semver +2 -2
- data/vendor/node_modules/traceur/node_modules/semver/package.json +4 -3
- data/vendor/node_modules/traceur/node_modules/semver/semver.browser.js +7 -0
- data/vendor/node_modules/traceur/node_modules/semver/semver.browser.js.gz +0 -0
- data/vendor/node_modules/traceur/node_modules/semver/semver.js +7 -0
- data/vendor/node_modules/traceur/node_modules/semver/semver.min.js +1 -1
- data/vendor/node_modules/traceur/node_modules/semver/semver.min.js.gz +0 -0
- data/vendor/node_modules/traceur/node_modules/semver/test/index.js +8 -4
- data/vendor/node_modules/traceur/node_modules/semver/test/ltr.js +2 -1
- data/vendor/node_modules/traceur/node_modules/source-map-support/.npmignore +1 -0
- data/vendor/node_modules/traceur/node_modules/{q-io/node_modules/mime/LICENSE → source-map-support/LICENSE.md} +7 -5
- data/vendor/node_modules/traceur/node_modules/source-map-support/README.md +165 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/amd-test/browser-source-map-support.js +89 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/amd-test/index.html +6 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/amd-test/require.js +36 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/amd-test/script.coffee +13 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/amd-test/script.js +24 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/amd-test/script.map +10 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/browser-source-map-support.js +89 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/browser-test/index.html +6 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/browser-test/script.coffee +12 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/browser-test/script.js +25 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/browser-test/script.map +10 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/build.js +69 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/header-test/index.html +6 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/header-test/script.coffee +12 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/header-test/script.js +25 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/header-test/script.map +10 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/header-test/server.js +45 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/.npmignore +2 -0
- data/vendor/node_modules/traceur/node_modules/{q-io → source-map-support/node_modules/source-map}/.travis.yml +1 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/CHANGELOG.md +121 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/LICENSE +28 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/Makefile.dryice.js +166 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/README.md +434 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/build/assert-shim.js +56 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/build/mini-require.js +152 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/build/prefix-source-map.jsm +20 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/build/prefix-utils.jsm +18 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/build/suffix-browser.js +8 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/build/suffix-source-map.jsm +6 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/build/suffix-utils.jsm +21 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/build/test-prefix.js +8 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/build/test-suffix.js +3 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/lib/source-map.js +8 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/lib/source-map/array-set.js +97 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/lib/source-map/base64-vlq.js +144 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/lib/source-map/base64.js +42 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/lib/source-map/binary-search.js +81 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/lib/source-map/source-map-consumer.js +478 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/lib/source-map/source-map-generator.js +380 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/lib/source-map/source-node.js +371 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/lib/source-map/util.js +205 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/node_modules/amdefine/LICENSE +58 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/node_modules/amdefine/README.md +171 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/node_modules/amdefine/amdefine.js +299 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/node_modules/amdefine/intercept.js +36 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/node_modules/amdefine/package.json +37 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/package.json +142 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/test/run-tests.js +62 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/test/source-map/test-api.js +26 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/test/source-map/test-array-set.js +104 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/test/source-map/test-base64-vlq.js +24 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/test/source-map/test-base64.js +35 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/test/source-map/test-binary-search.js +54 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/test/source-map/test-dog-fooding.js +72 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/test/source-map/test-source-map-consumer.js +451 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/test/source-map/test-source-map-generator.js +417 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/test/source-map/test-source-node.js +365 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/test/source-map/util.js +161 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/package.json +52 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/source-map-support.js +381 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/test.js +359 -0
- data/vendor/node_modules/traceur/package.json +234 -20
- data/vendor/node_modules/traceur/src/node/NodeCompiler.js +78 -0
- data/vendor/node_modules/traceur/src/node/System.js +32 -5
- data/vendor/node_modules/traceur/src/node/api.js +28 -93
- data/vendor/node_modules/traceur/src/node/command.js +84 -19
- data/vendor/node_modules/traceur/src/node/compileAllJsFilesInDir.js +40 -0
- data/vendor/node_modules/traceur/src/node/interpreter.js +11 -8
- data/vendor/node_modules/traceur/src/node/recursiveModuleCompile.js +171 -0
- data/vendor/node_modules/traceur/src/node/require.js +7 -21
- data/vendor/node_modules/traceur/src/node/to-amd-compiler.js +2 -7
- data/vendor/node_modules/traceur/src/node/to-closure-compiler.js +28 -0
- data/vendor/node_modules/traceur/src/node/to-commonjs-compiler.js +3 -7
- data/vendor/node_modules/traceur/src/node/traceur.js +1 -1
- metadata +196 -190
- data/vendor/node_modules/traceur/node_modules/q-io/.npmignore +0 -1
- data/vendor/node_modules/traceur/node_modules/q-io/CHANGES.md +0 -122
- data/vendor/node_modules/traceur/node_modules/q-io/LICENSE +0 -19
- data/vendor/node_modules/traceur/node_modules/q-io/README.md +0 -928
- data/vendor/node_modules/traceur/node_modules/q-io/buffer-stream.js +0 -59
- data/vendor/node_modules/traceur/node_modules/q-io/coverage-report.js +0 -44
- data/vendor/node_modules/traceur/node_modules/q-io/deprecate.js +0 -51
- data/vendor/node_modules/traceur/node_modules/q-io/fs-boot.js +0 -307
- data/vendor/node_modules/traceur/node_modules/q-io/fs-common.js +0 -499
- data/vendor/node_modules/traceur/node_modules/q-io/fs-mock.js +0 -547
- data/vendor/node_modules/traceur/node_modules/q-io/fs-root.js +0 -105
- data/vendor/node_modules/traceur/node_modules/q-io/fs.js +0 -355
- data/vendor/node_modules/traceur/node_modules/q-io/fs2http.js +0 -65
- data/vendor/node_modules/traceur/node_modules/q-io/http-apps.js +0 -152
- data/vendor/node_modules/traceur/node_modules/q-io/http-apps/chain.js +0 -24
- data/vendor/node_modules/traceur/node_modules/q-io/http-apps/content.js +0 -93
- data/vendor/node_modules/traceur/node_modules/q-io/http-apps/cookie.js +0 -154
- data/vendor/node_modules/traceur/node_modules/q-io/http-apps/decorators.js +0 -178
- data/vendor/node_modules/traceur/node_modules/q-io/http-apps/fs.js +0 -417
- data/vendor/node_modules/traceur/node_modules/q-io/http-apps/html.js +0 -58
- data/vendor/node_modules/traceur/node_modules/q-io/http-apps/json.js +0 -78
- data/vendor/node_modules/traceur/node_modules/q-io/http-apps/negotiate.js +0 -120
- data/vendor/node_modules/traceur/node_modules/q-io/http-apps/proxy.js +0 -27
- data/vendor/node_modules/traceur/node_modules/q-io/http-apps/redirect.js +0 -209
- data/vendor/node_modules/traceur/node_modules/q-io/http-apps/route.js +0 -125
- data/vendor/node_modules/traceur/node_modules/q-io/http-apps/status.js +0 -175
- data/vendor/node_modules/traceur/node_modules/q-io/http-cookie.js +0 -75
- data/vendor/node_modules/traceur/node_modules/q-io/http.js +0 -378
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/.npmignore +0 -11
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/CHANGES.md +0 -78
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/LICENSE.md +0 -21
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/README.md +0 -1285
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/collections.js +0 -22
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/dict.js +0 -142
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/fast-map.js +0 -57
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/fast-set.js +0 -183
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/generic-collection.js +0 -261
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/generic-map.js +0 -186
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/generic-order.js +0 -55
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/generic-set.js +0 -59
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/heap.js +0 -236
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/iterator.js +0 -371
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/list.js +0 -435
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/listen/array-changes.js +0 -247
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/listen/map-changes.js +0 -147
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/listen/property-changes.js +0 -448
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/listen/range-changes.js +0 -139
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/lru-map.js +0 -79
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/lru-set.js +0 -142
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/map.js +0 -60
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/multi-map.js +0 -41
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/node_modules/weak-map/package.json +0 -12
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/node_modules/weak-map/sync +0 -7
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/node_modules/weak-map/sync.patch +0 -48
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/node_modules/weak-map/weak-map.js +0 -590
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/package.json +0 -49
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/set.js +0 -173
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/shim-array.js +0 -274
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/shim-function.js +0 -59
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/shim-object.js +0 -538
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/shim-regexp.js +0 -14
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/shim.js +0 -6
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/sorted-array-map.js +0 -49
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/sorted-array-set.js +0 -51
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/sorted-array.js +0 -269
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/sorted-map.js +0 -61
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/sorted-set.js +0 -736
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/tree-log.js +0 -40
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/weak-map.js +0 -1
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/mime/README.md +0 -66
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/mime/mime.js +0 -114
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/mime/package.json +0 -35
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/mime/test.js +0 -84
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/mime/types/mime.types +0 -1588
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/mime/types/node.types +0 -77
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/mimeparse/CHANGES +0 -15
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/mimeparse/LICENSE +0 -19
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/mimeparse/README +0 -96
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/mimeparse/lib/mimeparse.js +0 -166
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/mimeparse/package.json +0 -43
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/q/CONTRIBUTING.md +0 -40
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/q/LICENSE +0 -19
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/q/README.md +0 -813
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/q/benchmark/compare-with-callbacks.js +0 -71
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/q/benchmark/scenarios.js +0 -36
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/q/package.json +0 -93
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/q/q.js +0 -1937
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/q/queue.js +0 -35
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/.gitmodules +0 -6
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/History.md +0 -36
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/Makefile +0 -7
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/Readme.md +0 -38
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/benchmark.js +0 -32
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/examples.js +0 -39
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/index.js +0 -2
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/lib/querystring.js +0 -123
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/package.json +0 -19
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/.gitmodules +0 -3
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/.npmignore +0 -3
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/History.md +0 -128
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/Makefile +0 -53
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/Readme.md +0 -61
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/bin/expresso +0 -856
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/docs/api.html +0 -1080
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/docs/index.html +0 -377
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/docs/index.md +0 -290
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/docs/layout/foot.html +0 -3
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/docs/layout/head.html +0 -42
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/lib/bar.js +0 -4
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/lib/foo.js +0 -16
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/package.json +0 -12
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/test/assert.test.js +0 -91
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/test/async.test.js +0 -12
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/test/bar.test.js +0 -13
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/test/foo.test.js +0 -14
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/test/http.test.js +0 -146
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/test/serial/async.test.js +0 -39
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/test/serial/http.test.js +0 -48
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/should/.gitmodules +0 -3
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/should/History.md +0 -22
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/should/Makefile +0 -6
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/should/Readme.md +0 -248
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/should/examples/runner.js +0 -53
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/should/index.js +0 -2
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/should/lib/eql.js +0 -91
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/should/lib/should.js +0 -548
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/should/package.json +0 -8
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/should/test/should.test.js +0 -358
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/test/querystring.test.js +0 -133
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/url2/.npmignore +0 -3
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/url2/LICENSE.md +0 -20
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/url2/README.md +0 -33
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/url2/package.json +0 -37
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/url2/test/url2-spec.js +0 -125
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/url2/url2.js +0 -151
- data/vendor/node_modules/traceur/node_modules/q-io/package.json +0 -51
- data/vendor/node_modules/traceur/node_modules/q-io/reader.js +0 -133
- data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/boot-directory-spec.js +0 -47
- data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/contains-spec.js +0 -11
- data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/fixtures/hello.txt +0 -1
- data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/issues/1-spec.js +0 -33
- data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/make-tree-spec.js +0 -92
- data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/append-spec.js +0 -41
- data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/copy-tree-spec.js +0 -57
- data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/fixture/hello.txt +0 -1
- data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/link-spec.js +0 -70
- data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/make-tree-spec.js +0 -109
- data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/merge-spec.js +0 -67
- data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/move-spec.js +0 -219
- data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/object-spec.js +0 -20
- data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/range-spec.js +0 -26
- data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/read-spec.js +0 -40
- data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/remove-directory-spec.js +0 -37
- data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/remove-tree-spec.js +0 -39
- data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/root-spec.js +0 -32
- data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/stat-spec.js +0 -26
- data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/symbolic-link-spec.js +0 -86
- data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/working-directory-spec.js +0 -31
- data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/write-spec.js +0 -73
- data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/range-spec.js +0 -23
- data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/range-spec.txt +0 -1
- data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/read-spec.js +0 -22
- data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/relative-spec.js +0 -25
- data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/reroot-spec.js +0 -45
- data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/write-spec.js +0 -38
- data/vendor/node_modules/traceur/node_modules/q-io/spec/http-apps/cookie-spec.js +0 -52
- data/vendor/node_modules/traceur/node_modules/q-io/spec/http-apps/directory-list-spec.js +0 -86
- data/vendor/node_modules/traceur/node_modules/q-io/spec/http-apps/fixtures/01234.txt +0 -1
- data/vendor/node_modules/traceur/node_modules/q-io/spec/http-apps/fixtures/1234.txt +0 -1
- data/vendor/node_modules/traceur/node_modules/q-io/spec/http-apps/fixtures/5678.txt +0 -0
- data/vendor/node_modules/traceur/node_modules/q-io/spec/http-apps/fixtures/9012/3456.txt +0 -0
- data/vendor/node_modules/traceur/node_modules/q-io/spec/http-apps/hosts-spec.js +0 -49
- data/vendor/node_modules/traceur/node_modules/q-io/spec/http-apps/interpret-range-spec.js +0 -47
- data/vendor/node_modules/traceur/node_modules/q-io/spec/http-apps/partial-range-spec.js +0 -186
- data/vendor/node_modules/traceur/node_modules/q-io/spec/http-apps/proxy-spec.js +0 -82
- data/vendor/node_modules/traceur/node_modules/q-io/spec/http-apps/symbolic-link-spec.js +0 -110
- data/vendor/node_modules/traceur/node_modules/q-io/spec/http/agent-spec.js +0 -96
- data/vendor/node_modules/traceur/node_modules/q-io/spec/http/basic-spec.js +0 -96
- data/vendor/node_modules/traceur/node_modules/q-io/spec/lib/jasmine-promise.js +0 -42
- data/vendor/node_modules/traceur/node_modules/q-io/writer.js +0 -111
- data/vendor/node_modules/traceur/src/node/compile-single-file.js +0 -69
- data/vendor/node_modules/traceur/src/node/compiler.js +0 -116
- data/vendor/node_modules/traceur/src/node/inline-module.js +0 -149
@@ -1,65 +0,0 @@
|
|
1
|
-
|
2
|
-
var Q = require("q");
|
3
|
-
var HTTP = require("./http");
|
4
|
-
var URL = require("url");
|
5
|
-
|
6
|
-
exports.Client = Client;
|
7
|
-
function Client(fs) {
|
8
|
-
var self = Object.create(Client.prototype);
|
9
|
-
|
10
|
-
self.request = function (request) {
|
11
|
-
return Q.when(request, function (request) {
|
12
|
-
request = HTTP.normalizeRequest(request);
|
13
|
-
var url = URL.parse(request.url);
|
14
|
-
if (url.protocol !== "file:") {
|
15
|
-
return {
|
16
|
-
status: 404,
|
17
|
-
headers: {},
|
18
|
-
body: ["Can't access protocol " + url.protocol]
|
19
|
-
};
|
20
|
-
} else {
|
21
|
-
var path = url.pathname;
|
22
|
-
return fs.open(path, {
|
23
|
-
charset: request.charset
|
24
|
-
}).then(function (body) {
|
25
|
-
return {
|
26
|
-
status: 200,
|
27
|
-
headers: {},
|
28
|
-
body: body
|
29
|
-
};
|
30
|
-
});
|
31
|
-
}
|
32
|
-
});
|
33
|
-
};
|
34
|
-
|
35
|
-
self.read = function (request, qualifier) {
|
36
|
-
qualifier = qualifier || function (response) {
|
37
|
-
return response.status === 200;
|
38
|
-
};
|
39
|
-
return Q.when(exports.request(request), function (response) {
|
40
|
-
if (!qualifier(response)){
|
41
|
-
var error = new Error("HTTP request failed with code " + response.status);
|
42
|
-
error.response = response;
|
43
|
-
throw error;
|
44
|
-
}
|
45
|
-
return Q.invoke(response.body, "read");
|
46
|
-
});
|
47
|
-
};
|
48
|
-
|
49
|
-
return self;
|
50
|
-
}
|
51
|
-
|
52
|
-
exports.request = function (request) {
|
53
|
-
return Q.fcall(require.async || require, "./fs")
|
54
|
-
.then(function (fs) {
|
55
|
-
return Client(fs).request(request);
|
56
|
-
});
|
57
|
-
};
|
58
|
-
|
59
|
-
exports.read = function (request, qualifier) {
|
60
|
-
return Q.fcall(require.async || require, "./fs")
|
61
|
-
.then(function (fs) {
|
62
|
-
return Client(fs).read(request);
|
63
|
-
});
|
64
|
-
};
|
65
|
-
|
@@ -1,152 +0,0 @@
|
|
1
|
-
|
2
|
-
/**
|
3
|
-
* Provides tools for making, routing, adapting, and decorating
|
4
|
-
* Q-JSGI web applications.
|
5
|
-
*
|
6
|
-
* Duck Types
|
7
|
-
* ----------
|
8
|
-
*
|
9
|
-
* A Q-JSGI _app_ is a function that accepts a request and returns a
|
10
|
-
* response. The response may be promised.
|
11
|
-
*
|
12
|
-
* A Q-JSGI _request_ is an object or a promise for an object that has
|
13
|
-
* the following properties:
|
14
|
-
*
|
15
|
-
* * `method` is the HTTP request method as a string.
|
16
|
-
* * `path` is a string, guaranteed to start with `"/"`.
|
17
|
-
* * `headers` is an object mapping lower-case HTTP headers to
|
18
|
-
* their corresponding values as strings.
|
19
|
-
* * `body` is a Q-JSGI content body.
|
20
|
-
*
|
21
|
-
* A Q-JSGI _response_ is an object or a promise for an object that
|
22
|
-
* has the following properties:
|
23
|
-
*
|
24
|
-
* * `status` is the HTTP response status code as a number.
|
25
|
-
* * `headers` is an object mapping lower-case HTTP headers to their
|
26
|
-
* corresponding values as strings.
|
27
|
-
* * `body` is a Q-JSGI content body.
|
28
|
-
*
|
29
|
-
* A Q-JSGI response and request content _body_ can be as simple as an
|
30
|
-
* array of strings. It can be a promise. In general, it must be an
|
31
|
-
* object that has a `forEach` method. The `forEach` method accepts a
|
32
|
-
* `write` function. It goes without saying that `forEach` returns
|
33
|
-
* `undefined`, but it can return a promise for `undefined` that will
|
34
|
-
* resolve when it has made all of its `write` calls and the request
|
35
|
-
* or response can be closed, re-used, or kept alive.. The `forEach`
|
36
|
-
* function may call `write` with a `String` any number of times. The
|
37
|
-
* `String` may be promised.
|
38
|
-
*
|
39
|
-
* @module
|
40
|
-
*/
|
41
|
-
|
42
|
-
require("collections/shim");
|
43
|
-
var Q = require("q");
|
44
|
-
var HTTP = require("./http");
|
45
|
-
var FS = require("./fs");
|
46
|
-
var URL = require("url2");
|
47
|
-
var inspect = require("util").inspect;
|
48
|
-
|
49
|
-
exports.Chain = require("./http-apps/chain");
|
50
|
-
|
51
|
-
var RouteApps = require("./http-apps/route");
|
52
|
-
exports.Cap = RouteApps.Cap;
|
53
|
-
exports.Tap = RouteApps.Tap;
|
54
|
-
exports.Trap = RouteApps.Trap;
|
55
|
-
exports.Branch = RouteApps.Branch;
|
56
|
-
|
57
|
-
var ContentApps = require("./http-apps/content");
|
58
|
-
exports.Content = ContentApps.Content;
|
59
|
-
exports.content = ContentApps.content;
|
60
|
-
exports.ok = ContentApps.ok;
|
61
|
-
exports.ContentRequest = ContentApps.ContentRequest;
|
62
|
-
exports.Inspect = ContentApps.Inspect;
|
63
|
-
exports.ParseQuery = ContentApps.ParseQuery;
|
64
|
-
|
65
|
-
var FsApps = require("./http-apps/fs");
|
66
|
-
exports.File = FsApps.File;
|
67
|
-
exports.FileTree = FsApps.FileTree;
|
68
|
-
exports.file = FsApps.file;
|
69
|
-
exports.directory = FsApps.directory;
|
70
|
-
exports.etag = FsApps.etag;
|
71
|
-
|
72
|
-
exports.ListDirectories = FsApps.ListDirectories;
|
73
|
-
exports.listDirectory = FsApps.listDirectory;
|
74
|
-
exports.listDirectoryHtmlFragment = FsApps.listDirectoryHtmlFragment;
|
75
|
-
exports.listDirectoryText = FsApps.listDirectoryText;
|
76
|
-
exports.listDirectoryMarkdown = FsApps.listDirectoryMarkdown;
|
77
|
-
exports.listDirectoryJson = FsApps.listDirectoryJson;
|
78
|
-
exports.listDirectoryData = FsApps.listDirectoryData;
|
79
|
-
exports.DirectoryIndex = FsApps.DirectoryIndex;
|
80
|
-
|
81
|
-
var HtmlApps = require("./http-apps/html");
|
82
|
-
exports.HandleHtmlFragmentResponses = HtmlApps.HandleHtmlFragmentResponses;
|
83
|
-
exports.handleHtmlFragmentResponse = HtmlApps.handleHtmlFragmentResponse;
|
84
|
-
exports.escapeHtml = HtmlApps.escapeHtml;
|
85
|
-
|
86
|
-
var JsonApps = require("./http-apps/json");
|
87
|
-
exports.HandleJsonResponses = JsonApps.HandleJsonResponses;
|
88
|
-
exports.handleJsonResponse = JsonApps.handleJsonResponse;
|
89
|
-
exports.Json = JsonApps.Json;
|
90
|
-
exports.json = JsonApps.json;
|
91
|
-
exports.JsonRequest = JsonApps.JsonRequest;
|
92
|
-
|
93
|
-
var RedirectApps = require("./http-apps/redirect");
|
94
|
-
exports.PermanentRedirect = RedirectApps.PermanentRedirect;
|
95
|
-
exports.PermanentRedirectTree = RedirectApps.PermanentRedirectTree;
|
96
|
-
exports.TemporaryRedirect = RedirectApps.TemporaryRedirect;
|
97
|
-
exports.TemporaryRedirectTree = RedirectApps.TemporaryRedirectTree;
|
98
|
-
exports.Redirect = RedirectApps.Redirect;
|
99
|
-
exports.RedirectTree = RedirectApps.RedirectTree;
|
100
|
-
exports.permanentRedirect = RedirectApps.permanentRedirect;
|
101
|
-
exports.permanentRedirectTree = RedirectApps.permanentRedirectTree;
|
102
|
-
exports.temporaryRedirect = RedirectApps.temporaryRedirect;
|
103
|
-
exports.temporaryRedirectTree = RedirectApps.temporaryRedirectTree;
|
104
|
-
exports.redirectTree = RedirectApps.redirectTree;
|
105
|
-
exports.redirect = RedirectApps.redirect;
|
106
|
-
exports.redirectText = RedirectApps.redirectText;
|
107
|
-
exports.redirectHtml = RedirectApps.redirectHtml;
|
108
|
-
exports.RedirectTrap = RedirectApps.RedirectTrap;
|
109
|
-
exports.isRedirect = RedirectApps.isRedirect;
|
110
|
-
|
111
|
-
var ProxyApps = require("./http-apps/proxy");
|
112
|
-
exports.Proxy = ProxyApps.Proxy;
|
113
|
-
exports.ProxyTree = ProxyApps.ProxyTree;
|
114
|
-
|
115
|
-
var NegotiationApps = require("./http-apps/negotiate");
|
116
|
-
exports.negotiate = NegotiationApps.negotiate;
|
117
|
-
exports.Method = NegotiationApps.Method;
|
118
|
-
exports.ContentType = NegotiationApps.ContentType;
|
119
|
-
exports.Language = NegotiationApps.Language;
|
120
|
-
exports.Charset = NegotiationApps.Charset;
|
121
|
-
exports.Encoding = NegotiationApps.Encoding;
|
122
|
-
exports.Host = NegotiationApps.Host;
|
123
|
-
exports.Select = NegotiationApps.Select;
|
124
|
-
|
125
|
-
var StatusApps = require("./http-apps/status");
|
126
|
-
exports.statusCodes = StatusApps.statusCodes;
|
127
|
-
exports.statusMessages = StatusApps.statusMessages;
|
128
|
-
exports.statusWithNoEntityBody = StatusApps.statusWithNoEntityBody;
|
129
|
-
exports.appForStatus = StatusApps.appForStatus;
|
130
|
-
exports.responseForStatus = StatusApps.responseForStatus;
|
131
|
-
exports.textResponseForStatus = StatusApps.textResponseForStatus;
|
132
|
-
exports.htmlResponseForStatus = StatusApps.htmlResponseForStatus;
|
133
|
-
exports.badRequest = StatusApps.badRequest;
|
134
|
-
exports.notFound = StatusApps.notFound;
|
135
|
-
exports.methodNotAllowed = StatusApps.methodNotAllowed;
|
136
|
-
exports.noLanguage = StatusApps.noLanguage;
|
137
|
-
exports.notAcceptable = StatusApps.notAcceptable;
|
138
|
-
|
139
|
-
var DecoratorApps = require("./http-apps/decorators");
|
140
|
-
exports.Normalize = DecoratorApps.Normalize;
|
141
|
-
exports.Date = DecoratorApps.Date;
|
142
|
-
exports.Error = DecoratorApps.Error;
|
143
|
-
exports.Debug = DecoratorApps.Debug;
|
144
|
-
exports.Log = DecoratorApps.Log;
|
145
|
-
exports.Time = DecoratorApps.Time;
|
146
|
-
exports.Headers = DecoratorApps.Headers;
|
147
|
-
exports.Permanent = DecoratorApps.Permanent;
|
148
|
-
exports.Decorators = DecoratorApps.Decorators;
|
149
|
-
|
150
|
-
var CookieApps = require("./http-apps/cookie");
|
151
|
-
exports.CookieJar = CookieApps.CookieJar;
|
152
|
-
|
@@ -1,24 +0,0 @@
|
|
1
|
-
|
2
|
-
module.exports = Chain;
|
3
|
-
function Chain(end) {
|
4
|
-
var self = Object.create(Chain.prototype);
|
5
|
-
self.end = end || function (next) {
|
6
|
-
return next;
|
7
|
-
};
|
8
|
-
return self;
|
9
|
-
};
|
10
|
-
|
11
|
-
Chain.prototype.use = function (App /*, ...args*/) {
|
12
|
-
if (!App) throw new Error("App is not defined after " + this.app);
|
13
|
-
var args = Array.prototype.slice.call(arguments, 1);
|
14
|
-
var self = this;
|
15
|
-
this.end = (function (End) {
|
16
|
-
return function Self(next) {
|
17
|
-
if (self.end !== Self && !next) throw new Error("App chain is broken after " + App);
|
18
|
-
return End(App.apply(null, [next].concat(args)));
|
19
|
-
};
|
20
|
-
})(this.end);
|
21
|
-
this.app = App;
|
22
|
-
return this;
|
23
|
-
};
|
24
|
-
|
@@ -1,93 +0,0 @@
|
|
1
|
-
var Q = require("q");
|
2
|
-
var Negotiate = require("./negotiate");
|
3
|
-
var QS = require("qs");
|
4
|
-
var URL = require("url2");
|
5
|
-
|
6
|
-
/**
|
7
|
-
* Makes an app that returns a response with static content
|
8
|
-
* from memory.
|
9
|
-
* @param {Body} body a Q-JSGI
|
10
|
-
* response body
|
11
|
-
* @param {String} contentType
|
12
|
-
* @param {Number} status
|
13
|
-
* @returns {App} a Q-JSGI app
|
14
|
-
*/
|
15
|
-
exports.Content = function (body, contentType, status) {
|
16
|
-
return function (request, response) {
|
17
|
-
return {
|
18
|
-
"status": status || 200,
|
19
|
-
"headers": {
|
20
|
-
"content-type": contentType || "text/plain"
|
21
|
-
},
|
22
|
-
"body": body || ""
|
23
|
-
};
|
24
|
-
};
|
25
|
-
};
|
26
|
-
|
27
|
-
/**
|
28
|
-
* Returns a Q-JSGI response with the given content.
|
29
|
-
* @param {Body} content (optional) defaults to `[""]`
|
30
|
-
* @param {String} contentType (optional) defaults to `"text/plain"`
|
31
|
-
* @param {Number} status (optional) defaults to `200`
|
32
|
-
* @returns {Response}
|
33
|
-
*/
|
34
|
-
exports.content =
|
35
|
-
exports.ok = function (content, contentType, status) {
|
36
|
-
status = status || 200;
|
37
|
-
content = content || "";
|
38
|
-
if (typeof content === "string") {
|
39
|
-
content = [content];
|
40
|
-
}
|
41
|
-
contentType = contentType || "text/plain";
|
42
|
-
return {
|
43
|
-
"status": status,
|
44
|
-
"headers": {
|
45
|
-
"content-type": contentType
|
46
|
-
},
|
47
|
-
"body": content
|
48
|
-
};
|
49
|
-
};
|
50
|
-
|
51
|
-
/**
|
52
|
-
* Wraps an app such that it expects to receive content
|
53
|
-
* in the request body and passes that content as a string
|
54
|
-
* to as the second argument to the wrapped JSGI app.
|
55
|
-
*
|
56
|
-
* @param {Function(Request, Object):Response} app
|
57
|
-
* @returns {App}
|
58
|
-
*/
|
59
|
-
exports.ContentRequest = function (app) {
|
60
|
-
return function (request, response) {
|
61
|
-
return Q.when(request.body.read(), function (body) {
|
62
|
-
return app(body, request, response);
|
63
|
-
});
|
64
|
-
};
|
65
|
-
};
|
66
|
-
|
67
|
-
/**
|
68
|
-
* @param {Function(Request):Object}
|
69
|
-
* @returns {App}
|
70
|
-
*/
|
71
|
-
exports.Inspect = function (app) {
|
72
|
-
return Negotiate.Method({"GET": function (request, response) {
|
73
|
-
return Q.when(app(request, response), function (object) {
|
74
|
-
return {
|
75
|
-
status: 200,
|
76
|
-
headers: {
|
77
|
-
"content-type": "text/plain"
|
78
|
-
},
|
79
|
-
body: [inspect(object)]
|
80
|
-
}
|
81
|
-
});
|
82
|
-
}});
|
83
|
-
};
|
84
|
-
|
85
|
-
/**
|
86
|
-
*/
|
87
|
-
exports.ParseQuery = function (app) {
|
88
|
-
return function (request, response) {
|
89
|
-
request.query = QS.parse(URL.parse(request.url).query || "");
|
90
|
-
return app(request, response);
|
91
|
-
};
|
92
|
-
};
|
93
|
-
|
@@ -1,154 +0,0 @@
|
|
1
|
-
|
2
|
-
var Q = require("q");
|
3
|
-
var Cookie = require("../http-cookie");
|
4
|
-
|
5
|
-
exports.CookieJar = function (app) {
|
6
|
-
var hostCookies = {}; // to {} of pathCookies to [] of cookies
|
7
|
-
return function (request) {
|
8
|
-
|
9
|
-
var hosts = allHostsContaining(request.headers.host);
|
10
|
-
|
11
|
-
var now = new Date();
|
12
|
-
|
13
|
-
var requestCookies = concat(hosts.map(function (host) {
|
14
|
-
|
15
|
-
// delete expired cookies
|
16
|
-
for (var host in hostCookies) {
|
17
|
-
var pathCookies = hostCookies[host];
|
18
|
-
for (var path in pathCookies) {
|
19
|
-
var cookies = pathCookies[path];
|
20
|
-
for (var name in cookies) {
|
21
|
-
var cookie = cookies[name];
|
22
|
-
if (cookie.expires && cookie.expires > now) {
|
23
|
-
delete cookie[name];
|
24
|
-
}
|
25
|
-
}
|
26
|
-
}
|
27
|
-
}
|
28
|
-
|
29
|
-
// collect applicable cookies
|
30
|
-
return concat(
|
31
|
-
Object.keys(hostCookies)
|
32
|
-
.map(function (host) {
|
33
|
-
if (!hostContains(host, request.headers.host))
|
34
|
-
return [];
|
35
|
-
var pathCookies = hostCookies[host];
|
36
|
-
return concat(
|
37
|
-
Object.keys(pathCookies)
|
38
|
-
.map(function (path) {
|
39
|
-
if (!pathContains(path, request.path))
|
40
|
-
return [];
|
41
|
-
var cookies = pathCookies[path];
|
42
|
-
return (
|
43
|
-
Object.keys(cookies)
|
44
|
-
.map(function (name) {
|
45
|
-
return cookies[name];
|
46
|
-
})
|
47
|
-
.filter(function (cookie) {
|
48
|
-
return cookie.secure ?
|
49
|
-
request.ssl :
|
50
|
-
true;
|
51
|
-
})
|
52
|
-
);
|
53
|
-
})
|
54
|
-
)
|
55
|
-
})
|
56
|
-
);
|
57
|
-
|
58
|
-
}));
|
59
|
-
|
60
|
-
if (requestCookies.length) {
|
61
|
-
request.headers["cookie"] = (
|
62
|
-
requestCookies
|
63
|
-
.map(function (cookie) {
|
64
|
-
return Cookie.stringify(
|
65
|
-
cookie.key,
|
66
|
-
cookie.value,
|
67
|
-
cookie
|
68
|
-
);
|
69
|
-
})
|
70
|
-
.join("; ")
|
71
|
-
);
|
72
|
-
}
|
73
|
-
|
74
|
-
return Q.when(app.apply(this, arguments), function (response) {
|
75
|
-
response.headers = response.headers || {};
|
76
|
-
if (response.headers["set-cookie"]) {
|
77
|
-
var requestHost = ipRe.test(request.headers.host) ?
|
78
|
-
request.headers.host :
|
79
|
-
"." + request.headers.host;
|
80
|
-
// normalize to array
|
81
|
-
if (!Array.isArray(response.headers["set-cookie"])) {
|
82
|
-
response.headers["set-cookie"] = [response.headers["set-cookie"]];
|
83
|
-
}
|
84
|
-
response.headers["set-cookie"].forEach(function (cookie) {
|
85
|
-
var date = response.headers["date"] ?
|
86
|
-
new Date(response.headers["date"]) :
|
87
|
-
new Date();
|
88
|
-
cookie = Cookie.parse(cookie, date);
|
89
|
-
// ignore illegal host
|
90
|
-
if (cookie.host && !hostContains(requestHost, cookie.host))
|
91
|
-
delete cookie.host;
|
92
|
-
var host = requestHost || cookie.host;
|
93
|
-
var path = cookie.path || "/";
|
94
|
-
var pathCookies = hostCookies[host] = hostCookies[host] || {};
|
95
|
-
var cookies = pathCookies[path] = pathCookies[path] || {};
|
96
|
-
cookies[cookie.key] = cookie;
|
97
|
-
})
|
98
|
-
delete response.headers["set-cookie"];
|
99
|
-
}
|
100
|
-
|
101
|
-
return response;
|
102
|
-
});
|
103
|
-
|
104
|
-
};
|
105
|
-
};
|
106
|
-
|
107
|
-
var ipRe = /^\d+\.\d+\.\d+\.\d+$/;
|
108
|
-
|
109
|
-
function allHostsContaining(content) {
|
110
|
-
if (ipRe.test(content)) {
|
111
|
-
return [content];
|
112
|
-
} if (content === "localhost") {
|
113
|
-
return [content];
|
114
|
-
} else {
|
115
|
-
var parts = content.split(".");
|
116
|
-
var hosts = [];
|
117
|
-
while (parts.length > 1) {
|
118
|
-
hosts.push("." + parts.join("."));
|
119
|
-
parts.shift();
|
120
|
-
}
|
121
|
-
return hosts;
|
122
|
-
}
|
123
|
-
}
|
124
|
-
|
125
|
-
function hostContains(container, content) {
|
126
|
-
if (ipRe.test(container) || ipRe.test(content)) {
|
127
|
-
return container === content;
|
128
|
-
} else if (/^\./.test(container)) {
|
129
|
-
return (
|
130
|
-
content.lastIndexOf(container) ===
|
131
|
-
content.length - container.length
|
132
|
-
) || (
|
133
|
-
container.slice(1) === content
|
134
|
-
);
|
135
|
-
} else {
|
136
|
-
return container === content;
|
137
|
-
}
|
138
|
-
};
|
139
|
-
|
140
|
-
function pathContains(container, content) {
|
141
|
-
if (/^\/$/.test(container)) {
|
142
|
-
return content.indexOf(container) === 0;
|
143
|
-
} else {
|
144
|
-
return (
|
145
|
-
content === container ||
|
146
|
-
content.indexOf(container + "/") === 0
|
147
|
-
);
|
148
|
-
}
|
149
|
-
}
|
150
|
-
|
151
|
-
function concat(arrays) {
|
152
|
-
return [].concat.apply([], arrays);
|
153
|
-
}
|
154
|
-
|