aboutsummaryrefslogtreecommitdiff
path: root/node_modules/hosted-git-info
diff options
context:
space:
mode:
authorFlorian Dold <florian.dold@gmail.com>2018-09-20 02:56:13 +0200
committerFlorian Dold <florian.dold@gmail.com>2018-09-20 02:56:13 +0200
commitbbff7403fbf46f9ad92240ac213df8d30ef31b64 (patch)
treec58400ec5124da1c7d56b01aea83309f80a56c3b /node_modules/hosted-git-info
parent003fb34971cf63466184351b4db5f7c67df4f444 (diff)
update packages
Diffstat (limited to 'node_modules/hosted-git-info')
-rw-r--r--node_modules/hosted-git-info/README.md7
-rw-r--r--node_modules/hosted-git-info/git-host-info.js17
-rw-r--r--node_modules/hosted-git-info/git-host.js31
-rw-r--r--node_modules/hosted-git-info/index.js3
-rw-r--r--node_modules/hosted-git-info/package.json13
5 files changed, 52 insertions, 19 deletions
diff --git a/node_modules/hosted-git-info/README.md b/node_modules/hosted-git-info/README.md
index f9db5dd95..7b723f6b9 100644
--- a/node_modules/hosted-git-info/README.md
+++ b/node_modules/hosted-git-info/README.md
@@ -77,9 +77,11 @@ would return `https://raw.githubusercontent.com/npm/hosted-git-info/v1.0.0/packa
eg, `github:npm/hosted-git-info`
-* info.browse(opts)
+* info.browse(path, fragment, opts)
-eg, `https://github.com/npm/hosted-git-info/tree/v1.2.0`
+eg, `https://github.com/npm/hosted-git-info/tree/v1.2.0`,
+`https://github.com/npm/hosted-git-info/tree/v1.2.0/package.json`,
+`https://github.com/npm/hosted-git-info/tree/v1.2.0/REAMDE.md#supported-hosts`
* info.bugs(opts)
@@ -129,4 +131,3 @@ SSH connect strings will be normalized into `git+ssh` URLs.
Currently this supports Github, Bitbucket and Gitlab. Pull requests for
additional hosts welcome.
-
diff --git a/node_modules/hosted-git-info/git-host-info.js b/node_modules/hosted-git-info/git-host-info.js
index 93cf61744..090a23251 100644
--- a/node_modules/hosted-git-info/git-host-info.js
+++ b/node_modules/hosted-git-info/git-host-info.js
@@ -10,7 +10,7 @@ var gitHosts = module.exports = {
'filetemplate': 'https://{auth@}raw.githubusercontent.com/{user}/{project}/{committish}/{path}',
'bugstemplate': 'https://{domain}/{user}/{project}/issues',
'gittemplate': 'git://{auth@}{domain}/{user}/{project}.git{#committish}',
- 'tarballtemplate': 'https://{domain}/{user}/{project}/archive/{committish}.tar.gz'
+ 'tarballtemplate': 'https://codeload.{domain}/{user}/{project}/tar.gz/{committish}'
},
bitbucket: {
'protocols': [ 'git+ssh', 'git+https', 'ssh', 'https' ],
@@ -22,7 +22,6 @@ var gitHosts = module.exports = {
'protocols': [ 'git+ssh', 'git+https', 'ssh', 'https' ],
'domain': 'gitlab.com',
'treepath': 'tree',
- 'docstemplate': 'https://{domain}/{user}/{project}{/tree/committish}#README',
'bugstemplate': 'https://{domain}/{user}/{project}/issues',
'tarballtemplate': 'https://{domain}/{user}/{project}/repository/archive.tar.gz?ref={committish}'
},
@@ -36,11 +35,15 @@ var gitHosts = module.exports = {
'sshtemplate': 'git@{domain}:/{project}.git{#committish}',
'sshurltemplate': 'git+ssh://git@{domain}/{project}.git{#committish}',
'browsetemplate': 'https://{domain}/{project}{/committish}',
+ 'browsefiletemplate': 'https://{domain}/{project}{/committish}{#path}',
'docstemplate': 'https://{domain}/{project}{/committish}',
'httpstemplate': 'git+https://{domain}/{project}.git{#committish}',
'shortcuttemplate': '{type}:{project}{#committish}',
'pathtemplate': '{project}{#committish}',
- 'tarballtemplate': 'https://{domain}/{user}/{project}/archive/{committish}.tar.gz'
+ 'tarballtemplate': 'https://{domain}/{user}/{project}/archive/{committish}.tar.gz',
+ 'hashformat': function (fragment) {
+ return 'file-' + formatHashFragment(fragment)
+ }
}
}
@@ -48,12 +51,14 @@ var gitHostDefaults = {
'sshtemplate': 'git@{domain}:{user}/{project}.git{#committish}',
'sshurltemplate': 'git+ssh://git@{domain}/{user}/{project}.git{#committish}',
'browsetemplate': 'https://{domain}/{user}/{project}{/tree/committish}',
+ 'browsefiletemplate': 'https://{domain}/{user}/{project}/{treepath}/{committish}/{path}{#fragment}',
'docstemplate': 'https://{domain}/{user}/{project}{/tree/committish}#readme',
'httpstemplate': 'git+https://{auth@}{domain}/{user}/{project}.git{#committish}',
'filetemplate': 'https://{domain}/{user}/{project}/raw/{committish}/{path}',
'shortcuttemplate': '{type}:{user}/{project}{#committish}',
'pathtemplate': '{user}/{project}{#committish}',
- 'pathmatch': /^[/]([^/]+)[/]([^/]+?)(?:[.]git|[/])?$/
+ 'pathmatch': /^[/]([^/]+)[/]([^/]+?)(?:[.]git|[/])?$/,
+ 'hashformat': formatHashFragment
}
Object.keys(gitHosts).forEach(function (name) {
@@ -66,3 +71,7 @@ Object.keys(gitHosts).forEach(function (name) {
return protocol.replace(/([\\+*{}()[\]$^|])/g, '\\$1')
}).join('|') + '):$')
})
+
+function formatHashFragment (fragment) {
+ return fragment.toLowerCase().replace(/^\W+|\/|\W+$/g, '').replace(/\W+/g, '-')
+}
diff --git a/node_modules/hosted-git-info/git-host.js b/node_modules/hosted-git-info/git-host.js
index 4c6641bbf..733648d84 100644
--- a/node_modules/hosted-git-info/git-host.js
+++ b/node_modules/hosted-git-info/git-host.js
@@ -1,5 +1,6 @@
'use strict'
var gitHosts = require('./git-host-info.js')
+/* eslint-disable node/no-deprecated-api */
var extend = Object.assign || require('util')._extend
var GitHost = module.exports = function (type, user, auth, project, committish, defaultRepresentation, opts) {
@@ -24,6 +25,7 @@ GitHost.prototype.hash = function () {
GitHost.prototype._fill = function (template, opts) {
if (!template) return
var vars = extend({}, opts)
+ vars.path = vars.path ? vars.path.replace(/^[/]+/g, '') : ''
opts = extend(extend({}, this.opts), opts)
var self = this
Object.keys(this).forEach(function (key) {
@@ -31,10 +33,16 @@ GitHost.prototype._fill = function (template, opts) {
})
var rawAuth = vars.auth
var rawComittish = vars.committish
+ var rawFragment = vars.fragment
+ var rawPath = vars.path
Object.keys(vars).forEach(function (key) {
vars[key] = encodeURIComponent(vars[key])
})
vars['auth@'] = rawAuth ? rawAuth + '@' : ''
+ vars['#fragment'] = rawFragment ? '#' + this.hashformat(rawFragment) : ''
+ vars.fragment = vars.fragment ? vars.fragment : ''
+ vars['#path'] = rawPath ? '#' + this.hashformat(rawPath) : ''
+ vars['/path'] = vars.path ? '/' + vars.path : ''
if (opts.noCommittish) {
vars['#committish'] = ''
vars['/tree/committish'] = ''
@@ -43,8 +51,8 @@ GitHost.prototype._fill = function (template, opts) {
} else {
vars['#committish'] = rawComittish ? '#' + rawComittish : ''
vars['/tree/committish'] = vars.committish
- ? '/' + vars.treepath + '/' + vars.committish
- : ''
+ ? '/' + vars.treepath + '/' + vars.committish
+ : ''
vars['/committish'] = vars.committish ? '/' + vars.committish : ''
vars.committish = vars.committish || 'master'
}
@@ -67,8 +75,19 @@ GitHost.prototype.sshurl = function (opts) {
return this._fill(this.sshurltemplate, opts)
}
-GitHost.prototype.browse = function (opts) {
- return this._fill(this.browsetemplate, opts)
+GitHost.prototype.browse = function (P, F, opts) {
+ if (typeof P === 'string') {
+ if (typeof F !== 'string') {
+ opts = F
+ F = null
+ }
+ return this._fill(this.browsefiletemplate, extend({
+ fragment: F,
+ path: P
+ }, opts))
+ } else {
+ return this._fill(this.browsetemplate, P)
+ }
}
GitHost.prototype.docs = function (opts) {
@@ -100,9 +119,7 @@ GitHost.prototype.tarball = function (opts) {
}
GitHost.prototype.file = function (P, opts) {
- return this._fill(this.filetemplate, extend({
- path: P.replace(/^[/]+/g, '')
- }, opts))
+ return this._fill(this.filetemplate, extend({ path: P }, opts))
}
GitHost.prototype.getDefaultRepresentation = function () {
diff --git a/node_modules/hosted-git-info/index.js b/node_modules/hosted-git-info/index.js
index 9055ab185..c1c2cc899 100644
--- a/node_modules/hosted-git-info/index.js
+++ b/node_modules/hosted-git-info/index.js
@@ -26,6 +26,7 @@ var authProtocols = {
var cache = {}
module.exports.fromUrl = function (giturl, opts) {
+ if (typeof giturl !== 'string') return
var key = giturl + JSON.stringify(opts || {})
if (!(key in cache)) {
@@ -58,7 +59,7 @@ function fromUrl (giturl, opts) {
project = decodeURIComponent(shortcutMatch[3])
defaultRepresentation = 'shortcut'
} else {
- if (parsed.host !== gitHostInfo.domain) return
+ if (parsed.host && parsed.host !== gitHostInfo.domain && parsed.host.replace(/^www[.]/, '') !== gitHostInfo.domain) return
if (!gitHostInfo.protocols_re.test(parsed.protocol)) return
if (!parsed.path) return
var pathmatch = gitHostInfo.pathmatch
diff --git a/node_modules/hosted-git-info/package.json b/node_modules/hosted-git-info/package.json
index c24d1634e..bd1934d91 100644
--- a/node_modules/hosted-git-info/package.json
+++ b/node_modules/hosted-git-info/package.json
@@ -1,6 +1,6 @@
{
"name": "hosted-git-info",
- "version": "2.5.0",
+ "version": "2.7.1",
"description": "Provides metadata and conversions from repository urls for Github, Bitbucket and Gitlab",
"main": "index.js",
"repository": {
@@ -20,11 +20,16 @@
},
"homepage": "https://github.com/npm/hosted-git-info",
"scripts": {
- "test": "standard && tap -J --coverage test/*.js"
+ "prerelease": "npm t",
+ "postrelease": "npm publish && git push --follow-tags",
+ "pretest": "standard",
+ "release": "standard-version -s",
+ "test": "tap -J --nyc-arg=--all --coverage test"
},
"devDependencies": {
- "standard": "^9.0.2",
- "tap": "^10.3.0"
+ "standard": "^11.0.1",
+ "standard-version": "^4.3.0",
+ "tap": "^12.0.1"
},
"files": [
"index.js",