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 @@
|
|
1
|
+
(function(e){if(typeof module==="object"&&module.exports===e)e=module.exports=H;e.SEMVER_SPEC_VERSION="2.0.0";var r=e.re=[];var t=e.src=[];var n=0;var i=n++;t[i]="0|[1-9]\\d*";var s=n++;t[s]="[0-9]+";var a=n++;t[a]="\\d*[a-zA-Z-][a-zA-Z0-9-]*";var o=n++;t[o]="("+t[i]+")\\."+"("+t[i]+")\\."+"("+t[i]+")";var f=n++;t[f]="("+t[s]+")\\."+"("+t[s]+")\\."+"("+t[s]+")";var u=n++;t[u]="(?:"+t[i]+"|"+t[a]+")";var c=n++;t[c]="(?:"+t[s]+"|"+t[a]+")";var l=n++;t[l]="(?:-("+t[u]+"(?:\\."+t[u]+")*))";var p=n++;t[p]="(?:-?("+t[c]+"(?:\\."+t[c]+")*))";var h=n++;t[h]="[0-9A-Za-z-]+";var v=n++;t[v]="(?:\\+("+t[h]+"(?:\\."+t[h]+")*))";var m=n++;var g="v?"+t[o]+t[l]+"?"+t[v]+"?";t[m]="^"+g+"$";var w="[v=\\s]*"+t[f]+t[p]+"?"+t[v]+"?";var d=n++;t[d]="^"+w+"$";var y=n++;t[y]="((?:<|>)?=?)";var b=n++;t[b]=t[s]+"|x|X|\\*";var $=n++;t[$]=t[i]+"|x|X|\\*";var j=n++;t[j]="[v=\\s]*("+t[$]+")"+"(?:\\.("+t[$]+")"+"(?:\\.("+t[$]+")"+"(?:("+t[l]+")"+")?)?)?";var k=n++;t[k]="[v=\\s]*("+t[b]+")"+"(?:\\.("+t[b]+")"+"(?:\\.("+t[b]+")"+"(?:("+t[p]+")"+")?)?)?";var E=n++;t[E]="^"+t[y]+"\\s*"+t[j]+"$";var x=n++;t[x]="^"+t[y]+"\\s*"+t[k]+"$";var R=n++;t[R]="(?:~>?)";var S=n++;t[S]="(\\s*)"+t[R]+"\\s+";r[S]=new RegExp(t[S],"g");var V="$1~";var I=n++;t[I]="^"+t[R]+t[j]+"$";var T=n++;t[T]="^"+t[R]+t[k]+"$";var A=n++;t[A]="(?:\\^)";var C=n++;t[C]="(\\s*)"+t[A]+"\\s+";r[C]=new RegExp(t[C],"g");var M="$1^";var z=n++;t[z]="^"+t[A]+t[j]+"$";var P=n++;t[P]="^"+t[A]+t[k]+"$";var Z=n++;t[Z]="^"+t[y]+"\\s*("+w+")$|^$";var q=n++;t[q]="^"+t[y]+"\\s*("+g+")$|^$";var L=n++;t[L]="(\\s*)"+t[y]+"\\s*("+w+"|"+t[j]+")";r[L]=new RegExp(t[L],"g");var X="$1$2$3";var _=n++;t[_]="^\\s*("+t[j]+")"+"\\s+-\\s+"+"("+t[j]+")"+"\\s*$";var N=n++;t[N]="^\\s*("+t[k]+")"+"\\s+-\\s+"+"("+t[k]+")"+"\\s*$";var O=n++;t[O]="(<|>)?=?\\s*\\*";for(var B=0;B<n;B++){if(!r[B])r[B]=new RegExp(t[B])}e.parse=D;function D(e,t){var n=t?r[d]:r[m];return n.test(e)?new H(e,t):null}e.valid=F;function F(e,r){var t=D(e,r);return t?t.version:null}e.clean=G;function G(e,r){var t=D(e,r);return t?t.version:null}e.SemVer=H;function H(e,t){if(e instanceof H){if(e.loose===t)return e;else e=e.version}else if(typeof e!=="string"){throw new TypeError("Invalid Version: "+e)}if(!(this instanceof H))return new H(e,t);this.loose=t;var n=e.trim().match(t?r[d]:r[m]);if(!n)throw new TypeError("Invalid Version: "+e);this.raw=e;this.major=+n[1];this.minor=+n[2];this.patch=+n[3];if(!n[4])this.prerelease=[];else this.prerelease=n[4].split(".").map(function(e){return/^[0-9]+$/.test(e)?+e:e});this.build=n[5]?n[5].split("."):[];this.format()}H.prototype.format=function(){this.version=this.major+"."+this.minor+"."+this.patch;if(this.prerelease.length)this.version+="-"+this.prerelease.join(".");return this.version};H.prototype.inspect=function(){return'<SemVer "'+this+'">'};H.prototype.toString=function(){return this.version};H.prototype.compare=function(e){if(!(e instanceof H))e=new H(e,this.loose);return this.compareMain(e)||this.comparePre(e)};H.prototype.compareMain=function(e){if(!(e instanceof H))e=new H(e,this.loose);return Q(this.major,e.major)||Q(this.minor,e.minor)||Q(this.patch,e.patch)};H.prototype.comparePre=function(e){if(!(e instanceof H))e=new H(e,this.loose);if(this.prerelease.length&&!e.prerelease.length)return-1;else if(!this.prerelease.length&&e.prerelease.length)return 1;else if(!this.prerelease.length&&!e.prerelease.length)return 0;var r=0;do{var t=this.prerelease[r];var n=e.prerelease[r];if(t===undefined&&n===undefined)return 0;else if(n===undefined)return 1;else if(t===undefined)return-1;else if(t===n)continue;else return Q(t,n)}while(++r)};H.prototype.inc=function(e){switch(e){case"premajor":this.inc("major");this.inc("pre");break;case"preminor":this.inc("minor");this.inc("pre");break;case"prepatch":this.inc("patch");this.inc("pre");break;case"prerelease":if(this.prerelease.length===0)this.inc("patch");this.inc("pre");break;case"major":this.major++;this.minor=-1;case"minor":this.minor++;this.patch=0;this.prerelease=[];break;case"patch":if(this.prerelease.length===0)this.patch++;this.prerelease=[];break;case"pre":if(this.prerelease.length===0)this.prerelease=[0];else{var r=this.prerelease.length;while(--r>=0){if(typeof this.prerelease[r]==="number"){this.prerelease[r]++;r=-2}}if(r===-1)this.prerelease.push(0)}break;default:throw new Error("invalid increment argument: "+e)}this.format();return this};e.inc=J;function J(e,r,t){try{return new H(e,t).inc(r).version}catch(n){return null}}e.compareIdentifiers=Q;var K=/^[0-9]+$/;function Q(e,r){var t=K.test(e);var n=K.test(r);if(t&&n){e=+e;r=+r}return t&&!n?-1:n&&!t?1:e<r?-1:e>r?1:0}e.rcompareIdentifiers=U;function U(e,r){return Q(r,e)}e.compare=W;function W(e,r,t){return new H(e,t).compare(r)}e.compareLoose=Y;function Y(e,r){return W(e,r,true)}e.rcompare=er;function er(e,r,t){return W(r,e,t)}e.sort=rr;function rr(r,t){return r.sort(function(r,n){return e.compare(r,n,t)})}e.rsort=tr;function tr(r,t){return r.sort(function(r,n){return e.rcompare(r,n,t)})}e.gt=nr;function nr(e,r,t){return W(e,r,t)>0}e.lt=ir;function ir(e,r,t){return W(e,r,t)<0}e.eq=sr;function sr(e,r,t){return W(e,r,t)===0}e.neq=ar;function ar(e,r,t){return W(e,r,t)!==0}e.gte=or;function or(e,r,t){return W(e,r,t)>=0}e.lte=fr;function fr(e,r,t){return W(e,r,t)<=0}e.cmp=ur;function ur(e,r,t,n){var i;switch(r){case"===":i=e===t;break;case"!==":i=e!==t;break;case"":case"=":case"==":i=sr(e,t,n);break;case"!=":i=ar(e,t,n);break;case">":i=nr(e,t,n);break;case">=":i=or(e,t,n);break;case"<":i=ir(e,t,n);break;case"<=":i=fr(e,t,n);break;default:throw new TypeError("Invalid operator: "+r)}return i}e.Comparator=cr;function cr(e,r){if(e instanceof cr){if(e.loose===r)return e;else e=e.value}if(!(this instanceof cr))return new cr(e,r);this.loose=r;this.parse(e);if(this.semver===lr)this.value="";else this.value=this.operator+this.semver.version}var lr={};cr.prototype.parse=function(e){var t=this.loose?r[Z]:r[q];var n=e.match(t);if(!n)throw new TypeError("Invalid comparator: "+e);this.operator=n[1];if(!n[2])this.semver=lr;else{this.semver=new H(n[2],this.loose);if(this.operator==="<"&&!this.semver.prerelease.length){this.semver.prerelease=["0"];this.semver.format()}}};cr.prototype.inspect=function(){return'<SemVer Comparator "'+this+'">'};cr.prototype.toString=function(){return this.value};cr.prototype.test=function(e){return this.semver===lr?true:ur(e,this.operator,this.semver,this.loose)};e.Range=pr;function pr(e,r){if(e instanceof pr&&e.loose===r)return e;if(!(this instanceof pr))return new pr(e,r);this.loose=r;this.raw=e;this.set=e.split(/\s*\|\|\s*/).map(function(e){return this.parseRange(e.trim())},this).filter(function(e){return e.length});if(!this.set.length){throw new TypeError("Invalid SemVer Range: "+e)}this.format()}pr.prototype.inspect=function(){return'<SemVer Range "'+this.range+'">'};pr.prototype.format=function(){this.range=this.set.map(function(e){return e.join(" ").trim()}).join("||").trim();return this.range};pr.prototype.toString=function(){return this.range};pr.prototype.parseRange=function(e){var t=this.loose;e=e.trim();var n=t?r[N]:r[_];e=e.replace(n,kr);e=e.replace(r[L],X);e=e.replace(r[S],V);e=e.replace(r[C],M);e=e.split(/\s+/).join(" ");var i=t?r[Z]:r[q];var s=e.split(" ").map(function(e){return vr(e,t)}).join(" ").split(/\s+/);if(this.loose){s=s.filter(function(e){return!!e.match(i)})}s=s.map(function(e){return new cr(e,t)});return s};e.toComparators=hr;function hr(e,r){return new pr(e,r).set.map(function(e){return e.map(function(e){return e.value}).join(" ").trim().split(" ")})}function vr(e,r){e=dr(e,r);e=gr(e,r);e=br(e,r);e=jr(e,r);return e}function mr(e){return!e||e.toLowerCase()==="x"||e==="*"}function gr(e,r){return e.trim().split(/\s+/).map(function(e){return wr(e,r)}).join(" ")}function wr(e,t){var n=t?r[T]:r[I];return e.replace(n,function(e,r,t,n,i){var s;if(mr(r))s="";else if(mr(t))s=">="+r+".0.0-0 <"+(+r+1)+".0.0-0";else if(mr(n))s=">="+r+"."+t+".0-0 <"+r+"."+(+t+1)+".0-0";else if(i){if(i.charAt(0)!=="-")i="-"+i;s=">="+r+"."+t+"."+n+i+" <"+r+"."+(+t+1)+".0-0"}else s=">="+r+"."+t+"."+n+"-0"+" <"+r+"."+(+t+1)+".0-0";return s})}function dr(e,r){return e.trim().split(/\s+/).map(function(e){return yr(e,r)}).join(" ")}function yr(e,t){var n=t?r[P]:r[z];return e.replace(n,function(e,r,t,n,i){var s;if(mr(r))s="";else if(mr(t))s=">="+r+".0.0-0 <"+(+r+1)+".0.0-0";else if(mr(n)){if(r==="0")s=">="+r+"."+t+".0-0 <"+r+"."+(+t+1)+".0-0";else s=">="+r+"."+t+".0-0 <"+(+r+1)+".0.0-0"}else if(i){if(i.charAt(0)!=="-")i="-"+i;if(r==="0"){if(t==="0")s="="+r+"."+t+"."+n+i;else s=">="+r+"."+t+"."+n+i+" <"+r+"."+(+t+1)+".0-0"}else s=">="+r+"."+t+"."+n+i+" <"+(+r+1)+".0.0-0"}else{if(r==="0"){if(t==="0")s="="+r+"."+t+"."+n;else s=">="+r+"."+t+"."+n+"-0"+" <"+r+"."+(+t+1)+".0-0"}else s=">="+r+"."+t+"."+n+"-0"+" <"+(+r+1)+".0.0-0"}return s})}function br(e,r){return e.split(/\s+/).map(function(e){return $r(e,r)}).join(" ")}function $r(e,t){e=e.trim();var n=t?r[x]:r[E];return e.replace(n,function(e,r,t,n,i,s){var a=mr(t);var o=a||mr(n);var f=o||mr(i);var u=f;if(r==="="&&u)r="";if(r&&u){if(a)t=0;if(o)n=0;if(f)i=0;if(r===">"){r=">=";if(a){}else if(o){t=+t+1;n=0;i=0}else if(f){n=+n+1;i=0}}e=r+t+"."+n+"."+i+"-0"}else if(a){e="*"}else if(o){e=">="+t+".0.0-0 <"+(+t+1)+".0.0-0"}else if(f){e=">="+t+"."+n+".0-0 <"+t+"."+(+n+1)+".0-0"}return e})}function jr(e,t){return e.trim().replace(r[O],"")}function kr(e,r,t,n,i,s,a,o,f,u,c,l,p){if(mr(t))r="";else if(mr(n))r=">="+t+".0.0-0";else if(mr(i))r=">="+t+"."+n+".0-0";else r=">="+r;if(mr(f))o="";else if(mr(u))o="<"+(+f+1)+".0.0-0";else if(mr(c))o="<"+f+"."+(+u+1)+".0-0";else if(l)o="<="+f+"."+u+"."+c+"-"+l;else o="<="+o;return(r+" "+o).trim()}pr.prototype.test=function(e){if(!e)return false;for(var r=0;r<this.set.length;r++){if(Er(this.set[r],e))return true}return false};function Er(e,r){for(var t=0;t<e.length;t++){if(!e[t].test(r))return false}return true}e.satisfies=xr;function xr(e,r,t){try{r=new pr(r,t)}catch(n){return false}return r.test(e)}e.maxSatisfying=Rr;function Rr(e,r,t){return e.filter(function(e){return xr(e,r,t)}).sort(function(e,r){return er(e,r,t)})[0]||null}e.validRange=Sr;function Sr(e,r){try{return new pr(e,r).range||"*"}catch(t){return null}}e.ltr=Vr;function Vr(e,r,t){return Tr(e,r,"<",t)}e.gtr=Ir;function Ir(e,r,t){return Tr(e,r,">",t)}e.outside=Tr;function Tr(e,r,t,n){e=new H(e,n);r=new pr(r,n);var i,s,a,o,f;switch(t){case">":i=nr;s=fr;a=ir;o=">";f=">=";break;case"<":i=ir;s=or;a=nr;o="<";f="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(xr(e,r,n)){return false}for(var u=0;u<r.set.length;++u){var c=r.set[u];var l=null;var p=null;c.forEach(function(e){l=l||e;p=p||e;if(i(e.semver,l.semver,n)){l=e}else if(a(e.semver,p.semver,n)){p=e}});if(l.operator===o||l.operator===f){return false}if((!p.operator||p.operator===o)&&s(e,p.semver)){return false}else if(p.operator===f&&a(e,p.semver)){return false}}return true}if(typeof define==="function"&&define.amd)define(e)})(typeof exports==="object"?exports:typeof define==="function"&&define.amd?{}:semver={});
|
Binary file
|
@@ -0,0 +1,15 @@
|
|
1
|
+
var tap = require('tap');
|
2
|
+
var test = tap.test;
|
3
|
+
|
4
|
+
test('amd', function(t) {
|
5
|
+
global.define = define;
|
6
|
+
define.amd = true;
|
7
|
+
var defined = null;
|
8
|
+
function define(stuff) {
|
9
|
+
defined = stuff;
|
10
|
+
}
|
11
|
+
var fromRequire = require('../');
|
12
|
+
t.ok(defined, 'amd function called');
|
13
|
+
t.equal(fromRequire, defined, 'amd stuff same as require stuff');
|
14
|
+
t.end();
|
15
|
+
});
|
@@ -0,0 +1,173 @@
|
|
1
|
+
var tap = require('tap');
|
2
|
+
var test = tap.test;
|
3
|
+
var semver = require('../semver.js');
|
4
|
+
var gtr = semver.gtr;
|
5
|
+
|
6
|
+
test('\ngtr tests', function(t) {
|
7
|
+
// [range, version, loose]
|
8
|
+
// Version should be greater than range
|
9
|
+
[
|
10
|
+
['~1.2.2', '1.3.0'],
|
11
|
+
['~0.6.1-1', '0.7.1-1'],
|
12
|
+
['1.0.0 - 2.0.0', '2.0.1'],
|
13
|
+
['1.0.0', '1.0.1-beta1'],
|
14
|
+
['1.0.0', '2.0.0'],
|
15
|
+
['<=2.0.0', '2.1.1'],
|
16
|
+
['<=2.0.0', '3.2.9'],
|
17
|
+
['<2.0.0', '2.0.0'],
|
18
|
+
['0.1.20 || 1.2.4', '1.2.5'],
|
19
|
+
['2.x.x', '3.0.0'],
|
20
|
+
['1.2.x', '1.3.0'],
|
21
|
+
['1.2.x || 2.x', '3.0.0'],
|
22
|
+
['2.*.*', '5.0.1'],
|
23
|
+
['1.2.*', '1.3.3'],
|
24
|
+
['1.2.* || 2.*', '4.0.0'],
|
25
|
+
['2', '3.0.0'],
|
26
|
+
['2.3', '2.4.2'],
|
27
|
+
['~2.4', '2.5.0'], // >=2.4.0 <2.5.0
|
28
|
+
['~2.4', '2.5.5'],
|
29
|
+
['~>3.2.1', '3.3.0'], // >=3.2.1 <3.3.0
|
30
|
+
['~1', '2.2.3'], // >=1.0.0 <2.0.0
|
31
|
+
['~>1', '2.2.4'],
|
32
|
+
['~> 1', '3.2.3'],
|
33
|
+
['~1.0', '1.1.2'], // >=1.0.0 <1.1.0
|
34
|
+
['~ 1.0', '1.1.0'],
|
35
|
+
['<1.2', '1.2.0'],
|
36
|
+
['< 1.2', '1.2.1'],
|
37
|
+
['1', '2.0.0beta', true],
|
38
|
+
['~v0.5.4-pre', '0.6.0'],
|
39
|
+
['~v0.5.4-pre', '0.6.1-pre'],
|
40
|
+
['=0.7.x', '0.8.0'],
|
41
|
+
['=0.7.x', '0.8.0-asdf'],
|
42
|
+
['<=0.7.x', '0.7.0'],
|
43
|
+
['~1.2.2', '1.3.0'],
|
44
|
+
['1.0.0 - 2.0.0', '2.2.3'],
|
45
|
+
['1.0.0', '1.0.1'],
|
46
|
+
['<=2.0.0', '3.0.0'],
|
47
|
+
['<=2.0.0', '2.9999.9999'],
|
48
|
+
['<=2.0.0', '2.2.9'],
|
49
|
+
['<2.0.0', '2.9999.9999'],
|
50
|
+
['<2.0.0', '2.2.9'],
|
51
|
+
['2.x.x', '3.1.3'],
|
52
|
+
['1.2.x', '1.3.3'],
|
53
|
+
['1.2.x || 2.x', '3.1.3'],
|
54
|
+
['2.*.*', '3.1.3'],
|
55
|
+
['1.2.*', '1.3.3'],
|
56
|
+
['1.2.* || 2.*', '3.1.3'],
|
57
|
+
['2', '3.1.2'],
|
58
|
+
['2.3', '2.4.1'],
|
59
|
+
['~2.4', '2.5.0'], // >=2.4.0 <2.5.0
|
60
|
+
['~>3.2.1', '3.3.2'], // >=3.2.1 <3.3.0
|
61
|
+
['~1', '2.2.3'], // >=1.0.0 <2.0.0
|
62
|
+
['~>1', '2.2.3'],
|
63
|
+
['~1.0', '1.1.0'], // >=1.0.0 <1.1.0
|
64
|
+
['<1', '1.0.0'],
|
65
|
+
['1', '2.0.0beta', true],
|
66
|
+
['<1', '1.0.0beta', true],
|
67
|
+
['< 1', '1.0.0beta', true],
|
68
|
+
['=0.7.x', '0.8.2'],
|
69
|
+
['<=0.7.x', '0.7.2']
|
70
|
+
].forEach(function(tuple) {
|
71
|
+
var range = tuple[0];
|
72
|
+
var version = tuple[1];
|
73
|
+
var loose = tuple[2] || false;
|
74
|
+
var msg = 'gtr(' + version + ', ' + range + ', ' + loose + ')';
|
75
|
+
t.ok(gtr(version, range, loose), msg);
|
76
|
+
});
|
77
|
+
t.end();
|
78
|
+
});
|
79
|
+
|
80
|
+
test('\nnegative gtr tests', function(t) {
|
81
|
+
// [range, version, loose]
|
82
|
+
// Version should NOT be greater than range
|
83
|
+
[
|
84
|
+
['~0.6.1-1', '0.6.1-1'],
|
85
|
+
['1.0.0 - 2.0.0', '1.2.3'],
|
86
|
+
['1.0.0 - 2.0.0', '0.9.9'],
|
87
|
+
['1.0.0', '1.0.0'],
|
88
|
+
['>=*', '0.2.4'],
|
89
|
+
['', '1.0.0', true],
|
90
|
+
['*', '1.2.3'],
|
91
|
+
['*', 'v1.2.3-foo'],
|
92
|
+
['>=1.0.0', '1.0.0'],
|
93
|
+
['>=1.0.0', '1.0.1'],
|
94
|
+
['>=1.0.0', '1.1.0'],
|
95
|
+
['>1.0.0', '1.0.1'],
|
96
|
+
['>1.0.0', '1.1.0'],
|
97
|
+
['<=2.0.0', '2.0.0'],
|
98
|
+
['<=2.0.0', '1.9999.9999'],
|
99
|
+
['<=2.0.0', '0.2.9'],
|
100
|
+
['<2.0.0', '1.9999.9999'],
|
101
|
+
['<2.0.0', '0.2.9'],
|
102
|
+
['>= 1.0.0', '1.0.0'],
|
103
|
+
['>= 1.0.0', '1.0.1'],
|
104
|
+
['>= 1.0.0', '1.1.0'],
|
105
|
+
['> 1.0.0', '1.0.1'],
|
106
|
+
['> 1.0.0', '1.1.0'],
|
107
|
+
['<= 2.0.0', '2.0.0'],
|
108
|
+
['<= 2.0.0', '1.9999.9999'],
|
109
|
+
['<= 2.0.0', '0.2.9'],
|
110
|
+
['< 2.0.0', '1.9999.9999'],
|
111
|
+
['<\t2.0.0', '0.2.9'],
|
112
|
+
['>=0.1.97', 'v0.1.97'],
|
113
|
+
['>=0.1.97', '0.1.97'],
|
114
|
+
['0.1.20 || 1.2.4', '1.2.4'],
|
115
|
+
['0.1.20 || >1.2.4', '1.2.4'],
|
116
|
+
['0.1.20 || 1.2.4', '1.2.3'],
|
117
|
+
['0.1.20 || 1.2.4', '0.1.20'],
|
118
|
+
['>=0.2.3 || <0.0.1', '0.0.0'],
|
119
|
+
['>=0.2.3 || <0.0.1', '0.2.3'],
|
120
|
+
['>=0.2.3 || <0.0.1', '0.2.4'],
|
121
|
+
['||', '1.3.4'],
|
122
|
+
['2.x.x', '2.1.3'],
|
123
|
+
['1.2.x', '1.2.3'],
|
124
|
+
['1.2.x || 2.x', '2.1.3'],
|
125
|
+
['1.2.x || 2.x', '1.2.3'],
|
126
|
+
['x', '1.2.3'],
|
127
|
+
['2.*.*', '2.1.3'],
|
128
|
+
['1.2.*', '1.2.3'],
|
129
|
+
['1.2.* || 2.*', '2.1.3'],
|
130
|
+
['1.2.* || 2.*', '1.2.3'],
|
131
|
+
['1.2.* || 2.*', '1.2.3'],
|
132
|
+
['*', '1.2.3'],
|
133
|
+
['2', '2.1.2'],
|
134
|
+
['2.3', '2.3.1'],
|
135
|
+
['~2.4', '2.4.0'], // >=2.4.0 <2.5.0
|
136
|
+
['~2.4', '2.4.5'],
|
137
|
+
['~>3.2.1', '3.2.2'], // >=3.2.1 <3.3.0
|
138
|
+
['~1', '1.2.3'], // >=1.0.0 <2.0.0
|
139
|
+
['~>1', '1.2.3'],
|
140
|
+
['~> 1', '1.2.3'],
|
141
|
+
['~1.0', '1.0.2'], // >=1.0.0 <1.1.0
|
142
|
+
['~ 1.0', '1.0.2'],
|
143
|
+
['>=1', '1.0.0'],
|
144
|
+
['>= 1', '1.0.0'],
|
145
|
+
['<1.2', '1.1.1'],
|
146
|
+
['< 1.2', '1.1.1'],
|
147
|
+
['1', '1.0.0beta', true],
|
148
|
+
['~v0.5.4-pre', '0.5.5'],
|
149
|
+
['~v0.5.4-pre', '0.5.4'],
|
150
|
+
['=0.7.x', '0.7.2'],
|
151
|
+
['>=0.7.x', '0.7.2'],
|
152
|
+
['=0.7.x', '0.7.0-asdf'],
|
153
|
+
['>=0.7.x', '0.7.0-asdf'],
|
154
|
+
['<=0.7.x', '0.6.2'],
|
155
|
+
['>0.2.3 >0.2.4 <=0.2.5', '0.2.5'],
|
156
|
+
['>=0.2.3 <=0.2.4', '0.2.4'],
|
157
|
+
['1.0.0 - 2.0.0', '2.0.0'],
|
158
|
+
['^1', '0.0.0-0'],
|
159
|
+
['^3.0.0', '2.0.0'],
|
160
|
+
['^1.0.0 || ~2.0.1', '2.0.0'],
|
161
|
+
['^0.1.0 || ~3.0.1 || 5.0.0', '3.2.0'],
|
162
|
+
['^0.1.0 || ~3.0.1 || 5.0.0', '1.0.0beta', true],
|
163
|
+
['^0.1.0 || ~3.0.1 || 5.0.0', '5.0.0-0', true],
|
164
|
+
['^0.1.0 || ~3.0.1 || >4 <=5.0.0', '3.5.0']
|
165
|
+
].forEach(function(tuple) {
|
166
|
+
var range = tuple[0];
|
167
|
+
var version = tuple[1];
|
168
|
+
var loose = tuple[2] || false;
|
169
|
+
var msg = '!gtr(' + version + ', ' + range + ', ' + loose + ')';
|
170
|
+
t.notOk(gtr(version, range, loose), msg);
|
171
|
+
});
|
172
|
+
t.end();
|
173
|
+
});
|
@@ -0,0 +1,584 @@
|
|
1
|
+
var tap = require('tap');
|
2
|
+
var test = tap.test;
|
3
|
+
var semver = require('../semver.js');
|
4
|
+
var eq = semver.eq;
|
5
|
+
var gt = semver.gt;
|
6
|
+
var lt = semver.lt;
|
7
|
+
var neq = semver.neq;
|
8
|
+
var cmp = semver.cmp;
|
9
|
+
var gte = semver.gte;
|
10
|
+
var lte = semver.lte;
|
11
|
+
var satisfies = semver.satisfies;
|
12
|
+
var validRange = semver.validRange;
|
13
|
+
var inc = semver.inc;
|
14
|
+
var replaceStars = semver.replaceStars;
|
15
|
+
var toComparators = semver.toComparators;
|
16
|
+
var SemVer = semver.SemVer;
|
17
|
+
var Range = semver.Range;
|
18
|
+
|
19
|
+
test('\ncomparison tests', function(t) {
|
20
|
+
// [version1, version2]
|
21
|
+
// version1 should be greater than version2
|
22
|
+
[['0.0.0', '0.0.0-foo'],
|
23
|
+
['0.0.1', '0.0.0'],
|
24
|
+
['1.0.0', '0.9.9'],
|
25
|
+
['0.10.0', '0.9.0'],
|
26
|
+
['0.99.0', '0.10.0'],
|
27
|
+
['2.0.0', '1.2.3'],
|
28
|
+
['v0.0.0', '0.0.0-foo', true],
|
29
|
+
['v0.0.1', '0.0.0', true],
|
30
|
+
['v1.0.0', '0.9.9', true],
|
31
|
+
['v0.10.0', '0.9.0', true],
|
32
|
+
['v0.99.0', '0.10.0', true],
|
33
|
+
['v2.0.0', '1.2.3', true],
|
34
|
+
['0.0.0', 'v0.0.0-foo', true],
|
35
|
+
['0.0.1', 'v0.0.0', true],
|
36
|
+
['1.0.0', 'v0.9.9', true],
|
37
|
+
['0.10.0', 'v0.9.0', true],
|
38
|
+
['0.99.0', 'v0.10.0', true],
|
39
|
+
['2.0.0', 'v1.2.3', true],
|
40
|
+
['1.2.3', '1.2.3-asdf'],
|
41
|
+
['1.2.3', '1.2.3-4'],
|
42
|
+
['1.2.3', '1.2.3-4-foo'],
|
43
|
+
['1.2.3-5-foo', '1.2.3-5'],
|
44
|
+
['1.2.3-5', '1.2.3-4'],
|
45
|
+
['1.2.3-5-foo', '1.2.3-5-Foo'],
|
46
|
+
['3.0.0', '2.7.2+asdf'],
|
47
|
+
['1.2.3-a.10', '1.2.3-a.5'],
|
48
|
+
['1.2.3-a.b', '1.2.3-a.5'],
|
49
|
+
['1.2.3-a.b', '1.2.3-a'],
|
50
|
+
['1.2.3-a.b.c.10.d.5', '1.2.3-a.b.c.5.d.100']
|
51
|
+
].forEach(function(v) {
|
52
|
+
var v0 = v[0];
|
53
|
+
var v1 = v[1];
|
54
|
+
var loose = v[2];
|
55
|
+
t.ok(gt(v0, v1, loose), "gt('" + v0 + "', '" + v1 + "')");
|
56
|
+
t.ok(lt(v1, v0, loose), "lt('" + v1 + "', '" + v0 + "')");
|
57
|
+
t.ok(!gt(v1, v0, loose), "!gt('" + v1 + "', '" + v0 + "')");
|
58
|
+
t.ok(!lt(v0, v1, loose), "!lt('" + v0 + "', '" + v1 + "')");
|
59
|
+
t.ok(eq(v0, v0, loose), "eq('" + v0 + "', '" + v0 + "')");
|
60
|
+
t.ok(eq(v1, v1, loose), "eq('" + v1 + "', '" + v1 + "')");
|
61
|
+
t.ok(neq(v0, v1, loose), "neq('" + v0 + "', '" + v1 + "')");
|
62
|
+
t.ok(cmp(v1, '==', v1, loose), "cmp('" + v1 + "' == '" + v1 + "')");
|
63
|
+
t.ok(cmp(v0, '>=', v1, loose), "cmp('" + v0 + "' >= '" + v1 + "')");
|
64
|
+
t.ok(cmp(v1, '<=', v0, loose), "cmp('" + v1 + "' <= '" + v0 + "')");
|
65
|
+
t.ok(cmp(v0, '!=', v1, loose), "cmp('" + v0 + "' != '" + v1 + "')");
|
66
|
+
});
|
67
|
+
t.end();
|
68
|
+
});
|
69
|
+
|
70
|
+
test('\nequality tests', function(t) {
|
71
|
+
// [version1, version2]
|
72
|
+
// version1 should be equivalent to version2
|
73
|
+
[['1.2.3', 'v1.2.3', true],
|
74
|
+
['1.2.3', '=1.2.3', true],
|
75
|
+
['1.2.3', 'v 1.2.3', true],
|
76
|
+
['1.2.3', '= 1.2.3', true],
|
77
|
+
['1.2.3', ' v1.2.3', true],
|
78
|
+
['1.2.3', ' =1.2.3', true],
|
79
|
+
['1.2.3', ' v 1.2.3', true],
|
80
|
+
['1.2.3', ' = 1.2.3', true],
|
81
|
+
['1.2.3-0', 'v1.2.3-0', true],
|
82
|
+
['1.2.3-0', '=1.2.3-0', true],
|
83
|
+
['1.2.3-0', 'v 1.2.3-0', true],
|
84
|
+
['1.2.3-0', '= 1.2.3-0', true],
|
85
|
+
['1.2.3-0', ' v1.2.3-0', true],
|
86
|
+
['1.2.3-0', ' =1.2.3-0', true],
|
87
|
+
['1.2.3-0', ' v 1.2.3-0', true],
|
88
|
+
['1.2.3-0', ' = 1.2.3-0', true],
|
89
|
+
['1.2.3-1', 'v1.2.3-1', true],
|
90
|
+
['1.2.3-1', '=1.2.3-1', true],
|
91
|
+
['1.2.3-1', 'v 1.2.3-1', true],
|
92
|
+
['1.2.3-1', '= 1.2.3-1', true],
|
93
|
+
['1.2.3-1', ' v1.2.3-1', true],
|
94
|
+
['1.2.3-1', ' =1.2.3-1', true],
|
95
|
+
['1.2.3-1', ' v 1.2.3-1', true],
|
96
|
+
['1.2.3-1', ' = 1.2.3-1', true],
|
97
|
+
['1.2.3-beta', 'v1.2.3-beta', true],
|
98
|
+
['1.2.3-beta', '=1.2.3-beta', true],
|
99
|
+
['1.2.3-beta', 'v 1.2.3-beta', true],
|
100
|
+
['1.2.3-beta', '= 1.2.3-beta', true],
|
101
|
+
['1.2.3-beta', ' v1.2.3-beta', true],
|
102
|
+
['1.2.3-beta', ' =1.2.3-beta', true],
|
103
|
+
['1.2.3-beta', ' v 1.2.3-beta', true],
|
104
|
+
['1.2.3-beta', ' = 1.2.3-beta', true],
|
105
|
+
['1.2.3-beta+build', ' = 1.2.3-beta+otherbuild', true],
|
106
|
+
['1.2.3+build', ' = 1.2.3+otherbuild', true],
|
107
|
+
['1.2.3-beta+build', '1.2.3-beta+otherbuild'],
|
108
|
+
['1.2.3+build', '1.2.3+otherbuild'],
|
109
|
+
[' v1.2.3+build', '1.2.3+otherbuild']
|
110
|
+
].forEach(function(v) {
|
111
|
+
var v0 = v[0];
|
112
|
+
var v1 = v[1];
|
113
|
+
var loose = v[2];
|
114
|
+
t.ok(eq(v0, v1, loose), "eq('" + v0 + "', '" + v1 + "')");
|
115
|
+
t.ok(!neq(v0, v1, loose), "!neq('" + v0 + "', '" + v1 + "')");
|
116
|
+
t.ok(cmp(v0, '==', v1, loose), 'cmp(' + v0 + '==' + v1 + ')');
|
117
|
+
t.ok(!cmp(v0, '!=', v1, loose), '!cmp(' + v0 + '!=' + v1 + ')');
|
118
|
+
t.ok(!cmp(v0, '===', v1, loose), '!cmp(' + v0 + '===' + v1 + ')');
|
119
|
+
t.ok(cmp(v0, '!==', v1, loose), 'cmp(' + v0 + '!==' + v1 + ')');
|
120
|
+
t.ok(!gt(v0, v1, loose), "!gt('" + v0 + "', '" + v1 + "')");
|
121
|
+
t.ok(gte(v0, v1, loose), "gte('" + v0 + "', '" + v1 + "')");
|
122
|
+
t.ok(!lt(v0, v1, loose), "!lt('" + v0 + "', '" + v1 + "')");
|
123
|
+
t.ok(lte(v0, v1, loose), "lte('" + v0 + "', '" + v1 + "')");
|
124
|
+
});
|
125
|
+
t.end();
|
126
|
+
});
|
127
|
+
|
128
|
+
|
129
|
+
test('\nrange tests', function(t) {
|
130
|
+
// [range, version]
|
131
|
+
// version should be included by range
|
132
|
+
[['1.0.0 - 2.0.0', '1.2.3'],
|
133
|
+
['1.0.0', '1.0.0'],
|
134
|
+
['>=*', '0.2.4'],
|
135
|
+
['', '1.0.0'],
|
136
|
+
['*', '1.2.3'],
|
137
|
+
['*', 'v1.2.3-foo', true],
|
138
|
+
['>=1.0.0', '1.0.0'],
|
139
|
+
['>=1.0.0', '1.0.1'],
|
140
|
+
['>=1.0.0', '1.1.0'],
|
141
|
+
['>1.0.0', '1.0.1'],
|
142
|
+
['>1.0.0', '1.1.0'],
|
143
|
+
['<=2.0.0', '2.0.0'],
|
144
|
+
['<=2.0.0', '1.9999.9999'],
|
145
|
+
['<=2.0.0', '0.2.9'],
|
146
|
+
['<2.0.0', '1.9999.9999'],
|
147
|
+
['<2.0.0', '0.2.9'],
|
148
|
+
['>= 1.0.0', '1.0.0'],
|
149
|
+
['>= 1.0.0', '1.0.1'],
|
150
|
+
['>= 1.0.0', '1.1.0'],
|
151
|
+
['> 1.0.0', '1.0.1'],
|
152
|
+
['> 1.0.0', '1.1.0'],
|
153
|
+
['<= 2.0.0', '2.0.0'],
|
154
|
+
['<= 2.0.0', '1.9999.9999'],
|
155
|
+
['<= 2.0.0', '0.2.9'],
|
156
|
+
['< 2.0.0', '1.9999.9999'],
|
157
|
+
['<\t2.0.0', '0.2.9'],
|
158
|
+
['>=0.1.97', 'v0.1.97', true],
|
159
|
+
['>=0.1.97', '0.1.97'],
|
160
|
+
['0.1.20 || 1.2.4', '1.2.4'],
|
161
|
+
['>=0.2.3 || <0.0.1', '0.0.0'],
|
162
|
+
['>=0.2.3 || <0.0.1', '0.2.3'],
|
163
|
+
['>=0.2.3 || <0.0.1', '0.2.4'],
|
164
|
+
['||', '1.3.4'],
|
165
|
+
['2.x.x', '2.1.3'],
|
166
|
+
['1.2.x', '1.2.3'],
|
167
|
+
['1.2.x || 2.x', '2.1.3'],
|
168
|
+
['1.2.x || 2.x', '1.2.3'],
|
169
|
+
['x', '1.2.3'],
|
170
|
+
['2.*.*', '2.1.3'],
|
171
|
+
['1.2.*', '1.2.3'],
|
172
|
+
['1.2.* || 2.*', '2.1.3'],
|
173
|
+
['1.2.* || 2.*', '1.2.3'],
|
174
|
+
['*', '1.2.3'],
|
175
|
+
['2', '2.1.2'],
|
176
|
+
['2.3', '2.3.1'],
|
177
|
+
['~2.4', '2.4.0'], // >=2.4.0 <2.5.0
|
178
|
+
['~2.4', '2.4.5'],
|
179
|
+
['~>3.2.1', '3.2.2'], // >=3.2.1 <3.3.0,
|
180
|
+
['~1', '1.2.3'], // >=1.0.0 <2.0.0
|
181
|
+
['~>1', '1.2.3'],
|
182
|
+
['~> 1', '1.2.3'],
|
183
|
+
['~1.0', '1.0.2'], // >=1.0.0 <1.1.0,
|
184
|
+
['~ 1.0', '1.0.2'],
|
185
|
+
['~ 1.0.3', '1.0.12'],
|
186
|
+
['>=1', '1.0.0'],
|
187
|
+
['>= 1', '1.0.0'],
|
188
|
+
['<1.2', '1.1.1'],
|
189
|
+
['< 1.2', '1.1.1'],
|
190
|
+
['1', '1.0.0beta', true],
|
191
|
+
['~v0.5.4-pre', '0.5.5'],
|
192
|
+
['~v0.5.4-pre', '0.5.4'],
|
193
|
+
['=0.7.x', '0.7.2'],
|
194
|
+
['>=0.7.x', '0.7.2'],
|
195
|
+
['=0.7.x', '0.7.0-asdf'],
|
196
|
+
['>=0.7.x', '0.7.0-asdf'],
|
197
|
+
['<=0.7.x', '0.6.2'],
|
198
|
+
['~1.2.1 >=1.2.3', '1.2.3'],
|
199
|
+
['~1.2.1 =1.2.3', '1.2.3'],
|
200
|
+
['~1.2.1 1.2.3', '1.2.3'],
|
201
|
+
['~1.2.1 >=1.2.3 1.2.3', '1.2.3'],
|
202
|
+
['~1.2.1 1.2.3 >=1.2.3', '1.2.3'],
|
203
|
+
['~1.2.1 1.2.3', '1.2.3'],
|
204
|
+
['>=1.2.1 1.2.3', '1.2.3'],
|
205
|
+
['1.2.3 >=1.2.1', '1.2.3'],
|
206
|
+
['>=1.2.3 >=1.2.1', '1.2.3'],
|
207
|
+
['>=1.2.1 >=1.2.3', '1.2.3'],
|
208
|
+
['<=1.2.3', '1.2.3-beta'],
|
209
|
+
['>1.2', '1.3.0-beta'],
|
210
|
+
['>=1.2', '1.2.8'],
|
211
|
+
['^1.2.3', '1.8.1'],
|
212
|
+
['^1.2.3', '1.2.3-beta'],
|
213
|
+
['^0.1.2', '0.1.2'],
|
214
|
+
['^0.1', '0.1.2'],
|
215
|
+
['^1.2', '1.4.2'],
|
216
|
+
['^1.2 ^1', '1.4.2'],
|
217
|
+
['^1.2', '1.2.0-pre'],
|
218
|
+
['^1.2.3', '1.2.3-pre']
|
219
|
+
].forEach(function(v) {
|
220
|
+
var range = v[0];
|
221
|
+
var ver = v[1];
|
222
|
+
var loose = v[2];
|
223
|
+
t.ok(satisfies(ver, range, loose), range + ' satisfied by ' + ver);
|
224
|
+
});
|
225
|
+
t.end();
|
226
|
+
});
|
227
|
+
|
228
|
+
test('\nnegative range tests', function(t) {
|
229
|
+
// [range, version]
|
230
|
+
// version should not be included by range
|
231
|
+
[['1.0.0 - 2.0.0', '2.2.3'],
|
232
|
+
['1.0.0', '1.0.1'],
|
233
|
+
['>=1.0.0', '0.0.0'],
|
234
|
+
['>=1.0.0', '0.0.1'],
|
235
|
+
['>=1.0.0', '0.1.0'],
|
236
|
+
['>1.0.0', '0.0.1'],
|
237
|
+
['>1.0.0', '0.1.0'],
|
238
|
+
['<=2.0.0', '3.0.0'],
|
239
|
+
['<=2.0.0', '2.9999.9999'],
|
240
|
+
['<=2.0.0', '2.2.9'],
|
241
|
+
['<2.0.0', '2.9999.9999'],
|
242
|
+
['<2.0.0', '2.2.9'],
|
243
|
+
['>=0.1.97', 'v0.1.93', true],
|
244
|
+
['>=0.1.97', '0.1.93'],
|
245
|
+
['0.1.20 || 1.2.4', '1.2.3'],
|
246
|
+
['>=0.2.3 || <0.0.1', '0.0.3'],
|
247
|
+
['>=0.2.3 || <0.0.1', '0.2.2'],
|
248
|
+
['2.x.x', '1.1.3'],
|
249
|
+
['2.x.x', '3.1.3'],
|
250
|
+
['1.2.x', '1.3.3'],
|
251
|
+
['1.2.x || 2.x', '3.1.3'],
|
252
|
+
['1.2.x || 2.x', '1.1.3'],
|
253
|
+
['2.*.*', '1.1.3'],
|
254
|
+
['2.*.*', '3.1.3'],
|
255
|
+
['1.2.*', '1.3.3'],
|
256
|
+
['1.2.* || 2.*', '3.1.3'],
|
257
|
+
['1.2.* || 2.*', '1.1.3'],
|
258
|
+
['2', '1.1.2'],
|
259
|
+
['2.3', '2.4.1'],
|
260
|
+
['~2.4', '2.5.0'], // >=2.4.0 <2.5.0
|
261
|
+
['~2.4', '2.3.9'],
|
262
|
+
['~>3.2.1', '3.3.2'], // >=3.2.1 <3.3.0
|
263
|
+
['~>3.2.1', '3.2.0'], // >=3.2.1 <3.3.0
|
264
|
+
['~1', '0.2.3'], // >=1.0.0 <2.0.0
|
265
|
+
['~>1', '2.2.3'],
|
266
|
+
['~1.0', '1.1.0'], // >=1.0.0 <1.1.0
|
267
|
+
['<1', '1.0.0'],
|
268
|
+
['>=1.2', '1.1.1'],
|
269
|
+
['1', '2.0.0beta', true],
|
270
|
+
['~v0.5.4-beta', '0.5.4-alpha'],
|
271
|
+
['<1', '1.0.0beta', true],
|
272
|
+
['< 1', '1.0.0beta', true],
|
273
|
+
['=0.7.x', '0.8.2'],
|
274
|
+
['>=0.7.x', '0.6.2'],
|
275
|
+
['<=0.7.x', '0.7.2'],
|
276
|
+
['<1.2.3', '1.2.3-beta'],
|
277
|
+
['=1.2.3', '1.2.3-beta'],
|
278
|
+
['>1.2', '1.2.8'],
|
279
|
+
['^1.2.3', '2.0.0-alpha'],
|
280
|
+
['^1.2.3', '1.2.2'],
|
281
|
+
['^1.2', '1.1.9'],
|
282
|
+
// invalid ranges never satisfied!
|
283
|
+
['blerg', '1.2.3'],
|
284
|
+
['git+https://user:password0123@github.com/foo', '123.0.0', true],
|
285
|
+
['^1.2.3', '2.0.0-pre']
|
286
|
+
].forEach(function(v) {
|
287
|
+
var range = v[0];
|
288
|
+
var ver = v[1];
|
289
|
+
var loose = v[2];
|
290
|
+
var found = satisfies(ver, range, loose);
|
291
|
+
t.ok(!found, ver + ' not satisfied by ' + range);
|
292
|
+
});
|
293
|
+
t.end();
|
294
|
+
});
|
295
|
+
|
296
|
+
test('\nincrement versions test', function(t) {
|
297
|
+
// [version, inc, result]
|
298
|
+
// inc(version, inc) -> result
|
299
|
+
[['1.2.3', 'major', '2.0.0'],
|
300
|
+
['1.2.3', 'minor', '1.3.0'],
|
301
|
+
['1.2.3', 'patch', '1.2.4'],
|
302
|
+
['1.2.3tag', 'major', '2.0.0', true],
|
303
|
+
['1.2.3-tag', 'major', '2.0.0'],
|
304
|
+
['1.2.3', 'fake', null],
|
305
|
+
['1.2.0-0', 'patch', '1.2.0'],
|
306
|
+
['fake', 'major', null],
|
307
|
+
['1.2.3-4', 'major', '2.0.0'],
|
308
|
+
['1.2.3-4', 'minor', '1.3.0'],
|
309
|
+
['1.2.3-4', 'patch', '1.2.3'],
|
310
|
+
['1.2.3-alpha.0.beta', 'major', '2.0.0'],
|
311
|
+
['1.2.3-alpha.0.beta', 'minor', '1.3.0'],
|
312
|
+
['1.2.3-alpha.0.beta', 'patch', '1.2.3'],
|
313
|
+
['1.2.4', 'prerelease', '1.2.5-0'],
|
314
|
+
['1.2.3-0', 'prerelease', '1.2.3-1'],
|
315
|
+
['1.2.3-alpha.0', 'prerelease', '1.2.3-alpha.1'],
|
316
|
+
['1.2.3-alpha.1', 'prerelease', '1.2.3-alpha.2'],
|
317
|
+
['1.2.3-alpha.2', 'prerelease', '1.2.3-alpha.3'],
|
318
|
+
['1.2.3-alpha.0.beta', 'prerelease', '1.2.3-alpha.1.beta'],
|
319
|
+
['1.2.3-alpha.1.beta', 'prerelease', '1.2.3-alpha.2.beta'],
|
320
|
+
['1.2.3-alpha.2.beta', 'prerelease', '1.2.3-alpha.3.beta'],
|
321
|
+
['1.2.3-alpha.10.0.beta', 'prerelease', '1.2.3-alpha.10.1.beta'],
|
322
|
+
['1.2.3-alpha.10.1.beta', 'prerelease', '1.2.3-alpha.10.2.beta'],
|
323
|
+
['1.2.3-alpha.10.2.beta', 'prerelease', '1.2.3-alpha.10.3.beta'],
|
324
|
+
['1.2.3-alpha.10.beta.0', 'prerelease', '1.2.3-alpha.10.beta.1'],
|
325
|
+
['1.2.3-alpha.10.beta.1', 'prerelease', '1.2.3-alpha.10.beta.2'],
|
326
|
+
['1.2.3-alpha.10.beta.2', 'prerelease', '1.2.3-alpha.10.beta.3'],
|
327
|
+
['1.2.3-alpha.9.beta', 'prerelease', '1.2.3-alpha.10.beta'],
|
328
|
+
['1.2.3-alpha.10.beta', 'prerelease', '1.2.3-alpha.11.beta'],
|
329
|
+
['1.2.3-alpha.11.beta', 'prerelease', '1.2.3-alpha.12.beta'],
|
330
|
+
['1.2.0', 'preminor', '1.3.0-0'],
|
331
|
+
['1.2.0', 'premajor', '2.0.0-0'],
|
332
|
+
['1.2.0', 'preminor', '1.3.0-0'],
|
333
|
+
['1.2.0', 'premajor', '2.0.0-0']
|
334
|
+
|
335
|
+
|
336
|
+
].forEach(function(v) {
|
337
|
+
var pre = v[0];
|
338
|
+
var what = v[1];
|
339
|
+
var wanted = v[2];
|
340
|
+
var loose = v[3];
|
341
|
+
var found = inc(pre, what, loose);
|
342
|
+
t.equal(found, wanted, 'inc(' + pre + ', ' + what + ') === ' + wanted);
|
343
|
+
});
|
344
|
+
|
345
|
+
t.end();
|
346
|
+
});
|
347
|
+
|
348
|
+
test('\nvalid range test', function(t) {
|
349
|
+
// [range, result]
|
350
|
+
// validRange(range) -> result
|
351
|
+
// translate ranges into their canonical form
|
352
|
+
[['1.0.0 - 2.0.0', '>=1.0.0 <=2.0.0'],
|
353
|
+
['1.0.0', '1.0.0'],
|
354
|
+
['>=*', '>=0.0.0-0'],
|
355
|
+
['', '*'],
|
356
|
+
['*', '*'],
|
357
|
+
['*', '*'],
|
358
|
+
['>=1.0.0', '>=1.0.0'],
|
359
|
+
['>1.0.0', '>1.0.0'],
|
360
|
+
['<=2.0.0', '<=2.0.0'],
|
361
|
+
['1', '>=1.0.0-0 <2.0.0-0'],
|
362
|
+
['<=2.0.0', '<=2.0.0'],
|
363
|
+
['<=2.0.0', '<=2.0.0'],
|
364
|
+
['<2.0.0', '<2.0.0-0'],
|
365
|
+
['<2.0.0', '<2.0.0-0'],
|
366
|
+
['>= 1.0.0', '>=1.0.0'],
|
367
|
+
['>= 1.0.0', '>=1.0.0'],
|
368
|
+
['>= 1.0.0', '>=1.0.0'],
|
369
|
+
['> 1.0.0', '>1.0.0'],
|
370
|
+
['> 1.0.0', '>1.0.0'],
|
371
|
+
['<= 2.0.0', '<=2.0.0'],
|
372
|
+
['<= 2.0.0', '<=2.0.0'],
|
373
|
+
['<= 2.0.0', '<=2.0.0'],
|
374
|
+
['< 2.0.0', '<2.0.0-0'],
|
375
|
+
['< 2.0.0', '<2.0.0-0'],
|
376
|
+
['>=0.1.97', '>=0.1.97'],
|
377
|
+
['>=0.1.97', '>=0.1.97'],
|
378
|
+
['0.1.20 || 1.2.4', '0.1.20||1.2.4'],
|
379
|
+
['>=0.2.3 || <0.0.1', '>=0.2.3||<0.0.1-0'],
|
380
|
+
['>=0.2.3 || <0.0.1', '>=0.2.3||<0.0.1-0'],
|
381
|
+
['>=0.2.3 || <0.0.1', '>=0.2.3||<0.0.1-0'],
|
382
|
+
['||', '||'],
|
383
|
+
['2.x.x', '>=2.0.0-0 <3.0.0-0'],
|
384
|
+
['1.2.x', '>=1.2.0-0 <1.3.0-0'],
|
385
|
+
['1.2.x || 2.x', '>=1.2.0-0 <1.3.0-0||>=2.0.0-0 <3.0.0-0'],
|
386
|
+
['1.2.x || 2.x', '>=1.2.0-0 <1.3.0-0||>=2.0.0-0 <3.0.0-0'],
|
387
|
+
['x', '*'],
|
388
|
+
['2.*.*', '>=2.0.0-0 <3.0.0-0'],
|
389
|
+
['1.2.*', '>=1.2.0-0 <1.3.0-0'],
|
390
|
+
['1.2.* || 2.*', '>=1.2.0-0 <1.3.0-0||>=2.0.0-0 <3.0.0-0'],
|
391
|
+
['*', '*'],
|
392
|
+
['2', '>=2.0.0-0 <3.0.0-0'],
|
393
|
+
['2.3', '>=2.3.0-0 <2.4.0-0'],
|
394
|
+
['~2.4', '>=2.4.0-0 <2.5.0-0'],
|
395
|
+
['~2.4', '>=2.4.0-0 <2.5.0-0'],
|
396
|
+
['~>3.2.1', '>=3.2.1-0 <3.3.0-0'],
|
397
|
+
['~1', '>=1.0.0-0 <2.0.0-0'],
|
398
|
+
['~>1', '>=1.0.0-0 <2.0.0-0'],
|
399
|
+
['~> 1', '>=1.0.0-0 <2.0.0-0'],
|
400
|
+
['~1.0', '>=1.0.0-0 <1.1.0-0'],
|
401
|
+
['~ 1.0', '>=1.0.0-0 <1.1.0-0'],
|
402
|
+
['^0', '>=0.0.0-0 <1.0.0-0'],
|
403
|
+
['^ 1', '>=1.0.0-0 <2.0.0-0'],
|
404
|
+
['^0.1', '>=0.1.0-0 <0.2.0-0'],
|
405
|
+
['^1.0', '>=1.0.0-0 <2.0.0-0'],
|
406
|
+
['^1.2', '>=1.2.0-0 <2.0.0-0'],
|
407
|
+
['^0.0.1', '=0.0.1'],
|
408
|
+
['^0.0.1-beta', '=0.0.1-beta'],
|
409
|
+
['^0.1.2', '>=0.1.2-0 <0.2.0-0'],
|
410
|
+
['^1.2.3', '>=1.2.3-0 <2.0.0-0'],
|
411
|
+
['^1.2.3-beta.4', '>=1.2.3-beta.4 <2.0.0-0'],
|
412
|
+
['<1', '<1.0.0-0'],
|
413
|
+
['< 1', '<1.0.0-0'],
|
414
|
+
['>=1', '>=1.0.0-0'],
|
415
|
+
['>= 1', '>=1.0.0-0'],
|
416
|
+
['<1.2', '<1.2.0-0'],
|
417
|
+
['< 1.2', '<1.2.0-0'],
|
418
|
+
['1', '>=1.0.0-0 <2.0.0-0'],
|
419
|
+
['>01.02.03', '>1.2.3', true],
|
420
|
+
['>01.02.03', null],
|
421
|
+
['~1.2.3beta', '>=1.2.3-beta <1.3.0-0', true],
|
422
|
+
['~1.2.3beta', null],
|
423
|
+
['^ 1.2 ^ 1', '>=1.2.0-0 <2.0.0-0 >=1.0.0-0 <2.0.0-0']
|
424
|
+
].forEach(function(v) {
|
425
|
+
var pre = v[0];
|
426
|
+
var wanted = v[1];
|
427
|
+
var loose = v[2];
|
428
|
+
var found = validRange(pre, loose);
|
429
|
+
|
430
|
+
t.equal(found, wanted, 'validRange(' + pre + ') === ' + wanted);
|
431
|
+
});
|
432
|
+
|
433
|
+
t.end();
|
434
|
+
});
|
435
|
+
|
436
|
+
test('\ncomparators test', function(t) {
|
437
|
+
// [range, comparators]
|
438
|
+
// turn range into a set of individual comparators
|
439
|
+
[['1.0.0 - 2.0.0', [['>=1.0.0', '<=2.0.0']]],
|
440
|
+
['1.0.0', [['1.0.0']]],
|
441
|
+
['>=*', [['>=0.0.0-0']]],
|
442
|
+
['', [['']]],
|
443
|
+
['*', [['']]],
|
444
|
+
['*', [['']]],
|
445
|
+
['>=1.0.0', [['>=1.0.0']]],
|
446
|
+
['>=1.0.0', [['>=1.0.0']]],
|
447
|
+
['>=1.0.0', [['>=1.0.0']]],
|
448
|
+
['>1.0.0', [['>1.0.0']]],
|
449
|
+
['>1.0.0', [['>1.0.0']]],
|
450
|
+
['<=2.0.0', [['<=2.0.0']]],
|
451
|
+
['1', [['>=1.0.0-0', '<2.0.0-0']]],
|
452
|
+
['<=2.0.0', [['<=2.0.0']]],
|
453
|
+
['<=2.0.0', [['<=2.0.0']]],
|
454
|
+
['<2.0.0', [['<2.0.0-0']]],
|
455
|
+
['<2.0.0', [['<2.0.0-0']]],
|
456
|
+
['>= 1.0.0', [['>=1.0.0']]],
|
457
|
+
['>= 1.0.0', [['>=1.0.0']]],
|
458
|
+
['>= 1.0.0', [['>=1.0.0']]],
|
459
|
+
['> 1.0.0', [['>1.0.0']]],
|
460
|
+
['> 1.0.0', [['>1.0.0']]],
|
461
|
+
['<= 2.0.0', [['<=2.0.0']]],
|
462
|
+
['<= 2.0.0', [['<=2.0.0']]],
|
463
|
+
['<= 2.0.0', [['<=2.0.0']]],
|
464
|
+
['< 2.0.0', [['<2.0.0-0']]],
|
465
|
+
['<\t2.0.0', [['<2.0.0-0']]],
|
466
|
+
['>=0.1.97', [['>=0.1.97']]],
|
467
|
+
['>=0.1.97', [['>=0.1.97']]],
|
468
|
+
['0.1.20 || 1.2.4', [['0.1.20'], ['1.2.4']]],
|
469
|
+
['>=0.2.3 || <0.0.1', [['>=0.2.3'], ['<0.0.1-0']]],
|
470
|
+
['>=0.2.3 || <0.0.1', [['>=0.2.3'], ['<0.0.1-0']]],
|
471
|
+
['>=0.2.3 || <0.0.1', [['>=0.2.3'], ['<0.0.1-0']]],
|
472
|
+
['||', [[''], ['']]],
|
473
|
+
['2.x.x', [['>=2.0.0-0', '<3.0.0-0']]],
|
474
|
+
['1.2.x', [['>=1.2.0-0', '<1.3.0-0']]],
|
475
|
+
['1.2.x || 2.x', [['>=1.2.0-0', '<1.3.0-0'], ['>=2.0.0-0', '<3.0.0-0']]],
|
476
|
+
['1.2.x || 2.x', [['>=1.2.0-0', '<1.3.0-0'], ['>=2.0.0-0', '<3.0.0-0']]],
|
477
|
+
['x', [['']]],
|
478
|
+
['2.*.*', [['>=2.0.0-0', '<3.0.0-0']]],
|
479
|
+
['1.2.*', [['>=1.2.0-0', '<1.3.0-0']]],
|
480
|
+
['1.2.* || 2.*', [['>=1.2.0-0', '<1.3.0-0'], ['>=2.0.0-0', '<3.0.0-0']]],
|
481
|
+
['1.2.* || 2.*', [['>=1.2.0-0', '<1.3.0-0'], ['>=2.0.0-0', '<3.0.0-0']]],
|
482
|
+
['*', [['']]],
|
483
|
+
['2', [['>=2.0.0-0', '<3.0.0-0']]],
|
484
|
+
['2.3', [['>=2.3.0-0', '<2.4.0-0']]],
|
485
|
+
['~2.4', [['>=2.4.0-0', '<2.5.0-0']]],
|
486
|
+
['~2.4', [['>=2.4.0-0', '<2.5.0-0']]],
|
487
|
+
['~>3.2.1', [['>=3.2.1-0', '<3.3.0-0']]],
|
488
|
+
['~1', [['>=1.0.0-0', '<2.0.0-0']]],
|
489
|
+
['~>1', [['>=1.0.0-0', '<2.0.0-0']]],
|
490
|
+
['~> 1', [['>=1.0.0-0', '<2.0.0-0']]],
|
491
|
+
['~1.0', [['>=1.0.0-0', '<1.1.0-0']]],
|
492
|
+
['~ 1.0', [['>=1.0.0-0', '<1.1.0-0']]],
|
493
|
+
['~ 1.0.3', [['>=1.0.3-0', '<1.1.0-0']]],
|
494
|
+
['~> 1.0.3', [['>=1.0.3-0', '<1.1.0-0']]],
|
495
|
+
['<1', [['<1.0.0-0']]],
|
496
|
+
['< 1', [['<1.0.0-0']]],
|
497
|
+
['>=1', [['>=1.0.0-0']]],
|
498
|
+
['>= 1', [['>=1.0.0-0']]],
|
499
|
+
['<1.2', [['<1.2.0-0']]],
|
500
|
+
['< 1.2', [['<1.2.0-0']]],
|
501
|
+
['1', [['>=1.0.0-0', '<2.0.0-0']]],
|
502
|
+
['1 2', [['>=1.0.0-0', '<2.0.0-0', '>=2.0.0-0', '<3.0.0-0']]],
|
503
|
+
['1.2 - 3.4.5', [['>=1.2.0-0', '<=3.4.5']]],
|
504
|
+
['1.2.3 - 3.4', [['>=1.2.3', '<3.5.0-0']]]
|
505
|
+
].forEach(function(v) {
|
506
|
+
var pre = v[0];
|
507
|
+
var wanted = v[1];
|
508
|
+
var found = toComparators(v[0]);
|
509
|
+
var jw = JSON.stringify(wanted);
|
510
|
+
t.equivalent(found, wanted, 'toComparators(' + pre + ') === ' + jw);
|
511
|
+
});
|
512
|
+
|
513
|
+
t.end();
|
514
|
+
});
|
515
|
+
|
516
|
+
test('\ninvalid version numbers', function(t) {
|
517
|
+
['1.2.3.4',
|
518
|
+
'NOT VALID',
|
519
|
+
1.2,
|
520
|
+
null,
|
521
|
+
'Infinity.NaN.Infinity'
|
522
|
+
].forEach(function(v) {
|
523
|
+
t.throws(function() {
|
524
|
+
new SemVer(v);
|
525
|
+
}, {name:'TypeError', message:'Invalid Version: ' + v});
|
526
|
+
});
|
527
|
+
|
528
|
+
t.end();
|
529
|
+
});
|
530
|
+
|
531
|
+
test('\nstrict vs loose version numbers', function(t) {
|
532
|
+
[['=1.2.3', '1.2.3'],
|
533
|
+
['01.02.03', '1.2.3'],
|
534
|
+
['1.2.3-beta.01', '1.2.3-beta.1'],
|
535
|
+
[' =1.2.3', '1.2.3'],
|
536
|
+
['1.2.3foo', '1.2.3-foo']
|
537
|
+
].forEach(function(v) {
|
538
|
+
var loose = v[0];
|
539
|
+
var strict = v[1];
|
540
|
+
t.throws(function() {
|
541
|
+
new SemVer(loose);
|
542
|
+
});
|
543
|
+
var lv = new SemVer(loose, true);
|
544
|
+
t.equal(lv.version, strict);
|
545
|
+
t.ok(eq(loose, strict, true));
|
546
|
+
t.throws(function() {
|
547
|
+
eq(loose, strict);
|
548
|
+
});
|
549
|
+
t.throws(function() {
|
550
|
+
new SemVer(strict).compare(loose);
|
551
|
+
});
|
552
|
+
});
|
553
|
+
t.end();
|
554
|
+
});
|
555
|
+
|
556
|
+
test('\nstrict vs loose ranges', function(t) {
|
557
|
+
[['>=01.02.03', '>=1.2.3'],
|
558
|
+
['~1.02.03beta', '>=1.2.3-beta <1.3.0-0']
|
559
|
+
].forEach(function(v) {
|
560
|
+
var loose = v[0];
|
561
|
+
var comps = v[1];
|
562
|
+
t.throws(function() {
|
563
|
+
new Range(loose);
|
564
|
+
});
|
565
|
+
t.equal(new Range(loose, true).range, comps);
|
566
|
+
});
|
567
|
+
t.end();
|
568
|
+
});
|
569
|
+
|
570
|
+
test('\nmax satisfying', function(t) {
|
571
|
+
[[['1.2.3', '1.2.4'], '1.2', '1.2.4'],
|
572
|
+
[['1.2.4', '1.2.3'], '1.2', '1.2.4'],
|
573
|
+
[['1.2.3', '1.2.4', '1.2.5', '1.2.6'], '~1.2.3', '1.2.6'],
|
574
|
+
[['1.1.0', '1.2.0', '1.2.1', '1.3.0', '2.0.0b1', '2.0.0b2', '2.0.0b3', '2.0.0', '2.1.0'], '~2.0.0', '2.0.0', true]
|
575
|
+
].forEach(function(v) {
|
576
|
+
var versions = v[0];
|
577
|
+
var range = v[1];
|
578
|
+
var expect = v[2];
|
579
|
+
var loose = v[3];
|
580
|
+
var actual = semver.maxSatisfying(versions, range, loose);
|
581
|
+
t.equal(actual, expect);
|
582
|
+
});
|
583
|
+
t.end();
|
584
|
+
});
|