Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/npm/cli.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorForrest L Norvell <forrest@npmjs.com>2015-03-20 01:28:38 +0300
committerForrest L Norvell <forrest@npmjs.com>2015-03-20 01:28:38 +0300
commit3ed41bf64a1bb752bb3155c74dd6ffbbd28c89c9 (patch)
treeea0e59d20761df67575ef08374af6a48dff45f03 /node_modules/npm-package-arg
parent1e3cb301aa3b4ea07e20c2a04698332ea194a538 (diff)
npm-package-arg@3.1.1
Do the minimal upgrade necessary to get tests passing with new hosted repo metadata. I anticipate the realize-package-specifier update will be a little more invasive.
Diffstat (limited to 'node_modules/npm-package-arg')
-rw-r--r--node_modules/npm-package-arg/README.md76
-rw-r--r--node_modules/npm-package-arg/node_modules/hosted-git-info/.npmignore3
-rw-r--r--node_modules/npm-package-arg/node_modules/hosted-git-info/.travis.yml5
-rw-r--r--node_modules/npm-package-arg/node_modules/hosted-git-info/README.md82
-rw-r--r--node_modules/npm-package-arg/node_modules/hosted-git-info/README.md~88
-rw-r--r--node_modules/npm-package-arg/node_modules/hosted-git-info/index.js208
-rw-r--r--node_modules/npm-package-arg/node_modules/hosted-git-info/package.json55
-rw-r--r--node_modules/npm-package-arg/node_modules/hosted-git-info/test/basic.js9
-rw-r--r--node_modules/npm-package-arg/node_modules/hosted-git-info/test/bitbucket.js24
-rw-r--r--node_modules/npm-package-arg/node_modules/hosted-git-info/test/gist.js40
-rw-r--r--node_modules/npm-package-arg/node_modules/hosted-git-info/test/github.js42
-rw-r--r--node_modules/npm-package-arg/node_modules/hosted-git-info/test/gitlab.js25
-rw-r--r--node_modules/npm-package-arg/node_modules/hosted-git-info/test/lib/standard-tests.js28
-rw-r--r--node_modules/npm-package-arg/npa.js74
-rw-r--r--node_modules/npm-package-arg/package.json39
-rw-r--r--node_modules/npm-package-arg/test/basic.js59
-rw-r--r--node_modules/npm-package-arg/test/bitbucket.js82
-rw-r--r--node_modules/npm-package-arg/test/github.js106
-rw-r--r--node_modules/npm-package-arg/test/gitlab.js82
-rw-r--r--node_modules/npm-package-arg/test/windows.js28
20 files changed, 1032 insertions, 123 deletions
diff --git a/node_modules/npm-package-arg/README.md b/node_modules/npm-package-arg/README.md
index 602277a37..d37b35533 100644
--- a/node_modules/npm-package-arg/README.md
+++ b/node_modules/npm-package-arg/README.md
@@ -1,26 +1,54 @@
# npm-package-arg
-Parse the things that can be arguments to `npm install`
+Parse package name and specifier passed to commands like `npm install` or
+`npm cache add`. This just parses the text given-- it's worth noting that
+`npm` has further logic it applies by looking at your disk to figure out
+what ambiguous specifiers are. If you want that logic, please see
+[realize-package-specifier].
-Takes an argument like `foo@1.2`, or `foo@user/foo`, or
-`http://x.com/foo.tgz`, or `git+https://github.com/user/foo`, and
-figures out what type of thing it is.
+[realize-package-specifier]: https://www.npmjs.org/package/realize-package-specifier
-## USAGE
+Arguments look like: `foo@1.2`, `@bar/foo@1.2`, `foo@user/foo`, `http://x.com/foo.tgz`,
+`git+https://github.com/user/foo`, `bitbucket:user/foo`, `foo.tar.gz` or `bar`
+
+## EXAMPLES
```javascript
var assert = require("assert")
var npa = require("npm-package-arg")
// Pass in the descriptor, and it'll return an object
-var parsed = npa("foo@1.2")
+var parsed = npa("@bar/foo@1.2")
+
+// Returns an object like:
+{
+ raw: '@bar/foo@1.2', // what was passed in
+ name: "@bar/foo", // the name of the package
+ scope: "@bar", // the private scope of the package, or null
+ type: "range", // the type of specifier this is
+ spec: ">=1.2.0 <1.3.0" // the expanded specifier
+ rawSpec: "1.2" // the specifier as passed in
+ }
+
+// Parsing urls pointing at hosted git services produces a variation:
+var parsed = npa("git+https://github.com/user/foo")
// Returns an object like:
-// {
-// name: "foo", // The bit in front of the @
-// type: "range", // the type of descriptor this is
-// spec: "1.2" // the specifier for this descriptor
-// }
+{
+ raw: 'git+https://github.com/user/foo',
+ scope: null,
+ name: null,
+ rawSpec: 'git+https://github.com/user/foo',
+ spec: 'user/foo',
+ type: 'hosted',
+ hosted: {
+ type: 'github',
+ ssh: 'git@github.com:user/foo.git',
+ sshurl: 'git+ssh://git@github.com/user/foo.git',
+ https: 'https://github.com/user/foo.git',
+ directUrl: 'https://raw.githubusercontent.com/user/foo/master/package.json'
+ }
+}
// Completely unreasonable invalid garbage throws an error
// Make sure you wrap this in a try/catch if you have not
@@ -30,23 +58,41 @@ assert.throws(function() {
})
```
-For more examples, see the test file.
+## USING
+
+`var npa = require('npm-package-arg')`
+
+* var result = npa(*arg*)
+
+Parses *arg* and returns a result object detailing what *arg* is.
+
+*arg* -- a package descriptor, like: `foo@1.2`, or `foo@user/foo`, or
+`http://x.com/foo.tgz`, or `git+https://github.com/user/foo`
-## Result Objects
+## RESULT OBJECT
The objects that are returned by npm-package-arg contain the following
-fields:
+keys:
* `name` - If known, the `name` field expected in the resulting pkg.
* `type` - One of the following strings:
* `git` - A git repo
- * `github` - A github shorthand, like `user/project`
+ * `hosted` - A hosted project, from github, bitbucket or gitlab. Originally
+ either a full url pointing at one of these services or a shorthand like
+ `user/project` or `github:user/project` for github or `bitbucket:user/project`
+ for bitbucket.
* `tag` - A tagged version, like `"foo@latest"`
* `version` - A specific version number, like `"foo@1.2.3"`
* `range` - A version range, like `"foo@2.x"`
* `local` - A local file or folder path
* `remote` - An http url (presumably to a tgz)
* `spec` - The "thing". URL, the range, git repo, etc.
+* `hosted` - If type=hosted this will be an object with the following keys:
+ * `type` - github, bitbucket or gitlab
+ * `ssh` - The ssh path for this git repo
+ * `sshUrl` - The ssh URL for this git repo
+ * `httpsUrl` - The HTTPS URL for this git repo
+ * `directUrl` - The URL for the package.json in this git repo
* `raw` - The original un-modified string that was provided.
* `rawSpec` - The part after the `name@...`, as it was originally
provided.
diff --git a/node_modules/npm-package-arg/node_modules/hosted-git-info/.npmignore b/node_modules/npm-package-arg/node_modules/hosted-git-info/.npmignore
new file mode 100644
index 000000000..58e97a787
--- /dev/null
+++ b/node_modules/npm-package-arg/node_modules/hosted-git-info/.npmignore
@@ -0,0 +1,3 @@
+*~
+.#
+node_modules
diff --git a/node_modules/npm-package-arg/node_modules/hosted-git-info/.travis.yml b/node_modules/npm-package-arg/node_modules/hosted-git-info/.travis.yml
new file mode 100644
index 000000000..7dc661917
--- /dev/null
+++ b/node_modules/npm-package-arg/node_modules/hosted-git-info/.travis.yml
@@ -0,0 +1,5 @@
+language: node_js
+node_js:
+ - "0.11"
+ - "0.10"
+script: "npm test"
diff --git a/node_modules/npm-package-arg/node_modules/hosted-git-info/README.md b/node_modules/npm-package-arg/node_modules/hosted-git-info/README.md
new file mode 100644
index 000000000..ebf40a2ab
--- /dev/null
+++ b/node_modules/npm-package-arg/node_modules/hosted-git-info/README.md
@@ -0,0 +1,82 @@
+# hosted-git-info
+
+This will let you identify and transform various git hosts URLs between
+protocols. It also can tell you what the URL is for the raw path for
+particular file for direct access without git.
+
+## Usage
+
+```javascript
+var hostedGitInfo = require("hosted-git-info")
+var info = hostedGitInfo.fromUrl("git@github.com:npm/hosted-git-info.git")
+/* info looks like:
+{
+ type: "github",
+ domain: "github.com",
+ user: "npm",
+ project: "hosted-git-info"
+}
+*/
+```
+
+If the URL can't be matched with a git host, `null` will be returned. We
+can match git, ssh and https urls. Additionally, we can match ssh connect
+strings (`git@github.com:npm/hosted-git-info`) and shortcuts (eg,
+`github:npm/hosted-git-info`). Github specifically, is detected in the case
+of a third, unprefixed, form: `npm/hosted-git-info`.
+
+If it does match, the returned object has properties of:
+
+* info.type -- The short name of the service
+* info.domain -- The domain for git protocol use
+* info.user -- The name of the user/org on the git host
+* info.project -- The name of the project on the git host
+
+And methods of:
+
+* info.file(path)
+
+Given the path of a file relative to the repository, returns a URL for
+directly fetching it from the githost. If no comittish was set then
+`master` will be used as the default.
+
+For example `hostedGitInfo.fromUrl("git@github.com:npm/hosted-git-info.git#v1.0.0").file("package.json")`
+would return `https://raw.githubusercontent.com/npm/hosted-git-info/v1.0.0/package.json`
+
+* info.shortcut()
+
+eg, `github:npm/hosted-git-info`
+
+* info.browse()
+
+eg, `https://github.com/npm/hosted-git-info/tree/v1.2.0`
+
+* info.bugs()
+
+eg, `https://github.com/npm/hosted-git-info/issues`
+
+* info.docs()
+
+eg, `https://github.com/npm/hosted-git-info/tree/v1.2.0#readme`
+
+* info.https()
+
+eg, `https://github.com/npm/hosted-git-info.git`
+
+* info.sshurl()
+
+eg, `git+ssh://git@github.com/npm/hosted-git-info.git`
+
+* info.ssh()
+
+eg, `git@github.com:npm/hosted-git-info.git`
+
+* info.path()
+
+eg, `npm/hosted-git-info`
+
+## Supported hosts
+
+Currently this supports Github, Bitbucket and Gitlab. Pull requests for
+additional hosts welcome.
+
diff --git a/node_modules/npm-package-arg/node_modules/hosted-git-info/README.md~ b/node_modules/npm-package-arg/node_modules/hosted-git-info/README.md~
new file mode 100644
index 000000000..f6f1dcf9e
--- /dev/null
+++ b/node_modules/npm-package-arg/node_modules/hosted-git-info/README.md~
@@ -0,0 +1,88 @@
+# hosted-git-info
+
+This will let you identify and transform various git hosts URLs between
+protocols. It also can tell you what the URL is for the raw path for
+particular file for direct access without git.
+
+## Usage
+
+```javascript
+var hostedGitInfo = require("hosted-git-info")
+var info = hostedGitInfo.fromUrl("git@github.com:npm/hosted-git-info.git")
+/* info looks like:
+{
+ type: "github",
+ domain: "github.com",
+ user: "npm",
+ project: "hosted-git-info"
+}
+*/
+```
+
+If the URL can't be matched with a git host, `null` will be returned. We
+can match git, ssh and https urls. Additionally, we can match ssh connect
+strings (`git@github.com:npm/hosted-git-info`) and shortcuts (eg,
+`github:npm/hosted-git-info`). Github specifically, is detected in the case
+of a third, unprefixed, form: `npm/hosted-git-info`.
+
+If it does match, the returned object has properties of:
+
+* info.type -- The short name of the service
+* info.domain -- The domain for git protocol use
+* info.user -- The name of the user/org on the git host
+* info.project -- The name of the project on the git host
+
+And methods of:
+
+* info.file(path)
+
+Given the path of a file relative to the repository, returns a URL for
+directly fetching it from the githost. If no comittish was set then
+`master` will be used as the default.
+
+<<<<<<< HEAD
+For example `hostedGitInfo.fromUrl("git@github.com:npm/hosted-git-info.git#v1.0.0").file("package.json")`
+||||||| merged common ancestors
+For example `hostedGitInfo("git@github.com:npm/hosted-git-info.git").file("v1.0.0")`
+=======
+For example `hostedGitInfo.fromUrl("git@github.com:npm/hosted-git-info.git").file("v1.0.0")`
+>>>>>>> Another README fix
+would return `https://raw.githubusercontent.com/npm/hosted-git-info/v1.0.0/package.json`
+
+* info.shortcut()
+
+eg, `github:npm/hosted-git-info`
+
+* info.browse()
+
+eg, `https://github.com/npm/hosted-git-info/tree/v1.2.0`
+
+* info.bugs()
+
+eg, `https://github.com/npm/hosted-git-info/issues`
+
+* info.docs()
+
+eg, `https://github.com/npm/hosted-git-info/tree/v1.2.0#readme`
+
+* info.https()
+
+eg, `https://github.com/npm/hosted-git-info.git`
+
+* info.sshurl()
+
+eg, `git+ssh://git@github.com/npm/hosted-git-info.git`
+
+* info.ssh()
+
+eg, `git@github.com:npm/hosted-git-info.git`
+
+* info.path()
+
+eg, `npm/hosted-git-info`
+
+## Supported hosts
+
+Currently this supports Github, Bitbucket and Gitlab. Pull requests for
+additional hosts welcome.
+
diff --git a/node_modules/npm-package-arg/node_modules/hosted-git-info/index.js b/node_modules/npm-package-arg/node_modules/hosted-git-info/index.js
new file mode 100644
index 000000000..c2ad10a3b
--- /dev/null
+++ b/node_modules/npm-package-arg/node_modules/hosted-git-info/index.js
@@ -0,0 +1,208 @@
+"use strict"
+var url = require("url")
+
+var GitHost = exports = module.exports = function (type, user, project, comittish) {
+ this.type = type
+ this.domain = gitHosts[type].domain
+ this.filetemplate = gitHosts[type].filetemplate
+ this.sshtemplate = gitHosts[type].sshtemplate
+ this.sshurltemplate = gitHosts[type].sshurltemplate
+ this.browsetemplate = gitHosts[type].browsetemplate
+ this.docstemplate = gitHosts[type].docstemplate
+ this.bugstemplate = gitHosts[type].bugstemplate
+ this.gittemplate = gitHosts[type].gittemplate
+ this.httpstemplate = gitHosts[type].httpstemplate
+ this.treepath = gitHosts[type].treepath
+ this.user = user
+ this.project = project
+ this.comittish = comittish
+}
+GitHost.prototype = {}
+
+exports.fromUrl = function (giturl) {
+ if (giturl == null || giturl == "") return
+ var parsed = parseGitUrl(maybeGitHubShorthand(giturl) ? "github:" + giturl : giturl)
+ var matches = Object.keys(gitHosts).map(function(V) {
+ var gitHost = gitHosts[V]
+ var comittish = parsed.hash ? decodeURIComponent(parsed.hash.substr(1)) : null
+ if (parsed.protocol == V + ":") {
+ return new GitHost(V,
+ decodeURIComponent(parsed.host), decodeURIComponent(parsed.path.replace(/^[/](.*?)(?:[.]git)?$/, "$1")), comittish)
+ }
+ if (parsed.host != gitHost.domain) return
+ if (! gitHost.protocols_re.test(parsed.protocol)) return
+ var matched = parsed.path.match(gitHost.pathmatch)
+ if (! matched) return
+ return new GitHost(
+ V,
+ matched[1]!=null && decodeURIComponent(matched[1]),
+ matched[2]!=null && decodeURIComponent(matched[2]),
+ comittish)
+ }).filter(function(V){ return V })
+ if (matches.length != 1) return
+ return matches[0]
+}
+
+function maybeGitHubShorthand(arg) {
+ // Note: This does not fully test the git ref format.
+ // See https://www.kernel.org/pub/software/scm/git/docs/git-check-ref-format.html
+ //
+ // The only way to do this properly would be to shell out to
+ // git-check-ref-format, and as this is a fast sync function,
+ // we don't want to do that. Just let git fail if it turns
+ // out that the commit-ish is invalid.
+ // GH usernames cannot start with . or -
+ return /^[^:@%/\s.-][^:@%/\s]*[/][^:@\s/%]+(?:#.*)?$/.test(arg)
+}
+
+var parseGitUrl = function (giturl) {
+ if (typeof giturl != "string") giturl = "" + giturl
+ var matched = giturl.match(/^([^@]+)@([^:]+):[/]?((?:[^/]+[/])?[^/]+?)(?:[.]git)?(#.*)?$/)
+ if (! matched) return url.parse(giturl)
+ return {
+ protocol: "git+ssh:",
+ slashes: true,
+ auth: matched[1],
+ host: matched[2],
+ port: null,
+ hostname: matched[2],
+ hash: matched[4],
+ search: null,
+ query: null,
+ pathname: "/" + matched[3],
+ path: "/" + matched[3],
+ href: "git+ssh://" + matched[1] + "@" + matched[2] + "/" + matched[3] + (matched[4]||"")
+ }
+}
+
+var gitHostDefaults = {
+ "sshtemplate": "git@{domain}:{user}/{project}.git{#comittish}",
+ "sshurltemplate": "git+ssh://git@{domain}/{user}/{project}.git{#comittish}",
+ "browsetemplate": "https://{domain}/{user}/{project}{/tree/comittish}",
+ "docstemplate": "https://{domain}/{user}/{project}{/tree/comittish}#readme",
+ "httpstemplate": "https://{domain}/{user}/{project}.git{#comittish}",
+ "filetemplate": "https://{domain}/{user}/{project}/raw/{comittish}/{path}"
+}
+var gitHosts = {
+ github: {
+ // First two are insecure and generally shouldn't be used any more, but
+ // they are still supported.
+ "protocols": [ "git", "http", "git+ssh", "git+https", "ssh", "https" ],
+ "domain": "github.com",
+ "pathmatch": /^[/]([^/]+)[/]([^/]+?)(?:[.]git)?$/,
+ "treepath": "tree",
+ "filetemplate": "https://raw.githubusercontent.com/{user}/{project}/{comittish}/{path}",
+ "bugstemplate": "https://{domain}/{user}/{project}/issues",
+ "gittemplate": "git://{domain}/{user}/{project}.git{#comittish}"
+ },
+ bitbucket: {
+ "protocols": [ "git+ssh", "git+https", "ssh", "https" ],
+ "domain": "bitbucket.org",
+ "pathmatch": /^[/]([^/]+)[/]([^/]+?)(?:[.]git)?$/,
+ "treepath": "src"
+ },
+ gitlab: {
+ "protocols": [ "git+ssh", "git+https", "ssh", "https" ],
+ "domain": "gitlab.com",
+ "pathmatch": /^[/]([^/]+)[/]([^/]+?)(?:[.]git)?$/,
+ "treepath": "tree",
+ "docstemplate": "https://{domain}/{user}/{project}{/tree/comittish}#README",
+ "bugstemplate": "https://{domain}/{user}/{project}/issues"
+ },
+ gist: {
+ "protocols": [ "git", "git+ssh", "git+https", "ssh", "https" ],
+ "domain": "gist.github.com",
+ "pathmatch": /^[/](?:([^/]+)[/])?([a-z0-9]+)(?:[.]git)?$/,
+ "filetemplate": "https://gist.githubusercontent.com/{user}/{project}/raw{/comittish}/{path}",
+ "bugstemplate": "https://{domain}/{project}",
+ "gittemplate": "git://{domain}/{project}.git{#comittish}",
+ "sshtemplate": "git@{domain}:/{project}.git{#comittish}",
+ "sshurltemplate": "git+ssh://git@{domain}/{project}.git{#comittish}",
+ "browsetemplate": "https://{domain}/{project}{/comittish}",
+ "docstemplate": "https://{domain}/{project}{/comittish}",
+ "httpstemplate": "https://{domain}/{project}.git{#comittish}",
+ },
+}
+
+Object.keys(gitHosts).forEach(function(host) {
+ gitHosts[host].protocols_re = RegExp("^(" +
+ gitHosts[host].protocols.map(function(P){
+ return P.replace(/([\\+*{}()\[\]$^|])/g, "\\$1")
+ }).join("|") + "):$")
+})
+
+GitHost.prototype.shortcut = function () {
+ return this.type + ":" + this.path()
+}
+
+GitHost.prototype.hash = function () {
+ return this.comittish ? "#" + this.comittish : ""
+}
+
+GitHost.prototype.path = function () {
+ return this.user + "/" + this.project + this.hash()
+}
+
+GitHost.prototype._fill = function (template, vars) {
+ if (!template) throw new Error("Tried to fill without template")
+ if (!vars) vars = {}
+ var self = this
+ Object.keys(this).forEach(function(K){ if (self[K]!=null && vars[K]==null) vars[K] = self[K] })
+ var rawComittish = vars.comittish
+ Object.keys(vars).forEach(function(K){ (K[0]!='#') && (vars[K] = encodeURIComponent(vars[K])) })
+ vars["#comittish"] = rawComittish ? "#" + rawComittish : ""
+ vars["/tree/comittish"] = vars.comittish ? "/"+vars.treepath+"/" + vars.comittish : "",
+ vars["/comittish"] = vars.comittish ? "/" + vars.comittish : ""
+ vars.comittish = vars.comittish || "master"
+ var res = template
+ Object.keys(vars).forEach(function(K){
+ res = res.replace(new RegExp("[{]" + K + "[}]", "g"), vars[K])
+ })
+ return res
+}
+
+GitHost.prototype.ssh = function () {
+ var sshtemplate = this.sshtemplate || gitHostDefaults.sshtemplate
+ return this._fill(sshtemplate)
+}
+
+GitHost.prototype.sshurl = function () {
+ var sshurltemplate = this.sshurltemplate || gitHostDefaults.sshurltemplate
+ return this._fill(sshurltemplate)
+}
+
+GitHost.prototype.browse = function () {
+ var browsetemplate = this.browsetemplate || gitHostDefaults.browsetemplate
+ return this._fill(browsetemplate)
+}
+
+GitHost.prototype.docs = function () {
+ var docstemplate = this.docstemplate || gitHostDefaults.docstemplate
+ return this._fill(docstemplate)
+}
+
+GitHost.prototype.bugs = function() {
+ if (! this.bugstemplate) return
+ return this._fill(this.bugstemplate)
+}
+
+GitHost.prototype.https = function () {
+ var httpstemplate = this.httpstemplate || gitHostDefaults.httpstemplate
+ return this._fill(httpstemplate)
+}
+
+GitHost.prototype.git = function () {
+ if (! this.gittemplate) return
+ return this._fill(this.gittemplate)
+}
+
+GitHost.prototype.file = function (P) {
+ var filetemplate = this.filetemplate || gitHostDefaults.filetemplate
+ return this._fill(filetemplate, {
+ path: P.replace(/^[/]+/g, "")
+ })
+}
+
+GitHost.prototype.toString = function () {
+ return this[this.default||"sshurl"]()
+}
diff --git a/node_modules/npm-package-arg/node_modules/hosted-git-info/package.json b/node_modules/npm-package-arg/node_modules/hosted-git-info/package.json
new file mode 100644
index 000000000..00606f6a4
--- /dev/null
+++ b/node_modules/npm-package-arg/node_modules/hosted-git-info/package.json
@@ -0,0 +1,55 @@
+{
+ "name": "hosted-git-info",
+ "version": "1.5.3",
+ "description": "Provides metadata and conversions from repository urls for Github, Bitbucket and Gitlab",
+ "main": "index.js",
+ "repository": {
+ "type": "git",
+ "url": "git+https://github.com/npm/hosted-git-info.git"
+ },
+ "keywords": [
+ "git",
+ "github",
+ "bitbucket",
+ "gitlab"
+ ],
+ "author": {
+ "name": "Rebecca Turner",
+ "email": "me@re-becca.org",
+ "url": "http://re-becca.org"
+ },
+ "license": "ISC",
+ "bugs": {
+ "url": "https://github.com/npm/hosted-git-info/issues"
+ },
+ "homepage": "https://github.com/npm/hosted-git-info",
+ "scripts": {
+ "test": "tap test/*.js"
+ },
+ "devDependencies": {
+ "tap": "^0.4.13"
+ },
+ "gitHead": "153325f997813ebf8a7ae07b322b4fa89aa25f7d",
+ "_id": "hosted-git-info@1.5.3",
+ "_shasum": "1f46e25e9c0e207852fb7a4b94422ed5f09a03f5",
+ "_from": "hosted-git-info@>=1.5.3 <2.0.0",
+ "_npmVersion": "2.4.0",
+ "_nodeVersion": "0.10.33",
+ "_npmUser": {
+ "name": "iarna",
+ "email": "me@re-becca.org"
+ },
+ "maintainers": [
+ {
+ "name": "iarna",
+ "email": "me@re-becca.org"
+ }
+ ],
+ "dist": {
+ "shasum": "1f46e25e9c0e207852fb7a4b94422ed5f09a03f5",
+ "tarball": "http://registry.npmjs.org/hosted-git-info/-/hosted-git-info-1.5.3.tgz"
+ },
+ "directories": {},
+ "_resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-1.5.3.tgz",
+ "readme": "ERROR: No README data found!"
+}
diff --git a/node_modules/npm-package-arg/node_modules/hosted-git-info/test/basic.js b/node_modules/npm-package-arg/node_modules/hosted-git-info/test/basic.js
new file mode 100644
index 000000000..e56ef9a05
--- /dev/null
+++ b/node_modules/npm-package-arg/node_modules/hosted-git-info/test/basic.js
@@ -0,0 +1,9 @@
+"use strict"
+var HostedGit = require("../index")
+var test = require("tap").test
+
+test("basic", function (t) {
+ t.is(HostedGit.fromUrl("https://google.com"), undefined, "null on failure")
+
+ t.end()
+})
diff --git a/node_modules/npm-package-arg/node_modules/hosted-git-info/test/bitbucket.js b/node_modules/npm-package-arg/node_modules/hosted-git-info/test/bitbucket.js
new file mode 100644
index 000000000..089cb2819
--- /dev/null
+++ b/node_modules/npm-package-arg/node_modules/hosted-git-info/test/bitbucket.js
@@ -0,0 +1,24 @@
+"use strict"
+var HostedGit = require("../index")
+var test = require("tap").test
+
+test("fromUrl(bitbucket url)", function (t) {
+ function verify(host, label, branch) {
+ var hostinfo = HostedGit.fromUrl(host)
+ var hash = branch ? "#" + branch : ""
+ t.ok(hostinfo, label)
+ if (! hostinfo) return
+ t.is( hostinfo.https(), "https://bitbucket.org/111/222.git" + hash, label + " -> https" )
+ t.is( hostinfo.browse(), "https://bitbucket.org/111/222" + (branch ? "/src/" + branch : ""), label + " -> browse" )
+ t.is( hostinfo.docs(), "https://bitbucket.org/111/222" + (branch ? "/src/" + branch : "") + "#readme", label + " -> docs" )
+ t.is( hostinfo.ssh(), "git@bitbucket.org:111/222.git" + hash, label + " -> ssh" )
+ t.is( hostinfo.sshurl(), "git+ssh://git@bitbucket.org/111/222.git" + hash, label + " -> sshurl" )
+ t.is( (""+hostinfo), "git+ssh://git@bitbucket.org/111/222.git" + hash, label + " -> stringify" )
+ t.is( hostinfo.file("C"), "https://bitbucket.org/111/222/raw/"+(branch||"master")+"/C", label + " -> file" )
+ }
+
+ require('./lib/standard-tests')(verify, "bitbucket.org", "bitbucket")
+
+ t.end()
+})
+
diff --git a/node_modules/npm-package-arg/node_modules/hosted-git-info/test/gist.js b/node_modules/npm-package-arg/node_modules/hosted-git-info/test/gist.js
new file mode 100644
index 000000000..a316048cb
--- /dev/null
+++ b/node_modules/npm-package-arg/node_modules/hosted-git-info/test/gist.js
@@ -0,0 +1,40 @@
+"use strict"
+var HostedGit = require("../index")
+var test = require("tap").test
+
+
+test("fromUrl(gist url)", function (t) {
+ function verify(host, label, branch) {
+ var hostinfo = HostedGit.fromUrl(host)
+ var hash = branch ? "#" + branch : ""
+ t.ok(hostinfo, label)
+ if (! hostinfo) return
+ t.is( hostinfo.https(), "https://gist.github.com/222.git" + hash, label + " -> https" )
+ t.is( hostinfo.git(), "git://gist.github.com/222.git" + hash, label + " -> git" )
+ t.is( hostinfo.browse(), "https://gist.github.com/222" + (branch ? "/" + branch : ""), label + " -> browse" )
+ t.is( hostinfo.bugs(), "https://gist.github.com/222", label + " -> bugs" )
+ t.is( hostinfo.docs(), "https://gist.github.com/222" + (branch ? "/" + branch : ""), label + " -> docs" )
+ t.is( hostinfo.ssh(), "git@gist.github.com:/222.git" + hash, label + " -> ssh" )
+ t.is( hostinfo.sshurl(), "git+ssh://git@gist.github.com/222.git" + hash, label + " -> sshurl" )
+ t.is( (""+hostinfo), "git+ssh://git@gist.github.com/222.git" + hash, label + " -> stringify" )
+ if (hostinfo.user) {
+ t.is( hostinfo.file("C"), "https://gist.githubusercontent.com/111/222/raw/"+(branch?branch+"/":"")+"C", label + " -> file" )
+ }
+ }
+
+ verify("git@gist.github.com:222.git", "git@")
+ var hostinfo = HostedGit.fromUrl("git@gist.github.com:/ef860c7z5e0de3179341.git")
+ if (t.ok(hostinfo, "git@hex")) {
+ t.is( hostinfo.https(), "https://gist.github.com/ef860c7z5e0de3179341.git", "git@hex -> https" )
+ }
+ verify("git@gist.github.com:/222.git", "git@/")
+ verify("git://gist.github.com/222", "git")
+ verify("git://gist.github.com/222.git", "git.git")
+ verify("git://gist.github.com/222#branch", "git#branch", "branch")
+ verify("git://gist.github.com/222.git#branch", "git.git#branch", "branch")
+
+ require('./lib/standard-tests')(verify, "gist.github.com", "gist")
+
+ t.end()
+})
+
diff --git a/node_modules/npm-package-arg/node_modules/hosted-git-info/test/github.js b/node_modules/npm-package-arg/node_modules/hosted-git-info/test/github.js
new file mode 100644
index 000000000..e551c45d7
--- /dev/null
+++ b/node_modules/npm-package-arg/node_modules/hosted-git-info/test/github.js
@@ -0,0 +1,42 @@
+"use strict"
+var HostedGit = require("../index")
+var test = require("tap").test
+
+
+test("fromUrl(github url)", function (t) {
+ function verify(host, label, branch) {
+ var hostinfo = HostedGit.fromUrl(host)
+ var hash = branch ? "#" + branch : ""
+ t.ok(hostinfo, label)
+ if (! hostinfo) return
+ t.is( hostinfo.https(), "https://github.com/111/222.git" + hash, label + " -> https" )
+ t.is( hostinfo.git(), "git://github.com/111/222.git" + hash, label + " -> git" )
+ t.is( hostinfo.browse(), "https://github.com/111/222" + (branch ? "/tree/" + branch : ""), label + " -> browse" )
+ t.is( hostinfo.bugs(), "https://github.com/111/222/issues", label + " -> bugs" )
+ t.is( hostinfo.docs(), "https://github.com/111/222" + (branch ? "/tree/" + branch : "") + "#readme", label + " -> docs" )
+ t.is( hostinfo.ssh(), "git@github.com:111/222.git" + hash, label + " -> ssh" )
+ t.is( hostinfo.sshurl(), "git+ssh://git@github.com/111/222.git" + hash, label + " -> sshurl" )
+ t.is( (""+hostinfo), "git+ssh://git@github.com/111/222.git" + hash, label + " -> stringify" )
+ t.is( hostinfo.file("C"), "https://raw.githubusercontent.com/111/222/"+(branch||"master")+"/C", label + " -> file" )
+ }
+
+ // github shorturls
+ verify("111/222", "github-short")
+ verify("111/222#branch", "github-short#branch", "branch")
+
+ // insecure protocols
+ verify("git://github.com/111/222", "git")
+ verify("git://github.com/111/222.git", "git.git")
+ verify("git://github.com/111/222#branch", "git#branch", "branch")
+ verify("git://github.com/111/222.git#branch", "git.git#branch", "branch")
+
+ verify("http://github.com/111/222", "http")
+ verify("http://github.com/111/222.git", "http.git")
+ verify("http://github.com/111/222#branch", "http#branch", "branch")
+ verify("http://github.com/111/222.git#branch", "http.git#branch", "branch")
+
+ require('./lib/standard-tests')(verify, "github.com", "github")
+
+ t.end()
+})
+
diff --git a/node_modules/npm-package-arg/node_modules/hosted-git-info/test/gitlab.js b/node_modules/npm-package-arg/node_modules/hosted-git-info/test/gitlab.js
new file mode 100644
index 000000000..1a4e07096
--- /dev/null
+++ b/node_modules/npm-package-arg/node_modules/hosted-git-info/test/gitlab.js
@@ -0,0 +1,25 @@
+"use strict"
+var HostedGit = require("../index")
+var test = require("tap").test
+
+
+test("fromUrl(gitlab url)", function (t) {
+ function verify(host, label, branch) {
+ var hostinfo = HostedGit.fromUrl(host)
+ var hash = branch ? "#" + branch : ""
+ t.ok(hostinfo, label)
+ if (! hostinfo) return
+ t.is( hostinfo.https(), "https://gitlab.com/111/222.git" + hash, label + " -> https" )
+ t.is( hostinfo.browse(), "https://gitlab.com/111/222" + (branch ? "/tree/" + branch : ""), label + " -> browse" )
+ t.is( hostinfo.docs(), "https://gitlab.com/111/222" + (branch ? "/tree/" + branch : "") + "#README", label + " -> docs" )
+ t.is( hostinfo.ssh(), "git@gitlab.com:111/222.git" + hash, label + " -> ssh" )
+ t.is( hostinfo.sshurl(), "git+ssh://git@gitlab.com/111/222.git" + hash, label + " -> sshurl" )
+ t.is( (""+hostinfo), "git+ssh://git@gitlab.com/111/222.git" + hash, label + " -> stringify" )
+ t.is( hostinfo.file("C"), "https://gitlab.com/111/222/raw/"+(branch||"master")+"/C", label + " -> file" )
+ }
+
+ require('./lib/standard-tests')(verify, "gitlab.com", "gitlab")
+
+ t.end()
+})
+
diff --git a/node_modules/npm-package-arg/node_modules/hosted-git-info/test/lib/standard-tests.js b/node_modules/npm-package-arg/node_modules/hosted-git-info/test/lib/standard-tests.js
new file mode 100644
index 000000000..c505342fa
--- /dev/null
+++ b/node_modules/npm-package-arg/node_modules/hosted-git-info/test/lib/standard-tests.js
@@ -0,0 +1,28 @@
+"use strict"
+module.exports = function (verify, domain, shortname) {
+ verify("https://" + domain + "/111/222", "https")
+ verify("https://" + domain + "/111/222.git", "https.git")
+ verify("https://" + domain + "/111/222#branch", "https#branch", "branch")
+ verify("https://" + domain + "/111/222.git#branch", "https.git#branch", "branch")
+
+ verify("git+https://" + domain + "/111/222", "git+https")
+ verify("git+https://" + domain + "/111/222.git", "git+https.git")
+ verify("git+https://" + domain + "/111/222#branch", "git+https#branch", "branch")
+ verify("git+https://" + domain + "/111/222.git#branch", "git+https.git#branch", "branch")
+
+ verify("git@" + domain + ":111/222", "ssh")
+ verify("git@" + domain + ":111/222.git", "ssh.git")
+ verify("git@" + domain + ":111/222#branch", "ssh", "branch")
+ verify("git@" + domain + ":111/222.git#branch", "ssh.git", "branch")
+
+
+ verify("git+ssh://git@" + domain + "/111/222", "ssh url")
+ verify("git+ssh://git@" + domain + "/111/222.git", "ssh url.git")
+ verify("git+ssh://git@" + domain + "/111/222#branch", "ssh url#branch", "branch")
+ verify("git+ssh://git@" + domain + "/111/222.git#branch", "ssh url.git#branch", "branch")
+
+ verify(shortname + ":111/222", "shortcut")
+ verify(shortname + ":111/222.git", "shortcut.git")
+ verify(shortname + ":111/222#branch", "shortcut#branch", "branch")
+ verify(shortname + ":111/222.git#branch", "shortcut.git#branch", "branch")
+}
diff --git a/node_modules/npm-package-arg/npa.js b/node_modules/npm-package-arg/npa.js
index 8333c75f4..883c5401b 100644
--- a/node_modules/npm-package-arg/npa.js
+++ b/node_modules/npm-package-arg/npa.js
@@ -3,14 +3,15 @@ var assert = require("assert")
var util = require("util")
var semver = require("semver")
var path = require("path")
+var HostedGit = require("hosted-git-info")
module.exports = npa
var isWindows = process.platform === "win32" || global.FAKE_WINDOWS
-var slashRe = isWindows ? /\\|\// : /\//
+var slashRe = isWindows ? /\\|[/]/ : /[/]/
-var parseName = /^(?:@([^\/]+?)\/)?([^\/]+?)$/
-var nameAt = /^(@([^\/]+?)\/)?([^\/]+?)@/
+var parseName = /^(?:@([^/]+?)[/])?([^/]+?)$/
+var nameAt = /^(@([^/]+?)[/])?([^/]+?)@/
var debug = util.debuglog ? util.debuglog("npa")
: /\bnpa\b/i.test(process.env.NODE_DEBUG || "")
? function () {
@@ -25,7 +26,7 @@ function validName (name) {
var n = name.trim()
if (!n || n.charAt(0) === "."
|| !n.match(/^[a-zA-Z0-9]/)
- || n.match(/[\/\(\)&\?#\|<>@:%\s\\\*'"!~`]/)
+ || n.match(/[/()&?#|<>@:%\s\\*'"!~`]/)
|| n.toLowerCase() === "node_modules"
|| n !== encodeURIComponent(n)
|| n.toLowerCase() === "favicon.ico") {
@@ -70,20 +71,11 @@ function npa (arg) {
urlparse = {}
}
- if (urlparse.protocol) {
+ if (urlparse.protocol || HostedGit.fromUrl(arg)) {
return parseUrl(res, arg, urlparse)
}
- // parse git stuff
- // parse tag/range/local/remote
-
- if (maybeGitHubShorthand(arg)) {
- res.type = "github"
- res.spec = arg
- return res
- }
-
- // at this point, it's not a url, and not github
+ // at this point, it's not a url, and not hosted
// If it's a valid name, and doesn't already have a name, then assume
// $name@"" range
//
@@ -132,19 +124,20 @@ function parseLocal (res, arg) {
res.spec = path.resolve(arg)
}
-function maybeGitHubShorthand (arg) {
- // Note: This does not fully test the git ref format.
- // See https://www.kernel.org/pub/software/scm/git/docs/git-check-ref-format.html
- //
- // The only way to do this properly would be to shell out to
- // git-check-ref-format, and as this is a fast sync function,
- // we don't want to do that. Just let git fail if it turns
- // out that the commit-ish is invalid.
- // GH usernames cannot start with . or -
- return /^[^@%\/\s\.-][^@%\/\s]*\/[^@\s\/%]+(?:#.*)?$/.test(arg)
-}
-
function parseUrl (res, arg, urlparse) {
+ var gitHost = HostedGit.fromUrl(arg)
+ if (gitHost) {
+ res.type = "hosted"
+ res.spec = gitHost.toString(),
+ res.hosted = {
+ type: gitHost.type,
+ ssh: gitHost.ssh(),
+ sshUrl: gitHost.sshurl(),
+ httpsUrl: gitHost.https(),
+ directUrl: gitHost.file("package.json")
+ }
+ return res
+ }
// check the protocol, and then see if it's git or not
switch (urlparse.protocol) {
case "git:":
@@ -154,23 +147,23 @@ function parseUrl (res, arg, urlparse) {
case "git+ftp:":
case "git+ssh:":
case "git+file:":
- res.type = 'git'
- res.spec = arg.replace(/^git\+/, '')
+ res.type = "git"
+ res.spec = arg.replace(/^git[+]/, "")
break
- case 'http:':
- case 'https:':
- res.type = 'remote'
+ case "http:":
+ case "https:":
+ res.type = "remote"
res.spec = arg
break
- case 'file:':
- res.type = 'local'
+ case "file:":
+ res.type = "local"
res.spec = urlparse.pathname
- break;
+ break
default:
- throw new Error('Unsupported URL Type: ' + arg)
+ throw new Error("Unsupported URL Type: " + arg)
break
}
@@ -181,7 +174,8 @@ function parseUrl (res, arg, urlparse) {
function Result () {
if (!(this instanceof Result)) return new Result
}
-Result.prototype.name = null
-Result.prototype.type = null
-Result.prototype.spec = null
-Result.prototype.raw = null
+Result.prototype.name = null
+Result.prototype.type = null
+Result.prototype.spec = null
+Result.prototype.raw = null
+Result.prototype.hosted = null
diff --git a/node_modules/npm-package-arg/package.json b/node_modules/npm-package-arg/package.json
index babbd7312..b742b6f4d 100644
--- a/node_modules/npm-package-arg/package.json
+++ b/node_modules/npm-package-arg/package.json
@@ -1,12 +1,13 @@
{
"name": "npm-package-arg",
- "version": "2.1.3",
+ "version": "3.1.1",
"description": "Parse the things that can be arguments to `npm install`",
"main": "npa.js",
"directories": {
"test": "test"
},
"dependencies": {
+ "hosted-git-info": "^1.5.3",
"semver": "4"
},
"devDependencies": {
@@ -29,10 +30,34 @@
"url": "https://github.com/npm/npm-package-arg/issues"
},
"homepage": "https://github.com/npm/npm-package-arg",
- "readme": "# npm-package-arg\n\nParse the things that can be arguments to `npm install`\n\nTakes an argument like `foo@1.2`, or `foo@user/foo`, or\n`http://x.com/foo.tgz`, or `git+https://github.com/user/foo`, and\nfigures out what type of thing it is.\n\n## USAGE\n\n```javascript\nvar assert = require(\"assert\")\nvar npa = require(\"npm-package-arg\")\n\n// Pass in the descriptor, and it'll return an object\nvar parsed = npa(\"foo@1.2\")\n\n// Returns an object like:\n// {\n// name: \"foo\", // The bit in front of the @\n// type: \"range\", // the type of descriptor this is\n// spec: \"1.2\" // the specifier for this descriptor\n// }\n\n// Completely unreasonable invalid garbage throws an error\n// Make sure you wrap this in a try/catch if you have not\n// already sanitized the inputs!\nassert.throws(function() {\n npa(\"this is not \\0 a valid package name or url\")\n})\n```\n\nFor more examples, see the test file.\n\n## Result Objects\n\nThe objects that are returned by npm-package-arg contain the following\nfields:\n\n* `name` - If known, the `name` field expected in the resulting pkg.\n* `type` - One of the following strings:\n * `git` - A git repo\n * `github` - A github shorthand, like `user/project`\n * `tag` - A tagged version, like `\"foo@latest\"`\n * `version` - A specific version number, like `\"foo@1.2.3\"`\n * `range` - A version range, like `\"foo@2.x\"`\n * `local` - A local file or folder path\n * `remote` - An http url (presumably to a tgz)\n* `spec` - The \"thing\". URL, the range, git repo, etc.\n* `raw` - The original un-modified string that was provided.\n* `rawSpec` - The part after the `name@...`, as it was originally\n provided.\n* `scope` - If a name is something like `@org/module` then the `scope`\n field will be set to `org`. If it doesn't have a scoped name, then\n scope is `null`.\n",
- "readmeFilename": "README.md",
- "gitHead": "9aaabc2aae746371a05f54cdb57a5f9ada003d8f",
- "_id": "npm-package-arg@2.1.3",
- "_shasum": "dfba34bd82dd327c10cb43a65c8db6ef0b812bf7",
- "_from": "npm-package-arg@~2.1.3"
+ "gitHead": "1dc802d4b449f1599c7275bb948c6ecd265c23a8",
+ "_id": "npm-package-arg@3.1.1",
+ "_shasum": "c9e5f7587f8484d1372a9b386fbf8b2443fc1bdb",
+ "_from": "npm-package-arg@>=3.1.1 <3.2.0",
+ "_npmVersion": "2.6.1",
+ "_nodeVersion": "1.1.0",
+ "_npmUser": {
+ "name": "iarna",
+ "email": "me@re-becca.org"
+ },
+ "maintainers": [
+ {
+ "name": "isaacs",
+ "email": "i@izs.me"
+ },
+ {
+ "name": "othiym23",
+ "email": "ogd@aoaioxxysz.net"
+ },
+ {
+ "name": "iarna",
+ "email": "me@re-becca.org"
+ }
+ ],
+ "dist": {
+ "shasum": "c9e5f7587f8484d1372a9b386fbf8b2443fc1bdb",
+ "tarball": "http://registry.npmjs.org/npm-package-arg/-/npm-package-arg-3.1.1.tgz"
+ },
+ "_resolved": "https://registry.npmjs.org/npm-package-arg/-/npm-package-arg-3.1.1.tgz",
+ "readme": "ERROR: No README data found!"
}
diff --git a/node_modules/npm-package-arg/test/basic.js b/node_modules/npm-package-arg/test/basic.js
index 98206db20..4991ffcd3 100644
--- a/node_modules/npm-package-arg/test/basic.js
+++ b/node_modules/npm-package-arg/test/basic.js
@@ -63,11 +63,11 @@ require("tap").test("basic", function (t) {
rawSpec: "=v1.2.3"
},
- "git+ssh://git@github.com/user/foo#1.2.3": {
+ "git+ssh://git@notgithub.com/user/foo#1.2.3": {
name: null,
type: "git",
- spec: "ssh://git@github.com/user/foo#1.2.3",
- raw: "git+ssh://git@github.com/user/foo#1.2.3"
+ spec: "ssh://git@notgithub.com/user/foo#1.2.3",
+ raw: "git+ssh://git@notgithub.com/user/foo#1.2.3"
},
"git+file://path/to/repo#1.2.3": {
@@ -77,19 +77,19 @@ require("tap").test("basic", function (t) {
raw: "git+file://path/to/repo#1.2.3"
},
- "git://github.com/user/foo": {
+ "git://notgithub.com/user/foo": {
name: null,
type: "git",
- spec: "git://github.com/user/foo",
- raw: "git://github.com/user/foo"
+ spec: "git://notgithub.com/user/foo",
+ raw: "git://notgithub.com/user/foo"
},
- "@foo/bar@git+ssh://github.com/user/foo": {
+ "@foo/bar@git+ssh://notgithub.com/user/foo": {
name: "@foo/bar",
scope: "@foo",
- spec: "ssh://github.com/user/foo",
- rawSpec: "git+ssh://github.com/user/foo",
- raw: "@foo/bar@git+ssh://github.com/user/foo"
+ spec: "ssh://notgithub.com/user/foo",
+ rawSpec: "git+ssh://notgithub.com/user/foo",
+ raw: "@foo/bar@git+ssh://notgithub.com/user/foo"
},
"/path/to/foo": {
@@ -134,41 +134,6 @@ require("tap").test("basic", function (t) {
raw: "https://server.com/foo.tgz"
},
- "user/foo-js": {
- name: null,
- type: "github",
- spec: "user/foo-js",
- raw: "user/foo-js"
- },
-
- "user/foo-js#bar/baz": {
- name: null,
- type: "github",
- spec: "user/foo-js#bar/baz",
- raw: "user/foo-js#bar/baz"
- },
-
- "user..blerg--/..foo-js# . . . . . some . tags / / /": {
- name: null,
- type: "github",
- spec: "user..blerg--/..foo-js# . . . . . some . tags / / /",
- raw: "user..blerg--/..foo-js# . . . . . some . tags / / /"
- },
-
- "user/foo-js#bar/baz/bin": {
- name: null,
- type: "github",
- spec: "user/foo-js#bar/baz/bin",
- raw: "user/foo-js#bar/baz/bin"
- },
-
- "foo@user/foo-js": {
- name: "foo",
- type: "github",
- spec: "user/foo-js",
- raw: "foo@user/foo-js"
- },
-
"foo@latest": {
name: "foo",
type: "tag",
@@ -186,8 +151,8 @@ require("tap").test("basic", function (t) {
Object.keys(tests).forEach(function (arg) {
var res = npa(arg)
- t.type(res, "Result")
- t.has(res, tests[arg])
+ t.type(res, "Result", arg + " is result")
+ t.has(res, tests[arg], arg + " matches expectations")
})
// Completely unreasonable invalid garbage throws an error
diff --git a/node_modules/npm-package-arg/test/bitbucket.js b/node_modules/npm-package-arg/test/bitbucket.js
new file mode 100644
index 000000000..48bbdbcf9
--- /dev/null
+++ b/node_modules/npm-package-arg/test/bitbucket.js
@@ -0,0 +1,82 @@
+var npa = require("../npa.js")
+var path = require("path")
+
+require("tap").test("basic", function (t) {
+ t.setMaxListeners(999)
+
+ var tests = {
+ "bitbucket:user/foo-js": {
+ name: null,
+ type: "hosted",
+ hosted: { type: "bitbucket" },
+ spec: "git+ssh://git@bitbucket.org/user/foo-js.git",
+ raw: "bitbucket:user/foo-js"
+ },
+
+ "bitbucket:user/foo-js#bar/baz": {
+ name: null,
+ type: "hosted",
+ hosted: { type: "bitbucket" },
+ spec: "git+ssh://git@bitbucket.org/user/foo-js.git#bar/baz",
+ raw: "bitbucket:user/foo-js#bar/baz"
+ },
+
+ "bitbucket:user..blerg--/..foo-js# . . . . . some . tags / / /": {
+ name: null,
+ type: "hosted",
+ hosted: { type: "bitbucket" },
+ spec: "git+ssh://git@bitbucket.org/user..blerg--/..foo-js.git# . . . . . some . tags / / /",
+ raw: "bitbucket:user..blerg--/..foo-js# . . . . . some . tags / / /"
+ },
+
+ "bitbucket:user/foo-js#bar/baz/bin": {
+ name: null,
+ type: "hosted",
+ hosted: { type: "bitbucket" },
+ spec: "git+ssh://git@bitbucket.org/user/foo-js.git#bar/baz/bin",
+ raw: "bitbucket:user/foo-js#bar/baz/bin"
+ },
+
+ "foo@bitbucket:user/foo-js": {
+ name: "foo",
+ type: "hosted",
+ hosted: { type: "bitbucket" },
+ spec: "git+ssh://git@bitbucket.org/user/foo-js.git",
+ raw: "foo@bitbucket:user/foo-js"
+ },
+
+ "git+ssh://git@bitbucket.org/user/foo#1.2.3": {
+ name: null,
+ type: "hosted",
+ hosted: { type: "bitbucket" },
+ spec: "git+ssh://git@bitbucket.org/user/foo.git#1.2.3",
+ raw: "git+ssh://git@bitbucket.org/user/foo#1.2.3"
+ },
+
+ "https://bitbucket.org/user/foo.git": {
+ name: null,
+ type: "hosted",
+ hosted: { type: "bitbucket" },
+ spec: "git+ssh://git@bitbucket.org/user/foo.git",
+ raw: "https://bitbucket.org/user/foo.git"
+ },
+
+ "@foo/bar@git+ssh://bitbucket.org/user/foo": {
+ name: "@foo/bar",
+ scope: "@foo",
+ type: "hosted",
+ hosted: { type: "bitbucket" },
+ spec: "git+ssh://git@bitbucket.org/user/foo.git",
+ rawSpec: "git+ssh://bitbucket.org/user/foo",
+ raw: "@foo/bar@git+ssh://bitbucket.org/user/foo"
+ }
+ }
+
+ Object.keys(tests).forEach(function (arg) {
+ var res = npa(arg)
+ t.type(res, "Result", arg + " is a result")
+ t.has(res, tests[arg], arg + " matches expectations")
+ })
+
+ t.end()
+})
diff --git a/node_modules/npm-package-arg/test/github.js b/node_modules/npm-package-arg/test/github.js
new file mode 100644
index 000000000..63fd26c10
--- /dev/null
+++ b/node_modules/npm-package-arg/test/github.js
@@ -0,0 +1,106 @@
+var npa = require("../npa.js")
+var path = require("path")
+
+require("tap").test("basic", function (t) {
+ t.setMaxListeners(999)
+
+ var tests = {
+ "user/foo-js": {
+ name: null,
+ type: "hosted",
+ hosted: { type: "github" },
+ spec: "git+ssh://git@github.com/user/foo-js.git",
+ raw: "user/foo-js"
+ },
+
+ "user/foo-js#bar/baz": {
+ name: null,
+ type: "hosted",
+ hosted: { type: "github" },
+ spec: "git+ssh://git@github.com/user/foo-js.git#bar/baz",
+ raw: "user/foo-js#bar/baz"
+ },
+
+ "user..blerg--/..foo-js# . . . . . some . tags / / /": {
+ name: null,
+ type: "hosted",
+ hosted: { type: "github" },
+ spec: "git+ssh://git@github.com/user..blerg--/..foo-js.git# . . . . . some . tags / / /",
+ raw: "user..blerg--/..foo-js# . . . . . some . tags / / /"
+ },
+
+ "user/foo-js#bar/baz/bin": {
+ name: null,
+ type: "hosted",
+ hosted: { type: "github" },
+ spec: "git+ssh://git@github.com/user/foo-js.git#bar/baz/bin",
+ raw: "user/foo-js#bar/baz/bin"
+ },
+
+ "foo@user/foo-js": {
+ name: "foo",
+ type: "hosted",
+ hosted: { type: "github" },
+ spec: "git+ssh://git@github.com/user/foo-js.git",
+ raw: "foo@user/foo-js"
+ },
+
+ "github:user/foo-js": {
+ name: null,
+ type: "hosted",
+ hosted: { type: "github" },
+ spec: "git+ssh://git@github.com/user/foo-js.git",
+ raw: "github:user/foo-js"
+ },
+
+ "git+ssh://git@github.com/user/foo#1.2.3": {
+ name: null,
+ type: "hosted",
+ hosted: { type: "github" },
+ spec: "git+ssh://git@github.com/user/foo.git#1.2.3",
+ raw: "git+ssh://git@github.com/user/foo#1.2.3"
+ },
+
+ "git://github.com/user/foo": {
+ name: null,
+ type: "hosted",
+ hosted: { type: "github" },
+ spec: "git+ssh://git@github.com/user/foo.git",
+ raw: "git://github.com/user/foo"
+ },
+
+ "https://github.com/user/foo.git": {
+ name: null,
+ type: "hosted",
+ hosted: { type: "github" },
+ spec: "git+ssh://git@github.com/user/foo.git",
+ raw: "https://github.com/user/foo.git"
+ },
+
+ "@foo/bar@git+ssh://github.com/user/foo": {
+ name: "@foo/bar",
+ scope: "@foo",
+ type: "hosted",
+ hosted: { type: "github" },
+ spec: "git+ssh://git@github.com/user/foo.git",
+ rawSpec: "git+ssh://github.com/user/foo",
+ raw: "@foo/bar@git+ssh://github.com/user/foo"
+ },
+
+ "foo@bar/foo": {
+ name: "foo",
+ type: "hosted",
+ hosted: { type: "github" },
+ spec: "git+ssh://git@github.com/bar/foo.git",
+ raw: "foo@bar/foo"
+ }
+ }
+
+ Object.keys(tests).forEach(function (arg) {
+ var res = npa(arg)
+ t.type(res, "Result", arg + " is a result")
+ t.has(res, tests[arg], arg + " matches expectations")
+ })
+
+ t.end()
+})
diff --git a/node_modules/npm-package-arg/test/gitlab.js b/node_modules/npm-package-arg/test/gitlab.js
new file mode 100644
index 000000000..36ea016db
--- /dev/null
+++ b/node_modules/npm-package-arg/test/gitlab.js
@@ -0,0 +1,82 @@
+var npa = require("../npa.js")
+var path = require("path")
+
+require("tap").test("basic", function (t) {
+ t.setMaxListeners(999)
+
+ var tests = {
+ "gitlab:user/foo-js": {
+ name: null,
+ type: "hosted",
+ hosted: { type: "gitlab" },
+ spec: "git+ssh://git@gitlab.com/user/foo-js.git",
+ raw: "gitlab:user/foo-js"
+ },
+
+ "gitlab:user/foo-js#bar/baz": {
+ name: null,
+ type: "hosted",
+ hosted: { type: "gitlab" },
+ spec: "git+ssh://git@gitlab.com/user/foo-js.git#bar/baz",
+ raw: "gitlab:user/foo-js#bar/baz"
+ },
+
+ "gitlab:user..blerg--/..foo-js# . . . . . some . tags / / /": {
+ name: null,
+ type: "hosted",
+ hosted: { type: "gitlab" },
+ spec: "git+ssh://git@gitlab.com/user..blerg--/..foo-js.git# . . . . . some . tags / / /",
+ raw: "gitlab:user..blerg--/..foo-js# . . . . . some . tags / / /"
+ },
+
+ "gitlab:user/foo-js#bar/baz/bin": {
+ name: null,
+ type: "hosted",
+ hosted: { type: "gitlab" },
+ spec: "git+ssh://git@gitlab.com/user/foo-js.git#bar/baz/bin",
+ raw: "gitlab:user/foo-js#bar/baz/bin"
+ },
+
+ "foo@gitlab:user/foo-js": {
+ name: "foo",
+ type: "hosted",
+ hosted: { type: "gitlab" },
+ spec: "git+ssh://git@gitlab.com/user/foo-js.git",
+ raw: "foo@gitlab:user/foo-js"
+ },
+
+ "git+ssh://git@gitlab.com/user/foo#1.2.3": {
+ name: null,
+ type: "hosted",
+ hosted: { type: "gitlab" },
+ spec: "git+ssh://git@gitlab.com/user/foo.git#1.2.3",
+ raw: "git+ssh://git@gitlab.com/user/foo#1.2.3"
+ },
+
+ "https://gitlab.com/user/foo.git": {
+ name: null,
+ type: "hosted",
+ hosted: { type: "gitlab" },
+ spec: "git+ssh://git@gitlab.com/user/foo.git",
+ raw: "https://gitlab.com/user/foo.git"
+ },
+
+ "@foo/bar@git+ssh://gitlab.com/user/foo": {
+ name: "@foo/bar",
+ scope: "@foo",
+ type: "hosted",
+ hosted: { type: "gitlab" },
+ spec: "git+ssh://git@gitlab.com/user/foo.git",
+ rawSpec: "git+ssh://gitlab.com/user/foo",
+ raw: "@foo/bar@git+ssh://gitlab.com/user/foo"
+ }
+ }
+
+ Object.keys(tests).forEach(function (arg) {
+ var res = npa(arg)
+ t.type(res, "Result", arg + " is a result")
+ t.has(res, tests[arg], arg + " matches expectations")
+ })
+
+ t.end()
+})
diff --git a/node_modules/npm-package-arg/test/windows.js b/node_modules/npm-package-arg/test/windows.js
index 51629fe07..e3c8ba6b5 100644
--- a/node_modules/npm-package-arg/test/windows.js
+++ b/node_modules/npm-package-arg/test/windows.js
@@ -6,28 +6,28 @@ var path = require("path")
var cases = {
"C:\\x\\y\\z": {
- raw: 'C:\\x\\y\\z',
+ raw: "C:\\x\\y\\z",
scope: null,
name: null,
- rawSpec: 'C:\\x\\y\\z',
- spec: path.resolve('C:\\x\\y\\z'),
- type: 'local'
+ rawSpec: "C:\\x\\y\\z",
+ spec: path.resolve("C:\\x\\y\\z"),
+ type: "local"
},
"foo@C:\\x\\y\\z": {
- raw: 'foo@C:\\x\\y\\z',
+ raw: "foo@C:\\x\\y\\z",
scope: null,
- name: 'foo',
- rawSpec: 'C:\\x\\y\\z',
- spec: path.resolve('C:\\x\\y\\z'),
- type: 'local'
+ name: "foo",
+ rawSpec: "C:\\x\\y\\z",
+ spec: path.resolve("C:\\x\\y\\z"),
+ type: "local"
},
"foo@/foo/bar/baz": {
- raw: 'foo@/foo/bar/baz',
+ raw: "foo@/foo/bar/baz",
scope: null,
- name: 'foo',
- rawSpec: '/foo/bar/baz',
- spec: path.resolve('/foo/bar/baz'),
- type: 'local'
+ name: "foo",
+ rawSpec: "/foo/bar/baz",
+ spec: path.resolve("/foo/bar/baz"),
+ type: "local"
}
}