Allow the other types of URLs that npm supports.

See for instance #844 for people running into the
fact that our lack of support for git protocols means
dealing with private npm packages is a pain.
This commit is contained in:
Tom Coleman
2015-10-29 14:16:17 +11:00
parent 643d09a629
commit 58cbe65060

View File

@@ -477,9 +477,10 @@ exports.isUrlWithFileScheme = function (x) {
};
exports.isUrlWithSha = function (x) {
// For now, just support http/https, which is at least less restrictive than
// the old "github only" rule.
return /^https?:\/\/.*[0-9a-f]{40}/.test(x);
// These are the various protocols that NPM supports, which we use to download
// both NPM and Cordova dependencies
// See https://docs.npmjs.com/files/package.json#git-urls-as-dependencies
return /^(https|git|git\+ssh|git\+http|git\+https)?:\/\/.*[0-9a-f]{40}/.test(x);
};
exports.isPathRelative = function (x) {