create-docusaurus 0.0.0-4403 → 0.0.0-4416

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.
Files changed (27) hide show
  1. package/package.json +3 -3
  2. package/templates/classic/package.json +3 -3
  3. package/templates/classic-typescript/package.json +4 -4
  4. package/templates/classic-typescript/src/components/HomepageFeatures.tsx +6 -1
  5. package/templates/facebook/package.json +3 -3
  6. package/templates/facebook/node_modules/hosted-git-info/CHANGELOG.md +0 -185
  7. package/templates/facebook/node_modules/hosted-git-info/LICENSE +0 -13
  8. package/templates/facebook/node_modules/hosted-git-info/README.md +0 -133
  9. package/templates/facebook/node_modules/hosted-git-info/git-host-info.js +0 -154
  10. package/templates/facebook/node_modules/hosted-git-info/git-host.js +0 -110
  11. package/templates/facebook/node_modules/hosted-git-info/index.js +0 -237
  12. package/templates/facebook/node_modules/hosted-git-info/package.json +0 -52
  13. package/templates/facebook/node_modules/lru-cache/LICENSE +0 -15
  14. package/templates/facebook/node_modules/lru-cache/README.md +0 -166
  15. package/templates/facebook/node_modules/lru-cache/index.js +0 -334
  16. package/templates/facebook/node_modules/lru-cache/package.json +0 -34
  17. package/templates/facebook/node_modules/normalize-package-data/AUTHORS +0 -4
  18. package/templates/facebook/node_modules/normalize-package-data/LICENSE +0 -15
  19. package/templates/facebook/node_modules/normalize-package-data/README.md +0 -108
  20. package/templates/facebook/node_modules/normalize-package-data/lib/extract_description.js +0 -22
  21. package/templates/facebook/node_modules/normalize-package-data/lib/fixer.js +0 -474
  22. package/templates/facebook/node_modules/normalize-package-data/lib/make_warning.js +0 -22
  23. package/templates/facebook/node_modules/normalize-package-data/lib/normalize.js +0 -48
  24. package/templates/facebook/node_modules/normalize-package-data/lib/safe_format.js +0 -11
  25. package/templates/facebook/node_modules/normalize-package-data/lib/typos.json +0 -25
  26. package/templates/facebook/node_modules/normalize-package-data/lib/warning_messages.json +0 -30
  27. 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-4403",
3
+ "version": "0.0.0-4416",
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-4403",
26
+ "@docusaurus/logger": "0.0.0-4416",
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": "550d336db77e6225a4409a859f47e4f705a3908a"
42
+ "gitHead": "1e293693c98bbc0b8052e82ce35159807ec5eaa9"
43
43
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "docusaurus-2-classic-template",
3
- "version": "0.0.0-4403",
3
+ "version": "0.0.0-4416",
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-4403",
18
- "@docusaurus/preset-classic": "0.0.0-4403",
17
+ "@docusaurus/core": "0.0.0-4416",
18
+ "@docusaurus/preset-classic": "0.0.0-4416",
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-4403",
3
+ "version": "0.0.0-4416",
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-4403",
19
- "@docusaurus/preset-classic": "0.0.0-4403",
18
+ "@docusaurus/core": "0.0.0-4416",
19
+ "@docusaurus/preset-classic": "0.0.0-4416",
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-4403",
27
+ "@docusaurus/module-type-aliases": "0.0.0-4416",
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 className={styles.featureSvg} alt={title} src={image} />
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-4403",
3
+ "version": "0.0.0-4416",
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-4403",
22
- "@docusaurus/preset-classic": "0.0.0-4403",
21
+ "@docusaurus/core": "0.0.0-4416",
22
+ "@docusaurus/preset-classic": "0.0.0-4416",
23
23
  "@mdx-js/react": "^1.6.21",
24
24
  "clsx": "^1.1.1",
25
25
  "react": "^17.0.1",
