|
Last change
on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 12 days ago |
|
Fix frontend appearance
|
-
Property mode
set to
100644
|
|
File size:
787 bytes
|
| Line | |
|---|
| 1 | /*
|
|---|
| 2 | Copyright 2018 Google LLC
|
|---|
| 3 |
|
|---|
| 4 | Use of this source code is governed by an MIT-style
|
|---|
| 5 | license that can be found in the LICENSE file or at
|
|---|
| 6 | https://opensource.org/licenses/MIT.
|
|---|
| 7 | */
|
|---|
| 8 |
|
|---|
| 9 | import {errors} from './errors';
|
|---|
| 10 | import {ManifestTransform} from '../types';
|
|---|
| 11 |
|
|---|
| 12 | export function noRevisionForURLsMatchingTransform(
|
|---|
| 13 | regexp: RegExp,
|
|---|
| 14 | ): ManifestTransform {
|
|---|
| 15 | if (!(regexp instanceof RegExp)) {
|
|---|
| 16 | throw new Error(errors['invalid-dont-cache-bust']);
|
|---|
| 17 | }
|
|---|
| 18 |
|
|---|
| 19 | return (originalManifest) => {
|
|---|
| 20 | const manifest = originalManifest.map((entry) => {
|
|---|
| 21 | if (typeof entry.url !== 'string') {
|
|---|
| 22 | throw new Error(errors['manifest-entry-bad-url']);
|
|---|
| 23 | }
|
|---|
| 24 |
|
|---|
| 25 | if (entry.url.match(regexp)) {
|
|---|
| 26 | entry.revision = null;
|
|---|
| 27 | }
|
|---|
| 28 |
|
|---|
| 29 | return entry;
|
|---|
| 30 | });
|
|---|
| 31 |
|
|---|
| 32 | return {manifest};
|
|---|
| 33 | };
|
|---|
| 34 | }
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.