govuk_publishing_components 17.20.0 → 17.21.0
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.
- checksums.yaml +4 -4
- data/app/assets/stylesheets/govuk_publishing_components/components/_select.scss +8 -0
- data/app/views/govuk_publishing_components/components/_subscription-links.html.erb +15 -5
- data/app/views/govuk_publishing_components/components/docs/subscription-links.yml +13 -2
- data/lib/govuk_publishing_components/version.rb +1 -1
- data/node_modules/accessible-autocomplete/package.json +1 -1
- data/node_modules/graceful-fs/package.json +13 -13
- data/node_modules/graceful-fs/polyfills.js +17 -11
- data/node_modules/hosted-git-info/CHANGELOG.md +40 -0
- data/node_modules/hosted-git-info/git-host-info.js +5 -3
- data/node_modules/hosted-git-info/git-host.js +35 -10
- data/node_modules/hosted-git-info/index.js +17 -15
- data/node_modules/hosted-git-info/package.json +40 -30
- data/node_modules/lru-cache/LICENSE +15 -0
- data/node_modules/lru-cache/README.md +166 -0
- data/node_modules/lru-cache/index.js +334 -0
- data/node_modules/lru-cache/package.json +108 -0
- data/node_modules/pkg-conf/package.json +1 -1
- data/node_modules/preact/debug.js +630 -2
- data/node_modules/preact/debug.js.map +1 -1
- data/node_modules/preact/debug/dist/debug.js +2 -0
- data/node_modules/preact/debug/dist/debug.js.map +1 -0
- data/node_modules/preact/debug/dist/debug.mjs +681 -0
- data/node_modules/preact/debug/dist/debug.mjs.map +1 -0
- data/node_modules/preact/debug/dist/debug.module.js +2 -0
- data/node_modules/preact/debug/dist/debug.module.js.map +1 -0
- data/node_modules/preact/debug/dist/debug.umd.js +2 -0
- data/node_modules/preact/debug/dist/debug.umd.js.map +1 -0
- data/node_modules/preact/debug/index.js +2 -1
- data/node_modules/preact/dist/preact.d.ts +808 -3
- data/node_modules/preact/dist/preact.dev.js +727 -727
- data/node_modules/preact/dist/preact.dev.js.map +1 -1
- data/node_modules/preact/dist/preact.js +1 -1
- data/node_modules/preact/dist/preact.js.flow +3 -3
- data/node_modules/preact/dist/preact.js.map +1 -1
- data/node_modules/preact/dist/preact.min.js +1 -1
- data/node_modules/preact/dist/preact.min.js.map +1 -1
- data/node_modules/preact/dist/preact.mjs +724 -724
- data/node_modules/preact/dist/preact.mjs.map +1 -1
- data/node_modules/preact/dist/preact.umd.js +751 -0
- data/node_modules/preact/dist/preact.umd.js.map +1 -0
- data/node_modules/preact/package.json +43 -26
- data/node_modules/preact/src/preact.d.ts +808 -3
- data/node_modules/preact/src/preact.js.flow +3 -3
- data/node_modules/preact/src/util.js +1 -1
- data/node_modules/yallist/LICENSE +15 -0
- data/node_modules/yallist/README.md +204 -0
- data/node_modules/yallist/iterator.js +8 -0
- data/node_modules/yallist/package.json +97 -0
- data/node_modules/yallist/yallist.js +376 -0
- metadata +21 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: e1032f24e05536ec9cc1ad6c774d9f5b6dd9dd05c86bcd9c3650a5adacb76e35
|
|
4
|
+
data.tar.gz: f5b6085f2fdd900a3f1fd6f917844f6939b72d51037ab9686abc0ddfaf6c2037
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e970106156e026f49a5b2fb6bd2ec36782f2a6dd0574e811b0976a91fd381c621daba3f9a2d8a14556236e9cb7b63d7122dae2cd814f5872be353eac43fd4d73
|
|
7
|
+
data.tar.gz: 646defcf886271c5b2b33d6103f350a90453bebb43c2f50bb5be60fde35806a9ff1efe404fd2f864ee108a1e498ad6d424a40ad2654c7074f5d54addc27222ba
|
|
@@ -3,3 +3,11 @@
|
|
|
3
3
|
.gem-c-select__select--full-width {
|
|
4
4
|
width: 100%;
|
|
5
5
|
}
|
|
6
|
+
|
|
7
|
+
// Solution to text inside selects becoming unreadable if font size in
|
|
8
|
+
// the browser is increased. This is currently a problem in govuk-frontend
|
|
9
|
+
.gem-c-select {
|
|
10
|
+
.govuk-select {
|
|
11
|
+
height: 2.14em;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
<%
|
|
2
2
|
brand ||= false
|
|
3
3
|
brand_helper = GovukPublishingComponents::AppHelpers::BrandHelper.new(brand)
|
|
4
|
+
|
|
4
5
|
sl_helper = GovukPublishingComponents::Presenters::SubscriptionLinksHelper.new(local_assigns)
|
|
5
6
|
shared_helper = GovukPublishingComponents::Presenters::SharedHelper.new(local_assigns)
|
|
6
7
|
|
|
@@ -10,8 +11,13 @@
|
|
|
10
11
|
css_classes = %w( gem-c-subscription-links )
|
|
11
12
|
css_classes << (shared_helper.get_margin_bottom) unless local_assigns[:margin_bottom] == 0
|
|
12
13
|
css_classes << brand_helper.brand_class
|
|
14
|
+
|
|
13
15
|
data = {"module": "gem-toggle"} if sl_helper.feed_link_box_value
|
|
16
|
+
|
|
14
17
|
hide_heading ||= false
|
|
18
|
+
|
|
19
|
+
email_signup_link_text_locale = local_assigns[:email_signup_link_text_locale]
|
|
20
|
+
feed_link_text_locale = local_assigns[:feed_link_text_locale]
|
|
15
21
|
%>
|
|
16
22
|
<% if sl_helper.component_data_is_valid? %>
|
|
17
23
|
<%= tag.section class: css_classes, data: data do %>
|
|
@@ -25,10 +31,11 @@
|
|
|
25
31
|
<% if sl_helper.email_signup_link.present? %>
|
|
26
32
|
<li class="gem-c-subscription-links__list-item<%= ' gem-c-subscription-links__list-item--small' if local_assigns[:small_form] == true %>" >
|
|
27
33
|
<svg xmlns="http://www.w3.org/2000/svg" width="21" height="15.75" class="gem-c-subscription-links__icon" focusable="false" fill="currentColor" aria-hidden="true"><path d="M19.687 0H1.312C.589 0 0 .587 0 1.313v13.124c0 .726.588 1.313 1.313 1.313h18.374c.725 0 1.313-.587 1.313-1.313V1.313C21 .587 20.412 0 19.687 0zm-2.625 2.625L10.5 7.875l-6.563-5.25h13.126zm1.313 10.5H2.625V3.937L10.5 10.5l7.875-6.563v9.188z"/></svg>
|
|
28
|
-
<%= link_to sl_helper.email_signup_link_text, sl_helper.email_signup_link,
|
|
34
|
+
<%= link_to sl_helper.email_signup_link_text, sl_helper.email_signup_link, {
|
|
29
35
|
class: "gem-c-subscription-links__link #{brand_helper.color_class}",
|
|
30
|
-
data: sl_helper.email_signup_link_data_attributes
|
|
31
|
-
|
|
36
|
+
data: sl_helper.email_signup_link_data_attributes,
|
|
37
|
+
lang: email_signup_link_text_locale
|
|
38
|
+
} %>
|
|
32
39
|
</li>
|
|
33
40
|
<% end %>
|
|
34
41
|
|
|
@@ -36,8 +43,11 @@
|
|
|
36
43
|
<li class="gem-c-subscription-links__list-item<%= ' gem-c-subscription-links__list-item--small' if local_assigns[:small_form] == true %>">
|
|
37
44
|
<svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" class="gem-c-subscription-links__icon" focusable="false" fill="currentColor" aria-hidden="true"><path d="M1.996 11A2 2 0 0 0 0 12.993c0 1.101.895 1.99 1.996 1.99 1.106 0 2-.889 2-1.99a2 2 0 0 0-2-1.993zM.002 5.097V7.97c1.872 0 3.632.733 4.958 2.059A6.984 6.984 0 0 1 7.015 15h2.888c0-5.461-4.443-9.903-9.9-9.903zM.006 0v2.876c6.676 0 12.11 5.44 12.11 12.124H15C15 6.731 8.273 0 .006 0z"/></svg>
|
|
38
45
|
<%= link_to sl_helper.feed_link_text, sl_helper.feed_link,
|
|
39
|
-
|
|
40
|
-
|
|
46
|
+
{
|
|
47
|
+
class: "gem-c-subscription-links__link #{brand_helper.color_class}",
|
|
48
|
+
data: sl_helper.feed_link_data_attributes,
|
|
49
|
+
lang: feed_link_text_locale
|
|
50
|
+
}
|
|
41
51
|
%>
|
|
42
52
|
</li>
|
|
43
53
|
<% end %>
|
|
@@ -81,9 +81,20 @@ examples:
|
|
|
81
81
|
small_form: true
|
|
82
82
|
without_heading:
|
|
83
83
|
description: |
|
|
84
|
-
By default the component includes an h2 heading. The component could be used anywhere on the page and could mean
|
|
85
|
-
that it produces invalid markup or make the site unaccessible.
|
|
84
|
+
By default the component includes an h2 heading. The component could be used anywhere on the page and could mean that it produces invalid markup or make the site unaccessible.
|
|
86
85
|
data:
|
|
87
86
|
email_signup_link: '/foreign-travel-advice/singapore/email-signup'
|
|
88
87
|
feed_link: '/foreign-travel-advice/singapore.atom'
|
|
89
88
|
hide_heading: true
|
|
89
|
+
with_a_different_language:
|
|
90
|
+
data:
|
|
91
|
+
email_signup_link: '/foreign-travel-advice/singapore/email-signup'
|
|
92
|
+
email_signup_link_text: 'Recevez des notifications'
|
|
93
|
+
email_signup_link_text_locale: 'fr'
|
|
94
|
+
feed_link: '/foreign-travel-advice/singapore.atom'
|
|
95
|
+
feed_link_text: 'Flux RSS'
|
|
96
|
+
feed_link_text_locale: 'fr'
|
|
97
|
+
description: |
|
|
98
|
+
The component is used on translated pages that don't have a translation for the text strings. This means that it could display the fallback English string if the translate method can't find an appropriate translation. This makes sure that the `lang` can be set to ensure that browsers understand which parts of the page are in each language.
|
|
99
|
+
|
|
100
|
+
The `lang` attribute **must** be set to a [valid BCP47 string](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/lang#Language_tag_syntax). A valid code can be the two or three letter language code - for example, English is `en` or `eng`, Korean is `ko` or `kor` - but if in doubt please check.
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"/"
|
|
50
50
|
],
|
|
51
51
|
"_resolved": "git://github.com/alphagov/accessible-autocomplete.git#3523dd9fffc70cbd9f6f555f75863c33a709f49e",
|
|
52
|
-
"_shasum": "
|
|
52
|
+
"_shasum": "e84aa32f47a3675f17c583385901d70c398b19d2",
|
|
53
53
|
"_shrinkwrap": null,
|
|
54
54
|
"_spec": "accessible-autocomplete@git://github.com/alphagov/accessible-autocomplete.git#add-multiselect-support",
|
|
55
55
|
"_where": "/var/lib/jenkins/workspace/ublishing_components_master-N4FWJIUY4CIFHKGZOAAEVVXODRY3YBORQOPIBBXWX72VUPSGJRRQ",
|
|
@@ -15,19 +15,19 @@
|
|
|
15
15
|
],
|
|
16
16
|
"_from": "graceful-fs@>=4.1.2 <5.0.0",
|
|
17
17
|
"_hasShrinkwrap": false,
|
|
18
|
-
"_id": "graceful-fs@4.2.
|
|
18
|
+
"_id": "graceful-fs@4.2.1",
|
|
19
19
|
"_inCache": true,
|
|
20
20
|
"_location": "/graceful-fs",
|
|
21
|
-
"_nodeVersion": "12.
|
|
21
|
+
"_nodeVersion": "12.6.0",
|
|
22
22
|
"_npmOperationalInternal": {
|
|
23
23
|
"host": "s3://npm-registry-packages",
|
|
24
|
-
"tmp": "tmp/graceful-fs_4.2.
|
|
24
|
+
"tmp": "tmp/graceful-fs_4.2.1_1564898680936_0.4561090715904119"
|
|
25
25
|
},
|
|
26
26
|
"_npmUser": {
|
|
27
27
|
"name": "isaacs",
|
|
28
28
|
"email": "i@izs.me"
|
|
29
29
|
},
|
|
30
|
-
"_npmVersion": "6.
|
|
30
|
+
"_npmVersion": "6.10.2",
|
|
31
31
|
"_phantomChildren": {},
|
|
32
32
|
"_requested": {
|
|
33
33
|
"raw": "graceful-fs@^4.1.2",
|
|
@@ -45,8 +45,8 @@
|
|
|
45
45
|
"/load-json-file",
|
|
46
46
|
"/pkg-conf/load-json-file"
|
|
47
47
|
],
|
|
48
|
-
"_resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.
|
|
49
|
-
"_shasum": "
|
|
48
|
+
"_resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.1.tgz",
|
|
49
|
+
"_shasum": "1c1f0c364882c868f5bff6512146328336a11b1d",
|
|
50
50
|
"_shrinkwrap": null,
|
|
51
51
|
"_spec": "graceful-fs@^4.1.2",
|
|
52
52
|
"_where": "/var/lib/jenkins/workspace/ublishing_components_master-N4FWJIUY4CIFHKGZOAAEVVXODRY3YBORQOPIBBXWX72VUPSGJRRQ/node_modules/flat-cache",
|
|
@@ -65,14 +65,14 @@
|
|
|
65
65
|
"test": "test"
|
|
66
66
|
},
|
|
67
67
|
"dist": {
|
|
68
|
-
"integrity": "sha512-
|
|
69
|
-
"shasum": "
|
|
70
|
-
"tarball": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.
|
|
68
|
+
"integrity": "sha512-b9usnbDGnD928gJB3LrCmxoibr3VE4U2SMo5PBuBnokWyDADTqDPXg4YpwKF1trpH+UbGp7QLicO3+aWEy0+mw==",
|
|
69
|
+
"shasum": "1c1f0c364882c868f5bff6512146328336a11b1d",
|
|
70
|
+
"tarball": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.1.tgz",
|
|
71
71
|
"fileCount": 7,
|
|
72
|
-
"unpackedSize":
|
|
73
|
-
"npm-signature": "-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\
|
|
72
|
+
"unpackedSize": 26326,
|
|
73
|
+
"npm-signature": "-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdRnV5CRA9TVsSAnZWagAAI+cP/09vQFDgflZI5LDhq7Kn\nPzOQDHXsrAHDvKW1F55RxTFIXjPqExI8byFKOsPRDmeK/grBCEiovq3YGig/\nqC/HpiPuxWBo5WoOqScn7nuvbqN5vtAGjSbA9XN1nQHG+yFLv4A9V6/U6YCi\nVMcwIq4J3FzciBWGQ78R4DvmeCLyKCEXoxxQsHNl8+qrWtnrNF2rWvab4dtV\nypHI6HY2DdI5Lx/trflzyrKe3ycS6SiD+oJ+exxL/YewB4xHHftxVhALUoGS\nyT6AVg4vWz/LWdE2M4IG4jzjb9Mk3bBlpODIc1AlfDib5RHQ62oH9roQiq5A\nYKSWQ4BfOdz/c1c+YjXVEkCaSG5IKd9ULq2I/awfI714sy0CMsdFino29umN\nUODANsl9nrk8RGJ65lIKZVeF4EGFKHF7CcbuBpO5AkMKf32/uIXTkprUWrO4\nMVoaxp5HXasSp8fH1y9CryITWwdgFksnFrlgnUL3l6AaNWzLTajEWQmzeVdj\n3ADQ/GglE6bxJMnMzaD2c5KbS3+CnpqKxIqPbiPFtjyJeNGQCjKx/PgXDsp7\nmNo3KAcbTFYBjc/34sczullnv95TGCZOm6Oyz8XncI1afKqdTPBztf6MXmXl\nNKs+Z2k/p4o95MyLTwHBzRAZfXUhA87StuFijMJhyVD5JPx1Ja88ItqoLzog\nJWsf\r\n=Oyod\r\n-----END PGP SIGNATURE-----\r\n"
|
|
74
74
|
},
|
|
75
|
-
"gitHead": "
|
|
75
|
+
"gitHead": "7e8a5605310d1f995d56dcc2690660c58e5554b0",
|
|
76
76
|
"homepage": "https://github.com/isaacs/node-graceful-fs#readme",
|
|
77
77
|
"keywords": [
|
|
78
78
|
"fs",
|
|
@@ -111,5 +111,5 @@
|
|
|
111
111
|
"preversion": "npm test",
|
|
112
112
|
"test": "node test.js | tap -"
|
|
113
113
|
},
|
|
114
|
-
"version": "4.2.
|
|
114
|
+
"version": "4.2.1"
|
|
115
115
|
}
|
|
@@ -115,20 +115,26 @@ function patch (fs) {
|
|
|
115
115
|
}
|
|
116
116
|
|
|
117
117
|
// if read() returns EAGAIN, then just try it again.
|
|
118
|
-
fs.read = (function (fs$read) {
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
eagCounter
|
|
125
|
-
|
|
118
|
+
fs.read = (function (fs$read) {
|
|
119
|
+
function read (fd, buffer, offset, length, position, callback_) {
|
|
120
|
+
var callback
|
|
121
|
+
if (callback_ && typeof callback_ === 'function') {
|
|
122
|
+
var eagCounter = 0
|
|
123
|
+
callback = function (er, _, __) {
|
|
124
|
+
if (er && er.code === 'EAGAIN' && eagCounter < 10) {
|
|
125
|
+
eagCounter ++
|
|
126
|
+
return fs$read.call(fs, fd, buffer, offset, length, position, callback)
|
|
127
|
+
}
|
|
128
|
+
callback_.apply(this, arguments)
|
|
126
129
|
}
|
|
127
|
-
callback_.apply(this, arguments)
|
|
128
130
|
}
|
|
131
|
+
return fs$read.call(fs, fd, buffer, offset, length, position, callback)
|
|
129
132
|
}
|
|
130
|
-
|
|
131
|
-
|
|
133
|
+
|
|
134
|
+
// This ensures `util.promisify` works as it does for native `fs.read`.
|
|
135
|
+
read.__proto__ = fs$read
|
|
136
|
+
return read
|
|
137
|
+
})(fs.read)
|
|
132
138
|
|
|
133
139
|
fs.readSync = (function (fs$readSync) { return function (fd, buffer, offset, length, position) {
|
|
134
140
|
var eagCounter = 0
|
|
@@ -2,6 +2,46 @@
|
|
|
2
2
|
|
|
3
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
4
|
|
|
5
|
+
<a name="2.8.2"></a>
|
|
6
|
+
## [2.8.2](https://github.com/npm/hosted-git-info/compare/v2.8.1...v2.8.2) (2019-08-05)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* 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)
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
<a name="2.8.1"></a>
|
|
16
|
+
## [2.8.1](https://github.com/npm/hosted-git-info/compare/v2.8.0...v2.8.1) (2019-08-05)
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
### Bug Fixes
|
|
20
|
+
|
|
21
|
+
* ignore noCommittish on tarball url generation ([5d4a8d7](https://github.com/npm/hosted-git-info/commit/5d4a8d7))
|
|
22
|
+
* use gist tarball url that works for anonymous gists ([1692435](https://github.com/npm/hosted-git-info/commit/1692435))
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
<a name="2.8.0"></a>
|
|
27
|
+
# [2.8.0](https://github.com/npm/hosted-git-info/compare/v2.7.1...v2.8.0) (2019-08-05)
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
### Bug Fixes
|
|
31
|
+
|
|
32
|
+
* 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)
|
|
33
|
+
* **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)
|
|
34
|
+
* **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)
|
|
35
|
+
* do not allow invalid gist urls ([d5cf830](https://github.com/npm/hosted-git-info/commit/d5cf830))
|
|
36
|
+
* **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)
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
### Features
|
|
40
|
+
|
|
41
|
+
* give these objects a name ([60abaea](https://github.com/npm/hosted-git-info/commit/60abaea))
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
|
|
5
45
|
<a name="2.7.1"></a>
|
|
6
46
|
## [2.7.1](https://github.com/npm/hosted-git-info/compare/v2.7.0...v2.7.1) (2018-07-07)
|
|
7
47
|
|
|
@@ -23,12 +23,14 @@ var gitHosts = module.exports = {
|
|
|
23
23
|
'domain': 'gitlab.com',
|
|
24
24
|
'treepath': 'tree',
|
|
25
25
|
'bugstemplate': 'https://{domain}/{user}/{project}/issues',
|
|
26
|
-
'
|
|
26
|
+
'httpstemplate': 'git+https://{auth@}{domain}/{user}/{projectPath}.git{#committish}',
|
|
27
|
+
'tarballtemplate': 'https://{domain}/{user}/{project}/repository/archive.tar.gz?ref={committish}',
|
|
28
|
+
'pathmatch': /^[/]([^/]+)[/](.+?)(?:[.]git|[/])?$/
|
|
27
29
|
},
|
|
28
30
|
gist: {
|
|
29
31
|
'protocols': [ 'git', 'git+ssh', 'git+https', 'ssh', 'https' ],
|
|
30
32
|
'domain': 'gist.github.com',
|
|
31
|
-
'pathmatch': /^[/](?:([^/]+)[/])?([a-z0-9]
|
|
33
|
+
'pathmatch': /^[/](?:([^/]+)[/])?([a-z0-9]{32,})(?:[.]git)?$/,
|
|
32
34
|
'filetemplate': 'https://gist.githubusercontent.com/{user}/{project}/raw{/committish}/{path}',
|
|
33
35
|
'bugstemplate': 'https://{domain}/{project}',
|
|
34
36
|
'gittemplate': 'git://{domain}/{project}.git{#committish}',
|
|
@@ -40,7 +42,7 @@ var gitHosts = module.exports = {
|
|
|
40
42
|
'httpstemplate': 'git+https://{domain}/{project}.git{#committish}',
|
|
41
43
|
'shortcuttemplate': '{type}:{project}{#committish}',
|
|
42
44
|
'pathtemplate': '{project}{#committish}',
|
|
43
|
-
'tarballtemplate': 'https://
|
|
45
|
+
'tarballtemplate': 'https://codeload.github.com/gist/{project}/tar.gz/{committish}',
|
|
44
46
|
'hashformat': function (fragment) {
|
|
45
47
|
return 'file-' + formatHashFragment(fragment)
|
|
46
48
|
}
|
|
@@ -1,9 +1,24 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
var gitHosts = require('./git-host-info.js')
|
|
3
3
|
/* eslint-disable node/no-deprecated-api */
|
|
4
|
-
var extend = Object.assign || require('util')._extend
|
|
5
4
|
|
|
6
|
-
|
|
5
|
+
// copy-pasta util._extend from node's source, to avoid pulling
|
|
6
|
+
// the whole util module into peoples' webpack bundles.
|
|
7
|
+
/* istanbul ignore next */
|
|
8
|
+
var extend = Object.assign || function _extend (target, source) {
|
|
9
|
+
// Don't do anything if source isn't an object
|
|
10
|
+
if (source === null || typeof source !== 'object') return target
|
|
11
|
+
|
|
12
|
+
const keys = Object.keys(source)
|
|
13
|
+
let i = keys.length
|
|
14
|
+
while (i--) {
|
|
15
|
+
target[keys[i]] = source[keys[i]]
|
|
16
|
+
}
|
|
17
|
+
return target
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
module.exports = GitHost
|
|
21
|
+
function GitHost (type, user, auth, project, committish, defaultRepresentation, opts) {
|
|
7
22
|
var gitHostInfo = this
|
|
8
23
|
gitHostInfo.type = type
|
|
9
24
|
Object.keys(gitHosts[type]).forEach(function (key) {
|
|
@@ -16,7 +31,6 @@ var GitHost = module.exports = function (type, user, auth, project, committish,
|
|
|
16
31
|
gitHostInfo.default = defaultRepresentation
|
|
17
32
|
gitHostInfo.opts = opts || {}
|
|
18
33
|
}
|
|
19
|
-
GitHost.prototype = {}
|
|
20
34
|
|
|
21
35
|
GitHost.prototype.hash = function () {
|
|
22
36
|
return this.committish ? '#' + this.committish : ''
|
|
@@ -32,24 +46,33 @@ GitHost.prototype._fill = function (template, opts) {
|
|
|
32
46
|
if (self[key] != null && vars[key] == null) vars[key] = self[key]
|
|
33
47
|
})
|
|
34
48
|
var rawAuth = vars.auth
|
|
35
|
-
var
|
|
49
|
+
var rawcommittish = vars.committish
|
|
36
50
|
var rawFragment = vars.fragment
|
|
37
51
|
var rawPath = vars.path
|
|
52
|
+
var rawProject = vars.project
|
|
38
53
|
Object.keys(vars).forEach(function (key) {
|
|
39
|
-
|
|
54
|
+
var value = vars[key]
|
|
55
|
+
if ((key === 'path' || key === 'project') && typeof value === 'string') {
|
|
56
|
+
vars[key] = value.split('/').map(function (pathComponent) {
|
|
57
|
+
return encodeURIComponent(pathComponent)
|
|
58
|
+
}).join('/')
|
|
59
|
+
} else {
|
|
60
|
+
vars[key] = encodeURIComponent(value)
|
|
61
|
+
}
|
|
40
62
|
})
|
|
41
63
|
vars['auth@'] = rawAuth ? rawAuth + '@' : ''
|
|
42
64
|
vars['#fragment'] = rawFragment ? '#' + this.hashformat(rawFragment) : ''
|
|
43
65
|
vars.fragment = vars.fragment ? vars.fragment : ''
|
|
44
66
|
vars['#path'] = rawPath ? '#' + this.hashformat(rawPath) : ''
|
|
45
67
|
vars['/path'] = vars.path ? '/' + vars.path : ''
|
|
68
|
+
vars.projectPath = rawProject.split('/').map(encodeURIComponent).join('/')
|
|
46
69
|
if (opts.noCommittish) {
|
|
47
70
|
vars['#committish'] = ''
|
|
48
71
|
vars['/tree/committish'] = ''
|
|
49
|
-
vars['/
|
|
50
|
-
vars.
|
|
72
|
+
vars['/committish'] = ''
|
|
73
|
+
vars.committish = ''
|
|
51
74
|
} else {
|
|
52
|
-
vars['#committish'] =
|
|
75
|
+
vars['#committish'] = rawcommittish ? '#' + rawcommittish : ''
|
|
53
76
|
vars['/tree/committish'] = vars.committish
|
|
54
77
|
? '/' + vars.treepath + '/' + vars.committish
|
|
55
78
|
: ''
|
|
@@ -114,7 +137,8 @@ GitHost.prototype.path = function (opts) {
|
|
|
114
137
|
return this._fill(this.pathtemplate, opts)
|
|
115
138
|
}
|
|
116
139
|
|
|
117
|
-
GitHost.prototype.tarball = function (
|
|
140
|
+
GitHost.prototype.tarball = function (opts_) {
|
|
141
|
+
var opts = extend({}, opts_, { noCommittish: false })
|
|
118
142
|
return this._fill(this.tarballtemplate, opts)
|
|
119
143
|
}
|
|
120
144
|
|
|
@@ -127,5 +151,6 @@ GitHost.prototype.getDefaultRepresentation = function () {
|
|
|
127
151
|
}
|
|
128
152
|
|
|
129
153
|
GitHost.prototype.toString = function (opts) {
|
|
130
|
-
|
|
154
|
+
if (this.default && typeof this[this.default] === 'function') return this[this.default](opts)
|
|
155
|
+
return this.sshurl(opts)
|
|
131
156
|
}
|
|
@@ -2,17 +2,18 @@
|
|
|
2
2
|
var url = require('url')
|
|
3
3
|
var gitHosts = require('./git-host-info.js')
|
|
4
4
|
var GitHost = module.exports = require('./git-host.js')
|
|
5
|
+
var LRU = require('lru-cache')
|
|
6
|
+
var cache = new LRU({max: 1000})
|
|
5
7
|
|
|
6
8
|
var protocolToRepresentationMap = {
|
|
7
|
-
'git+ssh': 'sshurl',
|
|
8
|
-
'git+https': 'https',
|
|
9
|
-
'ssh': 'sshurl',
|
|
10
|
-
'git': 'git'
|
|
9
|
+
'git+ssh:': 'sshurl',
|
|
10
|
+
'git+https:': 'https',
|
|
11
|
+
'ssh:': 'sshurl',
|
|
12
|
+
'git:': 'git'
|
|
11
13
|
}
|
|
12
14
|
|
|
13
15
|
function protocolToRepresentation (protocol) {
|
|
14
|
-
|
|
15
|
-
return protocolToRepresentationMap[protocol] || protocol
|
|
16
|
+
return protocolToRepresentationMap[protocol] || protocol.slice(0, -1)
|
|
16
17
|
}
|
|
17
18
|
|
|
18
19
|
var authProtocols = {
|
|
@@ -23,17 +24,15 @@ var authProtocols = {
|
|
|
23
24
|
'git+http:': true
|
|
24
25
|
}
|
|
25
26
|
|
|
26
|
-
var cache = {}
|
|
27
|
-
|
|
28
27
|
module.exports.fromUrl = function (giturl, opts) {
|
|
29
28
|
if (typeof giturl !== 'string') return
|
|
30
29
|
var key = giturl + JSON.stringify(opts || {})
|
|
31
30
|
|
|
32
|
-
if (!(key
|
|
33
|
-
cache
|
|
31
|
+
if (!cache.has(key)) {
|
|
32
|
+
cache.set(key, fromUrl(giturl, opts))
|
|
34
33
|
}
|
|
35
34
|
|
|
36
|
-
return cache
|
|
35
|
+
return cache.get(key)
|
|
37
36
|
}
|
|
38
37
|
|
|
39
38
|
function fromUrl (giturl, opts) {
|
|
@@ -65,13 +64,17 @@ function fromUrl (giturl, opts) {
|
|
|
65
64
|
var pathmatch = gitHostInfo.pathmatch
|
|
66
65
|
var matched = parsed.path.match(pathmatch)
|
|
67
66
|
if (!matched) return
|
|
68
|
-
if (matched[1]
|
|
69
|
-
|
|
67
|
+
if (matched[1] !== null && matched[1] !== undefined) {
|
|
68
|
+
user = decodeURIComponent(matched[1].replace(/^:/, ''))
|
|
69
|
+
}
|
|
70
|
+
project = decodeURIComponent(matched[2])
|
|
70
71
|
defaultRepresentation = protocolToRepresentation(parsed.protocol)
|
|
71
72
|
}
|
|
72
73
|
return new GitHost(gitHostName, user, auth, project, committish, defaultRepresentation, opts)
|
|
73
74
|
} catch (ex) {
|
|
74
|
-
|
|
75
|
+
/* istanbul ignore else */
|
|
76
|
+
if (ex instanceof URIError) {
|
|
77
|
+
} else throw ex
|
|
75
78
|
}
|
|
76
79
|
}).filter(function (gitHostInfo) { return gitHostInfo })
|
|
77
80
|
if (matches.length !== 1) return
|
|
@@ -101,7 +104,6 @@ function fixupUnqualifiedGist (giturl) {
|
|
|
101
104
|
}
|
|
102
105
|
|
|
103
106
|
function parseGitUrl (giturl) {
|
|
104
|
-
if (typeof giturl !== 'string') giturl = '' + giturl
|
|
105
107
|
var matched = giturl.match(/^([^@]+)@([^:/]+):[/]?((?:[^/]+[/])?[^/]+?)(?:[.]git)?(#.*)?$/)
|
|
106
108
|
if (!matched) return url.parse(giturl)
|
|
107
109
|
return {
|