@@ -1,185 +0,0 @@
1
- # Change Log
2
-
3
- All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
-
5
- <a name="3.0.8"></a>
6
- ## [3.0.8](https://github.com/npm/hosted-git-info/compare/v3.0.7...v3.0.8) (2021-01-28)
7
-
8
-
9
- ### Bug Fixes
10
-
11
- * simplify the regular expression for shortcut matching ([bede0dc](https://github.com/npm/hosted-git-info/commit/bede0dc)), closes [#76](https://github.com/npm/hosted-git-info/issues/76)
12
-
13
-
14
-
15
- <a name="3.0.7"></a>
16
- ## [3.0.7](https://github.com/npm/hosted-git-info/compare/v3.0.6...v3.0.7) (2020-10-15)
17
-
18
-
19
- ### Bug Fixes
20
-
21
- * correctly filter out urls for tarballs in gitlab ([eb5bd5a](https://github.com/npm/hosted-git-info/commit/eb5bd5a)), closes [#69](https://github.com/npm/hosted-git-info/issues/69)
22
-
23
-
24
-
25
- <a name="3.0.6"></a>
26
- ## [3.0.6](https://github.com/npm/hosted-git-info/compare/v3.0.5...v3.0.6) (2020-10-12)
27
-
28
-
29
- ### Bug Fixes
30
-
31
- * support to github gist legacy hash length ([c067102](https://github.com/npm/hosted-git-info/commit/c067102)), closes [#68](https://github.com/npm/hosted-git-info/issues/68)
32
-
33
-
34
-
35
- <a name="3.0.5"></a>
36
- ## [3.0.5](https://github.com/npm/hosted-git-info/compare/v3.0.4...v3.0.5) (2020-07-11)
37
-
38
-
39
-
40
- <a name="3.0.4"></a>
41
- ## [3.0.4](https://github.com/npm/hosted-git-info/compare/v3.0.3...v3.0.4) (2020-02-26)
42
-
43
-
44
- ### Bug Fixes
45
-
46
- * Do not pass scp-style URLs to the WhatWG url.URL ([0835306](https://github.com/npm/hosted-git-info/commit/0835306)), closes [#60](https://github.com/npm/hosted-git-info/issues/60) [#63](https://github.com/npm/hosted-git-info/issues/63)
47
-
48
-
49
-
50
- <a name="3.0.3"></a>
51
- ## [3.0.3](https://github.com/npm/hosted-git-info/compare/v3.0.2...v3.0.3) (2020-02-25)
52
-
53
-
54
-
55
- <a name="3.0.2"></a>
56
- ## [3.0.2](https://github.com/npm/hosted-git-info/compare/v3.0.1...v3.0.2) (2019-10-08)
57
-
58
-
59
- ### Bug Fixes
60
-
61
- * do not encodeURIComponent the domain ([3e5fbec](https://github.com/npm/hosted-git-info/commit/3e5fbec)), closes [#53](https://github.com/npm/hosted-git-info/issues/53)
62
-
63
-
64
-
65
- <a name="3.0.1"></a>
66
- ## [3.0.1](https://github.com/npm/hosted-git-info/compare/v3.0.0...v3.0.1) (2019-10-07)
67
-
68
-
69
- ### Bug Fixes
70
-
71
- * update pathmatch for gitlab ([e3e3054](https://github.com/npm/hosted-git-info/commit/e3e3054)), closes [#52](https://github.com/npm/hosted-git-info/issues/52)
72
- * updated pathmatch for gitlab ([fa87af7](https://github.com/npm/hosted-git-info/commit/fa87af7))
73
-
74
-
75
-
76
- <a name="3.0.0"></a>
77
- # [3.0.0](https://github.com/npm/hosted-git-info/compare/v2.8.3...v3.0.0) (2019-08-12)
78
-
79
-
80
- ### Bug Fixes
81
-
82
- * **cache:** Switch to lru-cache to save ourselves from unlimited memory consumption ([37c2891](https://github.com/npm/hosted-git-info/commit/37c2891)), closes [#38](https://github.com/npm/hosted-git-info/issues/38)
83
-
84
-
85
- ### BREAKING CHANGES
86
-
87
- * **cache:** Drop support for node 0.x
88
-
89
-
90
-
91
- <a name="2.8.3"></a>
92
- ## [2.8.3](https://github.com/npm/hosted-git-info/compare/v2.8.2...v2.8.3) (2019-08-12)
93
-
94
-
95
-
96
- <a name="2.8.2"></a>
97
- ## [2.8.2](https://github.com/npm/hosted-git-info/compare/v2.8.1...v2.8.2) (2019-08-05)
98
-
99
-
100
- ### Bug Fixes
101
-
102
- * http protocol use sshurl by default ([3b1d629](https://github.com/npm/hosted-git-info/commit/3b1d629)), closes [#48](https://github.com/npm/hosted-git-info/issues/48)
103
-
104
-
105
-
106
- <a name="2.8.1"></a>
107
- ## [2.8.1](https://github.com/npm/hosted-git-info/compare/v2.8.0...v2.8.1) (2019-08-05)
108
-
109
-
110
- ### Bug Fixes
111
-
112
- * ignore noCommittish on tarball url generation ([5d4a8d7](https://github.com/npm/hosted-git-info/commit/5d4a8d7))
113
- * use gist tarball url that works for anonymous gists ([1692435](https://github.com/npm/hosted-git-info/commit/1692435))
114
-
115
-
116
-
117
- <a name="2.8.0"></a>
118
- # [2.8.0](https://github.com/npm/hosted-git-info/compare/v2.7.1...v2.8.0) (2019-08-05)
119
-
120
-
121
- ### Bug Fixes
122
-
123
- * Allow slashes in gitlab project section ([bbcf7b2](https://github.com/npm/hosted-git-info/commit/bbcf7b2)), closes [#46](https://github.com/npm/hosted-git-info/issues/46) [#43](https://github.com/npm/hosted-git-info/issues/43)
124
- * **git-host:** disallow URI-encoded slash (%2F) in `path` ([3776fa5](https://github.com/npm/hosted-git-info/commit/3776fa5)), closes [#44](https://github.com/npm/hosted-git-info/issues/44)
125
- * **gitlab:** Do not URL encode slashes in project name for GitLab https URL ([cbf04f9](https://github.com/npm/hosted-git-info/commit/cbf04f9)), closes [#47](https://github.com/npm/hosted-git-info/issues/47)
126
- * do not allow invalid gist urls ([d5cf830](https://github.com/npm/hosted-git-info/commit/d5cf830))
127
- * **cache:** Switch to lru-cache to save ourselves from unlimited memory consumption ([e518222](https://github.com/npm/hosted-git-info/commit/e518222)), closes [#38](https://github.com/npm/hosted-git-info/issues/38)
128
-
129
-
130
- ### Features
131
-
132
- * give these objects a name ([60abaea](https://github.com/npm/hosted-git-info/commit/60abaea))
133
-
134
-
135
-
136
- <a name="2.7.1"></a>
137
- ## [2.7.1](https://github.com/npm/hosted-git-info/compare/v2.7.0...v2.7.1) (2018-07-07)
138
-
139
-
140
- ### Bug Fixes
141
-
142
- * **index:** Guard against non-string types ([5bc580d](https://github.com/npm/hosted-git-info/commit/5bc580d))
143
- * **parse:** Crash on strings that parse to having no host ([c931482](https://github.com/npm/hosted-git-info/commit/c931482)), closes [#35](https://github.com/npm/hosted-git-info/issues/35)
144
-
145
-
146
-
147
- <a name="2.7.0"></a>
148
- # [2.7.0](https://github.com/npm/hosted-git-info/compare/v2.6.1...v2.7.0) (2018-07-06)
149
-
150
-
151
- ### Bug Fixes
152
-
153
- * **github tarball:** update github tarballtemplate ([6efd582](https://github.com/npm/hosted-git-info/commit/6efd582)), closes [#34](https://github.com/npm/hosted-git-info/issues/34)
154
- * **gitlab docs:** switched to lowercase anchors for readmes ([701bcd1](https://github.com/npm/hosted-git-info/commit/701bcd1))
155
-
156
-
157
- ### Features
158
-
159
- * **all:** Support www. prefixes on hostnames ([3349575](https://github.com/npm/hosted-git-info/commit/3349575)), closes [#32](https://github.com/npm/hosted-git-info/issues/32)
160
-
161
-
162
-
163
- <a name="2.6.1"></a>
164
- ## [2.6.1](https://github.com/npm/hosted-git-info/compare/v2.6.0...v2.6.1) (2018-06-25)
165
-
166
- ### Bug Fixes
167
-
168
- * **Revert:** "compat: remove Object.assign fallback ([#25](https://github.com/npm/hosted-git-info/issues/25))" ([cce5a62](https://github.com/npm/hosted-git-info/commit/cce5a62))
169
- * **Revert:** "git-host: fix forgotten extend()" ([a815ec9](https://github.com/npm/hosted-git-info/commit/a815ec9))
170
-
171
-
172
-
173
- <a name="2.6.0"></a>
174
- # [2.6.0](https://github.com/npm/hosted-git-info/compare/v2.5.0...v2.6.0) (2018-03-07)
175
-
176
-
177
- ### Bug Fixes
178
-
179
- * **compat:** remove Object.assign fallback ([#25](https://github.com/npm/hosted-git-info/issues/25)) ([627ab55](https://github.com/npm/hosted-git-info/commit/627ab55))
180
- * **git-host:** fix forgotten extend() ([eba1f7b](https://github.com/npm/hosted-git-info/commit/eba1f7b))
181
-
182
-
183
- ### Features
184
-
185
- * **browse:** fragment support for browse() ([#28](https://github.com/npm/hosted-git-info/issues/28)) ([cd5e5bb](https://github.com/npm/hosted-git-info/commit/cd5e5bb))
@@ -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,154 +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
- const names = Object.keys(gitHosts)
143
- gitHosts.byShortcut = {}
144
- gitHosts.byDomain = {}
145
- for (const name of names) {
146
- gitHosts.byShortcut[`${name}:`] = name
147
- gitHosts.byDomain[gitHosts[name].domain] = name
148
- }
149
-
150
- function formatHashFragment (fragment) {
151
- return fragment.toLowerCase().replace(/^\W+|\/|\W+$/g, '').replace(/\W+/g, '-')
152
- }
153
-
154
- module.exports = gitHosts