create-docusaurus 0.0.0-4411 → 0.0.0-4420
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +3 -3
- package/templates/classic/package.json +3 -3
- package/templates/classic-typescript/package.json +4 -4
- package/templates/classic-typescript/src/components/HomepageFeatures.tsx +6 -1
- package/templates/facebook/package.json +3 -3
- package/templates/facebook/node_modules/hosted-git-info/LICENSE +0 -13
- package/templates/facebook/node_modules/hosted-git-info/README.md +0 -133
- package/templates/facebook/node_modules/hosted-git-info/git-host-info.js +0 -184
- package/templates/facebook/node_modules/hosted-git-info/git-host.js +0 -110
- package/templates/facebook/node_modules/hosted-git-info/index.js +0 -237
- package/templates/facebook/node_modules/hosted-git-info/package.json +0 -51
- package/templates/facebook/node_modules/lru-cache/LICENSE +0 -15
- package/templates/facebook/node_modules/lru-cache/README.md +0 -166
- package/templates/facebook/node_modules/lru-cache/index.js +0 -334
- package/templates/facebook/node_modules/lru-cache/package.json +0 -34
- package/templates/facebook/node_modules/normalize-package-data/AUTHORS +0 -4
- package/templates/facebook/node_modules/normalize-package-data/LICENSE +0 -15
- package/templates/facebook/node_modules/normalize-package-data/README.md +0 -108
- package/templates/facebook/node_modules/normalize-package-data/lib/extract_description.js +0 -22
- package/templates/facebook/node_modules/normalize-package-data/lib/fixer.js +0 -474
- package/templates/facebook/node_modules/normalize-package-data/lib/make_warning.js +0 -22
- package/templates/facebook/node_modules/normalize-package-data/lib/normalize.js +0 -48
- package/templates/facebook/node_modules/normalize-package-data/lib/safe_format.js +0 -11
- package/templates/facebook/node_modules/normalize-package-data/lib/typos.json +0 -25
- package/templates/facebook/node_modules/normalize-package-data/lib/warning_messages.json +0 -30
- package/templates/facebook/node_modules/normalize-package-data/package.json +0 -41
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-docusaurus",
|
|
3
|
-
"version": "0.0.0-
|
|
3
|
+
"version": "0.0.0-4420",
|
|
4
4
|
"description": "Create Docusaurus apps easily.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
},
|
|
24
24
|
"license": "MIT",
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@docusaurus/logger": "0.0.0-
|
|
26
|
+
"@docusaurus/logger": "0.0.0-4420",
|
|
27
27
|
"commander": "^5.1.0",
|
|
28
28
|
"fs-extra": "^10.0.0",
|
|
29
29
|
"lodash": "^4.17.20",
|
|
@@ -39,5 +39,5 @@
|
|
|
39
39
|
"devDependencies": {
|
|
40
40
|
"@types/supports-color": "^8.1.1"
|
|
41
41
|
},
|
|
42
|
-
"gitHead": "
|
|
42
|
+
"gitHead": "1ca7d139c287d2304855df8f2de4b25a383ddb9d"
|
|
43
43
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "docusaurus-2-classic-template",
|
|
3
|
-
"version": "0.0.0-
|
|
3
|
+
"version": "0.0.0-4420",
|
|
4
4
|
"private": true,
|
|
5
5
|
"scripts": {
|
|
6
6
|
"docusaurus": "docusaurus",
|
|
@@ -14,8 +14,8 @@
|
|
|
14
14
|
"write-heading-ids": "docusaurus write-heading-ids"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@docusaurus/core": "0.0.0-
|
|
18
|
-
"@docusaurus/preset-classic": "0.0.0-
|
|
17
|
+
"@docusaurus/core": "0.0.0-4420",
|
|
18
|
+
"@docusaurus/preset-classic": "0.0.0-4420",
|
|
19
19
|
"@mdx-js/react": "^1.6.21",
|
|
20
20
|
"clsx": "^1.1.1",
|
|
21
21
|
"prism-react-renderer": "^1.2.1",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "docusaurus-2-classic-typescript-template",
|
|
3
|
-
"version": "0.0.0-
|
|
3
|
+
"version": "0.0.0-4420",
|
|
4
4
|
"private": true,
|
|
5
5
|
"scripts": {
|
|
6
6
|
"docusaurus": "docusaurus",
|
|
@@ -15,8 +15,8 @@
|
|
|
15
15
|
"typecheck": "tsc"
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@docusaurus/core": "0.0.0-
|
|
19
|
-
"@docusaurus/preset-classic": "0.0.0-
|
|
18
|
+
"@docusaurus/core": "0.0.0-4420",
|
|
19
|
+
"@docusaurus/preset-classic": "0.0.0-4420",
|
|
20
20
|
"@mdx-js/react": "^1.6.21",
|
|
21
21
|
"clsx": "^1.1.1",
|
|
22
22
|
"prism-react-renderer": "^1.2.1",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"react-dom": "^17.0.1"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
|
-
"@docusaurus/module-type-aliases": "0.0.0-
|
|
27
|
+
"@docusaurus/module-type-aliases": "0.0.0-4420",
|
|
28
28
|
"@tsconfig/docusaurus": "^1.0.4",
|
|
29
29
|
"typescript": "^4.5.2"
|
|
30
30
|
},
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import useBaseUrl from '@docusaurus/useBaseUrl';
|
|
1
2
|
import React from 'react';
|
|
2
3
|
import clsx from 'clsx';
|
|
3
4
|
import styles from './HomepageFeatures.module.css';
|
|
@@ -45,7 +46,11 @@ function Feature({title, image, description}: FeatureItem) {
|
|
|
45
46
|
return (
|
|
46
47
|
<div className={clsx('col col--4')}>
|
|
47
48
|
<div className="text--center">
|
|
48
|
-
<img
|
|
49
|
+
<img
|
|
50
|
+
className={styles.featureSvg}
|
|
51
|
+
alt={title}
|
|
52
|
+
src={useBaseUrl(image)}
|
|
53
|
+
/>
|
|
49
54
|
</div>
|
|
50
55
|
<div className="text--center padding-horiz--md">
|
|
51
56
|
<h3>{title}</h3>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "docusaurus-2-facebook-template",
|
|
3
|
-
"version": "0.0.0-
|
|
3
|
+
"version": "0.0.0-4420",
|
|
4
4
|
"private": true,
|
|
5
5
|
"scripts": {
|
|
6
6
|
"docusaurus": "docusaurus",
|
|
@@ -18,8 +18,8 @@
|
|
|
18
18
|
"format:diff": "prettier --config .prettierrc --list-different \"**/*.{js,jsx,ts,tsx,md,mdx}\""
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@docusaurus/core": "0.0.0-
|
|
22
|
-
"@docusaurus/preset-classic": "0.0.0-
|
|
21
|
+
"@docusaurus/core": "0.0.0-4420",
|
|
22
|
+
"@docusaurus/preset-classic": "0.0.0-4420",
|
|
23
23
|
"@mdx-js/react": "^1.6.21",
|
|
24
24
|
"clsx": "^1.1.1",
|
|
25
25
|
"react": "^17.0.1",
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
Copyright (c) 2015, Rebecca Turner
|
|
2
|
-
|
|
3
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
4
|
-
purpose with or without fee is hereby granted, provided that the above
|
|
5
|
-
copyright notice and this permission notice appear in all copies.
|
|
6
|
-
|
|
7
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
8
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
|
9
|
-
FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
10
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
11
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
12
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
13
|
-
PERFORMANCE OF THIS SOFTWARE.
|
|
@@ -1,133 +0,0 @@
|
|
|
1
|
-
# hosted-git-info
|
|
2
|
-
|
|
3
|
-
This will let you identify and transform various git hosts URLs between
|
|
4
|
-
protocols. It also can tell you what the URL is for the raw path for
|
|
5
|
-
particular file for direct access without git.
|
|
6
|
-
|
|
7
|
-
## Example
|
|
8
|
-
|
|
9
|
-
```javascript
|
|
10
|
-
var hostedGitInfo = require("hosted-git-info")
|
|
11
|
-
var info = hostedGitInfo.fromUrl("git@github.com:npm/hosted-git-info.git", opts)
|
|
12
|
-
/* info looks like:
|
|
13
|
-
{
|
|
14
|
-
type: "github",
|
|
15
|
-
domain: "github.com",
|
|
16
|
-
user: "npm",
|
|
17
|
-
project: "hosted-git-info"
|
|
18
|
-
}
|
|
19
|
-
*/
|
|
20
|
-
```
|
|
21
|
-
|
|
22
|
-
If the URL can't be matched with a git host, `null` will be returned. We
|
|
23
|
-
can match git, ssh and https urls. Additionally, we can match ssh connect
|
|
24
|
-
strings (`git@github.com:npm/hosted-git-info`) and shortcuts (eg,
|
|
25
|
-
`github:npm/hosted-git-info`). GitHub specifically, is detected in the case
|
|
26
|
-
of a third, unprefixed, form: `npm/hosted-git-info`.
|
|
27
|
-
|
|
28
|
-
If it does match, the returned object has properties of:
|
|
29
|
-
|
|
30
|
-
* info.type -- The short name of the service
|
|
31
|
-
* info.domain -- The domain for git protocol use
|
|
32
|
-
* info.user -- The name of the user/org on the git host
|
|
33
|
-
* info.project -- The name of the project on the git host
|
|
34
|
-
|
|
35
|
-
## Version Contract
|
|
36
|
-
|
|
37
|
-
The major version will be bumped any time…
|
|
38
|
-
|
|
39
|
-
* The constructor stops accepting URLs that it previously accepted.
|
|
40
|
-
* A method is removed.
|
|
41
|
-
* A method can no longer accept the number and type of arguments it previously accepted.
|
|
42
|
-
* A method can return a different type than it currently returns.
|
|
43
|
-
|
|
44
|
-
Implications:
|
|
45
|
-
|
|
46
|
-
* I do not consider the specific format of the urls returned from, say
|
|
47
|
-
`.https()` to be a part of the contract. The contract is that it will
|
|
48
|
-
return a string that can be used to fetch the repo via HTTPS. But what
|
|
49
|
-
that string looks like, specifically, can change.
|
|
50
|
-
* Dropping support for a hosted git provider would constitute a breaking
|
|
51
|
-
change.
|
|
52
|
-
|
|
53
|
-
## Usage
|
|
54
|
-
|
|
55
|
-
### var info = hostedGitInfo.fromUrl(gitSpecifier[, options])
|
|
56
|
-
|
|
57
|
-
* *gitSpecifer* is a URL of a git repository or a SCP-style specifier of one.
|
|
58
|
-
* *options* is an optional object. It can have the following properties:
|
|
59
|
-
* *noCommittish* — If true then committishes won't be included in generated URLs.
|
|
60
|
-
* *noGitPlus* — If true then `git+` won't be prefixed on URLs.
|
|
61
|
-
|
|
62
|
-
## Methods
|
|
63
|
-
|
|
64
|
-
All of the methods take the same options as the `fromUrl` factory. Options
|
|
65
|
-
provided to a method override those provided to the constructor.
|
|
66
|
-
|
|
67
|
-
* info.file(path, opts)
|
|
68
|
-
|
|
69
|
-
Given the path of a file relative to the repository, returns a URL for
|
|
70
|
-
directly fetching it from the githost. If no committish was set then
|
|
71
|
-
`master` will be used as the default.
|
|
72
|
-
|
|
73
|
-
For example `hostedGitInfo.fromUrl("git@github.com:npm/hosted-git-info.git#v1.0.0").file("package.json")`
|
|
74
|
-
would return `https://raw.githubusercontent.com/npm/hosted-git-info/v1.0.0/package.json`
|
|
75
|
-
|
|
76
|
-
* info.shortcut(opts)
|
|
77
|
-
|
|
78
|
-
eg, `github:npm/hosted-git-info`
|
|
79
|
-
|
|
80
|
-
* info.browse(path, fragment, opts)
|
|
81
|
-
|
|
82
|
-
eg, `https://github.com/npm/hosted-git-info/tree/v1.2.0`,
|
|
83
|
-
`https://github.com/npm/hosted-git-info/tree/v1.2.0/package.json`,
|
|
84
|
-
`https://github.com/npm/hosted-git-info/tree/v1.2.0/REAMDE.md#supported-hosts`
|
|
85
|
-
|
|
86
|
-
* info.bugs(opts)
|
|
87
|
-
|
|
88
|
-
eg, `https://github.com/npm/hosted-git-info/issues`
|
|
89
|
-
|
|
90
|
-
* info.docs(opts)
|
|
91
|
-
|
|
92
|
-
eg, `https://github.com/npm/hosted-git-info/tree/v1.2.0#readme`
|
|
93
|
-
|
|
94
|
-
* info.https(opts)
|
|
95
|
-
|
|
96
|
-
eg, `git+https://github.com/npm/hosted-git-info.git`
|
|
97
|
-
|
|
98
|
-
* info.sshurl(opts)
|
|
99
|
-
|
|
100
|
-
eg, `git+ssh://git@github.com/npm/hosted-git-info.git`
|
|
101
|
-
|
|
102
|
-
* info.ssh(opts)
|
|
103
|
-
|
|
104
|
-
eg, `git@github.com:npm/hosted-git-info.git`
|
|
105
|
-
|
|
106
|
-
* info.path(opts)
|
|
107
|
-
|
|
108
|
-
eg, `npm/hosted-git-info`
|
|
109
|
-
|
|
110
|
-
* info.tarball(opts)
|
|
111
|
-
|
|
112
|
-
eg, `https://github.com/npm/hosted-git-info/archive/v1.2.0.tar.gz`
|
|
113
|
-
|
|
114
|
-
* info.getDefaultRepresentation()
|
|
115
|
-
|
|
116
|
-
Returns the default output type. The default output type is based on the
|
|
117
|
-
string you passed in to be parsed
|
|
118
|
-
|
|
119
|
-
* info.toString(opts)
|
|
120
|
-
|
|
121
|
-
Uses the getDefaultRepresentation to call one of the other methods to get a URL for
|
|
122
|
-
this resource. As such `hostedGitInfo.fromUrl(url).toString()` will give
|
|
123
|
-
you a normalized version of the URL that still uses the same protocol.
|
|
124
|
-
|
|
125
|
-
Shortcuts will still be returned as shortcuts, but the special case github
|
|
126
|
-
form of `org/project` will be normalized to `github:org/project`.
|
|
127
|
-
|
|
128
|
-
SSH connect strings will be normalized into `git+ssh` URLs.
|
|
129
|
-
|
|
130
|
-
## Supported hosts
|
|
131
|
-
|
|
132
|
-
Currently this supports GitHub, Bitbucket and GitLab. Pull requests for
|
|
133
|
-
additional hosts welcome.
|
|
@@ -1,184 +0,0 @@
|
|
|
1
|
-
'use strict'
|
|
2
|
-
const maybeJoin = (...args) => args.every(arg => arg) ? args.join('') : ''
|
|
3
|
-
const maybeEncode = (arg) => arg ? encodeURIComponent(arg) : ''
|
|
4
|
-
|
|
5
|
-
const defaults = {
|
|
6
|
-
sshtemplate: ({ domain, user, project, committish }) => `git@${domain}:${user}/${project}.git${maybeJoin('#', committish)}`,
|
|
7
|
-
sshurltemplate: ({ domain, user, project, committish }) => `git+ssh://git@${domain}/${user}/${project}.git${maybeJoin('#', committish)}`,
|
|
8
|
-
browsetemplate: ({ domain, user, project, committish, treepath }) => `https://${domain}/${user}/${project}${maybeJoin('/', treepath, '/', maybeEncode(committish))}`,
|
|
9
|
-
browsefiletemplate: ({ domain, user, project, committish, treepath, path, fragment, hashformat }) => `https://${domain}/${user}/${project}/${treepath}/${maybeEncode(committish || 'master')}/${path}${maybeJoin('#', hashformat(fragment || ''))}`,
|
|
10
|
-
docstemplate: ({ domain, user, project, treepath, committish }) => `https://${domain}/${user}/${project}${maybeJoin('/', treepath, '/', maybeEncode(committish))}#readme`,
|
|
11
|
-
httpstemplate: ({ auth, domain, user, project, committish }) => `git+https://${maybeJoin(auth, '@')}${domain}/${user}/${project}.git${maybeJoin('#', committish)}`,
|
|
12
|
-
filetemplate: ({ domain, user, project, committish, path }) => `https://${domain}/${user}/${project}/raw/${maybeEncode(committish) || 'master'}/${path}`,
|
|
13
|
-
shortcuttemplate: ({ type, user, project, committish }) => `${type}:${user}/${project}${maybeJoin('#', committish)}`,
|
|
14
|
-
pathtemplate: ({ user, project, committish }) => `${user}/${project}${maybeJoin('#', committish)}`,
|
|
15
|
-
bugstemplate: ({ domain, user, project }) => `https://${domain}/${user}/${project}/issues`,
|
|
16
|
-
hashformat: formatHashFragment
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
const gitHosts = {}
|
|
20
|
-
gitHosts.github = Object.assign({}, defaults, {
|
|
21
|
-
// First two are insecure and generally shouldn't be used any more, but
|
|
22
|
-
// they are still supported.
|
|
23
|
-
protocols: ['git:', 'http:', 'git+ssh:', 'git+https:', 'ssh:', 'https:'],
|
|
24
|
-
domain: 'github.com',
|
|
25
|
-
treepath: 'tree',
|
|
26
|
-
filetemplate: ({ auth, user, project, committish, path }) => `https://${maybeJoin(auth, '@')}raw.githubusercontent.com/${user}/${project}/${maybeEncode(committish) || 'master'}/${path}`,
|
|
27
|
-
gittemplate: ({ auth, domain, user, project, committish }) => `git://${maybeJoin(auth, '@')}${domain}/${user}/${project}.git${maybeJoin('#', committish)}`,
|
|
28
|
-
tarballtemplate: ({ domain, user, project, committish }) => `https://codeload.${domain}/${user}/${project}/tar.gz/${maybeEncode(committish) || 'master'}`,
|
|
29
|
-
extract: (url) => {
|
|
30
|
-
let [, user, project, type, committish] = url.pathname.split('/', 5)
|
|
31
|
-
if (type && type !== 'tree') {
|
|
32
|
-
return
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
if (!type) {
|
|
36
|
-
committish = url.hash.slice(1)
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
if (project && project.endsWith('.git')) {
|
|
40
|
-
project = project.slice(0, -4)
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
if (!user || !project) {
|
|
44
|
-
return
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
return { user, project, committish }
|
|
48
|
-
}
|
|
49
|
-
})
|
|
50
|
-
|
|
51
|
-
gitHosts.bitbucket = Object.assign({}, defaults, {
|
|
52
|
-
protocols: ['git+ssh:', 'git+https:', 'ssh:', 'https:'],
|
|
53
|
-
domain: 'bitbucket.org',
|
|
54
|
-
treepath: 'src',
|
|
55
|
-
tarballtemplate: ({ domain, user, project, committish }) => `https://${domain}/${user}/${project}/get/${maybeEncode(committish) || 'master'}.tar.gz`,
|
|
56
|
-
extract: (url) => {
|
|
57
|
-
let [, user, project, aux] = url.pathname.split('/', 4)
|
|
58
|
-
if (['get'].includes(aux)) {
|
|
59
|
-
return
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
if (project && project.endsWith('.git')) {
|
|
63
|
-
project = project.slice(0, -4)
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
if (!user || !project) {
|
|
67
|
-
return
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
return { user, project, committish: url.hash.slice(1) }
|
|
71
|
-
}
|
|
72
|
-
})
|
|
73
|
-
|
|
74
|
-
gitHosts.gitlab = Object.assign({}, defaults, {
|
|
75
|
-
protocols: ['git+ssh:', 'git+https:', 'ssh:', 'https:'],
|
|
76
|
-
domain: 'gitlab.com',
|
|
77
|
-
treepath: 'tree',
|
|
78
|
-
httpstemplate: ({ auth, domain, user, project, committish }) => `git+https://${maybeJoin(auth, '@')}${domain}/${user}/${project}.git${maybeJoin('#', committish)}`,
|
|
79
|
-
tarballtemplate: ({ domain, user, project, committish }) => `https://${domain}/${user}/${project}/repository/archive.tar.gz?ref=${maybeEncode(committish) || 'master'}`,
|
|
80
|
-
extract: (url) => {
|
|
81
|
-
const path = url.pathname.slice(1)
|
|
82
|
-
if (path.includes('/-/') || path.includes('/archive.tar.gz')) {
|
|
83
|
-
return
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
const segments = path.split('/')
|
|
87
|
-
let project = segments.pop()
|
|
88
|
-
if (project.endsWith('.git')) {
|
|
89
|
-
project = project.slice(0, -4)
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
const user = segments.join('/')
|
|
93
|
-
if (!user || !project) {
|
|
94
|
-
return
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
return { user, project, committish: url.hash.slice(1) }
|
|
98
|
-
}
|
|
99
|
-
})
|
|
100
|
-
|
|
101
|
-
gitHosts.gist = Object.assign({}, defaults, {
|
|
102
|
-
protocols: ['git:', 'git+ssh:', 'git+https:', 'ssh:', 'https:'],
|
|
103
|
-
domain: 'gist.github.com',
|
|
104
|
-
sshtemplate: ({ domain, project, committish }) => `git@${domain}:${project}.git${maybeJoin('#', committish)}`,
|
|
105
|
-
sshurltemplate: ({ domain, project, committish }) => `git+ssh://git@${domain}/${project}.git${maybeJoin('#', committish)}`,
|
|
106
|
-
browsetemplate: ({ domain, project, committish }) => `https://${domain}/${project}${maybeJoin('/', maybeEncode(committish))}`,
|
|
107
|
-
browsefiletemplate: ({ domain, project, committish, path, hashformat }) => `https://${domain}/${project}${maybeJoin('/', maybeEncode(committish))}${maybeJoin('#', hashformat(path))}`,
|
|
108
|
-
docstemplate: ({ domain, project, committish }) => `https://${domain}/${project}${maybeJoin('/', maybeEncode(committish))}`,
|
|
109
|
-
httpstemplate: ({ domain, project, committish }) => `git+https://${domain}/${project}.git${maybeJoin('#', committish)}`,
|
|
110
|
-
filetemplate: ({ user, project, committish, path }) => `https://gist.githubusercontent.com/${user}/${project}/raw${maybeJoin('/', maybeEncode(committish))}/${path}`,
|
|
111
|
-
shortcuttemplate: ({ type, project, committish }) => `${type}:${project}${maybeJoin('#', committish)}`,
|
|
112
|
-
pathtemplate: ({ project, committish }) => `${project}${maybeJoin('#', committish)}`,
|
|
113
|
-
bugstemplate: ({ domain, project }) => `https://${domain}/${project}`,
|
|
114
|
-
gittemplate: ({ domain, project, committish }) => `git://${domain}/${project}.git${maybeJoin('#', committish)}`,
|
|
115
|
-
tarballtemplate: ({ project, committish }) => `https://codeload.github.com/gist/${project}/tar.gz/${maybeEncode(committish) || 'master'}`,
|
|
116
|
-
extract: (url) => {
|
|
117
|
-
let [, user, project, aux] = url.pathname.split('/', 4)
|
|
118
|
-
if (aux === 'raw') {
|
|
119
|
-
return
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
if (!project) {
|
|
123
|
-
if (!user) {
|
|
124
|
-
return
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
project = user
|
|
128
|
-
user = null
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
if (project.endsWith('.git')) {
|
|
132
|
-
project = project.slice(0, -4)
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
return { user, project, committish: url.hash.slice(1) }
|
|
136
|
-
},
|
|
137
|
-
hashformat: function (fragment) {
|
|
138
|
-
return fragment && 'file-' + formatHashFragment(fragment)
|
|
139
|
-
}
|
|
140
|
-
})
|
|
141
|
-
|
|
142
|
-
gitHosts.sourcehut = Object.assign({}, defaults, {
|
|
143
|
-
protocols: ['git+ssh:', 'https:'],
|
|
144
|
-
domain: 'git.sr.ht',
|
|
145
|
-
treepath: 'tree',
|
|
146
|
-
browsefiletemplate: ({ domain, user, project, committish, treepath, path, fragment, hashformat }) => `https://${domain}/${user}/${project}/${treepath}/${maybeEncode(committish || 'main')}/${path}${maybeJoin('#', hashformat(fragment || ''))}`,
|
|
147
|
-
filetemplate: ({ domain, user, project, committish, path }) => `https://${domain}/${user}/${project}/blob/${maybeEncode(committish) || 'main'}/${path}`,
|
|
148
|
-
httpstemplate: ({ domain, user, project, committish }) => `https://${domain}/${user}/${project}.git${maybeJoin('#', committish)}`,
|
|
149
|
-
tarballtemplate: ({ domain, user, project, committish }) => `https://${domain}/${user}/${project}/archive/${maybeEncode(committish) || 'main'}.tar.gz`,
|
|
150
|
-
bugstemplate: ({ domain, user, project }) => `https://todo.sr.ht/${user}/${project}`,
|
|
151
|
-
docstemplate: ({ domain, user, project, treepath, committish }) => `https://${domain}/${user}/${project}${maybeJoin('/', treepath, '/', maybeEncode(committish))}#readme`,
|
|
152
|
-
extract: (url) => {
|
|
153
|
-
let [, user, project, aux] = url.pathname.split('/', 4)
|
|
154
|
-
|
|
155
|
-
// tarball url
|
|
156
|
-
if (['archive'].includes(aux)) {
|
|
157
|
-
return
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
if (project && project.endsWith('.git')) {
|
|
161
|
-
project = project.slice(0, -4)
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
if (!user || !project) {
|
|
165
|
-
return
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
return { user, project, committish: url.hash.slice(1) }
|
|
169
|
-
}
|
|
170
|
-
})
|
|
171
|
-
|
|
172
|
-
const names = Object.keys(gitHosts)
|
|
173
|
-
gitHosts.byShortcut = {}
|
|
174
|
-
gitHosts.byDomain = {}
|
|
175
|
-
for (const name of names) {
|
|
176
|
-
gitHosts.byShortcut[`${name}:`] = name
|
|
177
|
-
gitHosts.byDomain[gitHosts[name].domain] = name
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
function formatHashFragment (fragment) {
|
|
181
|
-
return fragment.toLowerCase().replace(/^\W+|\/|\W+$/g, '').replace(/\W+/g, '-')
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
module.exports = gitHosts
|
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
'use strict'
|
|
2
|
-
const gitHosts = require('./git-host-info.js')
|
|
3
|
-
|
|
4
|
-
class GitHost {
|
|
5
|
-
constructor (type, user, auth, project, committish, defaultRepresentation, opts = {}) {
|
|
6
|
-
Object.assign(this, gitHosts[type])
|
|
7
|
-
this.type = type
|
|
8
|
-
this.user = user
|
|
9
|
-
this.auth = auth
|
|
10
|
-
this.project = project
|
|
11
|
-
this.committish = committish
|
|
12
|
-
this.default = defaultRepresentation
|
|
13
|
-
this.opts = opts
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
hash () {
|
|
17
|
-
return this.committish ? `#${this.committish}` : ''
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
ssh (opts) {
|
|
21
|
-
return this._fill(this.sshtemplate, opts)
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
_fill (template, opts) {
|
|
25
|
-
if (typeof template === 'function') {
|
|
26
|
-
const options = { ...this, ...this.opts, ...opts }
|
|
27
|
-
|
|
28
|
-
// the path should always be set so we don't end up with 'undefined' in urls
|
|
29
|
-
if (!options.path) {
|
|
30
|
-
options.path = ''
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
// template functions will insert the leading slash themselves
|
|
34
|
-
if (options.path.startsWith('/')) {
|
|
35
|
-
options.path = options.path.slice(1)
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
if (options.noCommittish) {
|
|
39
|
-
options.committish = null
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
const result = template(options)
|
|
43
|
-
return options.noGitPlus && result.startsWith('git+') ? result.slice(4) : result
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
return null
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
sshurl (opts) {
|
|
50
|
-
return this._fill(this.sshurltemplate, opts)
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
browse (path, fragment, opts) {
|
|
54
|
-
// not a string, treat path as opts
|
|
55
|
-
if (typeof path !== 'string') {
|
|
56
|
-
return this._fill(this.browsetemplate, path)
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
if (typeof fragment !== 'string') {
|
|
60
|
-
opts = fragment
|
|
61
|
-
fragment = null
|
|
62
|
-
}
|
|
63
|
-
return this._fill(this.browsefiletemplate, { ...opts, fragment, path })
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
docs (opts) {
|
|
67
|
-
return this._fill(this.docstemplate, opts)
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
bugs (opts) {
|
|
71
|
-
return this._fill(this.bugstemplate, opts)
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
https (opts) {
|
|
75
|
-
return this._fill(this.httpstemplate, opts)
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
git (opts) {
|
|
79
|
-
return this._fill(this.gittemplate, opts)
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
shortcut (opts) {
|
|
83
|
-
return this._fill(this.shortcuttemplate, opts)
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
path (opts) {
|
|
87
|
-
return this._fill(this.pathtemplate, opts)
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
tarball (opts) {
|
|
91
|
-
return this._fill(this.tarballtemplate, { ...opts, noCommittish: false })
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
file (path, opts) {
|
|
95
|
-
return this._fill(this.filetemplate, { ...opts, path })
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
getDefaultRepresentation () {
|
|
99
|
-
return this.default
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
toString (opts) {
|
|
103
|
-
if (this.default && typeof this[this.default] === 'function') {
|
|
104
|
-
return this[this.default](opts)
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
return this.sshurl(opts)
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
module.exports = GitHost
|