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
|
+
# nada
|
@@ -0,0 +1,27 @@
|
|
1
|
+
Copyright (c) Isaac Z. Schlueter ("Author")
|
2
|
+
All rights reserved.
|
3
|
+
|
4
|
+
The BSD License
|
5
|
+
|
6
|
+
Redistribution and use in source and binary forms, with or without
|
7
|
+
modification, are permitted provided that the following conditions
|
8
|
+
are met:
|
9
|
+
|
10
|
+
1. Redistributions of source code must retain the above copyright
|
11
|
+
notice, this list of conditions and the following disclaimer.
|
12
|
+
|
13
|
+
2. Redistributions in binary form must reproduce the above copyright
|
14
|
+
notice, this list of conditions and the following disclaimer in the
|
15
|
+
documentation and/or other materials provided with the distribution.
|
16
|
+
|
17
|
+
THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
18
|
+
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
19
|
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
20
|
+
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS
|
21
|
+
BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
22
|
+
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
23
|
+
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
|
24
|
+
BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
25
|
+
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
26
|
+
OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
|
27
|
+
IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
@@ -0,0 +1,24 @@
|
|
1
|
+
files = semver.browser.js \
|
2
|
+
semver.min.js \
|
3
|
+
semver.browser.js.gz \
|
4
|
+
semver.min.js.gz
|
5
|
+
|
6
|
+
all: $(files)
|
7
|
+
|
8
|
+
clean:
|
9
|
+
rm -f $(files)
|
10
|
+
|
11
|
+
semver.browser.js: head.js semver.js foot.js
|
12
|
+
( cat head.js; \
|
13
|
+
cat semver.js | \
|
14
|
+
egrep -v '^ *\/\* nomin \*\/' | \
|
15
|
+
perl -pi -e 's/debug\([^\)]+\)//g'; \
|
16
|
+
cat foot.js ) > semver.browser.js
|
17
|
+
|
18
|
+
semver.min.js: semver.browser.js
|
19
|
+
uglifyjs -m <semver.browser.js >semver.min.js
|
20
|
+
|
21
|
+
%.gz: %
|
22
|
+
gzip --stdout -9 <$< >$@
|
23
|
+
|
24
|
+
.PHONY: all clean
|
@@ -0,0 +1,158 @@
|
|
1
|
+
semver(1) -- The semantic versioner for npm
|
2
|
+
===========================================
|
3
|
+
|
4
|
+
## Usage
|
5
|
+
|
6
|
+
$ npm install semver
|
7
|
+
|
8
|
+
semver.valid('1.2.3') // '1.2.3'
|
9
|
+
semver.valid('a.b.c') // null
|
10
|
+
semver.clean(' =v1.2.3 ') // '1.2.3'
|
11
|
+
semver.satisfies('1.2.3', '1.x || >=2.5.0 || 5.0.0 - 7.2.3') // true
|
12
|
+
semver.gt('1.2.3', '9.8.7') // false
|
13
|
+
semver.lt('1.2.3', '9.8.7') // true
|
14
|
+
|
15
|
+
As a command-line utility:
|
16
|
+
|
17
|
+
$ semver -h
|
18
|
+
|
19
|
+
Usage: semver <version> [<version> [...]] [-r <range> | -i <inc> | -d <dec>]
|
20
|
+
Test if version(s) satisfy the supplied range(s), and sort them.
|
21
|
+
|
22
|
+
Multiple versions or ranges may be supplied, unless increment
|
23
|
+
or decrement options are specified. In that case, only a single
|
24
|
+
version may be used, and it is incremented by the specified level
|
25
|
+
|
26
|
+
Program exits successfully if any valid version satisfies
|
27
|
+
all supplied ranges, and prints all satisfying versions.
|
28
|
+
|
29
|
+
If no versions are valid, or ranges are not satisfied,
|
30
|
+
then exits failure.
|
31
|
+
|
32
|
+
Versions are printed in ascending order, so supplying
|
33
|
+
multiple versions to the utility will just sort them.
|
34
|
+
|
35
|
+
## Versions
|
36
|
+
|
37
|
+
A "version" is described by the `v2.0.0` specification found at
|
38
|
+
<http://semver.org/>.
|
39
|
+
|
40
|
+
A leading `"="` or `"v"` character is stripped off and ignored.
|
41
|
+
|
42
|
+
## Ranges
|
43
|
+
|
44
|
+
The following range styles are supported:
|
45
|
+
|
46
|
+
* `1.2.3` A specific version. When nothing else will do. Must be a full
|
47
|
+
version number, with major, minor, and patch versions specified.
|
48
|
+
Note that build metadata is still ignored, so `1.2.3+build2012` will
|
49
|
+
satisfy this range.
|
50
|
+
* `>1.2.3` Greater than a specific version.
|
51
|
+
* `<1.2.3` Less than a specific version. If there is no prerelease
|
52
|
+
tag on the version range, then no prerelease version will be allowed
|
53
|
+
either, even though these are technically "less than".
|
54
|
+
* `>=1.2.3` Greater than or equal to. Note that prerelease versions
|
55
|
+
are NOT equal to their "normal" equivalents, so `1.2.3-beta` will
|
56
|
+
not satisfy this range, but `2.3.0-beta` will.
|
57
|
+
* `<=1.2.3` Less than or equal to. In this case, prerelease versions
|
58
|
+
ARE allowed, so `1.2.3-beta` would satisfy.
|
59
|
+
* `1.2.3 - 2.3.4` := `>=1.2.3 <=2.3.4`
|
60
|
+
* `~1.2.3` := `>=1.2.3-0 <1.3.0-0` "Reasonably close to `1.2.3`". When
|
61
|
+
using tilde operators, prerelease versions are supported as well,
|
62
|
+
but a prerelease of the next significant digit will NOT be
|
63
|
+
satisfactory, so `1.3.0-beta` will not satisfy `~1.2.3`.
|
64
|
+
* `^1.2.3` := `>=1.2.3-0 <2.0.0-0` "Compatible with `1.2.3`". When
|
65
|
+
using caret operators, anything from the specified version (including
|
66
|
+
prerelease) will be supported up to, but not including, the next
|
67
|
+
major version (or its prereleases). `1.5.1` will satisfy `^1.2.3`,
|
68
|
+
while `1.2.2` and `2.0.0-beta` will not.
|
69
|
+
* `^0.1.3` := `>=0.1.3-0 <0.2.0-0` "Compatible with `0.1.3`". `0.x.x` versions are
|
70
|
+
special: the first non-zero component indicates potentially breaking changes,
|
71
|
+
meaning the caret operator matches any version with the same first non-zero
|
72
|
+
component starting at the specified version.
|
73
|
+
* `^0.0.2` := `=0.0.2` "Only the version `0.0.2` is considered compatible"
|
74
|
+
* `~1.2` := `>=1.2.0-0 <1.3.0-0` "Any version starting with `1.2`"
|
75
|
+
* `^1.2` := `>=1.2.0-0 <2.0.0-0` "Any version compatible with `1.2`"
|
76
|
+
* `1.2.x` := `>=1.2.0-0 <1.3.0-0` "Any version starting with `1.2`"
|
77
|
+
* `1.2.*` Same as `1.2.x`.
|
78
|
+
* `1.2` Same as `1.2.x`.
|
79
|
+
* `~1` := `>=1.0.0-0 <2.0.0-0` "Any version starting with `1`"
|
80
|
+
* `^1` := `>=1.0.0-0 <2.0.0-0` "Any version compatible with `1`"
|
81
|
+
* `1.x` := `>=1.0.0-0 <2.0.0-0` "Any version starting with `1`"
|
82
|
+
* `1.*` Same as `1.x`.
|
83
|
+
* `1` Same as `1.x`.
|
84
|
+
* `*` Any version whatsoever.
|
85
|
+
* `x` Same as `*`.
|
86
|
+
* `""` (just an empty string) Same as `*`.
|
87
|
+
|
88
|
+
|
89
|
+
Ranges can be joined with either a space (which implies "and") or a
|
90
|
+
`||` (which implies "or").
|
91
|
+
|
92
|
+
## Functions
|
93
|
+
|
94
|
+
All methods and classes take a final `loose` boolean argument that, if
|
95
|
+
true, will be more forgiving about not-quite-valid semver strings.
|
96
|
+
The resulting output will always be 100% strict, of course.
|
97
|
+
|
98
|
+
Strict-mode Comparators and Ranges will be strict about the SemVer
|
99
|
+
strings that they parse.
|
100
|
+
|
101
|
+
* `valid(v)`: Return the parsed version, or null if it's not valid.
|
102
|
+
* `inc(v, release)`: Return the version incremented by the release
|
103
|
+
type (`major`, `premajor`, `minor`, `preminor`, `patch`,
|
104
|
+
`prepatch`, or `prerelease`), or null if it's not valid
|
105
|
+
* `premajor` in one call will bump the version up to the next major
|
106
|
+
version and down to a prerelease of that major version.
|
107
|
+
`preminor`, and `prepatch` work the same way.
|
108
|
+
* If called from a non-prerelease version, the `prerelease` will work the
|
109
|
+
same as `prepatch`. It increments the patch version, then makes a
|
110
|
+
prerelease. If the input version is already a prerelease it simply
|
111
|
+
increments it.
|
112
|
+
|
113
|
+
### Comparison
|
114
|
+
|
115
|
+
* `gt(v1, v2)`: `v1 > v2`
|
116
|
+
* `gte(v1, v2)`: `v1 >= v2`
|
117
|
+
* `lt(v1, v2)`: `v1 < v2`
|
118
|
+
* `lte(v1, v2)`: `v1 <= v2`
|
119
|
+
* `eq(v1, v2)`: `v1 == v2` This is true if they're logically equivalent,
|
120
|
+
even if they're not the exact same string. You already know how to
|
121
|
+
compare strings.
|
122
|
+
* `neq(v1, v2)`: `v1 != v2` The opposite of `eq`.
|
123
|
+
* `cmp(v1, comparator, v2)`: Pass in a comparison string, and it'll call
|
124
|
+
the corresponding function above. `"==="` and `"!=="` do simple
|
125
|
+
string comparison, but are included for completeness. Throws if an
|
126
|
+
invalid comparison string is provided.
|
127
|
+
* `compare(v1, v2)`: Return `0` if `v1 == v2`, or `1` if `v1` is greater, or `-1` if
|
128
|
+
`v2` is greater. Sorts in ascending order if passed to `Array.sort()`.
|
129
|
+
* `rcompare(v1, v2)`: The reverse of compare. Sorts an array of versions
|
130
|
+
in descending order when passed to `Array.sort()`.
|
131
|
+
|
132
|
+
|
133
|
+
### Ranges
|
134
|
+
|
135
|
+
* `validRange(range)`: Return the valid range or null if it's not valid
|
136
|
+
* `satisfies(version, range)`: Return true if the version satisfies the
|
137
|
+
range.
|
138
|
+
* `maxSatisfying(versions, range)`: Return the highest version in the list
|
139
|
+
that satisfies the range, or `null` if none of them do.
|
140
|
+
* `gtr(version, range)`: Return `true` if version is greater than all the
|
141
|
+
versions possible in the range.
|
142
|
+
* `ltr(version, range)`: Return `true` if version is less than all the
|
143
|
+
versions possible in the range.
|
144
|
+
* `outside(version, range, hilo)`: Return true if the version is outside
|
145
|
+
the bounds of the range in either the high or low direction. The
|
146
|
+
`hilo` argument must be either the string `'>'` or `'<'`. (This is
|
147
|
+
the function called by `gtr` and `ltr`.)
|
148
|
+
|
149
|
+
Note that, since ranges may be non-contiguous, a version might not be
|
150
|
+
greater than a range, less than a range, *or* satisfy a range! For
|
151
|
+
example, the range `1.2 <1.2.9 || >2.0.0` would have a hole from `1.2.9`
|
152
|
+
until `2.0.0`, so the version `1.2.10` would not be greater than the
|
153
|
+
range (because `2.0.1` satisfies, which is higher), nor less than the
|
154
|
+
range (since `1.2.8` satisfies, which is lower), and it also does not
|
155
|
+
satisfy the range.
|
156
|
+
|
157
|
+
If you want to know if a version satisfies or does not satisfy a
|
158
|
+
range, use the `satisfies(version, range)` function.
|
@@ -0,0 +1,125 @@
|
|
1
|
+
#!/usr/bin/env node
|
2
|
+
// Standalone semver comparison program.
|
3
|
+
// Exits successfully and prints matching version(s) if
|
4
|
+
// any supplied version is valid and passes all tests.
|
5
|
+
|
6
|
+
var argv = process.argv.slice(2)
|
7
|
+
, versions = []
|
8
|
+
, range = []
|
9
|
+
, gt = []
|
10
|
+
, lt = []
|
11
|
+
, eq = []
|
12
|
+
, inc = null
|
13
|
+
, version = require("../package.json").version
|
14
|
+
, loose = false
|
15
|
+
, semver = require("../semver")
|
16
|
+
, reverse = false
|
17
|
+
|
18
|
+
main()
|
19
|
+
|
20
|
+
function main () {
|
21
|
+
if (!argv.length) return help()
|
22
|
+
while (argv.length) {
|
23
|
+
var a = argv.shift()
|
24
|
+
var i = a.indexOf('=')
|
25
|
+
if (i !== -1) {
|
26
|
+
a = a.slice(0, i)
|
27
|
+
argv.unshift(a.slice(i + 1))
|
28
|
+
}
|
29
|
+
switch (a) {
|
30
|
+
case "-rv": case "-rev": case "--rev": case "--reverse":
|
31
|
+
reverse = true
|
32
|
+
break
|
33
|
+
case "-l": case "--loose":
|
34
|
+
loose = true
|
35
|
+
break
|
36
|
+
case "-v": case "--version":
|
37
|
+
versions.push(argv.shift())
|
38
|
+
break
|
39
|
+
case "-i": case "--inc": case "--increment":
|
40
|
+
switch (argv[0]) {
|
41
|
+
case "major": case "minor": case "patch": case "prerelease":
|
42
|
+
case "premajor": case "preminor": case "prepatch":
|
43
|
+
inc = argv.shift()
|
44
|
+
break
|
45
|
+
default:
|
46
|
+
inc = "patch"
|
47
|
+
break
|
48
|
+
}
|
49
|
+
break
|
50
|
+
case "-r": case "--range":
|
51
|
+
range.push(argv.shift())
|
52
|
+
break
|
53
|
+
case "-h": case "--help": case "-?":
|
54
|
+
return help()
|
55
|
+
default:
|
56
|
+
versions.push(a)
|
57
|
+
break
|
58
|
+
}
|
59
|
+
}
|
60
|
+
|
61
|
+
versions = versions.filter(function (v) {
|
62
|
+
return semver.valid(v, loose)
|
63
|
+
})
|
64
|
+
if (!versions.length) return fail()
|
65
|
+
if (inc && (versions.length !== 1 || range.length))
|
66
|
+
return failInc()
|
67
|
+
|
68
|
+
for (var i = 0, l = range.length; i < l ; i ++) {
|
69
|
+
versions = versions.filter(function (v) {
|
70
|
+
return semver.satisfies(v, range[i], loose)
|
71
|
+
})
|
72
|
+
if (!versions.length) return fail()
|
73
|
+
}
|
74
|
+
return success(versions)
|
75
|
+
}
|
76
|
+
|
77
|
+
function failInc () {
|
78
|
+
console.error("--inc can only be used on a single version with no range")
|
79
|
+
fail()
|
80
|
+
}
|
81
|
+
|
82
|
+
function fail () { process.exit(1) }
|
83
|
+
|
84
|
+
function success () {
|
85
|
+
var compare = reverse ? "rcompare" : "compare"
|
86
|
+
versions.sort(function (a, b) {
|
87
|
+
return semver[compare](a, b, loose)
|
88
|
+
}).map(function (v) {
|
89
|
+
return semver.clean(v, loose)
|
90
|
+
}).map(function (v) {
|
91
|
+
return inc ? semver.inc(v, inc, loose) : v
|
92
|
+
}).forEach(function (v,i,_) { console.log(v) })
|
93
|
+
}
|
94
|
+
|
95
|
+
function help () {
|
96
|
+
console.log(["SemVer " + version
|
97
|
+
,""
|
98
|
+
,"A JavaScript implementation of the http://semver.org/ specification"
|
99
|
+
,"Copyright Isaac Z. Schlueter"
|
100
|
+
,""
|
101
|
+
,"Usage: semver [options] <version> [<version> [...]]"
|
102
|
+
,"Prints valid versions sorted by SemVer precedence"
|
103
|
+
,""
|
104
|
+
,"Options:"
|
105
|
+
,"-r --range <range>"
|
106
|
+
," Print versions that match the specified range."
|
107
|
+
,""
|
108
|
+
,"-i --increment [<level>]"
|
109
|
+
," Increment a version by the specified level. Level can"
|
110
|
+
," be one of: major, minor, patch, or prerelease"
|
111
|
+
," Default level is 'patch'."
|
112
|
+
," Only one version may be specified."
|
113
|
+
,""
|
114
|
+
,"-l --loose"
|
115
|
+
," Interpret versions and ranges loosely"
|
116
|
+
,""
|
117
|
+
,"Program exits successfully if any valid version satisfies"
|
118
|
+
,"all supplied ranges, and prints all satisfying versions."
|
119
|
+
,""
|
120
|
+
,"If no satisfying versions are found, then exits failure."
|
121
|
+
,""
|
122
|
+
,"Versions are printed in ascending order, so supplying"
|
123
|
+
,"multiple versions to the utility will just sort them."
|
124
|
+
].join("\n"))
|
125
|
+
}
|
@@ -0,0 +1,31 @@
|
|
1
|
+
{
|
2
|
+
"name": "semver",
|
3
|
+
"version": "2.3.0",
|
4
|
+
"description": "The semantic version parser used by npm.",
|
5
|
+
"main": "semver.js",
|
6
|
+
"browser": "semver.browser.js",
|
7
|
+
"min": "semver.min.js",
|
8
|
+
"scripts": {
|
9
|
+
"test": "tap test/*.js",
|
10
|
+
"prepublish": "make"
|
11
|
+
},
|
12
|
+
"devDependencies": {
|
13
|
+
"tap": "0.x >=0.0.4",
|
14
|
+
"uglify-js": "~2.3.6"
|
15
|
+
},
|
16
|
+
"license": "BSD",
|
17
|
+
"repository": {
|
18
|
+
"type": "git",
|
19
|
+
"url": "git://github.com/isaacs/node-semver.git"
|
20
|
+
},
|
21
|
+
"bin": {
|
22
|
+
"semver": "./bin/semver"
|
23
|
+
},
|
24
|
+
"readme": "semver(1) -- The semantic versioner for npm\n===========================================\n\n## Usage\n\n $ npm install semver\n\n semver.valid('1.2.3') // '1.2.3'\n semver.valid('a.b.c') // null\n semver.clean(' =v1.2.3 ') // '1.2.3'\n semver.satisfies('1.2.3', '1.x || >=2.5.0 || 5.0.0 - 7.2.3') // true\n semver.gt('1.2.3', '9.8.7') // false\n semver.lt('1.2.3', '9.8.7') // true\n\nAs a command-line utility:\n\n $ semver -h\n\n Usage: semver <version> [<version> [...]] [-r <range> | -i <inc> | -d <dec>]\n Test if version(s) satisfy the supplied range(s), and sort them.\n\n Multiple versions or ranges may be supplied, unless increment\n or decrement options are specified. In that case, only a single\n version may be used, and it is incremented by the specified level\n\n Program exits successfully if any valid version satisfies\n all supplied ranges, and prints all satisfying versions.\n\n If no versions are valid, or ranges are not satisfied,\n then exits failure.\n\n Versions are printed in ascending order, so supplying\n multiple versions to the utility will just sort them.\n\n## Versions\n\nA \"version\" is described by the `v2.0.0` specification found at\n<http://semver.org/>.\n\nA leading `\"=\"` or `\"v\"` character is stripped off and ignored.\n\n## Ranges\n\nThe following range styles are supported:\n\n* `1.2.3` A specific version. When nothing else will do. Must be a full\n version number, with major, minor, and patch versions specified.\n Note that build metadata is still ignored, so `1.2.3+build2012` will\n satisfy this range.\n* `>1.2.3` Greater than a specific version.\n* `<1.2.3` Less than a specific version. If there is no prerelease\n tag on the version range, then no prerelease version will be allowed\n either, even though these are technically \"less than\".\n* `>=1.2.3` Greater than or equal to. Note that prerelease versions\n are NOT equal to their \"normal\" equivalents, so `1.2.3-beta` will\n not satisfy this range, but `2.3.0-beta` will.\n* `<=1.2.3` Less than or equal to. In this case, prerelease versions\n ARE allowed, so `1.2.3-beta` would satisfy.\n* `1.2.3 - 2.3.4` := `>=1.2.3 <=2.3.4`\n* `~1.2.3` := `>=1.2.3-0 <1.3.0-0` \"Reasonably close to `1.2.3`\". When\n using tilde operators, prerelease versions are supported as well,\n but a prerelease of the next significant digit will NOT be\n satisfactory, so `1.3.0-beta` will not satisfy `~1.2.3`.\n* `^1.2.3` := `>=1.2.3-0 <2.0.0-0` \"Compatible with `1.2.3`\". When\n using caret operators, anything from the specified version (including\n prerelease) will be supported up to, but not including, the next\n major version (or its prereleases). `1.5.1` will satisfy `^1.2.3`,\n while `1.2.2` and `2.0.0-beta` will not.\n* `^0.1.3` := `>=0.1.3-0 <0.2.0-0` \"Compatible with `0.1.3`\". `0.x.x` versions are\n special: the first non-zero component indicates potentially breaking changes,\n meaning the caret operator matches any version with the same first non-zero\n component starting at the specified version.\n* `^0.0.2` := `=0.0.2` \"Only the version `0.0.2` is considered compatible\"\n* `~1.2` := `>=1.2.0-0 <1.3.0-0` \"Any version starting with `1.2`\"\n* `^1.2` := `>=1.2.0-0 <2.0.0-0` \"Any version compatible with `1.2`\"\n* `1.2.x` := `>=1.2.0-0 <1.3.0-0` \"Any version starting with `1.2`\"\n* `1.2.*` Same as `1.2.x`.\n* `1.2` Same as `1.2.x`.\n* `~1` := `>=1.0.0-0 <2.0.0-0` \"Any version starting with `1`\"\n* `^1` := `>=1.0.0-0 <2.0.0-0` \"Any version compatible with `1`\"\n* `1.x` := `>=1.0.0-0 <2.0.0-0` \"Any version starting with `1`\"\n* `1.*` Same as `1.x`.\n* `1` Same as `1.x`.\n* `*` Any version whatsoever.\n* `x` Same as `*`.\n* `\"\"` (just an empty string) Same as `*`.\n\n\nRanges can be joined with either a space (which implies \"and\") or a\n`||` (which implies \"or\").\n\n## Functions\n\nAll methods and classes take a final `loose` boolean argument that, if\ntrue, will be more forgiving about not-quite-valid semver strings.\nThe resulting output will always be 100% strict, of course.\n\nStrict-mode Comparators and Ranges will be strict about the SemVer\nstrings that they parse.\n\n* `valid(v)`: Return the parsed version, or null if it's not valid.\n* `inc(v, release)`: Return the version incremented by the release\n type (`major`, `premajor`, `minor`, `preminor`, `patch`,\n `prepatch`, or `prerelease`), or null if it's not valid\n * `premajor` in one call will bump the version up to the next major\n version and down to a prerelease of that major version.\n `preminor`, and `prepatch` work the same way.\n * If called from a non-prerelease version, the `prerelease` will work the\n same as `prepatch`. It increments the patch version, then makes a\n prerelease. If the input version is already a prerelease it simply\n increments it.\n\n### Comparison\n\n* `gt(v1, v2)`: `v1 > v2`\n* `gte(v1, v2)`: `v1 >= v2`\n* `lt(v1, v2)`: `v1 < v2`\n* `lte(v1, v2)`: `v1 <= v2`\n* `eq(v1, v2)`: `v1 == v2` This is true if they're logically equivalent,\n even if they're not the exact same string. You already know how to\n compare strings.\n* `neq(v1, v2)`: `v1 != v2` The opposite of `eq`.\n* `cmp(v1, comparator, v2)`: Pass in a comparison string, and it'll call\n the corresponding function above. `\"===\"` and `\"!==\"` do simple\n string comparison, but are included for completeness. Throws if an\n invalid comparison string is provided.\n* `compare(v1, v2)`: Return `0` if `v1 == v2`, or `1` if `v1` is greater, or `-1` if\n `v2` is greater. Sorts in ascending order if passed to `Array.sort()`.\n* `rcompare(v1, v2)`: The reverse of compare. Sorts an array of versions\n in descending order when passed to `Array.sort()`.\n\n\n### Ranges\n\n* `validRange(range)`: Return the valid range or null if it's not valid\n* `satisfies(version, range)`: Return true if the version satisfies the\n range.\n* `maxSatisfying(versions, range)`: Return the highest version in the list\n that satisfies the range, or `null` if none of them do.\n* `gtr(version, range)`: Return `true` if version is greater than all the\n versions possible in the range.\n* `ltr(version, range)`: Return `true` if version is less than all the\n versions possible in the range.\n* `outside(version, range, hilo)`: Return true if the version is outside\n the bounds of the range in either the high or low direction. The\n `hilo` argument must be either the string `'>'` or `'<'`. (This is\n the function called by `gtr` and `ltr`.)\n\nNote that, since ranges may be non-contiguous, a version might not be\ngreater than a range, less than a range, *or* satisfy a range! For\nexample, the range `1.2 <1.2.9 || >2.0.0` would have a hole from `1.2.9`\nuntil `2.0.0`, so the version `1.2.10` would not be greater than the\nrange (because `2.0.1` satisfies, which is higher), nor less than the\nrange (since `1.2.8` satisfies, which is lower), and it also does not\nsatisfy the range.\n\nIf you want to know if a version satisfies or does not satisfy a\nrange, use the `satisfies(version, range)` function.\n",
|
25
|
+
"readmeFilename": "README.md",
|
26
|
+
"bugs": {
|
27
|
+
"url": "https://github.com/isaacs/node-semver/issues"
|
28
|
+
},
|
29
|
+
"_id": "semver@2.3.0",
|
30
|
+
"_from": "semver@*"
|
31
|
+
}
|
@@ -0,0 +1,1039 @@
|
|
1
|
+
;(function(exports) {
|
2
|
+
|
3
|
+
// export the class if we are in a Node-like system.
|
4
|
+
if (typeof module === 'object' && module.exports === exports)
|
5
|
+
exports = module.exports = SemVer;
|
6
|
+
|
7
|
+
// The debug function is excluded entirely from the minified version.
|
8
|
+
|
9
|
+
// Note: this is the semver.org version of the spec that it implements
|
10
|
+
// Not necessarily the package version of this code.
|
11
|
+
exports.SEMVER_SPEC_VERSION = '2.0.0';
|
12
|
+
|
13
|
+
// The actual regexps go on exports.re
|
14
|
+
var re = exports.re = [];
|
15
|
+
var src = exports.src = [];
|
16
|
+
var R = 0;
|
17
|
+
|
18
|
+
// The following Regular Expressions can be used for tokenizing,
|
19
|
+
// validating, and parsing SemVer version strings.
|
20
|
+
|
21
|
+
// ## Numeric Identifier
|
22
|
+
// A single `0`, or a non-zero digit followed by zero or more digits.
|
23
|
+
|
24
|
+
var NUMERICIDENTIFIER = R++;
|
25
|
+
src[NUMERICIDENTIFIER] = '0|[1-9]\\d*';
|
26
|
+
var NUMERICIDENTIFIERLOOSE = R++;
|
27
|
+
src[NUMERICIDENTIFIERLOOSE] = '[0-9]+';
|
28
|
+
|
29
|
+
|
30
|
+
// ## Non-numeric Identifier
|
31
|
+
// Zero or more digits, followed by a letter or hyphen, and then zero or
|
32
|
+
// more letters, digits, or hyphens.
|
33
|
+
|
34
|
+
var NONNUMERICIDENTIFIER = R++;
|
35
|
+
src[NONNUMERICIDENTIFIER] = '\\d*[a-zA-Z-][a-zA-Z0-9-]*';
|
36
|
+
|
37
|
+
|
38
|
+
// ## Main Version
|
39
|
+
// Three dot-separated numeric identifiers.
|
40
|
+
|
41
|
+
var MAINVERSION = R++;
|
42
|
+
src[MAINVERSION] = '(' + src[NUMERICIDENTIFIER] + ')\\.' +
|
43
|
+
'(' + src[NUMERICIDENTIFIER] + ')\\.' +
|
44
|
+
'(' + src[NUMERICIDENTIFIER] + ')';
|
45
|
+
|
46
|
+
var MAINVERSIONLOOSE = R++;
|
47
|
+
src[MAINVERSIONLOOSE] = '(' + src[NUMERICIDENTIFIERLOOSE] + ')\\.' +
|
48
|
+
'(' + src[NUMERICIDENTIFIERLOOSE] + ')\\.' +
|
49
|
+
'(' + src[NUMERICIDENTIFIERLOOSE] + ')';
|
50
|
+
|
51
|
+
// ## Pre-release Version Identifier
|
52
|
+
// A numeric identifier, or a non-numeric identifier.
|
53
|
+
|
54
|
+
var PRERELEASEIDENTIFIER = R++;
|
55
|
+
src[PRERELEASEIDENTIFIER] = '(?:' + src[NUMERICIDENTIFIER] +
|
56
|
+
'|' + src[NONNUMERICIDENTIFIER] + ')';
|
57
|
+
|
58
|
+
var PRERELEASEIDENTIFIERLOOSE = R++;
|
59
|
+
src[PRERELEASEIDENTIFIERLOOSE] = '(?:' + src[NUMERICIDENTIFIERLOOSE] +
|
60
|
+
'|' + src[NONNUMERICIDENTIFIER] + ')';
|
61
|
+
|
62
|
+
|
63
|
+
// ## Pre-release Version
|
64
|
+
// Hyphen, followed by one or more dot-separated pre-release version
|
65
|
+
// identifiers.
|
66
|
+
|
67
|
+
var PRERELEASE = R++;
|
68
|
+
src[PRERELEASE] = '(?:-(' + src[PRERELEASEIDENTIFIER] +
|
69
|
+
'(?:\\.' + src[PRERELEASEIDENTIFIER] + ')*))';
|
70
|
+
|
71
|
+
var PRERELEASELOOSE = R++;
|
72
|
+
src[PRERELEASELOOSE] = '(?:-?(' + src[PRERELEASEIDENTIFIERLOOSE] +
|
73
|
+
'(?:\\.' + src[PRERELEASEIDENTIFIERLOOSE] + ')*))';
|
74
|
+
|
75
|
+
// ## Build Metadata Identifier
|
76
|
+
// Any combination of digits, letters, or hyphens.
|
77
|
+
|
78
|
+
var BUILDIDENTIFIER = R++;
|
79
|
+
src[BUILDIDENTIFIER] = '[0-9A-Za-z-]+';
|
80
|
+
|
81
|
+
// ## Build Metadata
|
82
|
+
// Plus sign, followed by one or more period-separated build metadata
|
83
|
+
// identifiers.
|
84
|
+
|
85
|
+
var BUILD = R++;
|
86
|
+
src[BUILD] = '(?:\\+(' + src[BUILDIDENTIFIER] +
|
87
|
+
'(?:\\.' + src[BUILDIDENTIFIER] + ')*))';
|
88
|
+
|
89
|
+
|
90
|
+
// ## Full Version String
|
91
|
+
// A main version, followed optionally by a pre-release version and
|
92
|
+
// build metadata.
|
93
|
+
|
94
|
+
// Note that the only major, minor, patch, and pre-release sections of
|
95
|
+
// the version string are capturing groups. The build metadata is not a
|
96
|
+
// capturing group, because it should not ever be used in version
|
97
|
+
// comparison.
|
98
|
+
|
99
|
+
var FULL = R++;
|
100
|
+
var FULLPLAIN = 'v?' + src[MAINVERSION] +
|
101
|
+
src[PRERELEASE] + '?' +
|
102
|
+
src[BUILD] + '?';
|
103
|
+
|
104
|
+
src[FULL] = '^' + FULLPLAIN + '$';
|
105
|
+
|
106
|
+
// like full, but allows v1.2.3 and =1.2.3, which people do sometimes.
|
107
|
+
// also, 1.0.0alpha1 (prerelease without the hyphen) which is pretty
|
108
|
+
// common in the npm registry.
|
109
|
+
var LOOSEPLAIN = '[v=\\s]*' + src[MAINVERSIONLOOSE] +
|
110
|
+
src[PRERELEASELOOSE] + '?' +
|
111
|
+
src[BUILD] + '?';
|
112
|
+
|
113
|
+
var LOOSE = R++;
|
114
|
+
src[LOOSE] = '^' + LOOSEPLAIN + '$';
|
115
|
+
|
116
|
+
var GTLT = R++;
|
117
|
+
src[GTLT] = '((?:<|>)?=?)';
|
118
|
+
|
119
|
+
// Something like "2.*" or "1.2.x".
|
120
|
+
// Note that "x.x" is a valid xRange identifer, meaning "any version"
|
121
|
+
// Only the first item is strictly required.
|
122
|
+
var XRANGEIDENTIFIERLOOSE = R++;
|
123
|
+
src[XRANGEIDENTIFIERLOOSE] = src[NUMERICIDENTIFIERLOOSE] + '|x|X|\\*';
|
124
|
+
var XRANGEIDENTIFIER = R++;
|
125
|
+
src[XRANGEIDENTIFIER] = src[NUMERICIDENTIFIER] + '|x|X|\\*';
|
126
|
+
|
127
|
+
var XRANGEPLAIN = R++;
|
128
|
+
src[XRANGEPLAIN] = '[v=\\s]*(' + src[XRANGEIDENTIFIER] + ')' +
|
129
|
+
'(?:\\.(' + src[XRANGEIDENTIFIER] + ')' +
|
130
|
+
'(?:\\.(' + src[XRANGEIDENTIFIER] + ')' +
|
131
|
+
'(?:(' + src[PRERELEASE] + ')' +
|
132
|
+
')?)?)?';
|
133
|
+
|
134
|
+
var XRANGEPLAINLOOSE = R++;
|
135
|
+
src[XRANGEPLAINLOOSE] = '[v=\\s]*(' + src[XRANGEIDENTIFIERLOOSE] + ')' +
|
136
|
+
'(?:\\.(' + src[XRANGEIDENTIFIERLOOSE] + ')' +
|
137
|
+
'(?:\\.(' + src[XRANGEIDENTIFIERLOOSE] + ')' +
|
138
|
+
'(?:(' + src[PRERELEASELOOSE] + ')' +
|
139
|
+
')?)?)?';
|
140
|
+
|
141
|
+
// >=2.x, for example, means >=2.0.0-0
|
142
|
+
// <1.x would be the same as "<1.0.0-0", though.
|
143
|
+
var XRANGE = R++;
|
144
|
+
src[XRANGE] = '^' + src[GTLT] + '\\s*' + src[XRANGEPLAIN] + '$';
|
145
|
+
var XRANGELOOSE = R++;
|
146
|
+
src[XRANGELOOSE] = '^' + src[GTLT] + '\\s*' + src[XRANGEPLAINLOOSE] + '$';
|
147
|
+
|
148
|
+
// Tilde ranges.
|
149
|
+
// Meaning is "reasonably at or greater than"
|
150
|
+
var LONETILDE = R++;
|
151
|
+
src[LONETILDE] = '(?:~>?)';
|
152
|
+
|
153
|
+
var TILDETRIM = R++;
|
154
|
+
src[TILDETRIM] = '(\\s*)' + src[LONETILDE] + '\\s+';
|
155
|
+
re[TILDETRIM] = new RegExp(src[TILDETRIM], 'g');
|
156
|
+
var tildeTrimReplace = '$1~';
|
157
|
+
|
158
|
+
var TILDE = R++;
|
159
|
+
src[TILDE] = '^' + src[LONETILDE] + src[XRANGEPLAIN] + '$';
|
160
|
+
var TILDELOOSE = R++;
|
161
|
+
src[TILDELOOSE] = '^' + src[LONETILDE] + src[XRANGEPLAINLOOSE] + '$';
|
162
|
+
|
163
|
+
// Caret ranges.
|
164
|
+
// Meaning is "at least and backwards compatible with"
|
165
|
+
var LONECARET = R++;
|
166
|
+
src[LONECARET] = '(?:\\^)';
|
167
|
+
|
168
|
+
var CARETTRIM = R++;
|
169
|
+
src[CARETTRIM] = '(\\s*)' + src[LONECARET] + '\\s+';
|
170
|
+
re[CARETTRIM] = new RegExp(src[CARETTRIM], 'g');
|
171
|
+
var caretTrimReplace = '$1^';
|
172
|
+
|
173
|
+
var CARET = R++;
|
174
|
+
src[CARET] = '^' + src[LONECARET] + src[XRANGEPLAIN] + '$';
|
175
|
+
var CARETLOOSE = R++;
|
176
|
+
src[CARETLOOSE] = '^' + src[LONECARET] + src[XRANGEPLAINLOOSE] + '$';
|
177
|
+
|
178
|
+
// A simple gt/lt/eq thing, or just "" to indicate "any version"
|
179
|
+
var COMPARATORLOOSE = R++;
|
180
|
+
src[COMPARATORLOOSE] = '^' + src[GTLT] + '\\s*(' + LOOSEPLAIN + ')$|^$';
|
181
|
+
var COMPARATOR = R++;
|
182
|
+
src[COMPARATOR] = '^' + src[GTLT] + '\\s*(' + FULLPLAIN + ')$|^$';
|
183
|
+
|
184
|
+
|
185
|
+
// An expression to strip any whitespace between the gtlt and the thing
|
186
|
+
// it modifies, so that `> 1.2.3` ==> `>1.2.3`
|
187
|
+
var COMPARATORTRIM = R++;
|
188
|
+
src[COMPARATORTRIM] = '(\\s*)' + src[GTLT] +
|
189
|
+
'\\s*(' + LOOSEPLAIN + '|' + src[XRANGEPLAIN] + ')';
|
190
|
+
|
191
|
+
// this one has to use the /g flag
|
192
|
+
re[COMPARATORTRIM] = new RegExp(src[COMPARATORTRIM], 'g');
|
193
|
+
var comparatorTrimReplace = '$1$2$3';
|
194
|
+
|
195
|
+
|
196
|
+
// Something like `1.2.3 - 1.2.4`
|
197
|
+
// Note that these all use the loose form, because they'll be
|
198
|
+
// checked against either the strict or loose comparator form
|
199
|
+
// later.
|
200
|
+
var HYPHENRANGE = R++;
|
201
|
+
src[HYPHENRANGE] = '^\\s*(' + src[XRANGEPLAIN] + ')' +
|
202
|
+
'\\s+-\\s+' +
|
203
|
+
'(' + src[XRANGEPLAIN] + ')' +
|
204
|
+
'\\s*$';
|
205
|
+
|
206
|
+
var HYPHENRANGELOOSE = R++;
|
207
|
+
src[HYPHENRANGELOOSE] = '^\\s*(' + src[XRANGEPLAINLOOSE] + ')' +
|
208
|
+
'\\s+-\\s+' +
|
209
|
+
'(' + src[XRANGEPLAINLOOSE] + ')' +
|
210
|
+
'\\s*$';
|
211
|
+
|
212
|
+
// Star ranges basically just allow anything at all.
|
213
|
+
var STAR = R++;
|
214
|
+
src[STAR] = '(<|>)?=?\\s*\\*';
|
215
|
+
|
216
|
+
// Compile to actual regexp objects.
|
217
|
+
// All are flag-free, unless they were created above with a flag.
|
218
|
+
for (var i = 0; i < R; i++) {
|
219
|
+
;
|
220
|
+
if (!re[i])
|
221
|
+
re[i] = new RegExp(src[i]);
|
222
|
+
}
|
223
|
+
|
224
|
+
exports.parse = parse;
|
225
|
+
function parse(version, loose) {
|
226
|
+
var r = loose ? re[LOOSE] : re[FULL];
|
227
|
+
return (r.test(version)) ? new SemVer(version, loose) : null;
|
228
|
+
}
|
229
|
+
|
230
|
+
exports.valid = valid;
|
231
|
+
function valid(version, loose) {
|
232
|
+
var v = parse(version, loose);
|
233
|
+
return v ? v.version : null;
|
234
|
+
}
|
235
|
+
|
236
|
+
|
237
|
+
exports.clean = clean;
|
238
|
+
function clean(version, loose) {
|
239
|
+
var s = parse(version, loose);
|
240
|
+
return s ? s.version : null;
|
241
|
+
}
|
242
|
+
|
243
|
+
exports.SemVer = SemVer;
|
244
|
+
|
245
|
+
function SemVer(version, loose) {
|
246
|
+
if (version instanceof SemVer) {
|
247
|
+
if (version.loose === loose)
|
248
|
+
return version;
|
249
|
+
else
|
250
|
+
version = version.version;
|
251
|
+
} else if (typeof version !== 'string') {
|
252
|
+
throw new TypeError('Invalid Version: ' + version);
|
253
|
+
}
|
254
|
+
|
255
|
+
if (!(this instanceof SemVer))
|
256
|
+
return new SemVer(version, loose);
|
257
|
+
|
258
|
+
;
|
259
|
+
this.loose = loose;
|
260
|
+
var m = version.trim().match(loose ? re[LOOSE] : re[FULL]);
|
261
|
+
|
262
|
+
if (!m)
|
263
|
+
throw new TypeError('Invalid Version: ' + version);
|
264
|
+
|
265
|
+
this.raw = version;
|
266
|
+
|
267
|
+
// these are actually numbers
|
268
|
+
this.major = +m[1];
|
269
|
+
this.minor = +m[2];
|
270
|
+
this.patch = +m[3];
|
271
|
+
|
272
|
+
// numberify any prerelease numeric ids
|
273
|
+
if (!m[4])
|
274
|
+
this.prerelease = [];
|
275
|
+
else
|
276
|
+
this.prerelease = m[4].split('.').map(function(id) {
|
277
|
+
return (/^[0-9]+$/.test(id)) ? +id : id;
|
278
|
+
});
|
279
|
+
|
280
|
+
this.build = m[5] ? m[5].split('.') : [];
|
281
|
+
this.format();
|
282
|
+
}
|
283
|
+
|
284
|
+
SemVer.prototype.format = function() {
|
285
|
+
this.version = this.major + '.' + this.minor + '.' + this.patch;
|
286
|
+
if (this.prerelease.length)
|
287
|
+
this.version += '-' + this.prerelease.join('.');
|
288
|
+
return this.version;
|
289
|
+
};
|
290
|
+
|
291
|
+
SemVer.prototype.inspect = function() {
|
292
|
+
return '<SemVer "' + this + '">';
|
293
|
+
};
|
294
|
+
|
295
|
+
SemVer.prototype.toString = function() {
|
296
|
+
return this.version;
|
297
|
+
};
|
298
|
+
|
299
|
+
SemVer.prototype.compare = function(other) {
|
300
|
+
;
|
301
|
+
if (!(other instanceof SemVer))
|
302
|
+
other = new SemVer(other, this.loose);
|
303
|
+
|
304
|
+
return this.compareMain(other) || this.comparePre(other);
|
305
|
+
};
|
306
|
+
|
307
|
+
SemVer.prototype.compareMain = function(other) {
|
308
|
+
if (!(other instanceof SemVer))
|
309
|
+
other = new SemVer(other, this.loose);
|
310
|
+
|
311
|
+
return compareIdentifiers(this.major, other.major) ||
|
312
|
+
compareIdentifiers(this.minor, other.minor) ||
|
313
|
+
compareIdentifiers(this.patch, other.patch);
|
314
|
+
};
|
315
|
+
|
316
|
+
SemVer.prototype.comparePre = function(other) {
|
317
|
+
if (!(other instanceof SemVer))
|
318
|
+
other = new SemVer(other, this.loose);
|
319
|
+
|
320
|
+
// NOT having a prerelease is > having one
|
321
|
+
if (this.prerelease.length && !other.prerelease.length)
|
322
|
+
return -1;
|
323
|
+
else if (!this.prerelease.length && other.prerelease.length)
|
324
|
+
return 1;
|
325
|
+
else if (!this.prerelease.length && !other.prerelease.length)
|
326
|
+
return 0;
|
327
|
+
|
328
|
+
var i = 0;
|
329
|
+
do {
|
330
|
+
var a = this.prerelease[i];
|
331
|
+
var b = other.prerelease[i];
|
332
|
+
;
|
333
|
+
if (a === undefined && b === undefined)
|
334
|
+
return 0;
|
335
|
+
else if (b === undefined)
|
336
|
+
return 1;
|
337
|
+
else if (a === undefined)
|
338
|
+
return -1;
|
339
|
+
else if (a === b)
|
340
|
+
continue;
|
341
|
+
else
|
342
|
+
return compareIdentifiers(a, b);
|
343
|
+
} while (++i);
|
344
|
+
};
|
345
|
+
|
346
|
+
// preminor will bump the version up to the next minor release, and immediately
|
347
|
+
// down to pre-release. premajor and prepatch work the same way.
|
348
|
+
SemVer.prototype.inc = function(release) {
|
349
|
+
switch (release) {
|
350
|
+
case 'premajor':
|
351
|
+
this.inc('major');
|
352
|
+
this.inc('pre');
|
353
|
+
break;
|
354
|
+
case 'preminor':
|
355
|
+
this.inc('minor');
|
356
|
+
this.inc('pre');
|
357
|
+
break;
|
358
|
+
case 'prepatch':
|
359
|
+
this.inc('patch');
|
360
|
+
this.inc('pre');
|
361
|
+
break;
|
362
|
+
// If the input is a non-prerelease version, this acts the same as
|
363
|
+
// prepatch.
|
364
|
+
case 'prerelease':
|
365
|
+
if (this.prerelease.length === 0)
|
366
|
+
this.inc('patch');
|
367
|
+
this.inc('pre');
|
368
|
+
break;
|
369
|
+
case 'major':
|
370
|
+
this.major++;
|
371
|
+
this.minor = -1;
|
372
|
+
case 'minor':
|
373
|
+
this.minor++;
|
374
|
+
this.patch = 0;
|
375
|
+
this.prerelease = [];
|
376
|
+
break;
|
377
|
+
case 'patch':
|
378
|
+
// If this is not a pre-release version, it will increment the patch.
|
379
|
+
// If it is a pre-release it will bump up to the same patch version.
|
380
|
+
// 1.2.0-5 patches to 1.2.0
|
381
|
+
// 1.2.0 patches to 1.2.1
|
382
|
+
if (this.prerelease.length === 0)
|
383
|
+
this.patch++;
|
384
|
+
this.prerelease = [];
|
385
|
+
break;
|
386
|
+
// This probably shouldn't be used publically.
|
387
|
+
// 1.0.0 "pre" would become 1.0.0-0 which is the wrong direction.
|
388
|
+
case 'pre':
|
389
|
+
if (this.prerelease.length === 0)
|
390
|
+
this.prerelease = [0];
|
391
|
+
else {
|
392
|
+
var i = this.prerelease.length;
|
393
|
+
while (--i >= 0) {
|
394
|
+
if (typeof this.prerelease[i] === 'number') {
|
395
|
+
this.prerelease[i]++;
|
396
|
+
i = -2;
|
397
|
+
}
|
398
|
+
}
|
399
|
+
if (i === -1) // didn't increment anything
|
400
|
+
this.prerelease.push(0);
|
401
|
+
}
|
402
|
+
break;
|
403
|
+
|
404
|
+
default:
|
405
|
+
throw new Error('invalid increment argument: ' + release);
|
406
|
+
}
|
407
|
+
this.format();
|
408
|
+
return this;
|
409
|
+
};
|
410
|
+
|
411
|
+
exports.inc = inc;
|
412
|
+
function inc(version, release, loose) {
|
413
|
+
try {
|
414
|
+
return new SemVer(version, loose).inc(release).version;
|
415
|
+
} catch (er) {
|
416
|
+
return null;
|
417
|
+
}
|
418
|
+
}
|
419
|
+
|
420
|
+
exports.compareIdentifiers = compareIdentifiers;
|
421
|
+
|
422
|
+
var numeric = /^[0-9]+$/;
|
423
|
+
function compareIdentifiers(a, b) {
|
424
|
+
var anum = numeric.test(a);
|
425
|
+
var bnum = numeric.test(b);
|
426
|
+
|
427
|
+
if (anum && bnum) {
|
428
|
+
a = +a;
|
429
|
+
b = +b;
|
430
|
+
}
|
431
|
+
|
432
|
+
return (anum && !bnum) ? -1 :
|
433
|
+
(bnum && !anum) ? 1 :
|
434
|
+
a < b ? -1 :
|
435
|
+
a > b ? 1 :
|
436
|
+
0;
|
437
|
+
}
|
438
|
+
|
439
|
+
exports.rcompareIdentifiers = rcompareIdentifiers;
|
440
|
+
function rcompareIdentifiers(a, b) {
|
441
|
+
return compareIdentifiers(b, a);
|
442
|
+
}
|
443
|
+
|
444
|
+
exports.compare = compare;
|
445
|
+
function compare(a, b, loose) {
|
446
|
+
return new SemVer(a, loose).compare(b);
|
447
|
+
}
|
448
|
+
|
449
|
+
exports.compareLoose = compareLoose;
|
450
|
+
function compareLoose(a, b) {
|
451
|
+
return compare(a, b, true);
|
452
|
+
}
|
453
|
+
|
454
|
+
exports.rcompare = rcompare;
|
455
|
+
function rcompare(a, b, loose) {
|
456
|
+
return compare(b, a, loose);
|
457
|
+
}
|
458
|
+
|
459
|
+
exports.sort = sort;
|
460
|
+
function sort(list, loose) {
|
461
|
+
return list.sort(function(a, b) {
|
462
|
+
return exports.compare(a, b, loose);
|
463
|
+
});
|
464
|
+
}
|
465
|
+
|
466
|
+
exports.rsort = rsort;
|
467
|
+
function rsort(list, loose) {
|
468
|
+
return list.sort(function(a, b) {
|
469
|
+
return exports.rcompare(a, b, loose);
|
470
|
+
});
|
471
|
+
}
|
472
|
+
|
473
|
+
exports.gt = gt;
|
474
|
+
function gt(a, b, loose) {
|
475
|
+
return compare(a, b, loose) > 0;
|
476
|
+
}
|
477
|
+
|
478
|
+
exports.lt = lt;
|
479
|
+
function lt(a, b, loose) {
|
480
|
+
return compare(a, b, loose) < 0;
|
481
|
+
}
|
482
|
+
|
483
|
+
exports.eq = eq;
|
484
|
+
function eq(a, b, loose) {
|
485
|
+
return compare(a, b, loose) === 0;
|
486
|
+
}
|
487
|
+
|
488
|
+
exports.neq = neq;
|
489
|
+
function neq(a, b, loose) {
|
490
|
+
return compare(a, b, loose) !== 0;
|
491
|
+
}
|
492
|
+
|
493
|
+
exports.gte = gte;
|
494
|
+
function gte(a, b, loose) {
|
495
|
+
return compare(a, b, loose) >= 0;
|
496
|
+
}
|
497
|
+
|
498
|
+
exports.lte = lte;
|
499
|
+
function lte(a, b, loose) {
|
500
|
+
return compare(a, b, loose) <= 0;
|
501
|
+
}
|
502
|
+
|
503
|
+
exports.cmp = cmp;
|
504
|
+
function cmp(a, op, b, loose) {
|
505
|
+
var ret;
|
506
|
+
switch (op) {
|
507
|
+
case '===': ret = a === b; break;
|
508
|
+
case '!==': ret = a !== b; break;
|
509
|
+
case '': case '=': case '==': ret = eq(a, b, loose); break;
|
510
|
+
case '!=': ret = neq(a, b, loose); break;
|
511
|
+
case '>': ret = gt(a, b, loose); break;
|
512
|
+
case '>=': ret = gte(a, b, loose); break;
|
513
|
+
case '<': ret = lt(a, b, loose); break;
|
514
|
+
case '<=': ret = lte(a, b, loose); break;
|
515
|
+
default: throw new TypeError('Invalid operator: ' + op);
|
516
|
+
}
|
517
|
+
return ret;
|
518
|
+
}
|
519
|
+
|
520
|
+
exports.Comparator = Comparator;
|
521
|
+
function Comparator(comp, loose) {
|
522
|
+
if (comp instanceof Comparator) {
|
523
|
+
if (comp.loose === loose)
|
524
|
+
return comp;
|
525
|
+
else
|
526
|
+
comp = comp.value;
|
527
|
+
}
|
528
|
+
|
529
|
+
if (!(this instanceof Comparator))
|
530
|
+
return new Comparator(comp, loose);
|
531
|
+
|
532
|
+
;
|
533
|
+
this.loose = loose;
|
534
|
+
this.parse(comp);
|
535
|
+
|
536
|
+
if (this.semver === ANY)
|
537
|
+
this.value = '';
|
538
|
+
else
|
539
|
+
this.value = this.operator + this.semver.version;
|
540
|
+
}
|
541
|
+
|
542
|
+
var ANY = {};
|
543
|
+
Comparator.prototype.parse = function(comp) {
|
544
|
+
var r = this.loose ? re[COMPARATORLOOSE] : re[COMPARATOR];
|
545
|
+
var m = comp.match(r);
|
546
|
+
|
547
|
+
if (!m)
|
548
|
+
throw new TypeError('Invalid comparator: ' + comp);
|
549
|
+
|
550
|
+
this.operator = m[1];
|
551
|
+
// if it literally is just '>' or '' then allow anything.
|
552
|
+
if (!m[2])
|
553
|
+
this.semver = ANY;
|
554
|
+
else {
|
555
|
+
this.semver = new SemVer(m[2], this.loose);
|
556
|
+
|
557
|
+
// <1.2.3-rc DOES allow 1.2.3-beta (has prerelease)
|
558
|
+
// >=1.2.3 DOES NOT allow 1.2.3-beta
|
559
|
+
// <=1.2.3 DOES allow 1.2.3-beta
|
560
|
+
// However, <1.2.3 does NOT allow 1.2.3-beta,
|
561
|
+
// even though `1.2.3-beta < 1.2.3`
|
562
|
+
// The assumption is that the 1.2.3 version has something you
|
563
|
+
// *don't* want, so we push the prerelease down to the minimum.
|
564
|
+
if (this.operator === '<' && !this.semver.prerelease.length) {
|
565
|
+
this.semver.prerelease = ['0'];
|
566
|
+
this.semver.format();
|
567
|
+
}
|
568
|
+
}
|
569
|
+
};
|
570
|
+
|
571
|
+
Comparator.prototype.inspect = function() {
|
572
|
+
return '<SemVer Comparator "' + this + '">';
|
573
|
+
};
|
574
|
+
|
575
|
+
Comparator.prototype.toString = function() {
|
576
|
+
return this.value;
|
577
|
+
};
|
578
|
+
|
579
|
+
Comparator.prototype.test = function(version) {
|
580
|
+
;
|
581
|
+
return (this.semver === ANY) ? true :
|
582
|
+
cmp(version, this.operator, this.semver, this.loose);
|
583
|
+
};
|
584
|
+
|
585
|
+
|
586
|
+
exports.Range = Range;
|
587
|
+
function Range(range, loose) {
|
588
|
+
if ((range instanceof Range) && range.loose === loose)
|
589
|
+
return range;
|
590
|
+
|
591
|
+
if (!(this instanceof Range))
|
592
|
+
return new Range(range, loose);
|
593
|
+
|
594
|
+
this.loose = loose;
|
595
|
+
|
596
|
+
// First, split based on boolean or ||
|
597
|
+
this.raw = range;
|
598
|
+
this.set = range.split(/\s*\|\|\s*/).map(function(range) {
|
599
|
+
return this.parseRange(range.trim());
|
600
|
+
}, this).filter(function(c) {
|
601
|
+
// throw out any that are not relevant for whatever reason
|
602
|
+
return c.length;
|
603
|
+
});
|
604
|
+
|
605
|
+
if (!this.set.length) {
|
606
|
+
throw new TypeError('Invalid SemVer Range: ' + range);
|
607
|
+
}
|
608
|
+
|
609
|
+
this.format();
|
610
|
+
}
|
611
|
+
|
612
|
+
Range.prototype.inspect = function() {
|
613
|
+
return '<SemVer Range "' + this.range + '">';
|
614
|
+
};
|
615
|
+
|
616
|
+
Range.prototype.format = function() {
|
617
|
+
this.range = this.set.map(function(comps) {
|
618
|
+
return comps.join(' ').trim();
|
619
|
+
}).join('||').trim();
|
620
|
+
return this.range;
|
621
|
+
};
|
622
|
+
|
623
|
+
Range.prototype.toString = function() {
|
624
|
+
return this.range;
|
625
|
+
};
|
626
|
+
|
627
|
+
Range.prototype.parseRange = function(range) {
|
628
|
+
var loose = this.loose;
|
629
|
+
range = range.trim();
|
630
|
+
;
|
631
|
+
// `1.2.3 - 1.2.4` => `>=1.2.3 <=1.2.4`
|
632
|
+
var hr = loose ? re[HYPHENRANGELOOSE] : re[HYPHENRANGE];
|
633
|
+
range = range.replace(hr, hyphenReplace);
|
634
|
+
;
|
635
|
+
// `> 1.2.3 < 1.2.5` => `>1.2.3 <1.2.5`
|
636
|
+
range = range.replace(re[COMPARATORTRIM], comparatorTrimReplace);
|
637
|
+
;
|
638
|
+
|
639
|
+
// `~ 1.2.3` => `~1.2.3`
|
640
|
+
range = range.replace(re[TILDETRIM], tildeTrimReplace);
|
641
|
+
|
642
|
+
// `^ 1.2.3` => `^1.2.3`
|
643
|
+
range = range.replace(re[CARETTRIM], caretTrimReplace);
|
644
|
+
|
645
|
+
// normalize spaces
|
646
|
+
range = range.split(/\s+/).join(' ');
|
647
|
+
|
648
|
+
// At this point, the range is completely trimmed and
|
649
|
+
// ready to be split into comparators.
|
650
|
+
|
651
|
+
var compRe = loose ? re[COMPARATORLOOSE] : re[COMPARATOR];
|
652
|
+
var set = range.split(' ').map(function(comp) {
|
653
|
+
return parseComparator(comp, loose);
|
654
|
+
}).join(' ').split(/\s+/);
|
655
|
+
if (this.loose) {
|
656
|
+
// in loose mode, throw out any that are not valid comparators
|
657
|
+
set = set.filter(function(comp) {
|
658
|
+
return !!comp.match(compRe);
|
659
|
+
});
|
660
|
+
}
|
661
|
+
set = set.map(function(comp) {
|
662
|
+
return new Comparator(comp, loose);
|
663
|
+
});
|
664
|
+
|
665
|
+
return set;
|
666
|
+
};
|
667
|
+
|
668
|
+
// Mostly just for testing and legacy API reasons
|
669
|
+
exports.toComparators = toComparators;
|
670
|
+
function toComparators(range, loose) {
|
671
|
+
return new Range(range, loose).set.map(function(comp) {
|
672
|
+
return comp.map(function(c) {
|
673
|
+
return c.value;
|
674
|
+
}).join(' ').trim().split(' ');
|
675
|
+
});
|
676
|
+
}
|
677
|
+
|
678
|
+
// comprised of xranges, tildes, stars, and gtlt's at this point.
|
679
|
+
// already replaced the hyphen ranges
|
680
|
+
// turn into a set of JUST comparators.
|
681
|
+
function parseComparator(comp, loose) {
|
682
|
+
;
|
683
|
+
comp = replaceCarets(comp, loose);
|
684
|
+
;
|
685
|
+
comp = replaceTildes(comp, loose);
|
686
|
+
;
|
687
|
+
comp = replaceXRanges(comp, loose);
|
688
|
+
;
|
689
|
+
comp = replaceStars(comp, loose);
|
690
|
+
;
|
691
|
+
return comp;
|
692
|
+
}
|
693
|
+
|
694
|
+
function isX(id) {
|
695
|
+
return !id || id.toLowerCase() === 'x' || id === '*';
|
696
|
+
}
|
697
|
+
|
698
|
+
// ~, ~> --> * (any, kinda silly)
|
699
|
+
// ~2, ~2.x, ~2.x.x, ~>2, ~>2.x ~>2.x.x --> >=2.0.0 <3.0.0
|
700
|
+
// ~2.0, ~2.0.x, ~>2.0, ~>2.0.x --> >=2.0.0 <2.1.0
|
701
|
+
// ~1.2, ~1.2.x, ~>1.2, ~>1.2.x --> >=1.2.0 <1.3.0
|
702
|
+
// ~1.2.3, ~>1.2.3 --> >=1.2.3 <1.3.0
|
703
|
+
// ~1.2.0, ~>1.2.0 --> >=1.2.0 <1.3.0
|
704
|
+
function replaceTildes(comp, loose) {
|
705
|
+
return comp.trim().split(/\s+/).map(function(comp) {
|
706
|
+
return replaceTilde(comp, loose);
|
707
|
+
}).join(' ');
|
708
|
+
}
|
709
|
+
|
710
|
+
function replaceTilde(comp, loose) {
|
711
|
+
var r = loose ? re[TILDELOOSE] : re[TILDE];
|
712
|
+
return comp.replace(r, function(_, M, m, p, pr) {
|
713
|
+
;
|
714
|
+
var ret;
|
715
|
+
|
716
|
+
if (isX(M))
|
717
|
+
ret = '';
|
718
|
+
else if (isX(m))
|
719
|
+
ret = '>=' + M + '.0.0-0 <' + (+M + 1) + '.0.0-0';
|
720
|
+
else if (isX(p))
|
721
|
+
// ~1.2 == >=1.2.0- <1.3.0-
|
722
|
+
ret = '>=' + M + '.' + m + '.0-0 <' + M + '.' + (+m + 1) + '.0-0';
|
723
|
+
else if (pr) {
|
724
|
+
;
|
725
|
+
if (pr.charAt(0) !== '-')
|
726
|
+
pr = '-' + pr;
|
727
|
+
ret = '>=' + M + '.' + m + '.' + p + pr +
|
728
|
+
' <' + M + '.' + (+m + 1) + '.0-0';
|
729
|
+
} else
|
730
|
+
// ~1.2.3 == >=1.2.3-0 <1.3.0-0
|
731
|
+
ret = '>=' + M + '.' + m + '.' + p + '-0' +
|
732
|
+
' <' + M + '.' + (+m + 1) + '.0-0';
|
733
|
+
|
734
|
+
;
|
735
|
+
return ret;
|
736
|
+
});
|
737
|
+
}
|
738
|
+
|
739
|
+
// ^ --> * (any, kinda silly)
|
740
|
+
// ^2, ^2.x, ^2.x.x --> >=2.0.0 <3.0.0
|
741
|
+
// ^2.0, ^2.0.x --> >=2.0.0 <3.0.0
|
742
|
+
// ^1.2, ^1.2.x --> >=1.2.0 <2.0.0
|
743
|
+
// ^1.2.3 --> >=1.2.3 <2.0.0
|
744
|
+
// ^1.2.0 --> >=1.2.0 <2.0.0
|
745
|
+
function replaceCarets(comp, loose) {
|
746
|
+
return comp.trim().split(/\s+/).map(function(comp) {
|
747
|
+
return replaceCaret(comp, loose);
|
748
|
+
}).join(' ');
|
749
|
+
}
|
750
|
+
|
751
|
+
function replaceCaret(comp, loose) {
|
752
|
+
var r = loose ? re[CARETLOOSE] : re[CARET];
|
753
|
+
return comp.replace(r, function(_, M, m, p, pr) {
|
754
|
+
;
|
755
|
+
var ret;
|
756
|
+
|
757
|
+
if (isX(M))
|
758
|
+
ret = '';
|
759
|
+
else if (isX(m))
|
760
|
+
ret = '>=' + M + '.0.0-0 <' + (+M + 1) + '.0.0-0';
|
761
|
+
else if (isX(p)) {
|
762
|
+
if (M === '0')
|
763
|
+
ret = '>=' + M + '.' + m + '.0-0 <' + M + '.' + (+m + 1) + '.0-0';
|
764
|
+
else
|
765
|
+
ret = '>=' + M + '.' + m + '.0-0 <' + (+M + 1) + '.0.0-0';
|
766
|
+
} else if (pr) {
|
767
|
+
;
|
768
|
+
if (pr.charAt(0) !== '-')
|
769
|
+
pr = '-' + pr;
|
770
|
+
if (M === '0') {
|
771
|
+
if (m === '0')
|
772
|
+
ret = '=' + M + '.' + m + '.' + p + pr;
|
773
|
+
else
|
774
|
+
ret = '>=' + M + '.' + m + '.' + p + pr +
|
775
|
+
' <' + M + '.' + (+m + 1) + '.0-0';
|
776
|
+
} else
|
777
|
+
ret = '>=' + M + '.' + m + '.' + p + pr +
|
778
|
+
' <' + (+M + 1) + '.0.0-0';
|
779
|
+
} else {
|
780
|
+
if (M === '0') {
|
781
|
+
if (m === '0')
|
782
|
+
ret = '=' + M + '.' + m + '.' + p;
|
783
|
+
else
|
784
|
+
ret = '>=' + M + '.' + m + '.' + p + '-0' +
|
785
|
+
' <' + M + '.' + (+m + 1) + '.0-0';
|
786
|
+
} else
|
787
|
+
ret = '>=' + M + '.' + m + '.' + p + '-0' +
|
788
|
+
' <' + (+M + 1) + '.0.0-0';
|
789
|
+
}
|
790
|
+
|
791
|
+
;
|
792
|
+
return ret;
|
793
|
+
});
|
794
|
+
}
|
795
|
+
|
796
|
+
function replaceXRanges(comp, loose) {
|
797
|
+
;
|
798
|
+
return comp.split(/\s+/).map(function(comp) {
|
799
|
+
return replaceXRange(comp, loose);
|
800
|
+
}).join(' ');
|
801
|
+
}
|
802
|
+
|
803
|
+
function replaceXRange(comp, loose) {
|
804
|
+
comp = comp.trim();
|
805
|
+
var r = loose ? re[XRANGELOOSE] : re[XRANGE];
|
806
|
+
return comp.replace(r, function(ret, gtlt, M, m, p, pr) {
|
807
|
+
;
|
808
|
+
var xM = isX(M);
|
809
|
+
var xm = xM || isX(m);
|
810
|
+
var xp = xm || isX(p);
|
811
|
+
var anyX = xp;
|
812
|
+
|
813
|
+
if (gtlt === '=' && anyX)
|
814
|
+
gtlt = '';
|
815
|
+
|
816
|
+
if (gtlt && anyX) {
|
817
|
+
// replace X with 0, and then append the -0 min-prerelease
|
818
|
+
if (xM)
|
819
|
+
M = 0;
|
820
|
+
if (xm)
|
821
|
+
m = 0;
|
822
|
+
if (xp)
|
823
|
+
p = 0;
|
824
|
+
|
825
|
+
if (gtlt === '>') {
|
826
|
+
// >1 => >=2.0.0-0
|
827
|
+
// >1.2 => >=1.3.0-0
|
828
|
+
// >1.2.3 => >= 1.2.4-0
|
829
|
+
gtlt = '>=';
|
830
|
+
if (xM) {
|
831
|
+
// no change
|
832
|
+
} else if (xm) {
|
833
|
+
M = +M + 1;
|
834
|
+
m = 0;
|
835
|
+
p = 0;
|
836
|
+
} else if (xp) {
|
837
|
+
m = +m + 1;
|
838
|
+
p = 0;
|
839
|
+
}
|
840
|
+
}
|
841
|
+
|
842
|
+
|
843
|
+
ret = gtlt + M + '.' + m + '.' + p + '-0';
|
844
|
+
} else if (xM) {
|
845
|
+
// allow any
|
846
|
+
ret = '*';
|
847
|
+
} else if (xm) {
|
848
|
+
// append '-0' onto the version, otherwise
|
849
|
+
// '1.x.x' matches '2.0.0-beta', since the tag
|
850
|
+
// *lowers* the version value
|
851
|
+
ret = '>=' + M + '.0.0-0 <' + (+M + 1) + '.0.0-0';
|
852
|
+
} else if (xp) {
|
853
|
+
ret = '>=' + M + '.' + m + '.0-0 <' + M + '.' + (+m + 1) + '.0-0';
|
854
|
+
}
|
855
|
+
|
856
|
+
;
|
857
|
+
|
858
|
+
return ret;
|
859
|
+
});
|
860
|
+
}
|
861
|
+
|
862
|
+
// Because * is AND-ed with everything else in the comparator,
|
863
|
+
// and '' means "any version", just remove the *s entirely.
|
864
|
+
function replaceStars(comp, loose) {
|
865
|
+
;
|
866
|
+
// Looseness is ignored here. star is always as loose as it gets!
|
867
|
+
return comp.trim().replace(re[STAR], '');
|
868
|
+
}
|
869
|
+
|
870
|
+
// This function is passed to string.replace(re[HYPHENRANGE])
|
871
|
+
// M, m, patch, prerelease, build
|
872
|
+
// 1.2 - 3.4.5 => >=1.2.0-0 <=3.4.5
|
873
|
+
// 1.2.3 - 3.4 => >=1.2.0-0 <3.5.0-0 Any 3.4.x will do
|
874
|
+
// 1.2 - 3.4 => >=1.2.0-0 <3.5.0-0
|
875
|
+
function hyphenReplace($0,
|
876
|
+
from, fM, fm, fp, fpr, fb,
|
877
|
+
to, tM, tm, tp, tpr, tb) {
|
878
|
+
|
879
|
+
if (isX(fM))
|
880
|
+
from = '';
|
881
|
+
else if (isX(fm))
|
882
|
+
from = '>=' + fM + '.0.0-0';
|
883
|
+
else if (isX(fp))
|
884
|
+
from = '>=' + fM + '.' + fm + '.0-0';
|
885
|
+
else
|
886
|
+
from = '>=' + from;
|
887
|
+
|
888
|
+
if (isX(tM))
|
889
|
+
to = '';
|
890
|
+
else if (isX(tm))
|
891
|
+
to = '<' + (+tM + 1) + '.0.0-0';
|
892
|
+
else if (isX(tp))
|
893
|
+
to = '<' + tM + '.' + (+tm + 1) + '.0-0';
|
894
|
+
else if (tpr)
|
895
|
+
to = '<=' + tM + '.' + tm + '.' + tp + '-' + tpr;
|
896
|
+
else
|
897
|
+
to = '<=' + to;
|
898
|
+
|
899
|
+
return (from + ' ' + to).trim();
|
900
|
+
}
|
901
|
+
|
902
|
+
|
903
|
+
// if ANY of the sets match ALL of its comparators, then pass
|
904
|
+
Range.prototype.test = function(version) {
|
905
|
+
if (!version)
|
906
|
+
return false;
|
907
|
+
for (var i = 0; i < this.set.length; i++) {
|
908
|
+
if (testSet(this.set[i], version))
|
909
|
+
return true;
|
910
|
+
}
|
911
|
+
return false;
|
912
|
+
};
|
913
|
+
|
914
|
+
function testSet(set, version) {
|
915
|
+
for (var i = 0; i < set.length; i++) {
|
916
|
+
if (!set[i].test(version))
|
917
|
+
return false;
|
918
|
+
}
|
919
|
+
return true;
|
920
|
+
}
|
921
|
+
|
922
|
+
exports.satisfies = satisfies;
|
923
|
+
function satisfies(version, range, loose) {
|
924
|
+
try {
|
925
|
+
range = new Range(range, loose);
|
926
|
+
} catch (er) {
|
927
|
+
return false;
|
928
|
+
}
|
929
|
+
return range.test(version);
|
930
|
+
}
|
931
|
+
|
932
|
+
exports.maxSatisfying = maxSatisfying;
|
933
|
+
function maxSatisfying(versions, range, loose) {
|
934
|
+
return versions.filter(function(version) {
|
935
|
+
return satisfies(version, range, loose);
|
936
|
+
}).sort(function(a, b) {
|
937
|
+
return rcompare(a, b, loose);
|
938
|
+
})[0] || null;
|
939
|
+
}
|
940
|
+
|
941
|
+
exports.validRange = validRange;
|
942
|
+
function validRange(range, loose) {
|
943
|
+
try {
|
944
|
+
// Return '*' instead of '' so that truthiness works.
|
945
|
+
// This will throw if it's invalid anyway
|
946
|
+
return new Range(range, loose).range || '*';
|
947
|
+
} catch (er) {
|
948
|
+
return null;
|
949
|
+
}
|
950
|
+
}
|
951
|
+
|
952
|
+
// Determine if version is less than all the versions possible in the range
|
953
|
+
exports.ltr = ltr;
|
954
|
+
function ltr(version, range, loose) {
|
955
|
+
return outside(version, range, '<', loose);
|
956
|
+
}
|
957
|
+
|
958
|
+
// Determine if version is greater than all the versions possible in the range.
|
959
|
+
exports.gtr = gtr;
|
960
|
+
function gtr(version, range, loose) {
|
961
|
+
return outside(version, range, '>', loose);
|
962
|
+
}
|
963
|
+
|
964
|
+
exports.outside = outside;
|
965
|
+
function outside(version, range, hilo, loose) {
|
966
|
+
version = new SemVer(version, loose);
|
967
|
+
range = new Range(range, loose);
|
968
|
+
|
969
|
+
var gtfn, ltefn, ltfn, comp, ecomp;
|
970
|
+
switch (hilo) {
|
971
|
+
case '>':
|
972
|
+
gtfn = gt;
|
973
|
+
ltefn = lte;
|
974
|
+
ltfn = lt;
|
975
|
+
comp = '>';
|
976
|
+
ecomp = '>=';
|
977
|
+
break;
|
978
|
+
case '<':
|
979
|
+
gtfn = lt;
|
980
|
+
ltefn = gte;
|
981
|
+
ltfn = gt;
|
982
|
+
comp = '<';
|
983
|
+
ecomp = '<=';
|
984
|
+
break;
|
985
|
+
default:
|
986
|
+
throw new TypeError('Must provide a hilo val of "<" or ">"');
|
987
|
+
}
|
988
|
+
|
989
|
+
// If it satisifes the range it is not outside
|
990
|
+
if (satisfies(version, range, loose)) {
|
991
|
+
return false;
|
992
|
+
}
|
993
|
+
|
994
|
+
// From now on, variable terms are as if we're in "gtr" mode.
|
995
|
+
// but note that everything is flipped for the "ltr" function.
|
996
|
+
|
997
|
+
for (var i = 0; i < range.set.length; ++i) {
|
998
|
+
var comparators = range.set[i];
|
999
|
+
|
1000
|
+
var high = null;
|
1001
|
+
var low = null;
|
1002
|
+
|
1003
|
+
comparators.forEach(function(comparator) {
|
1004
|
+
high = high || comparator;
|
1005
|
+
low = low || comparator;
|
1006
|
+
if (gtfn(comparator.semver, high.semver, loose)) {
|
1007
|
+
high = comparator;
|
1008
|
+
} else if (ltfn(comparator.semver, low.semver, loose)) {
|
1009
|
+
low = comparator;
|
1010
|
+
}
|
1011
|
+
});
|
1012
|
+
|
1013
|
+
// If the edge version comparator has a operator then our version
|
1014
|
+
// isn't outside it
|
1015
|
+
if (high.operator === comp || high.operator === ecomp) {
|
1016
|
+
return false;
|
1017
|
+
}
|
1018
|
+
|
1019
|
+
// If the lowest version comparator has an operator and our version
|
1020
|
+
// is less than it then it isn't higher than the range
|
1021
|
+
if ((!low.operator || low.operator === comp) &&
|
1022
|
+
ltefn(version, low.semver)) {
|
1023
|
+
return false;
|
1024
|
+
} else if (low.operator === ecomp && ltfn(version, low.semver)) {
|
1025
|
+
return false;
|
1026
|
+
}
|
1027
|
+
}
|
1028
|
+
return true;
|
1029
|
+
}
|
1030
|
+
|
1031
|
+
// Use the define() function if we're in AMD land
|
1032
|
+
if (typeof define === 'function' && define.amd)
|
1033
|
+
define(exports);
|
1034
|
+
|
1035
|
+
})(
|
1036
|
+
typeof exports === 'object' ? exports :
|
1037
|
+
typeof define === 'function' && define.amd ? {} :
|
1038
|
+
semver = {}
|
1039
|
+
);
|