From f45219ee1968a77f53d4a73ae2ee90993a369298 Mon Sep 17 00:00:00 2001 From: Gar Date: Thu, 6 Jan 2022 08:39:08 -0800 Subject: [PATCH] deps: hosted-git-info@4.1.0 * feat: Support Sourcehut --- node_modules/hosted-git-info/git-host-info.js | 30 +++++++++++++++++++ node_modules/hosted-git-info/package.json | 7 ++--- package-lock.json | 14 ++++----- package.json | 2 +- 4 files changed, 41 insertions(+), 12 deletions(-) diff --git a/node_modules/hosted-git-info/git-host-info.js b/node_modules/hosted-git-info/git-host-info.js index d4919344c77bf..ba55248e7d62d 100644 --- a/node_modules/hosted-git-info/git-host-info.js +++ b/node_modules/hosted-git-info/git-host-info.js @@ -139,6 +139,36 @@ gitHosts.gist = Object.assign({}, defaults, { } }) +gitHosts.sourcehut = Object.assign({}, defaults, { + protocols: ['git+ssh:', 'https:'], + domain: 'git.sr.ht', + treepath: 'tree', + browsefiletemplate: ({ domain, user, project, committish, treepath, path, fragment, hashformat }) => `https://${domain}/${user}/${project}/${treepath}/${maybeEncode(committish || 'main')}/${path}${maybeJoin('#', hashformat(fragment || ''))}`, + filetemplate: ({ domain, user, project, committish, path }) => `https://${domain}/${user}/${project}/blob/${maybeEncode(committish) || 'main'}/${path}`, + httpstemplate: ({ domain, user, project, committish }) => `https://${domain}/${user}/${project}.git${maybeJoin('#', committish)}`, + tarballtemplate: ({ domain, user, project, committish }) => `https://${domain}/${user}/${project}/archive/${maybeEncode(committish) || 'main'}.tar.gz`, + bugstemplate: ({ domain, user, project }) => `https://todo.sr.ht/${user}/${project}`, + docstemplate: ({ domain, user, project, treepath, committish }) => `https://${domain}/${user}/${project}${maybeJoin('/', treepath, '/', maybeEncode(committish))}#readme`, + extract: (url) => { + let [, user, project, aux] = url.pathname.split('/', 4) + + // tarball url + if (['archive'].includes(aux)) { + return + } + + if (project && project.endsWith('.git')) { + project = project.slice(0, -4) + } + + if (!user || !project) { + return + } + + return { user, project, committish: url.hash.slice(1) } + } +}) + const names = Object.keys(gitHosts) gitHosts.byShortcut = {} gitHosts.byDomain = {} diff --git a/node_modules/hosted-git-info/package.json b/node_modules/hosted-git-info/package.json index b7e2ee28e5b11..b145e62240805 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": "4.0.2", + "version": "4.1.0", "description": "Provides metadata and conversions from repository urls for GitHub, Bitbucket and GitLab", "main": "index.js", "repository": { @@ -34,7 +34,7 @@ "devDependencies": { "standard": "^16.0.3", "standard-version": "^9.1.0", - "tap": "^14.11.0" + "tap": "^15.1.6" }, "files": [ "index.js", @@ -46,7 +46,6 @@ }, "tap": { "color": 1, - "coverage": true, - "esm": false + "coverage": true } } diff --git a/package-lock.json b/package-lock.json index 48fd06a02815d..6316d552328e0 100644 --- a/package-lock.json +++ b/package-lock.json @@ -106,7 +106,7 @@ "fastest-levenshtein": "^1.0.12", "glob": "^7.2.0", "graceful-fs": "^4.2.8", - "hosted-git-info": "^4.0.2", + "hosted-git-info": "^4.1.0", "ini": "^2.0.0", "init-package-json": "^2.0.5", "is-cidr": "^4.0.2", @@ -3792,9 +3792,9 @@ } }, "node_modules/hosted-git-info": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-4.0.2.tgz", - "integrity": "sha512-c9OGXbZ3guC/xOlCg1Ci/VgWlwsqDv1yMQL1CWqXDL0hDjXuNcq0zuR4xqPSuasI3kqFDhqSyTjREz5gzq0fXg==", + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-4.1.0.tgz", + "integrity": "sha512-kyCuEOWjJqZuDbRHzL8V93NzQhwIB71oFWSyzVo+KPZI+pnQPPxucdkrOZvkLRnrf5URsQM+IJ09Dw29cRALIA==", "inBundle": true, "dependencies": { "lru-cache": "^6.0.0" @@ -13623,9 +13623,9 @@ } }, "hosted-git-info": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-4.0.2.tgz", - "integrity": "sha512-c9OGXbZ3guC/xOlCg1Ci/VgWlwsqDv1yMQL1CWqXDL0hDjXuNcq0zuR4xqPSuasI3kqFDhqSyTjREz5gzq0fXg==", + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-4.1.0.tgz", + "integrity": "sha512-kyCuEOWjJqZuDbRHzL8V93NzQhwIB71oFWSyzVo+KPZI+pnQPPxucdkrOZvkLRnrf5URsQM+IJ09Dw29cRALIA==", "requires": { "lru-cache": "^6.0.0" } diff --git a/package.json b/package.json index 8692a3b0950b0..048c146f078cb 100644 --- a/package.json +++ b/package.json @@ -74,7 +74,7 @@ "fastest-levenshtein": "^1.0.12", "glob": "^7.2.0", "graceful-fs": "^4.2.8", - "hosted-git-info": "^4.0.2", + "hosted-git-info": "^4.1.0", "ini": "^2.0.0", "init-package-json": "^2.0.5", "is-cidr": "^4.0.2",