Urara-Blog/node_modules/.pnpm-store/v3/files/02/eafd1f6ae6e9a4bd3bcfef23b3ded32ebc963911148c26d716ae71da1dce0ea5927297e5bb8177b495ada5d60228bd977ed1e1683b75673194242c2736bd32
2022-08-14 01:14:53 +08:00

34 lines
787 B
Text

/*
Copyright 2018 Google LLC
Use of this source code is governed by an MIT-style
license that can be found in the LICENSE file or at
https://opensource.org/licenses/MIT.
*/
import {errors} from './errors';
import {ManifestTransform} from '../types';
export function noRevisionForURLsMatchingTransform(
regexp: RegExp,
): ManifestTransform {
if (!(regexp instanceof RegExp)) {
throw new Error(errors['invalid-dont-cache-bust']);
}
return (originalManifest) => {
const manifest = originalManifest.map((entry) => {
if (typeof entry.url !== 'string') {
throw new Error(errors['manifest-entry-bad-url']);
}
if (entry.url.match(regexp)) {
entry.revision = null;
}
return entry;
});
return {manifest};
};
}