generated from nl-design-system/example
/
@stencil+core+2.14.0.patch
27 lines (27 loc) · 1.68 KB
/
@stencil+core+2.14.0.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
diff --git a/node_modules/@stencil/core/internal/client/index.js b/node_modules/@stencil/core/internal/client/index.js
index 69baa50..6fbf427 100644
--- a/node_modules/@stencil/core/internal/client/index.js
+++ b/node_modules/@stencil/core/internal/client/index.js
@@ -275,6 +275,11 @@ const addStyle = (styleContainerNode, cmpMeta, mode, hostElm) => {
if (BUILD.hydrateServerSide || BUILD.hotModuleReplacement) {
styleElm.setAttribute(HYDRATED_STYLE_ID, scopeId);
}
+ const nonceElm = styleContainerNode.ownerDocument.querySelector('style[nonce]');
+ if (nonceElm) {
+ styleElm.setAttribute('nonce', nonceElm.getAttribute('nonce'));
+ console.log(`CSP nonce-${nonceElm.getAttribute('nonce')}`);
+ }
styleContainerNode.insertBefore(styleElm, styleContainerNode.querySelector('link'));
}
if (appliedStyles) {
@@ -2685,6 +2690,10 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
if (BUILD.invisiblePrehydration && (BUILD.hydratedClass || BUILD.hydratedAttribute)) {
visibilityStyle.innerHTML = cmpTags + HYDRATED_CSS;
visibilityStyle.setAttribute('data-styles', '');
+ const nonceElm = visibilityStyle.ownerDocument.querySelector('style[nonce]');
+ if (nonceElm) {
+ visibilityStyle.setAttribute('nonce', nonceElm.getAttribute('nonce'));
+ }
head.insertBefore(visibilityStyle, metaCharset ? metaCharset.nextSibling : head.firstChild);
}
// Process deferred connectedCallbacks now all components have been registered