A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/npm/cli/commit/78df711a60aaf8538b9fcaf13f2f9d50ce62b7b8 below:

hosted-git-info@8.1.0 · npm/cli@78df711 · GitHub

File tree Expand file treeCollapse file tree 4 files changed

+56

-8

lines changed

Filter options

Expand file treeCollapse file tree 4 files changed

+56

-8

lines changed Original file line number Diff line number Diff line change

@@ -7,6 +7,26 @@ const parseUrl = require('./parse-url.js')

7 7 8 8

const cache = new LRUCache({ max: 1000 })

9 9 10 +

function unknownHostedUrl (url) {

11 +

try {

12 +

const {

13 +

protocol,

14 +

hostname,

15 +

pathname,

16 +

} = new URL(url)

17 + 18 +

if (!hostname) {

19 +

return null

20 +

}

21 + 22 +

const proto = /(?:git\+)http:$/.test(protocol) ? 'http:' : 'https:'

23 +

const path = pathname.replace(/\.git$/, '')

24 +

return `${proto}//${hostname}${path}`

25 +

} catch {

26 +

return null

27 +

}

28 +

}

29 + 10 30

class GitHost {

11 31

constructor (type, user, auth, project, committish, defaultRepresentation, opts = {}) {

12 32

Object.assign(this, GitHost.#gitHosts[type], {

@@ -56,6 +76,34 @@ class GitHost {

56 76

return cache.get(key)

57 77

}

58 78 79 +

static fromManifest (manifest, opts = {}) {

80 +

if (!manifest || typeof manifest !== 'object') {

81 +

return

82 +

}

83 + 84 +

const r = manifest.repository

85 +

// TODO: look into also checking the `bugs`/`homepage` URLs

86 + 87 +

const rurl = r && (

88 +

typeof r === 'string'

89 +

? r

90 +

: typeof r === 'object' && typeof r.url === 'string'

91 +

? r.url

92 +

: null

93 +

)

94 + 95 +

if (!rurl) {

96 +

throw new Error('no repository')

97 +

}

98 + 99 +

const info = (rurl && GitHost.fromUrl(rurl.replace(/^git\+/, ''), opts)) || null

100 +

if (info) {

101 +

return info

102 +

}

103 +

const unk = unknownHostedUrl(rurl)

104 +

return GitHost.fromUrl(unk, opts) || unk

105 +

}

106 + 59 107

static parseUrl (url) {

60 108

return parseUrl(url)

61 109

}

Original file line number Diff line number Diff line change

@@ -1,6 +1,6 @@

1 1

{

2 2

"name": "hosted-git-info",

3 -

"version": "8.0.2",

3 +

"version": "8.1.0",

4 4

"description": "Provides metadata and conversions from repository urls for GitHub, Bitbucket and GitLab",

5 5

"main": "./lib/index.js",

6 6

"repository": {

@@ -35,7 +35,7 @@

35 35

},

36 36

"devDependencies": {

37 37

"@npmcli/eslint-config": "^5.0.0",

38 -

"@npmcli/template-oss": "4.23.4",

38 +

"@npmcli/template-oss": "4.24.3",

39 39

"tap": "^16.0.1"

40 40

},

41 41

"files": [

@@ -55,7 +55,7 @@

55 55

},

56 56

"templateOSS": {

57 57

"//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.",

58 -

"version": "4.23.4",

58 +

"version": "4.24.3",

59 59

"publish": "true"

60 60

}

61 61

}

Original file line number Diff line number Diff line change

@@ -104,7 +104,7 @@

104 104

"fs-minipass": "^3.0.3",

105 105

"glob": "^10.4.5",

106 106

"graceful-fs": "^4.2.11",

107 -

"hosted-git-info": "^8.0.2",

107 +

"hosted-git-info": "^8.1.0",

108 108

"ini": "^5.0.0",

109 109

"init-package-json": "^8.0.0",

110 110

"is-cidr": "^5.1.1",

@@ -9286,9 +9286,9 @@

9286 9286

}

9287 9287

},

9288 9288

"node_modules/hosted-git-info": {

9289 -

"version": "8.0.2",

9290 -

"resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-8.0.2.tgz",

9291 -

"integrity": "sha512-sYKnA7eGln5ov8T8gnYlkSOxFJvywzEx9BueN6xo/GKO8PGiI6uK6xx+DIGe45T3bdVjLAQDQW1aicT8z8JwQg==",

9289 +

"version": "8.1.0",

9290 +

"resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-8.1.0.tgz",

9291 +

"integrity": "sha512-Rw/B2DNQaPBICNXEm8balFz9a6WpZrkCGpcWFpy7nCj+NyhSdqXipmfvtmWt9xGfp0wZnBxB+iVpLmQMYt47Tw==",

9292 9292

"inBundle": true,

9293 9293

"license": "ISC",

9294 9294

"dependencies": {

Original file line number Diff line number Diff line change

@@ -71,7 +71,7 @@

71 71

"fs-minipass": "^3.0.3",

72 72

"glob": "^10.4.5",

73 73

"graceful-fs": "^4.2.11",

74 -

"hosted-git-info": "^8.0.2",

74 +

"hosted-git-info": "^8.1.0",

75 75

"ini": "^5.0.0",

76 76

"init-package-json": "^8.0.0",

77 77

"is-cidr": "^5.1.1",

You can’t perform that action at this time.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4