fix treeshaking

pull/16271/head
7nik 2 months ago committed by GitHub
parent 5673d60424
commit b3ba3c72f6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -1,20 +1,18 @@
/** @import { TrustedTypePolicy } from 'trusted-types' */ /** @import { TrustedTypePolicy } from 'trusted-types' */
/** @type {Pick<TrustedTypePolicy, 'createHTML'> | undefined} */ const policy = /* @__PURE__ */ globalThis?.window?.trustedTypes?.createPolicy(
let policy; 'svelte-trusted-html',
{
if (globalThis?.window?.trustedTypes) {
policy = globalThis.window.trustedTypes.createPolicy('svelte-trusted-html', {
/** @param {string} html */ /** @param {string} html */
createHTML: (html) => { createHTML: (html) => {
return html; return html;
} }
}); }
} );
/** @param {string} html */ /** @param {string} html */
function create_trusted_html(html) { function create_trusted_html(html) {
return /** @type {string} */(policy?.createHTML(html) ?? html); return /** @type {string} */ (policy?.createHTML(html) ?? html);
} }
/** @param {string} html */ /** @param {string} html */

Loading…
Cancel
Save