From 393306a31e0afe7d83e4593df5908aa99bf9aa07 Mon Sep 17 00:00:00 2001 From: mertsincan Date: Wed, 24 Jan 2024 12:08:37 +0000 Subject: [PATCH] Update nuxt-primevue module --- modules/nuxt-primevue/module.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/modules/nuxt-primevue/module.js b/modules/nuxt-primevue/module.js index 806a8eeb6..9f2eda685 100644 --- a/modules/nuxt-primevue/module.js +++ b/modules/nuxt-primevue/module.js @@ -38,7 +38,7 @@ export default defineNuxtModule({ setup(moduleOptions, nuxt) { const resolver = createResolver(import.meta.url); const registered = register(moduleOptions); - const { importPT } = moduleOptions; + const { importPT, options } = moduleOptions; nuxt.options.runtimeConfig.public.primevue = { ...moduleOptions, @@ -50,10 +50,12 @@ export default defineNuxtModule({ const styleContent = () => ` ${registered.styles.map((style) => `import ${style.as} from '${style.from}';`).join('\n')} - +const styleProps = { + ${options?.csp?.nonce ? `nonce: ${options?.csp?.nonce}` : ''} +} const styles = [ ${registered.injectStylesAsString.join('')}, - ${registered.styles.map((item) => `${item.as} && ${item.as}.getStyleSheet ? ${item.as}.getStyleSheet() : ''`).join(',')} + ${registered.styles.map((item) => `${item.as} && ${item.as}.getStyleSheet ? ${item.as}.getStyleSheet(undefined, styleProps) : ''`).join(',')} ].join(''); export { styles };