@hotwired/turbo 8.0.10 → 8.0.12

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.
@@ -1,5 +1,5 @@
1
1
  /*!
2
- Turbo 8.0.10
2
+ Turbo 8.0.12
3
3
  Copyright © 2024 37signals LLC
4
4
  */
5
5
  /**
@@ -313,7 +313,7 @@ function activateScriptElement(element) {
313
313
  return element
314
314
  } else {
315
315
  const createdScriptElement = document.createElement("script");
316
- const cspNonce = getMetaContent("csp-nonce");
316
+ const cspNonce = getCspNonce();
317
317
  if (cspNonce) {
318
318
  createdScriptElement.nonce = cspNonce;
319
319
  }
@@ -486,6 +486,15 @@ function getMetaContent(name) {
486
486
  return element && element.content
487
487
  }
488
488
 
489
+ function getCspNonce() {
490
+ const element = getMetaElement("csp-nonce");
491
+
492
+ if (element) {
493
+ const { nonce, content } = element;
494
+ return nonce == "" ? content : nonce
495
+ }
496
+ }
497
+
489
498
  function setMetaContent(name, content) {
490
499
  let element = getMetaElement(name);
491
500
 
@@ -3035,8 +3044,9 @@ class ProgressBar {
3035
3044
  const element = document.createElement("style");
3036
3045
  element.type = "text/css";
3037
3046
  element.textContent = ProgressBar.defaultCSS;
3038
- if (this.cspNonce) {
3039
- element.nonce = this.cspNonce;
3047
+ const cspNonce = getCspNonce();
3048
+ if (cspNonce) {
3049
+ element.nonce = cspNonce;
3040
3050
  }
3041
3051
  return element
3042
3052
  }
@@ -3046,10 +3056,6 @@ class ProgressBar {
3046
3056
  element.className = "turbo-progress-bar";
3047
3057
  return element
3048
3058
  }
3049
-
3050
- get cspNonce() {
3051
- return getMetaContent("csp-nonce")
3052
- }
3053
3059
  }
3054
3060
 
3055
3061
  class HeadSnapshot extends Snapshot {
@@ -1,5 +1,5 @@
1
1
  /*!
2
- Turbo 8.0.10
2
+ Turbo 8.0.12
3
3
  Copyright © 2024 37signals LLC
4
4
  */
5
5
  (function (global, factory) {
@@ -319,7 +319,7 @@ Copyright © 2024 37signals LLC
319
319
  return element
320
320
  } else {
321
321
  const createdScriptElement = document.createElement("script");
322
- const cspNonce = getMetaContent("csp-nonce");
322
+ const cspNonce = getCspNonce();
323
323
  if (cspNonce) {
324
324
  createdScriptElement.nonce = cspNonce;
325
325
  }
@@ -492,6 +492,15 @@ Copyright © 2024 37signals LLC
492
492
  return element && element.content
493
493
  }
494
494
 
495
+ function getCspNonce() {
496
+ const element = getMetaElement("csp-nonce");
497
+
498
+ if (element) {
499
+ const { nonce, content } = element;
500
+ return nonce == "" ? content : nonce
501
+ }
502
+ }
503
+
495
504
  function setMetaContent(name, content) {
496
505
  let element = getMetaElement(name);
497
506
 
@@ -3041,8 +3050,9 @@ Copyright © 2024 37signals LLC
3041
3050
  const element = document.createElement("style");
3042
3051
  element.type = "text/css";
3043
3052
  element.textContent = ProgressBar.defaultCSS;
3044
- if (this.cspNonce) {
3045
- element.nonce = this.cspNonce;
3053
+ const cspNonce = getCspNonce();
3054
+ if (cspNonce) {
3055
+ element.nonce = cspNonce;
3046
3056
  }
3047
3057
  return element
3048
3058
  }
@@ -3052,10 +3062,6 @@ Copyright © 2024 37signals LLC
3052
3062
  element.className = "turbo-progress-bar";
3053
3063
  return element
3054
3064
  }
3055
-
3056
- get cspNonce() {
3057
- return getMetaContent("csp-nonce")
3058
- }
3059
3065
  }
3060
3066
 
3061
3067
  class HeadSnapshot extends Snapshot {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hotwired/turbo",
3
- "version": "8.0.10",
3
+ "version": "8.0.12",
4
4
  "description": "The speed of a single-page web application without having to write any JavaScript",
5
5
  "module": "dist/turbo.es2017-esm.js",
6
6
  "main": "dist/turbo.es2017-umd.js",