traceur-rb 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/.gitignore +22 -0
- data/.rspec +1 -0
- data/.ruby-gemset +1 -0
- data/.ruby-version +1 -0
- data/Gemfile +4 -0
- data/Guardfile +8 -0
- data/LICENSE.txt +22 -0
- data/README.md +87 -0
- data/Rakefile +2 -0
- data/lib/js/compile.js +31 -0
- data/lib/traceur-rb.rb +1 -0
- data/lib/traceur.rb +43 -0
- data/lib/traceur/compilation_options.rb +65 -0
- data/lib/traceur/compiler.rb +33 -0
- data/lib/traceur/configuration.rb +47 -0
- data/lib/traceur/node.rb +26 -0
- data/lib/traceur/node/command_result.rb +28 -0
- data/lib/traceur/node/runner.rb +40 -0
- data/lib/traceur/version.rb +3 -0
- data/spec/examples/classes.js +12 -0
- data/spec/integration/examples_spec.rb +28 -0
- data/spec/spec_helper.rb +1 -0
- data/spec/traceur/compilation_options_spec.rb +31 -0
- data/spec/traceur/configuration_spec.rb +54 -0
- data/spec/traceur/node_spec.rb +15 -0
- data/traceur-rb.gemspec +25 -0
- data/vendor/node_modules/.bin/traceur +3 -0
- data/vendor/node_modules/traceur/README.md +40 -0
- data/vendor/node_modules/traceur/bin/traceur-runtime.js +2101 -0
- data/vendor/node_modules/traceur/bin/traceur.js +23034 -0
- data/vendor/node_modules/traceur/node_modules/.bin/semver +125 -0
- data/vendor/node_modules/traceur/node_modules/commander/Readme.md +208 -0
- data/vendor/node_modules/traceur/node_modules/commander/index.js +852 -0
- data/vendor/node_modules/traceur/node_modules/commander/package.json +40 -0
- data/vendor/node_modules/traceur/node_modules/q-io/.npmignore +1 -0
- data/vendor/node_modules/traceur/node_modules/q-io/.travis.yml +3 -0
- data/vendor/node_modules/traceur/node_modules/q-io/CHANGES.md +122 -0
- data/vendor/node_modules/traceur/node_modules/q-io/LICENSE +19 -0
- data/vendor/node_modules/traceur/node_modules/q-io/README.md +928 -0
- data/vendor/node_modules/traceur/node_modules/q-io/buffer-stream.js +59 -0
- data/vendor/node_modules/traceur/node_modules/q-io/coverage-report.js +44 -0
- data/vendor/node_modules/traceur/node_modules/q-io/deprecate.js +51 -0
- data/vendor/node_modules/traceur/node_modules/q-io/fs-boot.js +307 -0
- data/vendor/node_modules/traceur/node_modules/q-io/fs-common.js +499 -0
- data/vendor/node_modules/traceur/node_modules/q-io/fs-mock.js +547 -0
- data/vendor/node_modules/traceur/node_modules/q-io/fs-root.js +105 -0
- data/vendor/node_modules/traceur/node_modules/q-io/fs.js +355 -0
- data/vendor/node_modules/traceur/node_modules/q-io/fs2http.js +65 -0
- data/vendor/node_modules/traceur/node_modules/q-io/http-apps.js +152 -0
- data/vendor/node_modules/traceur/node_modules/q-io/http-apps/chain.js +24 -0
- data/vendor/node_modules/traceur/node_modules/q-io/http-apps/content.js +93 -0
- data/vendor/node_modules/traceur/node_modules/q-io/http-apps/cookie.js +154 -0
- data/vendor/node_modules/traceur/node_modules/q-io/http-apps/decorators.js +178 -0
- data/vendor/node_modules/traceur/node_modules/q-io/http-apps/fs.js +417 -0
- data/vendor/node_modules/traceur/node_modules/q-io/http-apps/html.js +58 -0
- data/vendor/node_modules/traceur/node_modules/q-io/http-apps/json.js +78 -0
- data/vendor/node_modules/traceur/node_modules/q-io/http-apps/negotiate.js +120 -0
- data/vendor/node_modules/traceur/node_modules/q-io/http-apps/proxy.js +27 -0
- data/vendor/node_modules/traceur/node_modules/q-io/http-apps/redirect.js +209 -0
- data/vendor/node_modules/traceur/node_modules/q-io/http-apps/route.js +125 -0
- data/vendor/node_modules/traceur/node_modules/q-io/http-apps/status.js +175 -0
- data/vendor/node_modules/traceur/node_modules/q-io/http-cookie.js +75 -0
- data/vendor/node_modules/traceur/node_modules/q-io/http.js +378 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/.npmignore +11 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/.travis.yml +4 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/CHANGES.md +78 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/LICENSE.md +21 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/README.md +1285 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/collections.js +22 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/dict.js +142 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/fast-map.js +57 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/fast-set.js +183 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/generic-collection.js +261 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/generic-map.js +186 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/generic-order.js +55 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/generic-set.js +59 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/heap.js +236 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/iterator.js +371 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/list.js +435 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/listen/array-changes.js +247 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/listen/map-changes.js +147 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/listen/property-changes.js +448 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/listen/range-changes.js +139 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/lru-map.js +79 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/lru-set.js +142 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/map.js +60 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/multi-map.js +41 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/node_modules/weak-map/package.json +12 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/node_modules/weak-map/sync +7 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/node_modules/weak-map/sync.patch +48 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/node_modules/weak-map/weak-map.js +590 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/package.json +49 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/set.js +173 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/shim-array.js +274 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/shim-function.js +59 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/shim-object.js +538 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/shim-regexp.js +14 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/shim.js +6 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/sorted-array-map.js +49 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/sorted-array-set.js +51 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/sorted-array.js +269 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/sorted-map.js +61 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/sorted-set.js +736 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/tree-log.js +40 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/weak-map.js +1 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/mime/LICENSE +19 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/mime/README.md +66 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/mime/mime.js +114 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/mime/package.json +35 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/mime/test.js +84 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/mime/types/mime.types +1588 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/mime/types/node.types +77 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/mimeparse/CHANGES +15 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/mimeparse/LICENSE +19 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/mimeparse/README +96 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/mimeparse/lib/mimeparse.js +166 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/mimeparse/package.json +43 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/q/CONTRIBUTING.md +40 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/q/LICENSE +19 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/q/README.md +813 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/q/benchmark/compare-with-callbacks.js +71 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/q/benchmark/scenarios.js +36 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/q/package.json +93 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/q/q.js +1937 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/q/queue.js +35 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/.gitmodules +6 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/History.md +36 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/Makefile +7 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/Readme.md +38 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/benchmark.js +32 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/examples.js +39 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/index.js +2 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/lib/querystring.js +123 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/package.json +19 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/.gitmodules +3 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/.npmignore +3 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/History.md +128 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/Makefile +53 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/Readme.md +61 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/bin/expresso +856 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/docs/api.html +1080 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/docs/index.html +377 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/docs/index.md +290 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/docs/layout/foot.html +3 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/docs/layout/head.html +42 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/lib/bar.js +4 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/lib/foo.js +16 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/package.json +12 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/test/assert.test.js +91 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/test/async.test.js +12 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/test/bar.test.js +13 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/test/foo.test.js +14 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/test/http.test.js +146 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/test/serial/async.test.js +39 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/test/serial/http.test.js +48 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/should/.gitmodules +3 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/should/History.md +22 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/should/Makefile +6 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/should/Readme.md +248 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/should/examples/runner.js +53 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/should/index.js +2 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/should/lib/eql.js +91 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/should/lib/should.js +548 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/should/package.json +8 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/should/test/should.test.js +358 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/test/querystring.test.js +133 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/url2/.npmignore +3 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/url2/.travis.yml +4 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/url2/LICENSE.md +20 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/url2/README.md +33 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/url2/package.json +37 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/url2/test/url2-spec.js +125 -0
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/url2/url2.js +151 -0
- data/vendor/node_modules/traceur/node_modules/q-io/package.json +51 -0
- data/vendor/node_modules/traceur/node_modules/q-io/reader.js +133 -0
- data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/boot-directory-spec.js +47 -0
- data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/contains-spec.js +11 -0
- data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/fixtures/hello.txt +1 -0
- data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/issues/1-spec.js +33 -0
- data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/make-tree-spec.js +92 -0
- data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/append-spec.js +41 -0
- data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/copy-tree-spec.js +57 -0
- data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/fixture/hello.txt +1 -0
- data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/link-spec.js +70 -0
- data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/make-tree-spec.js +109 -0
- data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/merge-spec.js +67 -0
- data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/move-spec.js +219 -0
- data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/object-spec.js +20 -0
- data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/range-spec.js +26 -0
- data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/read-spec.js +40 -0
- data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/remove-directory-spec.js +37 -0
- data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/remove-tree-spec.js +39 -0
- data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/root-spec.js +32 -0
- data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/stat-spec.js +26 -0
- data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/symbolic-link-spec.js +86 -0
- data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/working-directory-spec.js +31 -0
- data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/write-spec.js +73 -0
- data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/range-spec.js +23 -0
- data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/range-spec.txt +1 -0
- data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/read-spec.js +22 -0
- data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/relative-spec.js +25 -0
- data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/reroot-spec.js +45 -0
- data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/write-spec.js +38 -0
- data/vendor/node_modules/traceur/node_modules/q-io/spec/http-apps/cookie-spec.js +52 -0
- data/vendor/node_modules/traceur/node_modules/q-io/spec/http-apps/directory-list-spec.js +86 -0
- data/vendor/node_modules/traceur/node_modules/q-io/spec/http-apps/fixtures/01234.txt +1 -0
- data/vendor/node_modules/traceur/node_modules/q-io/spec/http-apps/fixtures/1234.txt +1 -0
- 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 +49 -0
- data/vendor/node_modules/traceur/node_modules/q-io/spec/http-apps/interpret-range-spec.js +47 -0
- data/vendor/node_modules/traceur/node_modules/q-io/spec/http-apps/partial-range-spec.js +186 -0
- data/vendor/node_modules/traceur/node_modules/q-io/spec/http-apps/proxy-spec.js +82 -0
- data/vendor/node_modules/traceur/node_modules/q-io/spec/http-apps/symbolic-link-spec.js +110 -0
- data/vendor/node_modules/traceur/node_modules/q-io/spec/http/agent-spec.js +96 -0
- data/vendor/node_modules/traceur/node_modules/q-io/spec/http/basic-spec.js +96 -0
- data/vendor/node_modules/traceur/node_modules/q-io/spec/lib/jasmine-promise.js +42 -0
- data/vendor/node_modules/traceur/node_modules/q-io/writer.js +111 -0
- data/vendor/node_modules/traceur/node_modules/semver/.npmignore +1 -0
- data/vendor/node_modules/traceur/node_modules/semver/LICENSE +27 -0
- data/vendor/node_modules/traceur/node_modules/semver/Makefile +24 -0
- data/vendor/node_modules/traceur/node_modules/semver/README.md +158 -0
- data/vendor/node_modules/traceur/node_modules/semver/bin/semver +125 -0
- data/vendor/node_modules/traceur/node_modules/semver/foot.js +6 -0
- data/vendor/node_modules/traceur/node_modules/semver/head.js +2 -0
- data/vendor/node_modules/traceur/node_modules/semver/package.json +31 -0
- data/vendor/node_modules/traceur/node_modules/semver/semver.browser.js +1039 -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 +1043 -0
- data/vendor/node_modules/traceur/node_modules/semver/semver.min.js +1 -0
- data/vendor/node_modules/traceur/node_modules/semver/semver.min.js.gz +0 -0
- data/vendor/node_modules/traceur/node_modules/semver/test/amd.js +15 -0
- data/vendor/node_modules/traceur/node_modules/semver/test/gtr.js +173 -0
- data/vendor/node_modules/traceur/node_modules/semver/test/index.js +584 -0
- data/vendor/node_modules/traceur/node_modules/semver/test/ltr.js +174 -0
- data/vendor/node_modules/traceur/node_modules/semver/test/no-module.js +19 -0
- data/vendor/node_modules/traceur/package.json +64 -0
- data/vendor/node_modules/traceur/src/node/System.js +31 -0
- data/vendor/node_modules/traceur/src/node/api.js +124 -0
- data/vendor/node_modules/traceur/src/node/command.js +141 -0
- data/vendor/node_modules/traceur/src/node/compile-single-file.js +69 -0
- data/vendor/node_modules/traceur/src/node/compiler.js +116 -0
- data/vendor/node_modules/traceur/src/node/deferred.js +110 -0
- data/vendor/node_modules/traceur/src/node/file-util.js +73 -0
- data/vendor/node_modules/traceur/src/node/getopt.js +147 -0
- data/vendor/node_modules/traceur/src/node/inline-module.js +149 -0
- data/vendor/node_modules/traceur/src/node/interpreter.js +33 -0
- data/vendor/node_modules/traceur/src/node/nodeLoader.js +41 -0
- data/vendor/node_modules/traceur/src/node/require.js +85 -0
- data/vendor/node_modules/traceur/src/node/to-amd-compiler.js +33 -0
- data/vendor/node_modules/traceur/src/node/to-commonjs-compiler.js +33 -0
- data/vendor/node_modules/traceur/src/node/traceur.js +32 -0
- data/vendor/node_modules/traceur/traceur +3 -0
- metadata +359 -0
@@ -0,0 +1,186 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
var Object = require("./shim-object");
|
4
|
+
var MapChanges = require("./listen/map-changes");
|
5
|
+
var PropertyChanges = require("./listen/property-changes");
|
6
|
+
|
7
|
+
module.exports = GenericMap;
|
8
|
+
function GenericMap() {
|
9
|
+
throw new Error("Can't construct. GenericMap is a mixin.");
|
10
|
+
}
|
11
|
+
|
12
|
+
Object.addEach(GenericMap.prototype, MapChanges.prototype);
|
13
|
+
Object.addEach(GenericMap.prototype, PropertyChanges.prototype);
|
14
|
+
|
15
|
+
// all of these methods depend on the constructor providing a `store` set
|
16
|
+
|
17
|
+
GenericMap.prototype.isMap = true;
|
18
|
+
|
19
|
+
GenericMap.prototype.addEach = function (values) {
|
20
|
+
if (values && Object(values) === values) {
|
21
|
+
if (typeof values.forEach === "function") {
|
22
|
+
// copy map-alikes
|
23
|
+
if (values.isMap === true) {
|
24
|
+
values.forEach(function (value, key) {
|
25
|
+
this.set(key, value);
|
26
|
+
}, this);
|
27
|
+
// iterate key value pairs of other iterables
|
28
|
+
} else {
|
29
|
+
values.forEach(function (pair) {
|
30
|
+
this.set(pair[0], pair[1]);
|
31
|
+
}, this);
|
32
|
+
}
|
33
|
+
} else {
|
34
|
+
// copy other objects as map-alikes
|
35
|
+
Object.keys(values).forEach(function (key) {
|
36
|
+
this.set(key, values[key]);
|
37
|
+
}, this);
|
38
|
+
}
|
39
|
+
}
|
40
|
+
return this;
|
41
|
+
}
|
42
|
+
|
43
|
+
GenericMap.prototype.get = function (key, defaultValue) {
|
44
|
+
var item = this.store.get(new this.Item(key));
|
45
|
+
if (item) {
|
46
|
+
return item.value;
|
47
|
+
} else if (arguments.length > 1) {
|
48
|
+
return defaultValue;
|
49
|
+
} else {
|
50
|
+
return this.getDefault(key);
|
51
|
+
}
|
52
|
+
};
|
53
|
+
|
54
|
+
GenericMap.prototype.set = function (key, value) {
|
55
|
+
var item = new this.Item(key, value);
|
56
|
+
var found = this.store.get(item);
|
57
|
+
var grew = false;
|
58
|
+
if (found) { // update
|
59
|
+
if (this.dispatchesMapChanges) {
|
60
|
+
this.dispatchBeforeMapChange(key, found.value);
|
61
|
+
}
|
62
|
+
found.value = value;
|
63
|
+
if (this.dispatchesMapChanges) {
|
64
|
+
this.dispatchMapChange(key, value);
|
65
|
+
}
|
66
|
+
} else { // create
|
67
|
+
if (this.dispatchesMapChanges) {
|
68
|
+
this.dispatchBeforeMapChange(key, undefined);
|
69
|
+
}
|
70
|
+
if (this.store.add(item)) {
|
71
|
+
this.length++;
|
72
|
+
grew = true;
|
73
|
+
}
|
74
|
+
if (this.dispatchesMapChanges) {
|
75
|
+
this.dispatchMapChange(key, value);
|
76
|
+
}
|
77
|
+
}
|
78
|
+
return grew;
|
79
|
+
};
|
80
|
+
|
81
|
+
GenericMap.prototype.add = function (value, key) {
|
82
|
+
return this.set(key, value);
|
83
|
+
};
|
84
|
+
|
85
|
+
GenericMap.prototype.has = function (key) {
|
86
|
+
return this.store.has(new this.Item(key));
|
87
|
+
};
|
88
|
+
|
89
|
+
GenericMap.prototype['delete'] = function (key) {
|
90
|
+
var item = new this.Item(key);
|
91
|
+
if (this.store.has(item)) {
|
92
|
+
var from = this.store.get(item).value;
|
93
|
+
if (this.dispatchesMapChanges) {
|
94
|
+
this.dispatchBeforeMapChange(key, from);
|
95
|
+
}
|
96
|
+
this.store["delete"](item);
|
97
|
+
this.length--;
|
98
|
+
if (this.dispatchesMapChanges) {
|
99
|
+
this.dispatchMapChange(key, undefined);
|
100
|
+
}
|
101
|
+
return true;
|
102
|
+
}
|
103
|
+
return false;
|
104
|
+
};
|
105
|
+
|
106
|
+
GenericMap.prototype.clear = function () {
|
107
|
+
var keys;
|
108
|
+
if (this.dispatchesMapChanges) {
|
109
|
+
this.forEach(function (value, key) {
|
110
|
+
this.dispatchBeforeMapChange(key, value);
|
111
|
+
}, this);
|
112
|
+
keys = this.keys();
|
113
|
+
}
|
114
|
+
this.store.clear();
|
115
|
+
this.length = 0;
|
116
|
+
if (this.dispatchesMapChanges) {
|
117
|
+
keys.forEach(function (key) {
|
118
|
+
this.dispatchMapChange(key);
|
119
|
+
}, this);
|
120
|
+
}
|
121
|
+
};
|
122
|
+
|
123
|
+
GenericMap.prototype.reduce = function (callback, basis, thisp) {
|
124
|
+
return this.store.reduce(function (basis, item) {
|
125
|
+
return callback.call(thisp, basis, item.value, item.key, this);
|
126
|
+
}, basis, this);
|
127
|
+
};
|
128
|
+
|
129
|
+
GenericMap.prototype.reduceRight = function (callback, basis, thisp) {
|
130
|
+
return this.store.reduceRight(function (basis, item) {
|
131
|
+
return callback.call(thisp, basis, item.value, item.key, this);
|
132
|
+
}, basis, this);
|
133
|
+
};
|
134
|
+
|
135
|
+
GenericMap.prototype.keys = function () {
|
136
|
+
return this.map(function (value, key) {
|
137
|
+
return key;
|
138
|
+
});
|
139
|
+
};
|
140
|
+
|
141
|
+
GenericMap.prototype.values = function () {
|
142
|
+
return this.map(Function.identity);
|
143
|
+
};
|
144
|
+
|
145
|
+
GenericMap.prototype.entries = function () {
|
146
|
+
return this.map(function (value, key) {
|
147
|
+
return [key, value];
|
148
|
+
});
|
149
|
+
};
|
150
|
+
|
151
|
+
// XXX deprecated
|
152
|
+
GenericMap.prototype.items = function () {
|
153
|
+
return this.entries();
|
154
|
+
};
|
155
|
+
|
156
|
+
GenericMap.prototype.equals = function (that, equals) {
|
157
|
+
equals = equals || Object.equals;
|
158
|
+
if (this === that) {
|
159
|
+
return true;
|
160
|
+
} else if (Object.can(that, "every")) {
|
161
|
+
return that.length === this.length && that.every(function (value, key) {
|
162
|
+
return equals(this.get(key), value);
|
163
|
+
}, this);
|
164
|
+
} else {
|
165
|
+
var keys = Object.keys(that);
|
166
|
+
return keys.length === this.length && Object.keys(that).every(function (key) {
|
167
|
+
return equals(this.get(key), that[key]);
|
168
|
+
}, this);
|
169
|
+
}
|
170
|
+
};
|
171
|
+
|
172
|
+
GenericMap.prototype.Item = Item;
|
173
|
+
|
174
|
+
function Item(key, value) {
|
175
|
+
this.key = key;
|
176
|
+
this.value = value;
|
177
|
+
}
|
178
|
+
|
179
|
+
Item.prototype.equals = function (that) {
|
180
|
+
return Object.equals(this.key, that.key) && Object.equals(this.value, that.value);
|
181
|
+
};
|
182
|
+
|
183
|
+
Item.prototype.compare = function (that) {
|
184
|
+
return Object.compare(this.key, that.key);
|
185
|
+
};
|
186
|
+
|
@@ -0,0 +1,55 @@
|
|
1
|
+
|
2
|
+
var Object = require("./shim-object");
|
3
|
+
|
4
|
+
module.exports = GenericOrder;
|
5
|
+
function GenericOrder() {
|
6
|
+
throw new Error("Can't construct. GenericOrder is a mixin.");
|
7
|
+
}
|
8
|
+
|
9
|
+
GenericOrder.prototype.equals = function (that, equals) {
|
10
|
+
equals = equals || this.contentEquals || Object.equals;
|
11
|
+
|
12
|
+
if (this === that) {
|
13
|
+
return true;
|
14
|
+
}
|
15
|
+
if (!that) {
|
16
|
+
return false;
|
17
|
+
}
|
18
|
+
|
19
|
+
var self = this;
|
20
|
+
return (
|
21
|
+
this.length === that.length &&
|
22
|
+
this.zip(that).every(function (pair) {
|
23
|
+
return equals(pair[0], pair[1]);
|
24
|
+
})
|
25
|
+
);
|
26
|
+
};
|
27
|
+
|
28
|
+
GenericOrder.prototype.compare = function (that, compare) {
|
29
|
+
compare = compare || this.contentCompare || Object.compare;
|
30
|
+
|
31
|
+
if (this === that) {
|
32
|
+
return 0;
|
33
|
+
}
|
34
|
+
if (!that) {
|
35
|
+
return 1;
|
36
|
+
}
|
37
|
+
|
38
|
+
var length = Math.min(this.length, that.length);
|
39
|
+
var comparison = this.zip(that).reduce(function (comparison, pair, index) {
|
40
|
+
if (comparison === 0) {
|
41
|
+
if (index >= length) {
|
42
|
+
return comparison;
|
43
|
+
} else {
|
44
|
+
return compare(pair[0], pair[1]);
|
45
|
+
}
|
46
|
+
} else {
|
47
|
+
return comparison;
|
48
|
+
}
|
49
|
+
}, 0);
|
50
|
+
if (comparison === 0) {
|
51
|
+
return this.length - that.length;
|
52
|
+
}
|
53
|
+
return comparison;
|
54
|
+
};
|
55
|
+
|
@@ -0,0 +1,59 @@
|
|
1
|
+
|
2
|
+
module.exports = GenericSet;
|
3
|
+
function GenericSet() {
|
4
|
+
throw new Error("Can't construct. GenericSet is a mixin.");
|
5
|
+
}
|
6
|
+
|
7
|
+
GenericSet.prototype.union = function (that) {
|
8
|
+
var union = this.constructClone(this);
|
9
|
+
union.addEach(that);
|
10
|
+
return union;
|
11
|
+
};
|
12
|
+
|
13
|
+
GenericSet.prototype.intersection = function (that) {
|
14
|
+
return this.constructClone(this.filter(function (value) {
|
15
|
+
return that.has(value);
|
16
|
+
}));
|
17
|
+
};
|
18
|
+
|
19
|
+
GenericSet.prototype.difference = function (that) {
|
20
|
+
var union = this.constructClone(this);
|
21
|
+
union.deleteEach(that);
|
22
|
+
return union;
|
23
|
+
};
|
24
|
+
|
25
|
+
GenericSet.prototype.symmetricDifference = function (that) {
|
26
|
+
var union = this.union(that);
|
27
|
+
var intersection = this.intersection(that);
|
28
|
+
return union.difference(intersection);
|
29
|
+
};
|
30
|
+
|
31
|
+
GenericSet.prototype.equals = function (that, equals) {
|
32
|
+
var self = this;
|
33
|
+
return (
|
34
|
+
Object.can(that, "reduce") &&
|
35
|
+
this.length === that.length &&
|
36
|
+
that.reduce(function (equal, value) {
|
37
|
+
return equal && self.has(value, equals);
|
38
|
+
}, true)
|
39
|
+
);
|
40
|
+
};
|
41
|
+
|
42
|
+
// W3C DOMTokenList API overlap (does not handle variadic arguments)
|
43
|
+
|
44
|
+
GenericSet.prototype.contains = function (value) {
|
45
|
+
return this.has(value);
|
46
|
+
};
|
47
|
+
|
48
|
+
GenericSet.prototype.remove = function (value) {
|
49
|
+
return this["delete"](value);
|
50
|
+
};
|
51
|
+
|
52
|
+
GenericSet.prototype.toggle = function (value) {
|
53
|
+
if (this.has(value)) {
|
54
|
+
this["delete"](value);
|
55
|
+
} else {
|
56
|
+
this.add(value);
|
57
|
+
}
|
58
|
+
};
|
59
|
+
|
@@ -0,0 +1,236 @@
|
|
1
|
+
|
2
|
+
// Adapted from Eloquent JavaScript by Marijn Haverbeke
|
3
|
+
// http://eloquentjavascript.net/appendix2.html
|
4
|
+
|
5
|
+
var ArrayChanges = require("./listen/array-changes");
|
6
|
+
var Shim = require("./shim");
|
7
|
+
var GenericCollection = require("./generic-collection");
|
8
|
+
var MapChanges = require("./listen/map-changes");
|
9
|
+
var RangeChanges = require("./listen/range-changes");
|
10
|
+
var PropertyChanges = require("./listen/property-changes");
|
11
|
+
|
12
|
+
// Max Heap by default. Comparison can be reversed to produce a Min Heap.
|
13
|
+
|
14
|
+
module.exports = Heap;
|
15
|
+
|
16
|
+
function Heap(values, equals, compare) {
|
17
|
+
if (!(this instanceof Heap)) {
|
18
|
+
return new Heap(values, equals, compare);
|
19
|
+
}
|
20
|
+
this.contentEquals = equals || Object.equals;
|
21
|
+
this.contentCompare = compare || Object.compare;
|
22
|
+
this.content = [];
|
23
|
+
this.length = 0;
|
24
|
+
this.addEach(values);
|
25
|
+
}
|
26
|
+
|
27
|
+
Heap.Heap = Heap; // hack so require("heap").Heap will work in MontageJS
|
28
|
+
|
29
|
+
Object.addEach(Heap.prototype, GenericCollection.prototype);
|
30
|
+
Object.addEach(Heap.prototype, PropertyChanges.prototype);
|
31
|
+
Object.addEach(Heap.prototype, RangeChanges.prototype);
|
32
|
+
Object.addEach(Heap.prototype, MapChanges.prototype);
|
33
|
+
|
34
|
+
Heap.prototype.constructClone = function (values) {
|
35
|
+
return new this.constructor(
|
36
|
+
values,
|
37
|
+
this.contentEquals,
|
38
|
+
this.contentCompare
|
39
|
+
);
|
40
|
+
};
|
41
|
+
|
42
|
+
Heap.prototype.push = function (value) {
|
43
|
+
this.content.push(value);
|
44
|
+
this.float(this.content.length - 1);
|
45
|
+
this.length++;
|
46
|
+
};
|
47
|
+
|
48
|
+
Heap.prototype.pop = function () {
|
49
|
+
// Store the first value so we can return it later. This will leave a gap
|
50
|
+
// at index 0 that must be filled.
|
51
|
+
var result = this.content[0];
|
52
|
+
// Remove the value at the end of the array. The value most be removed
|
53
|
+
// from the end to preserve the completness of the tree, despite that the
|
54
|
+
// last child is also among the most likely to need to sink back to the
|
55
|
+
// bottom.
|
56
|
+
var top = this.content.pop();
|
57
|
+
// If there are any values remaining, put the last value on the top and
|
58
|
+
// let it sink back down.
|
59
|
+
if (this.content.length > 0) {
|
60
|
+
this.content.set(0, top);
|
61
|
+
this.sink(0);
|
62
|
+
}
|
63
|
+
this.length--;
|
64
|
+
return result;
|
65
|
+
};
|
66
|
+
|
67
|
+
Heap.prototype.add = function (value) {
|
68
|
+
this.push(value);
|
69
|
+
};
|
70
|
+
|
71
|
+
// indexOf must do a linear search since a binary heap does not preserve a
|
72
|
+
// strict sort order. Thus, deletion takes linear time for all values except
|
73
|
+
// for the max value.
|
74
|
+
|
75
|
+
Heap.prototype.indexOf = function (value) {
|
76
|
+
for (var index = 0; index < this.length; index++) {
|
77
|
+
if (this.contentEquals(this.content[index], value)) {
|
78
|
+
return index;
|
79
|
+
}
|
80
|
+
}
|
81
|
+
return -1;
|
82
|
+
};
|
83
|
+
|
84
|
+
Heap.prototype.delete = function (value) {
|
85
|
+
var index = this.indexOf(value);
|
86
|
+
if (index === -1)
|
87
|
+
return false;
|
88
|
+
var top = this.content.pop();
|
89
|
+
if (index === this.content.length)
|
90
|
+
return true;
|
91
|
+
this.content.set(index, top);
|
92
|
+
var comparison = this.contentCompare(top, value);
|
93
|
+
if (comparison > 0) {
|
94
|
+
this.float(index);
|
95
|
+
} else if (comparison < 0) {
|
96
|
+
this.sink(index);
|
97
|
+
}
|
98
|
+
this.length--;
|
99
|
+
return true;
|
100
|
+
};
|
101
|
+
|
102
|
+
Heap.prototype.peek = function () {
|
103
|
+
if (this.length) {
|
104
|
+
return this.content[0];
|
105
|
+
}
|
106
|
+
};
|
107
|
+
|
108
|
+
Heap.prototype.max = function () {
|
109
|
+
return this.peek();
|
110
|
+
};
|
111
|
+
|
112
|
+
Heap.prototype.one = function () {
|
113
|
+
return this.peek();
|
114
|
+
};
|
115
|
+
|
116
|
+
// Brings a value up until its parent is greater than it
|
117
|
+
Heap.prototype.float = function (index) {
|
118
|
+
// Grab the value that is being adjusted
|
119
|
+
var value = this.content[index];
|
120
|
+
// A value can go no higher that the top: index 0
|
121
|
+
while (index > 0) {
|
122
|
+
// Compute the parent value's index and fetch it
|
123
|
+
var parentIndex = Math.floor((index + 1) / 2) - 1;
|
124
|
+
var parent = this.content[parentIndex];
|
125
|
+
// If the parent is less than it
|
126
|
+
if (this.contentCompare(parent, value) < 0) {
|
127
|
+
this.content.set(parentIndex, value);
|
128
|
+
this.content.set(index, parent);
|
129
|
+
} else {
|
130
|
+
// Stop propagating if the parent is greater than the value.
|
131
|
+
break;
|
132
|
+
}
|
133
|
+
// Proceed upward
|
134
|
+
index = parentIndex;
|
135
|
+
}
|
136
|
+
};
|
137
|
+
|
138
|
+
// Brings a value down until its children are both less than it
|
139
|
+
Heap.prototype.sink = function (index) {
|
140
|
+
// Moves a value downward until it is greater than its children.
|
141
|
+
var length = this.content.length;
|
142
|
+
var value = this.content[index];
|
143
|
+
var left, right, leftIndex, rightIndex, swapIndex, needsSwap;
|
144
|
+
|
145
|
+
while (true) {
|
146
|
+
// Invariant: the value is at index.
|
147
|
+
// Variant: the index proceedes down the tree.
|
148
|
+
|
149
|
+
// Compute the indicies of the children.
|
150
|
+
rightIndex = (index + 1) * 2;
|
151
|
+
leftIndex = rightIndex - 1;
|
152
|
+
|
153
|
+
// If the left child exists, determine whether it is greater than the
|
154
|
+
// parent (value) and thus whether it can be floated upward.
|
155
|
+
needsSwap = false;
|
156
|
+
if (leftIndex < length) {
|
157
|
+
// Look it up and compare it.
|
158
|
+
var left = this.content[leftIndex];
|
159
|
+
var comparison = this.contentCompare(left, value);
|
160
|
+
// If the child is greater than the parent, it can be floated.
|
161
|
+
if (comparison > 0) {
|
162
|
+
swapIndex = leftIndex;
|
163
|
+
needsSwap = true;
|
164
|
+
}
|
165
|
+
}
|
166
|
+
|
167
|
+
// If the right child exists, determine whether it is greater than the
|
168
|
+
// parent (value), or even greater than the left child.
|
169
|
+
if (rightIndex < length) {
|
170
|
+
var right = this.content[rightIndex];
|
171
|
+
var comparison = this.contentCompare(right, needsSwap ? left : value);
|
172
|
+
if (comparison > 0) {
|
173
|
+
swapIndex = rightIndex;
|
174
|
+
needsSwap = true;
|
175
|
+
}
|
176
|
+
}
|
177
|
+
|
178
|
+
// if there is a child that is less than the value, float the child and
|
179
|
+
// sink the value.
|
180
|
+
if (needsSwap) {
|
181
|
+
this.content.set(index, this.content[swapIndex]);
|
182
|
+
this.content.set(swapIndex, value);
|
183
|
+
index = swapIndex;
|
184
|
+
// and continue sinking
|
185
|
+
} else {
|
186
|
+
// if the children are both less than the value
|
187
|
+
break;
|
188
|
+
}
|
189
|
+
|
190
|
+
}
|
191
|
+
|
192
|
+
};
|
193
|
+
|
194
|
+
Heap.prototype.clear = function () {
|
195
|
+
this.content.clear();
|
196
|
+
this.length = 0;
|
197
|
+
};
|
198
|
+
|
199
|
+
Heap.prototype.reduce = function (callback, basis /*, thisp*/) {
|
200
|
+
var thisp = arguments[2];
|
201
|
+
return this.content.reduce(function (basis, value, key) {
|
202
|
+
return callback.call(thisp, basis, value, key, this);
|
203
|
+
}, basis, this);
|
204
|
+
};
|
205
|
+
|
206
|
+
Heap.prototype.reduceRight = function (callback, basis /*, thisp*/) {
|
207
|
+
var thisp = arguments[2];
|
208
|
+
return this.content.reduceRight(function (basis, value, key) {
|
209
|
+
return callback.call(thisp, basis, value, key, this);
|
210
|
+
}, basis, this);
|
211
|
+
};
|
212
|
+
|
213
|
+
Heap.prototype.makeObservable = function () {
|
214
|
+
// TODO refactor dispatchers to allow direct forwarding
|
215
|
+
this.content.addRangeChangeListener(this, "content");
|
216
|
+
this.content.addBeforeRangeChangeListener(this, "content");
|
217
|
+
this.content.addMapChangeListener(this, "content");
|
218
|
+
this.content.addBeforeMapChangeListener(this, "content");
|
219
|
+
};
|
220
|
+
|
221
|
+
Heap.prototype.handleContentRangeChange = function (plus, minus, index) {
|
222
|
+
this.dispatchRangeChange(plus, minus, index);
|
223
|
+
};
|
224
|
+
|
225
|
+
Heap.prototype.handleContentRangeWillChange = function (plus, minus, index) {
|
226
|
+
this.dispatchBeforeRangeChange(plus, minus, index);
|
227
|
+
};
|
228
|
+
|
229
|
+
Heap.prototype.handleContentMapChange = function (value, key) {
|
230
|
+
this.dispatchMapChange(key, value);
|
231
|
+
};
|
232
|
+
|
233
|
+
Heap.prototype.handleContentMapWillChange = function (value, key) {
|
234
|
+
this.dispatchBeforeMapChange(key, value);
|
235
|
+
};
|
236
|
+
|