UNPKG

webpack-userscript

Version:
43 lines (42 loc) 1.32 kB
/// <reference types="node" /> import { IntegrityMap } from 'ssri'; import { URL } from 'url'; import { UserscriptPluginInstance } from '../types'; import { Feature } from './feature'; export type RawSSRILock = Record<string, string>; export type SSRILock = Record<string, IntegrityMap>; export type SSRIAlgorithm = 'sha256' | 'sha384' | 'sha512'; export type SSRITag = 'require' | 'resource'; export type URLFilter = (tag: SSRITag, value: URL) => boolean; export interface SSRIFeatureOptions { include?: URLFilter; exclude?: URLFilter; algorithms?: SSRIAlgorithm[]; strict?: boolean; lock?: boolean | string; concurrency?: number; } export interface SSRIOptions { root?: string; ssri?: SSRIFeatureOptions; } export declare class ProcessSSRI extends Feature<SSRIOptions> { readonly name = "ProcessSSRI"; readonly allowedProtocols: Set<string>; private ssriLockDirty; private ssriLock; private readonly limit; apply({ hooks }: UserscriptPluginInstance): void; private getSSRILockFile; private getTargetURLs; private normalizeURL; private filterURL; private computeSSRI; private parseSSRILike; private parseSSRILock; private toRawSSRILock; private parseURL; private stringifyURL; private updateURL; private patchHeaders; }