@netlify/plugin-csp-nonce 1.2.4 → 1.2.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "private": false,
3
3
  "name": "@netlify/plugin-csp-nonce",
4
- "version": "1.2.4",
4
+ "version": "1.2.5",
5
5
  "description": "Use a nonce for the script-src and style-src directives of your Content Security Policy.",
6
6
  "main": "index.js",
7
7
  "repository": {
@@ -112,8 +112,9 @@ const handler = async (request: Request, context: Context) => {
112
112
  response.headers.set(header, value);
113
113
  }
114
114
 
115
+ const querySelectors = ["script", 'link[rel="preload"][as="script"]'];
115
116
  return new HTMLRewriter()
116
- .on("script", {
117
+ .on(querySelectors.join(","), {
117
118
  element(element: HTMLElement) {
118
119
  element.setAttribute("nonce", nonce);
119
120
  },