diff options
author | Rebecca Turner <me@re-becca.org> | 2015-05-22 03:15:46 +0300 |
---|---|---|
committer | Rebecca Turner <me@re-becca.org> | 2015-05-22 03:15:46 +0300 |
commit | 6d74a2d2ac7f92750cf6a2cfafae1af23b569098 (patch) | |
tree | 9733b63ec36271b841a6ed06164b8ebf6c194005 | |
parent | e9267830ab261c751f12723e84d2458ae9238646 (diff) |
npm-package-arg@4.0.1
-rw-r--r-- | node_modules/npm-package-arg/package.json | 14 | ||||
-rw-r--r-- | node_modules/npm-package-arg/test/basic.js | 2 | ||||
-rw-r--r-- | node_modules/npm-package-arg/test/bitbucket.js | 2 | ||||
-rw-r--r-- | node_modules/npm-package-arg/test/bitbucket.js~ | 82 | ||||
-rw-r--r-- | node_modules/npm-package-arg/test/github.js | 2 | ||||
-rw-r--r-- | node_modules/npm-package-arg/test/github.js~ | 106 | ||||
-rw-r--r-- | node_modules/npm-package-arg/test/gitlab.js | 2 | ||||
-rw-r--r-- | node_modules/npm-package-arg/test/gitlab.js~ | 82 | ||||
-rw-r--r-- | package.json | 2 |
9 files changed, 282 insertions, 12 deletions
diff --git a/node_modules/npm-package-arg/package.json b/node_modules/npm-package-arg/package.json index 5cf76757f..0be06bb05 100644 --- a/node_modules/npm-package-arg/package.json +++ b/node_modules/npm-package-arg/package.json @@ -1,13 +1,13 @@ { "name": "npm-package-arg", - "version": "4.0.0", + "version": "4.0.1", "description": "Parse the things that can be arguments to `npm install`", "main": "npa.js", "directories": { "test": "test" }, "dependencies": { - "hosted-git-info": "^2.0.2", + "hosted-git-info": "^2.1.4", "semver": "4" }, "devDependencies": { @@ -18,7 +18,7 @@ }, "repository": { "type": "git", - "url": "https://github.com/npm/npm-package-arg" + "url": "git+https://github.com/npm/npm-package-arg.git" }, "author": { "name": "Isaac Z. Schlueter", @@ -30,10 +30,10 @@ "url": "https://github.com/npm/npm-package-arg/issues" }, "homepage": "https://github.com/npm/npm-package-arg", - "gitHead": "25ac404d9f3b77b14be9b05a7dafd9cb99557fdc", "readme": "# npm-package-arg\n\nParse package name and specifier passed to commands like `npm install` or\n`npm cache add`. This just parses the text given-- it's worth noting that\n`npm` has further logic it applies by looking at your disk to figure out\nwhat ambiguous specifiers are. If you want that logic, please see\n[realize-package-specifier].\n\n[realize-package-specifier]: https://www.npmjs.org/package/realize-package-specifier\n\nArguments look like: `foo@1.2`, `@bar/foo@1.2`, `foo@user/foo`, `http://x.com/foo.tgz`,\n`git+https://github.com/user/foo`, `bitbucket:user/foo`, `foo.tar.gz` or `bar`\n\n## EXAMPLES\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(\"@bar/foo@1.2\")\n\n// Returns an object like:\n{\n raw: '@bar/foo@1.2', // what was passed in\n name: \"@bar/foo\", // the name of the package\n scope: \"@bar\", // the private scope of the package, or null\n type: \"range\", // the type of specifier this is\n spec: \">=1.2.0 <1.3.0\" // the expanded specifier\n rawSpec: \"1.2\" // the specifier as passed in\n }\n\n// Parsing urls pointing at hosted git services produces a variation:\nvar parsed = npa(\"git+https://github.com/user/foo\")\n\n// Returns an object like:\n{\n raw: 'git+https://github.com/user/foo',\n scope: null,\n name: null,\n rawSpec: 'git+https://github.com/user/foo',\n spec: 'user/foo',\n type: 'hosted',\n hosted: {\n type: 'github',\n ssh: 'git@github.com:user/foo.git',\n sshurl: 'git+ssh://git@github.com/user/foo.git',\n https: 'https://github.com/user/foo.git',\n directUrl: 'https://raw.githubusercontent.com/user/foo/master/package.json'\n }\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\n## USING\n\n`var npa = require('npm-package-arg')`\n\n* var result = npa(*arg*)\n\nParses *arg* and returns a result object detailing what *arg* is.\n\n*arg* -- a package descriptor, like: `foo@1.2`, or `foo@user/foo`, or\n`http://x.com/foo.tgz`, or `git+https://github.com/user/foo`\n\n## RESULT OBJECT\n\nThe objects that are returned by npm-package-arg contain the following\nkeys:\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 * `hosted` - A hosted project, from github, bitbucket or gitlab. Originally\n either a full url pointing at one of these services or a shorthand like\n `user/project` or `github:user/project` for github or `bitbucket:user/project`\n for bitbucket.\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* `hosted` - If type=hosted this will be an object with the following keys:\n * `type` - github, bitbucket or gitlab\n * `ssh` - The ssh path for this git repo\n * `sshUrl` - The ssh URL for this git repo\n * `httpsUrl` - The HTTPS URL for this git repo\n * `directUrl` - The URL for the package.json in this git repo\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", - "_id": "npm-package-arg@4.0.0", - "_shasum": "04766dc98dbc19f6d627a5817075f4ce13d64a5d", - "_from": "npm-package-arg@>=4.0.0 <5.0.0" + "gitHead": "794c9981033bb16bd4a88c7ba45c109107439172", + "_id": "npm-package-arg@4.0.1", + "_shasum": "bfbea17cd2b9fdc4fca2f02796794173dbf1877c", + "_from": "npm-package-arg@>=4.0.0 <4.1.0" } diff --git a/node_modules/npm-package-arg/test/basic.js b/node_modules/npm-package-arg/test/basic.js index 4991ffcd3..a3d58c88c 100644 --- a/node_modules/npm-package-arg/test/basic.js +++ b/node_modules/npm-package-arg/test/basic.js @@ -95,7 +95,7 @@ require("tap").test("basic", function (t) { "/path/to/foo": { name: null, type: "local", - spec: "/path/to/foo", + spec: path.resolve(__dirname, "/path/to/foo"), raw: "/path/to/foo" }, diff --git a/node_modules/npm-package-arg/test/bitbucket.js b/node_modules/npm-package-arg/test/bitbucket.js index 83f99fc1b..1dff34ffa 100644 --- a/node_modules/npm-package-arg/test/bitbucket.js +++ b/node_modules/npm-package-arg/test/bitbucket.js @@ -57,7 +57,7 @@ require("tap").test("basic", function (t) { name: null, type: "hosted", hosted: { type: "bitbucket" }, - spec: "https://bitbucket.org/user/foo.git", + spec: "git+https://bitbucket.org/user/foo.git", raw: "https://bitbucket.org/user/foo.git" }, 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..3814657f0 --- /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: "bitbucket:user/foo-js", + raw: "bitbucket:user/foo-js" + }, + + "bitbucket:user/foo-js#bar/baz": { + name: null, + type: "hosted", + hosted: { type: "bitbucket" }, + spec: "bitbucket:user/foo-js#bar/baz", + raw: "bitbucket:user/foo-js#bar/baz" + }, + + "bitbucket:user..blerg--/..foo-js# . . . . . some . tags / / /": { + name: null, + type: "hosted", + hosted: { type: "bitbucket" }, + spec: "bitbucket:user..blerg--/..foo-js# . . . . . 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: "bitbucket:user/foo-js#bar/baz/bin", + raw: "bitbucket:user/foo-js#bar/baz/bin" + }, + + "foo@bitbucket:user/foo-js": { + name: "foo", + type: "hosted", + hosted: { type: "bitbucket" }, + spec: "bitbucket:user/foo-js", + 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+https: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 index a51cd0886..a2c146002 100644 --- a/node_modules/npm-package-arg/test/github.js +++ b/node_modules/npm-package-arg/test/github.js @@ -73,7 +73,7 @@ require("tap").test("basic", function (t) { name: null, type: "hosted", hosted: { type: "github" }, - spec: "https://github.com/user/foo.git", + spec: "git+https://github.com/user/foo.git", raw: "https://github.com/user/foo.git" }, 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..080b7c1d3 --- /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: "github:user/foo-js", + raw: "user/foo-js" + }, + + "user/foo-js#bar/baz": { + name: null, + type: "hosted", + hosted: { type: "github" }, + spec: "github:user/foo-js#bar/baz", + raw: "user/foo-js#bar/baz" + }, + + "user..blerg--/..foo-js# . . . . . some . tags / / /": { + name: null, + type: "hosted", + hosted: { type: "github" }, + spec: "github:user..blerg--/..foo-js# . . . . . some . tags / / /", + raw: "user..blerg--/..foo-js# . . . . . some . tags / / /" + }, + + "user/foo-js#bar/baz/bin": { + name: null, + type: "hosted", + hosted: { type: "github" }, + raw: "github:user/foo-js#bar/baz/bin", + raw: "user/foo-js#bar/baz/bin" + }, + + "foo@user/foo-js": { + name: "foo", + type: "hosted", + hosted: { type: "github" }, + spec: "github:user/foo-js", + raw: "foo@user/foo-js" + }, + + "github:user/foo-js": { + name: null, + type: "hosted", + hosted: { type: "github" }, + spec: "github:user/foo-js", + 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://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+https: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: "github:bar/foo", + 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 index 94c954814..c9a8ef9f2 100644 --- a/node_modules/npm-package-arg/test/gitlab.js +++ b/node_modules/npm-package-arg/test/gitlab.js @@ -57,7 +57,7 @@ require("tap").test("basic", function (t) { name: null, type: "hosted", hosted: { type: "gitlab" }, - spec: "https://gitlab.com/user/foo.git", + spec: "git+https://gitlab.com/user/foo.git", raw: "https://gitlab.com/user/foo.git" }, 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..08b962dfd --- /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" }, + raw: "gitlab:user/foo-js", + raw: "gitlab:user/foo-js" + }, + + "gitlab:user/foo-js#bar/baz": { + name: null, + type: "hosted", + hosted: { type: "gitlab" }, + raw: "gitlab:user/foo-js#bar/baz", + raw: "gitlab:user/foo-js#bar/baz" + }, + + "gitlab:user..blerg--/..foo-js# . . . . . some . tags / / /": { + name: null, + type: "hosted", + hosted: { type: "gitlab" }, + spec: "gitlab:user..blerg--/..foo-js# . . . . . 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: "gitlab:user/foo-js#bar/baz/bin", + raw: "gitlab:user/foo-js#bar/baz/bin" + }, + + "foo@gitlab:user/foo-js": { + name: "foo", + type: "hosted", + hosted: { type: "gitlab" }, + spec: "gitlab:user/foo-js", + 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+https: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/package.json b/package.json index ff9433a7f..078f03c62 100644 --- a/package.json +++ b/package.json @@ -69,7 +69,7 @@ "normalize-package-data": "~2.2.0", "npm-cache-filename": "~1.0.1", "npm-install-checks": "~1.0.5", - "npm-package-arg": "~4.0.0", + "npm-package-arg": "~4.0.1", "npm-registry-client": "~6.3.3", "npm-user-validate": "~0.1.2", "npmlog": "~1.2.1", |