vite-plugin-csp-guard
Version:
A Vite plugin that lets SPA applications generate a Content Security Policy (CSP).
15 lines • 1.11 kB
TypeScript
import type { Rolldown } from "vite";
import { Node } from "estree";
/**
* There are 3 approaches to getting this CSS in JS detection to work:
* 1. Use the AST during the moduleParsed hook to look for CSS in JS syntax and then store the result in a map. - This is the most accurate, and the most lightweight/scalable approach however its also the most complex.
* 2. Look for the CSS at build time inside each chunk and then store the result in a map. This could be easy to do, but probably not that accurate due to us being forced to use regex, there will be some edge cases that we miss.
* 3. Use LinkeDOM a JSOM alternative, to actually load the JS and CSS and then look for the CSS syntax in the DOM. This will be more accurate, however more heavy - especially when we have to account for lazy loading
*/
interface HandleModuleParsedProps {
info: Rolldown.ModuleInfo;
}
export declare const unstable_handleModuleParsed: ({ info, }: HandleModuleParsedProps) => void;
export declare const extractCSSFromTaggedTemplate: (node: Node) => string | null;
export {};
//# sourceMappingURL=index.d.ts.map