govuk_publishing_components 16.18.0 → 16.19.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/govspeak/_attachment.scss +5 -0
- data/app/views/govuk_publishing_components/component_guide/component_doc/_component_output.html.erb +2 -2
- data/app/views/govuk_publishing_components/components/_contextual_breadcrumbs.html.erb +3 -0
- data/app/views/govuk_publishing_components/components/docs/attachment.yml +15 -0
- data/app/views/govuk_publishing_components/components/docs/attachment_link.yml +15 -0
- data/app/views/govuk_publishing_components/components/docs/govspeak.yml +32 -2
- data/lib/govuk_publishing_components/presenters/contextual_navigation.rb +5 -1
- data/lib/govuk_publishing_components/version.rb +1 -1
- data/node_modules/accessible-autocomplete/package.json +1 -1
- data/node_modules/resolve/CHANGELOG.md +5 -1
- data/node_modules/resolve/lib/async.js +19 -2
- data/node_modules/resolve/lib/sync.js +17 -4
- data/node_modules/resolve/package.json +20 -12
- data/node_modules/resolve/readme.markdown +22 -0
- data/node_modules/resolve/test/mock.js +26 -0
- data/node_modules/resolve/test/mock_sync.js +17 -4
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: fbca39d94e05ae06beee0e1af782b21e582dab064e8011dc78e4b8e718be79df
|
|
4
|
+
data.tar.gz: 4163e6b84aa536d51f044042a2e90f30a5e86100e79a59b61ba1a03b149883cd
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d029cae28cc95720bd890d404860e06960dbe76ef931be0bb40f84e71197e2fa88e79b34a1dd46531e3882d97f370b10553e20786dec47850cd1e33f4d307349
|
|
7
|
+
data.tar.gz: ec1bf64a9309f27c01d15f5c82ee3062fc004723d011023ca78bef45d01628796b01e26e05f66399513c17495f760926db2983c1b748fcbd8f6ea05804ab6606
|
data/app/assets/stylesheets/govuk_publishing_components/components/govspeak/_attachment.scss
CHANGED
|
@@ -6,6 +6,11 @@
|
|
|
6
6
|
// - alphagov/govspeak: ✔︎
|
|
7
7
|
|
|
8
8
|
.gem-c-govspeak {
|
|
9
|
+
|
|
10
|
+
// Scope attachment and attachment-link component styles to gem-c-govspeak
|
|
11
|
+
@import "../attachment-link";
|
|
12
|
+
@import "../attachment";
|
|
13
|
+
|
|
9
14
|
// This block is duplicated from Whitehall as a transitional step, see the
|
|
10
15
|
// commit message for 2d893c10ee3f2cab27162b9aba38b12379a71d07 before making
|
|
11
16
|
// changes, original version:
|
data/app/views/govuk_publishing_components/component_guide/component_doc/_component_output.html.erb
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<% component = capture do %>
|
|
2
2
|
<% if example.has_block? %>
|
|
3
3
|
<%= render component_doc.partial_path, example.html_safe_data do %>
|
|
4
|
-
<%= example.block
|
|
4
|
+
<%= render inline: example.block %>
|
|
5
5
|
<% end %>
|
|
6
6
|
<% else %>
|
|
7
7
|
<%= render component_doc.partial_path, example.html_safe_data %>
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
<% end %>
|
|
10
10
|
|
|
11
11
|
<% if example.has_embed? %>
|
|
12
|
-
<%=
|
|
12
|
+
<%= render inline: example.embed, locals: { component: component } %>
|
|
13
13
|
<% else %>
|
|
14
14
|
<%= component %>
|
|
15
15
|
<% end %>
|
|
@@ -6,6 +6,9 @@
|
|
|
6
6
|
<%# Rendering step by step nav breadcrumbs because there's 1 step by step %>
|
|
7
7
|
<%= render 'govuk_publishing_components/components/step_by_step_nav_header',
|
|
8
8
|
navigation.step_nav_helper.header %>
|
|
9
|
+
<% elsif navigation.content_tagged_to_a_finder? %>
|
|
10
|
+
<%# Rendering finder breadcrumbs because the page is tagged to a finder %>
|
|
11
|
+
<%= render 'govuk_publishing_components/components/breadcrumbs', breadcrumbs: navigation.breadcrumbs %>
|
|
9
12
|
<% elsif navigation.content_is_tagged_to_a_live_taxon? && prioritise_taxon_breadcrumbs %>
|
|
10
13
|
<%# Rendering taxonomy breadcrumbs because the page is tagged to live taxons
|
|
11
14
|
and we want to prioritise them over all other breadcrumbs %>
|
|
@@ -54,3 +54,18 @@ examples:
|
|
|
54
54
|
content_type: text/plain
|
|
55
55
|
file_size: 108515
|
|
56
56
|
hide_help_text: true
|
|
57
|
+
embedded_in_govspeak:
|
|
58
|
+
description: |
|
|
59
|
+
This component can be embedded in Govspeak with the `[Attachment:]` code.
|
|
60
|
+
embed: |
|
|
61
|
+
<%= render "govuk_publishing_components/components/govspeak" do %>
|
|
62
|
+
<p>Some text.</p>
|
|
63
|
+
<%= component %>
|
|
64
|
+
<% end %>
|
|
65
|
+
data:
|
|
66
|
+
attachment:
|
|
67
|
+
title: "BEIS Information Asset Register"
|
|
68
|
+
url: https://assets.publishing.service.gov.uk/government/uploads/system/uploads/attachment_data/file/744083/BEIS_Information_Asset_Register_.ods
|
|
69
|
+
filename: BEIS_Information_Asset_Register_.ods
|
|
70
|
+
content_type: application/vnd.oasis.opendocument.spreadsheet
|
|
71
|
+
file_size: 20000
|
|
@@ -39,6 +39,21 @@ examples:
|
|
|
39
39
|
content_type: application/pdf
|
|
40
40
|
file_size: 20000
|
|
41
41
|
number_of_pages: 1
|
|
42
|
+
embedded_in_govspeak:
|
|
43
|
+
description: |
|
|
44
|
+
This component can be embedded in Govspeak with the `[AttachmentLink:]` code.
|
|
45
|
+
embed: |
|
|
46
|
+
<%= render "govuk_publishing_components/components/govspeak" do %>
|
|
47
|
+
<p>Some introductory information about <%= component %>.</p>
|
|
48
|
+
<% end %>
|
|
49
|
+
data:
|
|
50
|
+
attachment:
|
|
51
|
+
title: "Temporary snow ploughs: guidance note"
|
|
52
|
+
url: https://assets.publishing.service.gov.uk/government/uploads/system/uploads/attachment_data/file/259634/temporary-snow-ploughs.pdf
|
|
53
|
+
filename: temporary-snow-ploughs.pdf
|
|
54
|
+
content_type: application/pdf
|
|
55
|
+
file_size: 20000
|
|
56
|
+
number_of_pages: 1
|
|
42
57
|
with_target_blank:
|
|
43
58
|
data:
|
|
44
59
|
attachment:
|
|
@@ -374,14 +374,43 @@ examples:
|
|
|
374
374
|
</li>
|
|
375
375
|
</ol>
|
|
376
376
|
</div>
|
|
377
|
+
attachment_link:
|
|
378
|
+
description: Attachment link component rendered within Govspeak
|
|
379
|
+
data:
|
|
380
|
+
block: |
|
|
381
|
+
<p>
|
|
382
|
+
A reference to my
|
|
383
|
+
<%= render "govuk_publishing_components/components/attachment_link",
|
|
384
|
+
attachment: { url: "https://example.com/file.pdf",
|
|
385
|
+
title: "Attachment",
|
|
386
|
+
file_size: 1024,
|
|
387
|
+
content_type: "application/pdf",
|
|
388
|
+
number_of_pages: 2 }
|
|
389
|
+
%>
|
|
390
|
+
that is in my paragraph.
|
|
391
|
+
</p>
|
|
392
|
+
attachment:
|
|
393
|
+
description: Attachment component rendered within Govspeak
|
|
394
|
+
data:
|
|
395
|
+
block: |
|
|
396
|
+
<p>An attachment as a block</p>
|
|
397
|
+
|
|
398
|
+
<%= render "govuk_publishing_components/components/attachment",
|
|
399
|
+
attachment: { url: "https://example.com/file.odt",
|
|
400
|
+
title: "Attachment",
|
|
401
|
+
file_size: 1024,
|
|
402
|
+
content_type: "application/vnd.oasis.opendocument.text" }
|
|
403
|
+
%>
|
|
377
404
|
inline_attachment:
|
|
405
|
+
description: Legacy inline attachment embed used by Whitehall and Specialist Publisher
|
|
378
406
|
data:
|
|
379
407
|
block: |
|
|
380
408
|
<p>testing my attachment <span class="inline-attachment" id="attachment_1399340">
|
|
381
409
|
<a href="/government/uploads/system/uploads/attachment_data/file/498071/PHE_Payments_over__25k_Jun_15.csv">testing</a>
|
|
382
410
|
(<span class="type"><abbr title="Comma-separated Values">CSV</abbr></span>, <span class="file-size">65.4KB</span>)</span> works in the middle of copy.
|
|
383
411
|
</p>
|
|
384
|
-
|
|
412
|
+
whitehall_block_attachments:
|
|
413
|
+
description: Attachments rendered by govspeak extensions within Whitehall
|
|
385
414
|
data:
|
|
386
415
|
block: |
|
|
387
416
|
<section class="attachment embedded" id="attachment_1399345">
|
|
@@ -521,7 +550,8 @@ examples:
|
|
|
521
550
|
</p>
|
|
522
551
|
</div>
|
|
523
552
|
</section>
|
|
524
|
-
|
|
553
|
+
whitehall_block_attachment_rtl:
|
|
554
|
+
description: Attachments rendered by govspeak extensions within Whitehall
|
|
525
555
|
data:
|
|
526
556
|
direction: rtl
|
|
527
557
|
block: |
|
|
@@ -21,7 +21,7 @@ module GovukPublishingComponents
|
|
|
21
21
|
end
|
|
22
22
|
|
|
23
23
|
def breadcrumbs
|
|
24
|
-
if
|
|
24
|
+
if content_tagged_to_a_finder?
|
|
25
25
|
parent_finder = content_item.dig("links", "finder", 0)
|
|
26
26
|
return [] unless parent_finder
|
|
27
27
|
|
|
@@ -40,6 +40,10 @@ module GovukPublishingComponents
|
|
|
40
40
|
end
|
|
41
41
|
end
|
|
42
42
|
|
|
43
|
+
def content_tagged_to_a_finder?
|
|
44
|
+
content_item.dig("links", "finder").present?
|
|
45
|
+
end
|
|
46
|
+
|
|
43
47
|
def content_tagged_to_mainstream_browse_pages?
|
|
44
48
|
content_item.dig("links", "mainstream_browse_pages").present?
|
|
45
49
|
end
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"/"
|
|
50
50
|
],
|
|
51
51
|
"_resolved": "git://github.com/alphagov/accessible-autocomplete.git#0c518b4fa79b9a95b544410858486ed9e6403c84",
|
|
52
|
-
"_shasum": "
|
|
52
|
+
"_shasum": "5e8e39c6fda8e9ab73c042da6750e02b8742650c",
|
|
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",
|
|
@@ -2,7 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. Dates are displayed in UTC.
|
|
4
4
|
|
|
5
|
-
#### [Unreleased](https://github.com/browserify/resolve/compare/v1.
|
|
5
|
+
#### [Unreleased](https://github.com/browserify/resolve/compare/v1.11.0...HEAD)
|
|
6
|
+
|
|
7
|
+
#### [v1.11.0](https://github.com/browserify/resolve/compare/v1.10.1...v1.11.0) - 15 May 2019
|
|
8
|
+
- [New] Add `isDirectory`; use to speed up `node_modules` lookups (#192, #191, #190)
|
|
9
|
+
- [Tests] up to `node` `v12.2`, `v11.15`, `v6.17`
|
|
6
10
|
|
|
7
11
|
#### [v1.10.1](https://github.com/browserify/resolve/compare/v1.10.0...v1.10.1) - 23 April 2019
|
|
8
12
|
- [Fix] `core`: 6 `v8/` core modules and 3 `node-inspect/` core modules no longer exist in node 12 ([`b54d33a`][])
|
|
@@ -15,6 +15,16 @@ var defaultIsFile = function isFile(file, cb) {
|
|
|
15
15
|
});
|
|
16
16
|
};
|
|
17
17
|
|
|
18
|
+
var defaultIsDir = function isDirectory(dir, cb) {
|
|
19
|
+
fs.stat(dir, function (err, stat) {
|
|
20
|
+
if (!err) {
|
|
21
|
+
return cb(null, stat.isDirectory());
|
|
22
|
+
}
|
|
23
|
+
if (err.code === 'ENOENT' || err.code === 'ENOTDIR') return cb(null, false);
|
|
24
|
+
return cb(err);
|
|
25
|
+
});
|
|
26
|
+
};
|
|
27
|
+
|
|
18
28
|
module.exports = function resolve(x, options, callback) {
|
|
19
29
|
var cb = callback;
|
|
20
30
|
var opts = options;
|
|
@@ -32,6 +42,7 @@ module.exports = function resolve(x, options, callback) {
|
|
|
32
42
|
opts = normalizeOptions(x, opts);
|
|
33
43
|
|
|
34
44
|
var isFile = opts.isFile || defaultIsFile;
|
|
45
|
+
var isDirectory = opts.isDirectory || defaultIsDir;
|
|
35
46
|
var readFile = opts.readFile || fs.readFile;
|
|
36
47
|
|
|
37
48
|
var extensions = opts.extensions || ['.js'];
|
|
@@ -208,8 +219,14 @@ module.exports = function resolve(x, options, callback) {
|
|
|
208
219
|
if (dirs.length === 0) return cb(null, undefined);
|
|
209
220
|
var dir = dirs[0];
|
|
210
221
|
|
|
211
|
-
|
|
212
|
-
|
|
222
|
+
isDirectory(dir, isdir);
|
|
223
|
+
|
|
224
|
+
function isdir(err, isdir) {
|
|
225
|
+
if (err) return cb(err);
|
|
226
|
+
if (!isdir) return processDirs(cb, dirs.slice(1));
|
|
227
|
+
var file = path.join(dir, x);
|
|
228
|
+
loadAsFile(file, opts.package, onfile);
|
|
229
|
+
}
|
|
213
230
|
|
|
214
231
|
function onfile(err, m, pkg) {
|
|
215
232
|
if (err) return cb(err);
|
|
@@ -15,6 +15,16 @@ var defaultIsFile = function isFile(file) {
|
|
|
15
15
|
return stat.isFile() || stat.isFIFO();
|
|
16
16
|
};
|
|
17
17
|
|
|
18
|
+
var defaultIsDir = function isDirectory(dir) {
|
|
19
|
+
try {
|
|
20
|
+
var stat = fs.statSync(dir);
|
|
21
|
+
} catch (e) {
|
|
22
|
+
if (e && (e.code === 'ENOENT' || e.code === 'ENOTDIR')) return false;
|
|
23
|
+
throw e;
|
|
24
|
+
}
|
|
25
|
+
return stat.isDirectory();
|
|
26
|
+
};
|
|
27
|
+
|
|
18
28
|
module.exports = function (x, options) {
|
|
19
29
|
if (typeof x !== 'string') {
|
|
20
30
|
throw new TypeError('Path must be a string.');
|
|
@@ -23,6 +33,7 @@ module.exports = function (x, options) {
|
|
|
23
33
|
|
|
24
34
|
var isFile = opts.isFile || defaultIsFile;
|
|
25
35
|
var readFileSync = opts.readFileSync || fs.readFileSync;
|
|
36
|
+
var isDirectory = opts.isDirectory || defaultIsDir;
|
|
26
37
|
|
|
27
38
|
var extensions = opts.extensions || ['.js'];
|
|
28
39
|
var basedir = opts.basedir || path.dirname(caller());
|
|
@@ -145,10 +156,12 @@ module.exports = function (x, options) {
|
|
|
145
156
|
var dirs = nodeModulesPaths(start, opts, x);
|
|
146
157
|
for (var i = 0; i < dirs.length; i++) {
|
|
147
158
|
var dir = dirs[i];
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
159
|
+
if (isDirectory(dir)) {
|
|
160
|
+
var m = loadAsFileSync(path.join(dir, '/', x));
|
|
161
|
+
if (m) return m;
|
|
162
|
+
var n = loadAsDirectorySync(path.join(dir, '/', x));
|
|
163
|
+
if (n) return n;
|
|
164
|
+
}
|
|
152
165
|
}
|
|
153
166
|
}
|
|
154
167
|
};
|
|
@@ -15,13 +15,13 @@
|
|
|
15
15
|
],
|
|
16
16
|
"_from": "resolve@>=1.6.0 <2.0.0",
|
|
17
17
|
"_hasShrinkwrap": false,
|
|
18
|
-
"_id": "resolve@1.
|
|
18
|
+
"_id": "resolve@1.11.0",
|
|
19
19
|
"_inCache": true,
|
|
20
20
|
"_location": "/resolve",
|
|
21
|
-
"_nodeVersion": "12.
|
|
21
|
+
"_nodeVersion": "12.1.0",
|
|
22
22
|
"_npmOperationalInternal": {
|
|
23
23
|
"host": "s3://npm-registry-packages",
|
|
24
|
-
"tmp": "tmp/resolve_1.
|
|
24
|
+
"tmp": "tmp/resolve_1.11.0_1557946811120_0.4088999308496508"
|
|
25
25
|
},
|
|
26
26
|
"_npmUser": {
|
|
27
27
|
"name": "ljharb",
|
|
@@ -44,8 +44,8 @@
|
|
|
44
44
|
"/eslint-plugin-node",
|
|
45
45
|
"/normalize-package-data"
|
|
46
46
|
],
|
|
47
|
-
"_resolved": "https://registry.npmjs.org/resolve/-/resolve-1.
|
|
48
|
-
"_shasum": "
|
|
47
|
+
"_resolved": "https://registry.npmjs.org/resolve/-/resolve-1.11.0.tgz",
|
|
48
|
+
"_shasum": "4014870ba296176b86343d50b60f3b50609ce232",
|
|
49
49
|
"_shrinkwrap": null,
|
|
50
50
|
"_spec": "resolve@^1.6.0",
|
|
51
51
|
"_where": "/var/lib/jenkins/workspace/ublishing_components_master-N4FWJIUY4CIFHKGZOAAEVVXODRY3YBORQOPIBBXWX72VUPSGJRRQ/node_modules/eslint-plugin-import",
|
|
@@ -71,14 +71,14 @@
|
|
|
71
71
|
},
|
|
72
72
|
"directories": {},
|
|
73
73
|
"dist": {
|
|
74
|
-
"integrity": "sha512-
|
|
75
|
-
"shasum": "
|
|
76
|
-
"tarball": "https://registry.npmjs.org/resolve/-/resolve-1.
|
|
74
|
+
"integrity": "sha512-WL2pBDjqT6pGUNSUzMw00o4T7If+z4H2x3Gz893WoUQ5KW8Vr9txp00ykiP16VBaZF5+j/OcXJHZ9+PCvdiDKw==",
|
|
75
|
+
"shasum": "4014870ba296176b86343d50b60f3b50609ce232",
|
|
76
|
+
"tarball": "https://registry.npmjs.org/resolve/-/resolve-1.11.0.tgz",
|
|
77
77
|
"fileCount": 85,
|
|
78
|
-
"unpackedSize":
|
|
79
|
-
"npm-signature": "-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\
|
|
78
|
+
"unpackedSize": 140059,
|
|
79
|
+
"npm-signature": "-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJc3GG7CRA9TVsSAnZWagAAHfUP/14z/m0dy+F21lIsBxHb\nVecF7kLUXXzSuYuIUIE/bh4WGsY3sy6VZPTgPKdZv5BZf4EWWQIGSGwu1x11\nAkjx9P0+lMS8VOEO5bWgX36hMMZXp+cL4uFMgqWKyyNOS2uNGIoaQVgBKWQH\nTfNST4DGMZtc5VhJNg8mCTJP6puwCNNGm3jVRPmVQgOUZ+38JEmZY+BmcUK4\nxWOTSTRKFjc3w5QozCTvHMTHaG9TDKDDYL82Fahr7j8/p5NQ9zFTxVv1C2RL\nqz5sThGQKHKL9Jbhosbu/hpByfxDaYcYstAmFOQI9CsL+w5D327Q6bQ1IK5F\nDa4PO0tFQM2dhzSI/hwqJb8kzDcxIk11ToHcI0M5xsYy3tOgGjUrQcjhrqxi\nKaNXkEcBy2r4Pl/A3JXJi6jGUb4xt7evADsAypW0gCS8vktY7Ty9Ru6mcGWU\n+NFRYrz0xWgIfV70G1FNxQ/FXniJsiy6tPZy/eMducmGMUV39enpCmloREgh\ntOrxrU1wY60x5SCp6cT+B6IK7tmSsPsfbLLres9T1vWemDkKmWgSr5rh6LVA\n1VUrDI8qjtIhMfiQLNJSizlk+pBdrk2I5NWjiBQgDAi+YDOvQesIitTQ1veW\n4CGJ165gQ7IYvWKiRC9BSdcQ+GbHsbJOC/R8K/tThcrnfeNSEHCL1u/covlX\nsezS\r\n=s5dL\r\n-----END PGP SIGNATURE-----\r\n"
|
|
80
80
|
},
|
|
81
|
-
"gitHead": "
|
|
81
|
+
"gitHead": "da345f39588998003a53a7d9959c4df40e04fb23",
|
|
82
82
|
"homepage": "https://github.com/browserify/resolve#readme",
|
|
83
83
|
"keywords": [
|
|
84
84
|
"resolve",
|
|
@@ -117,6 +117,10 @@
|
|
|
117
117
|
"name": "cwmma",
|
|
118
118
|
"email": "calvin.metcalf@gmail.com"
|
|
119
119
|
},
|
|
120
|
+
{
|
|
121
|
+
"name": "defunctzombie",
|
|
122
|
+
"email": "shtylman@gmail.com"
|
|
123
|
+
},
|
|
120
124
|
{
|
|
121
125
|
"name": "dominictarr",
|
|
122
126
|
"email": "dominic.tarr@gmail.com"
|
|
@@ -181,6 +185,10 @@
|
|
|
181
185
|
"name": "ljharb",
|
|
182
186
|
"email": "ljharb@gmail.com"
|
|
183
187
|
},
|
|
188
|
+
{
|
|
189
|
+
"name": "lukechilds",
|
|
190
|
+
"email": "lukechilds123@gmail.com"
|
|
191
|
+
},
|
|
184
192
|
{
|
|
185
193
|
"name": "mafintosh",
|
|
186
194
|
"email": "mathiasbuus@gmail.com"
|
|
@@ -262,5 +270,5 @@
|
|
|
262
270
|
"test:multirepo": "cd ./test/resolver/multirepo && npm install && npm test",
|
|
263
271
|
"tests-only": "tape test/*.js"
|
|
264
272
|
},
|
|
265
|
-
"version": "1.
|
|
273
|
+
"version": "1.11.0"
|
|
266
274
|
}
|
|
@@ -59,6 +59,8 @@ options are:
|
|
|
59
59
|
|
|
60
60
|
* opts.isFile - function to asynchronously test whether a file exists
|
|
61
61
|
|
|
62
|
+
* opts.isDirectory - function to asynchronously test whether a directory exists
|
|
63
|
+
|
|
62
64
|
* `opts.packageFilter(pkg, pkgfile)` - transform the parsed package.json contents before looking at the "main" field
|
|
63
65
|
* pkg - package data
|
|
64
66
|
* pkgfile - path to package.json
|
|
@@ -101,6 +103,15 @@ default `opts` values:
|
|
|
101
103
|
return cb(err);
|
|
102
104
|
});
|
|
103
105
|
},
|
|
106
|
+
isDirectory: function isDirectory(dir, cb) {
|
|
107
|
+
fs.stat(dir, function (err, stat) {
|
|
108
|
+
if (!err) {
|
|
109
|
+
return cb(null, stat.isDirectory());
|
|
110
|
+
}
|
|
111
|
+
if (err.code === 'ENOENT' || err.code === 'ENOTDIR') return cb(null, false);
|
|
112
|
+
return cb(err);
|
|
113
|
+
});
|
|
114
|
+
},
|
|
104
115
|
moduleDirectory: 'node_modules',
|
|
105
116
|
preserveSymlinks: true
|
|
106
117
|
}
|
|
@@ -121,6 +132,8 @@ options are:
|
|
|
121
132
|
|
|
122
133
|
* opts.isFile - function to synchronously test whether a file exists
|
|
123
134
|
|
|
135
|
+
* opts.isDirectory - function to synchronously test whether a directory exists
|
|
136
|
+
|
|
124
137
|
* `opts.packageFilter(pkg, dir)` - transform the parsed package.json contents before looking at the "main" field
|
|
125
138
|
* pkg - package data
|
|
126
139
|
* dir - directory for package.json (Note: the second argument will change to "pkgfile" in v2)
|
|
@@ -157,6 +170,15 @@ default `opts` values:
|
|
|
157
170
|
}
|
|
158
171
|
return stat.isFile() || stat.isFIFO();
|
|
159
172
|
},
|
|
173
|
+
isDirectory: function isDirectory(dir) {
|
|
174
|
+
try {
|
|
175
|
+
var stat = fs.statSync(dir);
|
|
176
|
+
} catch (e) {
|
|
177
|
+
if (e && (e.code === 'ENOENT' || e.code === 'ENOTDIR')) return false;
|
|
178
|
+
throw e;
|
|
179
|
+
}
|
|
180
|
+
return stat.isDirectory();
|
|
181
|
+
},
|
|
160
182
|
moduleDirectory: 'node_modules',
|
|
161
183
|
preserveSymlinks: true
|
|
162
184
|
}
|
|
@@ -8,12 +8,18 @@ test('mock', function (t) {
|
|
|
8
8
|
var files = {};
|
|
9
9
|
files[path.resolve('/foo/bar/baz.js')] = 'beep';
|
|
10
10
|
|
|
11
|
+
var dirs = {};
|
|
12
|
+
dirs[path.resolve('/foo/bar')] = true;
|
|
13
|
+
|
|
11
14
|
function opts(basedir) {
|
|
12
15
|
return {
|
|
13
16
|
basedir: path.resolve(basedir),
|
|
14
17
|
isFile: function (file, cb) {
|
|
15
18
|
cb(null, Object.prototype.hasOwnProperty.call(files, path.resolve(file)));
|
|
16
19
|
},
|
|
20
|
+
isDirectory: function (dir, cb) {
|
|
21
|
+
cb(null, !!dirs[path.resolve(dir)]);
|
|
22
|
+
},
|
|
17
23
|
readFile: function (file, cb) {
|
|
18
24
|
cb(null, files[path.resolve(file)]);
|
|
19
25
|
}
|
|
@@ -49,12 +55,18 @@ test('mock from package', function (t) {
|
|
|
49
55
|
var files = {};
|
|
50
56
|
files[path.resolve('/foo/bar/baz.js')] = 'beep';
|
|
51
57
|
|
|
58
|
+
var dirs = {};
|
|
59
|
+
dirs[path.resolve('/foo/bar')] = true;
|
|
60
|
+
|
|
52
61
|
function opts(basedir) {
|
|
53
62
|
return {
|
|
54
63
|
basedir: path.resolve(basedir),
|
|
55
64
|
isFile: function (file, cb) {
|
|
56
65
|
cb(null, Object.prototype.hasOwnProperty.call(files, file));
|
|
57
66
|
},
|
|
67
|
+
isDirectory: function (dir, cb) {
|
|
68
|
+
cb(null, !!dirs[path.resolve(dir)]);
|
|
69
|
+
},
|
|
58
70
|
'package': { main: 'bar' },
|
|
59
71
|
readFile: function (file, cb) {
|
|
60
72
|
cb(null, files[file]);
|
|
@@ -94,12 +106,19 @@ test('mock package', function (t) {
|
|
|
94
106
|
main: './baz.js'
|
|
95
107
|
});
|
|
96
108
|
|
|
109
|
+
var dirs = {};
|
|
110
|
+
dirs[path.resolve('/foo')] = true;
|
|
111
|
+
dirs[path.resolve('/foo/node_modules')] = true;
|
|
112
|
+
|
|
97
113
|
function opts(basedir) {
|
|
98
114
|
return {
|
|
99
115
|
basedir: path.resolve(basedir),
|
|
100
116
|
isFile: function (file, cb) {
|
|
101
117
|
cb(null, Object.prototype.hasOwnProperty.call(files, path.resolve(file)));
|
|
102
118
|
},
|
|
119
|
+
isDirectory: function (dir, cb) {
|
|
120
|
+
cb(null, !!dirs[path.resolve(dir)]);
|
|
121
|
+
},
|
|
103
122
|
readFile: function (file, cb) {
|
|
104
123
|
cb(null, files[path.resolve(file)]);
|
|
105
124
|
}
|
|
@@ -122,12 +141,19 @@ test('mock package from package', function (t) {
|
|
|
122
141
|
main: './baz.js'
|
|
123
142
|
});
|
|
124
143
|
|
|
144
|
+
var dirs = {};
|
|
145
|
+
dirs[path.resolve('/foo')] = true;
|
|
146
|
+
dirs[path.resolve('/foo/node_modules')] = true;
|
|
147
|
+
|
|
125
148
|
function opts(basedir) {
|
|
126
149
|
return {
|
|
127
150
|
basedir: path.resolve(basedir),
|
|
128
151
|
isFile: function (file, cb) {
|
|
129
152
|
cb(null, Object.prototype.hasOwnProperty.call(files, path.resolve(file)));
|
|
130
153
|
},
|
|
154
|
+
isDirectory: function (dir, cb) {
|
|
155
|
+
cb(null, !!dirs[path.resolve(dir)]);
|
|
156
|
+
},
|
|
131
157
|
'package': { main: 'bar' },
|
|
132
158
|
readFile: function (file, cb) {
|
|
133
159
|
cb(null, files[path.resolve(file)]);
|
|
@@ -8,14 +8,20 @@ test('mock', function (t) {
|
|
|
8
8
|
var files = {};
|
|
9
9
|
files[path.resolve('/foo/bar/baz.js')] = 'beep';
|
|
10
10
|
|
|
11
|
+
var dirs = {};
|
|
12
|
+
dirs[path.resolve('/foo/bar')] = true;
|
|
13
|
+
|
|
11
14
|
function opts(basedir) {
|
|
12
15
|
return {
|
|
13
16
|
basedir: path.resolve(basedir),
|
|
14
17
|
isFile: function (file) {
|
|
15
|
-
return Object.prototype.hasOwnProperty.call(files, file);
|
|
18
|
+
return Object.prototype.hasOwnProperty.call(files, path.resolve(file));
|
|
19
|
+
},
|
|
20
|
+
isDirectory: function (dir) {
|
|
21
|
+
return !!dirs[path.resolve(dir)];
|
|
16
22
|
},
|
|
17
23
|
readFileSync: function (file) {
|
|
18
|
-
return files[file];
|
|
24
|
+
return files[path.resolve(file)];
|
|
19
25
|
}
|
|
20
26
|
};
|
|
21
27
|
}
|
|
@@ -48,14 +54,21 @@ test('mock package', function (t) {
|
|
|
48
54
|
main: './baz.js'
|
|
49
55
|
});
|
|
50
56
|
|
|
57
|
+
var dirs = {};
|
|
58
|
+
dirs[path.resolve('/foo')] = true;
|
|
59
|
+
dirs[path.resolve('/foo/node_modules')] = true;
|
|
60
|
+
|
|
51
61
|
function opts(basedir) {
|
|
52
62
|
return {
|
|
53
63
|
basedir: path.resolve(basedir),
|
|
54
64
|
isFile: function (file) {
|
|
55
|
-
return Object.prototype.hasOwnProperty.call(files, file);
|
|
65
|
+
return Object.prototype.hasOwnProperty.call(files, path.resolve(file));
|
|
66
|
+
},
|
|
67
|
+
isDirectory: function (dir) {
|
|
68
|
+
return !!dirs[path.resolve(dir)];
|
|
56
69
|
},
|
|
57
70
|
readFileSync: function (file) {
|
|
58
|
-
return files[file];
|
|
71
|
+
return files[path.resolve(file)];
|
|
59
72
|
}
|
|
60
73
|
};
|
|
61
74
|
}
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: govuk_publishing_components
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 16.
|
|
4
|
+
version: 16.19.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- GOV.UK Dev
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2019-05-
|
|
11
|
+
date: 2019-05-16 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: gds-api-adapters
|