diff --git a/index.d.ts b/index.d.ts index 101e02f..11e615c 100644 --- a/index.d.ts +++ b/index.d.ts @@ -1,11 +1,12 @@ -import { Adapter } from '@sveltejs/kit'; +import { Adapter } from "@sveltejs/kit"; export interface AdapterOptions { - pages?: string; - assets?: string; - fallback?: string; - precompress?: boolean; - strict?: boolean; + pages?: string; + assets?: string; + fallback?: string; + precompress?: boolean; + strict?: boolean; + policy?: string; } export default function plugin(options?: AdapterOptions): Adapter; diff --git a/index.js b/index.js index 1aa08e5..485cbdd 100644 --- a/index.js +++ b/index.js @@ -114,6 +114,21 @@ See https://kit.svelte.dev/docs/page-options#prerender for more details` }); }); + let regex_input = new RegExp( + `http-equiv="content-security-policy" content=""`, + "g" + ); + const policy = ""; + let regex_replace = `http-equiv="content-security-policy" content="${ + options?.policy ? options.policy : policy + }"`; + + await replace.sync({ + files: [pages + "/**/*.html"], + // @ts-ignore + processor: (input) => input.replace(regex_input, regex_replace), + }); + const HTML_assets = await glob("_app/**/*", { cwd: pages, dot: true,