diff options
author | Rebecca Turner <me@re-becca.org> | 2015-11-11 09:25:12 +0300 |
---|---|---|
committer | Rebecca Turner <me@re-becca.org> | 2015-11-11 12:08:30 +0300 |
commit | 1e834c22ed15d29c801fe48000eb0c40bf9078b4 (patch) | |
tree | c170ad3369439c2d9da7847a44ecfde59e1c2032 | |
parent | f7ea2b93264a78f98d2dd99c93929c8e338af87e (diff) |
npm-package-arg@4.1.0
PR-URL: https://github.com/npm/npm-package-arg/pull/15
Credit: @zkat
Fixes: #10189
-rw-r--r-- | node_modules/npm-package-arg/README.md | 4 | ||||
-rw-r--r-- | node_modules/npm-package-arg/npa.js | 5 | ||||
-rw-r--r-- | node_modules/npm-package-arg/package.json | 97 | ||||
-rw-r--r-- | node_modules/npm-package-arg/test/basic.js | 12 | ||||
-rw-r--r-- | package.json | 2 |
5 files changed, 88 insertions, 32 deletions
diff --git a/node_modules/npm-package-arg/README.md b/node_modules/npm-package-arg/README.md index d37b35533..82968a4be 100644 --- a/node_modules/npm-package-arg/README.md +++ b/node_modules/npm-package-arg/README.md @@ -99,3 +99,7 @@ keys: * `scope` - If a name is something like `@org/module` then the `scope` field will be set to `org`. If it doesn't have a scoped name, then scope is `null`. + +If you only include a name and no specifier part, eg, `foo` or `foo@` then +a default of `latest` will be used (as of 4.1.0). This is contrast with +previous behavior where `*` was used. diff --git a/node_modules/npm-package-arg/npa.js b/node_modules/npm-package-arg/npa.js index 2cba4cfb1..8989049ec 100644 --- a/node_modules/npm-package-arg/npa.js +++ b/node_modules/npm-package-arg/npa.js @@ -82,6 +82,7 @@ function npa (arg) { // if it's got / chars in it, then assume that it's local. if (res.name) { + if (arg == '') arg = 'latest' var version = semver.valid(arg, true) var range = semver.validRange(arg, true) // foo@... @@ -101,8 +102,8 @@ function npa (arg) { var p = arg.match(parseName) if (p && validName(p[2]) && (!p[1] || validName(p[1]))) { - res.type = "range" - res.spec = "*" + res.type = "tag" + res.spec = "latest" res.rawSpec = "" res.name = arg if (p[1]) diff --git a/node_modules/npm-package-arg/package.json b/node_modules/npm-package-arg/package.json index 9caed85e7..ec518ddf5 100644 --- a/node_modules/npm-package-arg/package.json +++ b/node_modules/npm-package-arg/package.json @@ -1,39 +1,90 @@ { - "name": "npm-package-arg", - "version": "4.0.2", - "description": "Parse the things that can be arguments to `npm install`", - "main": "npa.js", - "directories": { - "test": "test" + "_args": [ + [ + "npm-package-arg@~4.1.0", + "/Users/rebecca/code/npm" + ] + ], + "_from": "npm-package-arg@>=4.1.0 <4.2.0", + "_id": "npm-package-arg@4.1.0", + "_inCache": true, + "_installable": true, + "_location": "/npm-package-arg", + "_nodeVersion": "4.2.1", + "_npmUser": { + "email": "me@re-becca.org", + "name": "iarna" + }, + "_npmVersion": "3.4.0", + "_phantomChildren": {}, + "_requested": { + "name": "npm-package-arg", + "raw": "npm-package-arg@~4.1.0", + "rawSpec": "~4.1.0", + "scope": null, + "spec": ">=4.1.0 <4.2.0", + "type": "range" + }, + "_requiredBy": [ + "/", + "/init-package-json", + "/npm-registry-client", + "/realize-package-specifier" + ], + "_shasum": "2e015f8ac00737cb97f997c9cbf059f42a74527d", + "_shrinkwrap": null, + "_spec": "npm-package-arg@~4.1.0", + "_where": "/Users/rebecca/code/npm", + "author": { + "email": "i@izs.me", + "name": "Isaac Z. Schlueter", + "url": "http://blog.izs.me/" + }, + "bugs": { + "url": "https://github.com/npm/npm-package-arg/issues" }, "dependencies": { "hosted-git-info": "^2.1.4", "semver": "4 || 5" }, + "description": "Parse the things that can be arguments to `npm install`", "devDependencies": { "tap": "^1.2.0" }, - "scripts": { - "test": "tap test/*.js" + "directories": { + "test": "test" + }, + "dist": { + "shasum": "2e015f8ac00737cb97f997c9cbf059f42a74527d", + "tarball": "http://registry.npmjs.org/npm-package-arg/-/npm-package-arg-4.1.0.tgz" }, + "gitHead": "383b4783a076b825815be51eb1ab2e4bb8a1e1fc", + "homepage": "https://github.com/npm/npm-package-arg", + "license": "ISC", + "main": "npa.js", + "maintainers": [ + { + "name": "isaacs", + "email": "i@izs.me" + }, + { + "name": "othiym23", + "email": "ogd@aoaioxxysz.net" + }, + { + "name": "iarna", + "email": "me@re-becca.org" + } + ], + "name": "npm-package-arg", + "optionalDependencies": {}, + "readme": "ERROR: No README data found!", "repository": { "type": "git", "url": "git+https://github.com/npm/npm-package-arg.git" }, - "author": { - "name": "Isaac Z. Schlueter", - "email": "i@izs.me", - "url": "http://blog.izs.me/" - }, - "license": "ISC", - "bugs": { - "url": "https://github.com/npm/npm-package-arg/issues" + "scripts": { + "test": "tap test/*.js" }, - "homepage": "https://github.com/npm/npm-package-arg", - "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", - "gitHead": "8d3c51c33807fabde4db86a3811831b756eaf2eb", - "_id": "npm-package-arg@4.0.2", - "_shasum": "3f28235f9f6428e54bfeca73629e27d6c81a7e82", - "_from": "npm-package-arg@>=4.0.2 <4.1.0" + "version": "4.1.0" } diff --git a/node_modules/npm-package-arg/test/basic.js b/node_modules/npm-package-arg/test/basic.js index a3d58c88c..b72826b90 100644 --- a/node_modules/npm-package-arg/test/basic.js +++ b/node_modules/npm-package-arg/test/basic.js @@ -18,8 +18,8 @@ require("tap").test("basic", function (t) { name: "@foo/bar", scope: "@foo", rawSpec: "", - spec: "*", - type: "range" + spec: "latest", + type: "tag" }, "@foo/bar@": { @@ -27,8 +27,8 @@ require("tap").test("basic", function (t) { name: "@foo/bar", scope: "@foo", rawSpec: "", - spec: "*", - type: "range" + spec: "latest", + type: "tag" }, "@foo/bar@baz": { @@ -143,8 +143,8 @@ require("tap").test("basic", function (t) { "foo": { name: "foo", - type: "range", - spec: "*", + type: "tag", + spec: "latest", raw: "foo" } } diff --git a/package.json b/package.json index 80cfd7296..d1889275a 100644 --- a/package.json +++ b/package.json @@ -67,7 +67,7 @@ "normalize-package-data": "~2.3.5", "npm-cache-filename": "~1.0.2", "npm-install-checks": "~2.0.1", - "npm-package-arg": "~4.0.2", + "npm-package-arg": "~4.1.0", "npm-registry-client": "~7.0.7", "npm-user-validate": "~0.1.2", "npmlog": "~2.0.0", |