diff options
author | Luke Karrys <luke@lukekarrys.com> | 2022-08-25 23:56:32 +0300 |
---|---|---|
committer | Luke Karrys <luke@lukekarrys.com> | 2022-08-26 01:02:40 +0300 |
commit | 2c4e38728f25fd32624df2eb5bbf61c2c40c8ad5 (patch) | |
tree | d2d35c3ef880a46fb47b5bcc2d8e3311bea9cabd /node_modules | |
parent | e401a81c784556393bad57283337283a46bd57c5 (diff) |
deps: hosted-git-info@5.1.0
Diffstat (limited to 'node_modules')
-rw-r--r-- | node_modules/hosted-git-info/lib/git-host-info.js | 7 | ||||
-rw-r--r-- | node_modules/hosted-git-info/lib/git-host.js | 4 | ||||
-rw-r--r-- | node_modules/hosted-git-info/lib/index.js | 12 | ||||
-rw-r--r-- | node_modules/hosted-git-info/package.json | 26 |
4 files changed, 33 insertions, 16 deletions
diff --git a/node_modules/hosted-git-info/lib/git-host-info.js b/node_modules/hosted-git-info/lib/git-host-info.js index 9a9720fa3..cdc1e4601 100644 --- a/node_modules/hosted-git-info/lib/git-host-info.js +++ b/node_modules/hosted-git-info/lib/git-host-info.js @@ -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`, @@ -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'}`, @@ -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) @@ -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) => { @@ -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))}`, diff --git a/node_modules/hosted-git-info/lib/git-host.js b/node_modules/hosted-git-info/lib/git-host.js index 8a975e92e..bb65d4d99 100644 --- a/node_modules/hosted-git-info/lib/git-host.js +++ b/node_modules/hosted-git-info/lib/git-host.js @@ -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 } diff --git a/node_modules/hosted-git-info/lib/index.js b/node_modules/hosted-git-info/lib/index.js index 8bce6b3c2..d5d63c668 100644 --- a/node_modules/hosted-git-info/lib/index.js +++ b/node_modules/hosted-git-info/lib/index.js @@ -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 } @@ -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 @@ -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 } diff --git a/node_modules/hosted-git-info/package.json b/node_modules/hosted-git-info/package.json index 0153b0852..07a5587ca 100644 --- a/node_modules/hosted-git-info/package.json +++ b/node_modules/hosted-git-info/package.json @@ -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", @@ -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" } } |