mirror of
https://github.com/zhigang1992/npm.git
synced 2026-04-29 04:25:30 +08:00
npm-package-arg@2.0.0
This commit is contained in:
@@ -12,19 +12,18 @@ function mapToRegistry(name, config, cb) {
|
||||
// the name itself takes precedence
|
||||
var data = npa(name)
|
||||
if (data.scope) {
|
||||
// the name is definitely scoped, so escape now
|
||||
name = name.replace("/", "%2f")
|
||||
|
||||
var packageScope = "@" + data.scope
|
||||
if (!packageScope) return cb(new Error("No scope found in scoped package named " + name))
|
||||
log.silly("mapToRegistry", "packageScope", packageScope)
|
||||
log.silly("mapToRegistry", "scope", data.scope)
|
||||
|
||||
scopedRegistry = config.get(packageScope + ":registry")
|
||||
scopedRegistry = config.get(data.scope + ":registry")
|
||||
if (scopedRegistry) {
|
||||
log.silly("mapToRegistry", "scopedRegistry (scoped package)", scopedRegistry)
|
||||
uri = url.resolve(scopedRegistry, name)
|
||||
}
|
||||
else {
|
||||
log.verbose("mapToRegistry", "no registry URL found for scope", packageScope)
|
||||
log.verbose("mapToRegistry", "no registry URL found for scope", data.scope)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
3
node_modules/npm-package-arg/README.md
generated
vendored
3
node_modules/npm-package-arg/README.md
generated
vendored
@@ -50,3 +50,6 @@ fields:
|
||||
* `raw` - The original un-modified string that was provided.
|
||||
* `rawSpec` - The part after the `name@...`, as it was originally
|
||||
provided.
|
||||
* `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`.
|
||||
|
||||
6
node_modules/npm-package-arg/npa.js
generated
vendored
6
node_modules/npm-package-arg/npa.js
generated
vendored
@@ -46,7 +46,8 @@ function npa (arg) {
|
||||
if (nameparse && validName(nameparse[3]) &&
|
||||
(!nameparse[2] || validName(nameparse[2]))) {
|
||||
res.name = (nameparse[1] || "") + nameparse[3]
|
||||
res.scope = nameparse[2] || null
|
||||
if (nameparse[2])
|
||||
res.scope = "@" + nameparse[2]
|
||||
arg = arg.substr(nameparse[0].length)
|
||||
} else {
|
||||
res.name = null
|
||||
@@ -100,7 +101,8 @@ function npa (arg) {
|
||||
res.spec = "*"
|
||||
res.rawSpec = ""
|
||||
res.name = arg
|
||||
res.scope = p[1] || null
|
||||
if (p[1])
|
||||
res.scope = "@" + p[1]
|
||||
} else {
|
||||
parseLocal(res, arg)
|
||||
}
|
||||
|
||||
20
node_modules/npm-package-arg/package.json
generated
vendored
20
node_modules/npm-package-arg/package.json
generated
vendored
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "npm-package-arg",
|
||||
"version": "1.1.0",
|
||||
"version": "2.0.0",
|
||||
"description": "Parse the things that can be arguments to `npm install`",
|
||||
"main": "npa.js",
|
||||
"directories": {
|
||||
@@ -29,10 +29,10 @@
|
||||
"url": "https://github.com/npm/npm-package-arg/issues"
|
||||
},
|
||||
"homepage": "https://github.com/npm/npm-package-arg",
|
||||
"gitHead": "3bc0a6195ffb0396e8598fefed54f64b5b40723d",
|
||||
"_id": "npm-package-arg@1.1.0",
|
||||
"_shasum": "4546d1cf7d6c25bd1addd605ebc5a040778a2cd6",
|
||||
"_from": "npm-package-arg@~1.1.0",
|
||||
"gitHead": "e8b8d15b13bc254c64702a265668d35bb1cc27e0",
|
||||
"_id": "npm-package-arg@2.0.0",
|
||||
"_shasum": "b573aa01f3405c085564dfec930e8acc199bee08",
|
||||
"_from": "npm-package-arg@>=2.0.0-0 <2.1.0-0",
|
||||
"_npmVersion": "1.4.16",
|
||||
"_npmUser": {
|
||||
"name": "isaacs",
|
||||
@@ -42,11 +42,15 @@
|
||||
{
|
||||
"name": "isaacs",
|
||||
"email": "i@izs.me"
|
||||
},
|
||||
{
|
||||
"name": "othiym23",
|
||||
"email": "ogd@aoaioxxysz.net"
|
||||
}
|
||||
],
|
||||
"dist": {
|
||||
"shasum": "4546d1cf7d6c25bd1addd605ebc5a040778a2cd6",
|
||||
"tarball": "http://registry.npmjs.org/npm-package-arg/-/npm-package-arg-1.1.0.tgz"
|
||||
"shasum": "b573aa01f3405c085564dfec930e8acc199bee08",
|
||||
"tarball": "http://registry.npmjs.org/npm-package-arg/-/npm-package-arg-2.0.0.tgz"
|
||||
},
|
||||
"_resolved": "https://registry.npmjs.org/npm-package-arg/-/npm-package-arg-1.1.0.tgz"
|
||||
"_resolved": "https://registry.npmjs.org/npm-package-arg/-/npm-package-arg-2.0.0.tgz"
|
||||
}
|
||||
|
||||
14
node_modules/npm-package-arg/test/basic.js
generated
vendored
14
node_modules/npm-package-arg/test/basic.js
generated
vendored
@@ -16,7 +16,7 @@ require("tap").test("basic", function (t) {
|
||||
"@foo/bar": {
|
||||
raw: "@foo/bar",
|
||||
name: "@foo/bar",
|
||||
scope: "foo",
|
||||
scope: "@foo",
|
||||
rawSpec: "",
|
||||
spec: "*",
|
||||
type: "range"
|
||||
@@ -25,7 +25,7 @@ require("tap").test("basic", function (t) {
|
||||
"@foo/bar@": {
|
||||
raw: "@foo/bar@",
|
||||
name: "@foo/bar",
|
||||
scope: "foo",
|
||||
scope: "@foo",
|
||||
rawSpec: "",
|
||||
spec: "*",
|
||||
type: "range"
|
||||
@@ -34,7 +34,7 @@ require("tap").test("basic", function (t) {
|
||||
"@foo/bar@baz": {
|
||||
raw: "@foo/bar@baz",
|
||||
name: "@foo/bar",
|
||||
scope: "foo",
|
||||
scope: "@foo",
|
||||
rawSpec: "baz",
|
||||
spec: "baz",
|
||||
type: "tag"
|
||||
@@ -70,6 +70,14 @@ require("tap").test("basic", function (t) {
|
||||
raw: "git://github.com/user/foo"
|
||||
},
|
||||
|
||||
"@foo/bar@git+ssh://github.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"
|
||||
},
|
||||
|
||||
"/path/to/foo": {
|
||||
name: null,
|
||||
type: "local",
|
||||
|
||||
@@ -64,7 +64,7 @@
|
||||
"nopt": "~3.0.1",
|
||||
"npm-cache-filename": "~1.0.1",
|
||||
"npm-install-checks": "~1.0.2",
|
||||
"npm-package-arg": "~1.1.0",
|
||||
"npm-package-arg": "~2.0.0",
|
||||
"npm-registry-client": "git://github.com/npm/npm-registry-client#othiym23/multi-registry",
|
||||
"npm-user-validate": "~0.1.0",
|
||||
"npmconf": "git://github.com/npm/npmconf.git#othiym23/new-credentials",
|
||||
|
||||
Reference in New Issue
Block a user