1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 | const prettyBytes = require('pretty-bytes');
|
10 |
|
11 | module.exports = (maximumFileSizeToCacheInBytes) => {
|
12 | return (originalManifest) => {
|
13 | const warnings = [];
|
14 | const manifest = originalManifest.filter((entry) => {
|
15 | if (entry.size <= maximumFileSizeToCacheInBytes) {
|
16 | return true;
|
17 | }
|
18 |
|
19 | warnings.push(`${entry.url} is ${prettyBytes(entry.size)}, and won't ` +
|
20 | `be precached. Configure maximumFileSizeToCacheInBytes to change ` +
|
21 | `this limit.`);
|
22 | return false;
|
23 | });
|
24 |
|
25 | return {manifest, warnings};
|
26 | };
|
27 | };
|