UNPKG

vite-plugin-csp-guard

Version:

A Vite plugin that lets SPA applications generate a Content Security Policy (CSP).

27 lines 1.02 kB
import { BundleContext, HashAlgorithms, HashCollection } from "../types"; import { PluginContext } from "rollup"; import { CSPPolicy } from "csp-toolkit"; /** * TODO: Support correct warning logging of truly external scripts and styles. */ type handleIndexHtmlProps = { html: string; algorithm: HashAlgorithms; collection: HashCollection; policy: CSPPolicy; context: PluginContext | undefined; bundleContext?: BundleContext; }; /** * Looks at the html and scans it for inline scripts, external scripts, inline styles and external styles, so that we can warn the user if they are missing from the policy * @param html * @param mainBundleCode * @returns */ export declare function handleIndexHtml({ html, algorithm, collection: HASH_COLLECTION, policy, bundleContext, }: handleIndexHtmlProps): { HASH_COLLECTION: HashCollection; html: string; }; export declare const handleCSPInsert: (html: string, policy: string) => string; export {}; //# sourceMappingURL=handleIndexHtml.d.ts.map