Skip to content

Commit 2c4e387

Browse files
committed
deps: hosted-git-info@5.1.0
1 parent e401a81 commit 2c4e387

File tree

7 files changed

+41
-21
lines changed

7 files changed

+41
-21
lines changed

node_modules/hosted-git-info/lib/git-host-info.js

+7
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ const maybeEncode = (arg) => arg ? encodeURIComponent(arg) : ''
66
const defaults = {
77
sshtemplate: ({ domain, user, project, committish }) => `git@${domain}:${user}/${project}.git${maybeJoin('#', committish)}`,
88
sshurltemplate: ({ domain, user, project, committish }) => `git+ssh://git@${domain}/${user}/${project}.git${maybeJoin('#', committish)}`,
9+
edittemplate: ({ domain, user, project, committish, editpath, path }) => `https://${domain}/${user}/${project}${maybeJoin('/', editpath, '/', maybeEncode(committish || 'master'), '/', path)}`,
910
browsetemplate: ({ domain, user, project, committish, treepath }) => `https://${domain}/${user}/${project}${maybeJoin('/', treepath, '/', maybeEncode(committish))}`,
1011
browsefiletemplate: ({ domain, user, project, committish, treepath, path, fragment, hashformat }) => `https://${domain}/${user}/${project}/${treepath}/${maybeEncode(committish || 'master')}/${path}${maybeJoin('#', hashformat(fragment || ''))}`,
1112
docstemplate: ({ domain, user, project, treepath, committish }) => `https://${domain}/${user}/${project}${maybeJoin('/', treepath, '/', maybeEncode(committish))}#readme`,
@@ -24,6 +25,7 @@ gitHosts.github = Object.assign({}, defaults, {
2425
protocols: ['git:', 'http:', 'git+ssh:', 'git+https:', 'ssh:', 'https:'],
2526
domain: 'github.com',
2627
treepath: 'tree',
28+
editpath: 'edit',
2729
filetemplate: ({ auth, user, project, committish, path }) => `https://${maybeJoin(auth, '@')}raw.githubusercontent.com/${user}/${project}/${maybeEncode(committish) || 'master'}/${path}`,
2830
gittemplate: ({ auth, domain, user, project, committish }) => `git://${maybeJoin(auth, '@')}${domain}/${user}/${project}.git${maybeJoin('#', committish)}`,
2931
tarballtemplate: ({ domain, user, project, committish }) => `https://codeload.${domain}/${user}/${project}/tar.gz/${maybeEncode(committish) || 'master'}`,
@@ -53,6 +55,8 @@ gitHosts.bitbucket = Object.assign({}, defaults, {
5355
protocols: ['git+ssh:', 'git+https:', 'ssh:', 'https:'],
5456
domain: 'bitbucket.org',
5557
treepath: 'src',
58+
editpath: '?mode=edit',
59+
edittemplate: ({ domain, user, project, committish, treepath, path, editpath }) => `https://${domain}/${user}/${project}${maybeJoin('/', treepath, '/', maybeEncode(committish || 'master'), '/', path, editpath)}`,
5660
tarballtemplate: ({ domain, user, project, committish }) => `https://${domain}/${user}/${project}/get/${maybeEncode(committish) || 'master'}.tar.gz`,
5761
extract: (url) => {
5862
let [, user, project, aux] = url.pathname.split('/', 4)
@@ -76,6 +80,7 @@ gitHosts.gitlab = Object.assign({}, defaults, {
7680
protocols: ['git+ssh:', 'git+https:', 'ssh:', 'https:'],
7781
domain: 'gitlab.com',
7882
treepath: 'tree',
83+
editpath: '-/edit',
7984
httpstemplate: ({ auth, domain, user, project, committish }) => `git+https://${maybeJoin(auth, '@')}${domain}/${user}/${project}.git${maybeJoin('#', committish)}`,
8085
tarballtemplate: ({ domain, user, project, committish }) => `https://${domain}/${user}/${project}/repository/archive.tar.gz?ref=${maybeEncode(committish) || 'master'}`,
8186
extract: (url) => {
@@ -102,8 +107,10 @@ gitHosts.gitlab = Object.assign({}, defaults, {
102107
gitHosts.gist = Object.assign({}, defaults, {
103108
protocols: ['git:', 'git+ssh:', 'git+https:', 'ssh:', 'https:'],
104109
domain: 'gist.github.com',
110+
editpath: 'edit',
105111
sshtemplate: ({ domain, project, committish }) => `git@${domain}:${project}.git${maybeJoin('#', committish)}`,
106112
sshurltemplate: ({ domain, project, committish }) => `git+ssh://git@${domain}/${project}.git${maybeJoin('#', committish)}`,
113+
edittemplate: ({ domain, user, project, committish, editpath }) => `https://${domain}/${user}/${project}${maybeJoin('/', maybeEncode(committish))}/${editpath}`,
107114
browsetemplate: ({ domain, project, committish }) => `https://${domain}/${project}${maybeJoin('/', maybeEncode(committish))}`,
108115
browsefiletemplate: ({ domain, project, committish, path, hashformat }) => `https://${domain}/${project}${maybeJoin('/', maybeEncode(committish))}${maybeJoin('#', hashformat(path))}`,
109116
docstemplate: ({ domain, project, committish }) => `https://${domain}/${project}${maybeJoin('/', maybeEncode(committish))}`,

node_modules/hosted-git-info/lib/git-host.js

+4
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,10 @@ class GitHost {
9595
return this._fill(this.filetemplate, { ...opts, path })
9696
}
9797

98+
edit (path, opts) {
99+
return this._fill(this.edittemplate, { ...opts, path })
100+
}
101+
98102
getDefaultRepresentation () {
99103
return this.default
100104
}

node_modules/hosted-git-info/lib/index.js

+8-4
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@ function fromUrl (giturl, opts) {
4646
return
4747
}
4848

49-
const url = isGitHubShorthand(giturl) ? 'github:' + giturl : correctProtocol(giturl)
50-
const parsed = parseGitUrl(url)
49+
const correctedUrl = isGitHubShorthand(giturl) ? 'github:' + giturl : correctProtocol(giturl)
50+
const parsed = parseGitUrl(correctedUrl)
5151
if (!parsed) {
5252
return parsed
5353
}
@@ -229,7 +229,9 @@ const parseGitUrl = (giturl) => {
229229
let result
230230
try {
231231
result = new url.URL(giturl)
232-
} catch (err) {}
232+
} catch {
233+
// this fn should never throw
234+
}
233235

234236
if (result) {
235237
return result
@@ -238,7 +240,9 @@ const parseGitUrl = (giturl) => {
238240
const correctedUrl = correctUrl(giturl)
239241
try {
240242
result = new url.URL(correctedUrl)
241-
} catch (err) {}
243+
} catch {
244+
// this fn should never throw
245+
}
242246

243247
return result
244248
}

node_modules/hosted-git-info/package.json

+14-12
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
{
22
"name": "hosted-git-info",
3-
"version": "5.0.0",
3+
"version": "5.1.0",
44
"description": "Provides metadata and conversions from repository urls for GitHub, Bitbucket and GitLab",
55
"main": "./lib/index.js",
66
"repository": {
77
"type": "git",
8-
"url": "git+https://github.com/npm/hosted-git-info.git"
8+
"url": "https://github.com/npm/hosted-git-info.git"
99
},
1010
"keywords": [
1111
"git",
@@ -27,30 +27,32 @@
2727
"snap": "tap",
2828
"test": "tap",
2929
"test:coverage": "tap --coverage-report=html",
30-
"lint": "eslint '**/*.js'",
31-
"postlint": "npm-template-check",
32-
"template-copy": "npm-template-copy --force",
33-
"lintfix": "npm run lint -- --fix"
30+
"lint": "eslint \"**/*.js\"",
31+
"postlint": "template-oss-check",
32+
"lintfix": "npm run lint -- --fix",
33+
"template-oss-apply": "template-oss-apply --force"
3434
},
3535
"dependencies": {
3636
"lru-cache": "^7.5.1"
3737
},
3838
"devDependencies": {
39-
"@npmcli/template-oss": "^2.9.2",
40-
"tap": "^15.1.6"
39+
"@npmcli/eslint-config": "^3.0.1",
40+
"@npmcli/template-oss": "3.5.0",
41+
"tap": "^16.0.1"
4142
},
4243
"files": [
43-
"bin",
44-
"lib"
44+
"bin/",
45+
"lib/"
4546
],
4647
"engines": {
47-
"node": "^12.13.0 || ^14.15.0 || >=16"
48+
"node": "^12.13.0 || ^14.15.0 || >=16.0.0"
4849
},
4950
"tap": {
5051
"color": 1,
5152
"coverage": true
5253
},
5354
"templateOSS": {
54-
"version": "2.9.2"
55+
"//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.",
56+
"version": "3.5.0"
5557
}
5658
}

package-lock.json

+5-4
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@
109109
"fastest-levenshtein": "^1.0.12",
110110
"glob": "^8.0.1",
111111
"graceful-fs": "^4.2.10",
112-
"hosted-git-info": "^5.0.0",
112+
"hosted-git-info": "^5.1.0",
113113
"ini": "^3.0.0",
114114
"init-package-json": "^3.0.2",
115115
"is-cidr": "^4.0.2",
@@ -3820,14 +3820,15 @@
38203820
}
38213821
},
38223822
"node_modules/hosted-git-info": {
3823-
"version": "5.0.0",
3823+
"version": "5.1.0",
3824+
"resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-5.1.0.tgz",
3825+
"integrity": "sha512-Ek+QmMEqZF8XrbFdwoDjSbm7rT23pCgEMOJmz6GPk/s4yH//RQfNPArhIxbguNxROq/+5lNBwCDHMhA903Kx1Q==",
38243826
"inBundle": true,
3825-
"license": "ISC",
38263827
"dependencies": {
38273828
"lru-cache": "^7.5.1"
38283829
},
38293830
"engines": {
3830-
"node": "^12.13.0 || ^14.15.0 || >=16"
3831+
"node": "^12.13.0 || ^14.15.0 || >=16.0.0"
38313832
}
38323833
},
38333834
"node_modules/html-encoding-sniffer": {

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@
7474
"fastest-levenshtein": "^1.0.12",
7575
"glob": "^8.0.1",
7676
"graceful-fs": "^4.2.10",
77-
"hosted-git-info": "^5.0.0",
77+
"hosted-git-info": "^5.1.0",
7878
"ini": "^3.0.0",
7979
"init-package-json": "^3.0.2",
8080
"is-cidr": "^4.0.2",

workspaces/arborist/tap-snapshots/test/spec-from-lock.js.test.cjs

+2
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,8 @@ Result {
101101
"default": "sshurl",
102102
"docstemplate": "function docstemplate",
103103
"domain": "github.com",
104+
"editpath": "edit",
105+
"edittemplate": "function edittemplate",
104106
"extract": "function extract",
105107
"filetemplate": "function filetemplate",
106108
"gittemplate": "function gittemplate",

0 commit comments

Comments
 (0)