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