UNPKG

webpack-userscript

Version:
34 lines 1.24 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.FixTags = void 0; const feature_1 = require("./feature"); class FixTags extends feature_1.Feature { constructor() { super(...arguments); this.name = 'FixTags'; this.fixableTagNames = new Map([ ['updateUrl', 'updateURL'], ['iconUrl', 'iconURL'], ['icon64Url', 'icon64URL'], ['installUrl', 'installURL'], ['supportUrl', 'supportURL'], ['downloadUrl', 'downloadURL'], ['homepageUrl', 'homepageURL'], ]); } apply({ hooks }) { hooks.headers.tap(this.name, (headers) => { for (const [source, target] of this.fixableTagNames) { if (headers[source] !== undefined) { if (headers[target] !== undefined) { throw new Error(`ambiguous tags: ("${source}", "${target}")`); } headers = Object.assign(Object.assign({}, headers), { [source]: undefined, [target]: headers[source] }); } } return headers; }); } } exports.FixTags = FixTags; //# sourceMappingURL=fix-tags.js.map