1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 | const errors = require('./errors');
|
10 |
|
11 | module.exports = (regexp) => {
|
12 | if (!(regexp instanceof RegExp)) {
|
13 | throw new Error(errors['invalid-dont-cache-bust']);
|
14 | }
|
15 |
|
16 | return (originalManifest) => {
|
17 | const manifest = originalManifest.map((entry) => {
|
18 | if (typeof entry.url !== 'string') {
|
19 | throw new Error(errors['manifest-entry-bad-url']);
|
20 | }
|
21 |
|
22 | if (entry.url.match(regexp)) {
|
23 | delete entry.revision;
|
24 | }
|
25 |
|
26 | return entry;
|
27 | });
|
28 |
|
29 | return {manifest};
|
30 | };
|
31 | };
|