Skip to content

Commit

Permalink
deps: hosted-git-info@5.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
lukekarrys committed Aug 25, 2022
1 parent e401a81 commit 2c4e387
Show file tree
Hide file tree
Showing 7 changed files with 41 additions and 21 deletions.
7 changes: 7 additions & 0 deletions node_modules/hosted-git-info/lib/git-host-info.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ const maybeEncode = (arg) => arg ? encodeURIComponent(arg) : ''
const defaults = {
sshtemplate: ({ domain, user, project, committish }) => `git@${domain}:${user}/${project}.git${maybeJoin('#', committish)}`,
sshurltemplate: ({ domain, user, project, committish }) => `git+ssh://git@${domain}/${user}/${project}.git${maybeJoin('#', committish)}`,
edittemplate: ({ domain, user, project, committish, editpath, path }) => `https://${domain}/${user}/${project}${maybeJoin('/', editpath, '/', maybeEncode(committish || 'master'), '/', path)}`,
browsetemplate: ({ domain, user, project, committish, treepath }) => `https://${domain}/${user}/${project}${maybeJoin('/', treepath, '/', maybeEncode(committish))}`,
browsefiletemplate: ({ domain, user, project, committish, treepath, path, fragment, hashformat }) => `https://${domain}/${user}/${project}/${treepath}/${maybeEncode(committish || 'master')}/${path}${maybeJoin('#', hashformat(fragment || ''))}`,
docstemplate: ({ domain, user, project, treepath, committish }) => `https://${domain}/${user}/${project}${maybeJoin('/', treepath, '/', maybeEncode(committish))}#readme`,
Expand All @@ -24,6 +25,7 @@ gitHosts.github = Object.assign({}, defaults, {
protocols: ['git:', 'http:', 'git+ssh:', 'git+https:', 'ssh:', 'https:'],
domain: 'github.com',
treepath: 'tree',
editpath: 'edit',
filetemplate: ({ auth, user, project, committish, path }) => `https://${maybeJoin(auth, '@')}raw.githubusercontent.com/${user}/${project}/${maybeEncode(committish) || 'master'}/${path}`,
gittemplate: ({ auth, domain, user, project, committish }) => `git://${maybeJoin(auth, '@')}${domain}/${user}/${project}.git${maybeJoin('#', committish)}`,
tarballtemplate: ({ domain, user, project, committish }) => `https://codeload.${domain}/${user}/${project}/tar.gz/${maybeEncode(committish) || 'master'}`,
Expand Down Expand Up @@ -53,6 +55,8 @@ gitHosts.bitbucket = Object.assign({}, defaults, {
protocols: ['git+ssh:', 'git+https:', 'ssh:', 'https:'],
domain: 'bitbucket.org',
treepath: 'src',
editpath: '?mode=edit',
edittemplate: ({ domain, user, project, committish, treepath, path, editpath }) => `https://${domain}/${user}/${project}${maybeJoin('/', treepath, '/', maybeEncode(committish || 'master'), '/', path, editpath)}`,
tarballtemplate: ({ domain, user, project, committish }) => `https://${domain}/${user}/${project}/get/${maybeEncode(committish) || 'master'}.tar.gz`,
extract: (url) => {
let [, user, project, aux] = url.pathname.split('/', 4)
Expand All @@ -76,6 +80,7 @@ gitHosts.gitlab = Object.assign({}, defaults, {
protocols: ['git+ssh:', 'git+https:', 'ssh:', 'https:'],
domain: 'gitlab.com',
treepath: 'tree',
editpath: '-/edit',
httpstemplate: ({ auth, domain, user, project, committish }) => `git+https://${maybeJoin(auth, '@')}${domain}/${user}/${project}.git${maybeJoin('#', committish)}`,
tarballtemplate: ({ domain, user, project, committish }) => `https://${domain}/${user}/${project}/repository/archive.tar.gz?ref=${maybeEncode(committish) || 'master'}`,
extract: (url) => {
Expand All @@ -102,8 +107,10 @@ gitHosts.gitlab = Object.assign({}, defaults, {
gitHosts.gist = Object.assign({}, defaults, {
protocols: ['git:', 'git+ssh:', 'git+https:', 'ssh:', 'https:'],
domain: 'gist.github.com',
editpath: 'edit',
sshtemplate: ({ domain, project, committish }) => `git@${domain}:${project}.git${maybeJoin('#', committish)}`,
sshurltemplate: ({ domain, project, committish }) => `git+ssh://git@${domain}/${project}.git${maybeJoin('#', committish)}`,
edittemplate: ({ domain, user, project, committish, editpath }) => `https://${domain}/${user}/${project}${maybeJoin('/', maybeEncode(committish))}/${editpath}`,
browsetemplate: ({ domain, project, committish }) => `https://${domain}/${project}${maybeJoin('/', maybeEncode(committish))}`,
browsefiletemplate: ({ domain, project, committish, path, hashformat }) => `https://${domain}/${project}${maybeJoin('/', maybeEncode(committish))}${maybeJoin('#', hashformat(path))}`,
docstemplate: ({ domain, project, committish }) => `https://${domain}/${project}${maybeJoin('/', maybeEncode(committish))}`,
Expand Down
4 changes: 4 additions & 0 deletions node_modules/hosted-git-info/lib/git-host.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,10 @@ class GitHost {
return this._fill(this.filetemplate, { ...opts, path })
}

edit (path, opts) {
return this._fill(this.edittemplate, { ...opts, path })
}

getDefaultRepresentation () {
return this.default
}
Expand Down
12 changes: 8 additions & 4 deletions node_modules/hosted-git-info/lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ function fromUrl (giturl, opts) {
return
}

const url = isGitHubShorthand(giturl) ? 'github:' + giturl : correctProtocol(giturl)
const parsed = parseGitUrl(url)
const correctedUrl = isGitHubShorthand(giturl) ? 'github:' + giturl : correctProtocol(giturl)
const parsed = parseGitUrl(correctedUrl)
if (!parsed) {
return parsed
}
Expand Down Expand Up @@ -229,7 +229,9 @@ const parseGitUrl = (giturl) => {
let result
try {
result = new url.URL(giturl)
} catch (err) {}
} catch {
// this fn should never throw
}

if (result) {
return result
Expand All @@ -238,7 +240,9 @@ const parseGitUrl = (giturl) => {
const correctedUrl = correctUrl(giturl)
try {
result = new url.URL(correctedUrl)
} catch (err) {}
} catch {
// this fn should never throw
}

return result
}
26 changes: 14 additions & 12 deletions node_modules/hosted-git-info/package.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"name": "hosted-git-info",
"version": "5.0.0",
"version": "5.1.0",
"description": "Provides metadata and conversions from repository urls for GitHub, Bitbucket and GitLab",
"main": "./lib/index.js",
"repository": {
"type": "git",
"url": "git+https://github.com/npm/hosted-git-info.git"
"url": "https://github.com/npm/hosted-git-info.git"
},
"keywords": [
"git",
Expand All @@ -27,30 +27,32 @@
"snap": "tap",
"test": "tap",
"test:coverage": "tap --coverage-report=html",
"lint": "eslint '**/*.js'",
"postlint": "npm-template-check",
"template-copy": "npm-template-copy --force",
"lintfix": "npm run lint -- --fix"
"lint": "eslint \"**/*.js\"",
"postlint": "template-oss-check",
"lintfix": "npm run lint -- --fix",
"template-oss-apply": "template-oss-apply --force"
},
"dependencies": {
"lru-cache": "^7.5.1"
},
"devDependencies": {
"@npmcli/template-oss": "^2.9.2",
"tap": "^15.1.6"
"@npmcli/eslint-config": "^3.0.1",
"@npmcli/template-oss": "3.5.0",
"tap": "^16.0.1"
},
"files": [
"bin",
"lib"
"bin/",
"lib/"
],
"engines": {
"node": "^12.13.0 || ^14.15.0 || >=16"
"node": "^12.13.0 || ^14.15.0 || >=16.0.0"
},
"tap": {
"color": 1,
"coverage": true
},
"templateOSS": {
"version": "2.9.2"
"//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.",
"version": "3.5.0"
}
}
9 changes: 5 additions & 4 deletions package-lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@
"fastest-levenshtein": "^1.0.12",
"glob": "^8.0.1",
"graceful-fs": "^4.2.10",
"hosted-git-info": "^5.0.0",
"hosted-git-info": "^5.1.0",
"ini": "^3.0.0",
"init-package-json": "^3.0.2",
"is-cidr": "^4.0.2",
Expand Down Expand Up @@ -3820,14 +3820,15 @@
}
},
"node_modules/hosted-git-info": {
"version": "5.0.0",
"version": "5.1.0",
"resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-5.1.0.tgz",
"integrity": "sha512-Ek+QmMEqZF8XrbFdwoDjSbm7rT23pCgEMOJmz6GPk/s4yH//RQfNPArhIxbguNxROq/+5lNBwCDHMhA903Kx1Q==",
"inBundle": true,
"license": "ISC",
"dependencies": {
"lru-cache": "^7.5.1"
},
"engines": {
"node": "^12.13.0 || ^14.15.0 || >=16"
"node": "^12.13.0 || ^14.15.0 || >=16.0.0"
}
},
"node_modules/html-encoding-sniffer": {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
"fastest-levenshtein": "^1.0.12",
"glob": "^8.0.1",
"graceful-fs": "^4.2.10",
"hosted-git-info": "^5.0.0",
"hosted-git-info": "^5.1.0",
"ini": "^3.0.0",
"init-package-json": "^3.0.2",
"is-cidr": "^4.0.2",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,8 @@ Result {
"default": "sshurl",
"docstemplate": "function docstemplate",
"domain": "github.com",
"editpath": "edit",
"edittemplate": "function edittemplate",
"extract": "function extract",
"filetemplate": "function filetemplate",
"gittemplate": "function gittemplate",
Expand Down

0 comments on commit 2c4e387

Please sign in to comment.